mirror of
https://github.com/veganhacktivists/arabot.git
synced 2025-05-18 13:44:13 +02:00
feat(db): add outreach to database
This commit is contained in:
parent
9fa412b15e
commit
b859e4b617
@ -1,10 +1,10 @@
|
||||
-- CreateTable
|
||||
CREATE TABLE "Event" (
|
||||
"id" SERIAL NOT NULL,
|
||||
"eventType" TEXT NOT NULL,
|
||||
"leaderId" TEXT NOT NULL,
|
||||
"startTime" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"endTime" TIMESTAMP(3),
|
||||
"eventTypeType" TEXT NOT NULL,
|
||||
|
||||
CONSTRAINT "Event_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
@ -16,17 +16,10 @@ CREATE TABLE "EventType" (
|
||||
CONSTRAINT "EventType_pkey" PRIMARY KEY ("type")
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "EventStat" (
|
||||
"eventId" INTEGER NOT NULL,
|
||||
"statId" INTEGER NOT NULL,
|
||||
|
||||
CONSTRAINT "EventStat_pkey" PRIMARY KEY ("eventId","statId")
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "Stat" (
|
||||
"id" SERIAL NOT NULL,
|
||||
"eventId" INTEGER NOT NULL,
|
||||
"leaderId" TEXT NOT NULL,
|
||||
"vegan" INTEGER NOT NULL DEFAULT 0,
|
||||
"considered" INTEGER NOT NULL DEFAULT 0,
|
||||
@ -47,16 +40,13 @@ CREATE TABLE "ParticipantStat" (
|
||||
);
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "Event" ADD CONSTRAINT "Event_eventTypeType_fkey" FOREIGN KEY ("eventTypeType") REFERENCES "EventType"("type") ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
ALTER TABLE "Event" ADD CONSTRAINT "Event_eventType_fkey" FOREIGN KEY ("eventType") REFERENCES "EventType"("type") ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "Event" ADD CONSTRAINT "Event_leaderId_fkey" FOREIGN KEY ("leaderId") REFERENCES "User"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "EventStat" ADD CONSTRAINT "EventStat_eventId_fkey" FOREIGN KEY ("eventId") REFERENCES "Event"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "EventStat" ADD CONSTRAINT "EventStat_statId_fkey" FOREIGN KEY ("statId") REFERENCES "Stat"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
ALTER TABLE "Stat" ADD CONSTRAINT "Stat_eventId_fkey" FOREIGN KEY ("eventId") REFERENCES "Event"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "Stat" ADD CONSTRAINT "Stat_leaderId_fkey" FOREIGN KEY ("leaderId") REFERENCES "User"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
@ -68,7 +68,7 @@ model Verify {
|
||||
finishTime DateTime?
|
||||
manual Boolean @default(false) // If they were verified with the verify command
|
||||
timedOut Boolean @default(false) // If they got kicked out of verification because they timed out
|
||||
//complete Boolean @default(false) // If the verification was incomplete
|
||||
// complete Boolean @default(false) // If the verification was incomplete
|
||||
// Roles they got from verification
|
||||
vegan Boolean @default(false) // If they got verified as a vegan
|
||||
activist Boolean @default(false) // If they got the activist role when they verified
|
||||
@ -88,14 +88,14 @@ model Verify {
|
||||
}
|
||||
|
||||
model Event {
|
||||
id Int @id @default(autoincrement())
|
||||
type EventType @relation(fields: [eventTypeType], references: [type])
|
||||
leader User @relation("eventLeader", fields: [leaderId], references: [id]) // Not sure if this will stay
|
||||
leaderId String
|
||||
startTime DateTime @default(now())
|
||||
endTime DateTime?
|
||||
EventStat EventStat[]
|
||||
eventTypeType String
|
||||
id Int @id @default(autoincrement())
|
||||
type EventType @relation(fields: [eventType], references: [type])
|
||||
eventType String
|
||||
leader User @relation("eventLeader", fields: [leaderId], references: [id]) // Not sure if this will stay
|
||||
leaderId String
|
||||
startTime DateTime @default(now())
|
||||
endTime DateTime?
|
||||
stats Stat[]
|
||||
}
|
||||
|
||||
model EventType {
|
||||
@ -104,17 +104,18 @@ model EventType {
|
||||
}
|
||||
|
||||
model Stat {
|
||||
id Int @id @default(autoincrement())
|
||||
leader User @relation("statLeader", fields: [leaderId], references: [id]) // Not sure if this will stay
|
||||
leaderId String
|
||||
vegan Int @default(0)
|
||||
considered Int @default(0)
|
||||
antivegan Int @default(0)
|
||||
thanked Int @default(0)
|
||||
documentary Int @default(0)
|
||||
educated Int @default(0)
|
||||
EventStat EventStat[]
|
||||
ParticipantStat ParticipantStat[]
|
||||
id Int @id @default(autoincrement())
|
||||
event Event @relation(fields: [eventId], references: [id])
|
||||
eventId Int
|
||||
leader User @relation("statLeader", fields: [leaderId], references: [id]) // Not sure if this will stay
|
||||
leaderId String
|
||||
vegan Int @default(0)
|
||||
considered Int @default(0)
|
||||
antivegan Int @default(0)
|
||||
thanked Int @default(0)
|
||||
documentary Int @default(0)
|
||||
educated Int @default(0)
|
||||
participationStats ParticipantStat[]
|
||||
}
|
||||
|
||||
model ParticipantStat {
|
||||
|
Loading…
x
Reference in New Issue
Block a user