Commit 09a7d63b authored by Giorgos Korfiatis's avatar Giorgos Korfiatis

astakos: Use bulk_create in migrations

parent 33d94a8e
......@@ -19,9 +19,7 @@ class Migration(DataMigration):
checked_chain = chain.pk
projs.append(orm.Project(id=chain, application=app, state=1))
# use bulk_create in 1.4
for proj in projs:
proj.save()
orm.Project.objects.bulk_create(projs)
def backwards(self, orm):
"Write your backwards methods here."
......
......@@ -61,9 +61,7 @@ class Migration(DataMigration):
membership=m, date=m.leave_request_date,
from_state=ACCEPTED, to_state=LEAVE_REQUESTED))
# use bulk_create in 1.4
for log in logs:
log.save()
orm.ProjectMembershipLog.objects.bulk_create(logs)
membs = {}
for m in memberships:
......@@ -79,9 +77,7 @@ class Migration(DataMigration):
person_id=mh.person, project_id=mh.project,
state=H2S[mh.reason])
# use bulk_create in 1.4
for nm in new_membs.values():
nm.save()
orm.ProjectMembership.objects.bulk_create(new_membs.values())
memberships = orm.ProjectMembership.objects.all()
membs = {}
......@@ -98,9 +94,7 @@ class Migration(DataMigration):
membership=m, date=mh.date,
from_state=from_state, to_state=to_state))
# use bulk_create in 1.4
for log in logs:
log.save()
orm.ProjectMembershipLog.objects.bulk_create(logs)
def backwards(self, orm):
"Write your backwards methods here."
......
......@@ -27,9 +27,7 @@ class Migration(DataMigration):
reason=project.deactivation_reason,
from_state=NORMAL, to_state=TERMINATED))
# use bulk_create in 1.4
for log in logs:
log.save()
orm.ProjectLog.objects.bulk_create(logs)
def backwards(self, orm):
"Write your backwards methods here."
......
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 to comment