Skip to content

Instantly share code, notes, and snippets.

@agamdua
Created September 26, 2013 07:21
Show Gist options
  • Save agamdua/6710850 to your computer and use it in GitHub Desktop.
Save agamdua/6710850 to your computer and use it in GitHub Desktop.
''' We are facing a problem.
tl;dr: We want to add a new table to the database, without losing previous data.
On adding a new model to models.py, syncdb doesn't create the table. However, if we create a new db, it works.
This is surprising, because we didn't think that adding a new table is a 'schema migration' that syncdb cannot handle.
Hence, we don't think South will help here.
Is there something I'm missing/getting wrong?
'''
Class Person(models.Model):
# attributes
Class A(models.Model):
# attributes
Class B(models.Model):
a_fk = models.ForeignKey(A)
# more attributes
Class ProblemModel(models.Model)
p_fk = models.ForeignKey(Person)
a_fk = models.ForeignKey(A)
b_fk = models.ForeignKey(B)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment