Skip to content
代码片段 群组 项目
提交 734dc668 编辑于 作者: Doug Stull's avatar Doug Stull
浏览文件

Merge branch 'bojan/applications-settings-columns-cleanup' into 'master'

Remove columns from the `application_settings` table

See merge request https://gitlab.com/gitlab-org/gitlab/-/merge_requests/137985



Merged-by: default avatarDoug Stull <dstull@gitlab.com>
Approved-by: default avatarJaviera Tapia <jtapia@gitlab.com>
Approved-by: default avatarLeonardo da Rosa <ldarosa@gitlab.com>
Reviewed-by: default avatarDoug Stull <dstull@gitlab.com>
Reviewed-by: default avatarBojan Marjanovic <bmarjanovic@gitlab.com>
Reviewed-by: default avatarLeonardo da Rosa <ldarosa@gitlab.com>
Co-authored-by: default avatarbmarjanovic <bmarjanovic@gitlab.com>
No related branches found
No related tags found
无相关合并请求
# frozen_string_literal: true
class RemoveApplicationSettingsColumns < Gitlab::Database::Migration[2.2]
milestone '16.7'
disable_ddl_transaction!
def up
remove_column :application_settings, :elasticsearch_shards, if_exists: true
remove_column :application_settings, :elasticsearch_replicas, if_exists: true
remove_column :application_settings, :static_objects_external_storage_auth_token, if_exists: true
remove_column :application_settings, :web_ide_clientside_preview_enabled, if_exists: true
end
def down
add_column :application_settings, :elasticsearch_shards, :integer, default: 5, null: false, if_not_exists: true
add_column :application_settings, :elasticsearch_replicas, :integer, default: 1, null: false, if_not_exists: true
add_column :application_settings, :static_objects_external_storage_auth_token, :string, limit: 255,
if_not_exists: true
add_column :application_settings, :web_ide_clientside_preview_enabled, :boolean, default: false, null: false,
if_not_exists: true
end
end
af73341ffb326a6e9d4f6b6aa836f5888182278626f51cc193f5ca906c4ccf4e
\ No newline at end of file
......@@ -11873,7 +11873,6 @@ CREATE TABLE application_settings (
snowplow_enabled boolean DEFAULT false NOT NULL,
snowplow_collector_hostname character varying,
snowplow_cookie_domain character varying,
web_ide_clientside_preview_enabled boolean DEFAULT false NOT NULL,
user_show_add_ssh_key_message boolean DEFAULT true NOT NULL,
custom_project_templates_group_id integer,
usage_stats_set_by_user_id integer,
......@@ -11890,8 +11889,6 @@ CREATE TABLE application_settings (
lets_encrypt_notification_email character varying,
lets_encrypt_terms_of_service_accepted boolean DEFAULT false NOT NULL,
geo_node_allowed_ips character varying DEFAULT '0.0.0.0/0, ::/0'::character varying,
elasticsearch_shards integer DEFAULT 5 NOT NULL,
elasticsearch_replicas integer DEFAULT 1 NOT NULL,
encrypted_lets_encrypt_private_key text,
encrypted_lets_encrypt_private_key_iv text,
required_instance_ci_template character varying,
......@@ -11912,7 +11909,6 @@ CREATE TABLE application_settings (
encrypted_asset_proxy_secret_key text,
encrypted_asset_proxy_secret_key_iv character varying,
static_objects_external_storage_url character varying(255),
static_objects_external_storage_auth_token character varying(255),
max_personal_access_token_lifetime integer,
throttle_protected_paths_enabled boolean DEFAULT false NOT NULL,
throttle_protected_paths_requests_per_period integer DEFAULT 10 NOT NULL,
......@@ -1660,17 +1660,17 @@ def expect_invalid
end
context 'with plaintext token only' do
let(:token) { '' }
let(:plaintext_token) { Devise.friendly_token(20) }
it 'ignores the plaintext token' do
it 'encrypts the plaintext token' do
subject
described_class.update_all(static_objects_external_storage_auth_token: 'Test')
described_class.update!(static_objects_external_storage_auth_token: plaintext_token)
setting.reload
expect(setting[:static_objects_external_storage_auth_token]).to be_nil
expect(setting[:static_objects_external_storage_auth_token_encrypted]).to be_nil
expect(setting.static_objects_external_storage_auth_token).to be_nil
expect(setting[:static_objects_external_storage_auth_token_encrypted]).not_to be_nil
expect(setting.static_objects_external_storage_auth_token).to eq(plaintext_token)
end
end
end
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册