Created
September 26, 2013 07:21
-
-
Save agamdua/6710850 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' 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