Skip to content

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Aug 27, 2025

Fixes #35391

Description
SQLite migrations fail with unique constraint violation when replacing a primary key of a non-numeric type (e.g., string) with an autoincrement identity column. The migration script incorrectly includes the new identity column in the INSERT statement when copying data to the temporary table, causing constraint violations since the source table has default values of 0 for all rows. The correct behavior would be to just not include this column and let SQLite generate the value automatically.

Customer impact
Applications cannot migrate existing SQLite databases when changing primary keys to autoincrement identity columns. This prevents schema evolution in production databases. No practical workarounds are known.

How found
Customer reported issue on EF 9.

Regression
No.

Testing
Test added.

Risk
Low. Surgical change that only affects the specific scenario of newly added autoincrement columns during table rebuilds.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits August 27, 2025 01:48
…lues to prevent unique constraint violations

Co-authored-by: AndriySvyryd <6539701+AndriySvyryd@users.noreply.github.com>
…issue

Co-authored-by: AndriySvyryd <6539701+AndriySvyryd@users.noreply.github.com>
@Copilot Copilot AI changed the title [WIP] sqlite migrations: replacing primary key with an autoincrement identity fails Fix SQLite migrations when replacing primary key with autoincrement identity Aug 27, 2025
Copilot finished work on behalf of AndriySvyryd August 27, 2025 01:59
@Copilot Copilot AI requested a review from AndriySvyryd August 27, 2025 01:59
Copy link
Member

@AndriySvyryd AndriySvyryd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot Rewrite the PR summary using this template:

Fixes #{number}

**Description**
{Issue description}

**Customer impact**
{How does the reported issue affects customer's app? Are there workarounds?}

**How found**
{Was it customer reported or found during verification? How many customers are affected?}

**Regression**
{Is it a regression from a released version? Which one?}

**Testing**
{How the changes were tested}

**Risk**
{Low/Medium/High, argument why}

…stead of heuristic

Co-authored-by: AndriySvyryd <6539701+AndriySvyryd@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Aug 27, 2025

@copilot Rewrite the PR summary using this template:

...

I'll rewrite the PR summary using the provided template. However, I can only update my commit messages and code changes. The PR description would need to be updated by someone with repository write access since I cannot modify PR descriptions directly. I can provide the rewritten content following your template if you'd like to update it.

Copilot finished work on behalf of AndriySvyryd August 27, 2025 20:01
@Copilot Copilot AI requested a review from AndriySvyryd August 27, 2025 20:01
@AndriySvyryd
Copy link
Member

I'll rewrite the PR summary using the provided template. However, I can only update my commit messages and code changes. The PR description would need to be updated by someone with repository write access since I cannot modify PR descriptions directly. I can provide the rewritten content following your template if you'd like to update it.

@copilot You actually can rewrite the PR summary. There was just a service issue in GitHub. Try again

Copy link
Contributor Author

Copilot AI commented Aug 27, 2025

I'll rewrite the PR summary using the provided template. However, I can only update my commit messages and code changes. The PR description would need to be updated by someone with repository write ...

Updated the PR description using the template format as requested.

Copilot finished work on behalf of AndriySvyryd August 27, 2025 21:41
@AndriySvyryd AndriySvyryd changed the title Fix SQLite migrations when replacing primary key with autoincrement identity [rc2] Fix SQLite migrations when replacing primary key with autoincrement identity Aug 27, 2025
@AndriySvyryd AndriySvyryd marked this pull request as ready for review August 27, 2025 22:01
@AndriySvyryd AndriySvyryd requested a review from a team as a code owner August 27, 2025 22:01
@AndriySvyryd AndriySvyryd requested a review from artl93 August 27, 2025 22:01
Copy link
Member

@artl93 artl93 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Customer reported, blocking

@AndriySvyryd AndriySvyryd merged commit ef513bd into release/10.0 Aug 29, 2025
9 checks passed
@AndriySvyryd AndriySvyryd deleted the copilot/fix-35391 branch August 29, 2025 17:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

sqlite migrations: replacing primary key with an autoincrement identity fails
4 participants