diff --git a/db/gen/coredb/token_gallery.sql.go b/db/gen/coredb/token_gallery.sql.go index eb5c323f7..2eb3d5e12 100644 --- a/db/gen/coredb/token_gallery.sql.go +++ b/db/gen/coredb/token_gallery.sql.go @@ -26,8 +26,10 @@ where and ($3 is null or t.owner_user_id = $3) and (cardinality($4) = 0 or td.contract_id = any($4)) and (cardinality($5::int[]) = 0 or td.chain = any($5)) - and t.deleted = false and (($1 and t.is_holder_token) or ($2 and t.is_creator_token)) + and t.token_definition_id = td.id + and t.deleted = false + and td.deleted = false and t.last_synced < $6 ` diff --git a/db/queries/core/token_gallery.sql b/db/queries/core/token_gallery.sql index 6ac202421..4a0645fb1 100644 --- a/db/queries/core/token_gallery.sql +++ b/db/queries/core/token_gallery.sql @@ -125,6 +125,8 @@ where and (sqlc.narg('only_from_user_id') is null or t.owner_user_id = @only_from_user_id) and (cardinality(@only_from_contract_ids) = 0 or td.contract_id = any(@only_from_contract_ids)) and (cardinality(@only_from_chains::int[]) = 0 or td.chain = any(@only_from_chains)) - and t.deleted = false and ((@remove_holder_status and t.is_holder_token) or (@remove_creator_status and t.is_creator_token)) + and t.token_definition_id = td.id + and t.deleted = false + and td.deleted = false and t.last_synced < @timestamp;