0

I'm trying to run update-database -verbose on my project but I keep getting this error

Cannot find the object "dbo.Series", because it does not exist or you do not have permission.

I've looked at other examples on stackoverflow regarding this error message but they were all different situations. In my case the 'dbo.Series' actually does exist in my code and I can see it present in my database on SQL.

Here is the Up() code in the latest migration file.

public override void Up()
{
    AddColumn("dbo.Series", "FixtureId", c => c.Int());
    AddColumn("dbo.Fixture", "SeriesId", c => c.Int());
    CreateIndex("dbo.Series", "FixtureId");
    CreateIndex("dbo.Fixture", "SeriesId");
    AddForeignKey("dbo.Series", "FixtureId", "dbo.Fixture", "Id");
    AddForeignKey("dbo.Fixture", "SeriesId", "dbo.Series", "Id");
}

Is there anyway to get my migrations and current database back on the same page?

Thanks

Bad Dub
  • 1,503
  • 2
  • 22
  • 52
  • It seems the account you're using into your connection string does not have permission for droping database. – CodeNotFound May 14 '17 at 12:01
  • I actually posted the wrong error message, its meant to say "cannot FIND object". My bad. – Bad Dub May 14 '17 at 12:13
  • An easy option might be to flatten all the migrations into a single migration and start over: http://stackoverflow.com/questions/11679385/reset-entity-framework-migrations Otherwise, need to compare database migrations history and database schema and track down what caused migrations to become out of sync. – Ignas May 14 '17 at 12:29
  • Ill give this a go and let you know how I get on. Thanks for the link – Bad Dub May 14 '17 at 12:53

0 Answers0