© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
Drizzle TeamDT
Drizzle Team•15mo ago•
2 replies
buzyraccoon

Import problem with drizzle-kit generate

I'm migrating from TypeORM to Drizzle in my Node.js project to manage player data, but I'm facing an issue. I have created schemas in a folder to manage all of them, for example, core/schemas/*.schema.ts.

Some schemas need to use interfaces or types from my project or platform node modules. For example, I created a custom type for Vector3 from alt-server as follows:
Custom type code:
import { Vector3 } from 'alt-server';
import { customType } from 'drizzle-orm/mysql-core';

export const vector3 = (name: string) =>
    customType<{ data: Vector3; driverData: string; notNull: true; default: false }>({
        ...not nitro limit
        fromDriver(value: string): Vector3 {
            const { x, y, z } = JSON.parse(value);
            return new Vector3(x, y, z);
        },
    })(name);
import { Vector3 } from 'alt-server';
import { customType } from 'drizzle-orm/mysql-core';

export const vector3 = (name: string) =>
    customType<{ data: Vector3; driverData: string; notNull: true; default: false }>({
        ...not nitro limit
        fromDriver(value: string): Vector3 {
            const { x, y, z } = JSON.parse(value);
            return new Vector3(x, y, z);
        },
    })(name);
Schema code:
import { vector3 } from '../custom-types';

export const atmsTable = mysqlTable(
    'atms',
    {
        id: serial().notNull(),
        pos: vector3('pos'),
        rot: vector3('rot'),
    }...not nitro limit
);
import { vector3 } from '../custom-types';

export const atmsTable = mysqlTable(
    'atms',
    {
        id: serial().notNull(),
        pos: vector3('pos'),
        rot: vector3('rot'),
    }...not nitro limit
);
When I run drizzle-kit generate to generate SQL files for all the schemas, I get the following error:
Error: Cannot find module 'alt-server'
Require stack:
- src\server\core\custom-types.ts
- src\server\core\schemas\accounts.schema.ts
- node_modules\drizzle-kit\bin.cjs
Error: Cannot find module 'alt-server'
Require stack:
- src\server\core\custom-types.ts
- src\server\core\schemas\accounts.schema.ts
- node_modules\drizzle-kit\bin.cjs
Even if I use declare module or define the Vector3 class directly in the schema, I still encounter this issue when importing custom interfaces from other places. In short, I am unable to import external code.
Drizzle TeamJoin
The official Discord for all Drizzle related projects, such as Drizzle ORM, Drizzle Kit, Drizzle Studio and more!
11,879Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Issues with drizzle-kit generate
Drizzle TeamDTDrizzle Team / help
2y ago
issue drizzle-kit pull -> drizzle-kit-generate -> drizzle-kit migrations
Drizzle TeamDTDrizzle Team / help
9mo ago
drizzle-kit generate error
Drizzle TeamDTDrizzle Team / help
8mo ago
drizzle-kit generate with dynamic Schema
Drizzle TeamDTDrizzle Team / help
2y ago