Ticket #10164: sqlite_autoincrement_fix.diff
File sqlite_autoincrement_fix.diff, 2.1 KB (added by , 16 years ago) |
---|
-
models/fields/__init__.py
144 144 except KeyError: 145 145 return None 146 146 147 def db_type_suffix(self): 148 data = DictWrapper(self.__dict__, connection.ops.quote_name, "qn_") 149 try: 150 return connection.creation.data_types_suffix[self.get_internal_type()] % data 151 except (KeyError, AttributeError): 152 return False 153 147 154 def unique(self): 148 155 return self._unique or self.primary_key 149 156 unique = property(unique) -
backends/sqlite3/creation.py
30 30 'TimeField': 'time', 31 31 } 32 32 33 data_types_suffix = { 34 'AutoField': 'autoincrement', 35 } 36 33 37 def sql_for_pending_references(self, model, style, pending_references): 34 38 "SQLite3 doesn't support constraints" 35 39 return [] -
backends/creation.py
39 39 qn = self.connection.ops.quote_name 40 40 for f in opts.local_fields: 41 41 col_type = f.db_type() 42 col_type_suffix = f.db_type_suffix() 42 43 tablespace = f.db_tablespace or opts.db_tablespace 43 44 if col_type is None: 44 45 # Skip ManyToManyFields, because they're not represented as … … 63 64 pr = pending_references.setdefault(f.rel.to, []).append((model, f)) 64 65 else: 65 66 field_output.extend(ref_output) 67 if col_type_suffix: 68 field_output.append(style.SQL_KEYWORD(col_type_suffix)) 66 69 table_output.append(' '.join(field_output)) 67 70 if opts.order_with_respect_to: 68 71 table_output.append(style.SQL_FIELD(qn('_order')) + ' ' + \