Forums

Add South to Existing App

I'm trying to install South to an existing app called Blog so that I can modify the model structure. I've based my actions on documentation here: http://south.readthedocs.org/en/latest/tutorial/part1.html and here: http://south.readthedocs.org/en/latest/convertinganapp.html#converting-an-app

I've installed the South app, and it has been working correctly up to a certain point when it tries to create tables that already exist.

These initial steps seem to work fine

18:50 ~/steps $ python manage.py schemamigration blog --initial
Creating migrations directory at '/home/awwester/steps/../steps/blog/migrations'... Creating init.py in '/home/awwester/steps/../steps/blog/migrations'... + Added model blog.Blog + Added model blog.Category Created 0001_initial.py. You can now apply this migration with: ./manage.py migrate blog

18:50 ~/steps $ python manage.py schemamigration blog --auto
+ Added field active on blog.Blog Created 0002_auto__add_field_blog_active.py. You can now apply this migration with: ./manage.py migrate blog

Here's where it fails

Running migrations for blog: 19:26 ~/steps $ python manage.py migrate blog - Migrating forwards to 0004_auto__add_field_blog_active.

blog:0001_initial FATAL ERROR - The following SQL query failed: CREATE TABLE "blog_blog" ("id" integer NOT NULL PRIMARY KEY, "title" varchar(30) NOT NULL UNIQUE, "headline" v archar(100) NOT NULL, "body" text NOT NULL, "post_date" date NOT NULL, "category_id" integer NOT NULL, "views" integer NULL, "image" varchar(100) NOT NULL)

...

django.db.utils.DatabaseError: table "blog_blog" already exists

Any ideas how I can get the new field added into the table? Adam

my problem was not using --fake. I should have been googling how to add to an existing model, not how to add to an existing app.

http://stackoverflow.com/questions/3090648/django-south-table-already-exists

Glad it's working now, thanks for posting the solution!