Skip to content

Commit

Permalink
chore: rename SAML application secrets/configs constraints (#6840)
Browse files Browse the repository at this point in the history
  • Loading branch information
darcyYe authored Nov 29, 2024
1 parent 91a4de2 commit 743ed33
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { sql } from '@silverhand/slonik';

import type { AlterationScript } from '../lib/types/alteration.js';

const alteration: AlterationScript = {
up: async (pool) => {
await pool.query(sql`
alter table saml_application_configs
rename constraint application_type
to saml_application_configs__application_type;
`);

await pool.query(sql`
alter table saml_application_secrets
rename constraint application_type
to saml_application_secrets__application_type;
`);
},
down: async (pool) => {
await pool.query(sql`
alter table saml_application_configs
rename constraint saml_application_configs__application_type
to application_type;
`);

await pool.query(sql`
alter table saml_application_secrets
rename constraint saml_application_secrets__application_type
to application_type;
`);
},
};

export default alteration;
2 changes: 1 addition & 1 deletion packages/schemas/tables/saml_application_configs.sql
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ create table saml_application_configs (
entity_id varchar(128),
acs_url jsonb /* @use SamlAcsUrl */,
primary key (tenant_id, application_id),
constraint application_type
constraint saml_application_configs__application_type
check (check_application_type(application_id, 'SAML'))
);
2 changes: 1 addition & 1 deletion packages/schemas/tables/saml_application_secrets.sql
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ create table saml_application_secrets (
expires_at timestamptz not null,
active boolean not null,
primary key (tenant_id, application_id, id),
constraint application_type
constraint saml_application_secrets__application_type
check (check_application_type(application_id, 'SAML'))
);

Expand Down

0 comments on commit 743ed33

Please sign in to comment.