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

32 lines
1.1 KiB
TypeScript
Raw Normal View History

2024-06-19 22:35:04 -05:00
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;