feat(db): drizzle-schema, db-client und initiale migration
Vollstaendiges Datenmodell: Katalog (manufacturer, theme, set, tag, instruction), Besitz (collection_item, location, missing_part, photo), Wunschlisten (wishlist, wishlist_item) und die Auth-Tabellen von better-auth inklusive passkey und invite. Kernregel: ein set ist ein Katalogeintrag, ein collection_item die Verknuepfung mit dem tatsaechlichen Besitz. Preise liegen als Cent in INTEGER-Spalten, damit Summen exakt bleiben. SQLite laeuft mit WAL, foreign_keys=ON und busy_timeout. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
import path from 'node:path';
|
||||
import { config as loadEnv } from 'dotenv';
|
||||
import { defineConfig } from 'drizzle-kit';
|
||||
|
||||
loadEnv({ path: '.env', quiet: true });
|
||||
|
||||
// drizzle-kit runs outside the app, so it reads the raw env instead of src/env
|
||||
// (which would demand runtime-only variables such as BETTER_AUTH_SECRET).
|
||||
const dataDir = path.resolve(process.env.DATA_DIR ?? './data');
|
||||
|
||||
export default defineConfig({
|
||||
dialect: 'sqlite',
|
||||
schema: './src/db/schema/index.ts',
|
||||
out: './drizzle',
|
||||
dbCredentials: {
|
||||
url: path.join(dataDir, 'db', 'bricktrack.db'),
|
||||
},
|
||||
strict: true,
|
||||
verbose: true,
|
||||
});
|
||||
Reference in New Issue
Block a user