auth/prisma/migrations/20230704081950_init/migration.sql

30 lines
890 B
MySQL
Raw Normal View History

2022-12-20 16:37:59 +00:00
-- CreateEnum
CREATE TYPE "Type" AS ENUM ('EMAIL', 'PHONE');
-- CreateTable
CREATE TABLE "auth" (
"uuid" UUID NOT NULL,
"password" TEXT NOT NULL,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "auth_pkey" PRIMARY KEY ("uuid")
);
-- CreateTable
CREATE TABLE "username" (
"username" TEXT NOT NULL,
2023-07-04 10:16:34 +00:00
"authUuid" UUID NOT NULL,
2022-12-20 16:37:59 +00:00
"type" "Type" NOT NULL DEFAULT 'EMAIL',
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "username_pkey" PRIMARY KEY ("username")
);
-- CreateIndex
2023-07-04 10:16:34 +00:00
CREATE UNIQUE INDEX "username_authUuid_type_key" ON "username"("authUuid", "type");
-- AddForeignKey
ALTER TABLE "username" ADD CONSTRAINT "username_authUuid_fkey" FOREIGN KEY ("authUuid") REFERENCES "auth"("uuid") ON DELETE CASCADE ON UPDATE CASCADE;