feat: add Clerk Auth (#43)
This commit is contained in:
parent
1c5b37b24b
commit
ed2e18310e
17 changed files with 152 additions and 248 deletions
|
|
@ -0,0 +1,24 @@
|
|||
/*
|
||||
Warnings:
|
||||
|
||||
- You are about to drop the column `password` on the `User` table. All the data in the column will be lost.
|
||||
- You are about to drop the `Session` table. If the table is not empty, all the data it contains will be lost.
|
||||
- A unique constraint covering the columns `[clerkId]` on the table `User` will be added. If there are existing duplicate values, this will fail.
|
||||
- Added the required column `clerkId` to the `User` table without a default value. This is not possible if the table is not empty.
|
||||
|
||||
*/
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "Session" DROP CONSTRAINT "Session_userId_fkey";
|
||||
|
||||
-- DropIndex
|
||||
DROP INDEX "User_email_key";
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "User" DROP COLUMN "password",
|
||||
ADD COLUMN "clerkId" TEXT NOT NULL;
|
||||
|
||||
-- DropTable
|
||||
DROP TABLE "Session";
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "User_clerkId_key" ON "User"("clerkId");
|
||||
|
|
@ -15,24 +15,12 @@ datasource db {
|
|||
}
|
||||
|
||||
model User {
|
||||
id String @id @default(uuid())
|
||||
id String @id @default(uuid())
|
||||
clerkId String @unique
|
||||
|
||||
email String? @unique
|
||||
name String
|
||||
password String
|
||||
posts Post[]
|
||||
sessions Session[]
|
||||
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @default(now()) @updatedAt
|
||||
}
|
||||
|
||||
model Session {
|
||||
id String @id @default(uuid())
|
||||
|
||||
expiresAt DateTime
|
||||
user User @relation(references: [id], fields: [userId])
|
||||
userId String
|
||||
email String?
|
||||
name String
|
||||
posts Post[]
|
||||
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @default(now()) @updatedAt
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue