mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-03 10:26:00 +00:00
30 lines
819 B
TypeScript
30 lines
819 B
TypeScript
import { Knex } from "knex";
|
|
|
|
import { TableName } from "../schemas";
|
|
|
|
export async function up(knex: Knex): Promise<void> {
|
|
const hasKmsSecretManagerEncryptedDataKey = await knex.schema.hasColumn(
|
|
TableName.Project,
|
|
"kmsSecretManagerEncryptedDataKey"
|
|
);
|
|
|
|
await knex.schema.alterTable(TableName.Project, (tb) => {
|
|
if (!hasKmsSecretManagerEncryptedDataKey) {
|
|
tb.binary("kmsSecretManagerEncryptedDataKey");
|
|
}
|
|
});
|
|
}
|
|
|
|
export async function down(knex: Knex): Promise<void> {
|
|
const hasKmsSecretManagerEncryptedDataKey = await knex.schema.hasColumn(
|
|
TableName.Project,
|
|
"kmsSecretManagerEncryptedDataKey"
|
|
);
|
|
|
|
await knex.schema.alterTable(TableName.Project, (t) => {
|
|
if (hasKmsSecretManagerEncryptedDataKey) {
|
|
t.dropColumn("kmsSecretManagerEncryptedDataKey");
|
|
}
|
|
});
|
|
}
|