diff options
author | Yorick Peterse <yorickpeterse@gmail.com> | 2017-06-21 16:09:34 +0200 |
---|---|---|
committer | Yorick Peterse <yorickpeterse@gmail.com> | 2017-06-22 17:44:09 +0200 |
commit | 2438ffa4753a770dfede20a66b48bce420ecda3d (patch) | |
tree | 0092608b3d1381fc43afd21fad53ad4b7fe8af88 | |
parent | cf3cdd48bb4959cb277752a16a4b98b7f4a4f3c4 (diff) | |
download | gitlab-ce-2438ffa4753a770dfede20a66b48bce420ecda3d.tar.gz |
Added a template for database changesdb-changes-mr-template
This template includes a rather large (but fairly easy to follow)
checklist. This checklist should hopefully take away quite a bit of work
from database specialists by requiring authors to provide all the
necessary info.
[ci skip]
-rw-r--r-- | .gitlab/merge_request_templates/Database Changes.md | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/.gitlab/merge_request_templates/Database Changes.md b/.gitlab/merge_request_templates/Database Changes.md new file mode 100644 index 00000000000..f0172e17350 --- /dev/null +++ b/.gitlab/merge_request_templates/Database Changes.md @@ -0,0 +1,66 @@ +Remove this section and replace it with a description of your MR. Also follow the +checklist below and check off any tasks that are done. If a certain task can not +be done you should explain so in the MR body. + +When gathering statistics (e.g. the output of `EXPLAIN ANALYZE`) you should make +sure your database has enough data. Having around 10 000 rows in the tables +being queries should provide a reasonable estimate of how a query will behave. +Also make sure that PostgreSQL uses the following settings: + +* `random_page_cost`: `2` +* `work_mem`: `16MB` +* `maintenance_work_mem`: at least `64MB` +* `shared_buffers`: at least `256MB` + +If you have access to GitLab.com's staging environment you should also run your +measurements there, and include the results in this MR. + +## Database Checklist + +When adding migrations: + +- [ ] Updated `db/schema.rb` +- [ ] Added a `down` method so the migration can be reverted +- [ ] Added the output of the migration(s) to the MR body +- [ ] Added the execution time of the migration(s) to the MR body +- [ ] Added tests for the migration in `spec/migrations` if necessary (e.g. when + migrating data) +- [ ] Made sure the migration won't interfere with a running GitLab cluster, + for example by disabling transactions for long running migrations + +When adding or modifying queries: + +- [ ] Included the raw SQL queries of the relevant queries +- [ ] Included the output of `EXPLAIN ANALYZE` and execution timings of the + relevant queries +- [ ] Added tests for the relevant changes + +When adding indexes: + +- [ ] Described the need for these indexes in the MR body +- [ ] Made sure existing indexes can not be reused instead + +When adding foreign keys to existing tables: + +- [ ] Included a migration to remove orphaned rows in the source table +- [ ] Removed any instances of `dependent: ...` that may no longer be necessary + +When adding tables: + +- [ ] Ordered columns based on their type sizes in descending order +- [ ] Added foreign keys if necessary +- [ ] Added indexes if necessary + +When removing columns, tables, indexes or other structures: + +- [ ] Removed these in a post-deployment migration +- [ ] Made sure the application no longer uses (or ignores) these structures + +## General Checklist + +- [ ] [Changelog entry](https://docs.gitlab.com/ce/development/changelog.html) added, if necessary +- [ ] [Documentation created/updated](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/development/doc_styleguide.md) +- [ ] Tests added for this feature/bug +- [ ] Conform by the [merge request performance guides](http://docs.gitlab.com/ce/development/merge_request_performance_guidelines.html) +- [ ] Conform by the [style guides](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CONTRIBUTING.md#style-guides) +- [ ] [Squashed related commits together](https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits) |