Skip to content

Commit 4b750c8

Browse files
committed
migrate from plain sqlite to prisma
1 parent 01b35bd commit 4b750c8

File tree

7 files changed

+236
-223
lines changed

7 files changed

+236
-223
lines changed

server/.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,5 @@ pids
5656
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
5757

5858
# Jest jUnit test coverage reports
59-
reports
59+
reports
60+
/generated/prisma

server/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
"@nestjs/swagger": "^11.0.3",
3737
"@nestjs/websockets": "^11.0.7",
3838
"@octokit/core": "^6.1.3",
39+
"@prisma/client": "^6.9.0",
3940
"@types/bcrypt": "^5.0.2",
4041
"@willsoto/nestjs-prometheus": "^6.0.2",
4142
"axios": "^1.7.9",
@@ -84,6 +85,7 @@
8485
"jest": "^29.7.0",
8586
"jest-junit": "^16.0.0",
8687
"prettier": "^3.4.2",
88+
"prisma": "^6.9.0",
8789
"source-map-support": "^0.5.21",
8890
"supertest": "^7.0.0",
8991
"ts-jest": "^29.3.4",
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
-- CreateTable
2+
CREATE TABLE "Audit" (
3+
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
4+
"timestamp" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
5+
"user" TEXT NOT NULL,
6+
"severity" TEXT NOT NULL DEFAULT 'normal',
7+
"action" TEXT NOT NULL,
8+
"namespace" TEXT NOT NULL,
9+
"phase" TEXT NOT NULL,
10+
"app" TEXT NOT NULL,
11+
"pipeline" TEXT NOT NULL,
12+
"resource" TEXT NOT NULL DEFAULT 'unknown',
13+
"message" TEXT NOT NULL
14+
);
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Please do not edit this file manually
2+
# It should be added in your version-control system (e.g., Git)
3+
provider = "sqlite"

server/prisma/schema.prisma

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
// This is your Prisma schema file,
2+
// learn more about it in the docs: https://pris.ly/d/prisma-schema
3+
4+
// Looking for ways to speed up your queries, or scale easily with your serverless or edge functions?
5+
// Try Prisma Accelerate: https://pris.ly/cli/accelerate-init
6+
7+
// generator client {
8+
// provider = "prisma-client-js"
9+
// output = "../generated/prisma"
10+
// }
11+
12+
datasource db {
13+
provider = "sqlite"
14+
url = env("DATABASE_URL")
15+
}
16+
17+
generator client {
18+
provider = "prisma-client-js"
19+
}
20+
21+
model Audit {
22+
id Int @id @default(autoincrement())
23+
timestamp DateTime @default(now())
24+
user String
25+
severity Severity @default(normal)
26+
action String
27+
namespace String
28+
phase String
29+
app String
30+
pipeline String
31+
resource ResourceType @default(unknown)
32+
message String
33+
}
34+
35+
enum Severity {
36+
normal
37+
info
38+
warning
39+
critical
40+
error
41+
unknown
42+
}
43+
44+
enum ResourceType {
45+
user
46+
namespace
47+
phase
48+
app
49+
pipeline
50+
unknown
51+
system
52+
build
53+
addon
54+
settings
55+
events
56+
security
57+
templates
58+
config
59+
addons
60+
kubernetes
61+
}

0 commit comments

Comments
 (0)