Dropping the 'table' for a model and recreating in a django south migration
I have a django model which is created using some custom sql. It's actually just a SQL view, it's not a real table. We are using django south to manage migrations. I have changed the view definition SQL, and I want to write a migration for this change.
Since it's just a sql view, if I drop the view, then 'recreate' it (by running the custom sql), then the view will be up开发者_开发问答dated to the new defintion and we, obviously won't lose any data. How can I do that in django south?
Deleteing the table/view is easy in django south, I could just call some raw SQL db.execute*("DROP VIEW view_name;")
, is there a better way?
Is there a way to recreate the table from an object? something like orm.MyTable.recreate_this_table()
, so that it'll use the custom sql file?
How to handle database views in Django/South seems to contain some good information about this issue. As for the end of your question, I'm not sure I understand what you want to do...
精彩评论