mirror of
https://github.com/Drop-OSS/drop.git
synced 2026-01-31 15:37:09 +01:00
initial commit
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
-- CreateEnum
|
||||
CREATE TYPE "AuthMec" AS ENUM ('Simple');
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "User" (
|
||||
"id" TEXT NOT NULL,
|
||||
"username" TEXT NOT NULL,
|
||||
|
||||
CONSTRAINT "User_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "LinkedAuthMec" (
|
||||
"userId" TEXT NOT NULL,
|
||||
"mec" "AuthMec" NOT NULL,
|
||||
"credentials" TEXT[],
|
||||
|
||||
CONSTRAINT "LinkedAuthMec_pkey" PRIMARY KEY ("userId","mec")
|
||||
);
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "User_username_key" ON "User"("username");
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "LinkedAuthMec" ADD CONSTRAINT "LinkedAuthMec_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
@@ -0,0 +1,9 @@
|
||||
/*
|
||||
Warnings:
|
||||
|
||||
- Changed the type of `credentials` on the `LinkedAuthMec` table. No cast exists, the column would be dropped and recreated, which cannot be done if there is data, since the column is required.
|
||||
|
||||
*/
|
||||
-- AlterTable
|
||||
ALTER TABLE "LinkedAuthMec" DROP COLUMN "credentials",
|
||||
ADD COLUMN "credentials" JSONB NOT NULL;
|
||||
3
prisma/migrations/migration_lock.toml
Normal file
3
prisma/migrations/migration_lock.toml
Normal file
@@ -0,0 +1,3 @@
|
||||
# Please do not edit this file manually
|
||||
# It should be added in your version-control system (i.e. Git)
|
||||
provider = "postgresql"
|
||||
36
prisma/schema.prisma
Normal file
36
prisma/schema.prisma
Normal file
@@ -0,0 +1,36 @@
|
||||
// This is your Prisma schema file,
|
||||
// learn more about it in the docs: https://pris.ly/d/prisma-schema
|
||||
|
||||
// Looking for ways to speed up your queries, or scale easily with your serverless or edge functions?
|
||||
// Try Prisma Accelerate: https://pris.ly/cli/accelerate-init
|
||||
|
||||
generator client {
|
||||
provider = "prisma-client-js"
|
||||
}
|
||||
|
||||
datasource db {
|
||||
provider = "postgresql"
|
||||
url = env("DATABASE_URL")
|
||||
}
|
||||
|
||||
model User {
|
||||
id String @id @default(uuid())
|
||||
username String @unique
|
||||
|
||||
authMecs LinkedAuthMec[]
|
||||
}
|
||||
|
||||
enum AuthMec {
|
||||
Simple
|
||||
}
|
||||
|
||||
model LinkedAuthMec {
|
||||
userId String
|
||||
mec AuthMec
|
||||
|
||||
credentials Json
|
||||
|
||||
user User @relation(fields: [userId], references: [id])
|
||||
|
||||
@@id([userId, mec])
|
||||
}
|
||||
Reference in New Issue
Block a user