Rename asset_proxy_whitelist column
What does this MR do?
This MR replaces asset_proxy_whitelist
on application_settings
with asset_proxy_allowlist
.
We would like to keep this change backward-compatible for the Application Settings API. This support will be dropped with API v5.
🐘 Database
The DB migration is following the renaming column guideline.
Migrate
== 20210105052034 RenameAssetProxyWhitelistOnApplicationSettings: migrating ===
-- column_exists?(:application_settings, :id)
-> 0.0431s
-- transaction_open?()
-> 0.0000s
-- columns(:application_settings)
-> 0.0413s
-- add_column(:application_settings, :asset_proxy_allowlist, :text, {:limit=>nil, :precision=>nil, :scale=>nil})
-> 0.0023s
-- transaction_open?()
-> 0.0000s
-- exec_query("SELECT COUNT(*) AS count FROM \"application_settings\"")
-> 0.0027s
-- indexes(:application_settings)
-> 0.0051s
-- foreign_keys(:application_settings)
-> 0.0031s
-- transaction_open?()
-> 0.0000s
-- column_exists?(:application_settings, :asset_proxy_whitelist)
-> 0.0424s
-- column_exists?(:application_settings, :asset_proxy_allowlist)
-> 0.0428s
-- current_schema()
-> 0.0004s
-- quote_table_name(:application_settings)
-> 0.0000s
-- quote_column_name(:asset_proxy_whitelist)
-> 0.0001s
-- quote_column_name(:asset_proxy_allowlist)
-> 0.0000s
-- execute("CREATE OR REPLACE FUNCTION trigger_1e2b45eefbe0()\nRETURNS trigger AS\n$BODY$\nBEGIN\n NEW.\"asset_proxy_allowlist\" := NEW.\"asset_proxy_whitelist\";\n RETURN NEW;\nEND;\n$BODY$\nLANGUAGE 'plpgsql'\nVOLATILE\n")
-> 0.0036s
-- execute("DROP TRIGGER IF EXISTS trigger_1e2b45eefbe0\nON \"application_settings\"\n")
-> 0.0009s
-- execute("CREATE TRIGGER trigger_1e2b45eefbe0\nBEFORE INSERT OR UPDATE\nON \"application_settings\"\nFOR EACH ROW\nEXECUTE FUNCTION trigger_1e2b45eefbe0()\n")
-> 0.0019s
== 20210105052034 RenameAssetProxyWhitelistOnApplicationSettings: migrated (0.4363s)
== 20210105052229 CleanUpAssetProxyWhitelistRenameOnApplicationSettings: migrating
-- execute("DROP TRIGGER IF EXISTS trigger_1e2b45eefbe0 ON application_settings")
-> 0.0025s
-- execute("DROP FUNCTION IF EXISTS trigger_1e2b45eefbe0()")
-> 0.0012s
-- remove_column(:application_settings, :asset_proxy_whitelist)
-> 0.0016s
== 20210105052229 CleanUpAssetProxyWhitelistRenameOnApplicationSettings: migrated (0.0067s)
Revert
== 20210105052229 CleanUpAssetProxyWhitelistRenameOnApplicationSettings: reverting
-- column_exists?(:application_settings, :id)
-> 0.0425s
-- transaction_open?()
-> 0.0000s
-- columns(:application_settings)
-> 0.0391s
-- add_column(:application_settings, :asset_proxy_whitelist, :text, {:limit=>nil, :precision=>nil, :scale=>nil})
-> 0.0010s
-- transaction_open?()
-> 0.0000s
-- exec_query("SELECT COUNT(*) AS count FROM \"application_settings\"")
-> 0.0014s
-- exec_query("SELECT \"application_settings\".\"id\" FROM \"application_settings\" ORDER BY \"application_settings\".\"id\" ASC LIMIT 1")
-> 0.0006s
-- exec_query("SELECT \"application_settings\".\"id\" FROM \"application_settings\" WHERE \"application_settings\".\"id\" >= 1 ORDER BY \"application_settings\".\"id\" ASC LIMIT 1 OFFSET 1")
-> 0.0004s
-- execute("UPDATE \"application_settings\" SET \"asset_proxy_whitelist\" = \"application_settings\".\"asset_proxy_allowlist\" WHERE \"application_settings\".\"id\" >= 1")
-> 0.0015s
-- indexes(:application_settings)
-> 0.0044s
-- foreign_keys(:application_settings)
-> 0.0027s
-- transaction_open?()
-> 0.0000s
-- column_exists?(:application_settings, :asset_proxy_allowlist)
-> 0.0377s
-- column_exists?(:application_settings, :asset_proxy_whitelist)
-> 0.0370s
-- current_schema()
-> 0.0003s
-- quote_table_name(:application_settings)
-> 0.0000s
-- quote_column_name(:asset_proxy_whitelist)
-> 0.0000s
-- quote_column_name(:asset_proxy_allowlist)
-> 0.0000s
-- execute("CREATE OR REPLACE FUNCTION trigger_1e2b45eefbe0()\nRETURNS trigger AS\n$BODY$\nBEGIN\n NEW.\"asset_proxy_allowlist\" := NEW.\"asset_proxy_whitelist\";\n RETURN NEW;\nEND;\n$BODY$\nLANGUAGE 'plpgsql'\nVOLATILE\n")
-> 0.0027s
-- execute("DROP TRIGGER IF EXISTS trigger_1e2b45eefbe0\nON \"application_settings\"\n")
-> 0.0003s
-- execute("CREATE TRIGGER trigger_1e2b45eefbe0\nBEFORE INSERT OR UPDATE\nON \"application_settings\"\nFOR EACH ROW\nEXECUTE FUNCTION trigger_1e2b45eefbe0()\n")
-> 0.0007s
== 20210105052229 CleanUpAssetProxyWhitelistRenameOnApplicationSettings: reverted (0.1861s)
== 20210105052034 RenameAssetProxyWhitelistOnApplicationSettings: reverting ===
-- execute("DROP TRIGGER IF EXISTS trigger_1e2b45eefbe0 ON application_settings")
-> 0.0007s
-- execute("DROP FUNCTION IF EXISTS trigger_1e2b45eefbe0()")
-> 0.0005s
-- remove_column(:application_settings, :asset_proxy_allowlist)
-> 0.0008s
== 20210105052034 RenameAssetProxyWhitelistOnApplicationSettings: reverted (0.0025s)
Does this MR meet the acceptance criteria?
Conformity
-
Changelog entry -
Documentation (if required) -
Code review guidelines -
Merge request performance guidelines -
Style guides -
Database guides -
Separation of EE specific content
Availability and Testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. -
Tested in all supported browsers -
Informed Infrastructure department of a default or new setting change, if applicable per definition of done
Security
If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:
- [-] Label as security and @ mention
@gitlab-com/gl-security/appsec
- [-] The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
- [-] Security reports checked/validated by a reviewer from the AppSec team
Related to #295621 (closed)
Edited by Tan Le