Skip to content

Commit

Permalink
Merge pull request #266 from kodadot/volumeee
Browse files Browse the repository at this point in the history
volumeee
  • Loading branch information
vikiival committed Aug 11, 2023
2 parents 5adad71 + 66c8638 commit 38fa043
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 0 deletions.
12 changes: 12 additions & 0 deletions db/migrations/1691745365756-Data.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module.exports = class Data1691745365756 {
name = 'Data1691745365756'

async up(db) {
await db.query(`ALTER TABLE "collection_entity" ADD "volume" numeric`)
await db.query(`UPDATE "collection_entity" SET "volume" = 0`)
}

async down(db) {
await db.query(`ALTER TABLE "collection_entity" DROP COLUMN "volume"`)
}
}
1 change: 1 addition & 0 deletions schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ type CollectionEntity @entity {
updatedAt: DateTime!
nftCount: Int!
supply: Int!
volume: BigInt
}

type NFTEntity @entity {
Expand Down
1 change: 1 addition & 0 deletions src/mappings/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ async function mint(context: Context): Promise<void> {
final.updatedAt = timestamp
final.nftCount = 0
final.supply = 0
final.volume = 0n

if (final.metadata) {
const metadata = await handleMetadata(final.metadata, final.name, context.store)
Expand Down
3 changes: 3 additions & 0 deletions src/model/generated/collectionEntity.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,7 @@ export class CollectionEntity {

@Column_("int4", {nullable: false})
supply!: number

@Column_("numeric", {transformer: marshal.bigintTransformer, nullable: true})
volume!: bigint | undefined | null
}

0 comments on commit 38fa043

Please sign in to comment.