eletrotupi / tcc/ api/prisma/migrations/20260427224658_create_interventions/migration.sql5a1373aed06bccb3f57d57b91da01d9500c1ce91
642 B | 18 lines Raw
1
-- CreateEnum
2
CREATE TYPE "InterventionType" AS ENUM ('MEDICATION', 'THERAPY', 'MEDITATION', 'EXERCISE', 'CONVERSATION');
3

4
-- CreateTable
5
CREATE TABLE "interventions" (
6
    "id" SERIAL NOT NULL,
7
    "comment" TEXT,
8
    "intervention_type" "InterventionType" NOT NULL,
9
    "eficacy" INTEGER NOT NULL,
10
    "start_at" TIMESTAMP(3) NOT NULL,
11
    "end_at" TIMESTAMP(3) NOT NULL,
12
    "user_id" INTEGER NOT NULL,
13

14
    CONSTRAINT "interventions_pkey" PRIMARY KEY ("id")
15
);
16

17
-- AddForeignKey
18
ALTER TABLE "interventions" ADD CONSTRAINT "interventions_user_id_fkey" FOREIGN KEY ("user_id") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE;