Add embed_url to preview cards (#5775)
This commit is contained in:
parent
432761f375
commit
c083816c24
7 changed files with 38 additions and 9 deletions
18
db/migrate/20171130000000_add_embed_url_to_preview_cards.rb
Normal file
18
db/migrate/20171130000000_add_embed_url_to_preview_cards.rb
Normal file
|
@ -0,0 +1,18 @@
|
|||
require Rails.root.join('lib', 'mastodon', 'migration_helpers')
|
||||
|
||||
class AddEmbedUrlToPreviewCards < ActiveRecord::Migration[5.1]
|
||||
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
|
|
@ -10,7 +10,7 @@
|
|||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 20171129172043) do
|
||||
ActiveRecord::Schema.define(version: 20171130000000) do
|
||||
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "plpgsql"
|
||||
|
@ -325,6 +325,7 @@ ActiveRecord::Schema.define(version: 20171129172043) do
|
|||
t.integer "height", default: 0, null: false
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.string "embed_url", default: "", null: false
|
||||
t.index ["url"], name: "index_preview_cards_on_url", unique: true
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue