diff --git a/backend/src/db/migrations/20241127091918_webhook-to-kms.ts b/backend/src/db/migrations/20241127091918_webhook-to-kms.ts index 89458aaad..12ef58287 100644 --- a/backend/src/db/migrations/20241127091918_webhook-to-kms.ts +++ b/backend/src/db/migrations/20241127091918_webhook-to-kms.ts @@ -14,12 +14,14 @@ const BATCH_SIZE = 500; export async function up(knex: Knex): Promise { const hasEncryptedKey = await knex.schema.hasColumn(TableName.Webhook, "encryptedPassKey"); const hasEncryptedUrl = await knex.schema.hasColumn(TableName.Webhook, "encryptedUrl"); + const hasUrl = await knex.schema.hasColumn(TableName.Webhook, "url"); const hasWebhookTable = await knex.schema.hasTable(TableName.Webhook); if (hasWebhookTable) { await knex.schema.alterTable(TableName.Webhook, (t) => { if (!hasEncryptedKey) t.binary("encryptedPassKey"); if (!hasEncryptedUrl) t.binary("encryptedUrl"); + if (hasUrl) t.string("url").nullable().alter(); }); } diff --git a/backend/src/db/migrations/20241128092853_dynamic-secret-root-to-kms.ts b/backend/src/db/migrations/20241128092853_dynamic-secret-root-to-kms.ts index 2fd187373..833c87c92 100644 --- a/backend/src/db/migrations/20241128092853_dynamic-secret-root-to-kms.ts +++ b/backend/src/db/migrations/20241128092853_dynamic-secret-root-to-kms.ts @@ -14,11 +14,17 @@ import { getMigrationEncryptionServices } from "./utils/services"; const BATCH_SIZE = 500; export async function up(knex: Knex): Promise { const hasEncryptedInputColumn = await knex.schema.hasColumn(TableName.DynamicSecret, "encryptedInput"); + const hasInputCiphertextColumn = await knex.schema.hasColumn(TableName.DynamicSecret, "inputCiphertext"); + const hasInputIVColumn = await knex.schema.hasColumn(TableName.DynamicSecret, "inputIV"); + const hasInputTagColumn = await knex.schema.hasColumn(TableName.DynamicSecret, "inputTag"); const hasDynamicSecretTable = await knex.schema.hasTable(TableName.DynamicSecret); if (hasDynamicSecretTable) { await knex.schema.alterTable(TableName.DynamicSecret, (t) => { if (!hasEncryptedInputColumn) t.binary("encryptedInput"); + if (hasInputCiphertextColumn) t.text("inputCiphertext").nullable().alter(); + if (hasInputIVColumn) t.string("inputIV").nullable().alter(); + if (hasInputTagColumn) t.string("inputTag").nullable().alter(); }); }