C
C#10mo ago
WAASUL

✅ How should I name my ef core migrations?

I'm wondering if there is a good way to name your migrations. I have noticed that, you quickly end-up with a lot of migrations. I'm just wondering if there is a good naming convention.
13 Replies
Pobiega
Pobiega10mo ago
VersionPrefix_JiraTicketName_ShortDescription is what we use at work 🙂
WAASUL
WAASULOP10mo ago
@Pobiega Could you give an example if possible?
Jimmacle
Jimmacle10mo ago
i just name mine something related to what they do
Pobiega
Pobiega10mo ago
007_005_BA_5871_Local_identifiers
WAASUL
WAASULOP10mo ago
I see, thanks for the insights guys. What would happen if you lose you migrations or delete it. I have noticed, after deletion. If you do a migrations to an existing database. It says for instance, Product table already exists Is there a way to tell ef core when updating the database to ignore already defined tables?
Jimmacle
Jimmacle10mo ago
if you lose/delete migrations then EF won't know how to get your database to its "current" state anymore and if you delete the snapshot too, it won't know the current state at all so don't delete/lose them
WAASUL
WAASULOP10mo ago
I see, I didn't know that. Thanks mate.
Jimmacle
Jimmacle10mo ago
an exception would be if you're working on another branch and want to condense your migrations into a single one, then you can delete them, revert the snapshot to whatever's upstream, then create a single new migration but any migrations that have been applied to a real live database you care about should be kept
Unknown User
Unknown User10mo ago
Message Not Public
Sign In & Join Server To View
WAASUL
WAASULOP10mo ago
:A_pepelaugh: I guess, I should remove the Migrations/ from .gitignore :kekw:
Unknown User
Unknown User10mo ago
Message Not Public
Sign In & Join Server To View
Jimmacle
Jimmacle10mo ago
100% migrations are a permanent part of the project
WAASUL
WAASULOP10mo ago
Thanks again boys. Cheers
Want results from more Discord servers?
Add your server