Initial commit: Ham Radio Award Portal
Features implemented: - User authentication (register/login) with JWT - SQLite database with Drizzle ORM - SvelteKit frontend with authentication flow - ElysiaJS backend with CORS enabled - Award definition JSON schemas (DXCC, WAS, VUCC, SAT) - Responsive dashboard with user profile Tech stack: - Backend: ElysiaJS, Drizzle ORM, SQLite, JWT - Frontend: SvelteKit, Svelte stores - Runtime: Bun - Language: JavaScript Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
26
src/backend/init-db.js
Normal file
26
src/backend/init-db.js
Normal file
@@ -0,0 +1,26 @@
|
||||
import Database from 'bun:sqlite';
|
||||
import { drizzle } from 'drizzle-orm/bun-sqlite';
|
||||
import * as schema from './db/schema/index.js';
|
||||
|
||||
const sqlite = new Database('./award.db');
|
||||
const db = drizzle({
|
||||
client: sqlite,
|
||||
schema,
|
||||
});
|
||||
|
||||
console.log('Creating database tables...');
|
||||
|
||||
// Use drizzle-kit to push the schema
|
||||
// Since we don't have migrations, let's use the push command
|
||||
const { execSync } = await import('child_process');
|
||||
|
||||
try {
|
||||
execSync('bun drizzle-kit push', {
|
||||
cwd: '/Users/joergdorgeist/Dev/award',
|
||||
stdio: 'inherit'
|
||||
});
|
||||
console.log('✓ Database initialized successfully!');
|
||||
} catch (error) {
|
||||
console.error('Failed to initialize database:', error);
|
||||
process.exit(1);
|
||||
}
|
||||
Reference in New Issue
Block a user