about summary refs log tree commit diff
path: root/db/migrate/20190526052454_create_chat_accounts.rb
diff options
context:
space:
mode:
Diffstat (limited to 'db/migrate/20190526052454_create_chat_accounts.rb')
-rw-r--r--db/migrate/20190526052454_create_chat_accounts.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/db/migrate/20190526052454_create_chat_accounts.rb b/db/migrate/20190526052454_create_chat_accounts.rb
new file mode 100644
index 000000000..b950e36c1
--- /dev/null
+++ b/db/migrate/20190526052454_create_chat_accounts.rb
@@ -0,0 +1,11 @@
+class CreateChatAccounts < ActiveRecord::Migration[5.2]
+  def change
+    create_table :chat_accounts do |t|
+      t.references :account, foreign_key: { on_delete: :cascade }, null: false
+      t.references :tag, foreign_key: { on_delete: :cascade }, null: false
+      t.index [:account_id, :tag_id], unique: true
+      t.index [:tag_id, :account_id]
+      t.timestamps
+    end
+  end
+end