Skip to content

Commit

Permalink
Merge pull request #2774 from ministryofjustice/CAS-1343-update-lostb…
Browse files Browse the repository at this point in the history
…ed-tables-constraints

CAS1343 Update lost bed tables constraints
  • Loading branch information
muhammad-elabdulla authored Jan 8, 2025
2 parents 9a9ad8d + 48a6c7b commit a4f5b00
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
ALTER TABLE lost_beds DROP CONSTRAINT lost_bed_reason_id_fk;
ALTER TABLE lost_bed_cancellations DROP CONSTRAINT lost_bed_cancellations_lost_bed_id_fkey;

ALTER TABLE lost_beds RENAME TO cas3_void_bedspaces;

ALTER TABLE lost_bed_cancellations RENAME TO cas3_void_bedspace_cancellations;
Expand All @@ -7,4 +10,7 @@ ALTER TABLE lost_bed_reasons DROP COLUMN service_scope;
ALTER TABLE lost_bed_reasons RENAME TO cas3_void_bedspace_reasons;

ALTER TABLE cas3_void_bedspaces RENAME COLUMN lost_bed_reason_id TO cas3_void_bedspace_reason_id;
ALTER TABLE cas3_void_bedspace_cancellations RENAME COLUMN lost_bed_id TO cas3_void_bedspace_id;
ALTER TABLE cas3_void_bedspaces ADD CONSTRAINT cas3_void_bedspaces_cas3_void_bedspace_reason_id_fk FOREIGN KEY (cas3_void_bedspace_reason_id) REFERENCES cas3_void_bedspace_reasons(id);

ALTER TABLE cas3_void_bedspace_cancellations RENAME COLUMN lost_bed_id TO cas3_void_bedspace_id;
ALTER TABLE cas3_void_bedspace_cancellations ADD CONSTRAINT cas3_void_bedspace_cancellations_cas3_void_bedspace_id_fk FOREIGN KEY (cas3_void_bedspace_id) REFERENCES cas3_void_bedspaces(id);

0 comments on commit a4f5b00

Please sign in to comment.