mirror of
https://github.com/logto-io/logto.git
synced 2024-12-23 20:33:16 -05:00
24 lines
754 B
TypeScript
24 lines
754 B
TypeScript
|
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;
|