L-Mario564 / drizzle-dbml-generator

Generate DBML markup from your schema defined with Drizzle ORM.
MIT License
161 stars 8 forks source link

TypeError: b.build is not a function #22

Open tylerjenningsw opened 1 week ago

tylerjenningsw commented 1 week ago

I have this strange error on this line in the library:

`node_modules\drizzle-dbml-generator\dist\index.cjs:180
const builtIndexes = Object.values(extraConfig ?? {}).map((b) => b.build(table));
                                                                   ^
TypeError: b.build is not a function
    at C:\Users\twj19\source\repos\personal\widgetboard-backend\widgetboard-backend\node_modules\drizzle-dbml-generator\dist\index.cjs:180:72
    at Array.map (<anonymous>)
    at PgGenerator.generateTable (C:\Users\twj19\source\repos\personal\widgetboard-backend\widgetboard-backend\node_modules\drizzle-dbml-generator\dist\index.cjs:180:59)      
    at PgGenerator.generate (C:\Users\twj19\source\repos\personal\widgetboard-backend\widgetboard-backend\node_modules\drizzle-dbml-generator\dist\index.cjs:315:35)
    at pgGenerate (C:\Users\twj19\source\repos\personal\widgetboard-backend\widgetboard-backend\node_modules\drizzle-dbml-generator\dist\index.cjs:359:68)
    at <anonymous> (c:\Users\twj19\source\repos\personal\widgetboard-backend\widgetboard-backend\src\db\dbml.ts:5:1)
    at ModuleJob.run (node:internal/modules/esm/module_job:192:25)
    at async CustomizedModuleLoader.import (node:internal/modules/esm/loader:246:24)
    at async loadESM (node:internal/process/esm_loader:40:7)
    at async handleMainPromise (node:internal/modules/run_main:66:12)

Node.js v20.3.1`

I'm using the following versions:

"drizzle-dbml-generator": "^0.9.0",
"drizzle-kit": "^0.24.2",

And my code using tsx:


import * as schema from './schema';
import { pgGenerate } from "drizzle-dbml-generator";

pgGenerate({ schema, out: './schema.dbml', relational: true })
console.log("✅ Created the schema.dbml file");
console.log("⏳ Creating the erd.svg file");