20171130000000_add_embed_url_to_preview_cards.rb 477 B

123456789101112131415161718
  1. require Rails.root.join('lib', 'mastodon', 'migration_helpers')
  2. class AddEmbedUrlToPreviewCards < ActiveRecord::Migration[5.1]
  3. include Mastodon::MigrationHelpers
  4. disable_ddl_transaction!
  5. def up
  6. safety_assured do
  7. add_column_with_default :preview_cards, :embed_url, :string, default: '', allow_null: false
  8. end
  9. end
  10. def down
  11. execute "UPDATE preview_cards SET url=embed_url WHERE embed_url!=''"
  12. remove_column :preview_cards, :embed_url
  13. end
  14. end