ericknavarro
ericknavarro

Reputation: 45

Is it good practice to add migrations files to the repository?

I am using Django to create my applications and I am uploading them to GitHub. I have like a "history" of migrations files and they are all there.

Is it good practice to upload all migrations files to GitHub or do they need to be deleted?

Upvotes: 3

Views: 2595

Answers (2)

JayTurnr
JayTurnr

Reputation: 183

Absolutely, all migration files should be committed. It's vital to ensure all users are running from the same set of migrations otherwise weird bugs could occur.

Upvotes: 2

nenadp
nenadp

Reputation: 816

You should push them.
While they are all auto-generated, it may not make much sense, but eventually someone will create manual migration (eg. to add or correct some data, without changing models).
In that case, django is not aware of any changes, and won't generate migration on next makemigrations.

Also before pushing, I would strongly recommend checking if the migration can be successfully reverted.

Upvotes: 3

Related Questions