aychar
aychar
Explore posts from servers
PPrisma
Created by aychar on 8/16/2024 in #help-and-questions
Prisma keeps pasting incorrect schema
I'm admittedly not great with backend stuff, so I don't know if my Tournament table schema is bad, but after editing that table I keep having this weird issue where this clearly incorrect data keeps getting pasted into my User table on save. I've tested this on both VSCode and WebStorm, same thing happens. prisma and @prisma/client are on ^5.18.0 schema.prisma
// 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(cuid())
name String?
email String? @unique
emailVerified DateTime?
image String?
accounts Account[]
sessions Session[]

createdAt DateTime @default(now())
updatedAt DateTime @updatedAt

Tournament Tournament[]
Tournament Tournament? @relation(fields: [tournamentId], references: [id])
tournamentId String?
}

model Account {
userId String
type String
provider String
providerAccountId String
refresh_token String?
access_token String?
expires_at Int?
token_type String?
scope String?
id_token String?
session_state String?

createdAt DateTime @default(now())
updatedAt DateTime @updatedAt

user User @relation(fields: [userId], references: [id], onDelete: Cascade)

@@id([provider, providerAccountId])
}

model Session {
sessionToken String @unique
userId String
expires DateTime
user User @relation(fields: [userId], references: [id], onDelete: Cascade)

createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}

model Tournament {
id String @id @default(uuid())
tournamentName String
tournamentAcronym String
hostId String
host User @relation(name: "TournamentHost", fields: [hostId], references: [id])
users User[] @relation(name: "TournamentUsers")
startDate DateTime
endDate DateTime
}
// 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(cuid())
name String?
email String? @unique
emailVerified DateTime?
image String?
accounts Account[]
sessions Session[]

createdAt DateTime @default(now())
updatedAt DateTime @updatedAt

Tournament Tournament[]
Tournament Tournament? @relation(fields: [tournamentId], references: [id])
tournamentId String?
}

model Account {
userId String
type String
provider String
providerAccountId String
refresh_token String?
access_token String?
expires_at Int?
token_type String?
scope String?
id_token String?
session_state String?

createdAt DateTime @default(now())
updatedAt DateTime @updatedAt

user User @relation(fields: [userId], references: [id], onDelete: Cascade)

@@id([provider, providerAccountId])
}

model Session {
sessionToken String @unique
userId String
expires DateTime
user User @relation(fields: [userId], references: [id], onDelete: Cascade)

createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}

model Tournament {
id String @id @default(uuid())
tournamentName String
tournamentAcronym String
hostId String
host User @relation(name: "TournamentHost", fields: [hostId], references: [id])
users User[] @relation(name: "TournamentUsers")
startDate DateTime
endDate DateTime
}
16 replies