about summary refs log tree commit diff
path: root/db/migrate
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2022-07-17 13:49:29 +0200
committerGitHub <noreply@github.com>2022-07-17 13:49:29 +0200
commitc3f0621a59a74d0e20e6db6170894871c48e8f0f (patch)
treedf58568b5fbb86042f9dad4ba772f47d305e6086 /db/migrate
parentecb3bb3256fe1bab0d7a63829cdce914b2b509a9 (diff)
Add ability to follow hashtags (#18809)
Diffstat (limited to 'db/migrate')
-rw-r--r--db/migrate/20220714171049_create_tag_follows.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/db/migrate/20220714171049_create_tag_follows.rb b/db/migrate/20220714171049_create_tag_follows.rb
new file mode 100644
index 000000000..a393e90f5
--- /dev/null
+++ b/db/migrate/20220714171049_create_tag_follows.rb
@@ -0,0 +1,12 @@
+class CreateTagFollows < ActiveRecord::Migration[6.1]
+  def change
+    create_table :tag_follows do |t|
+      t.belongs_to :tag, null: false, foreign_key: { on_delete: :cascade }
+      t.belongs_to :account, null: false, foreign_key: { on_delete: :cascade }, index: false
+
+      t.timestamps
+    end
+
+    add_index :tag_follows, [:account_id, :tag_id], unique: true
+  end
+end