I use Django1.7 with Mezzanine. I create simple profile (according to Mezzanine documentation) stored in separate app “profiles”:
class RoadmapProfile(models.Model): user = models.OneToOneField("auth.User") fullname = models.CharField(max_length=100, verbose_name="Full name")
Creation of migrations returns:
Migrations for 'profiles': 0001_initial.py: - Create model RoadmapProfile
When I run “migrate profiles”:
Operations to perform: Apply all migrations: profiles Running migrations: No migrations to apply.
The issue is, when I try to open any page related to mezzanine.accounts (for example update account), it crashes with:
OperationalError at /accounts/update/ no such column: profiles_roadmapprofile.fullname
What I have done wrong?
Advertisement
Answer
Sounds like your initial migration was faked because the table already existed (probably with an outdated schema):
https://docs.djangoproject.com/en/1.8/topics/migrations/#adding-migrations-to-apps
“This will make a new initial migration for your app. Now, when you run migrate, Django will detect that you have an initial migration and that the tables it wants to create already exist, and will mark the migration as already applied.”
Otherwise you would get an no-such-table error :)
Did you clean up the applied-migrations table? That’s also a common cause for non-applied migrations.