parent
d7a8574c6e
commit
3f9dc3747b
1 changed files with 7 additions and 7 deletions
|
@ -1,14 +1,14 @@
|
|||
# db/migrate/20240612000000_add_local_top_algorithm_support.rb
|
||||
class AddLocalTopAlgorithmSupport < ActiveRecord::Migration[8.0]
|
||||
disable_ddl_transaction!
|
||||
disable_ddl_transaction! # Allows concurrent operations
|
||||
|
||||
def change
|
||||
# Safe to add immediately
|
||||
add_column :users, :feed_algorithm, :string, default: 'chronological'
|
||||
|
||||
# Add reference without foreign key constraint first
|
||||
# 1. Add reference without immediate foreign key validation
|
||||
add_reference :statuses, :status_stat,
|
||||
index: { algorithm: :concurrently },
|
||||
foreign_key: false
|
||||
index: { algorithm: :concurrently }, # Concurrent index
|
||||
foreign_key: { on_delete: :cascade, validate: false } # Defer validation
|
||||
|
||||
# 2. Add user preference column (safe operation)
|
||||
add_column :users, :feed_algorithm, :string, default: 'chronological'
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue