From 4de19a2cd02ab7d13c716997e01ffcde7462b038 Mon Sep 17 00:00:00 2001 From: Quentin Gliech Date: Thu, 31 Mar 2016 23:24:25 +0200 Subject: [PATCH] =?UTF-8?q?Enl=C3=A8ve=20le=20recalcul=20des=20votes=20?= =?UTF-8?q?=C3=A0=20la=20vol=C3=A9e=20lors=20de=20la=20migration?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- zds/utils/migrations/0005_commentvote.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/zds/utils/migrations/0005_commentvote.py b/zds/utils/migrations/0005_commentvote.py index 14bad833b0..77d5998cab 100644 --- a/zds/utils/migrations/0005_commentvote.py +++ b/zds/utils/migrations/0005_commentvote.py @@ -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 ' @@ -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',