X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/21f878e8112cf1f9b732a6dbb77e70efa68a01aa..31badf91680a7ddb83f1d4fcc952bf52ac25b6b6:/apps/south/db/sqlite3.py?ds=inline diff --git a/apps/south/db/sqlite3.py b/apps/south/db/sqlite3.py index 6073b4d4c..1fac1b83d 100644 --- a/apps/south/db/sqlite3.py +++ b/apps/south/db/sqlite3.py @@ -8,5 +8,35 @@ class DatabaseOperations(generic.DatabaseOperations): SQLite3 implementation of database operations. """ - def __init__(self): - raise NotImplementedError("Support for SQLite3 is not yet complete.") \ No newline at end of file + # SQLite ignores foreign key constraints. I wish I could. + supports_foreign_keys = False + + # You can't add UNIQUE columns with an ALTER TABLE. + def add_column(self, table_name, name, field, *args, **kwds): + # Run ALTER TABLE with no unique column + unique, field._unique, field.db_index = field.unique, False, False + generic.DatabaseOperations.add_column(self, table_name, name, field, *args, **kwds) + # If it _was_ unique, make an index on it. + if unique: + self.create_index(table_name, [name], unique=True) + + # SQLite doesn't have ALTER COLUMN + def alter_column(self, table_name, name, field, explicit_name=True): + """ + Not supported under SQLite. + """ + raise NotImplementedError("SQLite does not support altering columns.") + + # Nor DROP COLUMN + def delete_column(self, table_name, name, field): + """ + Not supported under SQLite. + """ + raise NotImplementedError("SQLite does not support deleting columns.") + + # Nor RENAME COLUMN + def rename_column(self, table_name, old, new): + """ + Not supported under SQLite. + """ + raise NotImplementedError("SQLite does not support renaming columns.") \ No newline at end of file