20171130000000_add_embed_url_to_preview_cards.rb 386 B

12345678910111213141516
  1. # frozen_string_literal: true
  2. class AddEmbedURLToPreviewCards < ActiveRecord::Migration[5.2]
  3. disable_ddl_transaction!
  4. def up
  5. safety_assured do
  6. add_column :preview_cards, :embed_url, :string, default: '', null: false
  7. end
  8. end
  9. def down
  10. execute "UPDATE preview_cards SET url=embed_url WHERE embed_url!=''"
  11. remove_column :preview_cards, :embed_url
  12. end
  13. end