Skip to content

Commit

Permalink
fix(migrations): change the order of queries for mysql
Browse files Browse the repository at this point in the history
Signed-off-by: Roman Dmytrenko <rdmytrenko@gmail.com>
  • Loading branch information
erka committed May 1, 2024
1 parent 2868dd3 commit d08c159
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions config/migrations/mysql/5_namespaces_relationships.up.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d08c159

Please sign in to comment.