0

I have coded everything perfectly and created a migration file. It had everything I needed, but I accidentally deleted it.

I try to re-create it and it doesn't give me all the stuff I need, it just gives me a blank page with skeleton code.

Is there a way to fix this?

Winner Crespo
  • 1,644
  • 15
  • 29
1011 1110
  • 743
  • 2
  • 17
  • 43

2 Answers2

1

This is because the tooling believes/knows that the migration has been applied, that's why when you add a migration you're not getting an implemented up and down methods. If you don't have any sensitive data in your database you can deleted the database, and then run the command Update-Database. All the existing migrations will be checked and applied, and now you can know run Add-Migration <MigrationName>.

Hope it helps

Maximo Dominguez
  • 2,075
  • 18
  • 35
0

If you don't want this to happen anymore in the future, you can use TFS for your source control or can use File History

I think you can just delete the Migrations folder from your project. I will recreate again and uses the existing database.

RHAD
  • 1,317
  • 3
  • 13
  • 37