Skip to content

Commit fca3577

Browse files
vronkbabslgam
andauthored
changes to WorkingGroup table (#244)
#217 --------- Co-authored-by: Barbara Krautgartner <barbara.krautgartner@oeaw.ac.at>
1 parent 42e2c68 commit fca3577

File tree

3 files changed

+136
-5
lines changed

3 files changed

+136
-5
lines changed

prisma/dbml/schema.dbml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ Table event_reports {
6868
report reports [not null]
6969
createdAt DateTime [default: `now()`, not null]
7070
updatedAt DateTime [not null]
71+
WGReport wgreports [not null]
7172
}
7273

7374
Table institutions {
@@ -287,8 +288,42 @@ Table working_groups {
287288
name String [not null]
288289
startDate DateTime
289290
chairs contributions [not null]
291+
member_tracking String
292+
mailing_list String
290293
createdAt DateTime [default: `now()`, not null]
291294
updatedAt DateTime [not null]
295+
WGReport wgreports [not null]
296+
WGEventDetail WGEventDetail
297+
wGEventDetailId String
298+
}
299+
300+
Table wgreports {
301+
id String [pk]
302+
comments Json
303+
numberMebmers Int
304+
status ReportStatus [not null, default: 'draft']
305+
year Int [not null]
306+
narrativeReport String [not null]
307+
facultativeQuestions String [not null]
308+
workingGroupId String
309+
workingGroup working_groups
310+
eventReport event_reports
311+
createdAt DateTime [default: `now()`, not null]
312+
updatedAt DateTime [not null]
313+
eventReportId String
314+
315+
indexes {
316+
(workingGroupId, year) [unique]
317+
}
318+
}
319+
320+
Table WGEventDetail {
321+
id String [pk]
322+
eventTitle String [not null]
323+
eventLink String [not null]
324+
working_groups working_groups [not null]
325+
eventDate DateTime
326+
eventRole String [not null]
292327
}
293328

294329
Table users {
@@ -528,6 +563,12 @@ Ref: service_reports.serviceId > services.id [delete: Cascade]
528563

529564
Ref: service_kpis.serviceReportId > service_reports.id [delete: Cascade]
530565

566+
Ref: working_groups.wGEventDetailId > WGEventDetail.id
567+
568+
Ref: wgreports.workingGroupId > working_groups.id
569+
570+
Ref: wgreports.eventReportId > event_reports.id
571+
531572
Ref: users.countryId > countries.id
532573

533574
Ref: sessions.userId > users.id [delete: Cascade]
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
-- AlterTable
2+
ALTER TABLE "working_groups" ADD COLUMN "mailing_list" TEXT,
3+
ADD COLUMN "member_tracking" TEXT,
4+
ADD COLUMN "wGEventDetailId" UUID;
5+
6+
-- CreateTable
7+
CREATE TABLE "wgreports" (
8+
"id" UUID NOT NULL,
9+
"comments" JSONB,
10+
"numberMebmers" INTEGER,
11+
"status" "ReportStatus" NOT NULL DEFAULT 'draft',
12+
"year" INTEGER NOT NULL,
13+
"narrativeReport" TEXT NOT NULL,
14+
"facultativeQuestions" TEXT NOT NULL,
15+
"working_group_id" UUID,
16+
"created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
17+
"updated_at" TIMESTAMP(3) NOT NULL,
18+
"eventReportId" UUID,
19+
20+
CONSTRAINT "wgreports_pkey" PRIMARY KEY ("id")
21+
);
22+
23+
-- CreateTable
24+
CREATE TABLE "WGEventDetail" (
25+
"id" UUID NOT NULL,
26+
"eventTitle" TEXT NOT NULL,
27+
"eventLink" TEXT NOT NULL,
28+
"eventDate" TIMESTAMP(3),
29+
"eventRole" TEXT NOT NULL,
30+
31+
CONSTRAINT "WGEventDetail_pkey" PRIMARY KEY ("id")
32+
);
33+
34+
-- CreateIndex
35+
CREATE INDEX "wgreports_year_idx" ON "wgreports"("year");
36+
37+
-- CreateIndex
38+
CREATE UNIQUE INDEX "wgreports_working_group_id_year_key" ON "wgreports"("working_group_id", "year");
39+
40+
-- AddForeignKey
41+
ALTER TABLE "working_groups" ADD CONSTRAINT "working_groups_wGEventDetailId_fkey" FOREIGN KEY ("wGEventDetailId") REFERENCES "WGEventDetail"("id") ON DELETE SET NULL ON UPDATE CASCADE;
42+
43+
-- AddForeignKey
44+
ALTER TABLE "wgreports" ADD CONSTRAINT "wgreports_working_group_id_fkey" FOREIGN KEY ("working_group_id") REFERENCES "working_groups"("id") ON DELETE SET NULL ON UPDATE CASCADE;
45+
46+
-- AddForeignKey
47+
ALTER TABLE "wgreports" ADD CONSTRAINT "wgreports_eventReportId_fkey" FOREIGN KEY ("eventReportId") REFERENCES "event_reports"("id") ON DELETE SET NULL ON UPDATE CASCADE;

prisma/schema.prisma

Lines changed: 48 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,9 @@ model EventReport {
127127
128128
report Report @relation(fields: [reportId], references: [id], onDelete: Cascade)
129129
130-
createdAt DateTime @default(now()) @map(name: "created_at")
131-
updatedAt DateTime @updatedAt @map(name: "updated_at")
130+
createdAt DateTime @default(now()) @map(name: "created_at")
131+
updatedAt DateTime @updatedAt @map(name: "updated_at")
132+
WGReport WGReport[]
132133
133134
@@map(name: "event_reports")
134135
}
@@ -560,14 +561,56 @@ model WorkingGroup {
560561
name String
561562
startDate DateTime? @map(name: "start_date")
562563
563-
chairs Contribution[]
564+
chairs Contribution[]
565+
member_tracking String? // describe how you keep track of the WG members, e.g. via mailing list?
566+
mailing_list String? // If you use a mailing list for the WG communication, provide here.
564567
565-
createdAt DateTime @default(now()) @map(name: "created_at")
566-
updatedAt DateTime @updatedAt @map(name: "updated_at")
568+
createdAt DateTime @default(now()) @map(name: "created_at")
569+
updatedAt DateTime @updatedAt @map(name: "updated_at")
570+
WGReport WGReport[]
571+
WGEventDetail WGEventDetail? @relation(fields: [wGEventDetailId], references: [id])
572+
wGEventDetailId String? @db.Uuid
567573
568574
@@map(name: "working_groups")
569575
}
570576

577+
model WGReport {
578+
id String @id @default(uuid()) @db.Uuid
579+
580+
comments Json?
581+
numberMebmers Int?
582+
status ReportStatus @default(draft)
583+
year Int
584+
585+
narrativeReport String // this should allow a long rich text
586+
facultativeQuestions String // this should allow a long rich text
587+
588+
workingGroupId String? @map(name: "working_group_id") @db.Uuid
589+
workingGroup WorkingGroup? @relation(fields: [workingGroupId], references: [id])
590+
591+
eventReport EventReport? @relation(fields: [eventReportId], references: [id])
592+
593+
createdAt DateTime @default(now()) @map(name: "created_at")
594+
updatedAt DateTime @updatedAt @map(name: "updated_at")
595+
eventReportId String? @db.Uuid
596+
597+
@@unique([workingGroupId, year])
598+
@@index(fields: [year])
599+
@@map(name: "wgreports")
600+
}
601+
602+
model WGEventDetail {
603+
id String @id @default(uuid()) @db.Uuid
604+
605+
eventTitle String
606+
eventLink String // URL
607+
working_groups WorkingGroup[] // multiple WGs can organise one event
608+
609+
eventDate DateTime? // not finally decided yet, if necessary.
610+
611+
eventRole String // role of WG in the organisation of the event (something like organiser, presenter ...) - enum not final yet
612+
}
613+
571614
// -------------------------------------------------------------------------------------------------
572615

573616
enum UserRole {

0 commit comments

Comments
 (0)