© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•10mo ago•
30 replies
AlisterKB

creating migrations on an existing DB to add a column(efcore)

so I have a webapi project, dotnet 8 efcore 8 and postgres
project was DB first and hence scaffolded. now I wanna add a property to an entity of mine AND/OR add a column to a table
I have always done db first and never done code first and have never touched migrations. tried adding migration but doing so it wants to create all tables with updated columns. tables already exist and have data I'd rather not lose (though it wouldn't be end of the world as it is a personal project for learning) so wondering how can I add a column without dropping my tables and not updating my table with sql command scaffolding it again. Most resources I've found involve somewhat hacky way of adding migration and deleting the content in up and down methods in migration though I don't understand how that might help ?
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

❔ EFCore migrations
C#CC# / help
3y ago
❔ Scaffold migrations from existing DB
C#CC# / help
4y ago
❔ EFCore SQLITE Migrations on Server
C#CC# / help
3y ago