diff --git a/config/migrations/mysql/5_namespaces_relationships.up.sql b/config/migrations/mysql/5_namespaces_relationships.up.sql index 14ec7289f1..7567c0cf9e 100644 --- a/config/migrations/mysql/5_namespaces_relationships.up.sql +++ b/config/migrations/mysql/5_namespaces_relationships.up.sql @@ -37,12 +37,12 @@ ALTER TABLE segments ADD COLUMN namespace_key VARCHAR(255) NOT NULL DEFAULT 'def -- Drop previously created unique index and add a new unique index on namespace_key and key columns ALTER TABLE segments DROP INDEX `key`, ADD INDEX `key` (`key`) USING BTREE; --- Add foreign key constraint on namespace_key column referencing key column of namespaces table -ALTER TABLE segments ADD FOREIGN KEY (namespace_key) REFERENCES namespaces(`key`) ON DELETE CASCADE; - -- Drop primary key constraint and add a new composite primary key on namespace_key and key columns ALTER TABLE segments DROP PRIMARY KEY, ADD PRIMARY KEY (`namespace_key`, `key`); +-- Add foreign key constraint on namespace_key column referencing key column of namespaces table +ALTER TABLE segments ADD FOREIGN KEY (namespace_key) REFERENCES namespaces(`key`) ON DELETE CASCADE; + -- Constraints -- Add column namespace_key with a default value