mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
fix: Add schema to postgres migrations (hotfix) (#5218)
* fix: Add schema to postgres migrations
This commit is contained in:
parent
9ce526e784
commit
c5245dd387
|
@ -1,12 +1,11 @@
|
||||||
import { MigrationInterface, QueryRunner } from 'typeorm';
|
import { MigrationInterface, QueryRunner } from 'typeorm';
|
||||||
import { logMigrationEnd, logMigrationStart } from '@db/utils/migrationHelpers';
|
import { getTablePrefix, logMigrationEnd, logMigrationStart } from '@db/utils/migrationHelpers';
|
||||||
import config from '@/config';
|
|
||||||
|
|
||||||
export class DeleteExecutionsWithWorkflows1673268682475 implements MigrationInterface {
|
export class DeleteExecutionsWithWorkflows1673268682475 implements MigrationInterface {
|
||||||
name = 'DeleteExecutionsWithWorkflows1673268682475';
|
name = 'DeleteExecutionsWithWorkflows1673268682475';
|
||||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||||
logMigrationStart(this.name);
|
logMigrationStart(this.name);
|
||||||
const tablePrefix = config.getEnv('database.tablePrefix');
|
const tablePrefix = getTablePrefix();
|
||||||
|
|
||||||
await queryRunner.query(`ALTER TABLE \`${tablePrefix}execution_entity\` MODIFY workflowId INT`);
|
await queryRunner.query(`ALTER TABLE \`${tablePrefix}execution_entity\` MODIFY workflowId INT`);
|
||||||
|
|
||||||
|
@ -31,7 +30,7 @@ export class DeleteExecutionsWithWorkflows1673268682475 implements MigrationInte
|
||||||
}
|
}
|
||||||
|
|
||||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||||
const tablePrefix = config.getEnv('database.tablePrefix');
|
const tablePrefix = getTablePrefix();
|
||||||
await queryRunner.query(
|
await queryRunner.query(
|
||||||
`ALTER TABLE \`${tablePrefix}execution_entity\`
|
`ALTER TABLE \`${tablePrefix}execution_entity\`
|
||||||
DROP FOREIGN KEY \`FK_${tablePrefix}execution_entity_workflowId\``,
|
DROP FOREIGN KEY \`FK_${tablePrefix}execution_entity_workflowId\``,
|
||||||
|
|
|
@ -1,12 +1,11 @@
|
||||||
import { MigrationInterface, QueryRunner } from 'typeorm';
|
import { MigrationInterface, QueryRunner } from 'typeorm';
|
||||||
import { logMigrationEnd, logMigrationStart } from '@db/utils/migrationHelpers';
|
import { getTablePrefix, logMigrationEnd, logMigrationStart } from '@db/utils/migrationHelpers';
|
||||||
import config from '@/config';
|
|
||||||
|
|
||||||
export class DeleteExecutionsWithWorkflows1673268682475 implements MigrationInterface {
|
export class DeleteExecutionsWithWorkflows1673268682475 implements MigrationInterface {
|
||||||
name = 'DeleteExecutionsWithWorkflows1673268682475';
|
name = 'DeleteExecutionsWithWorkflows1673268682475';
|
||||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||||
logMigrationStart(this.name);
|
logMigrationStart(this.name);
|
||||||
const tablePrefix = config.getEnv('database.tablePrefix');
|
const tablePrefix = getTablePrefix();
|
||||||
|
|
||||||
await queryRunner.query(
|
await queryRunner.query(
|
||||||
`ALTER TABLE ${tablePrefix}execution_entity
|
`ALTER TABLE ${tablePrefix}execution_entity
|
||||||
|
@ -38,7 +37,7 @@ export class DeleteExecutionsWithWorkflows1673268682475 implements MigrationInte
|
||||||
}
|
}
|
||||||
|
|
||||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||||
const tablePrefix = config.getEnv('database.tablePrefix');
|
const tablePrefix = getTablePrefix();
|
||||||
await queryRunner.query(
|
await queryRunner.query(
|
||||||
`ALTER TABLE ${tablePrefix}execution_entity
|
`ALTER TABLE ${tablePrefix}execution_entity
|
||||||
DROP CONSTRAINT "FK_${tablePrefix}execution_entity_workflowId"`,
|
DROP CONSTRAINT "FK_${tablePrefix}execution_entity_workflowId"`,
|
||||||
|
|
|
@ -1,12 +1,11 @@
|
||||||
import { MigrationInterface, QueryRunner } from 'typeorm';
|
import { MigrationInterface, QueryRunner } from 'typeorm';
|
||||||
import { logMigrationEnd, logMigrationStart } from '@db/utils/migrationHelpers';
|
import { getTablePrefix, logMigrationEnd, logMigrationStart } from '@db/utils/migrationHelpers';
|
||||||
import config from '@/config';
|
|
||||||
|
|
||||||
export class DeleteExecutionsWithWorkflows1673268682475 implements MigrationInterface {
|
export class DeleteExecutionsWithWorkflows1673268682475 implements MigrationInterface {
|
||||||
name = 'DeleteExecutionsWithWorkflows1673268682475';
|
name = 'DeleteExecutionsWithWorkflows1673268682475';
|
||||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||||
logMigrationStart(this.name);
|
logMigrationStart(this.name);
|
||||||
const tablePrefix = config.getEnv('database.tablePrefix');
|
const tablePrefix = getTablePrefix();
|
||||||
|
|
||||||
const workflowIds: Array<{ id: number }> = await queryRunner.query(`
|
const workflowIds: Array<{ id: number }> = await queryRunner.query(`
|
||||||
SELECT id FROM "${tablePrefix}workflow_entity"
|
SELECT id FROM "${tablePrefix}workflow_entity"
|
||||||
|
@ -64,7 +63,7 @@ export class DeleteExecutionsWithWorkflows1673268682475 implements MigrationInte
|
||||||
}
|
}
|
||||||
|
|
||||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||||
const tablePrefix = config.getEnv('database.tablePrefix');
|
const tablePrefix = getTablePrefix();
|
||||||
|
|
||||||
await queryRunner.query(`DROP TABLE IF EXISTS "${tablePrefix}temporary_execution_entity"`);
|
await queryRunner.query(`DROP TABLE IF EXISTS "${tablePrefix}temporary_execution_entity"`);
|
||||||
await queryRunner.query(
|
await queryRunner.query(
|
||||||
|
|
Loading…
Reference in a new issue