diff --git a/backend/src/db/migrations/20240924172713_add-kms-key-project-id.ts b/backend/src/db/migrations/20240924172713_add-kms-key-project-id.ts index deed9361b..abf74605a 100644 --- a/backend/src/db/migrations/20240924172713_add-kms-key-project-id.ts +++ b/backend/src/db/migrations/20240924172713_add-kms-key-project-id.ts @@ -30,15 +30,15 @@ export async function down(knex: Knex): Promise { // remove projectId for CMEK functionality await knex.schema.alterTable(TableName.KmsKey, (table) => { + if (hasName) { + table.renameColumn("name", "slug"); + } + if (hasOrgId) { table.dropUnique(["orgId", "projectId", "slug"]); table.unique(["orgId", "slug"]); } table.dropColumn("projectId"); - - if (hasName) { - table.renameColumn("name", "slug"); - } }); } }