Database migrations has stopped working. How do I get it working again? RRS feed

  • Question

  • A strange thing happened today.

    I put a required attribute on a string field and in Powershell I entered "Update-Database"

    That failed, I had to go into the databse a drop a constraint on that table and then it worked.

    I do not know if that might have caused my current difficulty. I can't think why it would.

    Because since then every change i have tried to made has been ignored.

    I get

    PM> Update-Database -Verbose
    Using StartUp project 'SCD'.
    Using NuGet project 'SCD.Model'.
    Specify the '-Verbose' flag to view the SQL statements being applied to the target database.
    Target database is: 'SherryGreenGroup' (DataSource: SQL_MULALLEY, Provider: System.Data.SqlClient, Origin: Configuration).
    No pending code-based migrations.
    Running Seed method.

    I know that is not much to go on.

    So maybe I should uninstall and reintsall database migrations? How?

    Friday, February 1, 2013 10:29 AM

All replies

  • I assume this is using Automatic Migrations, correct?

    To make sure I understand your scenario:

    1. You added a required attribute

    2. Used Update-Database with automatic migrations to add the constraint to the database. Something went wrong here? What was it?

    3. You removed some constraint from the database, was it one created in step 2?

    4. Now automatic migrations no longer work.

    Is that right?

    We are seeing a lot of great Entity Framework questions (and answers) from the community on Stack Overflow. As a result, our team is going to spend more time reading and answering questions posted on Stack Overflow. We would encourage you to post questions on Stack Overflow using the entity-framework tag. We will also continue to monitor the Entity Framework forum.

    Friday, February 1, 2013 6:57 PM