Skip to content

Commit

Permalink
Delete CAS1 lost beds from lost_beds and lost_bed_cancellations tables
Browse files Browse the repository at this point in the history
  • Loading branch information
Muhammad El Abdulla committed Jan 9, 2025
1 parent a4f5b00 commit b55f68c
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
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;

DELETE FROM lost_bed_cancellations
WHERE lost_bed_id in(
SELECT id
FROM lost_beds
where premises_id in (select id from premises where service='approved-premises'));

DELETE FROM lost_beds
where premises_id in (select id from premises where service='approved-premises');

ALTER TABLE lost_beds RENAME TO cas3_void_bedspaces;

ALTER TABLE lost_bed_cancellations RENAME TO cas3_void_bedspace_cancellations;
Expand Down

0 comments on commit b55f68c

Please sign in to comment.