skuse
skuse
Explore posts from servers
DTDrizzle Team
Created by skuse on 4/20/2024 in #help
NaN primary keys + not honouring camelCase table names
Hey thanks zeus I got it working
4 replies
DTDrizzle Team
Created by LeFuncq on 11/29/2023 in #help
TypeError: Cannot read properties of undefined (reading 'type') on drizzle kit push command
TLDR This bug happens when you change your primary key. To fix you need to re add the name of the field you deleted to your table, but not as serial or primary key. Once you push your changes you can delete the old field and push again.
6 replies
DTDrizzle Team
Created by LeFuncq on 11/29/2023 in #help
TypeError: Cannot read properties of undefined (reading 'type') on drizzle kit push command
I get this error using planetscale DB and changing the primary key. Fixed by incrementally pushing: 1. add the ID field back to the table, push, should be successful 2. change the type of the ID field to varchar / something other than serial or primaryKey. Add the new primary key field, in my case its a compound key. Push 3. Delete the ID field and push again seems to be a bug with changing the primary key. Some kind of name conflict
6 replies
TTCTheo's Typesafe Cult
Created by Furki4_4 on 11/24/2023 in #questions
next-auth drizzle adapter customization
hey man, im having trouble with this too, mind sharing your solution?
7 replies
DTDrizzle Team
Created by skuse on 8/8/2023 in #help
Cant drop key mysql
this is for dropping unique constraint. I havent tested it with other keys
3 replies
DTDrizzle Team
Created by skuse on 8/8/2023 in #help
Cant drop key mysql
the code it attempts to execute is:
'ALTER TABLE `Attribute` DROP CONSTRAINT `Attribute_tokenAttributeId_key`;'
'ALTER TABLE `Attribute` DROP CONSTRAINT `Attribute_tokenAttributeId_key`;'
whereas it should be:
ALTER TABLE `Attribute` DROP INDEX `Attribute_tokenAttributeId_key`;
ALTER TABLE `Attribute` DROP INDEX `Attribute_tokenAttributeId_key`;
3 replies
DTDrizzle Team
Created by skuse on 8/3/2023 in #help
Dropping unique constraint cant push to db
(planetscale)
2 replies
TTCTheo's Typesafe Cult
Created by skuse on 3/23/2023 in #questions
Prisma p.account.create() error "Column: for"
I've sorted it out. The spotify access token is 260 characters long, and was exceeding the character limit. Same as my scopes. I added @db.Text to the fields and this fixed my problem model Account { id String @id @default(cuid()) userId String type String provider String providerAccountId String refresh_token String? access_token String? @db.Text expires_at BigInt? token_type String? scope String? @db.Text id_token String? session_state String? user User @relation(fields: [userId], references: [id], onDelete: Cascade) @@unique([provider, providerAccountId]) }
2 replies
TTCTheo's Typesafe Cult
Created by skuse on 1/10/2023 in #questions
Environment variables pass on backend but fail on client?
I just seen this, did you fix it? I was a beginner and tried to call prisma in my client side component eg. _app.tsx You can only call prisma in a server component because the server communicates with the database (the database is prisma), not the client. If you called prisma in the client, a user would have access to see everything in the database, we dont want want that. We want to call prisma on the server, get the information we need, then deliver that information from the server to the client. that's what TRPC is for. You can call trpc on your client, then trpc runs the function you made on the server (this would be like the example router), within this server function you would call prisma, prisma will give you what you requested, then you would return the result in the trpc function to the client, which is the const { data } = trpc.example.useQuery() I would also recommend you learn the basics of react query so you know what's going on with useQuery and useMutation Hope this helps!
4 replies
TTCTheo's Typesafe Cult
Created by skuse on 1/10/2023 in #questions
Environment variables pass on backend but fail on client?
FIXED. Was trying to call prisma from client but needed to do it in server.
4 replies