Issue changes are recorded per field in the issue_change table, in the same transaction as the issue itself. The new history module exposes: - GET /api/issues/:issueId/history — change timeline grouped by save - GET /api/issues/stats/daily — created, status transitions and status snapshot per day, with time zone support The migration backfills history for existing issues. Setting a field to its current value no longer bumps updatedAt or emits issue.updated.
This commit is contained in:
1 parent
f44590b8ca
commit
cb29c7d2c4
26 files changed
+1026
-16
No files matched your search
@@ -0,0 +1,28 @@
|
||||
-- CreateTable
|
||||
CREATE TABLE "issue_change" (
|
||||
"id" SERIAL NOT NULL,
|
||||
"issueId" INTEGER NOT NULL,
|
||||
"changeId" TEXT NOT NULL,
|
||||
"field" TEXT NOT NULL,
|
||||
"oldValue" TEXT,
|
||||
"newValue" TEXT,
|
||||
"actorId" TEXT,
|
||||
"changedAt" TIMESTAMPTZ(3) NOT NULL,
|
||||
|
||||
CONSTRAINT "issue_change_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "issue_change_issueId_changedAt_idx" ON "issue_change"("issueId", "changedAt");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "issue_change_field_changedAt_idx" ON "issue_change"("field", "changedAt");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "issue_change_actorId_idx" ON "issue_change"("actorId");
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "issue_change" ADD CONSTRAINT "issue_change_issueId_fkey" FOREIGN KEY ("issueId") REFERENCES "issue"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "issue_change" ADD CONSTRAINT "issue_change_actorId_fkey" FOREIGN KEY ("actorId") REFERENCES "user"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
Reference in new issue
Block a user