#29198: Add a --plan option to the migrate command
--------------------------------------------+------------------------
               Reporter:  Craig de Stigter  |          Owner:  nobody
                   Type:  Uncategorized     |         Status:  new
              Component:  Migrations        |        Version:  2.0
               Severity:  Normal            |       Keywords:
           Triage Stage:  Unreviewed        |      Has patch:  0
    Needs documentation:  0                 |    Needs tests:  0
Patch needs improvement:  0                 |  Easy pickings:  0
                  UI/UX:  0                 |
--------------------------------------------+------------------------
 While migrating a prod database today I found myself feeling
 uncomfortable.

 In a situation like this:

 {{{
 [X] 0023_add_fairy_dust
 [X] 0021_apply_beers_to_database
 [ ] 0022_magik_stuff
 [ ] 0024_merge
 }}}

 ... what will happen when I run `django-admin migrate app
 0023_add_fairy_dust`? Will `0021_apply_beers_to_database` get unapplied?
 Will it try to roll forwards to the merge? Will some dependencies from
 another app get pulled in? Will any tables get dropped? Something Else?*

 We really need a way to quickly sanity-check what's going to happen,
 before actually doing it.

 A dry-run option was proposed in #23347 but then everyone missed the
 forest for the trees, and it was closed because something about RunPython
 not being able to be sqlified.

 There are various ways to do this:

 * I think a simple `--plan` showing which migrations will be applied (same
 as the `showmigrations` option, but for a specific plan, especially for
 reverse plans) would probably be enough to ease my mind about unapplying
 beers.
 * A short summary of the operations involved might be nice.
 * Full SQL output might be cool. But it might also be too verbose for a
 quick sanity check if there are a lot of changes. And as pointed out in
 the other ticket, it doesn't work for RunPython (but that's not really a
 good reason to not do it)


 I haven't spent much time in newer releases (currently upgrading a large
 project from 1.8 to 1.11) but AFAICT this still doesn't exist. Correct me
 if I'm wrong.




 (*Answer: nothing happens - it says `No migrations to apply.`. I don't
 think it's possible to unapply those beers, but that's a separate issue.)

-- 
Ticket URL: <https://code.djangoproject.com/ticket/29198>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/050.7e013037ed6279bd4a3317023b9950a6%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to