From e7dc06abcad4741b82ca5ef8ff3582c53013ca5f Mon Sep 17 00:00:00 2001 From: mtrela <mtrela@syncad.com> Date: Thu, 3 Sep 2020 08:46:23 +0200 Subject: [PATCH] Name of view is changed --- hive/db/db_state.py | 1 - hive/db/schema.py | 4 ++-- hive/server/bridge_api/objects.py | 2 +- hive/server/condenser_api/cursor.py | 2 +- hive/server/condenser_api/objects.py | 2 +- 5 files changed, 5 insertions(+), 6 deletions(-) diff --git a/hive/db/db_state.py b/hive/db/db_state.py index 7b590b7fd..405b944e2 100644 --- a/hive/db/db_state.py +++ b/hive/db/db_state.py @@ -128,7 +128,6 @@ class DbState: #'hive_posts_cache_ix32', # API: community created #'hive_posts_cache_ix33', # API: community payout #'hive_posts_cache_ix34', # API: community muted - 'hive_accounts_ix1', # (cached_at, name) 'hive_accounts_ix5' # (cached_at, name) ] diff --git a/hive/db/schema.py b/hive/db/schema.py index 113df629e..1c42b7007 100644 --- a/hive/db/schema.py +++ b/hive/db/schema.py @@ -569,9 +569,9 @@ def setup(db): # and posting/voting after an account updating, fixes `active_at` value immediately. sql = """ - DROP VIEW IF EXISTS public.hive_accounts_info; + DROP VIEW IF EXISTS public.hive_accounts_info_view; - CREATE OR REPLACE VIEW public.hive_accounts_info + CREATE OR REPLACE VIEW public.hive_accounts_info_view AS SELECT id, name, diff --git a/hive/server/bridge_api/objects.py b/hive/server/bridge_api/objects.py index 6d525cf7e..ae9969d14 100644 --- a/hive/server/bridge_api/objects.py +++ b/hive/server/bridge_api/objects.py @@ -16,7 +16,7 @@ log = logging.getLogger(__name__) async def load_profiles(db, names): """`get_accounts`-style lookup for `get_state` compat layer.""" - sql = """SELECT * FROM hive_accounts_info + sql = """SELECT * FROM hive_accounts_info_view WHERE name IN :names""" rows = await db.query_all(sql, names=tuple(names)) return [_condenser_profile_object(row) for row in rows] diff --git a/hive/server/condenser_api/cursor.py b/hive/server/condenser_api/cursor.py index 263028e21..a6f062e87 100644 --- a/hive/server/condenser_api/cursor.py +++ b/hive/server/condenser_api/cursor.py @@ -443,7 +443,7 @@ async def get_accounts(db, accounts: list): location, website, profile_image, cover_image, followers, following, proxy, post_count, proxy_weight, rank, lastread_at, active_at, cached_at, raw_json - FROM hive_accounts_info WHERE name IN ({})""".format(",".join(names)) + FROM hive_accounts_info_view WHERE name IN ({})""".format(",".join(names)) result = await db.query_all(sql) for row in result: diff --git a/hive/server/condenser_api/objects.py b/hive/server/condenser_api/objects.py index 878399c92..ca231cc1d 100644 --- a/hive/server/condenser_api/objects.py +++ b/hive/server/condenser_api/objects.py @@ -14,7 +14,7 @@ log = logging.getLogger(__name__) async def load_accounts(db, names): """`get_accounts`-style lookup for `get_state` compat layer.""" - sql = """SELECT * FROM hive_accounts_info + sql = """SELECT * FROM hive_accounts_info_view WHERE name IN :names""" rows = await db.query_all(sql, names=tuple(names)) return [_condenser_account_object(row) for row in rows] -- GitLab