From 6ecaf982c559f4d1509db653278accb6b56ae29e Mon Sep 17 00:00:00 2001 From: Anna Velentsevich Date: Fri, 27 Dec 2024 17:52:20 +0100 Subject: [PATCH] split index removing and addition --- ...e_uniqueness_constraint_on_invoice_custom_sections.rb | 1 - ..._add_new_index_on_code_for_invoice_custom_sections.rb | 9 +++++++++ db/schema.rb | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) create mode 100644 db/migrate/20241227161927_add_new_index_on_code_for_invoice_custom_sections.rb diff --git a/db/migrate/20241227154337_add_code_uniqueness_constraint_on_invoice_custom_sections.rb b/db/migrate/20241227154337_add_code_uniqueness_constraint_on_invoice_custom_sections.rb index 200c98bba74c..e444ad43fc72 100644 --- a/db/migrate/20241227154337_add_code_uniqueness_constraint_on_invoice_custom_sections.rb +++ b/db/migrate/20241227154337_add_code_uniqueness_constraint_on_invoice_custom_sections.rb @@ -5,6 +5,5 @@ class AddCodeUniquenessConstraintOnInvoiceCustomSections < ActiveRecord::Migrati def change remove_index :invoice_custom_sections, %i[organization_id code], unique: true, algorithm: :concurrently - add_index :invoice_custom_sections, %i[organization_id code], unique: true, where: 'deleted_at IS NULL', algorithm: :concurrently end end diff --git a/db/migrate/20241227161927_add_new_index_on_code_for_invoice_custom_sections.rb b/db/migrate/20241227161927_add_new_index_on_code_for_invoice_custom_sections.rb new file mode 100644 index 000000000000..80cca75f754a --- /dev/null +++ b/db/migrate/20241227161927_add_new_index_on_code_for_invoice_custom_sections.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class AddNewIndexOnCodeForInvoiceCustomSections < ActiveRecord::Migration[7.1] + disable_ddl_transaction! + + def change + add_index :invoice_custom_sections, %i[organization_id code], unique: true, where: 'deleted_at IS NULL', algorithm: :concurrently + end +end diff --git a/db/schema.rb b/db/schema.rb index 7a1587447e64..7ab5548ce77a 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[7.1].define(version: 2024_12_27_154337) do +ActiveRecord::Schema[7.1].define(version: 2024_12_27_161927) do # These are extensions that must be enabled in order to support this database enable_extension "pgcrypto" enable_extension "plpgsql"