views:

60

answers:

1

Hello I have an already existing app with alot of database entries.

class Foo(models.Model):
    value = models.TextField(u"Value")

For this I do this:

python manage.py schemamigration myapp --initial
python  manage.py migrate myapp

I change the model to such:

class Foo(models.Model):
    value = models.TextField(u"Value")
    live = models.BooleanField(u"Live", default=False)
    creation_time = models.DateTimeField("Creation Time", auto_now_add=True, null=True, blank=True)

and migrate:

python manage.py schemamigration myapp --auto
python  manage.py migrate myapp

I get django.db.utils.DatabaseError: relation "myapp.foo" already exists error.

I have already checked this question but --fake doesn't seem to be supported via South anymore.

+1  A: 

Your models look invalid to me, though I'd be surprised if that's what's actually causing the problem.

It looks like your first argument is intended to be the verbose_name attribute, your model should probably look like this:

class Foo(models.Model):
    value = models.TextField(verbose_name = u"Value")
    live = models.BooleanField(verbose_name = u"Live", default=False)
    creation_time = models.DateTimeField(verbose_name = u"Creation Time", auto_now_add=True, null=True, blank=True)

(you also forgot the u before the verbose_name for creation_time).

Meanwhile, --fake is definitely still supported (see the docs), what error are you getting when you try and run it?

Dominic Rodger
What Dominic said. I have successfully used `--fake` with the latest version of South. Something else is going wrong.
Manoj Govindan
I tried to use --fake with schemamigration command, not migrate. Thanks alot Dominic!
Hellnar