diff --git a/hive/db/db_state.py b/hive/db/db_state.py index 7b590b7fd32f096b960628e423b222e82c9967e0..405b944e297b73bd680912478a0f4b451ef38e9e 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 67635d0ba883473e1e44882ff603d6aae210477f..228f3211f16d350ae484bfc9bd143cc0430a3e91 100644 --- a/hive/db/schema.py +++ b/hive/db/schema.py @@ -563,9 +563,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 6d525cf7e2fd4403625cc7a6d1198980ed1656de..ae9969d144a457011da270e74f3af7cb3e4d0f29 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 263028e21d3fac7ccd96cbf3e0134ded985863e0..a6f062e8715181bd431204fe7f574d4a28d8e261 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 878399c92b831dc0e8b738eab309581ab9acfd6f..ca231cc1d56fc29ce23e5479ffb7f7dd6dfb39c4 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]