Hocus
Hocus
DTDrizzle Team
Created by Kason on 2/1/2024 in #help
Can't create Supabase Schemas using Drizzle?
any news on this? I tried to create a private schema, but nothing happens, no tables created. No error msg.
4 replies
DTDrizzle Team
Created by Hocus on 12/9/2023 in #help
`{ onDelete: "cascade" }` when the entity is in one-to-one relationship with multiple entities?
Yeah I think I am pretty happy with it. Appreciate your help!
26 replies
DTDrizzle Team
Created by Hocus on 12/9/2023 in #help
`{ onDelete: "cascade" }` when the entity is in one-to-one relationship with multiple entities?
the 2nd approach I am lost, I tried it but didnt get it to work
26 replies
DTDrizzle Team
Created by Hocus on 12/9/2023 in #help
`{ onDelete: "cascade" }` when the entity is in one-to-one relationship with multiple entities?
so in my case I have a one-to-one relation and I gave the 1st approach a try. It works with: - multiple FK columns, all null except for 1 - onDelete cascade But has a weird sideeffect: - this creates a weird flow in which I do the following 1. insert new friendRequest and return insertedId 2. insert new location with id from new friendRequest and return insertedId 3. update user created in step 1 with location id returned in step 2
26 replies
DTDrizzle Team
Created by Hocus on 12/9/2023 in #help
`{ onDelete: "cascade" }` when the entity is in one-to-one relationship with multiple entities?
I dont really understand this part: "If you don't include that where, you will fetch comments from cities and countries that have id of 1. I think adding the commentType is a cleaner solution IMO." why would there be multiple comments with the same ID of 1? Arent comment.id unique by the primary key constraint?
26 replies
DTDrizzle Team
Created by Hocus on 12/9/2023 in #help
`{ onDelete: "cascade" }` when the entity is in one-to-one relationship with multiple entities?
I need to let that sink in and wrap my head around this. how would that work with my friendRequests table since it doesnt have a id column but derives the PK from pk: primaryKey(table.sentById, table.receivedById)
26 replies
DTDrizzle Team
Created by Hocus on 12/9/2023 in #help
`{ onDelete: "cascade" }` when the entity is in one-to-one relationship with multiple entities?
if I understand correct, there are two approaches. - multiple fk columns, and only one for each row would be set, the others are null. or - adding a type and a type specific id
26 replies
DTDrizzle Team
Created by Hocus on 12/9/2023 in #help
`{ onDelete: "cascade" }` when the entity is in one-to-one relationship with multiple entities?
thanks
26 replies
DTDrizzle Team
Created by Hocus on 12/9/2023 in #help
`{ onDelete: "cascade" }` when the entity is in one-to-one relationship with multiple entities?
if I make the userId the primary key, wont that lock me out of having a friendRequest with a location as well? And my friendRequest table doesn't have a ID, but a derived primaryKey out of sentBy and receivedBy. I want to attach a location to both, user and friendRequest
26 replies
DTDrizzle Team
Created by Schred on 12/8/2023 in #help
How to use cascade with a multi-column foreign key?
oh, I think I literally just ran into the same issue ... I think? https://discord.com/channels/1043890932593987624/1183062166690082826/1183062166690082826
9 replies
DTDrizzle Team
Created by Hocus on 12/9/2023 in #help
`{ onDelete: "cascade" }` when the entity is in one-to-one relationship with multiple entities?
I tried to add onDelete to the users, friendRequests tables but this leads to the inverse effect I am trying to archive - it deletes the user/friendRequests when a location is deleted.
...
locationId: text("locationId").references(() => locations.id, { onDelete: "cascade" }),
...
...
locationId: text("locationId").references(() => locations.id, { onDelete: "cascade" }),
...
Because the friendRequests table doesnt have an id column, I am having trouble to figure out how to do this?
26 replies
DTDrizzle Team
Created by DammitMoonMoon on 11/23/2023 in #help
"Prepared statement already exists" error
and these are the env variables that vercel added automatically when I linked the project to vercel storage
9 replies
DTDrizzle Team
Created by DammitMoonMoon on 11/23/2023 in #help
"Prepared statement already exists" error
No description
9 replies
DTDrizzle Team
Created by DammitMoonMoon on 11/23/2023 in #help
"Prepared statement already exists" error
not much to look at I am afraid 😄
9 replies
DTDrizzle Team
Created by DammitMoonMoon on 11/23/2023 in #help
"Prepared statement already exists" error
import { sql } from "@vercel/postgres";
import { drizzle } from "drizzle-orm/vercel-postgres";

import * as schema from "./schema";

export const db = drizzle(sql, { schema });
import { sql } from "@vercel/postgres";
import { drizzle } from "drizzle-orm/vercel-postgres";

import * as schema from "./schema";

export const db = drizzle(sql, { schema });
9 replies
DTDrizzle Team
Created by DammitMoonMoon on 11/23/2023 in #help
"Prepared statement already exists" error
I tried all three urls provided by vercel: POSTGRES_URL POSTGRES_PRISMA_URL POSTGRES_URL_NON_POOLING all give the same error. Not sure though if I should have reset the db somehow or clear the existing prepared statements before switching URLs. I did find very little information on this specially for drizzle. I see that this is mentioned in the docs for prisma, but yeah not sure what else to try
9 replies
DTDrizzle Team
Created by DammitMoonMoon on 11/23/2023 in #help
"Prepared statement already exists" error
did you figure it out? I just ran into the same issue
9 replies
DTDrizzle Team
Created by Hocus on 12/5/2023 in #help
Updated drizzle-kit -> Error: Cannot find module 'drizzle-orm/pg-core'
I ended up switching to postgres, which then has thrown a missing "pg" dependency error. I installed it as a dev dependency now even though the rest of the app works without it. I assume studio needs it anyways but doesnt have it bundled itself?
7 replies
DTDrizzle Team
Created by Hocus on 12/5/2023 in #help
Updated drizzle-kit -> Error: Cannot find module 'drizzle-orm/pg-core'
will only be able to do this end of the week. But if you are down, bootstrap a project with https://create.t3.gg/ and update to latest drizzle version.
7 replies
DTDrizzle Team
Created by Hocus on 12/5/2023 in #help
Updated drizzle-kit -> Error: Cannot find module 'drizzle-orm/pg-core'
hmm nope, if that were the case, shoudn't it also fail in the previous version?
7 replies