@danielcok17/prisma-db 1.20.16 → 1.20.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@danielcok17/prisma-db",
3
- "version": "1.20.16",
3
+ "version": "1.20.18",
4
4
  "description": "Shared Prisma schema for Legal AI applications",
5
5
  "repository": {
6
6
  "type": "git",
package/prisma/law.prisma CHANGED
@@ -52,6 +52,26 @@ model LawAttachment {
52
52
  @@schema("public")
53
53
  }
54
54
 
55
+ model LegalOpinion {
56
+ id Int @id @default(autoincrement())
57
+ caseNumber String @map("case_number")
58
+ decisionDate DateTime? @map("decision_date") @db.Date
59
+ ecli String?
60
+ source String // 'legal_precedents' | 'court_cases'
61
+ title String? // ÚS only (mkClauseTitle)
62
+ text String? // právna veta body
63
+ reasoning String? // judikáty only (zdôvodnenie právnej vety)
64
+ createdAt DateTime @default(now()) @map("created_at")
65
+ updatedAt DateTime @updatedAt @map("updated_at")
66
+
67
+ @@index([caseNumber])
68
+ @@index([ecli])
69
+ @@index([caseNumber, decisionDate])
70
+ @@index([source])
71
+ @@map("legal_opinion")
72
+ @@schema("public")
73
+ }
74
+
55
75
  model VersionParagraph {
56
76
  id Int @id
57
77
  paragraphId String? @map("paragraph_id")
@@ -0,0 +1,34 @@
1
+ -- CreateTable: legal_opinion
2
+ -- Stores právne vety from both legal_precedents (judikáty) and court_cases (Ústavný súd).
3
+ -- Lookup by ecli (preferred) or case_number + decision_date.
4
+ -- Multiple rows per case are supported (one per clause).
5
+
6
+ CREATE TABLE "legal_opinion" (
7
+ "id" SERIAL PRIMARY KEY,
8
+ "case_number" TEXT NOT NULL,
9
+ "decision_date" DATE,
10
+ "ecli" TEXT,
11
+ "source" TEXT NOT NULL, -- 'legal_precedents' | 'court_cases'
12
+ "title" TEXT, -- ÚS only (mkClauseTitle)
13
+ "text" TEXT, -- právna veta body
14
+ "reasoning" TEXT, -- judikáty only (zdôvodnenie právnej vety)
15
+ "created_at" TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
16
+ "updated_at" TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
17
+ );
18
+
19
+ CREATE INDEX "legal_opinion_case_number_idx" ON "legal_opinion" ("case_number");
20
+ CREATE INDEX "legal_opinion_ecli_idx" ON "legal_opinion" ("ecli") WHERE "ecli" IS NOT NULL;
21
+ CREATE INDEX "legal_opinion_case_number_decision_date_idx" ON "legal_opinion" ("case_number", "decision_date");
22
+ CREATE INDEX "legal_opinion_source_idx" ON "legal_opinion" ("source");
23
+
24
+ -- Backfill from existing legal_precedents rows that have a právna veta
25
+ INSERT INTO "legal_opinion" ("case_number", "decision_date", "ecli", "source", "text", "reasoning")
26
+ SELECT
27
+ lp.case_number,
28
+ lp.decision_date,
29
+ lp.ecli,
30
+ 'legal_precedents',
31
+ lp.legal_opinion,
32
+ lp.opinion_reasoning
33
+ FROM legal_precedents lp
34
+ WHERE lp.legal_opinion IS NOT NULL AND lp.legal_opinion != '';