Search code examples
asp.netentity-framework.net-corenpgsql

Updating tables with dotnet ef database update doesn't create tables


I've been following a tutorial to create a database by having a context class, and running the following commands:

dotnet ef migrations add InitialMigration dotnet ef database update

This did initially work for me, and the expected database was created. Since then I have deleted the migration file and ran the process again, the update command seems to run fine, but when I check the database, the tables have not been created.

If I look in the migration file, I can see that it looks fine and appears to have the correct code in it to create the tables I want.

I don't think I've actually changed anything, so why has the update command stopped working as it did before?


Solution

  • deleting you migration file didn't delete your database so your database must be still existed however , if your create a new migration with the same name and update your database this will not effect you database since the migration is have been applied to your database try to delete your database manually from SQL explorer then try update-database