setup prisma<>sqlite
This commit is contained in:
@@ -6,4 +6,5 @@ README.md
|
|||||||
.vinxi
|
.vinxi
|
||||||
.git
|
.git
|
||||||
.gitignore
|
.gitignore
|
||||||
.dockerignore
|
.dockerignore
|
||||||
|
*.db
|
||||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,5 +1,6 @@
|
|||||||
.output
|
.output
|
||||||
.vinxi
|
.vinxi
|
||||||
|
*.db
|
||||||
|
|
||||||
# ---> Node
|
# ---> Node
|
||||||
# Logs
|
# Logs
|
||||||
|
|||||||
@@ -1,14 +0,0 @@
|
|||||||
version: "3.8"
|
|
||||||
services:
|
|
||||||
arangodb:
|
|
||||||
image: arangodb/arangodb:latest
|
|
||||||
ports:
|
|
||||||
- "8529:8529"
|
|
||||||
environment:
|
|
||||||
ARANGO_ROOT_PASSWORD: pass
|
|
||||||
volumes:
|
|
||||||
- arangodb_data:/var/lib/arangodb3
|
|
||||||
- arangodb_apps:/var/lib/arangodb3-apps
|
|
||||||
volumes:
|
|
||||||
arangodb_data:
|
|
||||||
arangodb_apps:
|
|
||||||
19
migrations/20250805231347_init/migration.sql
Normal file
19
migrations/20250805231347_init/migration.sql
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
-- CreateTable
|
||||||
|
CREATE TABLE "Game" (
|
||||||
|
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
|
||||||
|
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
"updatedAt" DATETIME NOT NULL,
|
||||||
|
"name" TEXT NOT NULL,
|
||||||
|
"rules" TEXT
|
||||||
|
);
|
||||||
|
|
||||||
|
-- CreateTable
|
||||||
|
CREATE TABLE "Instance" (
|
||||||
|
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
|
||||||
|
"gameId" INTEGER NOT NULL,
|
||||||
|
"gameState" JSONB NOT NULL,
|
||||||
|
CONSTRAINT "Instance_gameId_fkey" FOREIGN KEY ("gameId") REFERENCES "Game" ("id") ON DELETE RESTRICT ON UPDATE CASCADE
|
||||||
|
);
|
||||||
|
|
||||||
|
-- CreateIndex
|
||||||
|
CREATE UNIQUE INDEX "Game_name_key" ON "Game"("name");
|
||||||
3
migrations/migration_lock.toml
Normal file
3
migrations/migration_lock.toml
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
# Please do not edit this file manually
|
||||||
|
# It should be added in your version-control system (e.g., Git)
|
||||||
|
provider = "sqlite"
|
||||||
@@ -3,12 +3,13 @@
|
|||||||
"type": "module",
|
"type": "module",
|
||||||
"version": "0.0.2",
|
"version": "0.0.2",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vinxi dev",
|
"dev": "concurrently 'vinxi dev' 'pnpm dlx prisma studio --browser none'",
|
||||||
"build": "vinxi build",
|
"build": "vinxi build",
|
||||||
"start": "vinxi start",
|
"start": "vinxi start",
|
||||||
"sync_db": "tsx ./sync_db.ts"
|
"sync_db": "concurrently 'pnpm dlx prisma generate' 'pnpm dlx prisma migrate dev'"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@prisma/client": "6.13.0",
|
||||||
"@solidjs/router": "^0.15.3",
|
"@solidjs/router": "^0.15.3",
|
||||||
"@solidjs/start": "^1.1.0",
|
"@solidjs/start": "^1.1.0",
|
||||||
"arangojs": "^10.1.2",
|
"arangojs": "^10.1.2",
|
||||||
@@ -20,7 +21,9 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/json-schema": "^7.0.15",
|
"@types/json-schema": "^7.0.15",
|
||||||
|
"concurrently": "^9.2.0",
|
||||||
"json-schema": "^0.4.0",
|
"json-schema": "^0.4.0",
|
||||||
|
"prisma": "6.13.0",
|
||||||
"tsx": "^4.20.3"
|
"tsx": "^4.20.3"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
190
pnpm-lock.yaml
generated
190
pnpm-lock.yaml
generated
@@ -8,6 +8,9 @@ importers:
|
|||||||
|
|
||||||
.:
|
.:
|
||||||
dependencies:
|
dependencies:
|
||||||
|
'@prisma/client':
|
||||||
|
specifier: 6.13.0
|
||||||
|
version: 6.13.0(prisma@6.13.0(magicast@0.3.5)(typescript@5.8.3))(typescript@5.8.3)
|
||||||
'@solidjs/router':
|
'@solidjs/router':
|
||||||
specifier: ^0.15.3
|
specifier: ^0.15.3
|
||||||
version: 0.15.3(solid-js@1.9.7)
|
version: 0.15.3(solid-js@1.9.7)
|
||||||
@@ -27,9 +30,15 @@ importers:
|
|||||||
'@types/json-schema':
|
'@types/json-schema':
|
||||||
specifier: ^7.0.15
|
specifier: ^7.0.15
|
||||||
version: 7.0.15
|
version: 7.0.15
|
||||||
|
concurrently:
|
||||||
|
specifier: ^9.2.0
|
||||||
|
version: 9.2.0
|
||||||
json-schema:
|
json-schema:
|
||||||
specifier: ^0.4.0
|
specifier: ^0.4.0
|
||||||
version: 0.4.0
|
version: 0.4.0
|
||||||
|
prisma:
|
||||||
|
specifier: 6.13.0
|
||||||
|
version: 6.13.0(magicast@0.3.5)(typescript@5.8.3)
|
||||||
tsx:
|
tsx:
|
||||||
specifier: ^4.20.3
|
specifier: ^4.20.3
|
||||||
version: 4.20.3
|
version: 4.20.3
|
||||||
@@ -698,6 +707,36 @@ packages:
|
|||||||
'@poppinss/exception@1.2.2':
|
'@poppinss/exception@1.2.2':
|
||||||
resolution: {integrity: sha512-m7bpKCD4QMlFCjA/nKTs23fuvoVFoA83brRKmObCUNmi/9tVu8Ve3w4YQAnJu4q3Tjf5fr685HYIC/IA2zHRSg==}
|
resolution: {integrity: sha512-m7bpKCD4QMlFCjA/nKTs23fuvoVFoA83brRKmObCUNmi/9tVu8Ve3w4YQAnJu4q3Tjf5fr685HYIC/IA2zHRSg==}
|
||||||
|
|
||||||
|
'@prisma/client@6.13.0':
|
||||||
|
resolution: {integrity: sha512-8m2+I3dQovkV8CkDMluiwEV1TxV9EXdT6xaCz39O6jYw7mkf5gwfmi+cL4LJsEPwz5tG7sreBwkRpEMJedGYUQ==}
|
||||||
|
engines: {node: '>=18.18'}
|
||||||
|
peerDependencies:
|
||||||
|
prisma: '*'
|
||||||
|
typescript: '>=5.1.0'
|
||||||
|
peerDependenciesMeta:
|
||||||
|
prisma:
|
||||||
|
optional: true
|
||||||
|
typescript:
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
'@prisma/config@6.13.0':
|
||||||
|
resolution: {integrity: sha512-OYMM+pcrvj/NqNWCGESSxVG3O7kX6oWuGyvufTUNnDw740KIQvNyA4v0eILgkpuwsKIDU36beZCkUtIt0naTog==}
|
||||||
|
|
||||||
|
'@prisma/debug@6.13.0':
|
||||||
|
resolution: {integrity: sha512-um+9pfKJW0ihmM83id9FXGi5qEbVJ0Vxi1Gm0xpYsjwUBnw6s2LdPBbrsG9QXRX46K4CLWCTNvskXBup4i9hlw==}
|
||||||
|
|
||||||
|
'@prisma/engines-version@6.13.0-35.361e86d0ea4987e9f53a565309b3eed797a6bcbd':
|
||||||
|
resolution: {integrity: sha512-MpPyKSzBX7P/ZY9odp9TSegnS/yH3CSbchQE9f0yBg3l2QyN59I6vGXcoYcqKC9VTniS1s18AMmhyr1OWavjHg==}
|
||||||
|
|
||||||
|
'@prisma/engines@6.13.0':
|
||||||
|
resolution: {integrity: sha512-D+1B79LFvtWA0KTt8ALekQ6A/glB9w10ETknH5Y9g1k2NYYQOQy93ffiuqLn3Pl6IPJG3EsK/YMROKEaq8KBrA==}
|
||||||
|
|
||||||
|
'@prisma/fetch-engine@6.13.0':
|
||||||
|
resolution: {integrity: sha512-grmmq+4FeFKmaaytA8Ozc2+Tf3BC8xn/DVJos6LL022mfRlMZYjT3hZM0/xG7+5fO95zFG9CkDUs0m1S2rXs5Q==}
|
||||||
|
|
||||||
|
'@prisma/get-platform@6.13.0':
|
||||||
|
resolution: {integrity: sha512-Nii2pX50fY4QKKxQwm7/vvqT6Ku8yYJLZAFX4e2vzHwRdMqjugcOG5hOSLjxqoXb0cvOspV70TOhMzrw8kqAnw==}
|
||||||
|
|
||||||
'@rollup/plugin-alias@5.1.1':
|
'@rollup/plugin-alias@5.1.1':
|
||||||
resolution: {integrity: sha512-PR9zDb+rOzkRb2VD+EuKB7UC41vU5DIwZ5qqCpk0KJudcWAyi8rvYOhS7+L5aZCspw1stTViLgN5v6FF1p5cgQ==}
|
resolution: {integrity: sha512-PR9zDb+rOzkRb2VD+EuKB7UC41vU5DIwZ5qqCpk0KJudcWAyi8rvYOhS7+L5aZCspw1stTViLgN5v6FF1p5cgQ==}
|
||||||
engines: {node: '>=14.0.0'}
|
engines: {node: '>=14.0.0'}
|
||||||
@@ -912,6 +951,9 @@ packages:
|
|||||||
'@speed-highlight/core@1.2.7':
|
'@speed-highlight/core@1.2.7':
|
||||||
resolution: {integrity: sha512-0dxmVj4gxg3Jg879kvFS/msl4s9F3T9UXC1InxgOf7t5NvcPD97u/WTA5vL/IxWHMn7qSxBozqrnnE2wvl1m8g==}
|
resolution: {integrity: sha512-0dxmVj4gxg3Jg879kvFS/msl4s9F3T9UXC1InxgOf7t5NvcPD97u/WTA5vL/IxWHMn7qSxBozqrnnE2wvl1m8g==}
|
||||||
|
|
||||||
|
'@standard-schema/spec@1.0.0':
|
||||||
|
resolution: {integrity: sha512-m2bOd0f2RT9k8QJx1JN85cZYyH1RqFBdlwtkSlf4tBDYLCiiZnv1fIIwacK6cqwXavOydf0NPToMQgpKq+dVlA==}
|
||||||
|
|
||||||
'@tanstack/directive-functions-plugin@1.121.21':
|
'@tanstack/directive-functions-plugin@1.121.21':
|
||||||
resolution: {integrity: sha512-B9z/HbF7gJBaRHieyX7f2uQ4LpLLAVAEutBZipH6w+CYD6RHRJvSVPzECGHF7icFhNWTiJQL2QR6K07s59yzEw==}
|
resolution: {integrity: sha512-B9z/HbF7gJBaRHieyX7f2uQ4LpLLAVAEutBZipH6w+CYD6RHRJvSVPzECGHF7icFhNWTiJQL2QR6K07s59yzEw==}
|
||||||
engines: {node: '>=12'}
|
engines: {node: '>=12'}
|
||||||
@@ -1248,6 +1290,10 @@ packages:
|
|||||||
ccount@2.0.1:
|
ccount@2.0.1:
|
||||||
resolution: {integrity: sha512-eyrF0jiFpY+3drT6383f1qhkbGsLSifNAjA61IUjZjmLCWjItY6LB9ft9YhoDgwfmclB2zhu51Lc7+95b8NRAg==}
|
resolution: {integrity: sha512-eyrF0jiFpY+3drT6383f1qhkbGsLSifNAjA61IUjZjmLCWjItY6LB9ft9YhoDgwfmclB2zhu51Lc7+95b8NRAg==}
|
||||||
|
|
||||||
|
chalk@4.1.2:
|
||||||
|
resolution: {integrity: sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==}
|
||||||
|
engines: {node: '>=10'}
|
||||||
|
|
||||||
chalk@5.4.1:
|
chalk@5.4.1:
|
||||||
resolution: {integrity: sha512-zgVZuo2WcZgfUEmsn6eO3kINexW8RAE4maiQ8QNs8CtpPCSyMiYsULR3HQYkm3w8FIA3SberyMJMSldGsW+U3w==}
|
resolution: {integrity: sha512-zgVZuo2WcZgfUEmsn6eO3kINexW8RAE4maiQ8QNs8CtpPCSyMiYsULR3HQYkm3w8FIA3SberyMJMSldGsW+U3w==}
|
||||||
engines: {node: ^12.17.0 || ^14.13 || >=16.0.0}
|
engines: {node: ^12.17.0 || ^14.13 || >=16.0.0}
|
||||||
@@ -1334,6 +1380,11 @@ packages:
|
|||||||
resolution: {integrity: sha512-6FqVXeETqWPoGcfzrXb37E50NP0LXT8kAMu5ooZayhWWdgEY4lBEEcbQNXtkuKQsGduxiIcI4gOTsxTmuq/bSg==}
|
resolution: {integrity: sha512-6FqVXeETqWPoGcfzrXb37E50NP0LXT8kAMu5ooZayhWWdgEY4lBEEcbQNXtkuKQsGduxiIcI4gOTsxTmuq/bSg==}
|
||||||
engines: {node: '>= 14'}
|
engines: {node: '>= 14'}
|
||||||
|
|
||||||
|
concurrently@9.2.0:
|
||||||
|
resolution: {integrity: sha512-IsB/fiXTupmagMW4MNp2lx2cdSN2FfZq78vF90LBB+zZHArbIQZjQtzXCiXnvTxCZSvXanTqFLWBjw2UkLx1SQ==}
|
||||||
|
engines: {node: '>=18'}
|
||||||
|
hasBin: true
|
||||||
|
|
||||||
confbox@0.1.8:
|
confbox@0.1.8:
|
||||||
resolution: {integrity: sha512-RMtmw0iFkeR4YV+fUOSucriAQNb9g8zFR52MWCtl+cCZOFRNL6zeB395vPzFhEjjn4fMxXudmELnl/KF/WrK6w==}
|
resolution: {integrity: sha512-RMtmw0iFkeR4YV+fUOSucriAQNb9g8zFR52MWCtl+cCZOFRNL6zeB395vPzFhEjjn4fMxXudmELnl/KF/WrK6w==}
|
||||||
|
|
||||||
@@ -1441,6 +1492,10 @@ packages:
|
|||||||
decache@4.6.2:
|
decache@4.6.2:
|
||||||
resolution: {integrity: sha512-2LPqkLeu8XWHU8qNCS3kcF6sCcb5zIzvWaAHYSvPfwhdd7mHuah29NssMzrTYyHN4F5oFy2ko9OBYxegtU0FEw==}
|
resolution: {integrity: sha512-2LPqkLeu8XWHU8qNCS3kcF6sCcb5zIzvWaAHYSvPfwhdd7mHuah29NssMzrTYyHN4F5oFy2ko9OBYxegtU0FEw==}
|
||||||
|
|
||||||
|
deepmerge-ts@7.1.5:
|
||||||
|
resolution: {integrity: sha512-HOJkrhaYsweh+W+e74Yn7YStZOilkoPb6fycpwNLKzSPtruFs48nYis0zy5yJz1+ktUhHxoRDJ27RQAWLIJVJw==}
|
||||||
|
engines: {node: '>=16.0.0'}
|
||||||
|
|
||||||
deepmerge@4.3.1:
|
deepmerge@4.3.1:
|
||||||
resolution: {integrity: sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==}
|
resolution: {integrity: sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==}
|
||||||
engines: {node: '>=0.10.0'}
|
engines: {node: '>=0.10.0'}
|
||||||
@@ -1551,6 +1606,9 @@ packages:
|
|||||||
ee-first@1.1.1:
|
ee-first@1.1.1:
|
||||||
resolution: {integrity: sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==}
|
resolution: {integrity: sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==}
|
||||||
|
|
||||||
|
effect@3.16.12:
|
||||||
|
resolution: {integrity: sha512-N39iBk0K71F9nb442TLbTkjl24FLUzuvx2i1I2RsEAQsdAdUTuUoW0vlfUXgkMTUOnYqKnWcFfqw4hK4Pw27hg==}
|
||||||
|
|
||||||
electron-to-chromium@1.5.192:
|
electron-to-chromium@1.5.192:
|
||||||
resolution: {integrity: sha512-rP8Ez0w7UNw/9j5eSXCe10o1g/8B1P5SM90PCCMVkIRQn2R0LEHWz4Eh9RnxkniuDe1W0cTSOB3MLlkTGDcuCg==}
|
resolution: {integrity: sha512-rP8Ez0w7UNw/9j5eSXCe10o1g/8B1P5SM90PCCMVkIRQn2R0LEHWz4Eh9RnxkniuDe1W0cTSOB3MLlkTGDcuCg==}
|
||||||
|
|
||||||
@@ -1689,6 +1747,10 @@ packages:
|
|||||||
engines: {node: '>= 10.17.0'}
|
engines: {node: '>= 10.17.0'}
|
||||||
hasBin: true
|
hasBin: true
|
||||||
|
|
||||||
|
fast-check@3.23.2:
|
||||||
|
resolution: {integrity: sha512-h5+1OzzfCC3Ef7VbtKdcv7zsstUQwUDlYpUTvjeUsJAssPgLn7QzbboPtL5ro04Mq0rPOsMzl7q5hIbRs2wD1A==}
|
||||||
|
engines: {node: '>=8.0.0'}
|
||||||
|
|
||||||
fast-fifo@1.3.2:
|
fast-fifo@1.3.2:
|
||||||
resolution: {integrity: sha512-/d9sfos4yxzpwkDkuN7k2SqFKtYNmCTzgfEpz82x34IM9/zc8KGxQoXg1liNC/izpRM/MBdt44Nmx41ZWqk+FQ==}
|
resolution: {integrity: sha512-/d9sfos4yxzpwkDkuN7k2SqFKtYNmCTzgfEpz82x34IM9/zc8KGxQoXg1liNC/izpRM/MBdt44Nmx41ZWqk+FQ==}
|
||||||
|
|
||||||
@@ -1845,6 +1907,10 @@ packages:
|
|||||||
h3@1.15.3:
|
h3@1.15.3:
|
||||||
resolution: {integrity: sha512-z6GknHqyX0h9aQaTx22VZDf6QyZn+0Nh+Ym8O/u0SGSkyF5cuTJYKlc8MkzW3Nzf9LE1ivcpmYC3FUGpywhuUQ==}
|
resolution: {integrity: sha512-z6GknHqyX0h9aQaTx22VZDf6QyZn+0Nh+Ym8O/u0SGSkyF5cuTJYKlc8MkzW3Nzf9LE1ivcpmYC3FUGpywhuUQ==}
|
||||||
|
|
||||||
|
has-flag@4.0.0:
|
||||||
|
resolution: {integrity: sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==}
|
||||||
|
engines: {node: '>=8'}
|
||||||
|
|
||||||
has-symbols@1.1.0:
|
has-symbols@1.1.0:
|
||||||
resolution: {integrity: sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==}
|
resolution: {integrity: sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==}
|
||||||
engines: {node: '>= 0.4'}
|
engines: {node: '>= 0.4'}
|
||||||
@@ -2478,6 +2544,16 @@ packages:
|
|||||||
resolution: {integrity: sha512-mQUvGU6aUFQ+rNvTIAcZuWGRT9a6f6Yrg9bHs4ImKF+HZCEK+plBvnAZYSIQztknZF2qnzNtr6F8s0+IuptdlQ==}
|
resolution: {integrity: sha512-mQUvGU6aUFQ+rNvTIAcZuWGRT9a6f6Yrg9bHs4ImKF+HZCEK+plBvnAZYSIQztknZF2qnzNtr6F8s0+IuptdlQ==}
|
||||||
engines: {node: ^14.13.1 || >=16.0.0}
|
engines: {node: ^14.13.1 || >=16.0.0}
|
||||||
|
|
||||||
|
prisma@6.13.0:
|
||||||
|
resolution: {integrity: sha512-dfzORf0AbcEyyzxuv2lEwG8g+WRGF/qDQTpHf/6JoHsyF5MyzCEZwClVaEmw3WXcobgadosOboKUgQU0kFs9kw==}
|
||||||
|
engines: {node: '>=18.18'}
|
||||||
|
hasBin: true
|
||||||
|
peerDependencies:
|
||||||
|
typescript: '>=5.1.0'
|
||||||
|
peerDependenciesMeta:
|
||||||
|
typescript:
|
||||||
|
optional: true
|
||||||
|
|
||||||
process-nextick-args@2.0.1:
|
process-nextick-args@2.0.1:
|
||||||
resolution: {integrity: sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==}
|
resolution: {integrity: sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==}
|
||||||
|
|
||||||
@@ -2491,6 +2567,9 @@ packages:
|
|||||||
pump@3.0.3:
|
pump@3.0.3:
|
||||||
resolution: {integrity: sha512-todwxLMY7/heScKmntwQG8CXVkWUOdYxIvY2s0VWAAMh/nd8SoYiRaKjlr7+iCs984f2P8zvrfWcDDYVb73NfA==}
|
resolution: {integrity: sha512-todwxLMY7/heScKmntwQG8CXVkWUOdYxIvY2s0VWAAMh/nd8SoYiRaKjlr7+iCs984f2P8zvrfWcDDYVb73NfA==}
|
||||||
|
|
||||||
|
pure-rand@6.1.0:
|
||||||
|
resolution: {integrity: sha512-bVWawvoZoBYpp6yIoQtQXHZjmz35RSVHnUOTefl8Vcjr8snTPY1wnpSPMWekcFwbxI6gtmT7rSYPFvz71ldiOA==}
|
||||||
|
|
||||||
qs@6.14.0:
|
qs@6.14.0:
|
||||||
resolution: {integrity: sha512-YWWTjgABSKcvs/nWBi9PycY/JiPJqOD4JA6o9Sej2AtvSGarXxKC3OQSk4pAarbdQlKAh5D4FCQkJNkW+GAn3w==}
|
resolution: {integrity: sha512-YWWTjgABSKcvs/nWBi9PycY/JiPJqOD4JA6o9Sej2AtvSGarXxKC3OQSk4pAarbdQlKAh5D4FCQkJNkW+GAn3w==}
|
||||||
engines: {node: '>=0.6'}
|
engines: {node: '>=0.6'}
|
||||||
@@ -2618,6 +2697,9 @@ packages:
|
|||||||
run-parallel@1.2.0:
|
run-parallel@1.2.0:
|
||||||
resolution: {integrity: sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==}
|
resolution: {integrity: sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==}
|
||||||
|
|
||||||
|
rxjs@7.8.2:
|
||||||
|
resolution: {integrity: sha512-dhKf903U/PQZY6boNNtAGdWbG85WAbjT/1xYoZIC7FAY0yWapOBQVsVrDl58W86//e1VpMNBtRV4MaXfdMySFA==}
|
||||||
|
|
||||||
safe-buffer@5.1.2:
|
safe-buffer@5.1.2:
|
||||||
resolution: {integrity: sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==}
|
resolution: {integrity: sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==}
|
||||||
|
|
||||||
@@ -2683,6 +2765,10 @@ packages:
|
|||||||
resolution: {integrity: sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==}
|
resolution: {integrity: sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==}
|
||||||
engines: {node: '>=8'}
|
engines: {node: '>=8'}
|
||||||
|
|
||||||
|
shell-quote@1.8.3:
|
||||||
|
resolution: {integrity: sha512-ObmnIF4hXNg1BqhnHmgbDETF8dLPCggZWBjkQfhZpbszZnYur5DUljTcCHii5LC3J5E0yeO/1LIMyH+UvHQgyw==}
|
||||||
|
engines: {node: '>= 0.4'}
|
||||||
|
|
||||||
shiki@1.29.2:
|
shiki@1.29.2:
|
||||||
resolution: {integrity: sha512-njXuliz/cP+67jU2hukkxCNuH1yUi4QfdZZY+sMr5PPrIyXSu5iTb/qYC4BiWWB0vZ+7TbdvYUCeL23zpwCfbg==}
|
resolution: {integrity: sha512-njXuliz/cP+67jU2hukkxCNuH1yUi4QfdZZY+sMr5PPrIyXSu5iTb/qYC4BiWWB0vZ+7TbdvYUCeL23zpwCfbg==}
|
||||||
|
|
||||||
@@ -2823,6 +2909,14 @@ packages:
|
|||||||
resolution: {integrity: sha512-HRVVSbCCMbj7/kdWF9Q+bbckjBHLtHMEoJWlkmYzzdwhYMkjkOwubLM6t7NbWKjgKamGDrWL1++KrjUO1t9oAQ==}
|
resolution: {integrity: sha512-HRVVSbCCMbj7/kdWF9Q+bbckjBHLtHMEoJWlkmYzzdwhYMkjkOwubLM6t7NbWKjgKamGDrWL1++KrjUO1t9oAQ==}
|
||||||
engines: {node: '>=18'}
|
engines: {node: '>=18'}
|
||||||
|
|
||||||
|
supports-color@7.2.0:
|
||||||
|
resolution: {integrity: sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==}
|
||||||
|
engines: {node: '>=8'}
|
||||||
|
|
||||||
|
supports-color@8.1.1:
|
||||||
|
resolution: {integrity: sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==}
|
||||||
|
engines: {node: '>=10'}
|
||||||
|
|
||||||
supports-preserve-symlinks-flag@1.0.0:
|
supports-preserve-symlinks-flag@1.0.0:
|
||||||
resolution: {integrity: sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==}
|
resolution: {integrity: sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==}
|
||||||
engines: {node: '>= 0.4'}
|
engines: {node: '>= 0.4'}
|
||||||
@@ -2886,6 +2980,10 @@ packages:
|
|||||||
tr46@0.0.3:
|
tr46@0.0.3:
|
||||||
resolution: {integrity: sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==}
|
resolution: {integrity: sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==}
|
||||||
|
|
||||||
|
tree-kill@1.2.2:
|
||||||
|
resolution: {integrity: sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A==}
|
||||||
|
hasBin: true
|
||||||
|
|
||||||
trim-lines@3.0.1:
|
trim-lines@3.0.1:
|
||||||
resolution: {integrity: sha512-kRj8B+YHZCc9kQYdWfJB2/oUl9rA99qbowYYBtr4ui4mZyAQ2JpvVBd/6U2YloATfqBhBTSMhTpgBHtU0Mf3Rg==}
|
resolution: {integrity: sha512-kRj8B+YHZCc9kQYdWfJB2/oUl9rA99qbowYYBtr4ui4mZyAQ2JpvVBd/6U2YloATfqBhBTSMhTpgBHtU0Mf3Rg==}
|
||||||
|
|
||||||
@@ -3868,6 +3966,41 @@ snapshots:
|
|||||||
|
|
||||||
'@poppinss/exception@1.2.2': {}
|
'@poppinss/exception@1.2.2': {}
|
||||||
|
|
||||||
|
'@prisma/client@6.13.0(prisma@6.13.0(magicast@0.3.5)(typescript@5.8.3))(typescript@5.8.3)':
|
||||||
|
optionalDependencies:
|
||||||
|
prisma: 6.13.0(magicast@0.3.5)(typescript@5.8.3)
|
||||||
|
typescript: 5.8.3
|
||||||
|
|
||||||
|
'@prisma/config@6.13.0(magicast@0.3.5)':
|
||||||
|
dependencies:
|
||||||
|
c12: 3.1.0(magicast@0.3.5)
|
||||||
|
deepmerge-ts: 7.1.5
|
||||||
|
effect: 3.16.12
|
||||||
|
read-package-up: 11.0.0
|
||||||
|
transitivePeerDependencies:
|
||||||
|
- magicast
|
||||||
|
|
||||||
|
'@prisma/debug@6.13.0': {}
|
||||||
|
|
||||||
|
'@prisma/engines-version@6.13.0-35.361e86d0ea4987e9f53a565309b3eed797a6bcbd': {}
|
||||||
|
|
||||||
|
'@prisma/engines@6.13.0':
|
||||||
|
dependencies:
|
||||||
|
'@prisma/debug': 6.13.0
|
||||||
|
'@prisma/engines-version': 6.13.0-35.361e86d0ea4987e9f53a565309b3eed797a6bcbd
|
||||||
|
'@prisma/fetch-engine': 6.13.0
|
||||||
|
'@prisma/get-platform': 6.13.0
|
||||||
|
|
||||||
|
'@prisma/fetch-engine@6.13.0':
|
||||||
|
dependencies:
|
||||||
|
'@prisma/debug': 6.13.0
|
||||||
|
'@prisma/engines-version': 6.13.0-35.361e86d0ea4987e9f53a565309b3eed797a6bcbd
|
||||||
|
'@prisma/get-platform': 6.13.0
|
||||||
|
|
||||||
|
'@prisma/get-platform@6.13.0':
|
||||||
|
dependencies:
|
||||||
|
'@prisma/debug': 6.13.0
|
||||||
|
|
||||||
'@rollup/plugin-alias@5.1.1(rollup@4.46.2)':
|
'@rollup/plugin-alias@5.1.1(rollup@4.46.2)':
|
||||||
optionalDependencies:
|
optionalDependencies:
|
||||||
rollup: 4.46.2
|
rollup: 4.46.2
|
||||||
@@ -4059,6 +4192,8 @@ snapshots:
|
|||||||
|
|
||||||
'@speed-highlight/core@1.2.7': {}
|
'@speed-highlight/core@1.2.7': {}
|
||||||
|
|
||||||
|
'@standard-schema/spec@1.0.0': {}
|
||||||
|
|
||||||
'@tanstack/directive-functions-plugin@1.121.21(vite@6.3.5(@types/node@24.1.0)(jiti@2.5.1)(terser@5.43.1)(tsx@4.20.3))':
|
'@tanstack/directive-functions-plugin@1.121.21(vite@6.3.5(@types/node@24.1.0)(jiti@2.5.1)(terser@5.43.1)(tsx@4.20.3))':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@babel/code-frame': 7.26.2
|
'@babel/code-frame': 7.26.2
|
||||||
@@ -4515,6 +4650,11 @@ snapshots:
|
|||||||
|
|
||||||
ccount@2.0.1: {}
|
ccount@2.0.1: {}
|
||||||
|
|
||||||
|
chalk@4.1.2:
|
||||||
|
dependencies:
|
||||||
|
ansi-styles: 4.3.0
|
||||||
|
supports-color: 7.2.0
|
||||||
|
|
||||||
chalk@5.4.1: {}
|
chalk@5.4.1: {}
|
||||||
|
|
||||||
character-entities-html4@2.1.0: {}
|
character-entities-html4@2.1.0: {}
|
||||||
@@ -4596,6 +4736,16 @@ snapshots:
|
|||||||
normalize-path: 3.0.0
|
normalize-path: 3.0.0
|
||||||
readable-stream: 4.7.0
|
readable-stream: 4.7.0
|
||||||
|
|
||||||
|
concurrently@9.2.0:
|
||||||
|
dependencies:
|
||||||
|
chalk: 4.1.2
|
||||||
|
lodash: 4.17.21
|
||||||
|
rxjs: 7.8.2
|
||||||
|
shell-quote: 1.8.3
|
||||||
|
supports-color: 8.1.1
|
||||||
|
tree-kill: 1.2.2
|
||||||
|
yargs: 17.7.2
|
||||||
|
|
||||||
confbox@0.1.8: {}
|
confbox@0.1.8: {}
|
||||||
|
|
||||||
confbox@0.2.2: {}
|
confbox@0.2.2: {}
|
||||||
@@ -4663,6 +4813,8 @@ snapshots:
|
|||||||
dependencies:
|
dependencies:
|
||||||
callsite: 1.0.0
|
callsite: 1.0.0
|
||||||
|
|
||||||
|
deepmerge-ts@7.1.5: {}
|
||||||
|
|
||||||
deepmerge@4.3.1: {}
|
deepmerge@4.3.1: {}
|
||||||
|
|
||||||
define-lazy-prop@2.0.0: {}
|
define-lazy-prop@2.0.0: {}
|
||||||
@@ -4763,6 +4915,11 @@ snapshots:
|
|||||||
|
|
||||||
ee-first@1.1.1: {}
|
ee-first@1.1.1: {}
|
||||||
|
|
||||||
|
effect@3.16.12:
|
||||||
|
dependencies:
|
||||||
|
'@standard-schema/spec': 1.0.0
|
||||||
|
fast-check: 3.23.2
|
||||||
|
|
||||||
electron-to-chromium@1.5.192: {}
|
electron-to-chromium@1.5.192: {}
|
||||||
|
|
||||||
emoji-regex-xs@1.0.0: {}
|
emoji-regex-xs@1.0.0: {}
|
||||||
@@ -4922,6 +5079,10 @@ snapshots:
|
|||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
- supports-color
|
- supports-color
|
||||||
|
|
||||||
|
fast-check@3.23.2:
|
||||||
|
dependencies:
|
||||||
|
pure-rand: 6.1.0
|
||||||
|
|
||||||
fast-fifo@1.3.2: {}
|
fast-fifo@1.3.2: {}
|
||||||
|
|
||||||
fast-glob@3.3.3:
|
fast-glob@3.3.3:
|
||||||
@@ -5085,6 +5246,8 @@ snapshots:
|
|||||||
ufo: 1.6.1
|
ufo: 1.6.1
|
||||||
uncrypto: 0.1.3
|
uncrypto: 0.1.3
|
||||||
|
|
||||||
|
has-flag@4.0.0: {}
|
||||||
|
|
||||||
has-symbols@1.1.0: {}
|
has-symbols@1.1.0: {}
|
||||||
|
|
||||||
hasown@2.0.2:
|
hasown@2.0.2:
|
||||||
@@ -5777,6 +5940,15 @@ snapshots:
|
|||||||
|
|
||||||
pretty-bytes@6.1.1: {}
|
pretty-bytes@6.1.1: {}
|
||||||
|
|
||||||
|
prisma@6.13.0(magicast@0.3.5)(typescript@5.8.3):
|
||||||
|
dependencies:
|
||||||
|
'@prisma/config': 6.13.0(magicast@0.3.5)
|
||||||
|
'@prisma/engines': 6.13.0
|
||||||
|
optionalDependencies:
|
||||||
|
typescript: 5.8.3
|
||||||
|
transitivePeerDependencies:
|
||||||
|
- magicast
|
||||||
|
|
||||||
process-nextick-args@2.0.1: {}
|
process-nextick-args@2.0.1: {}
|
||||||
|
|
||||||
process@0.11.10: {}
|
process@0.11.10: {}
|
||||||
@@ -5788,6 +5960,8 @@ snapshots:
|
|||||||
end-of-stream: 1.4.5
|
end-of-stream: 1.4.5
|
||||||
once: 1.4.0
|
once: 1.4.0
|
||||||
|
|
||||||
|
pure-rand@6.1.0: {}
|
||||||
|
|
||||||
qs@6.14.0:
|
qs@6.14.0:
|
||||||
dependencies:
|
dependencies:
|
||||||
side-channel: 1.1.0
|
side-channel: 1.1.0
|
||||||
@@ -5945,6 +6119,10 @@ snapshots:
|
|||||||
dependencies:
|
dependencies:
|
||||||
queue-microtask: 1.2.3
|
queue-microtask: 1.2.3
|
||||||
|
|
||||||
|
rxjs@7.8.2:
|
||||||
|
dependencies:
|
||||||
|
tslib: 2.8.1
|
||||||
|
|
||||||
safe-buffer@5.1.2: {}
|
safe-buffer@5.1.2: {}
|
||||||
|
|
||||||
safe-buffer@5.2.1: {}
|
safe-buffer@5.2.1: {}
|
||||||
@@ -6031,6 +6209,8 @@ snapshots:
|
|||||||
|
|
||||||
shebang-regex@3.0.0: {}
|
shebang-regex@3.0.0: {}
|
||||||
|
|
||||||
|
shell-quote@1.8.3: {}
|
||||||
|
|
||||||
shiki@1.29.2:
|
shiki@1.29.2:
|
||||||
dependencies:
|
dependencies:
|
||||||
'@shikijs/core': 1.29.2
|
'@shikijs/core': 1.29.2
|
||||||
@@ -6192,6 +6372,14 @@ snapshots:
|
|||||||
|
|
||||||
supports-color@10.0.0: {}
|
supports-color@10.0.0: {}
|
||||||
|
|
||||||
|
supports-color@7.2.0:
|
||||||
|
dependencies:
|
||||||
|
has-flag: 4.0.0
|
||||||
|
|
||||||
|
supports-color@8.1.1:
|
||||||
|
dependencies:
|
||||||
|
has-flag: 4.0.0
|
||||||
|
|
||||||
supports-preserve-symlinks-flag@1.0.0: {}
|
supports-preserve-symlinks-flag@1.0.0: {}
|
||||||
|
|
||||||
system-architecture@0.1.0: {}
|
system-architecture@0.1.0: {}
|
||||||
@@ -6254,6 +6442,8 @@ snapshots:
|
|||||||
|
|
||||||
tr46@0.0.3: {}
|
tr46@0.0.3: {}
|
||||||
|
|
||||||
|
tree-kill@1.2.2: {}
|
||||||
|
|
||||||
trim-lines@3.0.1: {}
|
trim-lines@3.0.1: {}
|
||||||
|
|
||||||
triple-beam@1.4.1: {}
|
triple-beam@1.4.1: {}
|
||||||
|
|||||||
24
schema.prisma
Normal file
24
schema.prisma
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
generator client {
|
||||||
|
provider = "prisma-client-js"
|
||||||
|
}
|
||||||
|
|
||||||
|
datasource db {
|
||||||
|
provider = "sqlite"
|
||||||
|
url = "file:./dev.db"
|
||||||
|
}
|
||||||
|
|
||||||
|
model Game {
|
||||||
|
id Int @id @default(autoincrement())
|
||||||
|
createdAt DateTime @default(now())
|
||||||
|
updatedAt DateTime @updatedAt
|
||||||
|
name String @unique
|
||||||
|
rules String?
|
||||||
|
instances Instance[]
|
||||||
|
}
|
||||||
|
|
||||||
|
model Instance {
|
||||||
|
id Int @id @default(autoincrement())
|
||||||
|
gameId Int
|
||||||
|
game Game @relation(fields: [gameId], references: [id])
|
||||||
|
gameState Json
|
||||||
|
}
|
||||||
17
src/db.ts
17
src/db.ts
@@ -1,17 +0,0 @@
|
|||||||
"use server";
|
|
||||||
|
|
||||||
import { Database } from "arangojs";
|
|
||||||
import { GameState, newGame } from "./types/cards";
|
|
||||||
import { AqlQuery } from "arangojs/aql";
|
|
||||||
|
|
||||||
const db = new Database({
|
|
||||||
url: "http://localhost:8529",
|
|
||||||
auth: {
|
|
||||||
username: "root",
|
|
||||||
password: "pass",
|
|
||||||
},
|
|
||||||
databaseName: "prod",
|
|
||||||
});
|
|
||||||
|
|
||||||
export const query = async <T>(q: AqlQuery<T>) =>
|
|
||||||
await db.query(q).then((c) => c.all());
|
|
||||||
4
src/db/Games.ts
Normal file
4
src/db/Games.ts
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
"use server";
|
||||||
|
import { prisma } from "./db";
|
||||||
|
|
||||||
|
export const queryAll = async () => await prisma.game.findMany();
|
||||||
6
src/db/Instances.ts
Normal file
6
src/db/Instances.ts
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
"use server";
|
||||||
|
|
||||||
|
import { prisma } from "./db";
|
||||||
|
|
||||||
|
export const queryInstances = async (gameName: string) =>
|
||||||
|
await prisma.instance.findMany({ where: { game: { name: gameName } } });
|
||||||
5
src/db/db.ts
Normal file
5
src/db/db.ts
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
"use server";
|
||||||
|
|
||||||
|
import { PrismaClient } from "@prisma/client";
|
||||||
|
|
||||||
|
export const prisma = new PrismaClient();
|
||||||
@@ -1,24 +1,16 @@
|
|||||||
import { A, useParams } from "@solidjs/router";
|
import { A, useParams } from "@solidjs/router";
|
||||||
|
|
||||||
import { createEffect, createResource, For, Suspense } from "solid-js";
|
import { createEffect, createResource, For, Suspense } from "solid-js";
|
||||||
import { query } from "../../db";
|
import * as Instance from "../../db/Instances";
|
||||||
import { aql } from "arangojs";
|
|
||||||
|
|
||||||
export default () => {
|
export default () => {
|
||||||
const params = useParams();
|
const params = useParams<{ game: string }>();
|
||||||
createEffect(() => {
|
createEffect(() => {
|
||||||
console.log(">>", params.game);
|
console.log(">>", params.game);
|
||||||
});
|
});
|
||||||
const [instances] = createResource(
|
const [instances] = createResource(
|
||||||
() => params.game,
|
() => params.game,
|
||||||
() =>
|
() => Instance.queryInstances(params.game)
|
||||||
query<{ _id: string }>(
|
|
||||||
aql`
|
|
||||||
FOR i IN instances
|
|
||||||
FILTER i.name == ${params.game}
|
|
||||||
RETURN i
|
|
||||||
`
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
createEffect(() => console.log(instances()));
|
createEffect(() => console.log(instances()));
|
||||||
|
|||||||
@@ -1,15 +1,12 @@
|
|||||||
import { A } from "@solidjs/router";
|
import { A } from "@solidjs/router";
|
||||||
import { For } from "solid-js";
|
import { createResource, For } from "solid-js";
|
||||||
|
import * as Games from "../db/games";
|
||||||
|
|
||||||
export default () => {
|
export default () => {
|
||||||
const games = [
|
const [games] = createResource(() => Games.queryAll());
|
||||||
{
|
|
||||||
name: "renaissance",
|
|
||||||
},
|
|
||||||
];
|
|
||||||
return (
|
return (
|
||||||
<div style={{ padding: "20px" }}>
|
<div style={{ padding: "20px" }}>
|
||||||
<For each={games}>
|
<For each={games()}>
|
||||||
{(game) => <A href={`/${game.name}`}>{game.name}</A>}
|
{(game) => <A href={`/${game.name}`}>{game.name}</A>}
|
||||||
</For>
|
</For>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
43
sync_db.ts
43
sync_db.ts
@@ -1,43 +0,0 @@
|
|||||||
import { Database, aql } from "arangojs";
|
|
||||||
import { DocumentCollection, SchemaOptions } from "arangojs/collections";
|
|
||||||
import { EnsurePersistentIndexOptions } from "arangojs/indexes";
|
|
||||||
import { JSONSchema7 } from "json-schema";
|
|
||||||
// It's good practice to specify the URL.
|
|
||||||
// We connect to the _system database first to check if our target DB exists.
|
|
||||||
const sysdb = new Database({
|
|
||||||
url: "http://localhost:8529",
|
|
||||||
auth: {
|
|
||||||
username: "root",
|
|
||||||
password: "pass",
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
const db = sysdb.database("prod");
|
|
||||||
|
|
||||||
const ent = async (
|
|
||||||
name: string,
|
|
||||||
schema?: SchemaOptions,
|
|
||||||
index?: EnsurePersistentIndexOptions
|
|
||||||
) => {
|
|
||||||
const col = db.collection(name);
|
|
||||||
|
|
||||||
// @ts-ignore
|
|
||||||
|
|
||||||
await col.exists().then((e) => e || db.createCollection(name));
|
|
||||||
|
|
||||||
schema && col.properties({ schema });
|
|
||||||
index && col.ensureIndex(index);
|
|
||||||
|
|
||||||
return col;
|
|
||||||
};
|
|
||||||
|
|
||||||
const Games = ent("games", {
|
|
||||||
rule: {
|
|
||||||
type: "object",
|
|
||||||
properties: {
|
|
||||||
name: { type: "string" },
|
|
||||||
},
|
|
||||||
} as JSONSchema7,
|
|
||||||
});
|
|
||||||
const Instances = ent("instances");
|
|
||||||
const Humans = ent("humans");
|
|
||||||
Reference in New Issue
Block a user