Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Added 'If I make changes to a model, how do I update the database?' t…

…o the FAQ

git-svn-id: http://code.djangoproject.com/svn/django/trunk@594 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 8c83f2ab300c82e7856da3bf6bcdaf087f89e80d 1 parent 8da42a8
Adrian Holovaty authored September 01, 2005

Showing 1 changed file with 17 additions and 0 deletions. Show diff stats Hide diff stats

  1. 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:
266 266
        absolute URL to your image in a template with
267 267
        ``{{ object.get_mug_shot_url }}``.
268 268
 
  269
+If I make changes to a model, how do I update the database?
  270
+-----------------------------------------------------------
  271
+
  272
+If you don't care about clearing data, just do this::
  273
+
  274
+    django-admin.py sqlreset appname | psql dbname
  275
+
  276
+That "psql" assumes you're using PostgreSQL. If you're using MySQL, use the
  277
+appropriate command-line utility, ``mysql``.
  278
+
  279
+If you do care about deleting data, you'll have to execute the ``ALTER TABLE``
  280
+statements manually in your database. That's the way we've always done it,
  281
+because dealing with data is a very sensitive operation that we've wanted to
  282
+avoid automating. That said, there's some work being done to add a
  283
+``django-admin.py updatedb`` command, which would output the necessary
  284
+``ALTER TABLE`` statements, if any.
  285
+
269 286
 The database API
270 287
 ================
271 288
 

0 notes on commit 8c83f2a

Please sign in to comment.
Something went wrong with that request. Please try again.