diff --git a/core/modules/migrate/src/Plugin/migrate/id_map/Sql.php b/core/modules/migrate/src/Plugin/migrate/id_map/Sql.php index 37c1c32b57..24ff8c702b 100644 --- a/core/modules/migrate/src/Plugin/migrate/id_map/Sql.php +++ b/core/modules/migrate/src/Plugin/migrate/id_map/Sql.php @@ -441,6 +441,9 @@ protected function ensureTables() { 'description' => 'Messages generated during a migration process', 'fields' => $fields, 'primary key' => ['msgid'], + 'unique keys' => [ + $this::SOURCE_IDS_HASH => [$this::SOURCE_IDS_HASH], + ], ]; $this->getDatabase()->schema()->createTable($this->messageTableName(), $schema); } diff --git a/core/modules/migrate/tests/src/Unit/MigrateSqlIdMapEnsureTablesTest.php b/core/modules/migrate/tests/src/Unit/MigrateSqlIdMapEnsureTablesTest.php index 826087933c..41db4fb299 100644 --- a/core/modules/migrate/tests/src/Unit/MigrateSqlIdMapEnsureTablesTest.php +++ b/core/modules/migrate/tests/src/Unit/MigrateSqlIdMapEnsureTablesTest.php @@ -109,6 +109,9 @@ public function testEnsureTablesNotExist() { 'description' => 'Messages generated during a migration process', 'fields' => $fields, 'primary key' => ['msgid'], + 'unique keys' => [ + 'source_ids_hash' => ['source_ids_hash'], + ], ]; $schema = $this->getMockBuilder('Drupal\Core\Database\Schema')