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,25 @@
/// <reference types="./mysql-adapter.d.ts" />
import { sql } from '../../raw-builder/sql.js';
import { DialectAdapterBase } from '../dialect-adapter-base.js';
const LOCK_ID = 'ea586330-2c93-47c8-908d-981d9d270f9d';
const LOCK_TIMEOUT_SECONDS = 60 * 60;
export class MysqlAdapter extends DialectAdapterBase {
get supportsTransactionalDdl() {
return false;
}
get supportsReturning() {
return false;
}
async acquireMigrationLock(db, _opt) {
// Kysely uses a single connection to run the migrations. Because of that, we
// can take a lock using `get_lock`. Locks acquired using `get_lock` get
// released when the connection is destroyed (session ends) or when the lock
// is released using `release_lock`. This way we know that the lock is either
// released by us after successfull or failed migrations OR it's released by
// MySQL if the process gets killed for some reason.
await sql `select get_lock(${sql.lit(LOCK_ID)}, ${sql.lit(LOCK_TIMEOUT_SECONDS)})`.execute(db);
}
async releaseMigrationLock(db, _opt) {
await sql `select release_lock(${sql.lit(LOCK_ID)})`.execute(db);
}
}