diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-12-16 12:09:38 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-12-16 12:09:38 +0300 |
commit | bc9b43904d491c7b864c8fb6ba06ae0f6625db0d (patch) | |
tree | ca0a5ae3bbbf98530707b96a7db08d1bd773b429 /db/migrate/20221209110935_fix_update_import_sources_on_application_settings.rb | |
parent | 10476ea7d8253d8462e092ed95aedc01204238bc (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'db/migrate/20221209110935_fix_update_import_sources_on_application_settings.rb')
-rw-r--r-- | db/migrate/20221209110935_fix_update_import_sources_on_application_settings.rb | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/db/migrate/20221209110935_fix_update_import_sources_on_application_settings.rb b/db/migrate/20221209110935_fix_update_import_sources_on_application_settings.rb new file mode 100644 index 00000000000..d3123113e82 --- /dev/null +++ b/db/migrate/20221209110935_fix_update_import_sources_on_application_settings.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +# This fixes 20221209110934_update_import_sources_on_application_settings.rb, which +# previously serialized a YAML column into a string. +class FixUpdateImportSourcesOnApplicationSettings < Gitlab::Database::Migration[2.0] + disable_ddl_transaction! + + restrict_gitlab_migration gitlab_schema: :gitlab_main + + class ApplicationSetting < MigrationRecord + end + + def up + sources = ApplicationSetting.last&.import_sources + + return unless sources.is_a?(String) + return if sources.start_with?('---') + + sources = YAML.safe_load(sources) + + ApplicationSetting.update_all(import_sources: sources.to_yaml) + end + + def down; end +end |