Commit fff0768d authored by Damien McKenna's avatar Damien McKenna Committed by Damien McKenna
Browse files

Issue #3314495 by DamienMcKenna, alexpott: Docs/UI improvements.

parent 067edbc8
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ JSON Field 8.x-1.x-dev, xxxx-xx-xx
#3314477 by DamienMcKenna: core/jquery.once library rewritten in 9.2+.
#3093318 by pelegr, DamienMcKenna: JSON view does not work when field label is
  set to visible.
#3314495 by DamienMcKenna, alexpott: Docs/UI improvements.


JSON Field 8.x-1.0-rc4, 2021-05-13
+29 −8
Original line number Diff line number Diff line
@@ -5,15 +5,27 @@ tools to make editing it easier than using a plain text field.

## Supported field types

Three field types are provided by the module;
Three field types are provided by the module, but how each database system
supports them will vary:

* "JSON (stored as text in database)"
  This option uses a VARCHAR or TEXT column in the database.
* "JSON (stored as raw JSON in database)"
  Stores the data in a JSON column in the database.
* "JSONB/JSON (stored as raw JSONB in PostgreSQL)"
  On PostgreSQL the data will be stored in a JSONB column, on MySQL (or MariaDB)
  the data will be stored in a regular JSON column.
* "JSON (text)"
  This option uses a VARCHAR or TEXT column on all supported database systems.
* "JSON (raw)"
  MySQL: Stores as JSON.
  PostgreSQL: Stored as JSON.
  MariaDB: Stored as LONGTEXT
  Sqlite: Stored as TEXT.
* "JSONB/JSON (raw)"
  MySQL: Stores as JSON.
  PostgreSQL: Stored as JSONB.
  MariaDB: Stored as LONGTEXT
  Sqlite: Stored as TEXT.

### Notes

MariaDB uses a [LONGTEXT column to store JSON data](https://mariadb.com/kb/en/json-data-type/),
which will be confusing at first. However, it then supports queries executed
against the column.

## Installation

@@ -81,3 +93,12 @@ And add the libraries to your project with:
composer require yesmeck/jquery-jsonview
composer require josdejong/jsoneditor
```

## Issues with core

Using JSON columns will cause problems with core's database export script due
to it not directly supporting "json" field types; core issues exist to add the
necessary API changes:

* MySQL/MariaDB: https://www.drupal.org/project/drupal/issues/3143512
* PostgreSQL: https://www.drupal.org/project/drupal/issues/2472709
+1 −1
Original line number Diff line number Diff line
@@ -14,7 +14,7 @@ use Drupal\Core\TypedData\DataDefinition;
 *
 * @FieldType(
 *   id = "json",
 *   label = @Translation("JSON (stored as text in database)"),
 *   label = @Translation("JSON (text)"),
 *   description = @Translation("Allows JSON data to be stored in the database. In the database the content is stored in a text column."),
 *   category = @Translation("Data"),
 *   default_widget = "json_textarea",
+1 −1
Original line number Diff line number Diff line
@@ -10,7 +10,7 @@ use Drupal\Core\TypedData\DataDefinition;
 *
 * @FieldType(
 *   id = "json_native_binary",
 *   label = @Translation("JSONB/JSON (stored as raw JSONB in PostgreSQL)"),
 *   label = @Translation("JSONB/JSON (raw)"),
 *   description = @Translation("Allows JSON data to be stored in the database. On PostgreSQL the data is stored in a JSONB column, on MySQL it uses a regular JSON column."),
 *   category = @Translation("Data"),
 *   default_widget = "json_textarea",
+1 −1
Original line number Diff line number Diff line
@@ -11,7 +11,7 @@ use Drupal\Core\TypedData\DataDefinition;
 *
 * @FieldType(
 *   id = "json_native",
 *   label = @Translation("JSON (stored as raw JSON in database)"),
 *   label = @Translation("JSON (raw)"),
 *   description = @Translation("Allows JSON data to be stored in the database. Stores the data in a JSON column in the database."),
 *   category = @Translation("Data"),
 *   default_widget = "json_textarea",