mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
feat: execution metadata migrations
This commit is contained in:
parent
80c7ac839f
commit
677126b697
|
@ -0,0 +1,31 @@
|
||||||
|
import { MigrationInterface, QueryRunner, Table } from 'typeorm';
|
||||||
|
import { getTablePrefix, logMigrationEnd, logMigrationStart } from '@db/utils/migrationHelpers';
|
||||||
|
import config from '@/config';
|
||||||
|
|
||||||
|
export class CreateExecutionMetadataTable1674133106779 implements MigrationInterface {
|
||||||
|
name = 'CreateExecutionMetadataTable1674133106779';
|
||||||
|
|
||||||
|
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||||
|
logMigrationStart(this.name);
|
||||||
|
const tablePrefix = getTablePrefix();
|
||||||
|
|
||||||
|
await queryRunner.query(
|
||||||
|
`CREATE TABLE ${tablePrefix}execution_metadata (
|
||||||
|
id int(11) auto_increment NOT NULL PRIMARY KEY,
|
||||||
|
executionId int(11) NOT NULL,
|
||||||
|
\`key\` TEXT NOT NULL,
|
||||||
|
value TEXT NOT NULL,
|
||||||
|
CONSTRAINT ${tablePrefix}execution_metadata_FK FOREIGN KEY (executionId) REFERENCES ${tablePrefix}execution_entity(id) ON DELETE CASCADE
|
||||||
|
)
|
||||||
|
ENGINE=InnoDB`,
|
||||||
|
);
|
||||||
|
|
||||||
|
logMigrationEnd(this.name);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||||
|
const tablePrefix = getTablePrefix();
|
||||||
|
|
||||||
|
await queryRunner.query(`DROP TABLE "${tablePrefix}execution_metadata"`);
|
||||||
|
}
|
||||||
|
}
|
|
@ -31,6 +31,7 @@ import { MessageEventBusDestinations1671535397530 } from './1671535397530-Messag
|
||||||
import { DeleteExecutionsWithWorkflows1673268682475 } from './1673268682475-DeleteExecutionsWithWorkflows';
|
import { DeleteExecutionsWithWorkflows1673268682475 } from './1673268682475-DeleteExecutionsWithWorkflows';
|
||||||
import { CreateLdapEntities1674509946020 } from './1674509946020-CreateLdapEntities';
|
import { CreateLdapEntities1674509946020 } from './1674509946020-CreateLdapEntities';
|
||||||
import { PurgeInvalidWorkflowConnections1675940580449 } from './1675940580449-PurgeInvalidWorkflowConnections';
|
import { PurgeInvalidWorkflowConnections1675940580449 } from './1675940580449-PurgeInvalidWorkflowConnections';
|
||||||
|
import { CreateExecutionMetadataTable1674133106779 } from './1674133106779-CreateExecutionMetadataTable';
|
||||||
|
|
||||||
export const mysqlMigrations = [
|
export const mysqlMigrations = [
|
||||||
InitialMigration1588157391238,
|
InitialMigration1588157391238,
|
||||||
|
@ -65,5 +66,6 @@ export const mysqlMigrations = [
|
||||||
MessageEventBusDestinations1671535397530,
|
MessageEventBusDestinations1671535397530,
|
||||||
DeleteExecutionsWithWorkflows1673268682475,
|
DeleteExecutionsWithWorkflows1673268682475,
|
||||||
CreateLdapEntities1674509946020,
|
CreateLdapEntities1674509946020,
|
||||||
PurgeInvalidWorkflowConnections1675940580449
|
PurgeInvalidWorkflowConnections1675940580449,
|
||||||
|
CreateExecutionMetadataTable1674133106779,
|
||||||
];
|
];
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
import { MigrationInterface, QueryRunner, Table } from 'typeorm';
|
||||||
|
import { getTablePrefix, logMigrationEnd, logMigrationStart } from '@db/utils/migrationHelpers';
|
||||||
|
import config from '@/config';
|
||||||
|
|
||||||
|
export class CreateExecutionMetadataTable1674133106778 implements MigrationInterface {
|
||||||
|
name = 'CreateExecutionMetadataTable1674133106778';
|
||||||
|
|
||||||
|
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||||
|
logMigrationStart(this.name);
|
||||||
|
const tablePrefix = getTablePrefix();
|
||||||
|
|
||||||
|
await queryRunner.query(
|
||||||
|
`CREATE TABLE ${tablePrefix}execution_metadata (
|
||||||
|
"id" serial4 NOT NULL PRIMARY KEY,
|
||||||
|
"executionId" int4 NOT NULL,
|
||||||
|
"key" text NOT NULL,
|
||||||
|
"value" text NOT NULL,
|
||||||
|
CONSTRAINT ${tablePrefix}execution_metadata_fk FOREIGN KEY ("executionId") REFERENCES ${tablePrefix}execution_entity(id) ON DELETE CASCADE
|
||||||
|
)`,
|
||||||
|
);
|
||||||
|
|
||||||
|
logMigrationEnd(this.name);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||||
|
const tablePrefix = getTablePrefix();
|
||||||
|
|
||||||
|
await queryRunner.query(`DROP TABLE "${tablePrefix}execution_metadata"`);
|
||||||
|
}
|
||||||
|
}
|
|
@ -29,6 +29,7 @@ import { MessageEventBusDestinations1671535397530 } from './1671535397530-Messag
|
||||||
import { DeleteExecutionsWithWorkflows1673268682475 } from './1673268682475-DeleteExecutionsWithWorkflows';
|
import { DeleteExecutionsWithWorkflows1673268682475 } from './1673268682475-DeleteExecutionsWithWorkflows';
|
||||||
import { CreateLdapEntities1674509946020 } from './1674509946020-CreateLdapEntities';
|
import { CreateLdapEntities1674509946020 } from './1674509946020-CreateLdapEntities';
|
||||||
import { PurgeInvalidWorkflowConnections1675940580449 } from './1675940580449-PurgeInvalidWorkflowConnections';
|
import { PurgeInvalidWorkflowConnections1675940580449 } from './1675940580449-PurgeInvalidWorkflowConnections';
|
||||||
|
import { CreateExecutionMetadataTable1674133106778 } from './1674133106778-CreateExecutionMetadataTable';
|
||||||
|
|
||||||
export const postgresMigrations = [
|
export const postgresMigrations = [
|
||||||
InitialMigration1587669153312,
|
InitialMigration1587669153312,
|
||||||
|
@ -61,5 +62,6 @@ export const postgresMigrations = [
|
||||||
MessageEventBusDestinations1671535397530,
|
MessageEventBusDestinations1671535397530,
|
||||||
DeleteExecutionsWithWorkflows1673268682475,
|
DeleteExecutionsWithWorkflows1673268682475,
|
||||||
CreateLdapEntities1674509946020,
|
CreateLdapEntities1674509946020,
|
||||||
PurgeInvalidWorkflowConnections1675940580449
|
PurgeInvalidWorkflowConnections1675940580449,
|
||||||
|
CreateExecutionMetadataTable1674133106778,
|
||||||
];
|
];
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { MigrationInterface, QueryRunner, Table } from 'typeorm';
|
import { MigrationInterface, QueryRunner, Table } from 'typeorm';
|
||||||
import { logMigrationEnd, logMigrationStart } from '@db/utils/migrationHelpers';
|
import { getTablePrefix, logMigrationEnd, logMigrationStart } from '@db/utils/migrationHelpers';
|
||||||
import config from '@/config';
|
import config from '@/config';
|
||||||
|
|
||||||
export class CreateExecutionMetadataTable1674133106777 implements MigrationInterface {
|
export class CreateExecutionMetadataTable1674133106777 implements MigrationInterface {
|
||||||
|
@ -7,14 +7,14 @@ export class CreateExecutionMetadataTable1674133106777 implements MigrationInter
|
||||||
|
|
||||||
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(
|
||||||
`CREATE TABLE "${tablePrefix}execution_metadata" (
|
`CREATE TABLE "${tablePrefix}execution_metadata" (
|
||||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
|
||||||
executionId INTEGER NOT NULL,
|
executionId INTEGER NOT NULL,
|
||||||
"key" TEXT,
|
"key" TEXT NOT NULL,
|
||||||
value TEXT,
|
value TEXT NOT NULL,
|
||||||
CONSTRAINT ${tablePrefix}execution_metadata_entity_FK FOREIGN KEY (executionId) REFERENCES ${tablePrefix}execution_entity(id) ON DELETE CASCADE
|
CONSTRAINT ${tablePrefix}execution_metadata_entity_FK FOREIGN KEY (executionId) REFERENCES ${tablePrefix}execution_entity(id) ON DELETE CASCADE
|
||||||
)`,
|
)`,
|
||||||
);
|
);
|
||||||
|
@ -23,7 +23,7 @@ export class CreateExecutionMetadataTable1674133106777 implements MigrationInter
|
||||||
}
|
}
|
||||||
|
|
||||||
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 "${tablePrefix}execution_metadata"`);
|
await queryRunner.query(`DROP TABLE "${tablePrefix}execution_metadata"`);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue