-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Sql Server Migrations: Throw when altering IDENTITY #5345
Comments
@rowanmiller What would be the best way to do this right now? |
This will require table rebuilds (issue #329). Even if we managed to drop and recreate all the referencing constraints, the updated primary key columns will not be marked as The best workaround for now is to make this change before creating the database, delete the model snapshot and migrations files, then re-add the |
Triage: the reson this was traiged for 1.1.0 is that we want to give users more information when this situation happens. |
I'm still not sure how to provide additional information in this scenario. Options:
Invalid options:
|
If you go through the process of changing the ApplicationUser ID type to int, then you will hit issues with EF migrations. On SQL Server, you'll get errors including:
The object 'PK_AspNetUsers' is dependent on column 'Id'.
The object 'FK_AspNetUserRoles_AspNetUsers_UserId' is dependent on column 'Id'.
The object 'FK_AspNetUserLogins_AspNetUsers_UserId' is dependent on column 'Id'.
The object 'FK_AspNetUserClaims_AspNetUsers_UserId' is dependent on column 'Id'.
ALTER TABLE ALTER COLUMN Id failed because one or more objects access this column.
The text was updated successfully, but these errors were encountered: