Silas | @silaspath
Silas | @silaspath
TTCTheo's Typesafe Cult
Created by Silas | @silaspath on 5/23/2023 in #questions
bundle size and browser performance
I'm comparing framer motion and motion one for my react app regarding bundle size and Page Speed Insights performance metrics. I'm trying to use PSI but it seems very inconsistent with its scans favoring one over the other at times. Does anyone have suggestions for use PSI better or using other analyzers? Also suggestions for Network tab to help? Currently installing a bundle analyzer...
4 replies
TTCTheo's Typesafe Cult
Created by Silas | @silaspath on 5/17/2023 in #questions
prisma push data loss
I had a table populated with a few records I then updated my prisma.schema to add a new table (and include the old ones) and used prisma push I got no warnings about data loss then the old table that wasn't modified lost all its records
2 replies
TTCTheo's Typesafe Cult
Created by Silas | @silaspath on 4/12/2023 in #questions
mapping a column in model to another model
I have nextauth with github I want github usernames to be fetched so I can display them alongside comments. working state of my schema.prisma:
model Session {
id String @id @default(cuid())
sessi onToken String @unique
userId String
expires DateTime
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
}

model User {
id String @id @default(cuid())
name String?
email String? @unique
emailVerified DateTime?
image String?
accounts Account[]
sessions Session[]
comments Comment[]
}

model VerificationToken {
identifier String
token String @unique
expires DateTime

@@unique([identifier, token])
}

model Comment {
id String @id @default(cuid())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
userId String
content String @db.Text
user User @relation(fields: [userId], references: [id])

}
model Session {
id String @id @default(cuid())
sessi onToken String @unique
userId String
expires DateTime
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
}

model User {
id String @id @default(cuid())
name String?
email String? @unique
emailVerified DateTime?
image String?
accounts Account[]
sessions Session[]
comments Comment[]
}

model VerificationToken {
identifier String
token String @unique
expires DateTime

@@unique([identifier, token])
}

model Comment {
id String @id @default(cuid())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
userId String
content String @db.Text
user User @relation(fields: [userId], references: [id])

}
I think I'm supposed to add another field for a relation between User and Comment tables? see that I added userName
model Comment {
id String @id @default(cuid())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
userId String
userName String
content String @db.Text
user User @relation(fields: [userId, userName], references: [id, name])
}
model Comment {
id String @id @default(cuid())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
userId String
userName String
content String @db.Text
user User @relation(fields: [userId, userName], references: [id, name])
}
but I get an error -> Error parsing attribute "@relation": The argument references must refer to a unique criterion in the related model. Consider adding an @@unique([id, name]) attribute to the model User. and I'm kinda lost
3 replies
TTCTheo's Typesafe Cult
Created by Silas | @silaspath on 4/3/2023 in #questions
ts error raised on tailwind plugin
in tailwind config:
plugins: [require("@tailwindcss/typography", require("daisyui"))],
plugins: [require("@tailwindcss/typography", require("daisyui"))],
I get the squiggly for daisyui... Expected 1 arguments, but got 2.
7 replies
TTCTheo's Typesafe Cult
Created by Silas | @silaspath on 4/1/2023 in #questions
how long should install be?
23 replies