replaced email with username

This commit is contained in:
Daniel
2023-07-08 14:05:43 +03:30
parent 3993615071
commit 97ca682c0a
32 changed files with 283 additions and 117 deletions
@@ -0,0 +1,32 @@
/*
Warnings:
- You are about to drop the column `email` on the `User` table. All the data in the column will be lost.
- A unique constraint covering the columns `[username]` on the table `User` will be added. If there are existing duplicate values, this will fail.
- Added the required column `username` to the `User` table without a default value. This is not possible if the table is not empty.
*/
-- DropIndex
DROP INDEX "User_email_key";
ALTER TABLE "User" RENAME COLUMN "email" TO "username";
-- AlterTable
ALTER TABLE "User" ADD COLUMN "emailVerified" TIMESTAMP(3),
ADD COLUMN "image" TEXT;
-- CreateTable
CREATE TABLE "VerificationToken" (
"identifier" TEXT NOT NULL,
"token" TEXT NOT NULL,
"expires" TIMESTAMP(3) NOT NULL
);
-- CreateIndex
CREATE UNIQUE INDEX "VerificationToken_token_key" ON "VerificationToken"("token");
-- CreateIndex
CREATE UNIQUE INDEX "VerificationToken_identifier_token_key" ON "VerificationToken"("identifier", "token");
-- CreateIndex
CREATE UNIQUE INDEX "User_username_key" ON "User"("username");
+59 -12
View File
@@ -7,22 +7,69 @@ datasource db {
url = env("DATABASE_URL")
}
model User {
id Int @id @default(autoincrement())
name String
email String @unique
password String
collections Collection[]
tags Tag[]
// model Account {
// id String @id @default(cuid())
// userId Int
// type String
// provider String
// providerAccountId String
// refresh_token String? @db.Text
// access_token String? @db.Text
// expires_at Int?
// token_type String?
// scope String?
// id_token String? @db.Text
// session_state String?
pinnedLinks Link[]
// user User @relation(fields: [userId], references: [id], onDelete: Cascade)
// @@unique([provider, providerAccountId])
// }
// model Session {
// id String @id @default(cuid())
// sessionToken String @unique
// userId Int
// expires DateTime
// user User @relation(fields: [userId], references: [id], onDelete: Cascade)
// }
model User {
id Int @id @default(autoincrement())
name String
username String @unique
// email String? @unique
emailVerified DateTime?
image String?
// accounts Account[]
// sessions Session[]
collectionsJoined UsersAndCollections[]
isPrivate Boolean @default(false)
whitelistedUsers String[] @default([])
createdAt DateTime @default(now())
password String
collections Collection[]
tags Tag[]
pinnedLinks Link[]
collectionsJoined UsersAndCollections[]
isPrivate Boolean @default(false)
whitelistedUsers String[] @default([])
createdAt DateTime @default(now())
}
model VerificationToken {
identifier String
token String @unique
expires DateTime
@@unique([identifier, token])
}
model Collection {
id Int @id @default(autoincrement())
name String