Commit 46c10c96 authored by Craig Gomes's avatar Craig Gomes

Merge branch 'cgomes-dbchanges-review-include-rollback' of...

Merge branch 'cgomes-dbchanges-review-include-rollback' of https://gitlab.com/gitlab-org/gitlab into cgomes-dbchanges-review-include-rollback
parents 5b168a74 76599631
...@@ -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.
- 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