0

I made a minor change to my model. I have south installed and has done the initial migration before. from:

class Text(models.Model):

    title = models.CharField(max_length=20, verbose_name="posting title")

To:

class Text(models.Model):

    title = models.CharField(max_length=200, verbose_name="posting title")

I changed the max_length from 20 to 200. when I run

./manage.py schemamigration my_app --auto
Nothing seems to have changed.

Does it mean any changes to attributes (such as verbose_name, label, required etc) do not need syncdb?

eagertoLearn
  • 9,772
  • 23
  • 80
  • 122

1 Answers1

0

There are a handful of attributes that require a database sync because they are enforced in part or in whole in the database schema. Here's a (likely incomplete) list:

As to why South didn't pick up any changes... that's an oddity.

First off, run ./manage.py migrate my_app --list and make sure the initial migration has an * next to it. If it doesn't, run ./manage.py migrate my_app --fake and retry your schemamigration command.

If it does have an asterisk next to it, you'll have to check your migration file.

If you open up the initial migration file (probably called 0001_initial.py) you can see how south documented your models. In your case, you should see a line like:

...
('title', self.gf('django.db.models.fields.CharField')(max_length=20)),
...

If that isn't the case, you can edit the file to reflect your old model with the 20-character limit on title. Note that you'll have to make changes both in the forwards function and the models dictionary if there is an error in the file.

patsweet
  • 1,548
  • 10
  • 12