-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add `listing_created_at` to `mb_views.metadata_unburned` * Add hasura permission
- Loading branch information
Showing
3 changed files
with
93 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
migrations/2023-08-09-091613_unburned-metadata-listing-created-at/down.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
drop view mb_views.nft_metadata_unburned; | ||
|
||
create view mb_views.nft_metadata_unburned as | ||
select md.id as metadata_id, | ||
md.title, | ||
md.description, | ||
md.reference, | ||
md.media, | ||
md.nft_contract_id, | ||
md.base_uri, | ||
md.reference_blob, | ||
md.content_flag, | ||
t.minted_timestamp, | ||
t.last_transfer_timestamp, | ||
t.minter, | ||
l.price, | ||
l.currency, | ||
l.listed_by | ||
from nft_metadata md | ||
left join lateral ( | ||
select | ||
t.minted_timestamp, | ||
t.last_transfer_timestamp, | ||
t.minter | ||
from nft_tokens t | ||
where | ||
t.burned_timestamp is null and t.metadata_id = md.id | ||
order by greatest(t.minted_timestamp, t.last_transfer_timestamp) desc | ||
limit 1 | ||
) t on true | ||
left join lateral ( | ||
select | ||
p.price, | ||
p.currency, | ||
p.listed_by | ||
from nft_listings p | ||
where | ||
p.unlisted_at is null and | ||
p.accepted_at is null and | ||
p.invalidated_at is null and | ||
p.metadata_id = md.id | ||
order by p.price asc | ||
limit 1 | ||
) l on true | ||
where coalesce(t.last_transfer_timestamp, t.minted_timestamp) is not null; |
47 changes: 47 additions & 0 deletions
47
migrations/2023-08-09-091613_unburned-metadata-listing-created-at/up.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
drop view mb_views.nft_metadata_unburned; | ||
|
||
create view mb_views.nft_metadata_unburned as | ||
select md.id as metadata_id, | ||
md.title, | ||
md.description, | ||
md.reference, | ||
md.media, | ||
md.nft_contract_id, | ||
md.base_uri, | ||
md.reference_blob, | ||
md.content_flag, | ||
t.minted_timestamp, | ||
t.last_transfer_timestamp, | ||
t.minter, | ||
l.price, | ||
l.currency, | ||
l.listed_by, | ||
l.created_at as listing_created_at | ||
from nft_metadata md | ||
left join lateral ( | ||
select | ||
t.minted_timestamp, | ||
t.last_transfer_timestamp, | ||
t.minter | ||
from nft_tokens t | ||
where | ||
t.burned_timestamp is null and t.metadata_id = md.id | ||
order by greatest(t.minted_timestamp, t.last_transfer_timestamp) desc | ||
limit 1 | ||
) t on true | ||
left join lateral ( | ||
select | ||
p.price, | ||
p.currency, | ||
p.listed_by, | ||
p.created_at | ||
from nft_listings p | ||
where | ||
p.unlisted_at is null and | ||
p.accepted_at is null and | ||
p.invalidated_at is null and | ||
p.metadata_id = md.id | ||
order by p.price asc | ||
limit 1 | ||
) l on true | ||
where coalesce(t.last_transfer_timestamp, t.minted_timestamp) is not null; |