Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add-Migration creating empty migration in code migrations/code first

I'm using code migrations in code first. I modified one of my models (domain class) and changes were picked up when I added a migration. So far so good. Now is the part where I may be doing something wrong:

  1. I made additional changes making the previous modification irrelevant.
  2. I deleted the migration and tried to re-scaffold, I got an empty migration. I understand now that the database tracks migration history. So I understand why this was stupid.
  3. My next step was to delete the rows in the database- it also sounds like this is not a good idea. The appropriate way to "step-back" is to do Update-Database -Target:{MigrationName}
  4. Trying both of these I am still getting an empty migration. I also tried dropping the database and updating to the migration before mine.

My google/SO foo has failed me. What I think is happening is that VS/Entity is not detecting changes in my model and I'm not sure what the trigger is. Can someone help me out?

like image 775
Craig Avatar asked Nov 11 '22 00:11

Craig


1 Answers

I had a similar problem. My solution was to just go forward with a substance-less migration happening. The only change it makes is adding a record to the __Migration table, but I am living with that and just moving forward.

like image 54
thepaulpage Avatar answered Dec 26 '22 01:12

thepaulpage