Commit 3a91107a authored by catch's avatar catch
Browse files

Issue #3487533 by mglaman, catch, larowlan, wim leers, daffie, longwave:...

Issue #3487533 by mglaman, catch, larowlan, wim leers, daffie, longwave: Cannot modify a table which uses JSON type

(cherry picked from commit 75dcfd20)
parent 1068d9ce
Loading
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -249,6 +249,11 @@ public function getFieldTypeMap() {

      'blob:big'        => 'BLOB',
      'blob:normal'     => 'BLOB',

      // Only the SQLite driver has this field map to due to a fatal error
      // error caused by this driver's schema on table introspection.
      // @todo Add support to all drivers in https://drupal.org/i/3343634
      'json:normal'     => 'JSON',
    ];
    return $map;
  }
+10 −0
Original line number Diff line number Diff line
@@ -272,6 +272,16 @@ public function testSchema(): void {
    // Test the primary key columns.
    $this->assertSame(['test_serial', 'test_composite_primary_key'], $method->invoke($this->schema, 'test_table'));

    // Test adding and removing JSON column.
    $this->schema->addField('test_table', 'test_json', [
      'description' => 'I heard you liked JSON.',
      'type' => 'json',
      'pgsql_type' => 'jsonb',
      'mysql_type' => 'json',
      'sqlite_type' => 'json',
    ]);
    $this->schema->dropField('test_table', 'test_json');

    // Test renaming of keys and constraints.
    $this->schema->dropTable('test_table');
    $table_specification = [