diff --git a/packages/cli/src/databases/mysqldb/migrations/1617268711084-CreateTagEntity.ts b/packages/cli/src/databases/mysqldb/migrations/1617268711084-CreateTagEntity.ts index df37a30110..2829328346 100644 --- a/packages/cli/src/databases/mysqldb/migrations/1617268711084-CreateTagEntity.ts +++ b/packages/cli/src/databases/mysqldb/migrations/1617268711084-CreateTagEntity.ts @@ -2,18 +2,18 @@ import {MigrationInterface, QueryRunner} from "typeorm"; import * as config from '../../../../config'; export class CreateTagEntity1617268711084 implements MigrationInterface { - name = 'CreateTagEntity1617268711084' + name = 'CreateTagEntity1617268711084'; - async up(queryRunner: QueryRunner): Promise { + async up(queryRunner: QueryRunner): Promise { const tablePrefix = config.get('database.tablePrefix'); await queryRunner.query('CREATE TABLE `' + tablePrefix + 'tag_entity` (`id` int NOT NULL AUTO_INCREMENT, `name` varchar(24) NOT NULL, `createdAt` datetime NOT NULL, `updatedAt` datetime NOT NULL, UNIQUE INDEX `IDX_' + tablePrefix + '8f949d7a3a984759044054e89b` (`name`), PRIMARY KEY (`id`)) ENGINE=InnoDB'); await queryRunner.query('CREATE TABLE `' + tablePrefix + 'workflows_tags` (`workflowId` int NOT NULL, `tagId` int NOT NULL, INDEX `IDX_' + tablePrefix + '54b2f0343d6a2078fa13744386` (`workflowId`), INDEX `IDX_' + tablePrefix + '77505b341625b0b4768082e217` (`tagId`), PRIMARY KEY (`workflowId`, `tagId`)) ENGINE=InnoDB'); await queryRunner.query('ALTER TABLE `' + tablePrefix + 'workflows_tags` ADD CONSTRAINT `FK_' + tablePrefix + '54b2f0343d6a2078fa137443869` FOREIGN KEY (`workflowId`) REFERENCES `' + tablePrefix + 'workflow_entity`(`id`) ON DELETE CASCADE ON UPDATE NO ACTION'); await queryRunner.query('ALTER TABLE `' + tablePrefix + 'workflows_tags` ADD CONSTRAINT `FK_' + tablePrefix + '77505b341625b0b4768082e2171` FOREIGN KEY (`tagId`) REFERENCES `' + tablePrefix + 'tag_entity`(`id`) ON DELETE CASCADE ON UPDATE NO ACTION'); - } + } - async down(queryRunner: QueryRunner): Promise { + async down(queryRunner: QueryRunner): Promise { const tablePrefix = config.get('database.tablePrefix'); await queryRunner.query('ALTER TABLE `' + tablePrefix + 'workflows_tags` DROP FOREIGN KEY `FK_' + tablePrefix + '77505b341625b0b4768082e2171`'); @@ -23,6 +23,6 @@ export class CreateTagEntity1617268711084 implements MigrationInterface { await queryRunner.query('DROP TABLE `' + tablePrefix + 'workflows_tags`'); await queryRunner.query('DROP INDEX `IDX_' + tablePrefix + '8f949d7a3a984759044054e89b` ON `' + tablePrefix + 'tag_entity`'); await queryRunner.query('DROP TABLE `' + tablePrefix + 'tag_entity`'); - } + } } diff --git a/packages/cli/src/databases/postgresdb/migrations/1617270242566-CreateTagEntity.ts b/packages/cli/src/databases/postgresdb/migrations/1617270242566-CreateTagEntity.ts index 51f6ec0cf2..9af3c37a67 100644 --- a/packages/cli/src/databases/postgresdb/migrations/1617270242566-CreateTagEntity.ts +++ b/packages/cli/src/databases/postgresdb/migrations/1617270242566-CreateTagEntity.ts @@ -2,9 +2,9 @@ import {MigrationInterface, QueryRunner} from "typeorm"; import * as config from '../../../../config'; export class CreateTagEntity1617270242566 implements MigrationInterface { - name = 'CreateTagEntity1617270242566' + name = 'CreateTagEntity1617270242566'; - async up(queryRunner: QueryRunner): Promise { + async up(queryRunner: QueryRunner): Promise { let tablePrefix = config.get('database.tablePrefix'); const tablePrefixPure = tablePrefix; const schema = config.get('database.postgresdb.schema'); @@ -20,9 +20,9 @@ export class CreateTagEntity1617270242566 implements MigrationInterface { await queryRunner.query(`CREATE INDEX IDX_${tablePrefixPure}5e29bfe9e22c5d6567f509d4a4 ON ${tablePrefix}workflows_tags ("tagId") `); await queryRunner.query(`ALTER TABLE ${tablePrefix}workflows_tags ADD CONSTRAINT "FK_${tablePrefixPure}31140eb41f019805b40d0087449" FOREIGN KEY ("workflowId") REFERENCES ${tablePrefix}workflow_entity ("id") ON DELETE CASCADE ON UPDATE NO ACTION`); await queryRunner.query(`ALTER TABLE ${tablePrefix}workflows_tags ADD CONSTRAINT "FK_${tablePrefixPure}5e29bfe9e22c5d6567f509d4a46" FOREIGN KEY ("tagId") REFERENCES ${tablePrefix}tag_entity ("id") ON DELETE CASCADE ON UPDATE NO ACTION`); - } + } - async down(queryRunner: QueryRunner): Promise { + async down(queryRunner: QueryRunner): Promise { let tablePrefix = config.get('database.tablePrefix'); const tablePrefixPure = tablePrefix; const schema = config.get('database.postgresdb.schema'); @@ -37,6 +37,6 @@ export class CreateTagEntity1617270242566 implements MigrationInterface { await queryRunner.query(`DROP TABLE ${tablePrefix}workflows_tags`); await queryRunner.query(`DROP INDEX IDX_${tablePrefixPure}812eb05f7451ca757fb98444ce`); await queryRunner.query(`DROP TABLE ${tablePrefix}tag_entity`); - } + } } diff --git a/packages/cli/src/databases/sqlite/migrations/1617213344594-CreateTagEntity.ts b/packages/cli/src/databases/sqlite/migrations/1617213344594-CreateTagEntity.ts index b27a62e836..4473ba806d 100644 --- a/packages/cli/src/databases/sqlite/migrations/1617213344594-CreateTagEntity.ts +++ b/packages/cli/src/databases/sqlite/migrations/1617213344594-CreateTagEntity.ts @@ -2,7 +2,7 @@ import {MigrationInterface, QueryRunner} from "typeorm"; import * as config from '../../../../config'; export class CreateTagEntity1617213344594 implements MigrationInterface { - name = 'CreateTagEntity1617213344594' + name = 'CreateTagEntity1617213344594'; async up(queryRunner: QueryRunner): Promise { const tablePrefix = config.get('database.tablePrefix'); diff --git a/packages/cli/src/databases/utils.ts b/packages/cli/src/databases/utils.ts index 447c4eb21c..595c68e1f9 100644 --- a/packages/cli/src/databases/utils.ts +++ b/packages/cli/src/databases/utils.ts @@ -1,7 +1,7 @@ import { DatabaseType, } from '../index'; -import { getConfigValueSync } from '../../src/GenericHelpers' +import { getConfigValueSync } from '../../src/GenericHelpers'; /** * Resolves the data type for the used database type