django - Another South "table does not exist" issue: none of the previously posted solutions working -
i trying make app using django , using south handle migrations. after define app's models.py, include south in "installed_apps" in settings.py. sync database. when validate database, 0 errors. execute following commands on command prompt:
c:\users\abagaria\desktop\integrateid\website>python manage.py schemamigration w ebsite.integrate --initial creating migrations directory @ 'c:\users\abagaria\desktop\integrateid\website\ website\integrate\migrations'... creating __init__.py in 'c:\users\abagaria\desktop\integrateid\website\website\i ntegrate\migrations'... + added model integrate.publisher + added model integrate.author + added model integrate.book + added m2m table authors on integrate.book created 0001_initial.py. can apply migration with: ./manage.py migr ate integrate c:\users\abagaria\desktop\integrateid\website>python manage.py migrate website.i ntegrate running migrations integrate: - migrating forwards 0001_initial. > integrate:0001_initial fatal error - following sql query failed: create table "integrate_publisher" ("id" integer not null primary key, "name" varchar(30) not null, "address" varc har(50) not null, "city" varchar(60) not null, "state_province" varchar(30) not null, "country" varchar(50) not null, "website" varchar(200) not null) error was: table "integrate_publisher" exists ! error found during real run of migration! aborting. ! since have database not support running ! schema-altering statements in transactions, have had ! leave in interim state between migrations. ! *might* able recover with: = drop table "integrate_publisher"; [] = drop table "integrate_author"; [] = drop table "integrate_book"; [] = drop table "integrate_book_authors"; [] ! south developers regret has happened, , ! gently persuade consider ! easier-to-deal-with dbms (one supports ddl transactions) ! note: error caused migration fail further up. error in migration: integrate:0001_initial databaseerror: table "integrate_publisher" exists
i know lot of people have faced similar problems while using south, in case, make mistake of executing "--initial" command more once-- thereby causing south make more 1 __initial file in migrations directory. in case, south thinks table exists when make first migration!
i have tried:
- deleting migrations directory
- deleting ghost migrations
- making "fake" migration
- and running actual migration
can please tell me how fix problem , can start defining models again?
if have tables in database, not use --initial, instead need convert_to_south command. delete directory "migrations", tables database , run following commands:
python manage.py syncdb python manage.py convert_to_south appname python manage.py syncdb --migrate
Comments
Post a Comment