Django: Convert CharField to TextField with data intact

后端 未结 3 1971
醉酒成梦
醉酒成梦 2021-02-07 15:32

Is there a way to change a CharField to a TextField and keep the data from this column intact?

Right now I have the following:

class TestLog(models.Mod         


        
3条回答
  •  既然无缘
    2021-02-07 16:02

    This is solved with django migrations (1.7+). If you change the type from CharField to TextField, the migration produced is AlterField, which does the right thing.

提交回复
热议问题