2 from django.db import connection
3 from south.db import generic
5 class DatabaseOperations(generic.DatabaseOperations):
8 SQLite3 implementation of database operations.
11 # SQLite ignores foreign key constraints. I wish I could.
12 supports_foreign_keys = False
14 # You can't add UNIQUE columns with an ALTER TABLE.
15 def add_column(self, table_name, name, field, *args, **kwds):
16 # Run ALTER TABLE with no unique column
17 unique, field._unique, field.db_index = field.unique, False, False
18 generic.DatabaseOperations.add_column(self, table_name, name, field, *args, **kwds)
19 # If it _was_ unique, make an index on it.
21 self.create_index(table_name, [name], unique=True)
23 # SQLite doesn't have ALTER COLUMN
24 def alter_column(self, table_name, name, field, explicit_name=True):
26 Not supported under SQLite.
28 raise NotImplementedError("SQLite does not support altering columns.")
31 def delete_column(self, table_name, name, field):
33 Not supported under SQLite.
35 raise NotImplementedError("SQLite does not support deleting columns.")
38 def rename_column(self, table_name, old, new):
40 Not supported under SQLite.
42 raise NotImplementedError("SQLite does not support renaming columns.")