rogueturnip
rogueturnip
Explore posts from servers
DTDrizzle Team
Created by rogueturnip on 10/11/2023 in #help
branches with neon
I was wondering if anyone is using Neon with drizzle in a production setup. I've got things setup nicely for development using a branch called "dev". What I'm wondering is what is the procedure now that I want to start getting my "main" branch ready. How do I do my migration into this branch given I have a number of migration files that have come along with my development process. I've been looking for some good documentation of going from development to production but I haven't found anything.
I am using Next 13 and deploy to vercel. Thanks!
1 replies
DTDrizzle Team
Created by rogueturnip on 10/3/2023 in #help
one-to-many
I might be asking something simple or have to change my model but I thought I'd ask cause I've been stuck for a while. I have an images table
export const images = pgTable('images', {
id: text('id')
.$defaultFn(() => `image_${nanoid()}`)
.primaryKey(),
label: text('label'),
url: text('url'),
resourceId: text('resource_id'),
resourceType: text('resource_type'),
createdAt: timestamp('created_at').defaultNow().notNull(),
});
export const images = pgTable('images', {
id: text('id')
.$defaultFn(() => `image_${nanoid()}`)
.primaryKey(),
label: text('label'),
url: text('url'),
resourceId: text('resource_id'),
resourceType: text('resource_type'),
createdAt: timestamp('created_at').defaultNow().notNull(),
});
you can see I have a resourceId and a resourceType because I have different things that can have relations to images. I know I could create a table inbetween but I thought I'd try there, where I'm stuck is on setting up the relation. All the documentation shows
many(images)
many(images)
But when I run it I get an error on the resource I'm doing the with as "There is not enough information to infer the relation" Any suggestions?
6 replies