Skip to content
Snippets Groups Projects
Commit 0267b42a authored by Jonathan Weth's avatar Jonathan Weth :keyboard:
Browse files

Merge branch '141-unique-constraints-doesn-t-include-all-necessary-fields' into 'master'

Resolve "Unique constraints doesn't include all necessary fields"

Closes #141

See merge request !175
parents 7e9d5201 cf613287
No related branches found
No related tags found
1 merge request!175Resolve "Unique constraints doesn't include all necessary fields"
Pipeline #15406 passed
Pipeline: AlekSIS

#15409

    ......@@ -6,6 +6,14 @@ All notable changes to this project will be documented in this file.
    The format is based on `Keep a Changelog`_,
    and this project adheres to `Semantic Versioning`_.
    Unreleased
    ----------
    Fixed
    ~~~~~
    * Unique constraints for breaks and substitutions were too tight
    `2.0b0`_ - 2021-05-21
    ---------------------
    ......
    ......@@ -52,11 +52,11 @@ class Migration(migrations.Migration):
    ),
    migrations.AddConstraint(
    model_name='break',
    constraint=models.UniqueConstraint(fields=('site_id', 'short_name'), name='unique_short_name_per_site_break'),
    constraint=models.UniqueConstraint(fields=('validity', 'short_name'), name='unique_short_name_per_site_break'),
    ),
    migrations.AddConstraint(
    model_name='lessonsubstitution',
    constraint=models.UniqueConstraint(fields=('lesson_period', 'week'), name='unique_period_per_week'),
    constraint=models.UniqueConstraint(fields=('lesson_period', 'week', 'year'), name='unique_period_per_week'),
    ),
    migrations.AddConstraint(
    model_name='room',
    ......
    ......@@ -451,7 +451,7 @@ class LessonSubstitution(ExtensibleModel, TeacherPropertiesMixin, WeekRelatedMix
    ),
    # Heads up: Link to period implies uniqueness per site
    models.UniqueConstraint(
    fields=["lesson_period", "week"], name="unique_period_per_week"
    fields=["lesson_period", "week", "year"], name="unique_period_per_week"
    ),
    ]
    indexes = [
    ......@@ -866,7 +866,7 @@ class Break(ValidityRangeRelatedExtensibleModel):
    verbose_name_plural = _("Breaks")
    constraints = [
    models.UniqueConstraint(
    fields=["site_id", "short_name"], name="unique_short_name_per_site_break"
    fields=["validity", "short_name"], name="unique_short_name_per_site_break"
    ),
    ]
    ......
    0% Loading or .
    You are about to add 0 people to the discussion. Proceed with caution.
    Finish editing this message first!
    Please register or to comment