Skip to content

Fix/org unit localid not unique index#1391

Merged
strongmindsaln merged 11 commits into
masterfrom
fix/org-unit-localid-not-unique-index
May 4, 2026
Merged

Fix/org unit localid not unique index#1391
strongmindsaln merged 11 commits into
masterfrom
fix/org-unit-localid-not-unique-index

Conversation

@strongmindsnan

Copy link
Copy Markdown

KITOS Pull request template

Description

Describe what was changed in this branch, and WHY it was changed.

Checklist

The following procedure dictates the steps needed before a Pull request can be merged into master.

  • Implement:
    All requirements are implemented and unit tests are green

  • Merge master into branch / rebase with master:
    Make sure you are testing your changes and how they co-exist with the latest version of master

  • Green on integration:
    All integration tests are green on integration

  • Add a description
    Under "Description" above, explain what was changed in this branch, and WHY it was changed

  • Request review:
    Tag whomever you wish to review your code

  • Review completed:
    Reviewer ticks this box when review comments have been submitted

  • Changes:
    PR owner and reviewer agrees on which changes must be made and the changes are committed.

  • Merge master into branch / rebase with master:
    Make sure you are testing your changes and how they co-exist with the latest version of master

  • Green on integration:
    All integration tests are green on integration

Copilot AI review requested due to automatic review settings April 29, 2026 07:22

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adjusts the EF Core model/migrations so OrganizationUnit (OrganizationId, LocalId) is indexed but no longer enforced as unique, aligning the database constraint with the intended domain behavior.

Changes:

  • Replaced the unique filtered index on (OrganizationId, LocalId) with a non-unique index (and renamed UX_LocalIdIX_LocalId).
  • Added an EF Core migration to drop/recreate the index accordingly.
  • Updated the EF Core model snapshot to reflect the new index definition.

Reviewed changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 1 comment.

File Description
Infrastructure.DataAccess/Migrations/EfCore/KitosContextModelSnapshot.cs Updates snapshot: (OrganizationId, LocalId) index is no longer unique/filtered and uses the new name.
Infrastructure.DataAccess/Migrations/EfCore/20260429070545_MakeOrganizationUnitLocalIdIndexNotUnique.cs Migration drops UX_LocalId and creates IX_LocalId; Down migration restores the prior unique filtered index.
Infrastructure.DataAccess/Mapping/OrganizationUnitMap.cs Updates fluent configuration to use a non-unique index named IX_LocalId.

Comment thread Infrastructure.DataAccess/Mapping/OrganizationUnitMap.cs Outdated
strongmindsaln
strongmindsaln previously approved these changes May 4, 2026
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

@strongmindsmhs strongmindsmhs left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please also consider Postgres naming conventions going forward:
https://www.geeksforgeeks.org/postgresql/postgresql-naming-conventions/

@strongmindsaln
strongmindsaln merged commit fece8d3 into master May 4, 2026
6 checks passed
@strongmindsaln
strongmindsaln deleted the fix/org-unit-localid-not-unique-index branch May 4, 2026 07:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants