I deleted some tables thinking they would be recreated on running my application but they weren't and it said couldn't find table. So to rerun the migrations I've deleted them from the migration table. Now when I try update-database it says there is already object xxx in the database (different table to what I deleted)
I'm new to EF-Code First so any help gratefully appreciated :)
Its depending on your data, you want to keep them or no.
Update-Database
command.ConnectionString
and create correct version of your corrupted database to manually add missing tables and relations.2
and move your existing records from corrupted database into the fresh version of your database using Generate Scripts
(use this tutorial, and generate script only for data, not Schema).Entity-Framework
keeps track of Tables
, Relations
, Constraints
and Indexes
so even an small change in them will make problems for you.Entity-Framework
keeps an snapshot of your database schema for every single migration.