summaryrefslogtreecommitdiff
path: root/db/migrate/20161113184239_create_user_chat_names_table.rb
diff options
context:
space:
mode:
authorKamil Trzcinski <ayufan@ayufan.eu>2016-11-13 20:35:47 +0100
committerKamil Trzcinski <ayufan@ayufan.eu>2016-11-16 13:42:35 +0100
commitc60437786bfe43344b4a5eb040437f73f37c6396 (patch)
treefe90ee0dd9e556369e7f53ce4a03e2751b486682 /db/migrate/20161113184239_create_user_chat_names_table.rb
parentc5169b5d447ab6c73bbe542c071a4054c5969165 (diff)
downloadgitlab-ce-c60437786bfe43344b4a5eb040437f73f37c6396.tar.gz
Create relation between chat user and GitLab user and allow to authorize them [ci skip]
Diffstat (limited to 'db/migrate/20161113184239_create_user_chat_names_table.rb')
-rw-r--r--db/migrate/20161113184239_create_user_chat_names_table.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/db/migrate/20161113184239_create_user_chat_names_table.rb b/db/migrate/20161113184239_create_user_chat_names_table.rb
new file mode 100644
index 00000000000..f9ab2adf2a9
--- /dev/null
+++ b/db/migrate/20161113184239_create_user_chat_names_table.rb
@@ -0,0 +1,20 @@
+class CreateUserChatNamesTable < ActiveRecord::Migration
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ def change
+ create_table :chat_names do |t|
+ t.integer "user_id", null: false
+ t.integer "service_id", null: false
+ t.string "team_id"
+ t.string "team_domain"
+ t.string "chat_id"
+ t.string "chat_name"
+ t.timestamps
+ end
+
+ add_index :chat_names, [:user_id, :service_id], unique: true
+ add_index :chat_names, [:service_id, :team_id, :chat_id], unique: true
+ end
+end