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.0.0_rc.0-1675316731-update-seed-data.ts

40 lines
1.1 KiB
TypeScript
Raw Permalink Normal View History

2024-03-16 06:04:55 -05:00
import { sql } from '@silverhand/slonik';
2023-02-02 05:36:18 -05:00
import type { AlterationScript } from '../lib/types/alteration.js';
const alteration: AlterationScript = {
up: async (pool) => {
await pool.query(sql`
update roles
set id = 'admin-role'
where id = 'ac-admin-id';
update scopes
set
id = 'management-api-all',
name = 'all',
description = 'Default scope for Management API, allows all permissions.'
where id = 'management-api-scope';
-- this update is one-way since no need to revert the id column as it's just for seeding not querying
update roles_scopes
set id = 'admin-role-scope'
where role_id = 'admin-role'
and scope_id = 'management-api-all';
`);
},
down: async (pool) => {
await pool.query(sql`
update roles
set id = 'ac-admin-id'
where id = 'admin-role';
update scopes
set
id = 'management-api-scope',
name = 'management-api:default',
description = 'Default scope for Management API.'
where id = 'management-api-all';
`);
},
};
export default alteration;