Skip to content
Snippets Groups Projects

Modify namespace name and path validation

Merged username-removed-444 requested to merge dz-remove-namespaces-path-uniq into master
2 unresolved threads

What does this MR do?

  • Allow same namespace name with different parent_id
  • Allow same namespace path. Uniq validation should be handled by routes table

Are there points in the code the reviewer needs to double check?

migrations

Why was this MR needed?

So we can use same name in different nesting like:

gitlab-ce/foo
gitlab-com/foo
foo/gitlab-ce

Screenshots (if relevant)

no

Does this MR meet the acceptance criteria?

What are the relevant issue numbers?

https://gitlab.com/gitlab-org/gitlab-ce/issues/2772

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
6 6 it { is_expected.to have_many :projects }
7 7
8 8 it { is_expected.to validate_presence_of(:name) }
9 it { is_expected.to validate_uniqueness_of(:name) }
9 it { is_expected.to validate_uniqueness_of(:name).scoped_to(:parent_id) }
  • 5 include Gitlab::Database::MigrationHelpers
    6
    7 disable_ddl_transaction!
    8
    9 DOWNTIME = false
    10
    11 def up
    12 constraint_name = 'namespaces_path_key'
    13
    14 transaction do
    15 if index_exists?(:namespaces, :path)
    16 remove_index(:namespaces, :path)
    17 end
    18
    19 # In some bizarre cases PostgreSQL might have a separate unique constraint
    20 # that we'll need to drop.
  • @dzaporozhets LGTM, two questions.

  • @smcgivern thanks. I am going to merge it but please checkout my comments so I can improve in separate MR if needed

  • mentioned in commit 4bdfb039

  • added 169 commits

    Compare with previous version

  • mentioned in commit abad9a9b

  • Please register or sign in to reply
    Loading