summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-01-06 19:20:58 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2021-01-06 19:20:58 +0000
commite85719b439c7ec3f2f8e3d518776f6dc307bd000 (patch)
tree67218121fe398f3fe2bd8cb27f2aded535950d01 /db
parent30235c34b0a56de6f7acde24e6fba7a0116a2e02 (diff)
downloadgitlab-ce-e85719b439c7ec3f2f8e3d518776f6dc307bd000.tar.gz
Add latest changes from gitlab-org/security/gitlab@13-6-stable-ee
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20201222151823_update_trusted_apps_to_confidential.rb23
-rw-r--r--db/schema_migrations/202012221518231
-rw-r--r--db/structure.sql2
3 files changed, 26 insertions, 0 deletions
diff --git a/db/migrate/20201222151823_update_trusted_apps_to_confidential.rb b/db/migrate/20201222151823_update_trusted_apps_to_confidential.rb
new file mode 100644
index 00000000000..bcb94c65125
--- /dev/null
+++ b/db/migrate/20201222151823_update_trusted_apps_to_confidential.rb
@@ -0,0 +1,23 @@
+# frozen_string_literal: true
+
+class UpdateTrustedAppsToConfidential < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+ INDEX_NAME = 'tmp_index_oauth_applications_on_id_where_trusted'
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :oauth_applications, :id, where: 'trusted = true', name: INDEX_NAME
+
+ execute('UPDATE oauth_applications SET confidential = true WHERE trusted = true')
+ end
+
+ def down
+ # We won't be able to tell which trusted applications weren't confidential before the migration
+ # and setting all trusted applications are not confidential would introduce security issues
+
+ remove_concurrent_index_by_name :oauth_applications, INDEX_NAME
+ end
+end
diff --git a/db/schema_migrations/20201222151823 b/db/schema_migrations/20201222151823
new file mode 100644
index 00000000000..914e96473a0
--- /dev/null
+++ b/db/schema_migrations/20201222151823
@@ -0,0 +1 @@
+d3af120a74b4c55345ac7fb524395251cd3c1b3cd9685f711196a134f427845c \ No newline at end of file
diff --git a/db/structure.sql b/db/structure.sql
index f29f9178a26..1ed6ea64eca 100644
--- a/db/structure.sql
+++ b/db/structure.sql
@@ -22367,6 +22367,8 @@ CREATE INDEX tmp_idx_index_issues_with_outdate_blocking_count ON issues USING bt
CREATE INDEX tmp_index_for_email_unconfirmation_migration ON emails USING btree (id) WHERE (confirmed_at IS NOT NULL);
+CREATE INDEX tmp_index_oauth_applications_on_id_where_trusted ON oauth_applications USING btree (id) WHERE (trusted = true);
+
CREATE UNIQUE INDEX unique_merge_request_metrics_by_merge_request_id ON merge_request_metrics USING btree (merge_request_id);
CREATE UNIQUE INDEX vulnerability_feedback_unique_idx ON vulnerability_feedback USING btree (project_id, category, feedback_type, project_fingerprint);