evewspace / eve-wspace

Wormhole mapping and corporation management for Eve Online.
Apache License 2.0
86 stars 51 forks source link

Migration error Map.0005_wsystem_static #251

Closed proycon closed 7 years ago

proycon commented 8 years ago

I'm running into a migration error with Map.0005_wsystem_static when updating. First of all it complains about static3 not existing on wsystem, so I simply uncommented that in the migration since it seem to have no effect anyway. But then I get this:


  Applying Map.0005_wsystem_statics...Traceback (most recent call last):
  File "./manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/home/maptool/eve-wspace/env/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 354, in execute_from_command_line
    utility.execute()
  File "/home/maptool/eve-wspace/env/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 346, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/home/maptool/eve-wspace/env/local/lib/python2.7/site-packages/django/core/management/base.py", line 394, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/home/maptool/eve-wspace/env/local/lib/python2.7/site-packages/django/core/management/base.py", line 445, in execute
    output = self.handle(*args, **options)
  File "/home/maptool/eve-wspace/env/local/lib/python2.7/site-packages/django/core/management/commands/migrate.py", line 222, in handle
    executor.migrate(targets, plan, fake=fake, fake_initial=fake_initial)
  File "/home/maptool/eve-wspace/env/local/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 "/home/maptool/eve-wspace/env/local/lib/python2.7/site-packages/django/db/migrations/executor.py", line 148, in apply_migration
    state = migration.apply(state, schema_editor)
  File "/home/maptool/eve-wspace/env/local/lib/python2.7/site-packages/django/db/backends/base/schema.py", line 91, in __exit__
    self.execute(sql)
  File "/home/maptool/eve-wspace/env/local/lib/python2.7/site-packages/django/db/backends/base/schema.py", line 111, in execute
    cursor.execute(sql, params)
  File "/home/maptool/eve-wspace/env/local/lib/python2.7/site-packages/django/db/backends/utils.py", line 79, in execute
    return super(CursorDebugWrapper, self).execute(sql, params)
  File "/home/maptool/eve-wspace/env/local/lib/python2.7/site-packages/django/db/backends/utils.py", line 64, in execute
    return self.cursor.execute(sql, params)
  File "/home/maptool/eve-wspace/env/local/lib/python2.7/site-packages/django/db/utils.py", line 98, in __exit__
    six.reraise(dj_exc_type, dj_exc_value, traceback)
  File "/home/maptool/eve-wspace/env/local/lib/python2.7/site-packages/django/db/backends/utils.py", line 64, in execute
    return self.cursor.execute(sql, params)
  File "/home/maptool/eve-wspace/env/local/lib/python2.7/site-packages/django/db/backends/mysql/base.py", line 124, in execute
    return self.cursor.execute(query, args)
  File "/home/maptool/eve-wspace/env/local/lib/python2.7/site-packages/MySQLdb/cursors.py", line 205, in execute
    self.errorhandler(self, exc, value)
  File "/home/maptool/eve-wspace/env/local/lib/python2.7/site-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler
    raise errorclass, errorvalue
django.db.utils.IntegrityError: (1215, 'Cannot add foreign key constraint')

Has anybody encountered this too?

proycon commented 8 years ago

OK, this was a very messy upgrade but I managed to fix it in the end. It was caused by all my tables using the MyISAM engine, but the new table was InnoDB. First make a backup of your database (before running any migrations), then convert all evewspace tables to InnoDB (See http://stackoverflow.com/questions/3856435/how-to-convert-all-tables-from-myisam-into-innodb), and only then run the migration.

After that, my statics table was still empty and I had to run ./manage.py loaddata ./Map/fixtures/SystemStatic.json ..

raphendyr commented 7 years ago

fixed by 5f7eae8 . was broken by PR #229