Iterations - constraint date ranges do not overlap
What does this MR do?
Adds btree_gist postgresql extension Makes it so that Iterations inside the same group/project cannot have overlapping date ranges.
Screenshots
Does this MR meet the acceptance criteria?
Conformity
-
Changelog entry -
Documentation (if required) -
Code review guidelines -
Merge request performance guidelines -
Style guides -
Database guides -
Separation of EE specific content
Availability and Testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. -
Tested in all supported browsers -
Informed Infrastructure department of a default or new setting change, if applicable per definition of done
Security
If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:
-
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
Database
Migrations UP
== 20200515152649 EnableBtreeGistExtension: migrating =========================
-- execute("CREATE EXTENSION IF NOT EXISTS btree_gist")
-> 0.0544s
== 20200515152649 EnableBtreeGistExtension: migrated (0.0544s) ================
== 20200515153633 IterationDateRangeConstraint: migrating =====================
-- execute("ALTER TABLE sprints\n ADD CONSTRAINT iteration_start_and_due_daterange_project_id_constraint\n EXCLUDE USING gist\n ( project_id WITH =,\n daterange(start_date, due_date, '[]') WITH &&\n )\n WHERE (project_id IS NOT NULL)\n")
-> 0.0036s
-- execute("ALTER TABLE sprints\n ADD CONSTRAINT iteration_start_and_due_daterange_group_id_constraint\n EXCLUDE USING gist\n ( group_id WITH =,\n daterange(start_date, due_date, '[]') WITH &&\n )\n WHERE (group_id IS NOT NULL)\n")
-> 0.0013s
== 20200515153633 IterationDateRangeConstraint: migrated (0.0050s) ============
Migrations DOWN
== 20200515153633 IterationDateRangeConstraint: reverting =====================
-- execute("ALTER TABLE sprints\n DROP CONSTRAINT IF EXISTS iteration_start_and_due_daterange_project_id_constraint\n")
-> 0.0013s
-- execute("ALTER TABLE sprints\n DROP CONSTRAINT IF EXISTS iteration_start_and_due_daterange_group_id_constraint\n")
-> 0.0003s
== 20200515153633 IterationDateRangeConstraint: reverted (0.0017s) ============
== 20200515152649 EnableBtreeGistExtension: reverting =========================
-- execute("DROP EXTENSION IF EXISTS btree_gist")
-> 0.0174s
== 20200515152649 EnableBtreeGistExtension: reverted (0.0174s) ================
Edited by Yorick Peterse