[Entity] I deleted my DB and tried to re-update my and the columns in my table do not reflect my controller..
I have a small project I am working and I had all this test data in the DB that I wanted to get rid of. Instead of deleting it one by one I just scrapped the DB think that running update-database again but just recreate it but without any of that junk data.
It recreated the table but with the incorrect columns and I can't seem to figure out why.
My controller:
public class Resources { public int id { get; set; } public virtual string Category { get; set; } public string ResourceName { get; set; } public string Description { get; set; } public string ResourceUrl { get; set; } [DataType(DataType.Date)] public DateTime Date { get; set; } public virtual List<Tags> Tags { get; set; } }
My db context:
public class ApplicationDbContext : IdentityDbContext<ApplicationUser> { public DbSet<Resources> Resources { get; set; } public DbSet<Categories> Categories { get; set; } public DbSet<Tags> Tags { get; set; } public ApplicationDbContext() : base("resource_dashboard", throwIfV1Schema: false) { } public static ApplicationDbContext Create() { return new ApplicationDbContext(); } }
My error or caution when updating:
Applying explicit migration: 201712021634024_initial. Applying explicit migration: 201712021654565_adding db. Applying explicit migration: 201712021702135_updateDB. Applying explicit migration: 201712021806024_fixedDB. Applying explicit migration: 201712060029392_629_db_fix. Applying explicit migration: 201712091729006_fix-resource-id. Applying explicit migration: 201712091732499_resource-id-issues. Applying explicit migration: 201712132045266_attempt-dos. Applying explicit migration: 201712192253247_tablefix. Applying explicit migration: 201712200024463_corrected-resource-id. Applying explicit migration: 201712200302091_alteredtagtable. Caution: Changing any part of an object name could break scripts and stored procedures. Applying explicit migration: 201712200305039_alteredresourcelabelintagtable. Applying explicit migration: 201801111600152_set-date.
I never changed anything and when the dummy data was in there before I deleted everything was working fine.
The project is also here if this helps at all: https://github.com/basictom/resource-dashboard/tree/master/resource-dashboard/resource-dashboard
So if this is something dumb and obvious but I can't seem to figure out what I have done wrong, and I pretty new back end. Thanks for any and all the help!
Edit: Formatting
0 comments:
Post a Comment