fedibird-fe/db/migrate/20220817075513_add_searchability_to_status.rb

14 lines
533 B
Ruby
Raw Normal View History

2022-08-23 05:14:23 +00:00
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