Re: [Django] #25492: warn about migrations mixing schema- and data- changing operations

2016-12-19 Thread Django
#25492: warn about migrations mixing schema- and data- changing operations
-+-
 Reporter:  Joey Wilhelm |Owner:  nobody
 Type:  New feature  |   Status:  new
Component:  Core (System |  Version:  master
  checks)|
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:  Ready for
 |  checkin
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Tim Graham):

 * stage:  Accepted => Ready for checkin


--
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 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/069.f0ebf3012a396f426bbf79cf48a3de0c%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #25492: warn about migrations mixing schema- and data- changing operations

2016-12-17 Thread Django
#25492: warn about migrations mixing schema- and data- changing operations
--+
 Reporter:  Joey Wilhelm  |Owner:  nobody
 Type:  New feature   |   Status:  new
Component:  Core (System checks)  |  Version:  master
 Severity:  Normal|   Resolution:
 Keywords:| Triage Stage:  Accepted
Has patch:  1 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  0
Easy pickings:  0 |UI/UX:  0
--+
Changes (by Simon Charette):

 * has_patch:  0 => 1


Comment:

 Here's a [https://github.com/django/django/pull/7709 PR] solving the
 pending trigger events issue by checking deferred foreign key constraints
 before deleting them.

--
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 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/069.c8a698d87ceb28c48ca7e5ede9bacdc1%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #25492: warn about migrations mixing schema- and data- changing operations

2016-12-17 Thread Django
#25492: warn about migrations mixing schema- and data- changing operations
--+
 Reporter:  Joey Wilhelm  |Owner:  nobody
 Type:  New feature   |   Status:  new
Component:  Core (System checks)  |  Version:  master
 Severity:  Normal|   Resolution:
 Keywords:| Triage Stage:  Accepted
Has patch:  0 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  0
Easy pickings:  0 |UI/UX:  0
--+

Comment (by Simon Charette):

 I just wanted to mention that wrapping your migration operations with `SET
 CONSTRAINTS ALL IMMEDIATE` solves the `pending trigger events` message.

 {{{#!python
 operations = [
 migrations.RunSQL('SET CONSTRAINTS ALL IMMEDIATE', 'SET CONSTRAINTS
 ALL DEFERRED'),
 migrations.AlterField(
 model_name='charity',
 name='name_legal',
 field=models.CharField(max_length=255, default='',
 verbose_name='legal name'),
 preserve_default=False,
 ),
 migrations.RunSQL('SET CONSTRAINTS ALL DEFERRED', 'SET CONSTRAINTS ALL
 IMMEDIATE'),
 ]
 }}}

 Maybe this is something that could be done automatically by Django in
 `AlterField` when it knows it has to perform both a data and structural
 update?

--
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 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/069.ab51b9768c9000b270340c2463a9a553%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #25492: warn about migrations mixing schema- and data- changing operations

2015-10-03 Thread Django
#25492: warn about migrations mixing schema- and data- changing operations
--+
 Reporter:  tarkatronic   |Owner:  nobody
 Type:  New feature   |   Status:  new
Component:  Core (System checks)  |  Version:  master
 Severity:  Normal|   Resolution:
 Keywords:| Triage Stage:  Accepted
Has patch:  0 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  0
Easy pickings:  0 |UI/UX:  0
--+
Changes (by shaib):

 * cc: shaib (added)


Comment:

 Replying to [comment:4 tarkatronic]:
 > An alternative which was suggested, in regards to my specific case, was
 to split the data and schema operations into separate transactions, or
 even separate migrations. Would something like that be a possibility?

 If you're thinking about some automatic process to do the splitting into
 migrations, I don't think that's a very good idea. Remember, to get the
 problem in the first place, the migration needs to have been edited by the
 user. This means that, in order to generate the separate migration files,
 we'd need to parse and understand their code, and I suspect the fringe
 cases where this would break (not as in "error out", but as in "generate
 wrong code") are many and hard to detect.

--
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 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/069.8b1b8970fdd4ab06c49db907ae0c2c72%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #25492: warn about migrations mixing schema- and data- changing operations

2015-10-02 Thread Django
#25492: warn about migrations mixing schema- and data- changing operations
--+
 Reporter:  tarkatronic   |Owner:  nobody
 Type:  New feature   |   Status:  new
Component:  Core (System checks)  |  Version:  master
 Severity:  Normal|   Resolution:
 Keywords:| Triage Stage:  Accepted
Has patch:  0 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  0
Easy pickings:  0 |UI/UX:  0
--+

Comment (by timgraham):

 Each migration is run in a separate transaction, so yes, splitting the
 operations into separate files is what you should do. We don't want to run
 multiple transactions per migration because we need each migration to be
 atomic.

--
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 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/069.2f6f0b05831e1bf1884697d3581a6b31%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #25492: warn about migrations mixing schema- and data- changing operations

2015-10-02 Thread Django
#25492: warn about migrations mixing schema- and data- changing operations
--+
 Reporter:  tarkatronic   |Owner:  nobody
 Type:  New feature   |   Status:  new
Component:  Core (System checks)  |  Version:  master
 Severity:  Normal|   Resolution:
 Keywords:| Triage Stage:  Accepted
Has patch:  0 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  0
Easy pickings:  0 |UI/UX:  0
--+

Comment (by tarkatronic):

 An alternative which was suggested, in regards to my specific case, was to
 split the data and schema operations into separate transactions, or even
 separate migrations. Would something like that be a possibility?

--
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 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/069.4b973258db9dc6367fcdcd02940ca2e4%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #25492: warn about migrations mixing schema- and data- changing operations

2015-10-02 Thread Django
#25492: warn about migrations mixing schema- and data- changing operations
--+
 Reporter:  tarkatronic   |Owner:  nobody
 Type:  New feature   |   Status:  new
Component:  Core (System checks)  |  Version:  master
 Severity:  Normal|   Resolution:
 Keywords:| Triage Stage:  Accepted
Has patch:  0 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  0
Easy pickings:  0 |UI/UX:  0
--+
Changes (by timgraham):

 * component:  Migrations => Core (System checks)
 * stage:  Unreviewed => Accepted


--
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 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/069.937b909a511a6386345876f290446ebf%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #25492: warn about migrations mixing schema- and data- changing operations (was: makemigrations can generate invalid migrations when removing null=True from a field)

2015-10-02 Thread Django
#25492: warn about migrations mixing schema- and data- changing operations
-+--
 Reporter:  tarkatronic  |Owner:  nobody
 Type:  New feature  |   Status:  new
Component:  Migrations   |  Version:  master
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:  Unreviewed
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+--
Changes (by shaib):

 * version:  1.8 => master
 * type:  Bug => New feature


Comment:

 The problem is that some migrations, even including both schema changes
 and data changes, are valid; for an example, see comment:5:ticket:24630.
 So, forbidding such migrations is a backwards-incompatible change.

 That said, I still think it is a change worth making, at least to some
 degree. I think that, for starters, a warning (using the Checks framework)
 for mixed operations in a migration could be a good idea. To support it,
 we'd need each operation to define its "type" -- schema or data operation,
 or "possibly either" (e.g. `RunSQL`); the check would warn if any
 migration mixes types, or if a "possibly either" operation is in the same
 migration with any other operation. At least for the "possibly either"
 operations, the type should be overridable. All these APIs need to be
 public, to enable user-defined operations to play nice.

 I've modified the ticket title and type in accordance with this
 suggestion; if this seems reasonable, we should also change the
 description. In any case, a behavior change about this would be a new
 feature, and we'd need a reason to backport it even to 1.9, not to mention
 1.8.

--
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 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/069.f4e91951da9afe39eb3c233361656cec%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.