- Add session-based authentication (login page, middleware, auth context) - Add cron-like scrip scheduler for time-based conditions - Add layout builder, scrip wizard, searchable select components - Add trend chart widget for dashboards - Add notifications, attachments, queue-permissions API routes - Add seed-users script - Update schema with 10 new migrations (0008-0017) - Apply redesign: Linear-inspired dark theme, conversation-centric UI - Gitignore runtime data directory Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
29 lines
833 B
TypeScript
29 lines
833 B
TypeScript
import { drizzle } from 'drizzle-orm/node-postgres';
|
|
import { Pool } from 'pg';
|
|
import { users } from '../src/db/schema.ts';
|
|
|
|
const pool = new Pool({ connectionString: process.env.DATABASE_URL! });
|
|
const db = drizzle(pool);
|
|
|
|
const BATCH = 100;
|
|
const TOTAL = 1000;
|
|
const password = await Bun.password.hash('password');
|
|
|
|
console.log(`Inserting ${TOTAL} users...`);
|
|
for (let i = 0; i < TOTAL; i += BATCH) {
|
|
const batch = [];
|
|
for (let j = i; j < Math.min(i + BATCH, TOTAL); j++) {
|
|
const n = String(j).padStart(4, '0');
|
|
batch.push({
|
|
username: `user${n}`,
|
|
email: `user${n}@test.local`,
|
|
role: 'staff',
|
|
password_hash: password,
|
|
});
|
|
}
|
|
await db.insert(users).values(batch as any).onConflictDoNothing();
|
|
process.stdout.write('.');
|
|
}
|
|
console.log(`\nDone. ${TOTAL} users seeded.`);
|
|
await pool.end();
|