From 7cf8427ec722f93afbe4b089be948f4ace0e83ac Mon Sep 17 00:00:00 2001 From: shreddedbacon Date: Wed, 14 Feb 2024 09:17:40 +1100 Subject: [PATCH] refactor: drop duplicates when adding the unique key to the environment_service table --- .../migrations/20240114000000_environment_services.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/services/api/database/migrations/20240114000000_environment_services.js b/services/api/database/migrations/20240114000000_environment_services.js index 92986b7b36..76efd85898 100644 --- a/services/api/database/migrations/20240114000000_environment_services.js +++ b/services/api/database/migrations/20240114000000_environment_services.js @@ -4,6 +4,7 @@ */ exports.up = async function(knex) { return knex.schema + .raw(`DELETE es1 FROM environment_service es1 INNER JOIN environment_service es2 WHERE es1.id < es2.id AND es1.name = es2.name;`) .alterTable('environment_service', function (table) { table.string('type', 300); table.timestamp('updated').notNullable().defaultTo(knex.fn.now()); @@ -27,7 +28,6 @@ exports.down = async function(knex) { table.dropColumn('type'); table.dropColumn('updated'); table.dropColumn('created'); - table.dropUnique(['name', 'environment'], 'service_environment'); }) .dropTable('environment_service_container') -}; +}; \ No newline at end of file