|
1 |
| -// This file is specifically for drizzle-kit when generating SQLite migrations. |
2 |
| -// It defines the actual SQLite tables with proper foreign key relationships. |
| 1 | +// SINGLE SOURCE OF TRUTH FOR DATABASE SCHEMA |
| 2 | +// This file is the definitive schema definition for the SQLite database. |
| 3 | +// It is used by: |
| 4 | +// - Drizzle Kit for generating migrations (npm run db:generate) |
| 5 | +// - The application runtime for table definitions and type safety |
| 6 | +// - All database operations and queries |
| 7 | +// |
| 8 | +// IMPORTANT: When making schema changes: |
| 9 | +// 1. Edit this file (schema.sqlite.ts) ONLY |
| 10 | +// 2. Run `npm run db:generate` to create migrations |
| 11 | +// 3. The changes will be automatically applied on next server start |
| 12 | +// |
| 13 | +// DO NOT create or edit schema.ts - this file has been removed to avoid confusion. |
3 | 14 |
|
4 | 15 | import { sqliteTable, text, integer } from 'drizzle-orm/sqlite-core';
|
5 | 16 |
|
@@ -96,3 +107,9 @@ export const passwordResetTokens = sqliteTable('passwordResetTokens', {
|
96 | 107 | expires_at: integer('expires_at', { mode: 'timestamp' }).notNull(),
|
97 | 108 | created_at: integer('created_at', { mode: 'timestamp' }).notNull().$defaultFn(() => new Date()),
|
98 | 109 | });
|
| 110 | + |
| 111 | +// Plugin table definitions - populated dynamically by the plugin system |
| 112 | +// This object will hold definitions for plugin tables, to be populated dynamically. |
| 113 | +// Key: Table name (e.g., 'myPlugin_myTable') |
| 114 | +// Value: Column definitions object (e.g., { id: (b:any)=>b('id'), name: (b:any)=>b('name') }) |
| 115 | +export const pluginTableDefinitions: Record<string, Record<string, (columnBuilder: any) => any>> = {}; |
0 commit comments