Skip to content

Commit

Permalink
[DSC-1848] Fixes V7.6_2024.04.23 Flyway script
Browse files Browse the repository at this point in the history
  • Loading branch information
vins01-4science committed Oct 14, 2024
1 parent 1dc1d2e commit 0ec6218
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,12 @@
-- Drop the NOT NULL constraint on user_id column
ALTER TABLE process ALTER COLUMN user_id DROP NOT NULL;

-- Sets null the invalid user_id inside the process table
UPDATE process
set user_id = null
where not exists(
select 1 from eperson where eperson.uuid = user_id
);

-- Add the foreign key constraint with ON DELETE SET NULL
ALTER TABLE process ADD CONSTRAINT user_id FOREIGN KEY (user_id) REFERENCES eperson (uuid) ON DELETE SET NULL;
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,12 @@
-- Drop the NOT NULL constraint on user_id column
ALTER TABLE process ALTER COLUMN user_id DROP NOT NULL;

-- Sets null the invalid user_id inside the process table
UPDATE process
set user_id = null
where not exists(
select 1 from eperson where eperson.uuid = user_id
);

-- Add the foreign key constraint with ON DELETE SET NULL
ALTER TABLE process ADD CONSTRAINT user_id FOREIGN KEY (user_id) REFERENCES eperson (uuid) ON DELETE SET NULL;

0 comments on commit 0ec6218

Please sign in to comment.