I have a field in the model like this:
It's created in MySQL database with "NOT NULL" constraint. Now I need it to be null-able. Therefore I change the model like this:
As I understand, Django "syncdb" can't handle this. So what's the easiest way to do this on Webfaction (without losing the data)? asked 20 Oct '10, 18:32 nuigurumi |
First, I would look into using South as a schema migration tool. That will help make schema changes easier in the future. And, its pretty easy to use once you get the hang of it. To remove the NOT NULL constraint from that column, I would use a a SQL statement like the one below since MySQL columns are NULL by default ALTER TABLE myapp_somemodel MODIFY somecolumn INTEGER; I'm not sure if you will need to re-build the foreign key constraint on the DB or not... See this post on Stackoverflow. answered 20 Oct '10, 18:55 jlmurphy |