2023-07-12 17:47:08 +10:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-12-07 13:37:43 +11:00
|
|
|
require Rails.root.join('lib', 'mastodon', 'migration_helpers')
|
|
|
|
|
2023-03-28 01:09:10 +11:00
|
|
|
class AddEmbedURLToPreviewCards < ActiveRecord::Migration[5.2]
|
2017-12-07 13:37:43 +11:00
|
|
|
include Mastodon::MigrationHelpers
|
|
|
|
|
|
|
|
disable_ddl_transaction!
|
|
|
|
|
|
|
|
def up
|
|
|
|
safety_assured do
|
|
|
|
add_column_with_default :preview_cards, :embed_url, :string, default: '', allow_null: false
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def down
|
|
|
|
execute "UPDATE preview_cards SET url=embed_url WHERE embed_url!=''"
|
|
|
|
remove_column :preview_cards, :embed_url
|
|
|
|
end
|
|
|
|
end
|