mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
34 lines
1 KiB
TypeScript
34 lines
1 KiB
TypeScript
|
import { MigrationInterface, QueryRunner } from 'typeorm';
|
||
|
import { logMigrationEnd, logMigrationStart } from '../../utils/migrationHelpers';
|
||
|
import config from '../../../../config';
|
||
|
|
||
|
export class IntroducePinData1654090467022 implements MigrationInterface {
|
||
|
name = 'IntroducePinData1654090467022';
|
||
|
|
||
|
async up(queryRunner: QueryRunner) {
|
||
|
logMigrationStart(this.name);
|
||
|
|
||
|
const schema = config.getEnv('database.postgresdb.schema');
|
||
|
const tablePrefix = config.getEnv('database.tablePrefix');
|
||
|
|
||
|
await queryRunner.query(`SET search_path TO ${schema}`);
|
||
|
|
||
|
await queryRunner.query(
|
||
|
`ALTER TABLE ${schema}.${tablePrefix}workflow_entity ADD "pinData" json`,
|
||
|
);
|
||
|
|
||
|
logMigrationEnd(this.name);
|
||
|
}
|
||
|
|
||
|
async down(queryRunner: QueryRunner) {
|
||
|
const schema = config.getEnv('database.postgresdb.schema');
|
||
|
const tablePrefix = config.getEnv('database.tablePrefix');
|
||
|
|
||
|
await queryRunner.query(`SET search_path TO ${schema}`);
|
||
|
|
||
|
await queryRunner.query(
|
||
|
`ALTER TABLE ${schema}.${tablePrefix}workflow_entity DROP COLUMN "pinData"`,
|
||
|
);
|
||
|
}
|
||
|
}
|