mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-19 02:51:14 +00:00
refactor(core): Delete boilerplate code across migrations (no-changelog) (#5254)
This commit is contained in:
committed by
GitHub
parent
d5c44987f4
commit
82fe6383ef
@@ -1,13 +1,7 @@
|
||||
import { MigrationInterface, QueryRunner } from 'typeorm';
|
||||
import { logMigrationEnd, logMigrationStart, getTablePrefix } from '@db/utils/migrationHelpers';
|
||||
import config from '@/config';
|
||||
|
||||
export class CreateVariables1677501636754 implements MigrationInterface {
|
||||
name = 'CreateVariables1677501636754';
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
logMigrationStart(this.name);
|
||||
const tablePrefix = getTablePrefix();
|
||||
import type { MigrationContext, ReversibleMigration } from '@db/types';
|
||||
|
||||
export class CreateVariables1677501636754 implements ReversibleMigration {
|
||||
async up({ queryRunner, tablePrefix }: MigrationContext) {
|
||||
await queryRunner.query(`
|
||||
CREATE TABLE ${tablePrefix}variables (
|
||||
id serial4 NOT NULL PRIMARY KEY,
|
||||
@@ -17,16 +11,9 @@ export class CreateVariables1677501636754 implements MigrationInterface {
|
||||
UNIQUE ("key")
|
||||
);
|
||||
`);
|
||||
|
||||
logMigrationEnd(this.name);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
logMigrationStart(this.name);
|
||||
const tablePrefix = getTablePrefix();
|
||||
|
||||
async down({ queryRunner, tablePrefix }: MigrationContext) {
|
||||
await queryRunner.query(`DROP TABLE ${tablePrefix}variables;`);
|
||||
|
||||
logMigrationEnd(this.name);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user