Skip to content

Commit

Permalink
fix: WorkflowHistory columns being text not json
Browse files Browse the repository at this point in the history
  • Loading branch information
valya committed Sep 27, 2023
1 parent ebce6fe commit 419f337
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import type { MigrationContext, ReversibleMigration } from '@db/types';

const tableName = 'workflow_history';

export class ModifyWorkflowHistoryNodesAndConnections1695829275184 implements ReversibleMigration {
async up({ schemaBuilder: { addColumns, dropColumns, column } }: MigrationContext) {
await dropColumns(tableName, ['nodes', 'connections']);
await addColumns(tableName, [column('nodes').json.notNull, column('connections').json.notNull]);
}

async down({ schemaBuilder: { dropColumns, addColumns, column } }: MigrationContext) {
await dropColumns(tableName, ['nodes', 'connections']);
await addColumns(tableName, [column('nodes').text.notNull, column('connections').text.notNull]);
}
}
2 changes: 2 additions & 0 deletions packages/cli/src/databases/migrations/mysqldb/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ import { CreateWorkflowHistoryTable1692967111175 } from '../common/1692967111175
import { DisallowOrphanExecutions1693554410387 } from '../common/1693554410387-DisallowOrphanExecutions';
import { ExecutionSoftDelete1693491613982 } from '../common/1693491613982-ExecutionSoftDelete';
import { AddWorkflowMetadata1695128658538 } from '../common/1695128658538-AddWorkflowMetadata';
import { ModifyWorkflowHistoryNodesAndConnections1695829275184 } from '../common/1695829275184-ModifyWorkflowHistoryNodesAndConnections';

export const mysqlMigrations: Migration[] = [
InitialMigration1588157391238,
Expand Down Expand Up @@ -101,4 +102,5 @@ export const mysqlMigrations: Migration[] = [
DisallowOrphanExecutions1693554410387,
ExecutionSoftDelete1693491613982,
AddWorkflowMetadata1695128658538,
ModifyWorkflowHistoryNodesAndConnections1695829275184,
];
2 changes: 2 additions & 0 deletions packages/cli/src/databases/migrations/postgresdb/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ import { CreateWorkflowHistoryTable1692967111175 } from '../common/1692967111175
import { DisallowOrphanExecutions1693554410387 } from '../common/1693554410387-DisallowOrphanExecutions';
import { ExecutionSoftDelete1693491613982 } from '../common/1693491613982-ExecutionSoftDelete';
import { AddWorkflowMetadata1695128658538 } from '../common/1695128658538-AddWorkflowMetadata';
import { ModifyWorkflowHistoryNodesAndConnections1695829275184 } from '../common/1695829275184-ModifyWorkflowHistoryNodesAndConnections';

export const postgresMigrations: Migration[] = [
InitialMigration1587669153312,
Expand Down Expand Up @@ -97,4 +98,5 @@ export const postgresMigrations: Migration[] = [
DisallowOrphanExecutions1693554410387,
ExecutionSoftDelete1693491613982,
AddWorkflowMetadata1695128658538,
ModifyWorkflowHistoryNodesAndConnections1695829275184,
];
2 changes: 2 additions & 0 deletions packages/cli/src/databases/migrations/sqlite/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ import { CreateWorkflowHistoryTable1692967111175 } from '../common/1692967111175
import { DisallowOrphanExecutions1693554410387 } from '../common/1693554410387-DisallowOrphanExecutions';
import { ExecutionSoftDelete1693491613982 } from './1693491613982-ExecutionSoftDelete';
import { AddWorkflowMetadata1695128658538 } from '../common/1695128658538-AddWorkflowMetadata';
import { ModifyWorkflowHistoryNodesAndConnections1695829275184 } from '../common/1695829275184-ModifyWorkflowHistoryNodesAndConnections';

const sqliteMigrations: Migration[] = [
InitialMigration1588102412422,
Expand Down Expand Up @@ -95,6 +96,7 @@ const sqliteMigrations: Migration[] = [
DisallowOrphanExecutions1693554410387,
ExecutionSoftDelete1693491613982,
AddWorkflowMetadata1695128658538,
ModifyWorkflowHistoryNodesAndConnections1695829275184,
];

export { sqliteMigrations };

0 comments on commit 419f337

Please sign in to comment.