about summary refs log tree commit diff
path: root/db/migrate
diff options
context:
space:
mode:
authorJenkins <jenkins@jenkins.ninjawedding.org>2017-12-07 04:17:14 +0000
committerJenkins <jenkins@jenkins.ninjawedding.org>2017-12-07 04:17:14 +0000
commit744447b3c04d7806e383f0d1ad7a10c73bd667ef (patch)
tree640d74c3586dfe3114b7db3fdb97e2e3d8490843 /db/migrate
parentde5620995175b7c1c0fc458bd78c12d8c5860aad (diff)
parent0c4ca3e549865623fdd35764915814acc8a595e1 (diff)
Merge remote-tracking branch 'tootsuite/master' into glitchsoc/master
Diffstat (limited to 'db/migrate')
-rw-r--r--db/migrate/20171130000000_add_embed_url_to_preview_cards.rb18
1 files changed, 18 insertions, 0 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