❔ What could possibly be the reason when I run database -update but no tabled added ?
Pretty much as the title says, I run the command as in the image wanting to update my new created entity into my database, but when I check the database, there's no new table added, can someone help me what could possibly go wrong here ?
![](https://cdn.answeroverflow.com/1115570120098586655/image.png)
9 Replies
did you
Add-Migration
before?
this should add a migration with all the changes since the last migration was created
after that you can Update-Database
to apply the new migration to the database (creating the new table)i did, I have this migration
![](https://cdn.answeroverflow.com/1115571489891168307/image.png)
that doesn't look right (the methods should have code in them)
did you add a
DbSet<...>
for your new type to your dbcontext?im not sure I've made any action on my dbcontext, I'll check it then
you should have something like this in ur class "nameDBContext"
![](https://cdn.answeroverflow.com/1115659259506610369/image.png)
Then you override the method OnModelCreating(ModelBuilder modelBuidler)
and configure each table with each property definitions
in my case i do this:
![](https://cdn.answeroverflow.com/1115659588625244160/image.png)
up to you how should it look
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.