瀏覽代碼

HUE-2633 [desktop] Enable autocommit for transactions

South with SQLite requires autocommit to be turned on if it
uses transactions. Here by way of `Document.objects.sync()`.
Erick Tryzelaar 10 年之前
父節點
當前提交
4b187997f4

+ 6 - 0
desktop/core/src/desktop/migrations/0007_auto__add_documentpermission__add_documenttag__add_document.py

@@ -13,6 +13,12 @@ class Migration(SchemaMigration):
 
     def forwards(self, orm):
 
+        # On SQLite, database transactions (which are used by
+        # `Document.objects.sync`) requires autocommit to be turned on. South
+        # however doesn't enable this by default.
+        if connection.vendor == 'sqlite':
+            connection.set_autocommit(True)
+
         # Adding model 'Document'
         if 'desktop_document' not in connection.introspection.table_names():
             db.create_table('desktop_document', (