Files
n8n-enterprise-unlocked/packages/cli/src/databases/migrations/postgresdb/1663755770893-CreateWorkflowsEditorRole.ts
कारतोफ्फेलस्क्रिप्ट™ 82fe6383ef refactor(core): Delete boilerplate code across migrations (no-changelog) (#5254)
2023-05-05 11:28:59 +02:00

18 lines
539 B
TypeScript

import type { MigrationContext, ReversibleMigration } from '@db/types';
export class CreateWorkflowsEditorRole1663755770893 implements ReversibleMigration {
async up({ queryRunner, tablePrefix }: MigrationContext) {
await queryRunner.query(`
INSERT INTO ${tablePrefix}role (name, scope)
VALUES ('editor', 'workflow')
ON CONFLICT DO NOTHING;
`);
}
async down({ queryRunner, tablePrefix }: MigrationContext) {
await queryRunner.query(`
DELETE FROM ${tablePrefix}role WHERE name='user' AND scope='workflow';
`);
}
}