From d9549e7638b2393b823bd8d5c3158e59b1b10d9d Mon Sep 17 00:00:00 2001 From: tobi Date: Tue, 18 Mar 2025 13:25:19 +0100 Subject: [PATCH] should be good now --- internal/db/bundb/account.go | 2 -- .../20250314120945_add_gallery_web_layout.go | 15 ++++----------- 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/internal/db/bundb/account.go b/internal/db/bundb/account.go index cfacc1742..c13291ca9 100644 --- a/internal/db/bundb/account.go +++ b/internal/db/bundb/account.go @@ -892,9 +892,7 @@ func qMediaOnly(ctx context.Context, q *bun.SelectQuery) *bun.SelectQuery { case dialect.SQLite: return q. Where("? IS NOT NULL", bun.Ident("status.attachments")). - Where("? != ''", bun.Ident("status.attachments")). Where("? != 'null'", bun.Ident("status.attachments")). - Where("? != '{}'", bun.Ident("status.attachments")). Where("? != '[]'", bun.Ident("status.attachments")) default: diff --git a/internal/db/bundb/migrations/20250314120945_add_gallery_web_layout.go b/internal/db/bundb/migrations/20250314120945_add_gallery_web_layout.go index 68ad488b8..64b133cd5 100644 --- a/internal/db/bundb/migrations/20250314120945_add_gallery_web_layout.go +++ b/internal/db/bundb/migrations/20250314120945_add_gallery_web_layout.go @@ -50,6 +50,10 @@ func init() { return err } + // Note: "attachments" field is not included in + // the index below as SQLite is fussy about using it, + // and it prevents this index from being used + // properly in non media-only queries. if _, err := tx. NewCreateIndex(). Table("statuses"). @@ -60,18 +64,7 @@ func init() { "in_reply_to_uri", "boost_of_id", "federated", - "attachments", ). - IfNotExists(). - Exec(ctx); err != nil { - return err - } - - if _, err := tx. - NewCreateIndex(). - Table("statuses"). - Index("statuses_profile_web_view_order_by_idx"). - Column("account_id", "federated"). ColumnExpr("? DESC", bun.Ident("id")). IfNotExists(). Exec(ctx); err != nil {