Skip to content

Rename asset_proxy_allowlist column

What does this MR do?

The column rename in !50824 (merged) is considered a "breaking change" due to #322991 (closed), so it should happen only in %14.0 . This MR reverts the rename but keeps the application handling both version.

Migrations

  • Up
== 20210301200601 RenameAssetProxyAllowlistOnApplicationSettings: migrating ===
-- transaction_open?()
   -> 0.0000s
-- columns(:application_settings)
   -> 0.0431s
-- column_exists?(:application_settings, :id)
   -> 0.0380s
-- column_exists?(:application_settings, :asset_proxy_whitelist)
   -> 0.0396s
-- columns(:application_settings)
   -> 0.0414s
-- add_column(:application_settings, :asset_proxy_whitelist, :text, {:limit=>nil, :precision=>nil, :scale=>nil})
   -> 0.0027s
-- transaction_open?()
   -> 0.0000s
-- exec_query("SELECT COUNT(*) AS count FROM \"application_settings\"")
   -> 0.0020s
-- exec_query("SELECT \"application_settings\".\"id\" FROM \"application_settings\" ORDER BY \"application_settings\".\"id\" ASC LIMIT 1")
   -> 0.0007s
-- 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.0008s
-- execute("UPDATE \"application_settings\" SET \"asset_proxy_whitelist\" = \"application_settings\".\"asset_proxy_allowlist\" WHERE \"application_settings\".\"id\" >= 1")
   -> 0.0021s
-- indexes(:application_settings)
   -> 0.0039s
-- foreign_keys(:application_settings)
   -> 0.0030s
-- transaction_open?()
   -> 0.0000s
-- column_exists?(:application_settings, :asset_proxy_allowlist)
   -> 0.0401s
-- column_exists?(:application_settings, :asset_proxy_whitelist)
   -> 0.0393s
-- current_schema()
   -> 0.0003s
-- quote_table_name(:application_settings)
   -> 0.0000s
-- quote_column_name(:asset_proxy_allowlist)
   -> 0.0000s
-- quote_column_name(:asset_proxy_whitelist)
   -> 0.0000s
-- execute("CREATE OR REPLACE FUNCTION function_for_trigger_e40a6f1858e6()\nRETURNS trigger\nLANGUAGE plpgsql\nAS $$\nBEGIN\n  IF NEW.\"asset_proxy_allowlist\" IS NULL AND NEW.\"asset_proxy_whitelist\" IS NOT NULL THEN\n    NEW.\"asset_proxy_allowlist\" = NEW.\"asset_proxy_whitelist\";\n  END IF;\n\n  IF NEW.\"asset_proxy_whitelist\" IS NULL AND NEW.\"asset_proxy_allowlist\" IS NOT NULL THEN\n    NEW.\"asset_proxy_whitelist\" = NEW.\"asset_proxy_allowlist\";\n  END IF;\n\n  RETURN NEW;\nEND\n$$;\n\nDROP TRIGGER IF EXISTS trigger_e40a6f1858e6\nON \"application_settings\";\n\nCREATE TRIGGER trigger_e40a6f1858e6\nBEFORE INSERT ON \"application_settings\"\nFOR EACH ROW EXECUTE FUNCTION function_for_trigger_e40a6f1858e6();\n")
   -> 0.0036s
-- execute("CREATE OR REPLACE FUNCTION function_for_trigger_0d588df444c8()\nRETURNS trigger\nLANGUAGE plpgsql\nAS $$\nBEGIN\n  NEW.\"asset_proxy_allowlist\" := NEW.\"asset_proxy_whitelist\";\n  RETURN NEW;\nEND\n$$;\n\nDROP TRIGGER IF EXISTS trigger_0d588df444c8\nON \"application_settings\";\n\nCREATE TRIGGER trigger_0d588df444c8\nBEFORE UPDATE OF \"asset_proxy_whitelist\" ON \"application_settings\"\nFOR EACH ROW EXECUTE FUNCTION function_for_trigger_0d588df444c8();\n")
   -> 0.0010s
-- execute("CREATE OR REPLACE FUNCTION function_for_trigger_b01442420ce6()\nRETURNS trigger\nLANGUAGE plpgsql\nAS $$\nBEGIN\n  NEW.\"asset_proxy_whitelist\" := NEW.\"asset_proxy_allowlist\";\n  RETURN NEW;\nEND\n$$;\n\nDROP TRIGGER IF EXISTS trigger_b01442420ce6\nON \"application_settings\";\n\nCREATE TRIGGER trigger_b01442420ce6\nBEFORE UPDATE OF \"asset_proxy_allowlist\" ON \"application_settings\"\nFOR EACH ROW EXECUTE FUNCTION function_for_trigger_b01442420ce6();\n")
   -> 0.0009s
== 20210301200601 RenameAssetProxyAllowlistOnApplicationSettings: migrated (0.2812s)

== 20210301200959 CleanUpAssetProxyAllowlistRenameOnApplicationSettings: migrating
-- column_exists?(:application_settings, :asset_proxy_allowlist)
   -> 0.0512s
-- quote_table_name(:application_settings)
   -> 0.0000s
-- execute("DROP TRIGGER IF EXISTS trigger_e40a6f1858e6\nON \"application_settings\";\n\nDROP FUNCTION IF EXISTS function_for_trigger_e40a6f1858e6;\n")
   -> 0.0009s
-- execute("DROP TRIGGER IF EXISTS trigger_0d588df444c8\nON \"application_settings\";\n\nDROP FUNCTION IF EXISTS function_for_trigger_0d588df444c8;\n")
   -> 0.0008s
-- execute("DROP TRIGGER IF EXISTS trigger_b01442420ce6\nON \"application_settings\";\n\nDROP FUNCTION IF EXISTS function_for_trigger_b01442420ce6;\n")
   -> 0.0009s
-- remove_column(:application_settings, :asset_proxy_allowlist)
   -> 0.0013s
== 20210301200959 CleanUpAssetProxyAllowlistRenameOnApplicationSettings: migrated (0.0598s)
  • Down
== 20210301200959 CleanUpAssetProxyAllowlistRenameOnApplicationSettings: reverting
-- transaction_open?()
   -> 0.0000s
-- columns(:application_settings)
   -> 0.0426s
-- column_exists?(:application_settings, :id)
   -> 0.0406s
-- column_exists?(:application_settings, :asset_proxy_allowlist)
   -> 0.0391s
-- columns(:application_settings)
   -> 0.0384s
-- add_column(:application_settings, :asset_proxy_allowlist, :text, {:limit=>nil, :precision=>nil, :scale=>nil})
   -> 0.0035s
-- transaction_open?()
   -> 0.0000s
-- exec_query("SELECT COUNT(*) AS count FROM \"application_settings\"")
   -> 0.0019s
-- exec_query("SELECT \"application_settings\".\"id\" FROM \"application_settings\" ORDER BY \"application_settings\".\"id\" ASC LIMIT 1")
   -> 0.0012s
-- 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.0008s
-- execute("UPDATE \"application_settings\" SET \"asset_proxy_allowlist\" = \"application_settings\".\"asset_proxy_whitelist\" WHERE \"application_settings\".\"id\" >= 1")
   -> 0.0017s
-- indexes(:application_settings)
   -> 0.0038s
-- foreign_keys(:application_settings)
   -> 0.0061s
-- transaction_open?()
   -> 0.0000s
-- column_exists?(:application_settings, :asset_proxy_whitelist)
   -> 0.0412s
-- column_exists?(:application_settings, :asset_proxy_allowlist)
   -> 0.0373s
-- current_schema()
   -> 0.0003s
-- quote_table_name(:application_settings)
   -> 0.0000s
-- quote_column_name(:asset_proxy_allowlist)
   -> 0.0000s
-- quote_column_name(:asset_proxy_whitelist)
   -> 0.0000s
-- execute("CREATE OR REPLACE FUNCTION function_for_trigger_e40a6f1858e6()\nRETURNS trigger\nLANGUAGE plpgsql\nAS $$\nBEGIN\n  IF NEW.\"asset_proxy_allowlist\" IS NULL AND NEW.\"asset_proxy_whitelist\" IS NOT NULL THEN\n    NEW.\"asset_proxy_allowlist\" = NEW.\"asset_proxy_whitelist\";\n  END IF;\n\n  IF NEW.\"asset_proxy_whitelist\" IS NULL AND NEW.\"asset_proxy_allowlist\" IS NOT NULL THEN\n    NEW.\"asset_proxy_whitelist\" = NEW.\"asset_proxy_allowlist\";\n  END IF;\n\n  RETURN NEW;\nEND\n$$;\n\nDROP TRIGGER IF EXISTS trigger_e40a6f1858e6\nON \"application_settings\";\n\nCREATE TRIGGER trigger_e40a6f1858e6\nBEFORE INSERT ON \"application_settings\"\nFOR EACH ROW EXECUTE FUNCTION function_for_trigger_e40a6f1858e6();\n")
   -> 0.0118s
-- execute("CREATE OR REPLACE FUNCTION function_for_trigger_0d588df444c8()\nRETURNS trigger\nLANGUAGE plpgsql\nAS $$\nBEGIN\n  NEW.\"asset_proxy_allowlist\" := NEW.\"asset_proxy_whitelist\";\n  RETURN NEW;\nEND\n$$;\n\nDROP TRIGGER IF EXISTS trigger_0d588df444c8\nON \"application_settings\";\n\nCREATE TRIGGER trigger_0d588df444c8\nBEFORE UPDATE OF \"asset_proxy_whitelist\" ON \"application_settings\"\nFOR EACH ROW EXECUTE FUNCTION function_for_trigger_0d588df444c8();\n")
   -> 0.0011s
-- execute("CREATE OR REPLACE FUNCTION function_for_trigger_b01442420ce6()\nRETURNS trigger\nLANGUAGE plpgsql\nAS $$\nBEGIN\n  NEW.\"asset_proxy_whitelist\" := NEW.\"asset_proxy_allowlist\";\n  RETURN NEW;\nEND\n$$;\n\nDROP TRIGGER IF EXISTS trigger_b01442420ce6\nON \"application_settings\";\n\nCREATE TRIGGER trigger_b01442420ce6\nBEFORE UPDATE OF \"asset_proxy_allowlist\" ON \"application_settings\"\nFOR EACH ROW EXECUTE FUNCTION function_for_trigger_b01442420ce6();\n")
   -> 0.0010s
== 20210301200959 CleanUpAssetProxyAllowlistRenameOnApplicationSettings: reverted (0.2930s)

== 20210301200601 RenameAssetProxyAllowlistOnApplicationSettings: reverting ===
-- column_exists?(:application_settings, :asset_proxy_whitelist)
   -> 0.0435s
-- quote_table_name(:application_settings)
   -> 0.0000s
-- execute("DROP TRIGGER IF EXISTS trigger_e40a6f1858e6\nON \"application_settings\";\n\nDROP FUNCTION IF EXISTS function_for_trigger_e40a6f1858e6;\n")
   -> 0.0009s
-- execute("DROP TRIGGER IF EXISTS trigger_0d588df444c8\nON \"application_settings\";\n\nDROP FUNCTION IF EXISTS function_for_trigger_0d588df444c8;\n")
   -> 0.0006s
-- execute("DROP TRIGGER IF EXISTS trigger_b01442420ce6\nON \"application_settings\";\n\nDROP FUNCTION IF EXISTS function_for_trigger_b01442420ce6;\n")
   -> 0.0006s
-- remove_column(:application_settings, :asset_proxy_whitelist)
   -> 0.0010s
== 20210301200601 RenameAssetProxyAllowlistOnApplicationSettings: reverted (0.0544s)

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

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 issues

Related to #322991 (closed)

Edited by Katrin Leinweber

Merge request reports

Loading