diff options
| author | Adrian Holovaty <adrian@holovaty.com> | 2005-09-01 21:48:15 +0000 |
|---|---|---|
| committer | Adrian Holovaty <adrian@holovaty.com> | 2005-09-01 21:48:15 +0000 |
| commit | 8c83f2ab300c82e7856da3bf6bcdaf087f89e80d (patch) | |
| tree | c26ec23d4872bb3e008874f2044a56f2b07a7dec /docs | |
| parent | 8da42a8b68698b57931f8c5db1247f47d70da009 (diff) | |
Added 'If I make changes to a model, how do I update the database?' to the FAQ
git-svn-id: http://code.djangoproject.com/svn/django/trunk@594 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/faq.txt | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/docs/faq.txt b/docs/faq.txt index e1f909cea3..69991d4954 100644 --- a/docs/faq.txt +++ b/docs/faq.txt @@ -266,6 +266,23 @@ Using a ``FileField`` or an ``ImageField`` in a model takes a few steps: absolute URL to your image in a template with ``{{ object.get_mug_shot_url }}``. +If I make changes to a model, how do I update the database? +----------------------------------------------------------- + +If you don't care about clearing data, just do this:: + + django-admin.py sqlreset appname | psql dbname + +That "psql" assumes you're using PostgreSQL. If you're using MySQL, use the +appropriate command-line utility, ``mysql``. + +If you do care about deleting data, you'll have to execute the ``ALTER TABLE`` +statements manually in your database. That's the way we've always done it, +because dealing with data is a very sensitive operation that we've wanted to +avoid automating. That said, there's some work being done to add a +``django-admin.py updatedb`` command, which would output the necessary +``ALTER TABLE`` statements, if any. + The database API ================ |
