Skip to content

Commit

Permalink
chore: attempt 5
Browse files Browse the repository at this point in the history
  • Loading branch information
conradbekondo committed Jan 22, 2025
1 parent 001d9f0 commit cbf8b9f
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions scripts/seed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,11 @@ neonConfig.webSocketConstructor = global.WebSocket ?? ws;
const logger = process.env['NODE_ENV'] === 'development' ? new DefaultLogger({ writer: new DefaultWriter() }) : false
console.log('db url = ', process.env['DATABASE_URL'])
const db = drizzle(new Pool({ connectionString: String(process.env['DATABASE_URL']) }), { logger });
db.$client.connect().then(() =>
db.transaction(async t => {
for await (const { seed, name } of seeders) {
console.log(`Seeding "${name} ⚙️`);
await seed(t as unknown as PgTransaction<any>);
console.log(`Seeded "${name}" ✅`);
}
}))
.then(() => db.$client.end())
db.transaction(async t => {
for await (const { seed, name } of seeders) {
console.log(`Seeding "${name} ⚙️`);
await seed(t as unknown as PgTransaction<any>);
console.log(`Seeded "${name}" ✅`);
}
}).then(() => db.$client.end())
.catch(console.error);

0 comments on commit cbf8b9f

Please sign in to comment.