web/lib/django/db/backends/mysql/creation.py
changeset 29 cc9b7e14412b
parent 0 0d40e90630ef
--- a/web/lib/django/db/backends/mysql/creation.py	Wed May 19 17:43:59 2010 +0200
+++ b/web/lib/django/db/backends/mysql/creation.py	Tue May 25 02:43:45 2010 +0200
@@ -1,4 +1,3 @@
-from django.conf import settings
 from django.db.backends.creation import BaseDatabaseCreation
 
 class DatabaseCreation(BaseDatabaseCreation):
@@ -18,6 +17,7 @@
         'FilePathField':     'varchar(%(max_length)s)',
         'FloatField':        'double precision',
         'IntegerField':      'integer',
+        'BigIntegerField':   'bigint',
         'IPAddressField':    'char(15)',
         'NullBooleanField':  'bool',
         'OneToOneField':     'integer',
@@ -31,29 +31,29 @@
 
     def sql_table_creation_suffix(self):
         suffix = []
-        if settings.TEST_DATABASE_CHARSET:
-            suffix.append('CHARACTER SET %s' % settings.TEST_DATABASE_CHARSET)
-        if settings.TEST_DATABASE_COLLATION:
-            suffix.append('COLLATE %s' % settings.TEST_DATABASE_COLLATION)
+        if self.connection.settings_dict['TEST_CHARSET']:
+            suffix.append('CHARACTER SET %s' % self.connection.settings_dict['TEST_CHARSET'])
+        if self.connection.settings_dict['TEST_COLLATION']:
+            suffix.append('COLLATE %s' % self.connection.settings_dict['TEST_COLLATION'])
         return ' '.join(suffix)
 
     def sql_for_inline_foreign_key_references(self, field, known_models, style):
         "All inline references are pending under MySQL"
         return [], True
-        
+
     def sql_for_inline_many_to_many_references(self, model, field, style):
         from django.db import models
         opts = model._meta
         qn = self.connection.ops.quote_name
-        
+
         table_output = [
             '    %s %s %s,' %
                 (style.SQL_FIELD(qn(field.m2m_column_name())),
-                style.SQL_COLTYPE(models.ForeignKey(model).db_type()),
+                style.SQL_COLTYPE(models.ForeignKey(model).db_type(connection=self.connection)),
                 style.SQL_KEYWORD('NOT NULL')),
             '    %s %s %s,' %
             (style.SQL_FIELD(qn(field.m2m_reverse_name())),
-            style.SQL_COLTYPE(models.ForeignKey(field.rel.to).db_type()),
+            style.SQL_COLTYPE(models.ForeignKey(field.rel.to).db_type(connection=self.connection)),
             style.SQL_KEYWORD('NOT NULL'))
         ]
         deferred = [
@@ -63,4 +63,3 @@
                 field.rel.to._meta.db_table, field.rel.to._meta.pk.column)
             ]
         return table_output, deferred
-        
\ No newline at end of file