Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'db/post_migrate/20230530114845_cleanup_organizations_with_null_path.rb')
-rw-r--r--db/post_migrate/20230530114845_cleanup_organizations_with_null_path.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/db/post_migrate/20230530114845_cleanup_organizations_with_null_path.rb b/db/post_migrate/20230530114845_cleanup_organizations_with_null_path.rb
new file mode 100644
index 00000000000..6d04bf6e4ec
--- /dev/null
+++ b/db/post_migrate/20230530114845_cleanup_organizations_with_null_path.rb
@@ -0,0 +1,18 @@
+# frozen_string_literal: true
+
+class CleanupOrganizationsWithNullPath < Gitlab::Database::Migration[2.1]
+ restrict_gitlab_migration gitlab_schema: :gitlab_main
+
+ module Organizations
+ class Organization < Gitlab::Database::Migration[2.1]::MigrationRecord
+ end
+ end
+
+ def up
+ Organizations::Organization.update_all("path = lower(name)")
+ end
+
+ def down
+ Organizations::Organization.update_all(path: '')
+ end
+end