routinelover
routinelover
DTDrizzle Team
Created by edarcode on 8/16/2024 in #help
seed
Yeah: the way you've written your code though doesn't work the way you think. id: text("id", { length: 36 }).primaryKey().default(crypto.randomUUID()) is equivalent to id: text("id", { length: 36 }).primaryKey().default("ba70af14-4cbc-4cbb-97b4-21d5c5c31b5c") . You're looking for something like id: text("id", { length: 36 }).primaryKey().$defaultFn(() => crypto.randomUUID())
14 replies
DTDrizzle Team
Created by edarcode on 8/16/2024 in #help
seed
Hope that helps!
14 replies
DTDrizzle Team
Created by edarcode on 8/16/2024 in #help
seed
That's why you're seeing the "unique constraint failed" error
14 replies
DTDrizzle Team
Created by edarcode on 8/16/2024 in #help
seed
Guessing here (I'm not going to set this up to run it) but it looks like you're assigning the same id to every user at runtime: the .default(crypto.randomUUID()) runs once, and sets a single UUID as the default
14 replies