mirror of
https://github.com/whyour/qinglong.git
synced 2026-11-03 16:19:11 +08:00
Use MikroORM's official Node SQLite dialect with bounded database isolation, preserve legacy schema and data for rollback, and require Node 22.17 or newer. Update Debian runtimes and retain ARMv6 musl compatibility without a SQLite addon. Complete short archive writes, stop orphaned SQL workers after owner death, preserve buffered startup requests, and prestart the archived backend on every platform. Cover real package installation, migration, failure recovery, and legacy database compatibility. Keep authentication storage failures distinct from expired sessions with a pinned Keyv runtime, propagated cache errors, and retryable HTTP 503 responses. Preserve genuine 401 failures and verify legacy cache bytes, initialization safety, and session recovery.
18 lines
500 B
TypeScript
18 lines
500 B
TypeScript
import Logger from './logger';
|
|
import { database } from '../data';
|
|
import { initialSchema } from '../data/schema';
|
|
import { migrateSchema } from '../shared/schemaMigrations';
|
|
|
|
export default async () => {
|
|
try {
|
|
await database.transaction(async () => {
|
|
for (const sql of initialSchema) await database.query(sql);
|
|
await migrateSchema(database);
|
|
});
|
|
Logger.info('[boot] DB loaded');
|
|
} catch (error) {
|
|
Logger.error('[boot] DB load failed', error);
|
|
throw error;
|
|
}
|
|
};
|