From 19b9a2973550572c81b66e462bbbbf4d25fbd927 Mon Sep 17 00:00:00 2001 From: daniel <4954577+jaensen@users.noreply.github.com> Date: Tue, 3 Sep 2024 17:25:04 +0200 Subject: [PATCH] remove InviteHuman events from V_CrcV2_Avatars --- Circles.Index.CirclesViews/DatabaseSchema.cs | 103 ++++++++----------- Circles.Index/Circles.Index.csproj | 4 +- docker-compose.gnosis.yml | 2 +- 3 files changed, 47 insertions(+), 62 deletions(-) diff --git a/Circles.Index.CirclesViews/DatabaseSchema.cs b/Circles.Index.CirclesViews/DatabaseSchema.cs index a2c29ef..23504e2 100644 --- a/Circles.Index.CirclesViews/DatabaseSchema.cs +++ b/Circles.Index.CirclesViews/DatabaseSchema.cs @@ -152,59 +152,45 @@ UNION ALL ]) { SqlMigrationItem = new SqlMigrationItem(@" - create or replace view public.""V_CrcV2_Avatars"" - (""blockNumber"", timestamp, ""transactionIndex"", ""logIndex"", ""transactionHash"", type, ""invitedBy"", avatar, - ""tokenId"", name, ""cidV0Digest"") - as - WITH avatars AS ( - SELECT ""CrcV2_RegisterOrganization"".""blockNumber"", - ""CrcV2_RegisterOrganization"".""timestamp"", - ""CrcV2_RegisterOrganization"".""transactionIndex"", - ""CrcV2_RegisterOrganization"".""logIndex"", - ""CrcV2_RegisterOrganization"".""transactionHash"", - 'organization'::text AS type, - NULL::text AS ""invitedBy"", - ""CrcV2_RegisterOrganization"".organization AS avatar, - NULL::text AS ""tokenId"", - ""CrcV2_RegisterOrganization"".name - FROM ""CrcV2_RegisterOrganization"" - UNION ALL - SELECT ""CrcV2_RegisterGroup"".""blockNumber"", - ""CrcV2_RegisterGroup"".""timestamp"", - ""CrcV2_RegisterGroup"".""transactionIndex"", - ""CrcV2_RegisterGroup"".""logIndex"", - ""CrcV2_RegisterGroup"".""transactionHash"", - 'group'::text AS type, - NULL::text AS ""invitedBy"", - ""CrcV2_RegisterGroup"".""group"" AS avatar, - ""CrcV2_RegisterGroup"".""group"" AS ""tokenId"", - ""CrcV2_RegisterGroup"".name - FROM ""CrcV2_RegisterGroup"" - UNION ALL - SELECT ""CrcV2_RegisterHuman"".""blockNumber"", - ""CrcV2_RegisterHuman"".""timestamp"", - ""CrcV2_RegisterHuman"".""transactionIndex"", - ""CrcV2_RegisterHuman"".""logIndex"", - ""CrcV2_RegisterHuman"".""transactionHash"", - 'human'::text AS type, - NULL::text AS ""invitedBy"", - ""CrcV2_RegisterHuman"".avatar, - ""CrcV2_RegisterHuman"".avatar AS ""tokenId"", - NULL::text AS name - FROM ""CrcV2_RegisterHuman"" - UNION ALL - SELECT ""CrcV2_InviteHuman"".""blockNumber"", - ""CrcV2_InviteHuman"".""timestamp"", - ""CrcV2_InviteHuman"".""transactionIndex"", - ""CrcV2_InviteHuman"".""logIndex"", - ""CrcV2_InviteHuman"".""transactionHash"", - 'human'::text AS type, - ""CrcV2_InviteHuman"".inviter AS ""invitedBy"", - ""CrcV2_InviteHuman"".invited, - ""CrcV2_InviteHuman"".invited AS ""tokenId"", - NULL::text AS name - FROM ""CrcV2_InviteHuman"" - ) + create or replace view public.""V_CrcV2_Avatars"" + (""blockNumber"", timestamp, ""transactionIndex"", ""logIndex"", ""transactionHash"", type, ""invitedBy"", avatar, + ""tokenId"", name, ""cidV0Digest"") + as + WITH avatars AS (SELECT ""CrcV2_RegisterOrganization"".""blockNumber"", + ""CrcV2_RegisterOrganization"".""timestamp"", + ""CrcV2_RegisterOrganization"".""transactionIndex"", + ""CrcV2_RegisterOrganization"".""logIndex"", + ""CrcV2_RegisterOrganization"".""transactionHash"", + 'organization'::text AS type, + NULL::text AS ""invitedBy"", + ""CrcV2_RegisterOrganization"".organization AS avatar, + NULL::text AS ""tokenId"", + ""CrcV2_RegisterOrganization"".name + FROM ""CrcV2_RegisterOrganization"" + UNION ALL + SELECT ""CrcV2_RegisterGroup"".""blockNumber"", + ""CrcV2_RegisterGroup"".""timestamp"", + ""CrcV2_RegisterGroup"".""transactionIndex"", + ""CrcV2_RegisterGroup"".""logIndex"", + ""CrcV2_RegisterGroup"".""transactionHash"", + 'group'::text AS type, + NULL::text AS ""invitedBy"", + ""CrcV2_RegisterGroup"".""group"" AS avatar, + ""CrcV2_RegisterGroup"".""group"" AS ""tokenId"", + ""CrcV2_RegisterGroup"".name + FROM ""CrcV2_RegisterGroup"" + UNION ALL + SELECT ""CrcV2_RegisterHuman"".""blockNumber"", + ""CrcV2_RegisterHuman"".""timestamp"", + ""CrcV2_RegisterHuman"".""transactionIndex"", + ""CrcV2_RegisterHuman"".""logIndex"", + ""CrcV2_RegisterHuman"".""transactionHash"", + 'human'::text AS type, + NULL::text AS ""invitedBy"", + ""CrcV2_RegisterHuman"".avatar, + ""CrcV2_RegisterHuman"".avatar AS ""tokenId"", + NULL::text AS name + FROM ""CrcV2_RegisterHuman"") SELECT a.""blockNumber"", a.""timestamp"", a.""transactionIndex"", @@ -217,12 +203,11 @@ UNION ALL a.name, cid.""cidV0Digest"" FROM avatars a - LEFT JOIN ( - SELECT cid_1.avatar, - cid_1.""metadataDigest"" AS ""cidV0Digest"", - ROW_NUMBER() OVER (PARTITION BY cid_1.avatar ORDER BY cid_1.""blockNumber"" DESC, cid_1.""transactionIndex"" DESC, cid_1.""logIndex"" DESC) as rn - FROM ""CrcV2_UpdateMetadataDigest"" cid_1 - ) cid ON cid.avatar = a.avatar AND cid.rn = 1; + LEFT JOIN (SELECT cid_1.avatar, + cid_1.""metadataDigest"" AS ""cidV0Digest"", + row_number() + OVER (PARTITION BY cid_1.avatar ORDER BY cid_1.""blockNumber"" DESC, cid_1.""transactionIndex"" DESC, cid_1.""logIndex"" DESC) AS rn + FROM ""CrcV2_UpdateMetadataDigest"" cid_1) cid ON cid.avatar = a.avatar AND cid.rn = 1; ") }; diff --git a/Circles.Index/Circles.Index.csproj b/Circles.Index/Circles.Index.csproj index d66052d..59b83df 100644 --- a/Circles.Index/Circles.Index.csproj +++ b/Circles.Index/Circles.Index.csproj @@ -8,8 +8,8 @@ Daniel Janz (Gnosis Service GmbH) Gnosis Service GmbH Circles - 1.7.0 - 1.7.0 + 1.7.1 + 1.7.1 diff --git a/docker-compose.gnosis.yml b/docker-compose.gnosis.yml index b564f74..314248f 100644 --- a/docker-compose.gnosis.yml +++ b/docker-compose.gnosis.yml @@ -61,7 +61,7 @@ services: consensus-gnosis: container_name: consensus-gnosis - image: sigp/lighthouse:v5.0.0 + image: sigp/lighthouse:v5.3.0-amd64-modern restart: always networks: - circles-gnosis