Ticket #1051: django-postgresql-schemas.diff
File django-postgresql-schemas.diff, 1.9 KB (added by , 19 years ago) |
---|
-
django/conf/project_template/settings.py
11 11 12 12 DATABASE_ENGINE = 'postgresql' # 'postgresql', 'mysql', 'sqlite3' or 'ado_mssql'. 13 13 DATABASE_NAME = '' # Or path to database file if using sqlite3. 14 DATABASE_SCHEMAS = '' # Only used with postgresq to support multiple schemas 14 15 DATABASE_USER = '' # Not used with sqlite3. 15 16 DATABASE_PASSWORD = '' # Not used with sqlite3. 16 17 DATABASE_HOST = '' # Set to empty string for localhost. Not used with sqlite3. -
django/core/db/backends/postgresql.py
15 15 self.queries = [] 16 16 17 17 def cursor(self): 18 from django.conf.settings import DATABASE_ USER, DATABASE_NAME, DATABASE_HOST, DATABASE_PORT, DATABASE_PASSWORD, DEBUG, TIME_ZONE18 from django.conf.settings import DATABASE_ENGINE, DATABASE_USER, DATABASE_NAME, DATABASE_SCHEMAS, DATABASE_HOST, DATABASE_PORT, DATABASE_PASSWORD, DEBUG, TIME_ZONE 19 19 if self.connection is None: 20 20 if DATABASE_NAME == '': 21 21 from django.core.exceptions import ImproperlyConfigured … … 33 33 self.connection.set_isolation_level(1) # make transactions transparent to all cursors 34 34 cursor = self.connection.cursor() 35 35 cursor.execute("SET TIME ZONE %s", [TIME_ZONE]) 36 if DATABASE_ENGINE == 'postgresql' and DATABASE_SCHEMAS: 37 cursor.execute("SET search_path TO %s; " % DATABASE_SCHEMAS) 36 38 if DEBUG: 37 39 return base.CursorDebugWrapper(cursor, self) 38 40 return cursor