fix: drop sessions FK and fix fixture phone numbers#119
Merged
ManukMinasyan merged 2 commits intomainfrom Feb 15, 2026
Merged
Conversation
drop the sessions table FK on user_id that references users.id, which causes integrity constraint violations when the sysadmin guard stores system_administrators IDs on login. replace invalid 555 phone numbers in people fixtures with valid E.164 format since libphonenumber rejects reserved/fictional numbers.
There was a problem hiding this comment.
Pull request overview
This pull request addresses two separate issues: (1) drops the sessions.user_id foreign key constraint to resolve integrity violations when the sysadmin guard stores system_administrators IDs during login, and (2) updates phone numbers in seed fixtures from fictional 555- format to valid E.164 format to satisfy libphonenumber validation requirements.
Changes:
- Removes foreign key constraint from
sessions.user_idto support multi-guard authentication where sessions store IDs from bothusersandsystem_administratorstables - Updates all people fixture phone numbers from invalid 555-xxx-xxxx format to valid E.164 format (+1415555xxxx)
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
database/migrations/2026_02_15_214730_drop_sessions_user_id_foreign_key.php |
New migration to drop the sessions.user_id foreign key constraint |
app-modules/OnboardSeed/resources/fixtures/people/brian.yaml |
Updated phone number to E.164 format (+14155550100) |
app-modules/OnboardSeed/resources/fixtures/people/dylan.yaml |
Updated phone number to E.164 format (+14155550101) |
app-modules/OnboardSeed/resources/fixtures/people/ivan.yaml |
Updated phone number to E.164 format (+14155550102) |
app-modules/OnboardSeed/resources/fixtures/people/tim.yaml |
Updated phone number to E.164 format (+14155550103) |
database/migrations/2026_02_15_214730_drop_sessions_user_id_foreign_key.php
Show resolved
Hide resolved
…alls Remove foreignUlid from original sessions migration to prevent FK creation on fresh installs. Use Schema::getForeignKeys() to check constraint existence before dropping on existing databases.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
sessions.user_idforeign key constraint that referencesusers.id— this causes integrity constraint violations when the sysadmin guard storessystem_administratorsIDs on login+1415555xxxx), sincelibphonenumberrejects reserved/fictional numbersTest plan
php artisan migratesysadmin.relaticle.testworks without FK errorsphp artisan db:seedto verify fixtures seed correctly with valid phone numbers