Initial commit - Event Planner application

This commit is contained in:
mberlin
2026-03-18 14:55:56 -03:00
commit 86d779eb4d
7548 changed files with 1006324 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
import { CompiledQuery } from 'kysely';
import { AbstractSqlConnection } from '../../AbstractSqlConnection.js';
export class BaseSqliteConnection extends AbstractSqlConnection {
createKyselyDialect(options) {
throw new Error(
'No SQLite dialect configured. Pass a Kysely dialect via the `driverOptions` config option, ' +
'e.g. `new NodeSqliteDialect(...)` for node:sqlite or a custom dialect for other libraries.',
);
}
async connect(options) {
await super.connect(options);
await this.getClient().executeQuery(CompiledQuery.raw('pragma foreign_keys = on'));
await this.attachDatabases();
}
async attachDatabases() {
const attachDatabases = this.config.get('attachDatabases');
if (!attachDatabases?.length) {
return;
}
const { fs } = await import('@mikro-orm/core/fs-utils');
const baseDir = this.config.get('baseDir');
for (const db of attachDatabases) {
const path = fs.absolutePath(db.path, baseDir);
await this.execute(`attach database '${path}' as ${this.platform.quoteIdentifier(db.name)}`);
}
}
}