Skip to content

Commit

Permalink
fix(schemas): fix the alteration script
Browse files Browse the repository at this point in the history
fix the alteration script
  • Loading branch information
simeng-li committed Apr 12, 2024
1 parent c33ae9a commit c56a80d
Showing 1 changed file with 1 addition and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,14 @@ import { sql } from '@silverhand/slonik';

import type { AlterationScript } from '../lib/types/alteration.js';

const enum LogtoJwtTokenKey {
AccessToken = 'jwt.accessToken',
ClientCredentials = 'jwt.clientCredentials',
}

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 ('${LogtoJwtTokenKey.AccessToken}', '${LogtoJwtTokenKey.ClientCredentials}')
where key in ('jwt.accessToken', 'jwt.clientCredentials')
and value->>'script' is null
`
);
Expand Down

0 comments on commit c56a80d

Please sign in to comment.