Files
dashboard-desaplus-noc/prisma/migrations/20260326092503_add_dashboard_metrics/migration.sql
nico 44b6b158ef [darmasaba-dashboard][2026-03-27] feat: modular seeders and database-backed dashboard
- Split seeders into modular files per feature category
- Added seed:auth, seed:demographics, seed:divisions, seed:services, seed:dashboard commands
- Connected dashboard components to live database (Budget, SDGs, Satisfaction)
- Added API endpoints: /api/dashboard/budget, /api/dashboard/sdgs, /api/dashboard/satisfaction
- Updated prisma schema with dashboard metrics models
- Added loading states to dashboard components
- Fixed header navigation to /admin

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-03-27 12:14:19 +08:00

59 lines
1.6 KiB
SQL

/*
Warnings:
- You are about to drop the `Budget` table. If the table is not empty, all the data it contains will be lost.
*/
-- DropForeignKey
ALTER TABLE "Budget" DROP CONSTRAINT "Budget_approvedBy_fkey";
-- DropTable
DROP TABLE "Budget";
-- CreateTable
CREATE TABLE "budget" (
"id" TEXT NOT NULL,
"category" TEXT NOT NULL,
"amount" DOUBLE PRECISION NOT NULL DEFAULT 0,
"percentage" DOUBLE PRECISION NOT NULL DEFAULT 0,
"color" TEXT NOT NULL DEFAULT '#3B82F6',
"fiscalYear" INTEGER NOT NULL DEFAULT 2025,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "budget_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "sdgs_score" (
"id" TEXT NOT NULL,
"title" TEXT NOT NULL,
"score" DOUBLE PRECISION NOT NULL DEFAULT 0,
"image" TEXT,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "sdgs_score_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "satisfaction_rating" (
"id" TEXT NOT NULL,
"category" TEXT NOT NULL,
"value" INTEGER NOT NULL DEFAULT 0,
"color" TEXT NOT NULL,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "satisfaction_rating_pkey" PRIMARY KEY ("id")
);
-- CreateIndex
CREATE UNIQUE INDEX "budget_category_fiscalYear_key" ON "budget"("category", "fiscalYear");
-- CreateIndex
CREATE UNIQUE INDEX "sdgs_score_title_key" ON "sdgs_score"("title");
-- CreateIndex
CREATE UNIQUE INDEX "satisfaction_rating_category_key" ON "satisfaction_rating"("category");