From cfc0b2fb8ddde1160a82bc6cc7e15317ae215c1d Mon Sep 17 00:00:00 2001 From: Daniel Hougaard Date: Tue, 29 Oct 2024 22:07:02 +0400 Subject: [PATCH] fix: renamed migration --- ...-with-hsm.ts => 20241028134337_kms-root-cfg-hsm.ts} | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) rename backend/src/db/migrations/{20241028134337_kms-with-hsm.ts => 20241028134337_kms-root-cfg-hsm.ts} (57%) diff --git a/backend/src/db/migrations/20241028134337_kms-with-hsm.ts b/backend/src/db/migrations/20241028134337_kms-root-cfg-hsm.ts similarity index 57% rename from backend/src/db/migrations/20241028134337_kms-with-hsm.ts rename to backend/src/db/migrations/20241028134337_kms-root-cfg-hsm.ts index 86fc556d6..a586f94b8 100644 --- a/backend/src/db/migrations/20241028134337_kms-with-hsm.ts +++ b/backend/src/db/migrations/20241028134337_kms-root-cfg-hsm.ts @@ -3,21 +3,21 @@ import { Knex } from "knex"; import { TableName } from "../schemas"; export async function up(knex: Knex): Promise { - const hasIsEncryptedByHsmCol = await knex.schema.hasColumn(TableName.KmsServerRootConfig, "isEncryptedByHsm"); + const hasEncryptionStrategy = await knex.schema.hasColumn(TableName.KmsServerRootConfig, "encryptionStrategy"); const hasTimestampsCol = await knex.schema.hasColumn(TableName.KmsServerRootConfig, "createdAt"); await knex.schema.alterTable(TableName.KmsServerRootConfig, (t) => { - if (!hasIsEncryptedByHsmCol) t.boolean("isEncryptedByHsm").defaultTo(false).notNullable(); - if (!hasTimestampsCol) t.timestamps(true, true); + if (!hasEncryptionStrategy) t.string("encryptionStrategy").defaultTo("BASIC"); + if (!hasTimestampsCol) t.timestamps(true, true, true); }); } export async function down(knex: Knex): Promise { - const hasIsEncryptedByHsmCol = await knex.schema.hasColumn(TableName.KmsServerRootConfig, "isEncryptedByHsm"); + const hasEncryptionStrategy = await knex.schema.hasColumn(TableName.KmsServerRootConfig, "encryptionStrategy"); const hasTimestampsCol = await knex.schema.hasColumn(TableName.KmsServerRootConfig, "createdAt"); await knex.schema.alterTable(TableName.KmsServerRootConfig, (t) => { - if (hasIsEncryptedByHsmCol) t.dropColumn("isEncryptedByHsm"); + if (hasEncryptionStrategy) t.dropColumn("encryptionStrategy"); if (hasTimestampsCol) t.dropTimestamps(true); }); }