-
Notifications
You must be signed in to change notification settings - Fork 108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NFT Database Schema #2070
NFT Database Schema #2070
Conversation
Signed-off-by: Ian Jungmann <ian.jungmann@hedera.com>
Signed-off-by: Ian Jungmann <ian.jungmann@hedera.com>
Signed-off-by: Ian Jungmann <ian.jungmann@hedera.com>
Codecov Report
@@ Coverage Diff @@
## master #2070 +/- ##
============================================
- Coverage 87.05% 79.44% -7.61%
- Complexity 1744 1919 +175
============================================
Files 315 377 +62
Lines 7731 9304 +1573
Branches 740 879 +139
============================================
+ Hits 6730 7392 +662
- Misses 772 1649 +877
- Partials 229 263 +34
Continue to review full report at Codecov.
|
Signed-off-by: Ian Jungmann <ian.jungmann@hedera.com>
|
||
-- Update the token table | ||
alter table token | ||
add column max_supply bigint not null default 9223372036854775807, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Max long
hedera-mirror-importer/src/main/resources/db/migration/v2/V2.0.0__time_scale_init.sql
Outdated
Show resolved
Hide resolved
|
||
-- Insert new response codes | ||
insert into t_transaction_results (result, proto_id) | ||
values ('ACCOUNT_EXPIRED_AND_PENDING_REMOVAL', 223), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one isn't part of the NFT protobufs change, but I noticed we were missing it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some discrepancies on the type
. Also left some nits.
alter table token | ||
add column max_supply bigint not null default 9223372036854775807, -- max long | ||
add column supply_type character varying(10) not null default 'INFINITE', | ||
add column type character varying(20) not null default 'NON_FUNGIBLE_UNIQUE'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe the default should be FUNGIBLE_COMMON
add column type character varying(20) not null default 'NON_FUNGIBLE_UNIQUE'; | |
add column type character varying(20) not null default 'FUNGIBLE_COMMON'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct, not sure why I got that swapped. Fixed.
); | ||
create unique index if not exists nft__token_id_serial_num | ||
on nft (token_id, serial_number); | ||
comment on table nft is 'NFT'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Something more suggestive. Template suggestions below that you can modify.
comment on table nft is 'NFT'; | |
comment on table nft is 'Non Fungible Tokens (NFTs) minted on network'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like that, just made Non Fungible
into Non-Fungible
symbol character varying(100) not null, | ||
total_supply bigint not null default 0, | ||
treasury_account_id bigint not null, | ||
type character varying(20) not null default 'NON_FUNGIBLE_UNIQUE', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same thing above, this should be FUNGIBLE_COMMON
right?
type character varying(20) not null default 'NON_FUNGIBLE_UNIQUE', | |
type character varying(20) not null default 'FUNGIBLE_COMMON', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, fixed.
hedera-mirror-importer/src/main/resources/db/migration/v1/V1.39.0__support_nfts.sql
Outdated
Show resolved
Hide resolved
hedera-mirror-importer/src/main/resources/db/migration/v1/V1.39.0__support_nfts.sql
Outdated
Show resolved
Hide resolved
hedera-mirror-importer/src/main/resources/db/migration/v1/V1.39.0__support_nfts.sql
Outdated
Show resolved
Hide resolved
hedera-mirror-importer/src/main/resources/db/migration/v1/V1.39.0__support_nfts.sql
Outdated
Show resolved
Hide resolved
Signed-off-by: Ian Jungmann <ian.jungmann@hedera.com>
Signed-off-by: Ian Jungmann <ian.jungmann@hedera.com>
SonarCloud Quality Gate failed. |
-- Create enums for tables | ||
CREATE TYPE token_supply_type AS ENUM ('INFINITE', 'FINITE'); | ||
CREATE TYPE token_type AS ENUM ('FUNGIBLE_COMMON', 'NON_FUNGIBLE_UNIQUE'); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any opinions on creating all enums at the top vs. creating them in their corresponding table sections?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Create at top in one group as you're doing so that the data types exist prior to table definitions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Let's get it in and unblock the next tasks.
Detailed description:
Add Flyway migrations to support NFTs (based on NFT design doc)
token
table with new valuesnft
andnft_transfer
tables, indexes, etc.Which issue(s) this PR fixes:
Fixes #2056
Special notes for your reviewer:
Checklist