✅ 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
VersionPrefix_JiraTicketName_ShortDescription
is what we use at work 🙂@Pobiega Could you give an example if possible?
i just name mine something related to what they do
007_005_BA_5871_Local_identifiers
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?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
I see, I didn't know that. Thanks mate.
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•9mo ago
Message Not Public
Sign In & Join Server To View
:A_pepelaugh:
I guess, I should remove the
Migrations/
from .gitignore
:kekw:Unknown User•9mo ago
Message Not Public
Sign In & Join Server To View
100%
migrations are a permanent part of the project
Thanks again boys. Cheers