我想向现有模型添加一列,并且在运行“schemamigration --auto”后,生成的迁移尝试删除另一个表!为什么会这样做?
我的模型(简化)-
class A(Model):
a = CharField()
b = BooleanField(default=False) # <--- this is the new column
class B(Model): # <---- this is the table South wants to delete
c = CharField()
d = ManyToManyField(A, through='C')
结果迁移——
def forwards(self, orm):
# Removing M2M table for field d on 'B'
db.delete_table('B_d') # <------- Why is that?
# Adding field 'b'
db.add_column('A', 'b', self.gf('django.db.models.fields.BooleanField')(default=False, blank=True), keep_default=False)