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

15 lines
587 B
TypeScript

import type { MigrationContext, ReversibleMigration } from '@db/types';
export class AddTriggerCountColumn1669823906994 implements ReversibleMigration {
async up({ queryRunner, tablePrefix }: MigrationContext) {
await queryRunner.query(
`ALTER TABLE ${tablePrefix}workflow_entity ADD COLUMN triggerCount integer NOT NULL DEFAULT 0`,
);
// Table will be populated by n8n startup - see ActiveWorkflowRunner.ts
}
async down({ queryRunner, tablePrefix }: MigrationContext) {
await queryRunner.query(`ALTER TABLE ${tablePrefix}workflow_entity DROP COLUMN triggerCount`);
}
}