@dbsp/adapter-pgsql 5.0.0 → 7.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -15,14 +15,14 @@ pnpm add @dbsp/adapter-pgsql pg
15
15
 
16
16
  ```typescript
17
17
  import { createOrm } from '@dbsp/core';
18
- import { createPgsqlAdapter } from '@dbsp/adapter-pgsql';
18
+ import { createPgAdapter } from '@dbsp/adapter-pgsql';
19
19
  import { Pool } from 'pg';
20
20
 
21
21
  const pool = new Pool({ connectionString: process.env.DATABASE_URL });
22
22
 
23
23
  const orm = createOrm({
24
24
  schema: db,
25
- adapter: createPgsqlAdapter(pool),
25
+ adapter: createPgAdapter(pool),
26
26
  });
27
27
 
28
28
  const rows = await orm.select('users').where(eq('active', true)).all();
@@ -34,11 +34,11 @@ Compile SQL without a database connection — useful for CLI tooling, CI plan in
34
34
 
35
35
  ```typescript
36
36
  import { createOrm, eq } from '@dbsp/core';
37
- import { createPgsqlCompileOnlyAdapter } from '@dbsp/adapter-pgsql';
37
+ import { createPgCompileOnlyAdapter } from '@dbsp/adapter-pgsql';
38
38
 
39
- // This is a connectionless PgsqlAdapter: dump() works; database operations
40
- // refuse at runtime until you instead construct createPgsqlAdapter(pool).
41
- const adapter = createPgsqlCompileOnlyAdapter();
39
+ // This is a connectionless PgAdapter: dump() works; database operations
40
+ // refuse at runtime until you instead construct createPgAdapter(pool).
41
+ const adapter = createPgCompileOnlyAdapter();
42
42
  const orm = createOrm({ schema: db, adapter });
43
43
  const { sql, params } = orm.select('users').where(eq('active', true)).dump();
44
44
  // sql, params — no Pool needed
@@ -53,8 +53,8 @@ const { sql, params } = orm.select('users').where(eq('active', true)).dump();
53
53
  - **Parameterized queries** — All user values use `$N` positional parameters; no SQL injection surface
54
54
  - **Identifier quoting** — All table/column/schema names are double-quoted automatically
55
55
  - **AST-based compiler** — SQL is built from the plan AST, never from string templates
56
- - **DDL provisioning** — pure model-to-model `compareSchemata()` + `generateDDL()` with 12-phase topological sort; use live `comparePgsqlDatabaseSchema()` when provisioning from an introspected PostgreSQL database
57
- - **Schema migrations** — `generateMigrationSQL()` with UP/DOWN sections and destructive-change safety gate
56
+ - **DDL provisioning** — build one `PgPhysicalModel` with `createPgPhysicalModel()`, then use pure model-to-model `compareSchemata()` + `generateDDL()` with 12-phase topological sort; use live `comparePgDatabaseSchema()` when provisioning from an introspected PostgreSQL database
57
+ - **Schema migrations** — `generateMigrationSQL()` consumes the physical-model comparison with UP/DOWN sections and destructive-change safety gate
58
58
  - **Schema introspection** — Reflect live database structure back into `ModelIR`
59
59
  - **Row-Level Security** — `rlsEnabled` + `policies[]` on `TableIR`, compiled to `CREATE POLICY` DDL
60
60
  - **Streaming & cursors** — `orm.select(...).stream()` and server-side cursor support