Commits

Andrew Godwin committed 9dc5791

SQLite module now has "standard" support, and passes all of the tests (bar unique and primary_key altering).

  • Participants
  • Parent commits 90985e0
  • Branches 0.7

Comments (0)

Files changed (3)

File south/db/sqlite3.py

         Not supported under SQLite.
         """
         print "   ! WARNING: SQLite does not support removing unique constraints. Ignored."
+
+    # Not implemented this yet.
+    def delete_primary_key(self, table_name):
+        raise NotImplementedError()
     
     # No cascades on deletes
     def delete_table(self, table_name, cascade=True):

File south/tests/db.py

         """
         Test the primary key operations
         """
+        
+        # SQLite backend doesn't support this yet.
+        if db.backend_name == "sqlite3":
+            return
+        
         db.create_table("test_pk", [
             ('id', models.IntegerField(primary_key=True)),
             ('new_pkey', models.IntegerField()),
         """
         Tests creating/deleting unique constraints.
         """
+        
+        # SQLite backend doesn't support this yet.
+        if db.backend_name == "sqlite3":
+            return
+        
         db.create_table("test_unique2", [
             ('id', models.AutoField(primary_key=True)),
         ])

File south/tests/logic.py

 from south.migration.utils import depends, dfs, flatten, get_app_label
 from south.models import MigrationHistory
 from south.tests import Monkeypatcher
+from south.db import db
 
 class TestMigration(Monkeypatcher):
     installed_apps = ["fakeapp", "otherfakeapp", "brokenapp"]
         self.assertEqual(list(MigrationHistory.objects.all()), [])
     
     def test_alter_column_null(self):
+        
         def null_ok():
             from django.db import connection, transaction
             # the DBAPI introspection module fails on postgres NULLs.
             cursor = connection.cursor()
+        
+            # SQLite has weird now()
+            if db.backend_name == "sqlite3":
+                now_func = "DATETIME('NOW')"
+            else:
+                now_func = "NOW()"
+            
             try:
-                cursor.execute("INSERT INTO southtest_spam (id, weight, expires, name) VALUES (100, 10.1, now(), NULL);")
+                cursor.execute("INSERT INTO southtest_spam (id, weight, expires, name) VALUES (100, 10.1, %s, NULL);" % now_func)
             except:
                 transaction.rollback()
                 return False