summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-12-03 15:06:20 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2019-12-03 15:06:20 +0000
commit4204cf308596e0e26f578a6e2da88f49c0f4aad9 (patch)
tree644447bcb576a459e079318b06712b7c89416e2b /db
parentcd4cb29b2c304f00d238ee72fe40c767cb3e2675 (diff)
downloadgitlab-ce-4204cf308596e0e26f578a6e2da88f49c0f4aad9.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20191107064946_update_oauth_open_id_requests_foreign_keys.rb29
-rw-r--r--db/migrate/20191120200015_add_index_to_grafana_integrations.rb15
-rw-r--r--db/schema.rb3
3 files changed, 46 insertions, 1 deletions
diff --git a/db/migrate/20191107064946_update_oauth_open_id_requests_foreign_keys.rb b/db/migrate/20191107064946_update_oauth_open_id_requests_foreign_keys.rb
new file mode 100644
index 00000000000..439610758a6
--- /dev/null
+++ b/db/migrate/20191107064946_update_oauth_open_id_requests_foreign_keys.rb
@@ -0,0 +1,29 @@
+# frozen_string_literal: true
+
+class UpdateOauthOpenIdRequestsForeignKeys < ActiveRecord::Migration[5.2]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_foreign_key(:oauth_openid_requests, :oauth_access_grants, column: :access_grant_id, on_delete: :cascade, name: new_foreign_key_name)
+ remove_foreign_key_if_exists(:oauth_openid_requests, name: existing_foreign_key_name)
+ end
+
+ def down
+ add_concurrent_foreign_key(:oauth_openid_requests, :oauth_access_grants, column: :access_grant_id, on_delete: false, name: existing_foreign_key_name)
+ remove_foreign_key_if_exists(:oauth_openid_requests, name: new_foreign_key_name)
+ end
+
+ private
+
+ def new_foreign_key_name
+ concurrent_foreign_key_name(:oauth_openid_requests, :access_grant_id)
+ end
+
+ def existing_foreign_key_name
+ 'fk_oauth_openid_requests_oauth_access_grants_access_grant_id'
+ end
+end
diff --git a/db/migrate/20191120200015_add_index_to_grafana_integrations.rb b/db/migrate/20191120200015_add_index_to_grafana_integrations.rb
new file mode 100644
index 00000000000..87292c86e97
--- /dev/null
+++ b/db/migrate/20191120200015_add_index_to_grafana_integrations.rb
@@ -0,0 +1,15 @@
+class AddIndexToGrafanaIntegrations < ActiveRecord::Migration[5.2]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :grafana_integrations, :enabled, where: 'enabled IS TRUE'
+ end
+
+ def down
+ remove_concurrent_index :grafana_integrations, :enabled
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 2715c5717f7..253d82e790b 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -1888,6 +1888,7 @@ ActiveRecord::Schema.define(version: 2019_11_25_140458) do
t.string "encrypted_token_iv", limit: 255, null: false
t.string "grafana_url", limit: 1024, null: false
t.boolean "enabled", default: false, null: false
+ t.index ["enabled"], name: "index_grafana_integrations_on_enabled", where: "(enabled IS TRUE)"
t.index ["project_id"], name: "index_grafana_integrations_on_project_id"
end
@@ -4535,7 +4536,7 @@ ActiveRecord::Schema.define(version: 2019_11_25_140458) do
add_foreign_key "notes", "projects", name: "fk_99e097b079", on_delete: :cascade
add_foreign_key "notes", "reviews", name: "fk_2e82291620", on_delete: :nullify
add_foreign_key "notification_settings", "users", name: "fk_0c95e91db7", on_delete: :cascade
- add_foreign_key "oauth_openid_requests", "oauth_access_grants", column: "access_grant_id", name: "fk_oauth_openid_requests_oauth_access_grants_access_grant_id"
+ add_foreign_key "oauth_openid_requests", "oauth_access_grants", column: "access_grant_id", name: "fk_77114b3b09", on_delete: :cascade
add_foreign_key "operations_feature_flag_scopes", "operations_feature_flags", column: "feature_flag_id", on_delete: :cascade
add_foreign_key "operations_feature_flags", "projects", on_delete: :cascade
add_foreign_key "operations_feature_flags_clients", "projects", on_delete: :cascade