Skip to content

Commit

Permalink
Fixed #6007: Added DEFAULT_TABLESPACE and DEFAULT_INDEX_TABLESPACE
Browse files Browse the repository at this point in the history
options to global_settings.py


git-svn-id: http://code.djangoproject.com/svn/django/trunk@6801 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information
nightflyerkilo committed Dec 1, 2007
1 parent c5a4541 commit bbc3a95
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 4 deletions.
4 changes: 4 additions & 0 deletions django/conf/global_settings.py
Expand Up @@ -253,6 +253,10 @@
from django import get_version from django import get_version
URL_VALIDATOR_USER_AGENT = "Django/%s (http://www.djangoproject.com)" % get_version() URL_VALIDATOR_USER_AGENT = "Django/%s (http://www.djangoproject.com)" % get_version()


# The tablespaces to use for each model when not specified otherwise.
DEFAULT_TABLESPACE = ''
DEFAULT_INDEX_TABLESPACE = ''

############## ##############
# MIDDLEWARE # # MIDDLEWARE #
############## ##############
Expand Down
2 changes: 1 addition & 1 deletion django/db/models/fields/__init__.py
Expand Up @@ -104,7 +104,7 @@ def __init__(self, verbose_name=None, name=None, primary_key=False,
self.radio_admin = radio_admin self.radio_admin = radio_admin
self.help_text = help_text self.help_text = help_text
self.db_column = db_column self.db_column = db_column
self.db_tablespace = db_tablespace self.db_tablespace = db_tablespace or settings.DEFAULT_INDEX_TABLESPACE


# Set db_index to True if the field has a relationship and doesn't explicitly set db_index. # Set db_index to True if the field has a relationship and doesn't explicitly set db_index.
self.db_index = db_index self.db_index = db_index
Expand Down
2 changes: 1 addition & 1 deletion django/db/models/options.py
Expand Up @@ -29,7 +29,7 @@ def __init__(self, meta):
self.object_name, self.app_label = None, None self.object_name, self.app_label = None, None
self.get_latest_by = None self.get_latest_by = None
self.order_with_respect_to = None self.order_with_respect_to = None
self.db_tablespace = None self.db_tablespace = settings.DEFAULT_TABLESPACE
self.admin = None self.admin = None
self.meta = meta self.meta = meta
self.pk = None self.pk = None
Expand Down
6 changes: 6 additions & 0 deletions docs/databases.txt
Expand Up @@ -258,6 +258,12 @@ many-to-many table would be stored in the ``indexes`` tablespace. The ``data``
field would also generate an index, but no tablespace for it is specified, so field would also generate an index, but no tablespace for it is specified, so
it would be stored in the model tablespace ``tables`` by default. it would be stored in the model tablespace ``tables`` by default.


The settings.py file supports two additional options to specify
default values for the db_tablespace options. This is useful for
setting a tablespace for the Django internal apps and other
contributed applications. These options are ``DEFAULT_TABLESPACE``
and ``DEFAULT_INDEX_TABLESPACE``.

Django does not create the tablespaces for you. Please refer to `Oracle's Django does not create the tablespaces for you. Please refer to `Oracle's
documentation`_ for details on creating and managing tablespaces. documentation`_ for details on creating and managing tablespaces.


Expand Down
5 changes: 3 additions & 2 deletions docs/model-api.txt
Expand Up @@ -618,8 +618,9 @@ statement for this field.
**New in Django development version** **New in Django development version**


The name of the database tablespace to use for this field's index, if The name of the database tablespace to use for this field's index, if
indeed this field is indexed. The default is the ``db_tablespace`` of indeed this field is indexed. The default is the project's
the model, if any. If the backend doesn't support tablespaces, this ``DEFAULT_INDEX_TABLESPACE`` setting, if set, or the ``db_tablespace``
of the model, if any. If the backend doesn't support tablespaces, this
option is ignored. option is ignored.


``default`` ``default``
Expand Down
16 changes: 16 additions & 0 deletions docs/settings.txt
Expand Up @@ -404,6 +404,22 @@ Default: ``'webmaster@localhost'``
Default e-mail address to use for various automated correspondence from the Default e-mail address to use for various automated correspondence from the
site manager(s). site manager(s).


DEFAULT_TABLESPACE
------------------

Default: ``''`` (Empty string)

Default tablespace to use for models that do not specify one, if the
backend supports it.

DEFAULT_INDEX_TABLESPACE
------------------------

Default: ``''`` (Empty string)

Default tablespace to use for indexes on fields that do not specify
one, if the backend supports it.

DISALLOWED_USER_AGENTS DISALLOWED_USER_AGENTS
---------------------- ----------------------


Expand Down

0 comments on commit bbc3a95

Please sign in to comment.