ls
ls
DTDrizzle Team
Created by ls on 11/28/2024 in #help
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!
4 replies