mirror of
https://github.com/n8n-io/n8n.git
synced 2025-02-21 02:56:40 -08:00
Fix indentation and improved comments
This commit is contained in:
parent
416997392e
commit
4c66c18de7
|
@ -39,10 +39,10 @@ export class ActiveExecutions {
|
||||||
async add(executionData: IWorkflowExecutionDataProcess, process?: ChildProcess): Promise<string> {
|
async add(executionData: IWorkflowExecutionDataProcess, process?: ChildProcess): Promise<string> {
|
||||||
|
|
||||||
const fullExecutionData: IExecutionDb = {
|
const fullExecutionData: IExecutionDb = {
|
||||||
data: executionData.executionData!, // check if we can use ! here
|
data: executionData.executionData!, // this is only empty for CLI executions but works fine.
|
||||||
mode: executionData.executionMode,
|
mode: executionData.executionMode,
|
||||||
finished: false,
|
finished: false,
|
||||||
startedAt: new Date(), // check if this is right
|
startedAt: new Date(),
|
||||||
workflowData: executionData.workflowData,
|
workflowData: executionData.workflowData,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -35,29 +35,29 @@ export let collections: IDatabaseCollections = {
|
||||||
import {
|
import {
|
||||||
CreateIndexStoppedAt1594828256133,
|
CreateIndexStoppedAt1594828256133,
|
||||||
InitialMigration1587669153312,
|
InitialMigration1587669153312,
|
||||||
WebhookModel1589476000887,
|
|
||||||
MakeStoppedAtNullable1607431743768,
|
MakeStoppedAtNullable1607431743768,
|
||||||
|
WebhookModel1589476000887,
|
||||||
} from './databases/postgresdb/migrations';
|
} from './databases/postgresdb/migrations';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
CreateIndexStoppedAt1594910478695,
|
CreateIndexStoppedAt1594910478695,
|
||||||
InitialMigration1587563438936,
|
InitialMigration1587563438936,
|
||||||
WebhookModel1592679094242,
|
|
||||||
MakeStoppedAtNullable1607431743766,
|
MakeStoppedAtNullable1607431743766,
|
||||||
|
WebhookModel1592679094242,
|
||||||
} from './databases/mongodb/migrations';
|
} from './databases/mongodb/migrations';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
CreateIndexStoppedAt1594902918301,
|
CreateIndexStoppedAt1594902918301,
|
||||||
InitialMigration1588157391238,
|
InitialMigration1588157391238,
|
||||||
WebhookModel1592447867632,
|
|
||||||
MakeStoppedAtNullable1607431743767,
|
MakeStoppedAtNullable1607431743767,
|
||||||
|
WebhookModel1592447867632,
|
||||||
} from './databases/mysqldb/migrations';
|
} from './databases/mysqldb/migrations';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
CreateIndexStoppedAt1594825041918,
|
CreateIndexStoppedAt1594825041918,
|
||||||
InitialMigration1588102412422,
|
InitialMigration1588102412422,
|
||||||
WebhookModel1592445003908,
|
|
||||||
MakeStoppedAtNullable1607431743769,
|
MakeStoppedAtNullable1607431743769,
|
||||||
|
WebhookModel1592445003908,
|
||||||
} from './databases/sqlite/migrations';
|
} from './databases/sqlite/migrations';
|
||||||
|
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
import {MigrationInterface, QueryRunner} from "typeorm";
|
import {MigrationInterface, QueryRunner} from "typeorm";
|
||||||
|
|
||||||
import * as config from '../../../../config';
|
|
||||||
|
|
||||||
export class MakeStoppedAtNullable1607431743766 implements MigrationInterface {
|
export class MakeStoppedAtNullable1607431743766 implements MigrationInterface {
|
||||||
|
|
||||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
async up(queryRunner: QueryRunner): Promise<void> {
|
||||||
}
|
|
||||||
|
|
||||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
}
|
||||||
}
|
|
||||||
|
async down(queryRunner: QueryRunner): Promise<void> {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,17 +1,17 @@
|
||||||
import {MigrationInterface, QueryRunner} from "typeorm";
|
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||||
|
|
||||||
import * as config from '../../../../config';
|
import * as config from '../../../../config';
|
||||||
|
|
||||||
export class MakeStoppedAtNullable1607431743767 implements MigrationInterface {
|
export class MakeStoppedAtNullable1607431743767 implements MigrationInterface {
|
||||||
|
|
||||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
async up(queryRunner: QueryRunner): Promise<void> {
|
||||||
const tablePrefix = config.get('database.tablePrefix');
|
const tablePrefix = config.get('database.tablePrefix');
|
||||||
await queryRunner.query('ALTER TABLE `' + tablePrefix + 'execution_entity` MODIFY `stoppedAt` datetime', undefined);
|
await queryRunner.query('ALTER TABLE `' + tablePrefix + 'execution_entity` MODIFY `stoppedAt` datetime', undefined);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
async down(queryRunner: QueryRunner): Promise<void> {
|
||||||
const tablePrefix = config.get('database.tablePrefix');
|
const tablePrefix = config.get('database.tablePrefix');
|
||||||
await queryRunner.query('ALTER TABLE `' + tablePrefix + 'execution_entity` MODIFY `stoppedAt` datetime NOT NULL', undefined);
|
await queryRunner.query('ALTER TABLE `' + tablePrefix + 'execution_entity` MODIFY `stoppedAt` datetime NOT NULL', undefined);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,13 +4,13 @@ import * as config from '../../../../config';
|
||||||
|
|
||||||
export class MakeStoppedAtNullable1607431743768 implements MigrationInterface {
|
export class MakeStoppedAtNullable1607431743768 implements MigrationInterface {
|
||||||
|
|
||||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
async up(queryRunner: QueryRunner): Promise<void> {
|
||||||
const tablePrefix = config.get('database.tablePrefix');
|
const tablePrefix = config.get('database.tablePrefix');
|
||||||
await queryRunner.query('ALTER TABLE `' + tablePrefix + 'execution_entity` ALTER COLUMN `stoppedAt` DROP NOT NULL', undefined);
|
await queryRunner.query('ALTER TABLE `' + tablePrefix + 'execution_entity` ALTER COLUMN `stoppedAt` DROP NOT NULL', undefined);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
async down(queryRunner: QueryRunner): Promise<void> {
|
||||||
// Cannot be undone as column might already have null values
|
// Cannot be undone as column might already have null values
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,16 +4,20 @@ import * as config from '../../../../config';
|
||||||
|
|
||||||
export class MakeStoppedAtNullable1607431743769 implements MigrationInterface {
|
export class MakeStoppedAtNullable1607431743769 implements MigrationInterface {
|
||||||
|
|
||||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
async up(queryRunner: QueryRunner): Promise<void> {
|
||||||
const tablePrefix = config.get('database.tablePrefix');
|
const tablePrefix = config.get('database.tablePrefix');
|
||||||
console.log(`UPDATE SQLITE_MASTER SET SQL = 'CREATE TABLE IF NOT EXISTS "${tablePrefix}execution_entity" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "data" text NOT NULL, "finished" boolean NOT NULL, "mode" varchar NOT NULL, "retryOf" varchar, "retrySuccessId" varchar, "startedAt" datetime NOT NULL, "stoppedAt" datetime, "workflowData" text NOT NULL, "workflowId" varchar)' WHERE NAME = "${tablePrefix}execution_entity";`);
|
// SQLite does not allow us to simply "alter column"
|
||||||
await queryRunner.query(`PRAGMA writable_schema = 1; `, undefined);
|
// We're hacking the way sqlite identifies tables
|
||||||
await queryRunner.query(`UPDATE SQLITE_MASTER SET SQL = 'CREATE TABLE IF NOT EXISTS "${tablePrefix}execution_entity" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "data" text NOT NULL, "finished" boolean NOT NULL, "mode" varchar NOT NULL, "retryOf" varchar, "retrySuccessId" varchar, "startedAt" datetime NOT NULL, "stoppedAt" datetime, "workflowData" text NOT NULL, "workflowId" varchar)' WHERE NAME = "${tablePrefix}execution_entity";`, undefined);
|
// Allowing a column to become nullable
|
||||||
await queryRunner.query(`PRAGMA writable_schema = 0;`, undefined);
|
// This is a very strict case when this can be done safely
|
||||||
}
|
// As no collateral effects exist.
|
||||||
|
await queryRunner.query(`PRAGMA writable_schema = 1; `, undefined);
|
||||||
|
await queryRunner.query(`UPDATE SQLITE_MASTER SET SQL = 'CREATE TABLE IF NOT EXISTS "${tablePrefix}execution_entity" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "data" text NOT NULL, "finished" boolean NOT NULL, "mode" varchar NOT NULL, "retryOf" varchar, "retrySuccessId" varchar, "startedAt" datetime NOT NULL, "stoppedAt" datetime, "workflowData" text NOT NULL, "workflowId" varchar)' WHERE NAME = "${tablePrefix}execution_entity";`, undefined);
|
||||||
|
await queryRunner.query(`PRAGMA writable_schema = 0;`, undefined);
|
||||||
|
}
|
||||||
|
|
||||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
async down(queryRunner: QueryRunner): Promise<void> {
|
||||||
// This cannot be undone as the table might already have nullable values
|
// This cannot be undone as the table might already have nullable values
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue