Skip to content

Add required organization on Project level

Bojan Marjanovic requested to merge marjanovic/change-default-organization into master

What does this MR do and why?

This MR is follow-up from Draft: Project model should require organization (!148011 - closed) and it's the first step proposed by reviever.

We're ensuring attribute is being set at application level (no database migrations). And validating the settings are working as expected! Then we're changes to remove default from DB level.

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

Before

> project = Project.new
=> #<Project id: >>
> project.organization
=> #<Organizations::Organization:0x000000029971e5d0 id: 1, ..., name: "Default", path: "default", visibility_level: 20>

After

> project = Project.new
=> #<Project id: >>
> project.organization
=> nil
> project.valid?
=> false

How to set up and validate locally

  1. Checkout the branch
  2. Run migrations
  3. Verify that
    • project doesn't have default organization, and
    • project requires organization to be explicitly defined! 🎉

Relates to: #443857

Edited by Bojan Marjanovic

Merge request reports