- 
                Notifications
    You must be signed in to change notification settings 
- Fork 10.5k
Alter database design for the Social Logins feature. #64202
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
| Thanks for your PR, @@chris-briddock. Someone from the team will get assigned to your PR shortly and we'll get it reviewed. | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces Identity V3 schema changes that migrate IdentityUserLogin, IdentityUserToken, IdentityUserClaim, and IdentityRoleClaim to use an Id primary key instead of composite keys, with unique indexes on the natural key combinations. The PR also includes Docker configuration files, sample application enhancements for external authentication, and comprehensive test coverage.
Key changes:
- Added Idprimary key toIdentityUserLoginandIdentityUserTokenwith unique indexes on the original composite key columns
- Changed IdentityUserClaimandIdentityRoleClaimto useTKeyinstead ofintfor theIdproperty
- Introduced FindTokenByUniqueIndexAsyncmethod to support token lookups with V3 schema
- Added Docker Compose setup with startup scripts for easy sample application testing
- Enhanced sample application with Google authentication and email confirmation support
Reviewed Changes
Copilot reviewed 29 out of 29 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description | 
|---|---|
| src/Identity/Extensions.Stores/src/IdentityUserToken.cs | Added Idprimary key property and updatedUserIddocumentation | 
| src/Identity/Extensions.Stores/src/IdentityUserLogin.cs | Added Idprimary key and reorderedUserIdproperty to the top | 
| src/Identity/Extensions.Stores/src/IdentityUserClaim.cs | Changed Idtype frominttoTKey | 
| src/Identity/Extensions.Stores/src/IdentityRoleClaim.cs | Changed Idtype frominttoTKey | 
| src/Identity/Extensions.Stores/src/UserStoreBase.cs | Added FindTokenByUniqueIndexAsyncmethod and updated callers | 
| src/Identity/EntityFrameworkCore/src/UserStore.cs | Implemented V3 schema support with Id generation for string keys | 
| src/Identity/EntityFrameworkCore/src/UserOnlyStore.cs | Implemented V3 schema support with Id generation for string keys | 
| src/Identity/EntityFrameworkCore/src/RoleStore.cs | Added Id generation for role claims with string keys | 
| src/Identity/EntityFrameworkCore/src/IdentityUserContext.cs | Updated model configuration for V3 schema with unique indexes | 
| src/Identity/samples/IdentitySample.DefaultUI/* | Added Docker support, external authentication, and helper scripts | 
| src/Identity/EntityFrameworkCore/test/EF.Test/* | Added comprehensive test coverage for V3 schema | 
| .devcontainer/devcontainer.json | Updated devcontainer configuration format | 
| So I added my changes to the PublicAPI.Unshipped file, it did give me a warning about PublicAPI.Shipped. Now all tests fail? I'm not knowing how to make this bit work apparently. | 
…serLogins for V3 schema Added Id primary key field to IdentityUserToken and IdentityUserLogin entities Updated V3 schema configuration to use Id primary keys with unique indexes instead of composite keys Made FindTokenAsync obsolete with guidance to use FindTokenByUniqueIndexAsync for V3 schema Updated UserStoreBase to use FindTokenByUniqueIndexAsync internally for token operations Modified UserStore and UserOnlyStore implementations to handle V3 schema with proper Id generation Updated SqlStoreTestBase to verify V3 schema includes Id columns Added comprehensive integration tests for UserManager with V3 schema Created UserStoreVersionThreeTest with specific V3 schema validation Updated DefaultUI sample to use V3 schema configuration All automated and manual testing passes successfully This change improves the database schema by using surrogate primary keys with unique indexes, which provides better performance and aligns with modern database design patterns. The V3 schema maintains backward compatibility while offering improved data access patterns
Remove IdentityUserClaim Id.get -> int from PublicAPI.Shipped.txt otherwise CI fails.
Alter database schema design for the Social Logins feature.
Summary of the changes (Less than 80 chars):
Add Id primary keys to IdentityUserTokens/Logins for V3 schema
Please see the attached report.
PR Report.md