© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
Drizzle TeamDT
Drizzle Team•3y ago•
75 replies
JT

help with column builder types

As I play around with learning drizzle, I wondered if I could generate a drizzle schema from a master schema. I'm very close to being able to do that. As you can see in this repo I created: https://github.com/rizen/drizzle-icing/blob/main/user.ts

The code works perfectly, but problem is that when I try to use
InferModel
InferModel
to get the column types from my schema, I'm getting

type User {
   [x:string]: unknown;
}
type User {
   [x:string]: unknown;
}

Where the I would get the following on a hand-built table:

type User = {
    id: string;
    createdAt: Date;
    username: string;
    password: string;
    useAsDisplayName: "username" | "email" | "realName";
    admin: boolean;
}
type User = {
    id: string;
    createdAt: Date;
    username: string;
    password: string;
    useAsDisplayName: "username" | "email" | "realName";
    admin: boolean;
}

My guess is that the problem lies in the use of the
AnyMySqlColumnBuilder
AnyMySqlColumnBuilder
type in this function:

export const makeTable = (schema: icingSchema) => {
    const columns: Record<string, AnyMySqlColumnBuilder> = {};
    for (const prop of schema.props) {
        columns[prop.name] = prop.db(prop);
    }
    return mysqlTable(schema.tableName, columns) 
}
export const makeTable = (schema: icingSchema) => {
    const columns: Record<string, AnyMySqlColumnBuilder> = {};
    for (const prop of schema.props) {
        columns[prop.name] = prop.db(prop);
    }
    return mysqlTable(schema.tableName, columns) 
}

Any help on what I should do to get the appropriate types out for
InferModel
InferModel
?
GitHub
drizzle-icing/user.ts at main · rizen/drizzle-icing
A test trying to generate drizzle schemas from a master schema. - drizzle-icing/user.ts at main · rizen/drizzle-icing
drizzle-icing/user.ts at main · rizen/drizzle-icing
Drizzle TeamJoin
The official Discord for all Drizzle related projects, such as Drizzle ORM, Drizzle Kit, Drizzle Studio and more!
11,879Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements
Next page

Similar Threads

Custom aggregation column types
Drizzle TeamDTDrizzle Team / help
2y ago
Help with proper types (values)
Drizzle TeamDTDrizzle Team / help
3y ago
help with drizzle-zod with jsonb column
Drizzle TeamDTDrizzle Team / help
3y ago
Help with types relational query function
Drizzle TeamDTDrizzle Team / help
3y ago