CognxSafeTrack commited on
Commit
b168be2
·
1 Parent(s): 2f133f7

chore: execute Phase 1 of technical debt roadmap

Browse files

- Infra: Updated turbo.json to track Prisma schema changes
- Infra: Automated 'prisma generate' in @repo /database build script
- DB: Added strategic indexes on Message, Enrollment, and AnalyticsLog for performance

packages/database/package.json CHANGED
@@ -8,7 +8,7 @@
8
  "./seed": "./src/seed.ts"
9
  },
10
  "scripts": {
11
- "build": "tsc --build",
12
  "db:push": "prisma db push",
13
  "db:studio": "prisma studio",
14
  "generate": "prisma generate",
 
8
  "./seed": "./src/seed.ts"
9
  },
10
  "scripts": {
11
+ "build": "prisma generate && tsc --build",
12
  "db:push": "prisma db push",
13
  "db:studio": "prisma studio",
14
  "generate": "prisma generate",
packages/database/prisma/schema.prisma CHANGED
@@ -106,6 +106,7 @@ model AnalyticsLog {
106
  campaign CampaignHistory @relation(fields: [campaignHistoryId], references: [id], onDelete: Cascade)
107
 
108
  @@index([campaignHistoryId])
 
109
  }
110
 
111
  // ... existing enums ...
@@ -309,6 +310,7 @@ model Enrollment {
309
  responses Response[]
310
 
311
  @@index([organizationId])
 
312
  }
313
 
314
  model Response {
@@ -346,6 +348,7 @@ model Message {
346
 
347
  @@index([userId, createdAt])
348
  @@index([contactId, createdAt])
 
349
  @@index([organizationId])
350
  }
351
 
 
106
  campaign CampaignHistory @relation(fields: [campaignHistoryId], references: [id], onDelete: Cascade)
107
 
108
  @@index([campaignHistoryId])
109
+ @@index([eventType])
110
  }
111
 
112
  // ... existing enums ...
 
310
  responses Response[]
311
 
312
  @@index([organizationId])
313
+ @@index([userId])
314
  }
315
 
316
  model Response {
 
348
 
349
  @@index([userId, createdAt])
350
  @@index([contactId, createdAt])
351
+ @@index([organizationId, createdAt])
352
  @@index([organizationId])
353
  }
354
 
turbo.json CHANGED
@@ -3,7 +3,8 @@
3
  "pipeline": {
4
  "build": {
5
  "dependsOn": ["^build"],
6
- "outputs": ["dist/**", ".next/**"]
 
7
  },
8
  "lint": {
9
  "outputs": []
 
3
  "pipeline": {
4
  "build": {
5
  "dependsOn": ["^build"],
6
+ "outputs": ["dist/**", ".next/**"],
7
+ "inputs": ["src/**", "public/**", "../../packages/database/prisma/schema.prisma"]
8
  },
9
  "lint": {
10
  "outputs": []