mirror of https://github.com/django/django.git
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
This commit is contained in:
parent
8da42a8b68
commit
8c83f2ab30
17
docs/faq.txt
17
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
|
||||
================
|
||||
|
||||
|
|
Loading…
Reference in New Issue