From 8d5831bf4bfcc7ef31b5c13b4085240124017239 Mon Sep 17 00:00:00 2001 From: gfawcett Date: Wed, 18 Aug 2010 13:24:12 +0000 Subject: [PATCH] database migration fixes git-svn-id: svn://svn.open-ils.org/ILS-Contrib/servres/trunk@972 6d9bc8c9-1ec2-4278-b937-99fde70a366f --- .../0005_auto__add_field_site_start_term__add_field_site_end_term.py | 2 ++ ...del_field_site_term__del_unique_site_owner_course_term__add_uniq.py | 3 --- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/conifer/syrup/migrations/0005_auto__add_field_site_start_term__add_field_site_end_term.py b/conifer/syrup/migrations/0005_auto__add_field_site_start_term__add_field_site_end_term.py index 4aa9284..cf173a1 100644 --- a/conifer/syrup/migrations/0005_auto__add_field_site_start_term__add_field_site_end_term.py +++ b/conifer/syrup/migrations/0005_auto__add_field_site_start_term__add_field_site_end_term.py @@ -13,9 +13,11 @@ class Migration(SchemaMigration): # Adding field 'Site.end_term' db.add_column('syrup_site', 'end_term', self.gf('django.db.models.fields.related.ForeignKey')(default=1, related_name='end_term', to=orm['syrup.Term']), keep_default=False) + db.start_transaction() for site in orm.Site.objects.all(): site.start_term = site.end_term = site.term site.save() + db.commit_transaction() def backwards(self, orm): diff --git a/conifer/syrup/migrations/0006_auto__del_field_site_term__del_unique_site_owner_course_term__add_uniq.py b/conifer/syrup/migrations/0006_auto__del_field_site_term__del_unique_site_owner_course_term__add_uniq.py index b8c1e56..cc3f3f9 100644 --- a/conifer/syrup/migrations/0006_auto__del_field_site_term__del_unique_site_owner_course_term__add_uniq.py +++ b/conifer/syrup/migrations/0006_auto__del_field_site_term__del_unique_site_owner_course_term__add_uniq.py @@ -11,9 +11,6 @@ class Migration(SchemaMigration): # Deleting field 'Site.term' db.delete_column('syrup_site', 'term_id') - # Removing unique constraint on 'Site', fields ['owner', 'course', 'term'] - db.delete_unique('syrup_site', ['owner_id', 'course_id', 'term_id']) - # Adding unique constraint on 'Site', fields ['owner', 'course', 'start_term'] db.create_unique('syrup_site', ['owner_id', 'course_id', 'start_term_id']) -- 2.11.0