Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
funkwhale
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Auri
funkwhale
Commits
40567d3b
Commit
40567d3b
authored
6 years ago
by
Auri
Browse files
Options
Downloads
Patches
Plain Diff
Credits: migration performance
parent
0955d769
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
api/funkwhale_api/music/migrations/0037_track_credit.py
+6
-8
6 additions, 8 deletions
api/funkwhale_api/music/migrations/0037_track_credit.py
with
6 additions
and
8 deletions
api/funkwhale_api/music/migrations/0037_track_credit.py
+
6
−
8
View file @
40567d3b
...
@@ -6,17 +6,15 @@ import django.db.models.deletion
...
@@ -6,17 +6,15 @@ import django.db.models.deletion
def
populate_track_credit
(
apps
,
schema_editor
):
def
populate_track_credit
(
apps
,
schema_editor
):
from
funkwhale_api.music.models
import
Credit
TrackCredit
=
apps
.
get_model
(
"
music
"
,
"
TrackCredit
"
)
TrackCredit
=
apps
.
get_model
(
"
music
"
,
"
TrackCredit
"
)
Track
=
apps
.
get_model
(
"
music
"
,
"
Track
"
)
Track
=
apps
.
get_model
(
"
music
"
,
"
Track
"
)
for
tk
in
Track
.
objects
.
al
l
():
tracks
=
Track
.
objects
.
v
al
ues
(
'
artist__id
'
,
'
id
'
).
iterator
()
tc
=
TrackCredit
()
credits
=
[
tc
.
artist
=
tk
.
artist
TrackCredit
(
artist_id
=
track
[
'
artist__id
'
],
track_id
=
track
[
'
id
'
],
credit
=
"
main
"
)
tc
.
track
=
tk
for
track
in
tracks
tc
.
credit
=
Credit
.
MAIN
]
tc
.
save
(
)
TrackCredit
.
objects
.
bulk_create
(
credits
)
def
rewind
(
apps
,
schema_editor
):
def
rewind
(
apps
,
schema_editor
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment