mirror of
https://gitlab.com/mbugroup/lti-api.git
synced 2026-05-20 21:41:55 +00:00
17 lines
639 B
SQL
17 lines
639 B
SQL
-- Drop existing FK constraints
|
|
ALTER TABLE expense_nonstocks DROP CONSTRAINT IF EXISTS fk_expense_nonstocks_expense_id;
|
|
|
|
-- Recreate with ON DELETE CASCADE
|
|
ALTER TABLE expense_nonstocks
|
|
ADD CONSTRAINT fk_expense_nonstocks_expense_id
|
|
FOREIGN KEY (expense_id) REFERENCES expenses(id)
|
|
ON DELETE CASCADE;
|
|
|
|
-- Drop and recreate expense_realizations FK
|
|
ALTER TABLE expense_realizations DROP CONSTRAINT IF EXISTS fk_expense_realizations_nonstock_id;
|
|
|
|
ALTER TABLE expense_realizations
|
|
ADD CONSTRAINT fk_expense_realizations_nonstock_id
|
|
FOREIGN KEY (expense_nonstock_id) REFERENCES expense_nonstocks(id)
|
|
ON DELETE CASCADE;
|