0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2025-02-24 22:05:56 -05:00
logto/packages/schemas/alterations/1.23.1-1735274337-add-encryption-config-to-saml-apps.ts
silverhand-bot e515728a52
release: version packages (#6928)
* release: version packages

* chore: fix the ci job

fix the integration test ci job

---------

Co-authored-by: simeng-li <simeng@silverhand.io>
2025-01-23 13:51:17 +08:00

35 lines
959 B
TypeScript

import { sql } from '@silverhand/slonik';
import type { AlterationScript } from '../lib/types/alteration.js';
enum NameIdFormat {
/** Uses unique and persistent identifiers for the user. */
Persistent = 'urn:oasis:names:tc:SAML:2.0:nameid-format:persistent',
}
const alteration: AlterationScript = {
up: async (pool) => {
await pool.query(sql`
alter table saml_application_configs
add column encryption jsonb,
add column name_id_format varchar(128);
`);
await pool.query(sql`
update saml_application_configs
set name_id_format = ${NameIdFormat.Persistent};
`);
await pool.query(sql`
alter table saml_application_configs
alter column name_id_format set not null;
`);
},
down: async (pool) => {
await pool.query(sql`
alter table saml_application_configs
drop column encryption,
drop column name_id_format;
`);
},
};
export default alteration;