Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@
"name": "dotabod",
"private": true,
"workspaces": [
"packages/settings",
"packages/prisma",
"packages/twitch/events",
"packages/twitch/chat",
"packages/dota",
"packages/steam"
],
"scripts": {
"studio": "doppler run -- yarn prisma studio --schema ./packages/prisma/src/postgres.prisma",
"up": "yarn upgrade-interactive",
"devscript": "yarn workspace @dotabod/dota run devscript",
"build": "yarn buildst && yarn buildd && yarn buildtc && yarn buildte",
Expand Down
1 change: 1 addition & 0 deletions packages/dota/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"fix-users-dev-docker": "node --no-warnings -r ts-node/register --loader ts-node/esm src/dev/index.ts"
},
"dependencies": {
"@dotabod/prisma": "1.0.0",
"@node-steam/id": "^1.2.0",
"@supabase/supabase-js": "^2.42.5",
"@twurple/api": "6.0.9",
Expand Down
82 changes: 82 additions & 0 deletions packages/dota/yarn.deploy.lock
Original file line number Diff line number Diff line change
Expand Up @@ -602,6 +602,7 @@ __metadata:
version: 0.0.0-use.local
resolution: "@dotabod/dota@workspace:."
dependencies:
"@dotabod/prisma": 1.0.0
"@faker-js/faker": ^8.4.1
"@jest/globals": ^29.7.0
"@node-steam/id": ^1.2.0
Expand Down Expand Up @@ -664,6 +665,18 @@ __metadata:
languageName: unknown
linkType: soft

"@dotabod/[email protected]":
version: 0.0.0-use.local
resolution: "@dotabod/prisma@workspace:packages/prisma"
dependencies:
"@faker-js/faker": ^8.4.1
"@prisma/client": 5.12.1
"@types/node": ^20.12.7
prisma: 5.12.1
ts-node: ^10.9.2
languageName: unknown
linkType: soft

"@esbuild/aix-ppc64@npm:0.19.11":
version: 0.19.11
resolution: "@esbuild/aix-ppc64@npm:0.19.11"
Expand Down Expand Up @@ -1311,6 +1324,64 @@ __metadata:
languageName: node
linkType: hard

"@prisma/client@npm:5.12.1":
version: 5.12.1
resolution: "@prisma/client@npm:5.12.1"
peerDependencies:
prisma: "*"
peerDependenciesMeta:
prisma:
optional: true
checksum: fcea460faf6256fdb6e948bad87a6fe881dffdc6e1f83f6a34297d17b289b88982bc19c999acf56a6e9de6edda6c46aefe452a069f0aef2ef083329a30ab5508
languageName: node
linkType: hard

"@prisma/debug@npm:5.12.1":
version: 5.12.1
resolution: "@prisma/debug@npm:5.12.1"
checksum: f61e1fafc810959d0ec0f332519cff7937955bba54301f6cf780d4cccfb32e43e7e4bc85b669749a4378fffd20d1ec71780e75b9030fc6b8230948194bfacfd3
languageName: node
linkType: hard

"@prisma/engines-version@npm:5.12.0-21.473ed3124229e22d881cb7addf559799debae1ab":
version: 5.12.0-21.473ed3124229e22d881cb7addf559799debae1ab
resolution: "@prisma/engines-version@npm:5.12.0-21.473ed3124229e22d881cb7addf559799debae1ab"
checksum: d227b5eb99932d078b1ffb44aa6049bd88e261b581468a7b881dce16cf32c42dead15c09d07c3af06a7eef4054f3a6cf0d555dd66e3120d445d28ea67935853d
languageName: node
linkType: hard

"@prisma/engines@npm:5.12.1":
version: 5.12.1
resolution: "@prisma/engines@npm:5.12.1"
dependencies:
"@prisma/debug": 5.12.1
"@prisma/engines-version": 5.12.0-21.473ed3124229e22d881cb7addf559799debae1ab
"@prisma/fetch-engine": 5.12.1
"@prisma/get-platform": 5.12.1
checksum: d216b20c97d2391e1f4411198c0f25e5515bbae2bb4ae7430686983ee53e54ad914365e21407dd02756d4750382ccf35fdb33b50b38db926e6c6466440a41d6c
languageName: node
linkType: hard

"@prisma/fetch-engine@npm:5.12.1":
version: 5.12.1
resolution: "@prisma/fetch-engine@npm:5.12.1"
dependencies:
"@prisma/debug": 5.12.1
"@prisma/engines-version": 5.12.0-21.473ed3124229e22d881cb7addf559799debae1ab
"@prisma/get-platform": 5.12.1
checksum: a1790042581ebaf96504c514dc4d321957ca3636ce61160624f89ee5d2b1691965b2566990749c6df08f6cd02cfd6f7b80646b6fd7fa6f5b883a8a21ab9bf91d
languageName: node
linkType: hard

"@prisma/get-platform@npm:5.12.1":
version: 5.12.1
resolution: "@prisma/get-platform@npm:5.12.1"
dependencies:
"@prisma/debug": 5.12.1
checksum: 3aa901767e343763a7841ddff7a954cafc20b826ebde26bea142d3615b6f260f5fc70fc6e0b96bcc5c3d1e789ba2f9d1651dd242baaff264f401622c119a356c
languageName: node
linkType: hard

"@redis/bloom@npm:1.2.0":
version: 1.2.0
resolution: "@redis/bloom@npm:1.2.0"
Expand Down Expand Up @@ -6836,6 +6907,17 @@ __metadata:
languageName: node
linkType: hard

"prisma@npm:5.12.1":
version: 5.12.1
resolution: "prisma@npm:5.12.1"
dependencies:
"@prisma/engines": 5.12.1
bin:
prisma: build/index.js
checksum: 6f20237779456d61fb908fbba355b3fb64f8c8a6f141bb4800d78b945261f58f3a7e83b2ba1c635dcdef69d6cd3d03400bd4153a253e2c2a2b331bdfd50dd0cd
languageName: node
linkType: hard

"proc-log@npm:^3.0.0":
version: 3.0.0
resolution: "proc-log@npm:3.0.0"
Expand Down
37 changes: 37 additions & 0 deletions packages/prisma/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"name": "@dotabod/prisma",
"version": "1.0.0",
"main": "dist/index.js",
"exports": {
"./dist/mongo/index.js": {
"types": "./dist/mongo/index.d.ts",
"default": "./dist/mongo/index.js"
},
"./dist/psql/index.js": {
"types": "./dist/psql/index.d.ts",
"default": "./dist/psql/index.js"
}
},
"type": "module",
"license": "MIT",
"prisma": {
"seed": "node --loader ts-node/esm ./src/seed.ts"
},
"scripts": {
"build": "prisma generate --schema ./src/mongo.prisma && prisma generate --schema ./src/postgres.prisma",
"pull:mongo": "doppler run -- prisma db pull --schema ./src/mongo.prisma --force",
"pull:psql": "doppler run -- prisma db pull --schema ./src/postgres.prisma",
"push:psql": "doppler run -- prisma db push --schema ./src/postgres.prisma",
"seed": "yarn push:psql && doppler run -- npx prisma db seed",
"reset": "doppler run -- npx prisma migrate reset --schema ./src/postgres.prisma"
},
"devDependencies": {
"@types/node": "^20.12.7",
"prisma": "5.12.1",
"ts-node": "^10.9.2"
},
"dependencies": {
"@faker-js/faker": "^8.4.1",
"@prisma/client": "5.12.1"
}
}
227 changes: 227 additions & 0 deletions packages/prisma/src/mongo.prisma
Original file line number Diff line number Diff line change
@@ -0,0 +1,227 @@
generator client {
provider = "prisma-client-js"
output = "../dist/mongo"
}

datasource db {
provider = "mongodb"
url = env("MONGO_URL")
}

type CardsFavoriteTeamPacked {
high Int
low Int
unsigned Boolean
}

type CardsRecentBattleCupVictory {
account_id Int
division_id Int
skill_level Int
streak Int
team_id Int
tournament_id Int
trophy_id Int
valid_until Int
win_date Int
}

type DelayedGamesBuildings {
destroyed Boolean
/// Multiple data types found: Float: 79.8%, Int: 20.2% out of 34164 sampled entries
heading Json
lane Int
team Int
tier Int
type Int
/// Multiple data types found: Float: 98.8%, Int: 1.2% out of 34164 sampled entries
x Json
/// Multiple data types found: Float: 98.8%, Int: 1.2% out of 34164 sampled entries
y Json
}

type DelayedGamesGraphData {
graph_gold Int[]
}

type DelayedGamesMatch {
bans DelayedGamesMatchBans[]
game_mode Int
game_state Int
game_time Int
league_id Int
league_node_id Int
lobby_type Int
match_id String
picks DelayedGamesMatchPicks[]
server_steam_id String
start_timestamp Int
timestamp Int
}

type DelayedGamesMatchBans {
hero Int
team Int
}

type DelayedGamesMatchPicks {
hero Int
team Int
}

type DelayedGamesTeams {
net_worth Int
players DelayedGamesTeamsPlayers[]
score Int
team_id Int
team_logo String
team_logo_url String
team_name String
team_number Int
team_tag String
}

type DelayedGamesTeamsPlayers {
abilities Int[]
accountid Int
assists_count Int
death_count Int
denies_count Int
gold Int
heroid Int
items Int[]
kill_count Int
level Int
lh_count Int
name String
net_worth Int
playerid Int
team Int
team_slot Int
/// Multiple data types found: Float: 94.6%, Int: 5.4% out of 10000 sampled entries
x Json
/// Multiple data types found: Float: 94.6%, Int: 5.4% out of 10000 sampled entries
y Json
}

model cards {
id String @id @default(auto()) @map("_id") @db.ObjectId
account_id Int
badge_points Int
createdAt DateTime @db.Date
event_id Int?
event_points Int?
favorite_team_packed CardsFavoriteTeamPacked
/// Field referred in an index, but found no data to define the type.
id_ Json? @map("id")
is_plus_subscriber Boolean
leaderboard_rank Int
/// Could not determine type: the field only had null or empty values in the sample set.
leaderboard_rank_core Json?
lifetime_games Int
plus_original_start_date Int
/// Could not determine type: the field only had null or empty values in the sample set.
previous_rank_tier Json?
rank_tier Int
/// Could not determine type: the field only had null or empty values in the sample set.
rank_tier_mmr_type Json?
/// Could not determine type: the field only had null or empty values in the sample set.
rank_tier_peak Json?
/// Could not determine type: the field only had null or empty values in the sample set.
rank_tier_score Json?
recent_battle_cup_victory CardsRecentBattleCupVictory?
/// Could not determine type: the field only had null or empty values in the sample set.
slots Json?
/// Could not determine type: the field only had null or empty values in the sample set.
title Json?

@@index([createdAt(sort: Desc)], map: "createdAt_-1")
@@index([id], map: "id_1")
}

model commandstats {
id String @id @default(auto()) @map("_id") @db.ObjectId
channel String
channelId String
command String
count Int
date String

@@index([channel, command, date], map: "channel_1_command_1_date_1_autocreated")
}

model delayedGames {
id String @id @default(auto()) @map("_id") @db.ObjectId
buildings DelayedGamesBuildings[]
createdAt DateTime @db.Date
delta_frame Boolean?
graph_data DelayedGamesGraphData
match DelayedGamesMatch
teams DelayedGamesTeams[]

@@index([match.match_id], map: "match.match_id_1")
@@index([teams.players.accountid], map: "teams.players.accountid_1")
@@index([createdAt(sort: Desc)], map: "createdAt_-1")
}

model gameModes {
id String @id @default(auto()) @map("_id") @db.ObjectId
id_ Int @map("id")
name String

@@index([id], map: "id_1")
}

model heroes {
id String @id @default(auto()) @map("_id") @db.ObjectId
/// Field referred in an index, but found no data to define the type.
custom Json?
id_ Int @map("id")
localized_name String

@@index([id], map: "id_1")
@@index([custom, localized_name], map: "custom_1_localized_name_1")
}

model medals {
id String @id @default(auto()) @map("_id") @db.ObjectId
name String
rank_tier Int

@@index([rank_tier], map: "rank_tier_1")
}

model notablePlayers {
id String @id @default(auto()) @map("_id") @db.ObjectId
/// Multiple data types found: Float: 0.3%, Int: 99.7% out of 1000 sampled entries
account_id Json
addedBy String?
avatar String?
avatarfull String?
avatarmedium String?
channel String?
cheese Int?
country_code String?
createdAt DateTime? @db.Date
fantasy_role Int?
fh_unavailable Boolean?
full_history_time String?
is_locked Boolean?
is_pro Boolean?
last_login String?
last_match_time String?
loccountrycode String?
/// Could not determine type: the field only had null or empty values in the sample set.
locked_until Json?
name String
personaname String?
plus Boolean?
profileurl String?
steamid String?
team_id Int?
team_name String?
team_tag String?

@@index([account_id], map: "account_id_1")
@@index([channel], map: "channel_1")
}
Loading