Skip to content
This repository has been archived by the owner on Aug 16, 2022. It is now read-only.

Commit

Permalink
fix: Add ON DELETE CASCADE to redshift snapshots. (#880)
Browse files Browse the repository at this point in the history
  • Loading branch information
irmatov authored May 11, 2022
1 parent 00197b5 commit 0009d0a
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 0 deletions.
6 changes: 6 additions & 0 deletions resources/provider/migrations/postgres/32_v0.11.6.down.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
-- aws_redshift_snapshots
ALTER TABLE IF EXISTS aws_redshift_snapshots DROP CONSTRAINT aws_redshift_snapshots_cluster_cq_id_fkey;
ALTER TABLE IF EXISTS aws_redshift_snapshots
ADD CONSTRAINT aws_redshift_snapshots_cluster_cq_id_fkey
FOREIGN KEY (cluster_cq_id)
REFERENCES aws_redshift_clusters(cq_id);
7 changes: 7 additions & 0 deletions resources/provider/migrations/postgres/32_v0.11.6.up.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
-- aws_redshift_snapshots
ALTER TABLE IF EXISTS aws_redshift_snapshots DROP CONSTRAINT aws_redshift_snapshots_cluster_cq_id_fkey;
ALTER TABLE IF EXISTS aws_redshift_snapshots
ADD CONSTRAINT aws_redshift_snapshots_cluster_cq_id_fkey
FOREIGN KEY (cluster_cq_id)
REFERENCES aws_redshift_clusters(cq_id)
ON DELETE CASCADE;
6 changes: 6 additions & 0 deletions resources/provider/migrations/timescale/32_v0.11.6.down.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
-- aws_redshift_snapshots
ALTER TABLE IF EXISTS aws_redshift_snapshots DROP CONSTRAINT aws_redshift_snapshots_cluster_cq_id_fkey;
ALTER TABLE IF EXISTS aws_redshift_snapshots
ADD CONSTRAINT aws_redshift_snapshots_cluster_cq_id_fkey
FOREIGN KEY (cq_fetch_date, cluster_cq_id)
REFERENCES aws_redshift_clusters(cq_fetch_date, cq_id);
7 changes: 7 additions & 0 deletions resources/provider/migrations/timescale/32_v0.11.6.up.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
-- aws_redshift_snapshots
ALTER TABLE IF EXISTS aws_redshift_snapshots DROP CONSTRAINT aws_redshift_snapshots_cluster_cq_id_fkey;
ALTER TABLE IF EXISTS aws_redshift_snapshots
ADD CONSTRAINT aws_redshift_snapshots_cluster_cq_id_fkey
FOREIGN KEY (cq_fetch_date, cluster_cq_id)
REFERENCES aws_redshift_clusters(cq_fetch_date, cq_id)
ON DELETE CASCADE;

0 comments on commit 0009d0a

Please sign in to comment.