0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2024-12-16 20:26:19 -05:00
logto/packages/schemas/alterations/1.18.0-1718786576-organization-jit-sso-connectors.ts
2024-07-06 09:07:56 +08:00

31 lines
1.1 KiB
TypeScript

import { sql } from '@silverhand/slonik';
import type { AlterationScript } from '../lib/types/alteration.js';
import { applyTableRls, dropTableRls } from './utils/1704934999-tables.js';
const alteration: AlterationScript = {
up: async (pool) => {
await pool.query(sql`
create table organization_jit_sso_connectors (
tenant_id varchar(21) not null
references tenants (id) on update cascade on delete cascade,
/** The ID of the organization. */
organization_id varchar(21) not null
references organizations (id) on update cascade on delete cascade,
sso_connector_id varchar(128) not null
references sso_connectors (id) on update cascade on delete cascade,
primary key (tenant_id, organization_id, sso_connector_id)
);
`);
await applyTableRls(pool, 'organization_jit_sso_connectors');
},
down: async (pool) => {
await dropTableRls(pool, 'organization_jit_sso_connectors');
await pool.query(sql`
drop table organization_jit_sso_connectors;
`);
},
};
export default alteration;