Ask Your Question
2

Askbot installation fails in migration due to 0 values in AutoField

asked 2013-10-13 21:57:24 -0500

knmnyn's avatar

Hi all, hope you can help with what seems to be a small problem.

I'm trying to install askbot on a new server and have run into problems with the migration chain for target 'askbot' during setup.

Any ideas? I've listed the libraries that pip install askbot installed for me at the end of the post.

[root@orbital askbot-django]# python manage.py migrate askbot
/usr/lib/python2.6/site-packages/django/utils/hashcompat.py:9: DeprecationWarning: django.utils.hashcompat is deprecated; use hashlib instead
  DeprecationWarning)
/usr/lib/python2.6/site-packages/django/core/management/__init__.py:465: DeprecationWarning: The 'execute_manager' function is deprecated, you likely need to update your 'manage.py'; please see the Django 1.4 release notes (https://docs.djangoproject.com/en/dev/releases/1.4/).
  DeprecationWarning)
/usr/lib/python2.6/site-packages/django/core/management/__init__.py:409: DeprecationWarning: The 'setup_environ' function is deprecated, you likely need to update your 'manage.py'; please see the Django 1.4 release notes (https://docs.djangoproject.com/en/dev/releases/1.4/).
  DeprecationWarning)
/usr/lib/python2.6/site-packages/django/conf/urls/defaults.py:3: DeprecationWarning: django.conf.urls.defaults is deprecated; use django.conf.urls instead
  DeprecationWarning)
WARNING!!! You are using a 'locmem' (local memory) caching backend,
which is OK for a low volume site running on a single-process server.
For a multi-process configuration it is neccessary to have a production
cache system, such as redis or memcached.

With local memory caching and multi-process setup you might intermittently
see outdated content on your site.

Running migrations for askbot:
 - Migrating forwards to 0170_auto__add_field_group_read_only.
 > askbot:0055_auto__chg_field_question_thread
 - Migration 'askbot:0055_auto__chg_field_question_thread' is marked for no-dry-run.
 ! Error found during real run of migration! Aborting.

 ! Since you have a database that does not support running
 ! schema-altering statements in transactions, we have had 
 ! to leave it in an interim state between migrations.

! You *might* be able to recover with:   (migration cannot be dry-run; cannot discover commands)
 ! The South developers regret this has happened, and would
 ! like to gently persuade you to consider a slightly
 ! easier-to-deal-with DBMS (one that supports DDL transactions)
 ! NOTE: The error which caused the migration to fail is further up.
Error in migration: askbot:0055_auto__chg_field_question_thread
ValueError: The database backend does not accept 0 as a value for AutoField.

Here are the libraries according to pip list:

AddOns (0.6)
akismet (0.2.0)
amqp (1.0.13)
anyjson (0.3.3)
askbot (0.7.49)
Babel (0.9.4)
Beaker (1.3.1)
beautifulsoup4 (4.3.2)
billiard (2.7.3.34)
BytecodeAssembler (0.5.1)
cas (0.15)
celery (3.0.24)
chardet (2.1.1)
Cheetah (2.4.1)
Coffin (0.3.8)
decorator (3.0.1)
DecoratorTools (1.7)
distribute (0.6.10)
Django (1.5)
django-appconf (0.6)
django-celery (3.0.11)
django-compressor (1.2)
django-countries (1.0.5)
django-followit (0.0.3)
django-keyedcache (1.4-6)
django-kombu (0.9.4)
django-picklefield (0.3.0)
django-recaptcha-works (0.3.4)
django-robots (0.9.2)
django-threaded-multihost (1.4-1)
django-tinymce (1.5.1b2)
ethtool (0 ...
(more)
edit retag flag offensive close merge delete

Comments

What database backend are you using?

Fitoria's avatar Fitoria  ( 2013-10-16 07:47:39 -0500 )edit

Hi Fitoria, thanks for the comment. This was using the MySQL database. Hope that helps!

knmnyn's avatar knmnyn  ( 2013-10-21 10:40:14 -0500 )edit

This appears to be specific to MySQL, which version of MySQL and the which MySQL storage backend are you using?

Evgeny's avatar Evgeny  ( 2013-10-29 14:44:21 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted
1

answered 2014-03-31 09:07:30 -0500

tmonteil's avatar

As explained in question #11851 i had the same problem. Four migration scripts set 0 as a default value for ForeignKey, which seems not accepted. Instead, you can set None as the default value. The following changes in the migrations script should fix this problem:

  • go to the askbot/migrations directory
  • type:

    sed -i.old 's|\(ForeignKey.*\)default=0|\1default=None|g' 0055_*.py 0080_*.py 0093_*.py 0099_*.py

edit flag offensive delete link more

Comments

Roger that! Your solution worked for me, thanks.

Flyte's avatar Flyte  ( 2014-05-28 11:16:03 -0500 )edit
0

answered 2013-10-29 14:51:09 -0500

Evgeny's avatar

updated 2013-10-29 14:52:44 -0500

Could you try skipping this migration:

python manage.py migrate askbot 0054 #migrate normally up to the 54th migration
python manage.py migrate askbot 0055 --fake #skip this migration
python manage.py migrate askbot #finish migrating askbot
python manage.py migrate #finish migrating anything else (if necessary)

Does that work for you? If so, we could add a workaround to that migration to make it pass on your database engine.

Note, however - we mostly target supporting Postgresql. Consider using Postgres instead of MySQL.

edit flag offensive delete link more

Comments

This solution didn't work for me. I got Error in migration: askbot:0080_transplant_favquestions_2 ValueError: The database backend does not accept 0 as a value for AutoField.

Nikhil's avatar Nikhil  ( 2013-11-21 07:57:46 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2013-10-13 21:57:24 -0500

Seen: 2,903 times

Last updated: Mar 31 '14