stacker.news/prisma/migrations/20211012203507_invite_modeld/migration.sql

22 lines
666 B
MySQL
Raw Normal View History

2021-10-12 23:49:04 +00:00
-- AlterTable
ALTER TABLE "users" ADD COLUMN "inviteId" TEXT;
-- CreateTable
CREATE TABLE "Invite" (
"id" TEXT NOT NULL,
"created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updated_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"userId" INTEGER NOT NULL,
"gift" INTEGER,
"limit" INTEGER,
"revoked" BOOLEAN NOT NULL DEFAULT false,
PRIMARY KEY ("id")
);
-- AddForeignKey
ALTER TABLE "users" ADD FOREIGN KEY ("inviteId") REFERENCES "Invite"("id") ON DELETE SET NULL ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "Invite" ADD FOREIGN KEY ("userId") REFERENCES "users"("id") ON DELETE CASCADE ON UPDATE CASCADE;