Re: [Django] #24424: Removing a model's last field results in SQL syntax error on SQLite

2015-11-07 Thread Django
#24424: Removing a model's last field results in SQL syntax error on SQLite
+
 Reporter:  adnam   |Owner:
 Type:  Bug |   Status:  new
Component:  Migrations  |  Version:  1.7
 Severity:  Normal  |   Resolution:
 Keywords:  | Triage Stage:  Accepted
Has patch:  1   |  Needs documentation:  0
  Needs tests:  0   |  Patch needs improvement:  1
Easy pickings:  0   |UI/UX:  0
+

Comment (by timgraham):

 #25690 is a duplicate.

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


Re: [Django] #24424: Removing a model's last field results in SQL syntax error on SQLite

2015-10-14 Thread Django
#24424: Removing a model's last field results in SQL syntax error on SQLite
+
 Reporter:  adnam   |Owner:
 Type:  Bug |   Status:  new
Component:  Migrations  |  Version:  1.7
 Severity:  Normal  |   Resolution:
 Keywords:  | Triage Stage:  Accepted
Has patch:  1   |  Needs documentation:  0
  Needs tests:  0   |  Patch needs improvement:  1
Easy pickings:  0   |UI/UX:  0
+

Comment (by chidg):

 I am also hitting this bug in Django 1.8.4, Python 3.4.3, while running a
 migration to remove a model's fields and then delete the model. I worked
 around the problem after reading this bug report and manually removing the
 `migrations.RemoveField` command before the `migrations.DeleteModel`
 command.

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


Re: [Django] #24424: Removing a model's last field results in SQL syntax error on SQLite

2015-08-19 Thread Django
#24424: Removing a model's last field results in SQL syntax error on SQLite
+
 Reporter:  adnam   |Owner:
 Type:  Bug |   Status:  new
Component:  Migrations  |  Version:  1.7
 Severity:  Normal  |   Resolution:
 Keywords:  | Triage Stage:  Accepted
Has patch:  1   |  Needs documentation:  0
  Needs tests:  0   |  Patch needs improvement:  1
Easy pickings:  0   |UI/UX:  0
+

Comment (by IanLee1521):

 Still seeing this issue in Django 1.7.9 (Python 2.7.6)

 {{{
   Applying foo.0005_auto_20150819_1819...Traceback (most recent call
 last):
   File "./manage.py", line 31, in 
 execute_from_command_line(sys.argv)
   File "/home/ianlee1521/.virtualenvs/bar/local/lib/python2.7/site-
 packages/django/core/management/__init__.py", line 385, in
 execute_from_command_line
 utility.execute()
   File "/home/ianlee1521/.virtualenvs/bar/local/lib/python2.7/site-
 packages/django/core/management/__init__.py", line 377, in execute
 self.fetch_command(subcommand).run_from_argv(self.argv)
   File "/home/ianlee1521/.virtualenvs/bar/local/lib/python2.7/site-
 packages/django/core/management/base.py", line 288, in run_from_argv
 self.execute(*args, **options.__dict__)
   File "/home/ianlee1521/.virtualenvs/bar/local/lib/python2.7/site-
 packages/django/core/management/base.py", line 338, in execute
 output = self.handle(*args, **options)
   File "/home/ianlee1521/.virtualenvs/bar/local/lib/python2.7/site-
 packages/django/core/management/commands/migrate.py", line 161, in handle
 executor.migrate(targets, plan, fake=options.get("fake", False))
   File "/home/ianlee1521/.virtualenvs/bar/local/lib/python2.7/site-
 packages/django/db/migrations/executor.py", line 68, in migrate
 self.apply_migration(migration, fake=fake)
   File "/home/ianlee1521/.virtualenvs/bar/local/lib/python2.7/site-
 packages/django/db/migrations/executor.py", line 102, in apply_migration
 migration.apply(project_state, schema_editor)
   File "/home/ianlee1521/.virtualenvs/bar/local/lib/python2.7/site-
 packages/django/db/migrations/migration.py", line 108, in apply
 operation.database_forwards(self.app_label, schema_editor,
 project_state, new_state)
   File "/home/ianlee1521/.virtualenvs/bar/local/lib/python2.7/site-
 packages/django/db/migrations/operations/fields.py", line 84, in
 database_forwards
 schema_editor.remove_field(from_model,
 from_model._meta.get_field_by_name(self.name)[0])
   File "/home/ianlee1521/.virtualenvs/bar/local/lib/python2.7/site-
 packages/django/db/backends/sqlite3/schema.py", line 197, in remove_field
 self._remake_table(model, delete_fields=[field])
   File "/home/ianlee1521/.virtualenvs/bar/local/lib/python2.7/site-
 packages/django/db/backends/sqlite3/schema.py", line 146, in _remake_table
 self.quote_name(model._meta.db_table),
   File "/home/ianlee1521/.virtualenvs/bar/local/lib/python2.7/site-
 packages/django/db/backends/schema.py", line 111, in execute
 cursor.execute(sql, params)
   File "/home/ianlee1521/.virtualenvs/bar/local/lib/python2.7/site-
 packages/django/db/backends/utils.py", line 81, in execute
 return super(CursorDebugWrapper, self).execute(sql, params)
   File "/home/ianlee1521/.virtualenvs/bar/local/lib/python2.7/site-
 packages/django/db/backends/utils.py", line 65, in execute
 return self.cursor.execute(sql, params)
   File "/home/ianlee1521/.virtualenvs/bar/local/lib/python2.7/site-
 packages/django/db/utils.py", line 94, in __exit__
 six.reraise(dj_exc_type, dj_exc_value, traceback)
   File "/home/ianlee1521/.virtualenvs/bar/local/lib/python2.7/site-
 packages/django/db/backends/utils.py", line 65, in execute
 return self.cursor.execute(sql, params)
   File "/home/ianlee1521/.virtualenvs/bar/local/lib/python2.7/site-
 packages/django/db/backends/sqlite3/base.py", line 485, in execute
 return Database.Cursor.execute(self, query, params)
 django.db.utils.OperationalError: near ")": syntax error

 }}}

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


Re: [Django] #24424: Removing a model's last field results in SQL syntax error on SQLite

2015-06-18 Thread Django
#24424: Removing a model's last field results in SQL syntax error on SQLite
+
 Reporter:  adnam   |Owner:
 Type:  Bug |   Status:  new
Component:  Migrations  |  Version:  1.7
 Severity:  Normal  |   Resolution:
 Keywords:  | Triage Stage:  Accepted
Has patch:  1   |  Needs documentation:  0
  Needs tests:  0   |  Patch needs improvement:  1
Easy pickings:  0   |UI/UX:  0
+

Comment (by adnam):

 I notice this bug is still open after 4 months. My feeling is that
 reproducing it by creating a rather convoluted series of migrations is
 rather the wrong way to go about it. The error is quite simple as I
 [[https://github.com/django/django/pull/4325#issuecomment-85060638|explained
 earlier]], and the fix is just a
 [[https://github.com/django/django/pull/4325/files#diff-
 0c8f495bfee773ab7b5409533bd6d7efL142|2-line change in
 db/backends/sqlite3/schema.py]]. The bug only affects the sqlite schema
 editor as it uniquely deletes then re-creates tables upon migrations.
 Reproducing the error via migrations is rather like eating sushi with 10m-
 long chopsticks, since the bug is several layers down the internal API.
 Just my tuppence worth.

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


Re: [Django] #24424: Removing a model's last field results in SQL syntax error on SQLite

2015-04-15 Thread Django
#24424: Removing a model's last field results in SQL syntax error on SQLite
+
 Reporter:  adnam   |Owner:
 Type:  Bug |   Status:  new
Component:  Migrations  |  Version:  1.7
 Severity:  Normal  |   Resolution:
 Keywords:  | Triage Stage:  Accepted
Has patch:  1   |  Needs documentation:  0
  Needs tests:  0   |  Patch needs improvement:  1
Easy pickings:  0   |UI/UX:  0
+

Comment (by jwineinger):

 Hrm, seems my patch to omit a RemoveField will probably mess up reverse
 migrations.

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


Re: [Django] #24424: Removing a model's last field results in SQL syntax error on SQLite

2015-04-14 Thread Django
#24424: Removing a model's last field results in SQL syntax error on SQLite
+
 Reporter:  adnam   |Owner:
 Type:  Bug |   Status:  new
Component:  Migrations  |  Version:  1.7
 Severity:  Normal  |   Resolution:
 Keywords:  | Triage Stage:  Accepted
Has patch:  1   |  Needs documentation:  0
  Needs tests:  0   |  Patch needs improvement:  1
Easy pickings:  0   |UI/UX:  0
+

Comment (by jwineinger):

 The case below is nearly exactly the same one I ran into.

 {{{#!python
 # models.py
 from django.db import models

 class Thing(models.Model):
 pass

 class Blob(Thing):
 pass


 # 0001_initial.py
 # -*- coding: utf-8 -*-
 from __future__ import unicode_literals

 from django.db import migrations, models


 class Migration(migrations.Migration):

 dependencies = [
 ]

 operations = [
 migrations.CreateModel(
 name='Thing',
 fields=[
 ('id', models.AutoField(auto_created=True,
 primary_key=True, serialize=False, verbose_name='ID')),
 ],
 ),
 migrations.CreateModel(
 name='Blob',
 fields=[
 ('thing_ptr', models.OneToOneField(auto_created=True,
 parent_link=True, primary_key=True, serialize=False, to='app_a.Thing')),
 ],
 bases=('app_a.thing',),
 ),
 ]
 }}}

 Making `Thing` inherit a new model `Bar`:

 {{{#!python
 # models.py
 from django.db import models

 class Bar(models.Model):
 pass


 # 0002_auto.py
 # -*- coding: utf-8 -*-
 from __future__ import unicode_literals

 from django.db import models, migrations


 class Migration(migrations.Migration):

 dependencies = [
 ('thing', '0001_initial'),
 ]

 operations = [
 migrations.RemoveField(
 model_name='blob',
 name='thing_ptr',
 ),
 migrations.DeleteModel(
 name='Blob',
 ),
 ]
 }}}

 {{{
 ./manage.py migrate
 Operations to perform:
   Synchronize unmigrated apps: staticfiles, messages
   Apply all migrations: auth, admin, thing, sessions, contenttypes
 Synchronizing apps without migrations:
   Creating tables...
 Running deferred SQL...
   Installing custom SQL...
 Running migrations:
   Rendering model states... DONE
   Applying contenttypes.0001_initial... OK
   Applying auth.0001_initial... OK
   Applying admin.0001_initial... OK
   Applying contenttypes.0002_remove_content_type_name... OK
   Applying auth.0002_alter_permission_name_max_length... OK
   Applying auth.0003_alter_user_email_max_length... OK
   Applying auth.0004_alter_user_username_opts... OK
   Applying auth.0005_alter_user_last_login_null... OK
   Applying auth.0006_require_contenttypes_0002... OK
   Applying sessions.0001_initial... OK
   Applying thing.0001_initial... OK
   Applying thing.0002_auto_20150415_0113...Traceback (most recent call
 last):
   File "/Users/jawineinger/venvs/test/lib/python3.4/site-
 packages/django/db/backends/utils.py", line 64, in execute
 return self.cursor.execute(sql, params)
   File "/Users/jawineinger/venvs/test/lib/python3.4/site-
 packages/django/db/backends/sqlite3/base.py", line 318, in execute
 return Database.Cursor.execute(self, query, params)
 sqlite3.OperationalError: near ")": syntax error

 The above exception was the direct cause of the following exception:

 Traceback (most recent call last):
   File "./manage.py", line 10, in 
 execute_from_command_line(sys.argv)
   File "/Users/jawineinger/venvs/test/lib/python3.4/site-
 packages/django/core/management/__init__.py", line 338, in
 execute_from_command_line
 utility.execute()
   File "/Users/jawineinger/venvs/test/lib/python3.4/site-
 packages/django/core/management/__init__.py", line 330, in execute
 self.fetch_command(subcommand).run_from_argv(self.argv)
   File "/Users/jawineinger/venvs/test/lib/python3.4/site-
 packages/django/core/management/base.py", line 390, in run_from_argv
 self.execute(*args, **cmd_options)
   File "/Users/jawineinger/venvs/test/lib/python3.4/site-
 packages/django/core/management/base.py", line 441, in execute
 output = self.handle(*args, **options)
   File "/Users/jawineinger/venvs/test/lib/python3.4/site-
 packages/django/core/management/commands/migrate.py", line 221, in handle
 executor.migrate(targets, plan, fake=fake, fake_initial=fake_initial)
   File "/Users/jawineinger/venvs/test/lib/python3.4/site-
 packages/django/db/migrations/executor.py", line 110, in migrate
 self.apply_migration(states[migration], migration, fake=fake,
 fake_initial=fake_initial)
   File "/Users/jawineinger/venvs/test/lib/python3.4/site-
 packages/django/db/migrations/executo

Re: [Django] #24424: Removing a model's last field results in SQL syntax error on SQLite

2015-04-14 Thread Django
#24424: Removing a model's last field results in SQL syntax error on SQLite
+
 Reporter:  adnam   |Owner:
 Type:  Bug |   Status:  new
Component:  Migrations  |  Version:  1.7
 Severity:  Normal  |   Resolution:
 Keywords:  | Triage Stage:  Accepted
Has patch:  1   |  Needs documentation:  0
  Needs tests:  0   |  Patch needs improvement:  1
Easy pickings:  0   |UI/UX:  0
+

Comment (by MarkusH):

 Replying to [comment:21 jwineinger]:
 > When you say "it is not about a DeleteModel operation following a
 RemoveField. That could just remove that field", what do you mean?

 If you have `RemoveField('mymodel', 'myfield')` followed by a
 `DeleteModel('MyModel')` operation, I can't construct a case where Django
 would end up constructing those two operations automatically where the
 `RemoveField` would create a model without fields. A single `DeleteModel`
 operation should be sufficient to drop the table and all its constraints.

 > Should the approach be to change the auto-detector to not produce states
 with zero columns, or should we try and handle that somewhere else?

 Giving this issue more thoughts, I think the only way to prevent the
 autodetector to construct states with models without fields is making the
 `AlterField` operation smarter. Furthermore, when `RemoveField` would drop
 the last field on a model, an `AlterField` operation must be used that
 then can take care of the steps I outlined in [comment:20 comment 20].
 This is only necessary for primary keys, though, I think. All other cases
 can be fixed by first adding the new field and then removing the old
 field.

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


Re: [Django] #24424: Removing a model's last field results in SQL syntax error on SQLite

2015-04-14 Thread Django
#24424: Removing a model's last field results in SQL syntax error on SQLite
+
 Reporter:  adnam   |Owner:
 Type:  Bug |   Status:  new
Component:  Migrations  |  Version:  1.7
 Severity:  Normal  |   Resolution:
 Keywords:  | Triage Stage:  Accepted
Has patch:  1   |  Needs documentation:  0
  Needs tests:  0   |  Patch needs improvement:  1
Easy pickings:  0   |UI/UX:  0
+

Comment (by jwineinger):

 I admit that wasn't the use case I was trying to fix. It seems that there
 are multiple situation where migrations create states with zero columns in
 a table. I don't see the relevance in what you describe to the problem I
 was having, so perhaps they are separate symptoms of this same problem.

 When you say "it is not about a DeleteModel operation following a
 RemoveField. That could just remove that field", what do you mean?

 Should the approach be to change the auto-detector to not produce states
 with zero columns, or should we try and handle that somewhere else?

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


Re: [Django] #24424: Removing a model's last field results in SQL syntax error on SQLite

2015-04-13 Thread Django
#24424: Removing a model's last field results in SQL syntax error on SQLite
+
 Reporter:  adnam   |Owner:
 Type:  Bug |   Status:  new
Component:  Migrations  |  Version:  1.7
 Severity:  Normal  |   Resolution:
 Keywords:  | Triage Stage:  Accepted
Has patch:  1   |  Needs documentation:  0
  Needs tests:  0   |  Patch needs improvement:  1
Easy pickings:  0   |UI/UX:  0
+

Comment (by MarkusH):

 Hi jwineinger, thanks for taking a shot at this. I've been playing around
 with that idea as well, though I don't see how your solution can solve the
 problem of replacing primary keys, i.e. changing the `OneToOneField` of a
 multi table inheritance into a `AutoField`. Furthermore, it is not about a
 `DeleteModel` operation following a `RemoveField`. That could just remove
 that field, I think.

 The last half-done idea I had was something along those lines:
 1. dropping the old field's constraints (primary key, foreign key, ...)
 2. adding the new field
 3. adding the new field's pk constraint
 4. removing the old field

 Though I have no idea how this is going to work out, if at all.

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


Re: [Django] #24424: Removing a model's last field results in SQL syntax error on SQLite

2015-04-13 Thread Django
#24424: Removing a model's last field results in SQL syntax error on SQLite
+
 Reporter:  adnam   |Owner:
 Type:  Bug |   Status:  new
Component:  Migrations  |  Version:  1.7
 Severity:  Normal  |   Resolution:
 Keywords:  | Triage Stage:  Accepted
Has patch:  1   |  Needs documentation:  0
  Needs tests:  0   |  Patch needs improvement:  1
Easy pickings:  0   |UI/UX:  0
+

Comment (by jwineinger):

 I took a stab at fixing this by adding a simple counter to prevent the
 last field from being removed when deleting a model.
 https://github.com/django/django/pull/4487

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


Re: [Django] #24424: Removing a model's last field results in SQL syntax error on SQLite

2015-03-24 Thread Django
#24424: Removing a model's last field results in SQL syntax error on SQLite
+
 Reporter:  adnam   |Owner:
 Type:  Bug |   Status:  new
Component:  Migrations  |  Version:  1.7
 Severity:  Normal  |   Resolution:
 Keywords:  | Triage Stage:  Accepted
Has patch:  1   |  Needs documentation:  0
  Needs tests:  0   |  Patch needs improvement:  1
Easy pickings:  0   |UI/UX:  0
+
Changes (by adnam):

 * owner:  adnam =>
 * status:  assigned => new


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


Re: [Django] #24424: Removing a model's last field results in SQL syntax error on SQLite

2015-03-24 Thread Django
#24424: Removing a model's last field results in SQL syntax error on SQLite
+
 Reporter:  adnam   |Owner:  adnam
 Type:  Bug |   Status:  assigned
Component:  Migrations  |  Version:  1.7
 Severity:  Normal  |   Resolution:
 Keywords:  | Triage Stage:  Accepted
Has patch:  1   |  Needs documentation:  0
  Needs tests:  0   |  Patch needs improvement:  1
Easy pickings:  0   |UI/UX:  0
+
Changes (by timgraham):

 * needs_better_patch:  0 => 1


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


Re: [Django] #24424: Removing a model's last field results in SQL syntax error on SQLite

2015-03-20 Thread Django
#24424: Removing a model's last field results in SQL syntax error on SQLite
+
 Reporter:  adnam   |Owner:  adnam
 Type:  Bug |   Status:  assigned
Component:  Migrations  |  Version:  1.7
 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
+

Comment (by timgraham):

 Anyone is welcome to review patches and mark the ticket as RFC, but you
 shouldn't review your own patches. Happy to review a doc patch if this
 could be emphasized somewhere around there.

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


Re: [Django] #24424: Removing a model's last field results in SQL syntax error on SQLite

2015-03-20 Thread Django
#24424: Removing a model's last field results in SQL syntax error on SQLite
+
 Reporter:  adnam   |Owner:  adnam
 Type:  Bug |   Status:  assigned
Component:  Migrations  |  Version:  1.7
 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
+

Comment (by adnam):

 Ah, I see. I was following the
 [https://docs.djangoproject.com/en/dev/internals/contributing/triaging-
 tickets/#triage-workflow triage workflow guidelines] which appear to
 suggest that Committers (core developers) can mark a ticket as fixed, and
 Ticket Triagers ("anyone in the Django community") can do everything else.

 [[Image(https://docs.djangoproject.com/en/dev/_images/triage_process.svg)]]

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


Re: [Django] #24424: Removing a model's last field results in SQL syntax error on SQLite

2015-03-20 Thread Django
#24424: Removing a model's last field results in SQL syntax error on SQLite
+
 Reporter:  adnam   |Owner:  adnam
 Type:  Bug |   Status:  assigned
Component:  Migrations  |  Version:  1.7
 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 timgraham):

 * cc: MarkusH (added)
 * stage:  Ready for checkin => Accepted


Comment:

 Please don't mark your own patches RFC (that's done by the person who
 reviews the patch). I didn't understand if Markus's concern is still
 valid, but I'm going to leave the ticket on the review queue so he can
 respond.

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


Re: [Django] #24424: Removing a model's last field results in SQL syntax error on SQLite

2015-03-20 Thread Django
#24424: Removing a model's last field results in SQL syntax error on SQLite
+-
 Reporter:  adnam   |Owner:  adnam
 Type:  Bug |   Status:  assigned
Component:  Migrations  |  Version:  1.7
 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 adnam):

 * needs_docs:  1 => 0
 * needs_better_patch:  1 => 0
 * needs_tests:  1 => 0
 * 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/063.8d624589a42e642057ebe419d47ac74a%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #24424: Removing a model's last field results in SQL syntax error on SQLite

2015-03-07 Thread Django
#24424: Removing a model's last field results in SQL syntax error on SQLite
+
 Reporter:  adnam   |Owner:  adnam
 Type:  Bug |   Status:  assigned
Component:  Migrations  |  Version:  1.7
 Severity:  Normal  |   Resolution:
 Keywords:  | Triage Stage:  Accepted
Has patch:  1   |  Needs documentation:  1
  Needs tests:  1   |  Patch needs improvement:  1
Easy pickings:  0   |UI/UX:  0
+

Comment (by MarkusH):

 Initial models and migration:

 {{{#!python
 # models.py
 from django.db import models

 class Thing(models.Model):
 pass

 class Blob(Thing):
 pass


 # 0001_initial.py
 # -*- coding: utf-8 -*-
 from __future__ import unicode_literals

 from django.db import migrations, models


 class Migration(migrations.Migration):

 dependencies = [
 ]

 operations = [
 migrations.CreateModel(
 name='Thing',
 fields=[
 ('id', models.AutoField(auto_created=True,
 primary_key=True, serialize=False, verbose_name='ID')),
 ],
 ),
 migrations.CreateModel(
 name='Blob',
 fields=[
 ('thing_ptr', models.OneToOneField(auto_created=True,
 parent_link=True, primary_key=True, serialize=False, to='app_a.Thing')),
 ],
 bases=('app_a.thing',),
 ),
 ]
 }}}

 Making `Thing` inherit a new model `Bar`:

 {{{#!python
 # models.py
 from django.db import models

 class Bar(models.Model):
 pass

 class Thing(Bar):
 pass

 class Blob(Thing):
 pass


 # 0002_auto.py
 # -*- coding: utf-8 -*-
 from __future__ import unicode_literals

 from django.db import migrations, models


 class Migration(migrations.Migration):

 dependencies = [
 ('app_a', '0001_initial'),
 ]

 operations = [
 migrations.CreateModel(
 name='Bar',
 fields=[
 ('id', models.AutoField(auto_created=True,
 primary_key=True, serialize=False, verbose_name='ID')),
 ],
 ),
 migrations.RemoveField(
 model_name='thing',
 name='id',
 ),
 migrations.AddField(
 model_name='thing',
 name='bar_ptr',
 field=models.OneToOneField(auto_created=True, default=0,
 parent_link=True, primary_key=True, serialize=False, to='app_a.Bar'),
 preserve_default=False,
 ),
 ]
 }}}


 {{{
 Operations to perform:
   Target specific migration: 0002_auto_20150307_1707, from app_a
 Running migrations:
   Rendering model states... DONE
   Applying app_a.0002_auto_20150307_1707...

 ('CREATE TABLE `app_a_bar` (`id` integer AUTO_INCREMENT NOT NULL PRIMARY
 KEY)', None)
 ('SELECT engine FROM information_schema.tables WHERE table_name = %s',
 ['app_a_bar'])
 ('ALTER TABLE `app_a_thing` DROP COLUMN `id` CASCADE', [])

 Traceback (most recent call last):
   File "/home/markus/Coding/django/django/db/backends/utils.py", line 64,
 in execute
 return self.cursor.execute(sql, params)
   File "/home/markus/Coding/django/django/db/backends/mysql/base.py", line
 125, in execute
 return self.cursor.execute(query, args)
   File "/home/markus/.venvs/django-dev-py3/lib/python3.4/site-
 packages/MySQLdb/cursors.py", line 219, in execute
 self.errorhandler(self, exc, value)
   File "/home/markus/.venvs/django-dev-py3/lib/python3.4/site-
 packages/MySQLdb/connections.py", line 38, in defaulterrorhandler
 raise errorvalue
   File "/home/markus/.venvs/django-dev-py3/lib/python3.4/site-
 packages/MySQLdb/cursors.py", line 205, in execute
 r = self._query(query)
   File "/home/markus/.venvs/django-dev-py3/lib/python3.4/site-
 packages/MySQLdb/cursors.py", line 372, in _query
 rowcount = self._do_query(q)
   File "/home/markus/.venvs/django-dev-py3/lib/python3.4/site-
 packages/MySQLdb/cursors.py", line 336, in _do_query
 db.query(q)
   File "/home/markus/.venvs/django-dev-py3/lib/python3.4/site-
 packages/MySQLdb/connections.py", line 282, in query
 _mysql.connection.query(self, query)
 _mysql_exceptions.OperationalError: (1090, "You can't delete all columns
 with ALTER TABLE; use DROP TABLE instead")

 The above exception was the direct cause of the following exception:

 Traceback (most recent call last):
   File "manage.py", line 10, in 
 execute_from_command_line(sys.argv)
   File "/home/markus/Coding/django/django/core/management/__init__.py",
 line 330, in execute_from_command_line
 utility.execute()
   File "/home/markus/Coding/django/django/core/management/__init__.py",
 line 322, in execute
 self.fetch_command(subcommand).run_from_argv(self.argv)
   File "/home/markus/Coding/django/django/core/management/

Re: [Django] #24424: Removing a model's last field results in SQL syntax error on SQLite

2015-03-07 Thread Django
#24424: Removing a model's last field results in SQL syntax error on SQLite
+
 Reporter:  adnam   |Owner:  adnam
 Type:  Bug |   Status:  assigned
Component:  Migrations  |  Version:  1.7
 Severity:  Normal  |   Resolution:
 Keywords:  | Triage Stage:  Accepted
Has patch:  1   |  Needs documentation:  1
  Needs tests:  1   |  Patch needs improvement:  1
Easy pickings:  0   |UI/UX:  0
+
Changes (by MarkusH):

 * keywords:  sqlite3 migrations =>
 * component:  Database layer (models, ORM) => Migrations
 * needs_tests:  0 => 1


Comment:

 Ok, the failing test on MySQL shows its non-standard behavior again. And
 also shows that the fundamental problem is not just the SQLite backend,
 but also the autodetector that generates models without any fields. This
 is not a valid model and thus shouldn't be generated by the migrations
 (and hence the migration autodetector).

 I don't have a patch for that ready, but I can verify the problem. Fixing
 only the SQLite schema editor won't do it.

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


Re: [Django] #24424: Removing a model's last field results in SQL syntax error on SQLite (was: Migrating an 'empty' model with SQLite gives an SQL syntax error)

2015-03-05 Thread Django
#24424: Removing a model's last field results in SQL syntax error on SQLite
-+-
 Reporter:  adnam|Owner:  adnam
 Type:  Bug  |   Status:  assigned
Component:  Database layer   |  Version:  1.7
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  sqlite3 migrations   | Triage Stage:  Accepted
Has patch:  1|  Needs documentation:  1
  Needs tests:  0|  Patch needs improvement:  1
Easy pickings:  0|UI/UX:  0
-+-
Changes (by MarkusH):

 * needs_better_patch:  0 => 1
 * version:  master => 1.7
 * component:  Migrations => Database layer (models, ORM)
 * needs_docs:  0 => 1


Comment:

 Although this bug manifests using migrations, the underlying problem is
 inside the schema editor for SQLite3. Thus I'm changing the component.

 The bug is already in 1.7 as part of a new feature and would have
 prevented a release back then.

 Pleae see the PR for notes regarding the patch itself.

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