Merge branch 'main' into sqlite
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
class AddAccountKeyToSearchRecords < ActiveRecord::Migration[8.2]
|
||||
def up
|
||||
16.times do |shard_id|
|
||||
table_name = "search_records_#{shard_id}"
|
||||
|
||||
add_column table_name, :account_key, :string, null: false, default: ""
|
||||
add_index table_name, [:account_key, :content, :title], type: :fulltext
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
16.times do |shard_id|
|
||||
table_name = "search_records_#{shard_id}"
|
||||
|
||||
remove_index table_name, column: [:account_key, :content, :title], type: :fulltext
|
||||
remove_column table_name, :account_key
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,16 @@
|
||||
class RemoveOldFulltextIndexesFromSearchRecords < ActiveRecord::Migration[8.2]
|
||||
def up
|
||||
# Remove the old fulltext indexes (content, title) from all 16 search_records shards
|
||||
# We're keeping the new indexes (account_key, content, title) for tenant-aware searching
|
||||
(0..15).each do |shard|
|
||||
remove_index "search_records_#{shard}", name: "index_search_records_#{shard}_on_content_and_title"
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
# Re-create the old fulltext indexes in case we need to rollback
|
||||
(0..15).each do |shard|
|
||||
add_index "search_records_#{shard}", [ :content, :title ], type: :fulltext, name: "index_search_records_#{shard}_on_content_and_title"
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user