Quantcast

migration lock file implementation

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

migration lock file implementation

Jian Li
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

--
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 [hidden email].
To post to this group, send email to [hidden email].
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/CACwUGkxYMkVtgoX6WgKDddV%2BihdpJUwe%2B1cos2E-RRsj3X3fjg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: migration lock file implementation

Jian Li
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

On Wednesday, May 17, 2017 at 1:30:41 PM UTC-7, Jian Li wrote:
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:

<a href="https://github.com/django/django/compare/master...jianli:migration-lock-file" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fdjango%2Fdjango%2Fcompare%2Fmaster...jianli%3Amigration-lock-file\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGGr2itxfqzxw8sWEvqIBD4cmmuqg&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fdjango%2Fdjango%2Fcompare%2Fmaster...jianli%3Amigration-lock-file\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGGr2itxfqzxw8sWEvqIBD4cmmuqg&#39;;return true;">https://github.com/django/django/compare/master...jianli:migration-lock-file

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

-Jian

--
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 [hidden email].
To post to this group, send email to [hidden email].
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.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: migration lock file implementation

Andrew Godwin-3
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

On Wed, May 24, 2017 at 12:39 PM, <[hidden email]> wrote:
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

On Wednesday, May 17, 2017 at 1:30:41 PM UTC-7, Jian Li wrote:
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

--
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 [hidden email].
To post to this group, send email to [hidden email].
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.

--
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 [hidden email].
To post to this group, send email to [hidden email].
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/CAFwN1ure5A%3D53%2BuGROkt0%2B8NLWg0p_rVBUq4uFYNQa%2Bs8ALyMg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: migration lock file implementation

Florian Apolloner
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.

--
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 [hidden email].
To post to this group, send email to [hidden email].
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/522df540-899e-4c18-a101-d14a9f6535d9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: migration lock file implementation

Adam Johnson-2
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.

On 24 May 2017 at 23:03, Florian Apolloner <[hidden email]> wrote:
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.

--
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 [hidden email].
To post to this group, send email to [hidden email].
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/522df540-899e-4c18-a101-d14a9f6535d9%40googlegroups.com.

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



--
Adam

--
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 [hidden email].
To post to this group, send email to [hidden email].
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/CAMyDDM0s%2BT-5XZUv-ecQ50%3Dd8kLvXYjUPko0RRuvQA%2BaW3byrw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Loading...