summaryrefslogtreecommitdiff
path: root/db/migrate
diff options
context:
space:
mode:
authorSean McGivern <sean@gitlab.com>2017-03-07 16:16:08 +0000
committerSean McGivern <sean@gitlab.com>2017-03-07 16:16:08 +0000
commitde37dcee90ac44ba794ad504e91f18b8fb4b13a3 (patch)
tree8be4fd7cbbe1f1a06dfdfa1da12616989e28d783 /db/migrate
parent6a52cda31da4becc3e342530a2bdf0868d8921cc (diff)
parentb2ca28d24bfbb0a574fccdf1ea05d549ccd6bf66 (diff)
downloadgitlab-ce-de37dcee90ac44ba794ad504e91f18b8fb4b13a3.tar.gz
Merge branch 'siemens/gitlab-ce-feature/openid-connect'
Diffstat (limited to 'db/migrate')
-rw-r--r--db/migrate/20161209165216_create_doorkeeper_openid_connect_tables.rb37
1 files changed, 37 insertions, 0 deletions
diff --git a/db/migrate/20161209165216_create_doorkeeper_openid_connect_tables.rb b/db/migrate/20161209165216_create_doorkeeper_openid_connect_tables.rb
new file mode 100644
index 00000000000..e63d5927f86
--- /dev/null
+++ b/db/migrate/20161209165216_create_doorkeeper_openid_connect_tables.rb
@@ -0,0 +1,37 @@
+class CreateDoorkeeperOpenidConnectTables < ActiveRecord::Migration
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ create_table :oauth_openid_requests do |t|
+ t.integer :access_grant_id, null: false
+ t.string :nonce, null: false
+ end
+
+ if Gitlab::Database.postgresql?
+ # add foreign key without validation to avoid downtime on PostgreSQL,
+ # also see db/post_migrate/20170209140523_validate_foreign_keys_on_oauth_openid_requests.rb
+ execute %q{
+ ALTER TABLE "oauth_openid_requests"
+ ADD CONSTRAINT "fk_oauth_openid_requests_oauth_access_grants_access_grant_id"
+ FOREIGN KEY ("access_grant_id")
+ REFERENCES "oauth_access_grants" ("id")
+ NOT VALID;
+ }
+ else
+ execute %q{
+ ALTER TABLE oauth_openid_requests
+ ADD CONSTRAINT fk_oauth_openid_requests_oauth_access_grants_access_grant_id
+ FOREIGN KEY (access_grant_id)
+ REFERENCES oauth_access_grants (id);
+ }
+ end
+ end
+
+ def down
+ drop_table :oauth_openid_requests
+ end
+end