You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tech-interview-handbook/apps/portal/prisma/migrations/20221002033341_add_todos/migration.sql

27 lines
726 B

/*
Warnings:
- You are about to drop the `Example` table. If the table is not empty, all the data it contains will be lost.
*/
-- CreateEnum
CREATE TYPE "TodoStatus" AS ENUM ('INCOMPLETE', 'COMPLETE');
-- DropTable
DROP TABLE "Example";
-- CreateTable
CREATE TABLE "Todo" (
"id" TEXT NOT NULL,
"userId" TEXT NOT NULL,
"text" TEXT NOT NULL,
"status" "TodoStatus" NOT NULL DEFAULT 'INCOMPLETE',
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "Todo_pkey" PRIMARY KEY ("id")
);
-- AddForeignKey
ALTER TABLE "Todo" ADD CONSTRAINT "Todo_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;