Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
itminedu
synnefo
Commits
09a7d63b
Commit
09a7d63b
authored
Oct 03, 2013
by
Giorgos Korfiatis
Browse files
astakos: Use bulk_create in migrations
parent
33d94a8e
Changes
3
Hide whitespace changes
Inline
Side-by-side
snf-astakos-app/astakos/im/migrations/0043_uninitialized_projects.py
View file @
09a7d63b
...
...
@@ -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."
...
...
snf-astakos-app/astakos/im/migrations/0047_membership_logs.py
View file @
09a7d63b
...
...
@@ -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."
...
...
snf-astakos-app/astakos/im/migrations/0050_project_logs.py
View file @
09a7d63b
...
...
@@ -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."
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment