init push

This commit is contained in:
2026-07-16 22:16:45 +07:00
commit 8b068bdb10
1021 changed files with 332816 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
-- +goose Up
-- Rewire crew FK to point at duty_rosters.
ALTER TABLE duty_roster_crews
DROP FOREIGN KEY fk_hems_duty_rosters_crews,
ADD CONSTRAINT fk_duty_roster_crews_roster
FOREIGN KEY (roster_id) REFERENCES duty_rosters(id)
ON DELETE CASCADE
ON UPDATE CASCADE;
ALTER TABLE duty_roster_other_persons
DROP FOREIGN KEY fk_duty_roster_other_persons_roster,
ADD CONSTRAINT fk_duty_roster_other_persons_roster
FOREIGN KEY (roster_id) REFERENCES duty_rosters(id)
ON DELETE CASCADE
ON UPDATE CASCADE;
-- +goose Down
-- Restore crew FK back to the legacy table.
ALTER TABLE duty_roster_crews
DROP FOREIGN KEY fk_duty_roster_crews_roster,
ADD CONSTRAINT fk_hems_duty_rosters_crews
FOREIGN KEY (roster_id) REFERENCES hems_duty_rosters(id)
ON DELETE CASCADE
ON UPDATE CASCADE;
ALTER TABLE duty_roster_other_persons
DROP FOREIGN KEY fk_duty_roster_other_persons_roster,
ADD CONSTRAINT fk_duty_roster_other_persons_roster
FOREIGN KEY (roster_id) REFERENCES hems_duty_rosters(id)
ON DELETE CASCADE
ON UPDATE CASCADE;