Resolve "Unique constraint for issue category should include parent category" #140

Merged
lloydmeins merged 1 commit from 41-unique-constraint-for-issue-category-should-include-parent-category into master 2021-06-18 15:49:56 +02:00
lloydmeins commented 2021-06-10 17:59:56 +02:00 (Migrated from edugit.org)

Closes #41

Closes #41
lloydmeins commented 2021-06-10 18:11:36 +02:00 (Migrated from edugit.org)

added 1 commit

  • 4d0c82e8 - Include parent category in unique constraints

Compare with previous version

added 1 commit <ul><li>4d0c82e8 - Include parent category in unique constraints</li></ul> [Compare with previous version](/AlekSIS/official/AlekSIS-App-Hjelp/-/merge_requests/84/diffs?diff_id=9654&start_sha=3d5dd31a3e242faebea8aa79dc41c13f87f376dc)
lloydmeins commented 2021-06-10 18:11:58 +02:00 (Migrated from edugit.org)

assigned to @nik and unassigned @lloydmeins

assigned to @nik and unassigned @lloydmeins
lloydmeins commented 2021-06-10 18:12:00 +02:00 (Migrated from edugit.org)

marked this merge request as ready

marked this merge request as **ready**
hansegucker commented 2021-06-10 18:13:45 +02:00 (Migrated from edugit.org)

@lloydmeins Please don't forget to update the migration.

@lloydmeins Please don't forget to update the migration.
lloydmeins commented 2021-06-10 18:29:33 +02:00 (Migrated from edugit.org)

added 1 commit

  • e3e4b0d0 - Include parent category in unique constraints

Compare with previous version

added 1 commit <ul><li>e3e4b0d0 - Include parent category in unique constraints</li></ul> [Compare with previous version](/AlekSIS/official/AlekSIS-App-Hjelp/-/merge_requests/84/diffs?diff_id=9656&start_sha=4d0c82e82b9ed1fdd16f4542eddcc434e70689b4)
lloydmeins commented 2021-06-10 18:30:05 +02:00 (Migrated from edugit.org)

added 1 commit

  • ee37a28b - Include parent category in unique constraints

Compare with previous version

added 1 commit <ul><li>ee37a28b - Include parent category in unique constraints</li></ul> [Compare with previous version](/AlekSIS/official/AlekSIS-App-Hjelp/-/merge_requests/84/diffs?diff_id=9657&start_sha=e3e4b0d09b463fbb897645b7fcde16b5cff82796)
hansegucker commented 2021-06-10 19:33:25 +02:00 (Migrated from edugit.org)

requested review from @hansegucker

requested review from @hansegucker
hansegucker commented 2021-06-10 19:33:44 +02:00 (Migrated from edugit.org)

approved this merge request

approved this merge request
nik commented 2021-06-11 16:33:19 +02:00 (Migrated from edugit.org)
create unique index on foo (b) where foo.c is null;

This is needed in addition, because unique keys do not include NULL values.

Also, please update the changelog.

```sql create unique index on foo (b) where foo.c is null; ``` This is needed in addition, because unique keys do not include `NULL` values. Also, please update the changelog.
nik commented 2021-06-12 21:13:34 +02:00 (Migrated from edugit.org)

@lloydmeins Can you please provide an update on this requested change, which you agreed to implement right after yesterday's dev meeting?

@lloydmeins Can you please provide an update on this requested change, which you agreed to implement right after yesterday's dev meeting?
nik commented 2021-06-14 22:08:46 +02:00 (Migrated from edugit.org)

@lloydmeins Any news here?

@lloydmeins Any news here?
lloydmeins commented 2021-06-15 16:37:48 +02:00 (Migrated from edugit.org)

added 1 commit

  • c046f2ca - Create unique index on categories if parent is null

Compare with previous version

added 1 commit <ul><li>c046f2ca - Create unique index on categories if parent is null</li></ul> [Compare with previous version](/AlekSIS/official/AlekSIS-App-Hjelp/-/merge_requests/84/diffs?diff_id=9804&start_sha=ee37a28b6688341ec098398cd6f925be8bca2067)
lloydmeins commented 2021-06-15 16:37:56 +02:00 (Migrated from edugit.org)
constraints = [
            models.UniqueConstraint(
                fields=["site_id", "name"], condition=models.Q(parent='null'), name="unique_category_name_per_site_without_parent"
            ),
            models.UniqueConstraint(
                fields=["site_id", "name", "parent"], name="unique_category_name_per_site_with_parent"
            )
        ]

My idea was to combine two unique constraints and use conditions if there is no parent. The problem is I cannot test this at the moment as my development system is broken (again).

``` constraints = [ models.UniqueConstraint( fields=["site_id", "name"], condition=models.Q(parent='null'), name="unique_category_name_per_site_without_parent" ), models.UniqueConstraint( fields=["site_id", "name", "parent"], name="unique_category_name_per_site_with_parent" ) ] ``` My idea was to combine two unique constraints and use [conditions](https://docs.djangoproject.com/en/3.2/ref/models/constraints/#condition) if there is no parent. The problem is I cannot test this at the moment as my development system is broken (again).
hansegucker commented 2021-06-17 15:10:53 +02:00 (Migrated from edugit.org)

added 1 commit

  • b05e0296 - Create unique index on categories if parent is null

Compare with previous version

added 1 commit <ul><li>b05e0296 - Create unique index on categories if parent is null</li></ul> [Compare with previous version](/AlekSIS/official/AlekSIS-App-Hjelp/-/merge_requests/84/diffs?diff_id=9865&start_sha=c046f2ca6a7861f4a547b5ece37e67974a7910c0)
hansegucker commented 2021-06-17 15:18:39 +02:00 (Migrated from edugit.org)

added 1 commit

  • 52548217 - Create unique index on categories if parent is null

Compare with previous version

added 1 commit <ul><li>52548217 - Create unique index on categories if parent is null</li></ul> [Compare with previous version](/AlekSIS/official/AlekSIS-App-Hjelp/-/merge_requests/84/diffs?diff_id=9866&start_sha=b05e0296552d34be9d8db2d7fa0881cc23826b02)
hansegucker commented 2021-06-17 15:42:27 +02:00 (Migrated from edugit.org)

resolved all threads

resolved all threads
hansegucker commented 2021-06-17 15:43:57 +02:00 (Migrated from edugit.org)

You cannot change the changelog for a version that has been already released.

You cannot change the changelog for a version that has been already released.
lloydmeins commented 2021-06-17 16:33:31 +02:00 (Migrated from edugit.org)

changed this line in version 7 of the diff

changed this line in [version 7 of the diff](/AlekSIS/official/AlekSIS-App-Hjelp/-/merge_requests/84/diffs?diff_id=9876&start_sha=525482174b15e18f9e70654d974fdfbdb2da3b6b#45267e3a9556cafa9cb7b61dab7a3b6659e73aad_15_23)
lloydmeins commented 2021-06-17 16:33:32 +02:00 (Migrated from edugit.org)

added 2 commits

  • c046f2ca - Create unique index on categories if parent is null
  • 5c88dccc - Merge branch...

Compare with previous version

added 2 commits <ul><li>c046f2ca - Create unique index on categories if parent is null</li><li>5c88dccc - Merge branch...</li></ul> [Compare with previous version](/AlekSIS/official/AlekSIS-App-Hjelp/-/merge_requests/84/diffs?diff_id=9876&start_sha=525482174b15e18f9e70654d974fdfbdb2da3b6b)
lloydmeins commented 2021-06-17 16:44:41 +02:00 (Migrated from edugit.org)

resolved all threads

resolved all threads
lloydmeins commented 2021-06-17 16:58:32 +02:00 (Migrated from edugit.org)

added 1 commit

  • 29206c63 - Merge branch...

Compare with previous version

added 1 commit <ul><li>29206c63 - Merge branch...</li></ul> [Compare with previous version](/AlekSIS/official/AlekSIS-App-Hjelp/-/merge_requests/84/diffs?diff_id=9879&start_sha=5c88dccc80da2bceae7672327ecd412227f79cb8)
nik commented 2021-06-18 10:36:01 +02:00 (Migrated from edugit.org)

Please fix the commit history

Please fix the commit history
hansegucker commented 2021-06-18 11:21:51 +02:00 (Migrated from edugit.org)

added 1 commit

  • a0b94a05 - Include parent category in unique constraints

Compare with previous version

added 1 commit <ul><li>a0b94a05 - Include parent category in unique constraints</li></ul> [Compare with previous version](/AlekSIS/official/AlekSIS-App-Hjelp/-/merge_requests/84/diffs?diff_id=9892&start_sha=29206c6300c9447f689395b208c1a0cffe5db316)
hansegucker commented 2021-06-18 11:22:27 +02:00 (Migrated from edugit.org)

Done.

Done.
hansegucker commented 2021-06-18 11:22:30 +02:00 (Migrated from edugit.org)

resolved all threads

resolved all threads
nik commented 2021-06-18 15:49:52 +02:00 (Migrated from edugit.org)

mentioned in commit bfea980b25

mentioned in commit bfea980b258e59e6444e54746837013515b5b86d
nik (Migrated from edugit.org) merged commit bfea980b25 into master 2021-06-18 15:49:56 +02:00
hansegucker (Migrated from edugit.org) approved these changes 2026-07-14 15:59:19 +02:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
aleksis/AlekSIS-App-Hjelp!140
No description provided.