Skip to content

Commit

Permalink
migrations order
Browse files Browse the repository at this point in the history
  • Loading branch information
0xthrpw committed Aug 16, 2024
1 parent 10ee49c commit f975472
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 4 deletions.
2 changes: 1 addition & 1 deletion db/queries/api/v1/discover/create_view__discover.sql
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ SELECT
l.followers,
l.following
FROM public.view__latest_follows r
LEFT JOIN efp_leaderboard l ON l.address = r.address;
LEFT JOIN public.efp_leaderboard l ON l.address = r.address;



Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ SELECT
ORDER BY fing.following_count DESC NULLS LAST
) as following_rank,
RANK () OVER (
ORDER BY blocks.blocks_count DESC NULLS LAST
ORDER BY blocks.blocked_count DESC NULLS LAST
) as blocks_rank,
COALESCE(mut.mutuals, 0 ) as mutuals,
COALESCE(fers.followers_count, 0 ) as followers,
COALESCE(fing.following_count, 0 ) as following,
COALESCE(blocks.blocks_count, 0 ) as blocks
COALESCE(blocks.blocked_count, 0 ) as blocks
FROM query.get_leaderboard_followers(10000) fers
LEFT OUTER JOIN query.get_leaderboard_following(10000) fing ON fing.address = fers.address
LEFT OUTER JOIN query.get_leaderboard_blocked(10000) blocks ON blocks.address = fers.address
Expand Down
2 changes: 1 addition & 1 deletion db/queries/api/v1/stats/create_view__events__efp_stats.sql
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
CREATE
OR REPLACE VIEW PUBLIC.view__efp_stats AS
SELECT
COUNT(DISTINCT (hexlify(record_data))) as address_count,
COUNT(DISTINCT (public.hexlify(record_data))) as address_count,
MAX (token_id) as list_count,
COUNT(*) as list_op_count
FROM
Expand Down
34 changes: 34 additions & 0 deletions src/database/generated/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,14 @@ export interface EfpLists {
user: string
}

export interface EfpRecommended {
address: string
avatar: string | null
class: string | null
created_at: Generated<Timestamp | null>
name: string
}

export interface EnsMetadata {
address: string
avatar: string | null
Expand Down Expand Up @@ -158,6 +166,20 @@ export interface SchemaMigrations {
version: string
}

export interface ViewDiscover {
address: string | null
avatar: string | null
followers: Int8 | null
following: Int8 | null
name: string | null
}

export interface ViewEfpStats {
address_count: Int8 | null
list_count: Int8 | null
list_op_count: Int8 | null
}

export interface ViewEventsEfpAccountMetadata {
address: string | null
block_number: Int8 | null
Expand Down Expand Up @@ -273,6 +295,14 @@ export interface ViewEventsEfpListStorageLocations {
efp_list_storage_location_version: number | null
}

export interface ViewEventsEfpRecommended {
address: string | null
avatar: string | null
class: string | null
created_at: Timestamp | null
name: string | null
}

export interface ViewEventsLatestRecordTags {
chain_id: Int8 | null
contract_address: string | null
Expand Down Expand Up @@ -362,9 +392,12 @@ export interface DB {
efp_list_record_tags: EfpListRecordTags
efp_list_records: EfpListRecords
efp_lists: EfpLists
efp_recommended: EfpRecommended
ens_metadata: EnsMetadata
events: Events
schema_migrations: SchemaMigrations
view__discover: ViewDiscover
view__efp_stats: ViewEfpStats
view__events__efp_account_metadata: ViewEventsEfpAccountMetadata
view__events__efp_accounts_with_primary_list: ViewEventsEfpAccountsWithPrimaryList
view__events__efp_contracts: ViewEventsEfpContracts
Expand All @@ -376,6 +409,7 @@ export interface DB {
view__events__efp_list_record_tags: ViewEventsEfpListRecordTags
view__events__efp_list_records: ViewEventsEfpListRecords
view__events__efp_list_storage_locations: ViewEventsEfpListStorageLocations
view__events__efp_recommended: ViewEventsEfpRecommended
view__events__latest_record_tags: ViewEventsLatestRecordTags
view__join__efp_leaderboard: ViewJoinEfpLeaderboard
view__join__efp_list_records_with_nft_manager_user_tags: ViewJoinEfpListRecordsWithNftManagerUserTags
Expand Down

0 comments on commit f975472

Please sign in to comment.