From e891c8ccbec69d56140a12bfe02d11da19452e10 Mon Sep 17 00:00:00 2001 From: Julien Bourdeau Date: Thu, 11 Jul 2024 11:57:57 +0200 Subject: [PATCH] fix(migrations): Split add_column and index (#2277) breakdown `payment_overdue` invoice --- .../20240611074215_add_payment_overdue_to_invoices.rb | 3 --- .../20240711094255_add_invoice_payment_overdue_index.rb | 9 +++++++++ db/schema.rb | 2 +- 3 files changed, 10 insertions(+), 4 deletions(-) create mode 100644 db/migrate/20240711094255_add_invoice_payment_overdue_index.rb diff --git a/db/migrate/20240611074215_add_payment_overdue_to_invoices.rb b/db/migrate/20240611074215_add_payment_overdue_to_invoices.rb index 7f8336e21d9..02781ef8d40 100644 --- a/db/migrate/20240611074215_add_payment_overdue_to_invoices.rb +++ b/db/migrate/20240611074215_add_payment_overdue_to_invoices.rb @@ -1,11 +1,8 @@ # frozen_string_literal: true class AddPaymentOverdueToInvoices < ActiveRecord::Migration[7.0] - disable_ddl_transaction! - def change add_column :invoices, :payment_overdue, :boolean, default: false - add_index :invoices, :payment_overdue, algorithm: :concurrently reversible do |dir| dir.up do diff --git a/db/migrate/20240711094255_add_invoice_payment_overdue_index.rb b/db/migrate/20240711094255_add_invoice_payment_overdue_index.rb new file mode 100644 index 00000000000..90b583a34ab --- /dev/null +++ b/db/migrate/20240711094255_add_invoice_payment_overdue_index.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class AddInvoicePaymentOverdueIndex < ActiveRecord::Migration[7.1] + disable_ddl_transaction! + + def change + add_index :invoices, :payment_overdue, algorithm: :concurrently, if_not_exists: true + end +end diff --git a/db/schema.rb b/db/schema.rb index 2ed267b9497..f0ae9241f85 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_07_11_091155) do +ActiveRecord::Schema[7.1].define(version: 2024_07_11_094255) do # These are extensions that must be enabled in order to support this database enable_extension "pgcrypto" enable_extension "plpgsql"