I actually think this would be super useful if we can make it make sense
(HEAD~ with merges..). "Undo the migration I just did" is a common
operation in development.

M
On 11 Mar 2016 2:18 p.m., "Joakim Saario" <saario.joa...@gmail.com> wrote:

> You can always have a y/N-question to limit these cases. Though, I think
> this is a problem as it is right now too, because you can always do a typo.
>
> /Joakim
>
> Den fredag 11 mars 2016 kl. 14:06:42 UTC+1 skrev Markus Holtermann:
>>
>> Hi Joakim,
>>
>> thank you for your proposal.
>>
>> I don't think this is a good idea because you can easily accidentally
>> undo too many migrations which would inevitably will result in data loss.
>> You don't have the data loss problem in Git as you can always recover by
>> using `git reflog` to go back and e.g. undo an incorrect rebase. However,
>> when you remove a field from a database table the data is pretty much lost.
>>
>> Cheers,
>>
>> /Markus
>>
>> On Friday, March 11, 2016 at 11:39:53 PM UTC+11, Joakim Saario wrote:
>>>
>>> Hello!
>>>
>>> Today if you just need to unmigrate the *n* migrations before the last
>>> one you would
>>> typically run `migrate <app> --list` and then `migrate <app>
>>> <migration_name>` where
>>> `migration_name` is the migration you want to roll back to.
>>>
>>> To reduce the steps of this procedure i think it would be nice to
>>> introduce
>>> a syntax similar to how commits in for example git works. I.e `git show
>>> HEAD^`
>>> for the previous commit and `git show HEAD~2` for the one before that.
>>> It would also be good to support the `git show <commit_id>(^+)|(~\d)`
>>> variant
>>> of this to be able to choose the origin.
>>>
>>> For this to work good for the normal case, there need to be a magic word
>>> that maps to the latest migration available and/or the latest applied
>>> migration.
>>>
>>> I can clearly see a use case for this as I can imagine that the most
>>> common
>>> operation besides applying all unmigrated migrations is to roll back *n*
>>> migrations.
>>>
>>> Does this sounds like a good idea?
>>>
>> --
> 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+unsubscr...@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/46b90e2f-e14d-41c9-8ac8-f7758e3a3d46%40googlegroups.com
> <https://groups.google.com/d/msgid/django-developers/46b90e2f-e14d-41c9-8ac8-f7758e3a3d46%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 developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@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/CAMwjO1EjGUM3P4e6GBFAdSHTnJoiXO1OEUAKJPY1RMyT0hkZAA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to