Skip to content

Load env for `gitlab:db:create_dynamic_partitions`

Patrick Bair requested to merge pb-load-environment-for-db-rake-tasks into master

What does this MR do?

Set :environment as an explicit dependency for gitlab:db:create_dynamic_partitions so you can run it as a standalone task.

Currently you get the below error. This works fine most of the time because it's called from db:migrate which already loads the environment, but if you want to run the partition creation manually, you can't.

rails gitlab:db:create_dynamic_partitions
rails aborted!
NameError: uninitialized constant Gitlab::Database
Did you mean?  DatabaseCleaner
/Users/pbair/Projects/gitlab-development-kit/gitlab/lib/tasks/gitlab/db.rake:118:in `block (3 levels) in <main>'

Caused by:
NameError: uninitialized constant Gitlab::Database
Did you mean?  DatabaseCleaner
/Users/pbair/Projects/gitlab-development-kit/gitlab/lib/tasks/gitlab/db.rake:118:in `block (3 levels) in <main>'
Tasks: TOP => gitlab:db:create_dynamic_partitions
(See full trace by running task with --trace)

Screenshots (strongly suggested)

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

Does this MR contain changes to processing or storing of credentials or tokens, authorization and authentication methods or other items described in the security review guidelines? If not, then delete this Security section.

  • Label as security and @ mention @gitlab-com/gl-security/appsec
  • The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • Security reports checked/validated by a reviewer from the AppSec team
Edited by Patrick Bair

Merge request reports