Initial commit - Event Planner application
This commit is contained in:
22
node_modules/kysely/dist/esm/dialect/postgres/postgres-adapter.js
generated
vendored
Normal file
22
node_modules/kysely/dist/esm/dialect/postgres/postgres-adapter.js
generated
vendored
Normal 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.
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user