Monday, April 17, 2017

Re: Automatic reverse migrations

On 18/04/2017 9:58 AM, paul@qwil.co wrote:
> Thanks Andrew, will see what I can rustle up.
>
> Camilo -- blue/green deploys don't really help with this problem. As
> each application deployment still talks to the same database, once you
> have run the migration you can't just abandon your deployment, you
> need to unwind the db migration first.

I agree it is an unsolvable problem to automate it. Or rather, not worth
the development cost of making an automatic "unwinder".

For the number of times it is likely to be needed in general it would be
less costly to do another new migration towards the previous state.

>
> On Saturday, April 15, 2017 at 6:01:03 PM UTC-7, Camilo Torres wrote:
>
> Hi,
> May both of you try to implement "blue-green deployments", and
> switch only if all tests are OK.
> You may also be interested in running a test deployment in a
> testing environment prior to production.
> Don't know of a solution integrated into django.
>
> On Friday, April 14, 2017 at 2:26:51 PM UTC-4, Andrew Godwin wrote:
>
> Hi Paul,
>
> I have tried this in the past, but it's basically an
> unsolvable problem in the generic case. Databases do not take
> well to snapshotting or changing schema, and some operations
> are naturally irreversible. If you find a way that works well,
> I suggest you write it up so others can learn from it!
>
> Andrew
>
> On Fri, Apr 14, 2017 at 10:33 AM, <pa...@qwil.co> wrote:
>
> In a modern Continuous Delivery environment, it's expected
> that there is an automated process for deploying code, and
> therefore performing database migrations. This is all
> straightforward.
>
> I haven't been able to find any good solutions for
> automatic rollback though. The main problem that I see is
> that there is (AFAIK) no easy way to definitively know
> which migrations to unapply to roll back to the previous
> verison. If you try to rollback from the new N+1 version,
> you have the migrations, but no recording of the previous
> version's state. If you rollback from the previous N
> version, you don't have the new migration files to do the
> DB rollback.
>
> What I'd really like is a way of recording a 'db migration
> checkpoint' which could be generated per-release (or
> whenever else you care to checkpoint your migration
> state), and would say something like `v1: {app1:0002,0003,
> app2: 0004}, v2: {app1:0004, app2: 0005, 0006}`, thus
> letting me roll back all of the migrations in the v2
> deploy with a single command.
>
> Does anyone have suggestions or references here? I may try
> rolling the above solution if there is no prior art, but I
> want to avoid reinventing the wheel here, as it seems that
> this issue must have been hit by many other users before me.
> --
> 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
> <https://groups.google.com/group/django-users>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/6cafecca-2c71-4a6f-b93b-fe3e64847bc2%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/6cafecca-2c71-4a6f-b93b-fe3e64847bc2%40googlegroups.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout
> <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 django-users+unsubscribe@googlegroups.com
> <mailto:django-users+unsubscribe@googlegroups.com>.
> To post to this group, send email to django-users@googlegroups.com
> <mailto:django-users@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/8d8f46a7-8819-4d18-908d-9681d8b6a39e%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/8d8f46a7-8819-4d18-908d-9681d8b6a39e%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 django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@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/21a5c50b-2ef2-e729-64a4-71f96b8f213b%40dewhirst.com.au.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment