Skip to content

Commit

Permalink
fix(migrations): Split add_column and index (#2276)
Browse files Browse the repository at this point in the history
## Description

Add column first, then add index without transaction.
  • Loading branch information
julienbourdeau committed Jul 11, 2024
1 parent 1f57d60 commit bf196d2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
3 changes: 0 additions & 3 deletions db/migrate/20240701184757_add_deleted_at_to_fees.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
# frozen_string_literal: true

class AddDeletedAtToFees < ActiveRecord::Migration[7.1]
disable_ddl_transaction!

def change
add_column :fees, :deleted_at, :datetime
add_index :fees, :deleted_at, algorithm: :concurrently
end
end
9 changes: 9 additions & 0 deletions db/migrate/20240711091155_add_fee_deleted_at_index.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# frozen_string_literal: true

class AddFeeDeletedAtIndex < ActiveRecord::Migration[7.1]
disable_ddl_transaction!

def change
add_index :fees, :deleted_at, algorithm: :concurrently, if_not_exists: true
end
end
2 changes: 1 addition & 1 deletion db/schema.rb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit bf196d2

Please sign in to comment.