fedibird-fe/db/migrate/20220817075513_add_searchability_to_status.rb
2023-02-06 16:28:35 +09:00

13 lines
533 B
Ruby

class AddSearchabilityToStatus < ActiveRecord::Migration[6.1]
disable_ddl_transaction!
def up
add_column :statuses, :searchability, :integer
add_index :statuses, [:account_id, :id], where: 'deleted_at IS NULL AND expired_at IS NULL AND reblog_of_id IS NULL AND searchability IN (0, 1, 2)', order: { id: :desc }, algorithm: :concurrently, name: :index_statuses_private_searchable
end
def down
remove_index :statuses, name: :index_statuses_private_searchable
remove_column :statuses, :searchability
end
end