-
Notifications
You must be signed in to change notification settings - Fork 7.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(core): Delete boilerplate code across migrations (no-changelog)
- Loading branch information
Showing
102 changed files
with
625 additions
and
1,321 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 6 additions & 19 deletions
25
packages/cli/src/databases/migrations/mysqldb/1588157391238-InitialMigration.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,45 @@ | ||
import { MigrationInterface, QueryRunner } from 'typeorm'; | ||
|
||
import config from '@/config'; | ||
import type { MigrationContext, MigrationInterface } from '@db/types'; | ||
|
||
export class InitialMigration1588157391238 implements MigrationInterface { | ||
name = 'InitialMigration1588157391238'; | ||
|
||
async up(queryRunner: QueryRunner): Promise<void> { | ||
const tablePrefix = config.getEnv('database.tablePrefix'); | ||
|
||
async up({ queryRunner, tablePrefix }: MigrationContext) { | ||
await queryRunner.query( | ||
'CREATE TABLE IF NOT EXISTS `' + | ||
tablePrefix + | ||
'credentials_entity` (`id` int NOT NULL AUTO_INCREMENT, `name` varchar(128) NOT NULL, `data` text NOT NULL, `type` varchar(32) NOT NULL, `nodesAccess` json NOT NULL, `createdAt` datetime NOT NULL, `updatedAt` datetime NOT NULL, INDEX `IDX_' + | ||
tablePrefix + | ||
'07fde106c0b471d8cc80a64fc8` (`type`), PRIMARY KEY (`id`)) ENGINE=InnoDB', | ||
undefined, | ||
); | ||
await queryRunner.query( | ||
'CREATE TABLE IF NOT EXISTS `' + | ||
tablePrefix + | ||
'execution_entity` (`id` int NOT NULL AUTO_INCREMENT, `data` text NOT NULL, `finished` tinyint NOT NULL, `mode` varchar(255) NOT NULL, `retryOf` varchar(255) NULL, `retrySuccessId` varchar(255) NULL, `startedAt` datetime NOT NULL, `stoppedAt` datetime NOT NULL, `workflowData` json NOT NULL, `workflowId` varchar(255) NULL, INDEX `IDX_' + | ||
tablePrefix + | ||
'c4d999a5e90784e8caccf5589d` (`workflowId`), PRIMARY KEY (`id`)) ENGINE=InnoDB', | ||
undefined, | ||
); | ||
await queryRunner.query( | ||
'CREATE TABLE IF NOT EXISTS`' + | ||
tablePrefix + | ||
'workflow_entity` (`id` int NOT NULL AUTO_INCREMENT, `name` varchar(128) NOT NULL, `active` tinyint NOT NULL, `nodes` json NOT NULL, `connections` json NOT NULL, `createdAt` datetime NOT NULL, `updatedAt` datetime NOT NULL, `settings` json NULL, `staticData` json NULL, PRIMARY KEY (`id`)) ENGINE=InnoDB', | ||
undefined, | ||
); | ||
} | ||
|
||
async down(queryRunner: QueryRunner): Promise<void> { | ||
const tablePrefix = config.getEnv('database.tablePrefix'); | ||
|
||
await queryRunner.query('DROP TABLE `' + tablePrefix + 'workflow_entity`', undefined); | ||
async down({ queryRunner, tablePrefix }: MigrationContext) { | ||
await queryRunner.query('DROP TABLE `' + tablePrefix + 'workflow_entity`'); | ||
await queryRunner.query( | ||
'DROP INDEX `IDX_' + | ||
tablePrefix + | ||
'c4d999a5e90784e8caccf5589d` ON `' + | ||
tablePrefix + | ||
'execution_entity`', | ||
undefined, | ||
); | ||
await queryRunner.query('DROP TABLE `' + tablePrefix + 'execution_entity`', undefined); | ||
await queryRunner.query('DROP TABLE `' + tablePrefix + 'execution_entity`'); | ||
await queryRunner.query( | ||
'DROP INDEX `IDX_' + | ||
tablePrefix + | ||
'07fde106c0b471d8cc80a64fc8` ON `' + | ||
tablePrefix + | ||
'credentials_entity`', | ||
undefined, | ||
); | ||
await queryRunner.query('DROP TABLE `' + tablePrefix + 'credentials_entity`', undefined); | ||
await queryRunner.query('DROP TABLE `' + tablePrefix + 'credentials_entity`'); | ||
} | ||
} |
13 changes: 3 additions & 10 deletions
13
packages/cli/src/databases/migrations/mysqldb/1592447867632-WebhookModel.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,13 @@ | ||
import { MigrationInterface, QueryRunner } from 'typeorm'; | ||
|
||
import config from '@/config'; | ||
import type { MigrationContext, MigrationInterface } from '@db/types'; | ||
|
||
export class WebhookModel1592447867632 implements MigrationInterface { | ||
name = 'WebhookModel1592447867632'; | ||
|
||
async up(queryRunner: QueryRunner): Promise<void> { | ||
const tablePrefix = config.getEnv('database.tablePrefix'); | ||
|
||
async up({ queryRunner, tablePrefix }: MigrationContext) { | ||
await queryRunner.query( | ||
`CREATE TABLE IF NOT EXISTS ${tablePrefix}webhook_entity (workflowId int NOT NULL, webhookPath varchar(255) NOT NULL, method varchar(255) NOT NULL, node varchar(255) NOT NULL, PRIMARY KEY (webhookPath, method)) ENGINE=InnoDB`, | ||
); | ||
} | ||
|
||
async down(queryRunner: QueryRunner): Promise<void> { | ||
const tablePrefix = config.getEnv('database.tablePrefix'); | ||
async down({ queryRunner, tablePrefix }: MigrationContext) { | ||
await queryRunner.query(`DROP TABLE ${tablePrefix}webhook_entity`); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 3 additions & 9 deletions
12
packages/cli/src/databases/migrations/mysqldb/1607431743767-MakeStoppedAtNullable.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,15 @@ | ||
import { MigrationInterface, QueryRunner } from 'typeorm'; | ||
|
||
import config from '@/config'; | ||
import type { MigrationContext, MigrationInterface } from '@db/types'; | ||
|
||
export class MakeStoppedAtNullable1607431743767 implements MigrationInterface { | ||
async up(queryRunner: QueryRunner): Promise<void> { | ||
const tablePrefix = config.getEnv('database.tablePrefix'); | ||
async up({ queryRunner, tablePrefix }: MigrationContext) { | ||
await queryRunner.query( | ||
'ALTER TABLE `' + tablePrefix + 'execution_entity` MODIFY `stoppedAt` datetime', | ||
undefined, | ||
); | ||
} | ||
|
||
async down(queryRunner: QueryRunner): Promise<void> { | ||
const tablePrefix = config.getEnv('database.tablePrefix'); | ||
async down({ queryRunner, tablePrefix }: MigrationContext) { | ||
await queryRunner.query( | ||
'ALTER TABLE `' + tablePrefix + 'execution_entity` MODIFY `stoppedAt` datetime NOT NULL', | ||
undefined, | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 3 additions & 10 deletions
13
packages/cli/src/databases/migrations/mysqldb/1615306975123-ChangeDataSize.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 3 additions & 10 deletions
13
packages/cli/src/databases/migrations/mysqldb/1620729500000-ChangeCredentialDataSize.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.