django_evolution
When you run ./manage.py syncdb, Django will look for any new models that have been defined, and add a database table to represent those new models. However, if you make a change to an existing model, ./manage.py syncdb will not make any changes to the database.
This is where Django Evolution fits in. Django Evolution is an extension to Django that allows you to track changes in your models over time, and to update the database to reflect those changes.
使用步骤
1. checkout http://django-evolution.googlecode.com/svn/trunk/ 获取源代码
2. cd django_evolution -> python setup.py install 安装
3. 修改你的django项目的settings.py的INSTALLED_APPS项,比如
INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django_evolution'
)
4.进入你的django项目文件夹, python manage.py syncdb创建 django_evolution所需的表
5.python manage.py evolve --hint --execute 根据实体同步修改你的数据表
over