Re: [Django] #30869: Setting to confirm destructive/weird migrations.

2019-10-11 Thread Django
#30869: Setting to confirm destructive/weird migrations.
-+-
 Reporter:  awiebe   |Owner:  nobody
 Type:  New feature  |   Status:  closed
Component:  Migrations   |  Version:  master
 Severity:  Normal   |   Resolution:  wontfix
 Keywords:  destructive,setting  | Triage Stage:
 |  Unreviewed
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Simon Charette):

 FWIW you could implement a confirmation mechanism by connecting a receiver
 to the `pre_migrate` signal based on the `interactive` flag.

 e.g.

 {{{#!python
 def confirm_destructive_operation(plan, interactive, **kwargs):
 if not interactive:
 return
 for migration, backward in plan:
if backward:
   return
for operation in migration.operations:
if isinstance(operation, RemoveField):
if not confirm("You're about to remove field..."):
break
 }}}

 It should be straightforward to implement as a third party package.

-- 
Ticket URL: 
Django 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/064.eb9a3448fb55051016427350bffbf085%40djangoproject.com.


Re: [Django] #30869: Setting to confirm destructive/weird migrations.

2019-10-11 Thread Django
#30869: Setting to confirm destructive/weird migrations.
-+-
 Reporter:  awiebe   |Owner:  nobody
 Type:  New feature  |   Status:  closed
Component:  Migrations   |  Version:  master
 Severity:  Normal   |   Resolution:  wontfix
 Keywords:  destructive,setting  | Triage Stage:
 |  Unreviewed
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by felixxm):

 * status:  new => closed
 * version:  2.2 => master
 * resolution:   => wontfix


Comment:

 Thanks for this report, however I don't think that we should force users
 to confirm that they really want to delete a model or remove a field
 because that causes a data loss. It seems quite clear to me that when you
 remove a table or column, you'll will lose data. IMO it's not Django job
 to explain that.

 About fields altering, DB should prevent you from losing data (it is not
 possible to change a text-type field into a number-type field in most
 databases). SQLite limitation is
 [https://docs.djangoproject.com/en/2.2/topics/migrations/#sqlite already
 described in documentation].

-- 
Ticket URL: 
Django 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/064.e5b81fd6d2938031426f091bf0941161%40djangoproject.com.