Adds in Mantis features. Enabling automated downloading of Mantises into the internal database, browsing of them, and viewing of attachments (including .msg files).

Resolves #14
This commit is contained in:
Cameron Redmore 2025-04-25 23:31:50 +01:00
parent 0e77e310bd
commit 5268d6aecd
15 changed files with 1583 additions and 44 deletions

View file

@ -0,0 +1,50 @@
-- CreateTable
CREATE TABLE "MantisIssue" (
"id" SERIAL NOT NULL,
"title" TEXT NOT NULL,
"description" TEXT,
"reporter_id" TEXT NOT NULL,
"status" TEXT NOT NULL,
"priority" TEXT NOT NULL,
"severity" TEXT NOT NULL,
"created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updated_at" TIMESTAMP(3) NOT NULL,
CONSTRAINT "MantisIssue_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "MantisComment" (
"id" SERIAL NOT NULL,
"mantis_issue_id" INTEGER NOT NULL,
"sender_id" TEXT NOT NULL,
"comment" TEXT NOT NULL,
"created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT "MantisComment_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "MantisAttachment" (
"id" SERIAL NOT NULL,
"comment_id" INTEGER NOT NULL,
"filename" TEXT NOT NULL,
"url" TEXT NOT NULL,
"mime_type" TEXT,
"size" INTEGER,
"uploaded_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT "MantisAttachment_pkey" PRIMARY KEY ("id")
);
-- AddForeignKey
ALTER TABLE "MantisIssue" ADD CONSTRAINT "MantisIssue_reporter_id_fkey" FOREIGN KEY ("reporter_id") REFERENCES "User"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "MantisComment" ADD CONSTRAINT "MantisComment_mantis_issue_id_fkey" FOREIGN KEY ("mantis_issue_id") REFERENCES "MantisIssue"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "MantisComment" ADD CONSTRAINT "MantisComment_sender_id_fkey" FOREIGN KEY ("sender_id") REFERENCES "User"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "MantisAttachment" ADD CONSTRAINT "MantisAttachment_comment_id_fkey" FOREIGN KEY ("comment_id") REFERENCES "MantisComment"("id") ON DELETE CASCADE ON UPDATE CASCADE;

View file

@ -0,0 +1,20 @@
/*
Warnings:
- You are about to drop the column `sender_id` on the `MantisComment` table. All the data in the column will be lost.
- You are about to drop the column `reporter_id` on the `MantisIssue` table. All the data in the column will be lost.
*/
-- DropForeignKey
ALTER TABLE "MantisComment" DROP CONSTRAINT "MantisComment_sender_id_fkey";
-- DropForeignKey
ALTER TABLE "MantisIssue" DROP CONSTRAINT "MantisIssue_reporter_id_fkey";
-- AlterTable
ALTER TABLE "MantisComment" DROP COLUMN "sender_id",
ADD COLUMN "sender_username" TEXT;
-- AlterTable
ALTER TABLE "MantisIssue" DROP COLUMN "reporter_id",
ADD COLUMN "reporter_username" TEXT;