0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2024-12-23 20:33:16 -05:00
logto/packages/schemas/alterations/1.16.0-1712912361-delete-jwt-customier-with-empty-script.ts

24 lines
754 B
TypeScript
Raw Normal View History

import { sql } from '@silverhand/slonik';
import type { AlterationScript } from '../lib/types/alteration.js';
const alteration: AlterationScript = {
// We are making the jwt-customizer script field mandatory
// Delete the records in logto_configs where key is jwt.accessToken or jwt.clientCredentials and value jsonb's script field is undefined
up: async (pool) => {
await pool.query(
sql`
delete from logto_configs
where key in ('jwt.accessToken', 'jwt.clientCredentials')
and value->>'script' is null
`
);
},
down: async () => {
// No down script available, this is a non-reversible operation
// It is fine since we have not released this feature yet
},
};
export default alteration;