Friday 29 April 2011

Altering django models

I wanted to add a column to an existing django model; but django does not support modifications to existing models so when I added a line to models.py and ran syncdb, I found no change. The workaround was to manually edit the schema in mysql (or your preferred database backend).

alter table <table name> add column <column name> varchar(512);

No comments: