Fix incorrect renaming migrations
This fixes the things that were incorrectly renamed in https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/10413
-
The users which had their personal namespace renamed, will now have their username renamed to match the namespace
this should be maximum 17 users to update:
SELECT count("users".*) FROM "users" WHERE ("users"."username" ILIKE '-' OR "users"."username" ILIKE 'abuse_reports' OR "users"."username" ILIKE 'api' OR "users"."username" ILIKE 'autocomplete' OR "users"."username" ILIKE 'explore' OR "users"."username" ILIKE 'health_check' OR "users"."username" ILIKE 'import' OR "users"."username" ILIKE 'invites' OR "users"."username" ILIKE 'jwt' OR "users"."username" ILIKE 'koding' OR "users"."username" ILIKE 'member' OR "users"."username" ILIKE 'notification_settings' OR "users"."username" ILIKE 'oauth' OR "users"."username" ILIKE 'sent_notifications' OR "users"."username" ILIKE 'unicorn_test' OR "users"."username" ILIKE 'uploads' OR "users"."username" ILIKE 'users') ORDER BY "users"."id" DESC
Closes #32526 (closed)
-
The routes that were incorrectly renamed because of https://gitlab.com/gitlab-org/gitlab-ce/issues/32528
According to https://gitlab.slack.com/archives/C101F3796/p1495181871458006 there are 325 incorrectly renamed root-routes.
The query for this is:
SELECT count("routes".*) FROM "routes" INNER JOIN namespaces ON routes.source_id = namespaces.id WHERE ("routes"."source_type" = 'Namespace' AND "namespaces"."parent_id" IS NULL) AND ("namespaces"."path" ILIKE '-%' OR "namespaces"."path" ILIKE 'abuse_reports%' OR "namespaces"."path" ILIKE 'api%' OR "namespaces"."path" ILIKE 'autocomplete%' OR "namespaces"."path" ILIKE 'explore%' OR "namespaces"."path" ILIKE 'health_check%' OR "namespaces"."path" ILIKE 'import%' OR "namespaces"."path" ILIKE 'invites%' OR "namespaces"."path" ILIKE 'jwt%' OR "namespaces"."path" ILIKE 'koding%' OR "namespaces"."path" ILIKE 'member%' OR "namespaces"."path" ILIKE 'notification_settings%' OR "namespaces"."path" ILIKE 'oauth%' OR "namespaces"."path" ILIKE 'sent_notifications%' OR "namespaces"."path" ILIKE 'unicorn_test%' OR "namespaces"."path" ILIKE 'uploads%' OR "namespaces"."path" ILIKE 'users%') AND (NOT (("namespaces"."path" ILIKE '-0%' OR "namespaces"."path" ILIKE 'abuse_reports0%' OR "namespaces"."path" ILIKE 'api0%' OR "namespaces"."path" ILIKE 'autocomplete0%' OR "namespaces"."path" ILIKE 'explore0%' OR "namespaces"."path" ILIKE 'health_check0%' OR "namespaces"."path" ILIKE 'import0%' OR "namespaces"."path" ILIKE 'invites0%' OR "namespaces"."path" ILIKE 'jwt0%' OR "namespaces"."path" ILIKE 'koding0%' OR "namespaces"."path" ILIKE 'member0%' OR "namespaces"."path" ILIKE 'notification_settings0%' OR "namespaces"."path" ILIKE 'oauth0%' OR "namespaces"."path" ILIKE 'sent_notifications0%' OR "namespaces"."path" ILIKE 'unicorn_test0%' OR "namespaces"."path" ILIKE 'uploads0%' OR "namespaces"."path" ILIKE 'users0%'))) AND ("routes"."path" ILIKE '-0%' OR "routes"."path" ILIKE 'abuse_reports0%' OR "routes"."path" ILIKE 'api0%' OR "routes"."path" ILIKE 'autocomplete0%' OR "routes"."path" ILIKE 'explore0%' OR "routes"."path" ILIKE 'health_check0%' OR "routes"."path" ILIKE 'import0%' OR "routes"."path" ILIKE 'invites0%' OR "routes"."path" ILIKE 'jwt0%' OR "routes"."path" ILIKE 'koding0%' OR "routes"."path" ILIKE 'member0%' OR "routes"."path" ILIKE 'notification_settings0%' OR "routes"."path" ILIKE 'oauth0%' OR "routes"."path" ILIKE 'sent_notifications0%' OR "routes"."path" ILIKE 'unicorn_test0%' OR "routes"."path" ILIKE 'uploads0%' OR "routes"."path" ILIKE 'users0%');
Of course we need to rename all child-routes as well, but that is done in batches for each of these 325 results separately. I haven't been able to look into that.
To see which root namespaces are going to be renamed, and into what they will be renamed, you could run:
SELECT "routes"."path", "namespaces"."path" AS namespace_path FROM "routes" INNER JOIN namespaces ON routes.source_id = namespaces.id WHERE ("routes"."source_type" = 'Namespace' AND "namespaces"."parent_id" IS NULL) AND ("namespaces"."path" ILIKE '-%' OR "namespaces"."path" ILIKE 'abuse_reports%' OR "namespaces"."path" ILIKE 'api%' OR "namespaces"."path" ILIKE 'autocomplete%' OR "namespaces"."path" ILIKE 'explore%' OR "namespaces"."path" ILIKE 'health_check%' OR "namespaces"."path" ILIKE 'import%' OR "namespaces"."path" ILIKE 'invites%' OR "namespaces"."path" ILIKE 'jwt%' OR "namespaces"."path" ILIKE 'koding%' OR "namespaces"."path" ILIKE 'member%' OR "namespaces"."path" ILIKE 'notification_settings%' OR "namespaces"."path" ILIKE 'oauth%' OR "namespaces"."path" ILIKE 'sent_notifications%' OR "namespaces"."path" ILIKE 'unicorn_test%' OR "namespaces"."path" ILIKE 'uploads%' OR "namespaces"."path" ILIKE 'users%') AND (NOT (("namespaces"."path" ILIKE '-0%' OR "namespaces"."path" ILIKE 'abuse_reports0%' OR "namespaces"."path" ILIKE 'api0%' OR "namespaces"."path" ILIKE 'autocomplete0%' OR "namespaces"."path" ILIKE 'explore0%' OR "namespaces"."path" ILIKE 'health_check0%' OR "namespaces"."path" ILIKE 'import0%' OR "namespaces"."path" ILIKE 'invites0%' OR "namespaces"."path" ILIKE 'jwt0%' OR "namespaces"."path" ILIKE 'koding0%' OR "namespaces"."path" ILIKE 'member0%' OR "namespaces"."path" ILIKE 'notification_settings0%' OR "namespaces"."path" ILIKE 'oauth0%' OR "namespaces"."path" ILIKE 'sent_notifications0%' OR "namespaces"."path" ILIKE 'unicorn_test0%' OR "namespaces"."path" ILIKE 'uploads0%' OR "namespaces"."path" ILIKE 'users0%'))) AND ("routes"."path" ILIKE '-0%' OR "routes"."path" ILIKE 'abuse_reports0%' OR "routes"."path" ILIKE 'api0%' OR "routes"."path" ILIKE 'autocomplete0%' OR "routes"."path" ILIKE 'explore0%' OR "routes"."path" ILIKE 'health_check0%' OR "routes"."path" ILIKE 'import0%' OR "routes"."path" ILIKE 'invites0%' OR "routes"."path" ILIKE 'jwt0%' OR "routes"."path" ILIKE 'koding0%' OR "routes"."path" ILIKE 'member0%' OR "routes"."path" ILIKE 'notification_settings0%' OR "routes"."path" ILIKE 'oauth0%' OR "routes"."path" ILIKE 'sent_notifications0%' OR "routes"."path" ILIKE 'unicorn_test0%' OR "routes"."path" ILIKE 'uploads0%' OR "routes"."path" ILIKE 'users0%');
path
is what is currently incorrect, and it will be renamed into namespace.path
Closes #32530 (closed)
Merge request reports
Activity
added database label
added 1 commit
- df5c3f36 - Rename users that had their namespace renamed
mentioned in issue #31934 (closed)
marked the checklist item The routes that were incorrectly renamed because of https://gitlab.com/gitlab-org/gitlab-ce/issues/32528 as completed
Ok, that should set all things straight. @yorickpeterse I would really appreciate your input on this one
.cc @DouweM
assigned to @yorickpeterse
- Resolved by Bob Van Landuyt :neckbeard:
- Resolved by Bob Van Landuyt :neckbeard:
- Resolved by Bob Van Landuyt :neckbeard:
- Resolved by Douwe Maan
assigned to @reprazent
added Next Patch Release label
1 require 'spec_helper' 2 require Rails.root.join('db', 'post_migrate', '20170518200835_rename_users_with_renamed_namespace.rb') 3 4 describe RenameUsersWithRenamedNamespace, truncate: true do 5 it 'renames a user that had his namespace renamed to the namespace path' do 6 other_user = create(:user, username: 'kodingu') @yorickpeterse I've adressed most of your comments, one more question left, could you take another look?
assigned to @yorickpeterse
mentioned in issue gitlab-com/support-forum#1857 (closed)
- Resolved by Douwe Maan
- Resolved by Douwe Maan
mentioned in commit 09c5885a
mentioned in commit f2768ed6
removed Next Patch Release label
Great job guys on releasing the fix.
I did notice something else, the links in my case works if I go directly e.g. gitlab.com/kodingu/kodingu, but if I click the link under the kodingu project, it still goes to gitlab.com/koding0u/kodingu.The extra 0 is still there.
Thanks again for fixing the issue.
Edited by username-removed-529882@bluetazmanian Right, good catch, that's the project list view that's still cached. A quick workaround for this would be editing the
kodingu
group, changing the name (not the path ), and then changing it back.I'll reopen https://gitlab.com/gitlab-org/gitlab-ce/issues/32530 to look at this.
mentioned in issue #32530 (closed)
@reprazent Worked as advertised. Kudos to you and the team.
mentioned in issue gitlab-com/infrastructure#1846 (closed)
mentioned in issue gitlab-com/infrastructure#1909 (closed)