At least for me I have custom migrations (for a materialized view) so that
needs to be commited, and a migration seems the most logical place to do so

Also if you already have a production database and you need to execute a
complex change in the data model you may need a sequence of steps that
include for example running migrations to a certain point, run a script,
and then run the rest of the migrations, which can't be done if the server
just makes its own migration in one step.

There may be other reasons but those are the most common for me

On Mon, Apr 30, 2018 at 1:03 PM Tom Scrace <[email protected]> wrote:

> Hi all,
>
> The way I've always worked, developers run `makemigrations` locally, and
> commit migration files to the repo.
>
> However, a suggestion has recently come my way that a better strategy is
> to only commit model changes to the repo (leaving the migrations directory
> gitignored), and then run `makemigrations` in whatever environment the app
> needs to run, whether that's another developer's laptop, or in production.
> The putative benefit is that this avoids the possibility of migration
> conflicts, and always guarantees a clean migration from the state of a
> database schema to the state of the Django models.
>
> Googling around, this opinion seems to be moderately widespread, although
> the official docs, and the *majority* of commenters seem to agree that
> committing migration files is the right way.
>
> I think I agree, but I can't quite put my finger on decisive arguments
> against the idea of not committing migration files. I feel like I am
> missing something.
>
> What are some reasons we should go the route of committing migration files?
>
> Thanks,
> Tom
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/08ef20a1-9b51-4bea-a1d8-7d3ed61093fe%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/08ef20a1-9b51-4bea-a1d8-7d3ed61093fe%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CALn3ei1JmrBG08kBqKVNeK_ExGDUgjEe%2Bg-J9yuUU9Yt341RkQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to