kingtimm
kingtimm
Explore posts from servers
NNuxt
Created by kingtimm on 3/9/2024 in #❓・help
Server Bundle Size with Clerk
Im not too familiar with the server bundle size. I've gotten it down to 985kB against Vercel's 1MB limit. I'm using vue-clerk and h3-clerk which instruct adding them to build.transpile. That seems to add most of the size. Any tips to try to reduce the server bundle size? nuxi analyze doesn't provide much detail into the server.mjs file
1 replies
DTDrizzle Team
Created by kingtimm on 9/21/2023 in #help
Simple ForeignKey With statement not working
Hi - I am attempting to use a with statement on a query and am getting this error: Cannot read properties of undefined (reading 'referencedTable') Here's the query:
await db.query.faves.findMany({
with: {
firstName: true,
middleName: true
}
await db.query.faves.findMany({
with: {
firstName: true,
middleName: true
}
Here is the schema
export const names = sqliteTable('names', {
id: integer('id').primaryKey(),
name: text('name').notNull(),
createdAt: integer('created_at', { mode: 'timestamp' }).notNull(),
})

export type Name = InferSelectModel<typeof names>

export const faves = sqliteTable('faves', {
id: integer('id').primaryKey(),
firstName: integer('first_name_id').references(() => names.id),
middleName: integer('middle_name_id').references(() => names.id),
createdAt: integer('created_at', { mode: 'timestamp' }).notNull(),
})
export const names = sqliteTable('names', {
id: integer('id').primaryKey(),
name: text('name').notNull(),
createdAt: integer('created_at', { mode: 'timestamp' }).notNull(),
})

export type Name = InferSelectModel<typeof names>

export const faves = sqliteTable('faves', {
id: integer('id').primaryKey(),
firstName: integer('first_name_id').references(() => names.id),
middleName: integer('middle_name_id').references(() => names.id),
createdAt: integer('created_at', { mode: 'timestamp' }).notNull(),
})
Do I need to add a relationship? From the docs - it seemed like the foreignkey would be enough. The "Faves" table is just a record of favorite combinations from the "Names" table.
2 replies