2

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.

Community
  • 1
  • 1
Hellnar
  • 62,315
  • 79
  • 204
  • 279

1 Answers1

3

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
  • 97,747
  • 36
  • 197
  • 212