From bb9072653339d811b161ca30f8a8d1fc651c6737 Mon Sep 17 00:00:00 2001 From: j <13580441+gary02@users.noreply.github.com> Date: Fri, 23 Aug 2024 15:26:31 +0800 Subject: [PATCH] feat(db): stop querying from deprecated mat_views tables --- lib/db.ts | 5 ++--- package.json | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/db.ts b/lib/db.ts index 0ff4962..6d4a5e7 100644 --- a/lib/db.ts +++ b/lib/db.ts @@ -288,7 +288,7 @@ LIMIT ${take} OFFSET ${skip};` since = '2022-01-01', }: { limit?: number; offset?: number; since?: string | Date } = {}) { return sqlRO`-- check latest articles' author ipns_key -SELECT u2.user_name, u2.display_name, GREATEST(ul.last_at ::date, u2.last_seen ::date) AS last_seen, +SELECT u2.user_name, u2.display_name, last_seen ::date, count_articles, ipns_key, last_data_hash AS top_dir_data_hash, last_published, a.*, concat('https://matters.town/@', u2.user_name, '/', a.id, '-', a.slug) AS last_article_url, priv_key_pem, priv_key_name @@ -299,7 +299,6 @@ FROM ( AND author_id NOT IN (SELECT user_id FROM user_restriction) -- skip restricted authors ORDER BY author_id, id DESC ) a -LEFT JOIN mat_views.users_lasts ul ON author_id=ul.id LEFT JOIN public.user u2 ON author_id=u2.id LEFT JOIN user_ipns_keys k ON author_id=k.user_id LEFT JOIN ( @@ -412,7 +411,7 @@ LEFT JOIN ( -- remove known duplicates from 'mat_views.tags_lasts' WHERE - tag.id NOT IN ( SELECT UNNEST( array_remove(dup_tag_ids, id) ) FROM mat_views.tags_lasts WHERE ARRAY_LENGTH(dup_tag_ids,1)>1 ) + tag.id NOT IN ( SELECT UNNEST( array_remove(dup_tag_ids, id) ) FROM mat_views.tags_lasts_view_materialized WHERE ARRAY_LENGTH(dup_tag_ids,1)>1 ) ${ range ? sql`AND ( tag.updated_at >= CURRENT_DATE - ${range} ::interval OR tag.id IN ( ${allRecentInUseTagIds} ) )` diff --git a/package.json b/package.json index 6d260f3..484d50d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "lambda-handlers-image", - "version": "0.10.10", + "version": "0.10.11", "private": true, "type": "module", "scripts": {