Skip to content

Commit

Permalink
Add new db table
Browse files Browse the repository at this point in the history
  • Loading branch information
ikprk committed Jul 2, 2024
1 parent 6295379 commit 69076f8
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 5 deletions.
13 changes: 13 additions & 0 deletions db/migrations/1719855101866-Data.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
module.exports = class Data1719855101866 {
name = 'Data1719855101866'

async up(db) {
await db.query(`CREATE TABLE "admin"."user_interaction_count" ("id" character varying NOT NULL, "type" text, "entity_id" text, "day_timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "count" integer NOT NULL, CONSTRAINT "PK_8e334a51febcf02c54dff48147d" PRIMARY KEY ("id"))`)
await db.query(`CREATE INDEX "IDX_b5261af5f3fe48d77086ebc602" ON "admin"."user_interaction_count" ("day_timestamp") `)
}

async down(db) {
await db.query(`DROP TABLE "admin"."user_interaction_count"`)
await db.query(`DROP INDEX "admin"."IDX_b5261af5f3fe48d77086ebc602"`)
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@

const { getViewDefinitions } = require('../viewDefinitions')

module.exports = class Views1709641962433 {
name = 'Views1709641962433'
module.exports = class Views1719855101957 {
name = 'Views1719855101957'

async up(db) {
// these two queries will be invoked and the cleaned up by the squid itself
Expand Down Expand Up @@ -30,15 +30,12 @@ module.exports = class Views1709641962433 {
`);
}
}


}

async down(db) {
const viewDefinitions = this.getViewDefinitions(db)
for (const viewName of Object.keys(viewDefinitions)) {
await db.query(`DROP VIEW "${viewName}"`)
}

}
}
17 changes: 17 additions & 0 deletions schema/events.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -505,3 +505,20 @@ type CreatorTokenRevenueSplitIssuedEventData {
"Details of the revenue split"
revenueShare: RevenueShare
}

type UserInteractionCount @entity @schema(name: "admin") {
"Autoincremented ID"
id: ID!

"Type of the user interaction eg. 'tokenMarketplaceEntry'"
type: String

"ID of the entity that the event is related to for 'tokenMarketplaceEntry' it would be token ID"
entityId: String

"Timestamp of the day that is used to count the interactions"
dayTimestamp: DateTime! @index

"Count of the interactions"
count: Int!
}

0 comments on commit 69076f8

Please sign in to comment.