fix: removed exported field

This commit is contained in:
Daniel Hougaard
2024-11-11 21:45:06 +04:00
parent a3ec1a27de
commit 6dbe3c8793
3 changed files with 1 additions and 6 deletions
@@ -4,12 +4,10 @@ import { TableName } from "../schemas";
export async function up(knex: Knex): Promise<void> {
const hasEncryptionStrategy = await knex.schema.hasColumn(TableName.KmsServerRootConfig, "encryptionStrategy");
const hasExported = await knex.schema.hasColumn(TableName.KmsServerRootConfig, "exported");
const hasTimestampsCol = await knex.schema.hasColumn(TableName.KmsServerRootConfig, "createdAt");
await knex.schema.alterTable(TableName.KmsServerRootConfig, (t) => {
if (!hasEncryptionStrategy) t.string("encryptionStrategy").defaultTo("BASIC");
if (!hasExported) t.boolean("exported").defaultTo(false);
if (!hasTimestampsCol) t.timestamps(true, true, true);
});
}
@@ -17,11 +15,9 @@ export async function up(knex: Knex): Promise<void> {
export async function down(knex: Knex): Promise<void> {
const hasEncryptionStrategy = await knex.schema.hasColumn(TableName.KmsServerRootConfig, "encryptionStrategy");
const hasTimestampsCol = await knex.schema.hasColumn(TableName.KmsServerRootConfig, "createdAt");
const hasExported = await knex.schema.hasColumn(TableName.KmsServerRootConfig, "exported");
await knex.schema.alterTable(TableName.KmsServerRootConfig, (t) => {
if (hasEncryptionStrategy) t.dropColumn("encryptionStrategy");
if (hasTimestampsCol) t.dropTimestamps(true);
if (hasExported) t.dropColumn("exported");
});
}