UI styling improvements: dashboard headers and navigation
- Restore blue PageHeader on Dashboard (/app-components) - Update homepage (/) with subtle header design without blue bar - Add uniform PageHeader styling to application edit page - Fix Rapporten link on homepage to point to /reports overview - Improve header descriptions spacing for better readability
This commit is contained in:
43
backend/src/services/database/normalized-schema-init.ts
Normal file
43
backend/src/services/database/normalized-schema-init.ts
Normal file
@@ -0,0 +1,43 @@
|
||||
/**
|
||||
* Database Schema Initialization
|
||||
*
|
||||
* Ensures normalized EAV schema is initialized before services use it.
|
||||
*/
|
||||
|
||||
import { getDatabaseAdapter } from './singleton.js';
|
||||
import { NORMALIZED_SCHEMA_POSTGRES, NORMALIZED_SCHEMA_SQLITE } from './normalized-schema.js';
|
||||
import { logger } from '../logger.js';
|
||||
|
||||
let initialized = false;
|
||||
let initializationPromise: Promise<void> | null = null;
|
||||
|
||||
/**
|
||||
* Ensure database schema is initialized
|
||||
*/
|
||||
export async function ensureSchemaInitialized(): Promise<void> {
|
||||
if (initialized) return;
|
||||
if (initializationPromise) {
|
||||
await initializationPromise;
|
||||
return;
|
||||
}
|
||||
|
||||
initializationPromise = (async () => {
|
||||
try {
|
||||
// Use shared database adapter singleton
|
||||
const db = getDatabaseAdapter();
|
||||
const isPostgres = db.isPostgres === true;
|
||||
|
||||
// Execute schema
|
||||
const schema = isPostgres ? NORMALIZED_SCHEMA_POSTGRES : NORMALIZED_SCHEMA_SQLITE;
|
||||
await db.exec(schema);
|
||||
|
||||
logger.info(`Database schema initialized (${isPostgres ? 'PostgreSQL' : 'SQLite'})`);
|
||||
initialized = true;
|
||||
} catch (error) {
|
||||
logger.error('Failed to initialize database schema', error);
|
||||
throw error;
|
||||
}
|
||||
})();
|
||||
|
||||
await initializationPromise;
|
||||
}
|
||||
Reference in New Issue
Block a user