fix 2
This commit is contained in:
parent
5c5a35be24
commit
2af5f750ad
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! # Allows concurrent operations
|
||||
disable_ddl_transaction!
|
||||
|
||||
def change
|
||||
# 1. Add reference without immediate foreign key validation
|
||||
add_reference :statuses, :status_stat,
|
||||
index: { algorithm: :concurrently }, # Concurrent index
|
||||
foreign_key: { on_delete: :cascade, validate: false } # Defer validation
|
||||
|
||||
# 2. Add user preference column (safe operation)
|
||||
# Safe to add immediately
|
||||
add_column :users, :feed_algorithm, :string, default: 'chronological'
|
||||
|
||||
# Add reference without foreign key constraint first
|
||||
add_reference :statuses, :status_stat,
|
||||
index: { algorithm: :concurrently },
|
||||
foreign_key: false
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue