Skip to content

Commit

Permalink
db
Browse files Browse the repository at this point in the history
  • Loading branch information
potts99 committed Nov 30, 2023
1 parent fe8b386 commit 1af3b79
Show file tree
Hide file tree
Showing 2 changed files with 118 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
-- AlterTable
ALTER TABLE "Config" ADD COLUMN "client_version" TEXT,
ADD COLUMN "feature_previews" BOOLEAN NOT NULL DEFAULT false,
ADD COLUMN "gh_version" TEXT,
ADD COLUMN "out_of_office" BOOLEAN NOT NULL DEFAULT false,
ADD COLUMN "out_of_office_end" TIMESTAMP(3),
ADD COLUMN "out_of_office_message" TEXT,
ADD COLUMN "out_of_office_start" TIMESTAMP(3),
ADD COLUMN "portal_locale" TEXT,
ADD COLUMN "sso_active" BOOLEAN NOT NULL DEFAULT false,
ADD COLUMN "sso_provider" TEXT;

-- CreateTable
CREATE TABLE "SSO" (
"id" TEXT NOT NULL,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"name" TEXT NOT NULL,
"clientId" TEXT NOT NULL,
"clientSecret" TEXT NOT NULL,
"active" BOOLEAN NOT NULL,
"issuer" TEXT,
"tenantId" TEXT,

CONSTRAINT "SSO_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "Uptime" (
"id" TEXT NOT NULL,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"name" TEXT NOT NULL,
"url" TEXT NOT NULL,
"active" BOOLEAN NOT NULL DEFAULT false,
"webhook" TEXT,
"latency" INTEGER,
"status" BOOLEAN,

CONSTRAINT "Uptime_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "knowledgeBase" (
"id" TEXT NOT NULL,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"title" TEXT NOT NULL,
"content" TEXT NOT NULL,
"tags" TEXT[],
"author" TEXT NOT NULL,
"public" BOOLEAN NOT NULL DEFAULT false,
"ticketId" TEXT,

CONSTRAINT "knowledgeBase_pkey" PRIMARY KEY ("id")
);

-- AddForeignKey
ALTER TABLE "knowledgeBase" ADD CONSTRAINT "knowledgeBase_ticketId_fkey" FOREIGN KEY ("ticketId") REFERENCES "Ticket"("id") ON DELETE SET NULL ON UPDATE CASCADE;
66 changes: 59 additions & 7 deletions apps/api/src/prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,13 @@ model Ticket {
Comment Comment[]
TimeTracking TimeTracking[]
team Team? @relation(fields: [teamId], references: [id])
teamId String?
assignedTo User? @relation(fields: [userId], references: [id])
client Client? @relation(fields: [clientId], references: [id])
clientId String?
userId String?
team Team? @relation(fields: [teamId], references: [id])
teamId String?
assignedTo User? @relation(fields: [userId], references: [id])
client Client? @relation(fields: [clientId], references: [id])
clientId String?
userId String?
knowledgeBase knowledgeBase[]
}

model TimeTracking {
Expand Down Expand Up @@ -258,7 +259,58 @@ model Config {
createdAt DateTime @default(now())
updatedAt DateTime @default(now())
notifications Json // Array of service names and an active field of TRUE OR FALSE
notifications Json // Array of service names and an active field of TRUE OR FALSE
sso_provider String?
sso_active Boolean @default(false)
gh_version String?
client_version String?
portal_locale String?
feature_previews Boolean @default(false)
out_of_office Boolean @default(false)
out_of_office_message String?
out_of_office_start DateTime?
out_of_office_end DateTime?
}

model SSO {
id String @id @default(uuid())
createdAt DateTime @default(now())
updatedAt DateTime @default(now())
name String
clientId String
clientSecret String
active Boolean
issuer String?
tenantId String?
}

model Uptime {
id String @id @default(uuid())
createdAt DateTime @default(now())
updatedAt DateTime @default(now())
name String
url String
active Boolean @default(false)
webhook String?
latency Int?
status Boolean?
}

model knowledgeBase {
id String @id @default(uuid())
createdAt DateTime @default(now())
updatedAt DateTime @default(now())
title String
content String
tags String[]
author String
public Boolean @default(false)
ticketId String?
ticket Ticket? @relation(fields: [ticketId], references: [id])
}

model Imap_Email {
Expand Down

0 comments on commit 1af3b79

Please sign in to comment.