about summary refs log tree commit diff
path: root/db
diff options
context:
space:
mode:
authorAkihiko Odaki <akihiko.odaki.4i@stu.hosei.ac.jp>2017-12-07 11:37:43 +0900
committerEugen Rochko <eugen@zeonfederated.com>2017-12-07 03:37:43 +0100
commitc083816c2479dcdfa6674c47a75a8293bf64a947 (patch)
treedddc1ffa56dae8a8856ec9c80af049beb5e66046 /db
parent432761f37574b4e4159283f595e6c094b7bde449 (diff)
Add embed_url to preview cards (#5775)
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20171130000000_add_embed_url_to_preview_cards.rb18
-rw-r--r--db/schema.rb3
2 files changed, 20 insertions, 1 deletions
diff --git a/db/migrate/20171130000000_add_embed_url_to_preview_cards.rb b/db/migrate/20171130000000_add_embed_url_to_preview_cards.rb
new file mode 100644
index 000000000..d19c0091b
--- /dev/null
+++ b/db/migrate/20171130000000_add_embed_url_to_preview_cards.rb
@@ -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
diff --git a/db/schema.rb b/db/schema.rb
index 71674ece6..cf0deb826 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -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