Skip to content

Commit

Permalink
Merge pull request #3479 from sandhose/hotfix-migration-votes
Browse files Browse the repository at this point in the history
[beta v18] Enlève le recalcul des votes à la volée lors de la migration
  • Loading branch information
SpaceFox committed Mar 31, 2016
2 parents 504cc3c + 4de19a2 commit e5cee41
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 e5cee41

Please sign in to comment.