Simon Achmüller
Simon Achmüller

Reputation: 1176

Entity Framework Core SQLite version

I'm using EF Core v2.2.1 for SQLite and just made a new migration, where I renamed a field in the table.

Migration code looks like

migrationBuilder.RenameColumn(
    name: "OldColumnName",
    table: "Table",
    newName: "NewColumnName");

It creates following SQL when I apply migration:

ALTER TABLE "Table" RENAME COLUMN "OldColumnName" TO "NewColumnName";

Staring with SQLite 3.25 it is supported https://www.sqlite.org/changes.html

Enhancements the ALTER TABLE command:

    Add support for renaming columns within a table using ALTER TABLE table RENAME COLUMN oldname TO newname.
    Fix table rename feature so that it also updates references to the renamed table in triggers and views.

But in EF Core I receive an exception:

Error while executing SQL query on database 'MyDatabase': near "COLUMN": syntax error

Sounds like it uses old version of SQLite. How can check which version does EF Core use?

EDIT: I found a workaround, but actually my question is "how do I know which version of SQLite am I currently using?".

Upvotes: 2

Views: 842

Answers (1)

dev-masih
dev-masih

Reputation: 4746

Renaming column for sqlite db in ef core is limited and not supported you can find official limitation lists here

there is a bug report for this problem that you can find it here
and there is a workaround for this issue in here

Upvotes: 2

Related Questions