Migrations

40 views
Skip to first unread message

Matthew Pava

unread,
Mar 10, 2017, 3:18:42 PM3/10/17
to django...@googlegroups.com

Does anyone else get a migraine when working migrations?

Aaron C. de Bruyn

unread,
Mar 10, 2017, 3:23:16 PM3/10/17
to django...@googlegroups.com
Nope.

-A

On Fri, Mar 10, 2017 at 12:17 PM, Matthew Pava <Matthe...@iss.com> wrote:
> Does anyone else get a migraine when working migrations?
>
> --
> 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 django-users...@googlegroups.com.
> To post to this group, send email to django...@googlegroups.com.
> 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/41f9ad6271964c208f3726a4fa28bfff%40ISS1.ISS.LOCAL.
> For more options, visit https://groups.google.com/d/optout.

Ed Sutherland

unread,
Mar 10, 2017, 3:57:41 PM3/10/17
to django-users
I certainly do. After a serious migration foul-up, I restarted the project. I'm now hoping there won't be a repeat. I wish there was a better way.


---- On Fri, 10 Mar 2017 15:17:11 -0500 Matthew Pava <Matthe...@iss.com> wrote ----

Does anyone else get a migraine when working migrations?


Dylan Reinhold

unread,
Mar 10, 2017, 4:20:59 PM3/10/17
to django...@googlegroups.com
Relative to where django started, with you doing all the schema changes on your own. Migrations is AMAZING.  
Now db schema control is one of the harder problems to solve. Migration is not perfect, if you have ideas on how to make it better or know people who do, I'm sure Andrew and the django team would love to work work you on making it better.

I think a great thing that can be done is for people who have had issues with migration (or any software) to share and document what lead up to their issues.
Then 2 things happen the dev team has visibility into whats going wrong in the wild. And others can learn from those issues and try and avoid them.

Just my $0.02
Dylan

On Fri, Mar 10, 2017 at 12:56 PM, Ed Sutherland <e...@tburgnews.com> wrote:
I certainly do. After a serious migration foul-up, I restarted the project. I'm now hoping there won't be a repeat. I wish there was a better way.


---- On Fri, 10 Mar 2017 15:17:11 -0500 Matthew Pava <Matthe...@iss.com> wrote ----

Does anyone else get a migraine when working migrations?


--
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 django-users+unsubscribe@googlegroups.com.

--
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 django-users+unsubscribe@googlegroups.com.

To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.

Mike Dewhirst

unread,
Mar 11, 2017, 2:23:22 AM3/11/17
to django...@googlegroups.com
On 11/03/2017 7:17 AM, Matthew Pava wrote:
>
> Does anyone else get a migraine when working migrations?
>

Only when I try to game them. If I follow instructions they are
magnificent. That said, what are your problems?

Mike


> --
> 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 django-users...@googlegroups.com
> <mailto:django-users...@googlegroups.com>.
> To post to this group, send email to django...@googlegroups.com
> <mailto:django...@googlegroups.com>.
> <https://groups.google.com/d/msgid/django-users/41f9ad6271964c208f3726a4fa28bfff%40ISS1.ISS.LOCAL?utm_medium=email&utm_source=footer>.

Vijay Khemlani

unread,
Mar 11, 2017, 2:58:53 PM3/11/17
to django...@googlegroups.com
Not really, as long as you understand what's going on and not
inputting commands just for the sake of it.
> email to django-users...@googlegroups.com.
> To post to this group, send email to django...@googlegroups.com.
> 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/8e23d94f-696c-91b4-af71-0418d047cd80%40dewhirst.com.au.

Matthew Pava

unread,
Mar 13, 2017, 9:26:44 AM3/13/17
to django...@googlegroups.com
My problems this time around came from a circular dependency that squashmigrations caused. I have had issues in the past with removing a field from a model and basically having a simple pass statement for the model. I saw a ticket or some discussion somewhere about that issue elsewhere. I also have had issues when renaming models, especially since the apps in my project are so interdependent on each other. But I already saw a ticket for part of that issue that is currently unresolved. It is related to using a string to relate a ForeignKey instead of the model object itself. The other aspect of that issue was that the makemigrations commands added so many unnecessary operations that just caused the migrate command to break. And after applying the new migrations to the production code, it works fine until I apply the migrations again, stating that it can't find the field that I already renamed.

I apologize for my earlier generalization, but, as you can see, I have had a struggle with migrations in general, and I have generally tried to let Django do the work in generating them.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/8e23d94f-696c-91b4-af71-0418d047cd80%40dewhirst.com.au.

marcin....@gmail.com

unread,
Mar 13, 2017, 10:28:32 AM3/13/17
to Django users, Matthe...@iss.com


On Friday, March 10, 2017 at 9:18:42 PM UTC+1, Matthew Pava wrote:

Does anyone else get a migraine when working migrations?


Yes*. Long time ago. Stayed with Liquibase wrapped with Liquimigrate.

Builtin migrations are pretty unrielable, because they're strongly dependent on your application's code. 
Create custom field, make migration, remove custom field - kaboom! Or something like that.

* - Not always. Builtin migrations are awesome, but for blog-like or short-maintainable projects. 
I'm using them for very small projects (blogs, homepages, etc) and they work well there.
These projects are rarely changed and I have no headache here. 

So the truth is - it depends. Think about maintaining the project and go with Liquibase (or something else) where long-term support is required.

Marcin

Mike Dewhirst

unread,
Mar 13, 2017, 9:33:56 PM3/13/17
to django...@googlegroups.com
On 14/03/2017 12:25 AM, Matthew Pava wrote:
> My problems this time around came from a circular dependency

I have encountered that but I blame myself for asking too much of
migrations. I have renamed a model and table successfully using
migrations and I believe that led to the circular dependency when I
tried to squash.

My project is SaaS in nature so I have control of all instances of the
database. My plan is to choose a moment in time when the entrails
indicate good fortune awaits the bold and I'll delete *all* migrations
except for the Django ones and remove the records from the
django_migrations table and do a fake initial migration.

Naturally I'll prepare well with a brute-force recovery in mind and ...
I have never believed I would ever want to roll my project back to a
previous incarnation so losing all the migrations is a price I'm
prepared to pay.

Cheers

Mike

Larry Martell

unread,
Mar 15, 2017, 10:18:33 AM3/15/17
to django...@googlegroups.com
On Fri, Mar 10, 2017 at 3:17 PM, Matthew Pava <Matthe...@iss.com> wrote:
> Does anyone else get a migraine when working migrations?

I have 2 django systems I support. The first has 2 deployments, both
in house, and one is generally a week or so behind the other. For this
system migrations generally work fine, however we do get situations
where they throw an error even though the migration seemed to work
(which I find disconcerting).

The second has 30 deployments, all out the field, all with different
versions of the code, and some without any external access. For these
we could not make migrations work for us and we do not use them.

Overall, I much preferred the old syncdb to create new tables, and I
managed the schema changes myself.
Reply all
Reply to author
Forward
0 new messages