Migrated to using Bun instead of Node and PNPM. This also brings in a Devcontainer which enables quick and easy development of the project. Additionally this adds connectivity to S3 (with a default Minio server pre-created) this enables Files to be uploaded against Mantises. There's also a new Internal Notes feature to store arbitrary text notes against a Mantis.
This commit is contained in:
parent
80ca48be70
commit
3b846b8c8e
23 changed files with 3210 additions and 6490 deletions
|
@ -0,0 +1,20 @@
|
|||
-- CreateTable
|
||||
CREATE TABLE "MantisFile" (
|
||||
"id" SERIAL NOT NULL,
|
||||
"mantis_issue_id" INTEGER NOT NULL,
|
||||
"filename" TEXT NOT NULL,
|
||||
"file_key" TEXT NOT NULL,
|
||||
"mime_type" TEXT,
|
||||
"size" INTEGER,
|
||||
"uploaded_by" TEXT,
|
||||
"uploaded_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"description" TEXT,
|
||||
|
||||
CONSTRAINT "MantisFile_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "MantisFile_mantis_issue_id_idx" ON "MantisFile"("mantis_issue_id");
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "MantisFile" ADD CONSTRAINT "MantisFile_mantis_issue_id_fkey" FOREIGN KEY ("mantis_issue_id") REFERENCES "MantisIssue"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
@ -0,0 +1,20 @@
|
|||
-- CreateTable
|
||||
CREATE TABLE "MantisNote" (
|
||||
"id" SERIAL NOT NULL,
|
||||
"mantis_issue_id" INTEGER NOT NULL,
|
||||
"content" TEXT NOT NULL,
|
||||
"created_by" TEXT NOT NULL,
|
||||
"created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"updated_at" TIMESTAMP(3) NOT NULL,
|
||||
|
||||
CONSTRAINT "MantisNote_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "MantisNote_mantis_issue_id_idx" ON "MantisNote"("mantis_issue_id");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "MantisNote_created_by_idx" ON "MantisNote"("created_by");
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "MantisNote" ADD CONSTRAINT "MantisNote_mantis_issue_id_fkey" FOREIGN KEY ("mantis_issue_id") REFERENCES "MantisIssue"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
@ -153,6 +153,8 @@ model MantisIssue {
|
|||
updatedAt DateTime @updatedAt @map("updated_at")
|
||||
|
||||
comments MantisComment[]
|
||||
files MantisFile[]
|
||||
notes MantisNote[] // Add relation to MantisNote
|
||||
|
||||
fts Unsupported("tsvector")?
|
||||
|
||||
|
@ -189,4 +191,36 @@ model MantisAttachment {
|
|||
comment MantisComment @relation(fields: [commentId], references: [id], onDelete: Cascade)
|
||||
}
|
||||
|
||||
// New model for user-uploaded files to S3
|
||||
model MantisFile {
|
||||
id Int @id @default(autoincrement())
|
||||
mantisIssueId Int @map("mantis_issue_id")
|
||||
filename String
|
||||
fileKey String @map("file_key") // S3 object key
|
||||
mimeType String? @map("mime_type")
|
||||
size Int?
|
||||
uploadedBy String? @map("uploaded_by") // Username of uploader
|
||||
uploadedAt DateTime @default(now()) @map("uploaded_at")
|
||||
description String?
|
||||
|
||||
mantisIssue MantisIssue @relation(fields: [mantisIssueId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@index([mantisIssueId])
|
||||
}
|
||||
|
||||
// New model for internal notes
|
||||
model MantisNote {
|
||||
id Int @id @default(autoincrement())
|
||||
mantisIssueId Int @map("mantis_issue_id")
|
||||
content String
|
||||
createdBy String @map("created_by") // Username of the creator
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
updatedAt DateTime @updatedAt @map("updated_at")
|
||||
|
||||
mantisIssue MantisIssue @relation(fields: [mantisIssueId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@index([mantisIssueId])
|
||||
@@index([createdBy])
|
||||
}
|
||||
|
||||
// --- Mantis Models End ---
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue