-
Notifications
You must be signed in to change notification settings - Fork 8.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add migration to add
managed
column to credentials table (#12275
- Loading branch information
1 parent
bafac73
commit 3cb7081
Showing
5 changed files
with
35 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
21 changes: 21 additions & 0 deletions
21
...s/cli/src/databases/migrations/common/1734479635324-AddManagedColumnToCredentialsTable.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,21 @@ | ||
import type { MigrationContext, ReversibleMigration } from '@/databases/types'; | ||
|
||
export class AddManagedColumnToCredentialsTable1734479635324 implements ReversibleMigration { | ||
async up({ escape, runQuery, isSqlite }: MigrationContext) { | ||
const tableName = escape.tableName('credentials_entity'); | ||
const columnName = escape.columnName('isManaged'); | ||
|
||
const defaultValue = isSqlite ? 0 : 'FALSE'; | ||
|
||
await runQuery( | ||
`ALTER TABLE ${tableName} ADD COLUMN ${columnName} BOOLEAN NOT NULL DEFAULT ${defaultValue}`, | ||
); | ||
} | ||
|
||
async down({ escape, runQuery }: MigrationContext) { | ||
const tableName = escape.tableName('credentials_entity'); | ||
const columnName = escape.columnName('isManaged'); | ||
|
||
await runQuery(`ALTER TABLE ${tableName} DROP COLUMN ${columnName}`); | ||
} | ||
} |
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