summaryrefslogtreecommitdiff
path: root/db/migrate/20141216155758_create_doorkeeper_tables.rb
diff options
context:
space:
mode:
authorValery Sizov <vsv2711@gmail.com>2014-12-19 16:15:29 +0200
committerValery Sizov <vsv2711@gmail.com>2014-12-24 15:38:07 +0200
commite41dadcb33fda44ee274daa673bd933e13aa90eb (patch)
treeef0dc6ecea0020fe1ce8598342bcbf7e620984fe /db/migrate/20141216155758_create_doorkeeper_tables.rb
parent5cf2bd4c997d84e9a02d722d6ba870c24b06cc0f (diff)
downloadgitlab-ce-e41dadcb33fda44ee274daa673bd933e13aa90eb.tar.gz
Doorkeeper integration
Diffstat (limited to 'db/migrate/20141216155758_create_doorkeeper_tables.rb')
-rw-r--r--db/migrate/20141216155758_create_doorkeeper_tables.rb42
1 files changed, 42 insertions, 0 deletions
diff --git a/db/migrate/20141216155758_create_doorkeeper_tables.rb b/db/migrate/20141216155758_create_doorkeeper_tables.rb
new file mode 100644
index 00000000000..af5aa7d8b73
--- /dev/null
+++ b/db/migrate/20141216155758_create_doorkeeper_tables.rb
@@ -0,0 +1,42 @@
+class CreateDoorkeeperTables < ActiveRecord::Migration
+ def change
+ create_table :oauth_applications do |t|
+ t.string :name, null: false
+ t.string :uid, null: false
+ t.string :secret, null: false
+ t.text :redirect_uri, null: false
+ t.string :scopes, null: false, default: ''
+ t.timestamps
+ end
+
+ add_index :oauth_applications, :uid, unique: true
+
+ create_table :oauth_access_grants do |t|
+ t.integer :resource_owner_id, null: false
+ t.integer :application_id, null: false
+ t.string :token, null: false
+ t.integer :expires_in, null: false
+ t.text :redirect_uri, null: false
+ t.datetime :created_at, null: false
+ t.datetime :revoked_at
+ t.string :scopes
+ end
+
+ add_index :oauth_access_grants, :token, unique: true
+
+ create_table :oauth_access_tokens do |t|
+ t.integer :resource_owner_id
+ t.integer :application_id
+ t.string :token, null: false
+ t.string :refresh_token
+ t.integer :expires_in
+ t.datetime :revoked_at
+ t.datetime :created_at, null: false
+ t.string :scopes
+ end
+
+ add_index :oauth_access_tokens, :token, unique: true
+ add_index :oauth_access_tokens, :resource_owner_id
+ add_index :oauth_access_tokens, :refresh_token, unique: true
+ end
+end