question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Generated migration cannot update SQLite database.

See original GitHub issue

When making a code first change which adds a relationship between models, dnx ef migrations add xyz creates a migration file which causes dnx ef database update to fail with System.NotSupportedException: SQLite cannot support this migration operation.

A comment in SqliteMigrationsSqlGenerator would appear to indicate the issue in in migration generation.

For example, see the second commit of https://github.com/Amerdrix/SQLite-Migration. Note that all migrations have been committed as generated by tooling.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

5reactions
faridhuseynovcommented, Oct 10, 2019

I fixed this with dropping the whole database, then deleting the whole migrations folder and then just building database with adding new “InitialCreated” database. The worst part will be if you already had some input data (not from template seed file). Then you will lose this all, which in my case wasn’t there.

1reaction
Galaxscommented, Oct 12, 2020

Thanks @faridhuseynov It worked for me too, this is a limitaion tracked in the docs. But have some work arrounds.

You can workaround some of these limitations by manually writing code in your migrations to perform a rebuild. Table rebuilds involve creating a new table, copying data to the new table, dropping the old table, renaming the new table. You will need to use the Sql(string) method to perform some of these steps.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Ruby on Rails - sqlite 3 rake migrations not updating the ...
I am using RoR (3.2.2) and SQLite 3 (1.3.5). When I initially generate a model I am able to successfully create a database....
Read more >
Cant Update dataBase after Adding a new Migration In EF ...
Cant Update dataBase after Adding a new Migration In EF core Code first approach. PM> Add-Migration AddIttrackertoDatabasePhase2 Build started... ...
Read more >
Fixing ALTER TABLE errors with Flask-Migrate and SQLite
The only way to do this is to generate a brand new table with the new schema and copy all the data. Alembic...
Read more >
Could not update database to latest schema
Problem. This error typically occurs when you have previously upgraded, then downgraded, and then again attempted to re-upgrade Workbench.
Read more >
Entity Framework Core Migrations
Command Line​​ Update the database to a specific migration name point. Lists all available migrations. Generates a SQL script for all migrations. ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found