how to add a table to an existing ef core database created using EnsureCreated()?
I have an existing SQLite database (30GB in size) which was created using
EnsureCreated()
, now I need to add a table which I tried using migrations (I passed dotnet ef database update
) on the command line but it causes Microsoft.Data.Sqlite.SqliteException (0x80004005): SQLite Error 1: 'table "AspNetRoles" already exists'.
error, I did a lot of research and it seems like I needed to create the database via migrations.
How do I add a table when the ef core database is created via EnsureCreated()
? Do I have to create the db via migrations and fill it with data from the existing db? can there be a way in which I can add the table be it via code?2 Replies