From 582a3a7208f3e9af047a66366d88958869ad138a Mon Sep 17 00:00:00 2001
From: Dariusz Kedzierski <dkedzierski@syncad.com>
Date: Fri, 12 Jun 2020 18:03:39 +0200
Subject: [PATCH] Fixed bad datatype for column children_abs_rshares

---
 hive/db/schema.py              | 2 +-
 hive/indexer/posts.py          | 2 +-
 scripts/update_hivemind_db.sql | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/hive/db/schema.py b/hive/db/schema.py
index 430059b80..cbe5f8246 100644
--- a/hive/db/schema.py
+++ b/hive/db/schema.py
@@ -113,7 +113,7 @@ def build_metadata():
 
         sa.Column('total_payout_value', sa.String(19), nullable=False, server_default=''),
         sa.Column('author_rewards', sa.Integer, nullable=False, server_default='0'),
-        sa.Column('children_abs_rshares', sa.Integer, nullable=False, server_default='0'),
+        sa.Column('children_abs_rshares', sa.BigInteger, nullable=False, server_default='0'),
         sa.Column('abs_rshares', sa.BigInteger, nullable=False, server_default='0'),
         sa.Column('vote_rshares', sa.BigInteger, nullable=False, server_default='0'),
         sa.Column('net_votes', sa.Integer, nullable=False, server_default='0'),
diff --git a/hive/indexer/posts.py b/hive/indexer/posts.py
index 4955eb9fb..96fd2622f 100644
--- a/hive/indexer/posts.py
+++ b/hive/indexer/posts.py
@@ -317,7 +317,7 @@ class Posts:
         else:
             sql += """children = (SELECT children FROM hive_posts WHERE id = :id) - 1"""
         sql += """ WHERE id = :id"""
-        DB.query(sql, id=parent_id, op=op)
+        DB.query(sql, id=parent_id)
 
     @classmethod
     def undelete(cls, op, date, pid):
diff --git a/scripts/update_hivemind_db.sql b/scripts/update_hivemind_db.sql
index 835b7daa2..305d5e0c6 100644
--- a/scripts/update_hivemind_db.sql
+++ b/scripts/update_hivemind_db.sql
@@ -108,7 +108,7 @@ CREATE TABLE IF NOT EXISTS hive_posts_new (
 
   total_payout_value VARCHAR(19) DEFAULT '',
   author_rewards INT DEFAULT '0',
-  children_abs_rshares INT DEFAULT '0',
+  children_abs_rshares BIGINT DEFAULT '0',
   abs_rshares BIGINT DEFAULT '0',
   vote_rshares BIGINT DEFAULT '0',
   net_votes INT DEFAULT '0',
-- 
GitLab