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,22 @@
/// <reference types="./postgres-adapter.d.ts" />
import { sql } from '../../raw-builder/sql.js';
import { DialectAdapterBase } from '../dialect-adapter-base.js';
// Random id for our transaction lock.
const LOCK_ID = BigInt('3853314791062309107');
export class PostgresAdapter extends DialectAdapterBase {
get supportsTransactionalDdl() {
return true;
}
get supportsReturning() {
return true;
}
async acquireMigrationLock(db, _opt) {
// Acquire a transaction level advisory lock.
await sql `select pg_advisory_xact_lock(${sql.lit(LOCK_ID)})`.execute(db);
}
async releaseMigrationLock(_db, _opt) {
// Nothing to do here. `pg_advisory_xact_lock` is automatically released at the
// end of the transaction and since `supportsTransactionalDdl` true, we know
// the `db` instance passed to acquireMigrationLock is actually a transaction.
}
}