Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-12-02 15:06:45 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2019-12-02 15:06:45 +0300
commitbffcdf9bca11a4d43cc40e3f382f03088d36f7c6 (patch)
treec773436393b7a59b5f6b14388b9fa6402a9bd198 /db
parent259c0cc0c4f8a49001b33d1bee577f4422e16d62 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20191118173522_add_snippet_size_limit_to_application_settings.rb13
-rw-r--r--db/migrate/20191125114345_add_admin_mode_protected_path.rb54
-rw-r--r--db/schema.rb3
3 files changed, 69 insertions, 1 deletions
diff --git a/db/migrate/20191118173522_add_snippet_size_limit_to_application_settings.rb b/db/migrate/20191118173522_add_snippet_size_limit_to_application_settings.rb
new file mode 100644
index 00000000000..b6b30febbd6
--- /dev/null
+++ b/db/migrate/20191118173522_add_snippet_size_limit_to_application_settings.rb
@@ -0,0 +1,13 @@
+# frozen_string_literal: true
+
+class AddSnippetSizeLimitToApplicationSettings < ActiveRecord::Migration[5.2]
+ DOWNTIME = false
+
+ def up
+ add_column :application_settings, :snippet_size_limit, :bigint, default: 50.megabytes, null: false
+ end
+
+ def down
+ remove_column :application_settings, :snippet_size_limit
+ end
+end
diff --git a/db/migrate/20191125114345_add_admin_mode_protected_path.rb b/db/migrate/20191125114345_add_admin_mode_protected_path.rb
new file mode 100644
index 00000000000..7e9b0d5a285
--- /dev/null
+++ b/db/migrate/20191125114345_add_admin_mode_protected_path.rb
@@ -0,0 +1,54 @@
+# frozen_string_literal: true
+
+class AddAdminModeProtectedPath < ActiveRecord::Migration[5.2]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ ADMIN_MODE_ENDPOINT = '/admin/session'
+
+ OLD_DEFAULT_PROTECTED_PATHS = [
+ '/users/password',
+ '/users/sign_in',
+ '/api/v3/session.json',
+ '/api/v3/session',
+ '/api/v4/session.json',
+ '/api/v4/session',
+ '/users',
+ '/users/confirmation',
+ '/unsubscribes/',
+ '/import/github/personal_access_token'
+ ]
+
+ NEW_DEFAULT_PROTECTED_PATHS = OLD_DEFAULT_PROTECTED_PATHS.dup << ADMIN_MODE_ENDPOINT
+
+ class ApplicationSetting < ActiveRecord::Base
+ self.table_name = 'application_settings'
+ end
+
+ def up
+ change_column_default :application_settings, :protected_paths, NEW_DEFAULT_PROTECTED_PATHS
+
+ # schema allows nulls for protected_paths
+ ApplicationSetting.where.not(protected_paths: nil).each do |application_setting|
+ unless application_setting.protected_paths.include?(ADMIN_MODE_ENDPOINT)
+ updated_protected_paths = application_setting.protected_paths << ADMIN_MODE_ENDPOINT
+
+ application_setting.update(protected_paths: updated_protected_paths)
+ end
+ end
+ end
+
+ def down
+ change_column_default :application_settings, :protected_paths, OLD_DEFAULT_PROTECTED_PATHS
+
+ # schema allows nulls for protected_paths
+ ApplicationSetting.where.not(protected_paths: nil).each do |application_setting|
+ if application_setting.protected_paths.include?(ADMIN_MODE_ENDPOINT)
+ updated_protected_paths = application_setting.protected_paths - [ADMIN_MODE_ENDPOINT]
+
+ application_setting.update(protected_paths: updated_protected_paths)
+ end
+ end
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 782610b62f5..725bcec3767 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -328,7 +328,7 @@ ActiveRecord::Schema.define(version: 2019_11_25_140458) do
t.boolean "throttle_protected_paths_enabled", default: false, null: false
t.integer "throttle_protected_paths_requests_per_period", default: 10, null: false
t.integer "throttle_protected_paths_period_in_seconds", default: 60, null: false
- t.string "protected_paths", limit: 255, default: ["/users/password", "/users/sign_in", "/api/v3/session.json", "/api/v3/session", "/api/v4/session.json", "/api/v4/session", "/users", "/users/confirmation", "/unsubscribes/", "/import/github/personal_access_token"], array: true
+ t.string "protected_paths", limit: 255, default: ["/users/password", "/users/sign_in", "/api/v3/session.json", "/api/v3/session", "/api/v4/session.json", "/api/v4/session", "/users", "/users/confirmation", "/unsubscribes/", "/import/github/personal_access_token", "/admin/session"], array: true
t.boolean "throttle_incident_management_notification_enabled", default: false, null: false
t.integer "throttle_incident_management_notification_period_in_seconds", default: 3600
t.integer "throttle_incident_management_notification_per_period", default: 3600
@@ -361,6 +361,7 @@ ActiveRecord::Schema.define(version: 2019_11_25_140458) do
t.string "encrypted_slack_app_secret_iv", limit: 255
t.text "encrypted_slack_app_verification_token"
t.string "encrypted_slack_app_verification_token_iv", limit: 255
+ t.bigint "snippet_size_limit", default: 52428800, null: false
t.index ["custom_project_templates_group_id"], name: "index_application_settings_on_custom_project_templates_group_id"
t.index ["file_template_project_id"], name: "index_application_settings_on_file_template_project_id"
t.index ["instance_administration_project_id"], name: "index_applicationsettings_on_instance_administration_project_id"