Commit c259a36d authored by Andreas Brandl's avatar Andreas Brandl

Merge branch 'cgomes-dbchanges-review-include-rollback' into 'master'

Adding step to ensure author includes rollback information

See merge request gitlab-org/gitlab!17537
parents 1aca8b70 c2e21cfc
...@@ -24,6 +24,7 @@ When adding migrations: ...@@ -24,6 +24,7 @@ When adding migrations:
- [ ] Added a `down` method so the migration can be reverted - [ ] Added a `down` method so the migration can be reverted
- [ ] Added the output of the migration(s) to the MR body - [ ] Added the output of the migration(s) to the MR body
- [ ] Added tests for the migration in `spec/migrations` if necessary (e.g. when migrating data) - [ ] Added tests for the migration in `spec/migrations` if necessary (e.g. when migrating data)
- [ ] Added rollback procedure. Include either a rollback procedure or description how to rollback changes
When adding or modifying queries to improve performance: When adding or modifying queries to improve performance:
......
...@@ -94,17 +94,18 @@ and details for a database reviewer: ...@@ -94,17 +94,18 @@ and details for a database reviewer:
- Check queries timing (If any): Queries executed in a migration - Check queries timing (If any): Queries executed in a migration
need to fit comfortably within `15s` - preferably much less than that - on GitLab.com. need to fit comfortably within `15s` - preferably much less than that - on GitLab.com.
- Check [background migrations](background_migrations.md): - Check [background migrations](background_migrations.md):
- For data migrations, establish a time estimate for execution - Establish a time estimate for execution
- They should only be used when migrating data in larger tables. - They should only be used when migrating data in larger tables.
- If a single `update` is below than `1s` the query can be placed - If a single `update` is below than `1s` the query can be placed
directly in a regular migration (inside `db/migrate`). directly in a regular migration (inside `db/migrate`).
- Review queries (for example, make sure batch sizes are fine) - Review queries (for example, make sure batch sizes are fine)
- Establish a time estimate for execution
- Because execution time can be longer than for a regular migration, - Because execution time can be longer than for a regular migration,
it's suggested to treat background migrations as post migrations: it's suggested to treat background migrations as post migrations:
place them in `db/post_migrate` instead of `db/migrate`. Keep in mind place them in `db/post_migrate` instead of `db/migrate`. Keep in mind
that post migrations are executed post-deployment in production. that post migrations are executed post-deployment in production.
- Check [timing guidelines for migrations](#timing-guidelines-for-migrations) - Check [timing guidelines for migrations](#timing-guidelines-for-migrations)
- Check migrations are reversible and implement a `#down` method
- Data migrations should be reversible too or come with a description of how to reverse, when possible. This applies to all types of migrations (regular, post-deploy, background).
- Query performance - Query performance
- Check for any obviously complex queries and queries the author specifically - Check for any obviously complex queries and queries the author specifically
points out for review (if any) points out for review (if any)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment