diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-05-17 19:05:49 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-05-17 19:05:49 +0300 |
commit | 43a25d93ebdabea52f99b05e15b06250cd8f07d7 (patch) | |
tree | dceebdc68925362117480a5d672bcff122fb625b /db/migrate/20230327123333_backfill_product_analytics_data_collector_host.rb | |
parent | 20c84b99005abd1c82101dfeff264ac50d2df211 (diff) |
Add latest changes from gitlab-org/gitlab@16-0-stable-eev16.0.0-rc42
Diffstat (limited to 'db/migrate/20230327123333_backfill_product_analytics_data_collector_host.rb')
-rw-r--r-- | db/migrate/20230327123333_backfill_product_analytics_data_collector_host.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/db/migrate/20230327123333_backfill_product_analytics_data_collector_host.rb b/db/migrate/20230327123333_backfill_product_analytics_data_collector_host.rb new file mode 100644 index 00000000000..04041d78c3e --- /dev/null +++ b/db/migrate/20230327123333_backfill_product_analytics_data_collector_host.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +class BackfillProductAnalyticsDataCollectorHost < Gitlab::Database::Migration[2.1] + restrict_gitlab_migration gitlab_schema: :gitlab_main + + def up + # fills product_analytics_data_collector_host by replacing jitsu_host subdomain with collector + regex = "'://(.+?\\.)'" + replace_with = "'://collector.'" + execute <<~SQL + UPDATE application_settings + SET product_analytics_data_collector_host = regexp_replace(jitsu_host, #{regex}, #{replace_with}, 'g') + WHERE jitsu_host IS NOT NULL AND product_analytics_data_collector_host IS NULL + SQL + end + + def down + # noop + end +end |