First time here? Check out the FAQ!
1

manage.py migrate fatal error

  • retag add tags

os : centos 6.3 Database mysql

askbot:0161_add_field__user_languages FATAL ERROR - The following SQL query failed: ALTER TABLE auth_user ADD COLUMN languages varchar(128) NOT NULL DEFAULT 'en'; The error was: (1060, "Duplicate column name 'languages'") ! Error found during real run of migration! Aborting.

coldsystem's avatar
31
coldsystem
asked 2013-02-01 07:59:31 -0500
edit flag offensive 0 remove flag close merge delete

Comments

I found many errors when migrating on Heroku. Unfortunately I was not able to solve them (yet). But the website runs OK even with these...

oscarfh's avatar oscarfh (2013-02-01 09:10:46 -0500) edit
add a comment see more comments

2 Answers

1

Hi

This is common if you do syncdb first and then the migrations, askbot uses add_to_class to add more fields to the auth_user table when syncdb runs the first time it will add them and then the migration will try to add them again to solve it you can do the following command:

python manage.py migrate askbot 0160
python manage.py migrate askbot 0161 --fake

The first command will migrate it up to the last migration and the last one to "fake" the new migration, this "fake" parameter will add the migration into the south history but does not applies actual changes into the database, therefore you won't see any error message.

Fitoria's avatar
1.1k
Fitoria
answered 2013-02-01 11:00:18 -0500
edit flag offensive 0 remove flag delete link

Comments

That is interesting. So everything should be working as expected even with the errors? And I should run the "fake" to avoid the error messages, correct?

oscarfh's avatar oscarfh (2013-02-01 13:13:23 -0500) edit
1

you should run --fake because if the next askbot update comes and has migrations you won't be able to pass to the 0162 without faking 0161

Fitoria's avatar Fitoria (2013-02-01 13:37:37 -0500) edit
add a comment see more comments
0

Now . downloaded askbot 0.7.48

copied database sqlite backup from 0.7.43

i ran :

python manage.py syncdb

python manage.py migrate askbot 0160

python runserver host:port

Now i have this on the browser page :

DatabaseError at /
    database disk image is malformed
    Request Method: GET
    Request URL:    http://5.39.79.145:8081/
    Django Version: 1.4.3
    Exception Type: DatabaseError
    Exception Value:    
    database disk image is malformed
    Exception Location: /usr/lib/python2.6/site-packages/Django-1.4.3-py2.6.egg/django/db/backends/sqlite3/base.py in execute, line 344
    Python Executable:  /usr/bin/python
    Python Version: 2.6.6
    Python Path:    
    ['/root/forum',
     '/usr/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg',
     '/usr/lib/python2.6/site-packages/pip-1.2.1-py2.6.egg',
     '/home/SITE-PROJECT',
     '/usr/lib/python2.6/site-packages/South-0.7.6-py2.6.egg',
     '/usr/lib/python2.6/site-packages/Coffin-0.3.7-py2.6.egg',
     '/usr/lib/python2.6/site-packages/lamson-1.1-py2.6.eg
coldsystem's avatar
31
coldsystem
answered 2013-02-01 16:57:31 -0500
edit flag offensive 0 remove flag delete link

Comments

file corruption on sqlite3? try to access it with the sqlite3 command and check this out: http://techblog.dorogin.com/2011/05/sqliteexception-database-disk-image-is.html

Fitoria's avatar Fitoria (2013-02-01 20:43:40 -0500) edit
add a comment see more comments