Open Closed

Entity framework : Migrations do not reflect changes #3297


0
omkarchoudhari created

We are using the asp.net core and angular 2.X template for our application. We are having many issues with code-first migrations. Whenever we make any changes to the models in the core project , and add migrations, either the migrations run but changes are not reflected completely. We then delete the migrations history and migration files and try again . But the framework simply generates empty migrations.

Is this a bug in the framework that is leading to unstable behavior ? Please suggest workaround for this. Its become very tedious to delete migrations every time and try regenerating them.

Thanks


3 Answer(s)
  • 0
    ismcagdas created
    Support Team

    Hi,

    We haven't seen such a behaviour in our development until now. This is completely related to Entity Framework actually. I suggest you not to delete applied migrations, this will cause problems like you have.

    You can search this on the web, if you cannot find any solution you can send your project to us with an explanation how to repeat this problem.

    Thanks.

  • 0
    omkarchoudhari created

    There seems to be a problem with the generated migrations file. The up method is actually dropping the objects and down method is creating objects. Hence every time we do update database we get the error "Cannot drop the table 'XXXX', because it does not exist or you do not have permission."

    When we switched the method names , db update has started working fine. This has happened on two different machines. So this is definitely a bug.

  • 0
    ismcagdas created
    Support Team

    Hi,

    You have a really strange case :). Can you send us the buggy version of your project via email ?

    Thanks.