Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[beta v18] Enlève le recalcul des votes à la volée lors de la migration #3479

Merged
merged 1 commit into from
Mar 31, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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