Django-DB-Migrations: cannot ALTER TABLE because it has pending trigger events

前端 未结 6 1404
梦毁少年i
梦毁少年i 2020-12-02 10:45

I want to remove null=True from a TextField:

-    footer=models.TextField(null=True, blank=True)
+    footer=models.TextField(blank=True, default=\'\')
         


        
6条回答
  •  余生分开走
    2020-12-02 11:12

    Have just hit this problem. You can also use db.start_transaction() and db.commit_transaction() in the schema migration to separate data changes from schema changes. Probably not so clean as to have a separate data migration but in my case I would need schema, data, and then another schema migration so I decided to do it all at once.

提交回复
热议问题