Skip to content
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

[5.0.2] SQLite Migrations: Quote table names in FROM clause during rebuilds #23620

Merged
merged 1 commit into from
Dec 10, 2020

Conversation

bricelam
Copy link
Contributor

@bricelam bricelam commented Dec 8, 2020

Fixes #23621

Description

When rebuilding table on SQLite (required for certain schema changes; this is a new feature in 5.0) we create an INSERT..FROM statement to copy data from the old table to the new one. However, we missed quoting the table name.

Customer Impact

Because the name isn't quoted, some tables can't be rebuilt. For example, this includes tables containing spaces in the name or ones matching a SQLite keyword (like GROUP).

How found

Customer reported on 5.0.0

Test coverage

We have tests asserting against baseline SQL, but failed to carefully review the SQL for quotes. The baselines have been updated to catch regressions.

Regression?

No. Table rebuilds are new in EF Core 5.0; the operation would have failed previously.

Risk

Very low. We quote table and column identifiers everywhere else in Migrations.

@bricelam bricelam requested a review from a team December 8, 2020 17:46
@ajcvickers ajcvickers added this to the 5.0.x milestone Dec 8, 2020
@leecow leecow modified the milestones: 5.0.x, 5.0.2 Dec 8, 2020
@ajcvickers
Copy link
Contributor

Approved by Tactics for 5.0.2. Please wait for the branch to open before merging.

@ajcvickers ajcvickers removed the blocked label Dec 8, 2020
fixes invalid migrations when the table name is a reserved keyword (e.g. 'Group')
@bricelam bricelam merged commit 9857e68 into dotnet:release/5.0 Dec 10, 2020
@bricelam bricelam deleted the quote branch December 10, 2020 17:20
@ajcvickers ajcvickers removed this from the 5.0.2 milestone Dec 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants