
* Moved prisma to packages * Add missing prisma configs * Extracts common libs and types * Build and pipeline fixes * Adds missing package * Prisma scripts cleanup * Updates lint staged * Type fixes * Sort imports * Updates yarn lock file * Fixes for yarn dx * Revert "Sort imports" This reverts commit 076109decab9b9ba307fc03696c3b0da5c4896f3. * Formatting * Prevent double TS version * Fix conflict * Extracted e2e configs
26 lines
674 B
SQL
26 lines
674 B
SQL
-- CreateEnum
|
|
CREATE TYPE "MembershipRole" AS ENUM ('MEMBER', 'OWNER');
|
|
|
|
-- CreateTable
|
|
CREATE TABLE "Team" (
|
|
"id" SERIAL NOT NULL,
|
|
"name" TEXT,
|
|
|
|
PRIMARY KEY ("id")
|
|
);
|
|
|
|
-- CreateTable
|
|
CREATE TABLE "Membership" (
|
|
"teamId" INTEGER NOT NULL,
|
|
"userId" INTEGER NOT NULL,
|
|
"accepted" BOOLEAN NOT NULL DEFAULT false,
|
|
"role" "MembershipRole" NOT NULL,
|
|
|
|
PRIMARY KEY ("userId","teamId")
|
|
);
|
|
|
|
-- AddForeignKey
|
|
ALTER TABLE "Membership" ADD FOREIGN KEY ("teamId") REFERENCES "Team"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
|
|
-- AddForeignKey
|
|
ALTER TABLE "Membership" ADD FOREIGN KEY ("userId") REFERENCES "users"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|