#24630: UUIDField migration
-------------------------------------+-------------------------------------
     Reporter:  lucacorti            |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:  Migrations           |                  Version:  1.8
     Severity:  Normal               |               Resolution:
     Keywords:  uuidfiled            |             Triage Stage:
  migrations                         |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by lucacorti):

 * needs_better_patch:   => 0
 * needs_tests:   => 0
 * needs_docs:   => 0


Old description:

> As per #23932, I added an UUIDField to a model following the
> documentation at https://docs.djangoproject.com/en/1.8/howto/writing-
> migrations/.
>
> When running the migration I get this error:
>
> {{{
>   File "manage.py", line 10, in <module>
>     execute_from_command_line(sys.argv)
>   File "venv/lib/python2.7/site-
> packages/django/core/management/__init__.py", line 338, in
> execute_from_command_line
>     utility.execute()
>   File "venv/lib/python2.7/site-
> packages/django/core/management/__init__.py", line 330, in execute
>     self.fetch_command(subcommand).run_from_argv(self.argv)
>   File "venv/lib/python2.7/site-packages/django/core/management/base.py",
> line 390, in run_from_argv
>     self.execute(*args, **cmd_options)
>   File "venv/lib/python2.7/site-packages/django/core/management/base.py",
> line 441, in execute
>     output = self.handle(*args, **options)
>   File "venv/lib/python2.7/site-
> packages/django/core/management/commands/migrate.py", line 221, in handle
>     executor.migrate(targets, plan, fake=fake, fake_initial=fake_initial)
>   File "venv/lib/python2.7/site-
> packages/django/db/migrations/executor.py", line 110, in migrate
>     self.apply_migration(states[migration], migration, fake=fake,
> fake_initial=fake_initial)
>   File "venv/lib/python2.7/site-
> packages/django/db/migrations/executor.py", line 147, in apply_migration
>     state = migration.apply(state, schema_editor)
>   File "venv/lib/python2.7/site-
> packages/django/db/migrations/migration.py", line 115, in apply
>     operation.database_forwards(self.app_label, schema_editor, old_state,
> project_state)
>   File "venv/lib/python2.7/site-
> packages/django/db/migrations/operations/fields.py", line 201, in
> database_forwards
>     schema_editor.alter_field(from_model, from_field, to_field)
>   File "venv/lib/python2.7/site-
> packages/django/db/backends/base/schema.py", line 484, in alter_field
>     old_db_params, new_db_params, strict)
>   File "venv/lib/python2.7/site-
> packages/django/db/backends/base/schema.py", line 637, in _alter_field
>     params,
>   File "venv/lib/python2.7/site-
> packages/django/db/backends/base/schema.py", line 107, in execute
>     cursor.execute(sql, params)
>   File "venv/lib/python2.7/site-packages/django/db/backends/utils.py",
> line 79, in execute
>     return super(CursorDebugWrapper, self).execute(sql, params)
>   File "venv/lib/python2.7/site-packages/django/db/backends/utils.py",
> line 64, in execute
>     return self.cursor.execute(sql, params)
>   File "venv/lib/python2.7/site-packages/django/db/utils.py", line 97, in
> __exit__
>     six.reraise(dj_exc_type, dj_exc_value, traceback)
>   File "venv/lib/python2.7/site-packages/django/db/backends/utils.py",
> line 64, in execute
>     return self.cursor.execute(sql, params)
> django.db.utils.OperationalError: cannot ALTER TABLE "mytable" because it
> has pending trigger events
> }}}

New description:

 As per #23932, I added an UUIDField to a model following the documentation
 at https://docs.djangoproject.com/en/1.8/howto/writing-migrations/. The
 database is PostgreSQL.

 When running the migration I get this error:

 {{{
   File "manage.py", line 10, in <module>
     execute_from_command_line(sys.argv)
   File "venv/lib/python2.7/site-
 packages/django/core/management/__init__.py", line 338, in
 execute_from_command_line
     utility.execute()
   File "venv/lib/python2.7/site-
 packages/django/core/management/__init__.py", line 330, in execute
     self.fetch_command(subcommand).run_from_argv(self.argv)
   File "venv/lib/python2.7/site-packages/django/core/management/base.py",
 line 390, in run_from_argv
     self.execute(*args, **cmd_options)
   File "venv/lib/python2.7/site-packages/django/core/management/base.py",
 line 441, in execute
     output = self.handle(*args, **options)
   File "venv/lib/python2.7/site-
 packages/django/core/management/commands/migrate.py", line 221, in handle
     executor.migrate(targets, plan, fake=fake, fake_initial=fake_initial)
   File "venv/lib/python2.7/site-
 packages/django/db/migrations/executor.py", line 110, in migrate
     self.apply_migration(states[migration], migration, fake=fake,
 fake_initial=fake_initial)
   File "venv/lib/python2.7/site-
 packages/django/db/migrations/executor.py", line 147, in apply_migration
     state = migration.apply(state, schema_editor)
   File "venv/lib/python2.7/site-
 packages/django/db/migrations/migration.py", line 115, in apply
     operation.database_forwards(self.app_label, schema_editor, old_state,
 project_state)
   File "venv/lib/python2.7/site-
 packages/django/db/migrations/operations/fields.py", line 201, in
 database_forwards
     schema_editor.alter_field(from_model, from_field, to_field)
   File "venv/lib/python2.7/site-
 packages/django/db/backends/base/schema.py", line 484, in alter_field
     old_db_params, new_db_params, strict)
   File "venv/lib/python2.7/site-
 packages/django/db/backends/base/schema.py", line 637, in _alter_field
     params,
   File "venv/lib/python2.7/site-
 packages/django/db/backends/base/schema.py", line 107, in execute
     cursor.execute(sql, params)
   File "venv/lib/python2.7/site-packages/django/db/backends/utils.py",
 line 79, in execute
     return super(CursorDebugWrapper, self).execute(sql, params)
   File "venv/lib/python2.7/site-packages/django/db/backends/utils.py",
 line 64, in execute
     return self.cursor.execute(sql, params)
   File "venv/lib/python2.7/site-packages/django/db/utils.py", line 97, in
 __exit__
     six.reraise(dj_exc_type, dj_exc_value, traceback)
   File "venv/lib/python2.7/site-packages/django/db/backends/utils.py",
 line 64, in execute
     return self.cursor.execute(sql, params)
 django.db.utils.OperationalError: cannot ALTER TABLE "mytable" because it
 has pending trigger events
 }}}

--

--
Ticket URL: <https://code.djangoproject.com/ticket/24630#comment:1>
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/067.b9824c4724c3fecfa93baf8680a8f7c8%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to