-
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.
feat(core): Migration for soft deletions for executions (#7088)
Based on #7065 --------- Co-authored-by: कारतोफ्फेलस्क्रिप्ट™ <aditya@netroy.in>
- Loading branch information
Showing
6 changed files
with
33 additions
and
0 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
19 changes: 19 additions & 0 deletions
19
packages/cli/src/databases/migrations/common/1693491613982-ExecutionSoftDelete.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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import type { MigrationContext, ReversibleMigration } from '@/databases/types'; | ||
|
||
/** | ||
* Add an indexed column `deletedAt` to track soft-deleted executions. | ||
* Add an index on `stoppedAt`, used by executions pruning. | ||
*/ | ||
export class ExecutionSoftDelete1693491613982 implements ReversibleMigration { | ||
async up({ schemaBuilder: { addColumns, column, createIndex } }: MigrationContext) { | ||
await addColumns('execution_entity', [column('deletedAt').timestamp()]); | ||
await createIndex('execution_entity', ['deletedAt']); | ||
await createIndex('execution_entity', ['stoppedAt']); | ||
} | ||
|
||
async down({ schemaBuilder: { dropColumns, dropIndex } }: MigrationContext) { | ||
await dropIndex('execution_entity', ['stoppedAt']); | ||
await dropIndex('execution_entity', ['deletedAt']); | ||
await dropColumns('execution_entity', ['deletedAt']); | ||
} | ||
} |
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
5 changes: 5 additions & 0 deletions
5
packages/cli/src/databases/migrations/sqlite/1693491613982-ExecutionSoftDelete.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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { ExecutionSoftDelete1693491613982 as BaseMigration } from '../common/1693491613982-ExecutionSoftDelete'; | ||
|
||
export class ExecutionSoftDelete1693491613982 extends BaseMigration { | ||
transaction = false as const; | ||
} |
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