summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--db/migrations/0262_remove_project_id_from_combo_box_settings.sql14
-rw-r--r--db/migrations/0263_remove_project_id_from_document_number_type_configs.sql14
-rw-r--r--db/migrations/0264_fix_duplicate_document_number_type_configs.sql16
3 files changed, 0 insertions, 44 deletions
diff --git a/db/migrations/0262_remove_project_id_from_combo_box_settings.sql b/db/migrations/0262_remove_project_id_from_combo_box_settings.sql
deleted file mode 100644
index 804b471a..00000000
--- a/db/migrations/0262_remove_project_id_from_combo_box_settings.sql
+++ /dev/null
@@ -1,14 +0,0 @@
--- Remove projectId column and related constraints from combo_box_settings table
--- Since codeGroupId already references codeGroups which has projectId, this is redundant
-
--- First, drop the unique constraint that includes projectId
-DROP INDEX IF EXISTS "unique_project_code_group_code";
-
--- Then drop the foreign key constraint for projectId
-ALTER TABLE "combo_box_settings" DROP CONSTRAINT IF EXISTS "combo_box_settings_project_id_projects_id_fk";
-
--- Finally, drop the projectId column
-ALTER TABLE "combo_box_settings" DROP COLUMN IF EXISTS "project_id";
-
--- Add a new unique constraint without projectId (since codeGroupId + code should be unique within a code group)
-ALTER TABLE "combo_box_settings" ADD CONSTRAINT "unique_code_group_code" UNIQUE ("code_group_id", "code"); \ No newline at end of file
diff --git a/db/migrations/0263_remove_project_id_from_document_number_type_configs.sql b/db/migrations/0263_remove_project_id_from_document_number_type_configs.sql
deleted file mode 100644
index 27522555..00000000
--- a/db/migrations/0263_remove_project_id_from_document_number_type_configs.sql
+++ /dev/null
@@ -1,14 +0,0 @@
--- Remove projectId column and related constraints from document_number_type_configs table
--- Since documentNumberTypeId already references documentNumberTypes which has projectId, this is redundant
-
--- First, drop the unique constraint that includes projectId
-DROP INDEX IF EXISTS "unique_project_number_type_sdq";
-
--- Then drop the foreign key constraint for projectId
-ALTER TABLE "document_number_type_configs" DROP CONSTRAINT IF EXISTS "document_number_type_configs_project_id_projects_id_fk";
-
--- Finally, drop the projectId column
-ALTER TABLE "document_number_type_configs" DROP COLUMN IF EXISTS "project_id";
-
--- Add a new unique constraint without projectId (since documentNumberTypeId + sdq should be unique within a document number type)
-ALTER TABLE "document_number_type_configs" ADD CONSTRAINT "unique_document_number_type_sdq" UNIQUE ("document_number_type_id", "sdq"); \ No newline at end of file
diff --git a/db/migrations/0264_fix_duplicate_document_number_type_configs.sql b/db/migrations/0264_fix_duplicate_document_number_type_configs.sql
deleted file mode 100644
index 45269a5e..00000000
--- a/db/migrations/0264_fix_duplicate_document_number_type_configs.sql
+++ /dev/null
@@ -1,16 +0,0 @@
--- Fix duplicate document_number_type_configs data before applying unique constraint
--- Remove duplicates keeping only the most recent one for each document_number_type_id + sdq combination
-
--- First, identify and remove duplicates
-DELETE FROM "document_number_type_configs"
-WHERE id NOT IN (
- SELECT MAX(id)
- FROM "document_number_type_configs"
- GROUP BY "document_number_type_id", "sdq"
-);
-
--- Now we can safely apply the unique constraint
--- (This should already be applied by the previous migration, but just in case)
-ALTER TABLE "document_number_type_configs"
-ADD CONSTRAINT "unique_document_number_type_sdq"
-UNIQUE ("document_number_type_id", "sdq"); \ No newline at end of file