fedibird-fe/db/migrate/20210708030726_add_expired_at_to_status.rb

18 lines
550 B
Ruby
Raw Normal View History

2021-07-16 06:38:50 +00:00
require Rails.root.join('lib', 'mastodon', 'migration_helpers')
class AddExpiredAtToStatus < ActiveRecord::Migration[6.1]
include Mastodon::MigrationHelpers
disable_ddl_transaction!
def up
safety_assured { add_column :statuses, :expired_at, :datetime, default: nil, allow_null: true }
safety_assured { add_index :statuses, :expired_at, algorithm: :concurrently, name: :index_statuses_on_expired_at }
end
def down
remove_index :statuses, name: :index_statuses_on_expired_at
remove_column :statuses, :expired_at
end
end