Seed Default Organization in Production and Development
What does this MR do and why?
In !120118 (merged), we added the concept of a Default Organization. This organization was added using a database migration so gitlab.com does have this organization.
However, we also need to be sure that this organization is created on new installations. We do not run old migrations during the installation of a GitLab instance
This MR adds creation of the default organization to both development and production.
It also includes a migration that conditionally creates the Default Organization, for self-managed instances that were installed after the original migration.
Installed using GitLab version... | Has the default organization? | Solution |
---|---|---|
Before %16.0 | Yes | - |
%16.0 | No | Will run migration from this MR |
%16.1 and newer | No | Add Default Organization as part of DB seeding |
Related issue #411441 (closed)
How to set up and validate locally
Rails Env Development:
git checkout master
gdk reset-data
-
gdk psql -c "SELECT * FROM organizations WHERE id = 1"
Result: no organizations git checkout rw-seed-default-organization
gdk reset-data
-
gdk psql -c "SELECT * FROM organizations WHERE id = 1"
Result: one organization
Rails Env Production:
I ran this on my local development, while having redis listening on the default port:
git checkout master
DISABLE_DATABASE_ENVIRONMENT_CHECK=1 RAILS_ENV=production rake db:environment:set db:drop db:create db:schema:load db:seed_fu
-
gdk psql -c "SELECT * FROM organizations WHERE id = 1"
Result: no organizations git checkout rw-seed-default-organization
DISABLE_DATABASE_ENVIRONMENT_CHECK=1 RAILS_ENV=production rake db:environment:set db:drop db:create db:schema:load db:seed_fu
-
gdk psql -c "SELECT * FROM organizations WHERE id = 1"
Result: one organization
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.