Migration fails in django.contrib.contenttypes with KeyError: 'db' #355

Closed
ssteinerx opened this Issue Feb 20, 2010 · 7 comments

Projects

None yet

4 participants

@ssteinerx

Trying to run the example app, django-cms-2.0 trunk, django 1.2 trunk, south 'stableish' (same problem with south 0.6.2).

python manage.py migrate

Running migrations for cms:

  • Migrating forwards to 0023_plugin_table_naming_function_changed. > cms: 0001_initial > cms: 0002_auto_start > cms: 0003_remove_placeholder > cms: 0004_textobjects > cms: 0005_mptt_added_to_plugins Traceback (most recent call last): File "manage.py", line 13, in execute_manager(settings) File "/Users/ssteiner/.virtualenvs/django-cms-1/lib/python2.6/site-packages/django/core/management/init.py", line 438, in execute_manager utility.execute() File "/Users/ssteiner/.virtualenvs/django-cms-1/lib/python2.6/site-packages/django/core/management/init.py", line 379, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/Users/ssteiner/.virtualenvs/django-cms-1/lib/python2.6/site-packages/django/core/management/base.py", line 195, in run_from_argv self.execute(args, *options.dict) File "/Users/ssteiner/.virtualenvs/django-cms-1/lib/python2.6/site-packages/django/core/management/base.py", line 222, in execute output = self.handle(args, *options) File "/Users/ssteiner/.virtualenvs/django-cms-1/lib/python2.6/site-packages/south/management/commands/migrate.py", line 91, in handle skip = skip, File "/Users/ssteiner/.virtualenvs/django-cms-1/lib/python2.6/site-packages/south/migration.py", line 586, in migrate_app db.send_pending_create_signals() File "/Users/ssteiner/.virtualenvs/django-cms-1/lib/python2.6/site-packages/south/db/generic.py", line 678, in send_pending_create_signals self.really_send_create_signal(app_label, list(set(model_names))) File "/Users/ssteiner/.virtualenvs/django-cms-1/lib/python2.6/site-packages/south/db/generic.py", line 718, in really_send_create_signal verbosity=verbosity, interactive=interactive) File "/Users/ssteiner/.virtualenvs/django-cms-1/lib/python2.6/site-packages/django/dispatch/dispatcher.py", line 166, in send response = receiver(signal=self, sender=sender, **named) File "/Users/ssteiner/.virtualenvs/django-cms-1/lib/python2.6/site-packages/django/contrib/contenttypes/management.py", line 10, in update_contenttypes db = kwargs['db'] KeyError: 'db'
@ssteinerx

NOTE: this is with South stableish, 0.7pre error is different:

python manage.py migrate
Running migrations for cms:

  • Migrating forwards to 0023_plugin_table_naming_function_changed. > cms:0001_initial > cms:0002_auto_start > cms:0003_remove_placeholder > cms:0004_textobjects > cms:0005_mptt_added_to_plugins Traceback (most recent call last): File "manage.py", line 13, in execute_manager(settings) File "/Users/ssteiner/.virtualenvs/django-cms-1/lib/python2.6/site-packages/django/core/management/init.py", line 438, in execute_manager utility.execute() File "/Users/ssteiner/.virtualenvs/django-cms-1/lib/python2.6/site-packages/django/core/management/init.py", line 379, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/Users/ssteiner/.virtualenvs/django-cms-1/lib/python2.6/site-packages/django/core/management/base.py", line 195, in run_from_argv self.execute(args, *options.dict) File "/Users/ssteiner/.virtualenvs/django-cms-1/lib/python2.6/site-packages/django/core/management/base.py", line 222, in execute output = self.handle(args, *options) File "/Users/ssteiner/.virtualenvs/django-cms-1/lib/python2.6/site-packages/south/management/commands/migrate.py", line 102, in handle delete_ghosts = delete_ghosts, File "/Users/ssteiner/.virtualenvs/django-cms-1/lib/python2.6/site-packages/south/migration/init.py", line 177, in migrate_app success = migrator.migrate_many(target, workplan) File "/Users/ssteiner/.virtualenvs/django-cms-1/lib/python2.6/site-packages/south/migration/migrators.py", line 207, in migrate_many result = migrator.class.migrate_many(migrator, target, migrations) File "/Users/ssteiner/.virtualenvs/django-cms-1/lib/python2.6/site-packages/south/migration/migrators.py", line 272, in migrate_many result = self.migrate(migration) File "/Users/ssteiner/.virtualenvs/django-cms-1/lib/python2.6/site-packages/south/migration/migrators.py", line 119, in migrate result = self.run(migration) File "/Users/ssteiner/.virtualenvs/django-cms-1/lib/python2.6/site-packages/south/migration/migrators.py", line 93, in run return self.run_migration(migration) File "/Users/ssteiner/.virtualenvs/django-cms-1/lib/python2.6/site-packages/south/migration/migrators.py", line 75, in run_migration migration_function() File "/Users/ssteiner/.virtualenvs/django-cms-1/lib/python2.6/site-packages/south/migration/migrators.py", line 54, in return (lambda: direction(orm)) File "/Users/ssteiner/Dropbox/work/django-applications/django-cms-2.0/cms/migrations/0005_mptt_added_to_plugins.py", line 10, in forwards db.add_column('cms_cmsplugin', 'tree_id', models.PositiveIntegerField(db_index=True, editable=False)) File "/Users/ssteiner/.virtualenvs/django-cms-1/lib/python2.6/site-packages/south/db/sqlite3.py", line 29, in add_column raise ValueError("You cannot add a null=False column without a default value.") ValueError: You cannot add a null=False column without a default value.
@DrMeers

This is not a django-cms issue -- just a south/django version combination. It should be fixed in south trunk.

@ssteinerx

I think it's more of an sqlite issue. Sqlite doesn't like NOT NULL without a default value (the error under .7). The 0.6.2 issue was definitely a south/django 1.2 issue. So, the actual problem is that the migrations, as written, will not work with sqlite for whatever that's worth.

@DrMeers

Yes, I was referring to the actual issue reported, not the completely different one added in the comments.

I'm not sure if we've given up on sqlite as far as migrations go (Patrick?); it is fraught with difficulties. Best to get a real database, or turn off south if you really need sqlite.

@digi604
Divio AG member

I would propose that we "reset" all migrations for 2.1... that everybody makes: manage.py migrate cms 0001 --fake before updating to 2.1 and we would start over with fresh migrations... or somebody fixes those sqllite migrations... or a big fat disclaimer: do not use south with sqllite

@ojii

this issue will be closed once the rebase branch of south hits a release. until then use syncdb --all and migrate --fake.

@digi604
Divio AG member

closed for #1434 is merged

@digi604 digi604 closed this Apr 8, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment