Skip to content

Commit

Permalink
Fixed backwards migration
Browse files Browse the repository at this point in the history
  • Loading branch information
samluescher committed Jan 21, 2012
1 parent 3121f70 commit 4f4c847
Showing 1 changed file with 9 additions and 3 deletions.
Expand Up @@ -43,9 +43,15 @@ def backwards(self, orm):
# Adding field 'FormLog.data'
db.add_column('form_designer_formlog', 'data', self.gf('picklefield.fields.PickledObjectField')(null=True, blank=True), keep_default=False)

# TODO: Since we can't access the data field because data is actually
# a property now, we cant convert formlog.values.all() back to pickled
# formlog.data
from form_designer.models import FormLog
from picklefield import PickledObjectField
tmp_data = PickledObjectField(null=True, blank=True)
tmp_data.contribute_to_class(FormLog, 'data')

for log in FormLog.objects.all():
log.data = log.get_data()
raise Exception(log.data)
log.save()

# Deleting field 'FormLog.created_by'
db.delete_column('form_designer_formlog', 'created_by_id')
Expand Down

0 comments on commit 4f4c847

Please sign in to comment.