1

Migration errors using latest git branch

I am trying to migrate askbot to the latest version available in devel branch and running : python manage.py migrate i got the following error:

    Traceback (most recent call last):
  File "manage.py", line 11, in <module>
    execute_manager(settings)
  File "/var/www/intreaba.ubuntu.ro/lib/python2.5/site-packages/django/core/management/__init__.py", line 362, in execute_manager
    utility.execute()
  File "/var/www/intreaba.ubuntu.ro/lib/python2.5/site-packages/django/core/management/__init__.py", line 303, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/var/www/intreaba.ubuntu.ro/lib/python2.5/site-packages/django/core/management/base.py", line 195, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/var/www/intreaba.ubuntu.ro/lib/python2.5/site-packages/django/core/management/base.py", line 222, in execute
    output = self.handle(*args, **options)
  File "/var/www/intreaba.ubuntu.ro/lib/python2.5/site-packages/south/management/commands/migrate.py", line 105, in handle
    ignore_ghosts = ignore_ghosts,
  File "/var/www/intreaba.ubuntu.ro/lib/python2.5/site-packages/south/migration/__init__.py", line 171, in migrate_app
    applied = check_migration_histories(applied, delete_ghosts, ignore_ghosts)
  File "/var/www/intreaba.ubuntu.ro/lib/python2.5/site-packages/south/migration/__init__.py", line 74, in check_migration_histories
    m = h.get_migration()
  File "/var/www/intreaba.ubuntu.ro/lib/python2.5/site-packages/south/models.py", line 34, in get_migration
    return self.get_migrations().migration(self.migration)
  File "/var/www/intreaba.ubuntu.ro/lib/python2.5/site-packages/south/models.py", line 31, in get_migrations
    return Migrations(self.app_name)
  File "/var/www/intreaba.ubuntu.ro/lib/python2.5/site-packages/south/migration/base.py", line 60, in __call__
    self.instances[app_label] = super(MigrationsMetaclass, self).__call__(app_label_to_app_module(app_label), **kwds)
  File "/var/www/intreaba.ubuntu.ro/lib/python2.5/site-packages/south/migration/base.py", line 88, in __init__
    self.set_application(application, force_creation, verbose_creation)
  File "/var/www/intreaba.ubuntu.ro/lib/python2.5/site-packages/south/migration/base.py", line 160, in set_application
    raise exceptions.NoMigrations(application)
south.exceptions.NoMigrations: Application '<module 'askbot.deps.django_authopenid' from '/var/www/intreaba.ubuntu.ro/lib/python2.5/site-packages/askbot/deps/django_authopenid/__init__.pyc'>' has no migrations.

Also if I drop all tables and try to do a new install following the documentation, I got the following error:

$ python manage.py migrate django_authopenid
The app 'django_authopenid' does not appear to use migrations. ./manage.py migrate [appname] [migrationname|zero] [--all] [--list] [--skip] [--merge] [--no-initial-data] [--fake] [--db-dry-run] [--database=dbalias]

Adi Roiban's avatar
67
Adi Roiban
updated 2011-03-24 06:41:05 -0500, asked 2011-03-24 06:36:17 -0500
edit flag offensive 0 remove flag close merge delete

Comments

what happens if you do a "migrate --list" It should list the migrations without doing them. I think in general, you should just issue a "migrate" command, without specifying the app.
Benoit's avatar Benoit (2011-03-24 08:39:15 -0500) edit
Thanks for you comment! It looks like „django_authopenid” is listed and has 5 revisions. I am just following the documentation and information available at http://askbot.org/en/question/310/how-do-you-manage-askbot-and-upgrades.
Adi Roiban's avatar Adi Roiban (2011-03-24 09:02:31 -0500) edit
If your site has no useful data - I would just start the database setup over. Drop the database, then syncdb and migrate.
Evgeny's avatar Evgeny (2011-03-24 13:54:42 -0500) edit
add a comment see more comments

1 Answer

0

Adi, have you done python manage.py flush some time before the upgrade?

If so - then the migration history was erased from the database and the only way to recover is to "fake"-migrate the apps to the pre-upgrade stage. And then run the actual upgrade the command is:

python manage.py migrate <the_app> <schema_version> --fake

But you need to know to what schema version to go, for example:

python manage.py migrate django_authopenid 0005 --fake

Secondly - might have you accidentally removed app django_authopenid from the list of installed apps?

Evgeny's avatar
13.2k
Evgeny
answered 2011-03-24 13:52:59 -0500
edit flag offensive 0 remove flag delete link

Comments

Thanks for the answer. The django_authopenid was not removed... not sure what was the problem. It was still in testing so I just done a clean reinstall. I have also tested a new update and this time it was ok (but i think that no DB migration were required).
Adi Roiban's avatar Adi Roiban (2011-04-04 04:45:48 -0500) edit
add a comment see more comments