~cytrogen/masto-fe

ref: ef8ca2fd7231f331f6822955b518a25861663b87 masto-fe/db/migrate/20171130000000_add_embed_url_to_preview_cards.rb -rw-r--r-- 508 bytes
ef8ca2fd — Renaud Chaput Change Dockerfile to upgrade packages when building (#26922) 2 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# frozen_string_literal: true

require Rails.root.join('lib', 'mastodon', 'migration_helpers')

class AddEmbedURLToPreviewCards < ActiveRecord::Migration[5.2]
  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