Skip to content

Commit

Permalink
Fixed #2166 - Use "manage.py dbshell" as the portable way to pipe com…
Browse files Browse the repository at this point in the history
…mands to

the database. Thanks Paolo.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@3132 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information
malcolmt committed Jun 16, 2006
1 parent 062bae3 commit cc56d65
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions docs/faq.txt
Original file line number Diff line number Diff line change
Expand Up @@ -406,18 +406,16 @@ If I make changes to a model, how do I update the database?
-----------------------------------------------------------

If you don't mind clearing data, just pipe the output of the appropriate
``django-admin.py sqlreset`` command into your database's command-line utility.
``manage.py sqlreset`` command into your database's command-line utility.
For example::

django-admin.py sqlreset appname | psql dbname
manage.py sqlreset appname | manage.py dbshell

That "psql" assumes you're using PostgreSQL. If you're using MySQL, use the
appropriate command-line utility, ``mysql``.

``django-admin.py sqlreset`` outputs SQL that clears the app's database
``manage.py sqlreset`` outputs SQL that clears the app's database
table(s) and creates new ones. The above command uses a Unix pipe to send the
SQL directly to the PostgreSQL command-line utility, which accepts SQL as
input.
SQL directly to the database command-line utility, which accepts SQL as
input (``manage.py dbshell`` will launch the appropriate tool for the database
configured in ``settings.py``).

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,
Expand Down

0 comments on commit cc56d65

Please sign in to comment.