summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorRussell Keith-Magee <russell@keith-magee.com>2010-01-07 11:37:49 +0000
committerRussell Keith-Magee <russell@keith-magee.com>2010-01-07 11:37:49 +0000
commitb7fa3e8c3501fe9064a6111809dc19f7a487e30d (patch)
tree27f7aa75de33828d6af2b59e3644bb80963e8251 /docs
parent1d18f324f17ea8638d12cd3a10019fb51512a20d (diff)
Added docs on how syncdb and other management commands interact with multi-db.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12116 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs')
-rw-r--r--docs/topics/db/multi-db.txt33
1 files changed, 33 insertions, 0 deletions
diff --git a/docs/topics/db/multi-db.txt b/docs/topics/db/multi-db.txt
index 3faa5bc0a6..f8a34ee0e5 100644
--- a/docs/topics/db/multi-db.txt
+++ b/docs/topics/db/multi-db.txt
@@ -51,6 +51,39 @@ If you attempt to access a database that you haven't defined in your
:setting:`DATABASES` setting then Django will raise a
``django.db.utils.ConnectionDoesNotExist`` exception.
+Synchronizing your databases
+============================
+
+The :djadmin:`syncdb` management command operates on one database at a
+time. By default, it operates on the ``default`` database, but by
+providing a :djadminopt:`--database` argument, you can tell syncdb to
+synchronize a different database. So - to synchronize all models onto
+all databases in our example, you would need to call::
+
+ $ ./manage.py syncdb
+ $ ./manage.py syncdb --database=users
+
+If you don't want every application to be synchronized onto a
+particular database. you can specify the :djadminopt:`--exclude`
+argument to :djadmin:`syncdb`. The :djadminopt:`--exclude` option
+allows you to prevent a specific application or applications from
+being synchronized. For example, if you don't want the ``sales``
+application to be on the ``users`` database, you could run::
+
+ $ ./manage.py syncdb --database=users --exclude=sales
+
+Alternatively, if you want fine grained control of synchronization,
+you can pipe all or part of the output of :djadmin:`sqlall` for a
+particular application directly into your database prompt.
+
+Using other management commands
+-------------------------------
+
+The other ``django-admin.py`` commands that interact with the database
+operate in the same way as :djadmin:`syncdb` -- they only ever operate
+on one database at a time, using the :djadminopt:`--database` to control
+the database that is used.
+
Selecting a database for a ``QuerySet``
=======================================