First time here? Check out the FAQ!
1

manage.py migrate fatal error
 

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.

To enter a block of code:

  • enter empty line after your previous text
  • paste or type the code
  • select the code and press the button above
Preview: (hide)
coldsystem's avatar
31
coldsystem
asked 12 years ago

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 (12 years ago)
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.

To enter a block of code:

  • enter empty line after your previous text
  • paste or type the code
  • select the code and press the button above
Preview: (hide)
Fitoria's avatar
1.1k
Fitoria
answered 12 years ago
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 (12 years ago)
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 (12 years ago)
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

To enter a block of code:

  • enter empty line after your previous text
  • paste or type the code
  • select the code and press the button above
Preview: (hide)
coldsystem's avatar
31
coldsystem
answered 12 years ago
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 (12 years ago)
see more comments