DT
Drizzle Team•4w ago
ls

How to use drizzle-seed to seed data?

I tried to use the drizzle-seed library to seed my local DB, but I get an error. Libraries I'm using: "drizzle-orm": "^0.36.4", "drizzle-seed": "^0.1.2", This is my code:
import { seed } from 'drizzle-seed';
import * as schema from './Schema';

await seed(dbClient, schema);
import { seed } from 'drizzle-seed';
import * as schema from './Schema';

await seed(dbClient, schema);
Error I get with the postgres driver:
Seed error: TypeError: Cannot read properties of undefined (reading 'length')
at /myApp/node_modules/drizzle-seed/index.cjs:131270:50
at Array.every (<anonymous>)
at GenerateValuesFromArray.checks (/myApp/node_modules/drizzle-seed/index.cjs:131270:24)
at GenerateValuesFromArray.init (/myApp/node_modules/drizzle-seed/index.cjs:131312:14)
at SeedService.generateColumnsValuesByGenerators (/myApp/node_modules/drizzle-seed/index.cjs:134363:43)
at SeedService.generateTablesValues (/myApp/node_modules/drizzle-seed/index.cjs:134322:38)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async seedPostgres (/myApp/node_modules/drizzle-seed/index.cjs:134673:5)
at async seedFunc (/myApp/node_modules/drizzle-seed/index.cjs:134579:9)
at async DBService.seed (/myApp/dist/src/db/DBService.js:73:13)
Seed error: TypeError: Cannot read properties of undefined (reading 'length')
at /myApp/node_modules/drizzle-seed/index.cjs:131270:50
at Array.every (<anonymous>)
at GenerateValuesFromArray.checks (/myApp/node_modules/drizzle-seed/index.cjs:131270:24)
at GenerateValuesFromArray.init (/myApp/node_modules/drizzle-seed/index.cjs:131312:14)
at SeedService.generateColumnsValuesByGenerators (/myApp/node_modules/drizzle-seed/index.cjs:134363:43)
at SeedService.generateTablesValues (/myApp/node_modules/drizzle-seed/index.cjs:134322:38)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async seedPostgres (/myApp/node_modules/drizzle-seed/index.cjs:134673:5)
at async seedFunc (/myApp/node_modules/drizzle-seed/index.cjs:134579:9)
at async DBService.seed (/myApp/dist/src/db/DBService.js:73:13)
Any help would be appreciated!
2 Replies
Jack
Jack•4w ago
I also get this length error too. I will see if I can find anything else and update here I have tried node-postgres and postgres drivers and it still gives the same error 😬 Tested with drizzle-orm 0.36.4
Jack
Jack•4w ago
I am at a bit of a loss to be honest, it throws here, because it is trying to access a property "values" on an instance of SQL which does not exist I thought this may have come from the constraints and indexes part of defining the table but I commented them all out and I still get the same error
No description
Want results from more Discord servers?
Add your server