Created
September 13, 2011 21:22
-
-
Save razum2um/1215212 to your computer and use it in GitHub Desktop.
add TABLESPACE parameter to ENGINE. more see: http://magazine.redhat.com/2007/12/12/tip-from-an-rhce-memory-storage-on-postgresql/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/django/db/backends/postgresql_psycopg2/creation.py b/django/db/backends/postgresql_psycopg2/creation.py | |
index 1f5609a..4468062 100644 | |
--- a/django/db/backends/postgresql_psycopg2/creation.py | |
+++ b/django/db/backends/postgresql_psycopg2/creation.py | |
@@ -34,9 +34,12 @@ class DatabaseCreation(BaseDatabaseCreation): | |
def sql_table_creation_suffix(self): | |
assert self.connection.settings_dict['TEST_COLLATION'] is None, "PostgreSQL does not support collation setting at database creation time." | |
+ suffix = '' | |
+ if self.connection.settings_dict.get('TEST_TABLESPACE'): | |
+ suffix += " WITH TABLESPACE = %s " % self.connection.settings_dict['TEST_TABLESPACE'] | |
if self.connection.settings_dict['TEST_CHARSET']: | |
- return "WITH ENCODING '%s'" % self.connection.settings_dict['TEST_CHARSET'] | |
- return '' | |
+ suffix += " WITH ENCODING '%s' " % self.connection.settings_dict['TEST_CHARSET'] | |
+ return suffix | |
def sql_indexes_for_field(self, model, f, style): | |
if f.db_index and not f.unique: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment