[Django] #23565: Unexpected Migration Crash

12 views
Skip to first unread message

Django

unread,
Sep 28, 2014, 11:04:11 PM9/28/14
to django-...@googlegroups.com
#23565: Unexpected Migration Crash
-------------------------------+------------------------------
Reporter: narrowfail | Owner: nobody
Type: Uncategorized | Status: new
Component: Migrations | Version: 1.7
Severity: Normal | Keywords: migration, crash
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------------
Here is what happened:


{{{
Operations to perform:
Apply all migrations: history
Running migrations:
Applying history.0002_employeehitmodel...Traceback (most recent call
last):
File "./manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/usr/local/lib/python2.7/dist-
packages/django/core/management/__init__.py", line 385, in
execute_from_command_line
utility.execute()
File "/usr/local/lib/python2.7/dist-
packages/django/core/management/__init__.py", line 377, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/local/lib/python2.7/dist-
packages/django/core/management/base.py", line 288, in run_from_argv
self.execute(*args, **options.__dict__)
File "/usr/local/lib/python2.7/dist-
packages/django/core/management/base.py", line 338, in execute
output = self.handle(*args, **options)
File "/usr/local/lib/python2.7/dist-
packages/django/core/management/commands/migrate.py", line 160, in handle
executor.migrate(targets, plan, fake=options.get("fake", False))
File "/usr/local/lib/python2.7/dist-
packages/django/db/migrations/executor.py", line 63, in migrate
self.apply_migration(migration, fake=fake)
File "/usr/local/lib/python2.7/dist-
packages/django/db/migrations/executor.py", line 97, in apply_migration
migration.apply(project_state, schema_editor)
File "/usr/local/lib/python2.7/dist-
packages/django/db/backends/schema.py", line 82, in __exit__
self.execute(sql)
File "/usr/local/lib/python2.7/dist-
packages/django/db/backends/schema.py", line 98, in execute
cursor.execute(sql, params)
File "/usr/local/lib/python2.7/dist-
packages/django/db/backends/utils.py", line 65, in execute
return self.cursor.execute(sql, params)
File "/usr/local/lib/python2.7/dist-
packages/django/db/backends/mysql/base.py", line 128, in execute
return self.cursor.execute(query, args)
File "/usr/lib/python2.7/dist-packages/MySQLdb/cursors.py", line 174, in
execute
self.errorhandler(self, exc, value)
File "/usr/lib/python2.7/dist-packages/MySQLdb/connections.py", line 36,
in defaulterrorhandler
raise errorclass, errorvalue
django.db.utils.OperationalError: (1005, "Can't create table 'munibase
.#sql-3c75_11a6a' (errno: 150)")
digitalice@munibase:/srv/bondfaces/bondfaces$ ./manage.py migrate history
Operations to perform:
Apply all migrations: history
Running migrations:
Applying history.0002_employeehitmodel...Traceback (most recent call
last):
File "./manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/usr/local/lib/python2.7/dist-
packages/django/core/management/__init__.py", line 385, in
execute_from_command_line
utility.execute()
File "/usr/local/lib/python2.7/dist-
packages/django/core/management/__init__.py", line 377, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/local/lib/python2.7/dist-
packages/django/core/management/base.py", line 288, in run_from_argv
self.execute(*args, **options.__dict__)
File "/usr/local/lib/python2.7/dist-
packages/django/core/management/base.py", line 338, in execute
output = self.handle(*args, **options)
File "/usr/local/lib/python2.7/dist-
packages/django/core/management/commands/migrate.py", line 160, in handle
executor.migrate(targets, plan, fake=options.get("fake", False))
File "/usr/local/lib/python2.7/dist-
packages/django/db/migrations/executor.py", line 63, in migrate
self.apply_migration(migration, fake=fake)
File "/usr/local/lib/python2.7/dist-
packages/django/db/migrations/executor.py", line 97, in apply_migration
migration.apply(project_state, schema_editor)
File "/usr/local/lib/python2.7/dist-
packages/django/db/migrations/migration.py", line 107, in apply
operation.database_forwards(self.app_label, schema_editor,
project_state, new_state)
File "/usr/local/lib/python2.7/dist-
packages/django/db/migrations/operations/models.py", line 36, in
database_forwards
schema_editor.create_model(model)
File "/usr/local/lib/python2.7/dist-
packages/django/db/backends/schema.py", line 270, in create_model
self.execute(sql, params)
File "/usr/local/lib/python2.7/dist-
packages/django/db/backends/schema.py", line 98, in execute
cursor.execute(sql, params)
File "/usr/local/lib/python2.7/dist-
packages/django/db/backends/utils.py", line 65, in execute
return self.cursor.execute(sql, params)
File "/usr/local/lib/python2.7/dist-packages/django/db/utils.py", line
94, in __exit__
six.reraise(dj_exc_type, dj_exc_value, traceback)
File "/usr/local/lib/python2.7/dist-
packages/django/db/backends/utils.py", line 65, in execute
return self.cursor.execute(sql, params)
File "/usr/local/lib/python2.7/dist-
packages/django/db/backends/mysql/base.py", line 128, in execute
return self.cursor.execute(query, args)
File "/usr/lib/python2.7/dist-packages/MySQLdb/cursors.py", line 174, in
execute
self.errorhandler(self, exc, value)
File "/usr/lib/python2.7/dist-packages/MySQLdb/connections.py", line 36,
in defaulterrorhandler
raise errorclass, errorvalue
django.db.utils.OperationalError: (1050, "Table 'history_employeehitmodel'
already exists")
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/23565>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Sep 28, 2014, 11:08:48 PM9/28/14
to django-...@googlegroups.com
#23565: Unexpected Migration Crash
----------------------------------+--------------------------------------
Reporter: narrowfail | Owner: nobody
Type: Uncategorized | Status: closed
Component: Migrations | Version: 1.7
Severity: Normal | Resolution: invalid

Keywords: migration, crash | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
----------------------------------+--------------------------------------
Changes (by narrowfail):

* status: new => closed
* needs_docs: => 0
* resolution: => invalid
* needs_tests: => 0
* needs_better_patch: => 0


--
Ticket URL: <https://code.djangoproject.com/ticket/23565#comment:1>

Django

unread,
Oct 2, 2014, 10:09:26 PM10/2/14
to django-...@googlegroups.com
#23565: Unexpected Migration Crash
----------------------------------+--------------------------------------
Reporter: narrowfail | Owner: nobody
Type: Uncategorized | Status: closed
Component: Migrations | Version: 1.7
Severity: Normal | Resolution: invalid

Keywords: migration, crash | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
----------------------------------+--------------------------------------

Comment (by gregplaysguitar):

Curious, why was this closed? I've just struck the same thing trying to
add a manytomany field to an existing model.

--
Ticket URL: <https://code.djangoproject.com/ticket/23565#comment:2>

Django

unread,
Oct 3, 2014, 7:53:02 AM10/3/14
to django-...@googlegroups.com
#23565: Unexpected Migration Crash
----------------------------------+--------------------------------------
Reporter: narrowfail | Owner: nobody
Type: Uncategorized | Status: closed
Component: Migrations | Version: 1.7
Severity: Normal | Resolution: invalid

Keywords: migration, crash | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
----------------------------------+--------------------------------------

Comment (by timgraham):

Looks to me like the issue might have been what's described in
[https://docs.djangoproject.com/en/1.7/topics/migrations/#upgrading-from-
south Upgrading from South]:

The only complication is if you have a circular dependency loop of
foreign keys; in this case, makemigrations might make more than one
initial migration, and you’ll need to mark them all as applied using:

`python manage.py migrate --fake yourappnamehere`

--
Ticket URL: <https://code.djangoproject.com/ticket/23565#comment:3>

Django

unread,
Jul 7, 2016, 6:52:51 PM7/7/16
to django-...@googlegroups.com
#23565: Unexpected Migration Crash
----------------------------------+--------------------------------------
Reporter: narrowfail | Owner: nobody
Type: Uncategorized | Status: closed
Component: Migrations | Version: 1.7
Severity: Normal | Resolution: invalid

Keywords: migration, crash | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
----------------------------------+--------------------------------------
Description changed by narrowfail:

Old description:

> Here is what happened:
>

New description:

Here is what happened:

django.db.utils.OperationalError: (1005, "Can't create table 'website
.#sql-3c75_11a6a' (errno: 150)")
digitalice@website:/srv/site/site$ ./manage.py migrate history

--

--
Ticket URL: <https://code.djangoproject.com/ticket/23565#comment:4>

Reply all
Reply to author
Forward
0 new messages