You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Summary: This PR follows up the SeaORM v2 bump (#245) by reordering entity fields, converting the users ↔ practitioner_offices relation to a via many-to-many, giving user_practitioner_offices a composite key in the entity, adding a physical unique index backing the existing #[sea_orm(unique)] on users.pid, and refactoring practitioner_office::create/service code to use the new ActiveModel::create helpers inside a DB transaction. CI build passed.
One issue found (posted as an inline comment):
src/models/_entities/user_practitioner_offices.rs — the entity now declares a composite primary key on (user_id, practitioner_office_id) and drops the id column, but no migration actually changes the physical table: it still has a surrogate id SERIAL PRIMARY KEY with no unique constraint on (user_id, practitioner_office_id). Since src/services/practitioner_office.rs:41 calls .update() on this entity, SeaORM will build the UPDATE using the (unenforced) composite key — if duplicate rows for the same pair ever exist, the update would silently touch all of them instead of one row. This should either be backed by a real DB constraint (migration dropping id / adding a unique index) or the entity should keep id as the primary key.
The idx_users_pid_unique migration itself looks correct and consistent with existing migration conventions in this repo (index-drop-by-name-only pattern matches other migrations, e.g. m20260508_155536 and m20250912_195210). The is_address_valid validation removed from services/practitioner_office.rs is preserved — it now lives inside practitioner_offices::ActiveModel::create (src/models/practitioner_offices.rs:43), so no regression there.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.