diff options
| author | Russell Keith-Magee <russell@keith-magee.com> | 2009-12-22 15:18:51 +0000 |
|---|---|---|
| committer | Russell Keith-Magee <russell@keith-magee.com> | 2009-12-22 15:18:51 +0000 |
| commit | ff60c5f9de3e8690d1e86f3e9e3f7248a15397c8 (patch) | |
| tree | a4cb0ebdd55fcaf8c8855231b6ad3e1a7bf45bee /docs/howto/initial-data.txt | |
| parent | 7ef212af149540aa2da577a960d0d87029fd1514 (diff) | |
Fixed #1142 -- Added multiple database support.
This monster of a patch is the result of Alex Gaynor's 2009 Google Summer of Code project.
Congratulations to Alex for a job well done.
Big thanks also go to:
* Justin Bronn for keeping GIS in line with the changes,
* Karen Tracey and Jani Tiainen for their help testing Oracle support
* Brett Hoerner, Jon Loyens, and Craig Kimmerer for their feedback.
* Malcolm Treddinick for his guidance during the GSoC submission process.
* Simon Willison for driving the original design process
* Cal Henderson for complaining about ponies he wanted.
... and everyone else too numerous to mention that helped to bring this feature into fruition.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@11952 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs/howto/initial-data.txt')
| -rw-r--r-- | docs/howto/initial-data.txt | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/docs/howto/initial-data.txt b/docs/howto/initial-data.txt index d36329daa4..b071d6d529 100644 --- a/docs/howto/initial-data.txt +++ b/docs/howto/initial-data.txt @@ -118,23 +118,27 @@ The SQL files are read by the :djadmin:`sqlcustom`, :djadmin:`sqlreset`, <ref-django-admin>`. Refer to the :ref:`manage.py documentation <ref-django-admin>` for more information. -Note that if you have multiple SQL data files, there's no guarantee of the order -in which they're executed. The only thing you can assume is that, by the time -your custom data files are executed, all the database tables already will have -been created. +Note that if you have multiple SQL data files, there's no guarantee of +the order in which they're executed. The only thing you can assume is +that, by the time your custom data files are executed, all the +database tables already will have been created. Database-backend-specific SQL data ---------------------------------- -There's also a hook for backend-specific SQL data. For example, you can have -separate initial-data files for PostgreSQL and MySQL. For each app, Django -looks for a file called ``<appname>/sql/<modelname>.<backend>.sql``, where -``<appname>`` is your app directory, ``<modelname>`` is the model's name in -lowercase and ``<backend>`` is the value of :setting:`DATABASE_ENGINE` in your -settings file (e.g., ``postgresql``, ``mysql``). +There's also a hook for backend-specific SQL data. For example, you +can have separate initial-data files for PostgreSQL and MySQL. For +each app, Django looks for a file called +``<appname>/sql/<modelname>.<backend>.sql``, where ``<appname>`` is +your app directory, ``<modelname>`` is the model's name in lowercase +and ``<backend>`` is the last part of the module name provided for the +:setting:`ENGINE` in your settings file (e.g., if you have defined a +database with an :setting:`ENGINE` value of +``django.db.backends.postgresql``, Django will look for +``<appname>/sql/<modelname>.postgresql.sql``). -Backend-specific SQL data is executed before non-backend-specific SQL data. For -example, if your app contains the files ``sql/person.sql`` and -``sql/person.postgresql.sql`` and you're installing the app on PostgreSQL, -Django will execute the contents of ``sql/person.postgresql.sql`` first, then -``sql/person.sql``. +Backend-specific SQL data is executed before non-backend-specific SQL +data. For example, if your app contains the files ``sql/person.sql`` +and ``sql/person.postgresql.sql`` and you're installing the app on +PostgreSQL, Django will execute the contents of +``sql/person.postgresql.sql`` first, then ``sql/person.sql``. |
