Skip to content

Rails db: always put main first

Jason Plum requested to merge 6372-order-db-stanzas into master

What does this MR do?

Always place main stanza of database.yml first. As Rails expects primary instead of main, it is possible that the following results in a bad template, due to hash entry order when using .each

gitlab_rails['databases']['ci']['enable'] = true
gitlab_rails['databases']['ci']['db_database'] = 'gitlabhq_production_ci'

Will result in:

@databases = {
'ci' => { ... },  # from user configuration
'main' => { ... } # from `generate_main_database`
}

See #6372 (closed) for details.

Related issues

Closes #6372 (closed)

Checklist

See Definition of done.

For anything in this list which will not be completed, please provide a reason in the MR discussion

Required

  • Merge Request Title, and Description are up to date, accurate, and descriptive
  • MR targeting the appropriate branch
  • MR has a green pipeline on GitLab.com
  • Pipeline is green on dev.gitlab.org if the change is touching anything besides documentation or internal cookbooks
  • trigger-package has a green pipeline running against latest commit

Expected (please provide an explanation if not completing)

  • Test plan indicating conditions for success has been posted and passes
  • Documentation created/updated
  • Tests added
  • Integration tests added to GitLab QA
  • Equivalent MR/issue for the GitLab Chart opened

Merge request reports