migration lock file implementation

154 views
Skip to first unread message

Jian Li

unread,
May 17, 2017, 4:30:41 PM5/17/17
to django-d...@googlegroups.com
Hi!

This is an idea that has been around for a while, and has been implemented by various organizations running Django: using lock files to prevent migration conflicts.

I recently implemented something for our Django project at work. Here is a cleaned-up version:


Hopefully this is useful enough to be merged upstream. Please let me know what you think, and keep up the amazing work!

-Jian

ji...@jianli.us

unread,
May 24, 2017, 3:39:43 PM5/24/17
to Django developers (Contributions to Django itself)
To elaborate on this feature request:

When working on a Django project with other people, a common issue is unintentionally creating conflicting migrations. These happen silently if two developers create and merge migrations in parallel. It's not clear there is a problem until after the second migration is merged. With this patch, the second migration will be prevented from merging by the VCS due to a merge conflict in the lock file.

A documented example of a team that uses something like this in production can be found at the Zenefits engineering blog.

Do you think that this is a useful feature to have in Django? And if so, does the proposed patch suffice?

-Jian

Andrew Godwin

unread,
May 24, 2017, 3:42:20 PM5/24/17
to Django developers (Contributions to Django itself)
I am personally unsure about this - it's extra overhead for smaller Django sites, and something that larger teams could easily adopt themselves. I think it might make more sense as a third-party app that plugs in?

Andrew

--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-developers+unsubscribe@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/98310105-15e4-473f-acab-e9e7b0427250%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Florian Apolloner

unread,
May 24, 2017, 6:03:11 PM5/24/17
to Django developers (Contributions to Django itself)
On Wednesday, May 24, 2017 at 9:42:20 PM UTC+2, Andrew Godwin wrote:
I am personally unsure about this - it's extra overhead for smaller Django sites, and something that larger teams could easily adopt themselves.

Yeah, I do not see an immediate need for this either.

Adam Johnson

unread,
May 25, 2017, 3:54:47 AM5/25/17
to django-d...@googlegroups.com
I agree, it really depends on your project's workflow and organization as to how often you see migration conflicts and whether this is the right way to show them to users. Creating lock files in django core would just add confusion for 99% of projects.

--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-developers+unsubscribe@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.

For more options, visit https://groups.google.com/d/optout.



--
Adam
Reply all
Reply to author
Forward
0 new messages