diff --git a/db/post_migrate/20250917093907_change_workspaces_agent_config_dns_zone_default.rb b/db/post_migrate/20250917093907_change_workspaces_agent_config_dns_zone_default.rb new file mode 100644 index 0000000000000000000000000000000000000000..135627feb0e2a7df080d8e84b630b679d1f41772 --- /dev/null +++ b/db/post_migrate/20250917093907_change_workspaces_agent_config_dns_zone_default.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +class ChangeWorkspacesAgentConfigDnsZoneDefault < Gitlab::Database::Migration[2.3] + milestone '18.5' + + def up + change_column_default :workspaces_agent_configs, :dns_zone, from: nil, to: "" + end + + def down + change_column_default :workspaces_agent_configs, :dns_zone, from: "", to: nil + end +end diff --git a/db/schema_migrations/20250917093907 b/db/schema_migrations/20250917093907 new file mode 100644 index 0000000000000000000000000000000000000000..57df1b4d13a3913c6b44f0d51f54282741193e63 --- /dev/null +++ b/db/schema_migrations/20250917093907 @@ -0,0 +1 @@ +541cb32972b3a51fb9c4ee2f4f62aaae06203b023abb91a35e03408f234ec198 \ No newline at end of file diff --git a/db/structure.sql b/db/structure.sql index 213cfc5bb853bd743fe40d64d378055af23a0f50..2183ba790bb95662b92641fa428f61d9c73b9c56 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -27626,7 +27626,7 @@ CREATE TABLE workspaces_agent_configs ( project_id bigint NOT NULL, enabled boolean NOT NULL, network_policy_enabled boolean DEFAULT true NOT NULL, - dns_zone text NOT NULL, + dns_zone text DEFAULT ''::text NOT NULL, gitlab_workspaces_proxy_namespace text DEFAULT 'gitlab-workspaces'::text NOT NULL, network_policy_egress jsonb DEFAULT '[{"allow": "0.0.0.0/0", "except": ["10.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16"]}]'::jsonb NOT NULL, default_resources_per_workspace_container jsonb DEFAULT '{}'::jsonb NOT NULL, diff --git a/ee/app/models/remote_development/workspaces_agent_config.rb b/ee/app/models/remote_development/workspaces_agent_config.rb index 908e45dd1dd7df79f4b442c3bb6f01bb6e7de325..8f5fd5a559cb892e57054c224c788bd09cda323a 100644 --- a/ee/app/models/remote_development/workspaces_agent_config.rb +++ b/ee/app/models/remote_development/workspaces_agent_config.rb @@ -6,6 +6,9 @@ class WorkspacesAgentConfig < ApplicationRecord # https://gitlab.com/gitlab-org/gitlab/-/issues/410045#note_1385602915 include Sortable + include SafelyChangeColumnDefault + + columns_changing_default :dns_zone UNLIMITED_QUOTA = -1 MIN_HOURS_BEFORE_TERMINATION = 1