Fix for #24 running migrate with sqlite3

When using sqlite3 we set autocommit to True at the beginning of the
migration 0002 for wagtail core / docs / images in order to disable
transactions there and be able to do a simple python manage.py migrate
also in sqlite3.
This commit is contained in:
Serafeim Papastefanos 2014-02-17 09:59:50 +02:00
parent d8c0a0ef9b
commit 296d09ff5f
3 changed files with 12 additions and 3 deletions

View file

@ -2,11 +2,14 @@
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import DataMigration
from django.db import models
from django.db import models, connection
from django.db.transaction import set_autocommit
class Migration(DataMigration):
def forwards(self, orm):
if connection.vendor == 'sqlite':
set_autocommit(True)
page_content_type, created = orm['contenttypes.contenttype'].objects.get_or_create(
model='page', app_label='wagtailcore', defaults={'name': 'page'})

View file

@ -2,11 +2,14 @@
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import DataMigration
from django.db import models
from django.db import models, connection
from django.db.transaction import set_autocommit
class Migration(DataMigration):
def forwards(self, orm):
if connection.vendor == 'sqlite':
set_autocommit(True)
document_content_type, created = orm['contenttypes.ContentType'].objects.get_or_create(
model='document', app_label='wagtaildocs', defaults={'name': 'document'})
add_permission, created = orm['auth.permission'].objects.get_or_create(

View file

@ -2,11 +2,14 @@
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import DataMigration
from django.db import models
from django.db import models, connection
from django.db.transaction import set_autocommit
class Migration(DataMigration):
def forwards(self, orm):
if connection.vendor == 'sqlite':
set_autocommit(True)
image_content_type, created = orm['contenttypes.ContentType'].objects.get_or_create(
model='image', app_label='wagtailimages', defaults={'name': 'image'})
add_permission, created = orm['auth.permission'].objects.get_or_create(