Commit d0891d38 by Őry Máté

vm: fix migrations

parent f19b455c
......@@ -9,7 +9,10 @@ class Migration(SchemaMigration):
def forwards(self, orm):
# Removing unique constraint on 'InstanceTemplate', fields ['name']
db.delete_unique(u'vm_instancetemplate', ['name'])
try:
db.delete_unique(u'vm_instancetemplate', ['name'])
except Exception as e:
print unicode(e)
# Changing field 'InstanceTemplate.parent'
......@@ -281,4 +284,4 @@ class Migration(SchemaMigration):
}
}
complete_apps = ['vm']
\ No newline at end of file
complete_apps = ['vm']
......@@ -7,34 +7,45 @@ class Migration(SchemaMigration):
def forwards(self, orm):
db.start_transaction()
# Adding field 'InstanceActivity.result_data'
db.add_column(u'vm_instanceactivity', 'result_data',
self.gf('jsonfield.fields.JSONField')(null=True, blank=True),
keep_default=False)
# Adding field 'NodeActivity.result_data'
db.add_column(u'vm_nodeactivity', 'result_data',
self.gf('jsonfield.fields.JSONField')(null=True, blank=True),
keep_default=False)
db.commit_transaction()
db.start_transaction()
for i in orm.InstanceActivity.objects.all():
result = i.result.replace("%", "%%") if i.result else ""
i.result_data = {"user_text_template": "",
"admin_text_template": result, "params": {}}
i.save()
# Deleting field 'InstanceActivity.result'
db.delete_column(u'vm_instanceactivity', 'result')
# Adding field 'NodeActivity.result_data'
db.add_column(u'vm_nodeactivity', 'result_data',
self.gf('jsonfield.fields.JSONField')(null=True, blank=True),
keep_default=False)
for i in orm.NodeActivity.objects.all():
result = i.result.replace("%", "%%") if i.result else ""
i.result_data = {"user_text_template": "",
"admin_text_template": result, "params": {}}
i.save()
db.commit_transaction()
db.start_transaction()
# Deleting field 'InstanceActivity.result'
db.delete_column(u'vm_instanceactivity', 'result')
# Deleting field 'NodeActivity.result'
db.delete_column(u'vm_nodeactivity', 'result')
db.commit_transaction()
def backwards(self, orm):
# Adding field 'InstanceActivity.result'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment