diff --git a/internal/db/schema/migrations/oss/postgres/82/01_storage_policies.up.sql b/internal/db/schema/migrations/oss/postgres/82/01_storage_policies.up.sql index adf5078845..b72c542f9c 100644 --- a/internal/db/schema/migrations/oss/postgres/82/01_storage_policies.up.sql +++ b/internal/db/schema/migrations/oss/postgres/82/01_storage_policies.up.sql @@ -6,7 +6,6 @@ begin; create table policy ( public_id wt_public_id primary key, scope_id wt_scope_id not null - -- constraints replaced in internal/db/schema/migrations/postgres/91/01_storage_policies.up.sql constraint policy_scope_id_fkey references iam_scope(public_id) on delete restrict @@ -18,7 +17,6 @@ comment on table policy is create table policy_storage_policy ( public_id wt_public_id primary key, scope_id wt_scope_id not null - -- constraints replaced in internal/db/schema/migrations/postgres/91/01_storage_policies.up.sql constraint policy_storage_policy_scope_id_fkey references iam_scope(public_id) on delete restrict diff --git a/internal/db/schema/migrations/oss/postgres/91/01_storage_policies.up.sql b/internal/db/schema/migrations/oss/postgres/91/01_storage_policies.up.sql deleted file mode 100644 index bd17767174..0000000000 --- a/internal/db/schema/migrations/oss/postgres/91/01_storage_policies.up.sql +++ /dev/null @@ -1,25 +0,0 @@ --- Copyright (c) HashiCorp, Inc. --- SPDX-License-Identifier: BUSL-1.1 - -begin; - - -- replaces constraints from internal/db/schema/migrations/postgres/82/01_storage_policies.up.sql - alter table policy - drop constraint policy_scope_id_fkey; - alter table policy - add constraint policy_scope_id_fkey - foreign key (scope_id) - references iam_scope(public_id) - on delete cascade - on update cascade; - - alter table policy_storage_policy - drop constraint policy_storage_policy_scope_id_fkey; - alter table policy_storage_policy - add constraint policy_storage_policy_scope_id_fkey - foreign key (scope_id) - references iam_scope(public_id) - on delete cascade - on update cascade; - -commit; diff --git a/internal/db/sqltest/tests/policy/org_policy_storage_policy.sql b/internal/db/sqltest/tests/policy/org_policy_storage_policy.sql deleted file mode 100644 index e3d6838509..0000000000 --- a/internal/db/sqltest/tests/policy/org_policy_storage_policy.sql +++ /dev/null @@ -1,30 +0,0 @@ --- Copyright (c) HashiCorp, Inc. --- SPDX-License-Identifier: BUSL-1.1 - -begin; - - select plan(6); - - -- create a storage policy - prepare insert_policy as - insert into policy_storage_policy - (public_id, scope_id, retain_for_days, delete_after_days) - values - ('pst_test1234', 'o__foodtruck', 1, 0); - select lives_ok('insert_policy'); - - select is(count(*), 1::bigint) from policy_storage_policy where public_id = 'pst_test1234'; - select is(count(*), 1::bigint) from policy where public_id = 'pst_test1234'; - - -- deleting org should also delete the storage policy creating in that org - prepare delete_org as - delete from iam_scope - where type = 'org' - and public_id = 'o__foodtruck'; - - select lives_ok('delete_org'); - - select is(count(*), 0::bigint) from policy_storage_policy where public_id = 'pst_test1234'; - select is(count(*), 0::bigint) from policy where public_id = 'pst_test1234'; - -rollback;