Commit dc71f42b authored by Stan Hu's avatar Stan Hu

Enforce default, global project and snippet visibilities

Prior to this change, it was possible for the global project and snippet
visibilities to be NULL, which could cause errors in the UI. We now
enforce a NOT NULL constraint and set the default value to private for
both visibility levels.

Closes https://gitlab.com/gitlab-org/gitlab/issues/35013
parent 0f8cee80
---
title: Enforce default, global project and snippet visibilities
merge_request: 19188
author:
type: fixed
# frozen_string_literal: true
class SetApplicationSettingsDefaultProjectAndSnippetVisibility < ActiveRecord::Migration[5.2]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
def change
change_column_null :application_settings, :default_project_visibility, false, 0
change_column_default :application_settings, :default_project_visibility, from: nil, to: 0
change_column_null :application_settings, :default_snippet_visibility, false, 0
change_column_default :application_settings, :default_snippet_visibility, from: nil, to: 0
end
end
......@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 2019_10_26_041447) do
ActiveRecord::Schema.define(version: 2019_10_26_124116) do
# These are extensions that must be enabled in order to support this database
enable_extension "pg_trgm"
......@@ -158,8 +158,8 @@ ActiveRecord::Schema.define(version: 2019_10_26_041447) do
t.text "restricted_visibility_levels"
t.boolean "version_check_enabled", default: true
t.integer "max_attachment_size", default: 10, null: false
t.integer "default_project_visibility"
t.integer "default_snippet_visibility"
t.integer "default_project_visibility", default: 0, null: false
t.integer "default_snippet_visibility", default: 0, null: false
t.text "domain_whitelist"
t.boolean "user_oauth_applications", default: true
t.string "after_sign_out_path"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment