Skip to content

Conversation

@chris-briddock
Copy link

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

Copilot AI review requested due to automatic review settings October 30, 2025 11:11
@github-actions github-actions bot added the area-identity Includes: Identity and providers label Oct 30, 2025
@dotnet-policy-service dotnet-policy-service bot added the community-contribution Indicates that the PR has been added by a community member label Oct 30, 2025
@dotnet-policy-service
Copy link
Contributor

Thanks for your PR, @@chris-briddock. Someone from the team will get assigned to your PR shortly and we'll get it reviewed.

Copy link
Contributor

Copilot AI left a 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 Id primary key to IdentityUserLogin and IdentityUserToken with unique indexes on the original composite key columns
  • Changed IdentityUserClaim and IdentityRoleClaim to use TKey instead of int for the Id property
  • Introduced FindTokenByUniqueIndexAsync method 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 Id primary key property and updated UserId documentation
src/Identity/Extensions.Stores/src/IdentityUserLogin.cs Added Id primary key and reordered UserId property to the top
src/Identity/Extensions.Stores/src/IdentityUserClaim.cs Changed Id type from int to TKey
src/Identity/Extensions.Stores/src/IdentityRoleClaim.cs Changed Id type from int to TKey
src/Identity/Extensions.Stores/src/UserStoreBase.cs Added FindTokenByUniqueIndexAsync method 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

@chris-briddock
Copy link
Author

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.

Chris added 2 commits October 30, 2025 11:10
…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.
@chris-briddock chris-briddock requested review from a team and tdykstra as code owners October 30, 2025 20:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-identity Includes: Identity and providers community-contribution Indicates that the PR has been added by a community member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant