Skip to content

Commit

Permalink
Enlève le recalcul des votes à la volée lors de la migration
Browse files Browse the repository at this point in the history
  • Loading branch information
sandhose committed Mar 31, 2016
1 parent 504cc3c commit 4de19a2
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions zds/utils/migrations/0005_commentvote.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class Migration(migrations.Migration):
'UNION SELECT DISTINCT t2.comments_id as comment_id, t2.user_id as user_id, 0 as positive '
'FROM utils_commentdislike t2'
') AS t3;'
), reverse_sql=(
), reverse_sql=(
'INSERT INTO utils_commentlike (comments_id, user_id) '
'SELECT vote.comment_id as comments_id, vote.user_id as user_id '
'FROM utils_commentvote vote '
Expand All @@ -50,11 +50,6 @@ class Migration(migrations.Migration):
'FROM utils_commentvote vote '
'WHERE vote.positive = 0')
),
migrations.RunSQL((
'UPDATE utils_comment '
'SET `like` = (SELECT COUNT(*) FROM utils_commentvote votes WHERE votes.comment_id = utils_comment.id AND votes.positive = 1), '
'`dislike` = (SELECT COUNT(*) FROM utils_commentvote votes WHERE votes.comment_id = utils_comment.id AND votes.positive = 0);'
), reverse_sql=""),
migrations.RemoveField(
model_name='commentdislike',
name='comments',
Expand Down

0 comments on commit 4de19a2

Please sign in to comment.