You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
555 B
23 lines
555 B
import './env';
|
|
import { dbGlobal } from "./lib/db";
|
|
import { usersTable } from "./lib/schema/schema";
|
|
import bcrypt from "bcryptjs";
|
|
|
|
async function main() {
|
|
const passwordHash = bcrypt.hashSync("seed-password-123", 10);
|
|
await dbGlobal.insert(usersTable).values(
|
|
Array.from({ length: 5 }).map((_, i) => ({
|
|
name: `Seed User ${i}`,
|
|
age: 20 + i,
|
|
email: `seed${i}@example.com`,
|
|
passwordHash,
|
|
})),
|
|
);
|
|
console.log('Seed complete!');
|
|
process.exit(0);
|
|
}
|
|
|
|
main().catch((e) => {
|
|
console.error(e);
|
|
process.exit(1);
|
|
});
|
|
|