@quickback-dev/cli 0.66.7 → 0.66.9

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.
Files changed (83) hide show
  1. package/dist/commands/build.d.ts +0 -1
  2. package/dist/commands/build.d.ts.map +1 -1
  3. package/dist/commands/build.js +11 -2
  4. package/dist/commands/build.js.map +1 -1
  5. package/dist/commands/build.test.js +53 -2
  6. package/dist/commands/build.test.js.map +1 -1
  7. package/dist/commands/canary.d.ts +17 -5
  8. package/dist/commands/canary.d.ts.map +1 -1
  9. package/dist/commands/canary.js +34 -24
  10. package/dist/commands/canary.js.map +1 -1
  11. package/dist/commands/canary.test.d.ts +2 -0
  12. package/dist/commands/canary.test.d.ts.map +1 -0
  13. package/dist/commands/canary.test.js +100 -0
  14. package/dist/commands/canary.test.js.map +1 -0
  15. package/dist/commands/deploy.d.ts +14 -1
  16. package/dist/commands/deploy.d.ts.map +1 -1
  17. package/dist/commands/deploy.js +49 -19
  18. package/dist/commands/deploy.js.map +1 -1
  19. package/dist/commands/deploy.test.d.ts +2 -0
  20. package/dist/commands/deploy.test.d.ts.map +1 -0
  21. package/dist/commands/deploy.test.js +139 -0
  22. package/dist/commands/deploy.test.js.map +1 -0
  23. package/dist/index.js +3 -3
  24. package/dist/lib/compile-next-steps.d.ts.map +1 -1
  25. package/dist/lib/compile-next-steps.js +12 -5
  26. package/dist/lib/compile-next-steps.js.map +1 -1
  27. package/dist/lib/deployment-target.d.ts +29 -0
  28. package/dist/lib/deployment-target.d.ts.map +1 -0
  29. package/dist/lib/deployment-target.js +46 -0
  30. package/dist/lib/deployment-target.js.map +1 -0
  31. package/dist/lib/deployment-target.test.d.ts +2 -0
  32. package/dist/lib/deployment-target.test.d.ts.map +1 -0
  33. package/dist/lib/deployment-target.test.js +27 -0
  34. package/dist/lib/deployment-target.test.js.map +1 -0
  35. package/dist/lib/file-writer.d.ts +1 -1
  36. package/dist/lib/file-writer.d.ts.map +1 -1
  37. package/dist/lib/file-writer.js +2 -3
  38. package/dist/lib/file-writer.js.map +1 -1
  39. package/dist/lib/neon-canary.d.ts +4 -0
  40. package/dist/lib/neon-canary.d.ts.map +1 -1
  41. package/dist/lib/neon-canary.js +24 -4
  42. package/dist/lib/neon-canary.js.map +1 -1
  43. package/dist/lib/neon-canary.test.js +39 -3
  44. package/dist/lib/neon-canary.test.js.map +1 -1
  45. package/dist/lib/neon-target.d.ts +5 -48
  46. package/dist/lib/neon-target.d.ts.map +1 -1
  47. package/dist/lib/neon-target.js +18 -42
  48. package/dist/lib/neon-target.js.map +1 -1
  49. package/dist/lib/neon-target.test.js +26 -4
  50. package/dist/lib/neon-target.test.js.map +1 -1
  51. package/dist/lib/shell.d.ts +10 -0
  52. package/dist/lib/shell.d.ts.map +1 -1
  53. package/dist/lib/shell.js +20 -0
  54. package/dist/lib/shell.js.map +1 -1
  55. package/dist/lib/shell.test.js +35 -1
  56. package/dist/lib/shell.test.js.map +1 -1
  57. package/dist/lib/wrangler-resources.d.ts +1 -1
  58. package/dist/lib/wrangler-resources.d.ts.map +1 -1
  59. package/dist/lib/wrangler-resources.js +20 -9
  60. package/dist/lib/wrangler-resources.js.map +1 -1
  61. package/dist/lib/wrangler-resources.test.js +20 -0
  62. package/dist/lib/wrangler-resources.test.js.map +1 -1
  63. package/dist/schema-engine/index.js +3 -0
  64. package/dist/schema-engine/index.js.map +2 -2
  65. package/dist/schema-engine/provider-dialects.d.ts +1 -1
  66. package/dist/schema-engine/provider-dialects.d.ts.map +1 -1
  67. package/dist/skill/docs/configure/providers.md +18 -3
  68. package/dist/skill/docs/define/actions/scoped-db.md +88 -41
  69. package/dist/skill/docs/platform/database/d1.md +2 -2
  70. package/dist/skill/docs/platform/database/index.md +7 -2
  71. package/dist/skill/docs/platform/database/neon.md +283 -57
  72. package/dist/skill/docs/platform/database/planetscale-postgres.md +205 -0
  73. package/dist/skill/docs/start/deploy.md +30 -0
  74. package/dist/skill/docs/tooling/cli.md +41 -0
  75. package/package.json +1 -1
  76. package/src/skill/docs/configure/providers.md +18 -3
  77. package/src/skill/docs/define/actions/scoped-db.md +88 -41
  78. package/src/skill/docs/platform/database/d1.md +2 -2
  79. package/src/skill/docs/platform/database/index.md +7 -2
  80. package/src/skill/docs/platform/database/neon.md +283 -57
  81. package/src/skill/docs/platform/database/planetscale-postgres.md +205 -0
  82. package/src/skill/docs/start/deploy.md +30 -0
  83. package/src/skill/docs/tooling/cli.md +41 -0
@@ -50,6 +50,7 @@ Run it again any time. When every id is real, there's nothing to create — the
50
50
 
51
51
  | Flag | Effect |
52
52
  |------|--------|
53
+ | `--env <logical-target>` | Select a named target from `environments` (or legacy `providers.database.environments`). Required for named projects. |
53
54
  | `--dry-run` | Print the provisioning plan (what would be created vs. what's already set) and exit. Creates nothing. |
54
55
  | `--skip-deploy` | Provision resources + sync ids + recompile, but skip migrations and the deploy itself. |
55
56
  | `--force` | Overwrite a config id that differs from what Cloudflare reports. Without it, a mismatch prints both values and aborts — never silently overwritten. |
@@ -63,6 +64,35 @@ quickback deploy --dry-run
63
64
  quickback deploy --skip-deploy
64
65
  ```
65
66
 
67
+ ## Named deployment targets
68
+
69
+ ```bash
70
+ quickback deploy --env dev
71
+ quickback deploy --env prod --dry-run
72
+ ```
73
+
74
+ The argument is the **logical config key**. If `dev` declares
75
+ `worker.env: "preview-blue"` and `name: "existing-dev-worker"`, Quickback
76
+ selects `[env.preview-blue]`, migrates only that target's D1 bindings with
77
+ `--env preview-blue`, and uploads that Worker. Top-level bindings are not
78
+ inherited. Both environment placements are supported; declaring both is an
79
+ error. Missing or unknown targets stop before resource creation, migrations,
80
+ or upload.
81
+
82
+ Named targets must already have their D1, KV and Hyperdrive IDs configured in
83
+ their own `worker.bindings`. If an ID is a placeholder, deployment stops before
84
+ provisioning; create that target's resources manually, enter its IDs and run
85
+ `quickback build`. The CLI does not splice named IDs into global provider config.
86
+ R2 buckets declared by the selected target are still ensured by name.
87
+ `--force` does not bypass these checks. `--skip-deploy` skips migrations and
88
+ upload, and `--dry-run` reports without creating resources.
89
+
90
+ Postgres migrations remain a separate operator-owned step, including for named
91
+ Neon targets. `quickback deploy --env dev` selects the Worker but does **not**
92
+ verify that the Hyperdrive origin matches the intended Neon branch, inspect
93
+ remote query caching, or apply Postgres migrations. Configure Hyperdrive with
94
+ query caching disabled and migrate the intended branch before deployment.
95
+
66
96
  ## Conflicting ids
67
97
 
68
98
  If `quickback.config.ts` already carries a real id for a resource and Cloudflare reports a different one for the same-named resource, `quickback deploy` prints both and stops:
@@ -173,6 +173,12 @@ get Postgres declarations; SQLite providers (`cloudflare-d1`,
173
173
  providers are refused with an error rather than written in the wrong
174
174
  dialect; no provider (or an unrecognized one) defaults to SQLite.
175
175
 
176
+ `quickback build` uses the same provider-to-dialect mapping when checking
177
+ managed columns, including with `--fix-schema`. An explicitly configured
178
+ unknown or MySQL provider stops the build before authored schema files are
179
+ changed. Omitting the database provider retains the SQLite default. Dialect
180
+ recognition does not add support for an unregistered database provider.
181
+
176
182
  ### Authored-Source Codemods
177
183
 
178
184
  ```bash
@@ -446,3 +452,38 @@ This can happen if your session token expired or if the API is temporarily unava
446
452
  quickback logout
447
453
  quickback login
448
454
  ```
455
+
456
+ ### Deploy a named target
457
+
458
+ ```bash
459
+ quickback deploy --env dev
460
+ quickback deploy --env prod --dry-run
461
+ ```
462
+
463
+ Named projects require a logical target from top-level `environments` or legacy
464
+ `providers.database.environments`. Quickback maps that key to the configured
465
+ `worker.env` and explicit Worker `name`; the Wrangler environment may differ
466
+ from the logical key. Only selected bindings participate in planning and D1
467
+ migrations. Unknown targets and duplicate placements reject before mutation.
468
+
469
+ Named D1/KV/Hyperdrive placeholder IDs must be provisioned and entered manually
470
+ in the target's `worker.bindings`, followed by `quickback build`. The CLI does
471
+ not overwrite global IDs for named targets. Postgres migrations and remote
472
+ Hyperdrive cache/target verification remain operator-owned. See
473
+ [Deploying](/start/deploy#named-deployment-targets).
474
+
475
+ ### Verify Neon migrations
476
+
477
+ ```bash
478
+ quickback canary dev --required
479
+ quickback canary prod --required --apply
480
+ ```
481
+
482
+ Canary uses the same logical environment mapping. `--required` fails instead
483
+ of skipping if credentials or branch configuration are missing; an unknown
484
+ named target or a non-Neon provider always fails. `--apply` rehearses on a
485
+ branch, then migrates the parent using the same selected database and migration
486
+ role. Local migration inventory changes abort parent apply. See
487
+ [Neon canaries](/platform/database/neon#required-migration-canaries) for role
488
+ selection, inventory-check limits and cleanup behavior. `quickback migrate`
489
+ continues to mean authored-source codemods, not database migration execution.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quickback-dev/cli",
3
- "version": "0.66.7",
3
+ "version": "0.66.9",
4
4
  "description": "CLI for Quickback — define your backend in TypeScript, compile to a fully wired Cloudflare Worker (or Bun / Node) with auth, database, migrations, security, CMS, and Account UI.",
5
5
  "author": "Kardoe Incorporated <paul@kardoe.com>",
6
6
  "license": "MIT",
@@ -59,15 +59,20 @@ providers: {
59
59
 
60
60
  ## Database Providers
61
61
 
62
- Two databases are supported, both Cloudflare-native:
62
+ Three provider names are supported — one SQLite target and one Postgres
63
+ implementation on two hosts:
63
64
 
64
65
  | Provider | Description |
65
66
  |----------|-------------|
66
67
  | `cloudflare-d1` | Cloudflare D1 (SQLite at the edge) |
67
- | `neon` | Neon serverless PostgreSQL (`@neondatabase/serverless` over HTTP) |
68
+ | `neon` | Neon serverless PostgreSQL (`@neondatabase/serverless` over HTTP, or postgres.js over Hyperdrive) |
69
+ | `planetscale-postgres` | [PlanetScale Postgres](/platform/database/planetscale-postgres) over a Cloudflare Hyperdrive binding — the same Postgres emitters as `neon` (Hyperdrive only) |
70
+
71
+ `planetscale` — without the suffix — is the MySQL name and is **not** a
72
+ registered provider; MySQL is not supported.
68
73
 
69
74
  One database provider per app: auth tables and feature tables always share the
70
- selected database. On `neon`, Better Auth uses its PostgreSQL/Drizzle adapter
75
+ selected database. On either Postgres provider, Better Auth uses its PostgreSQL/Drizzle adapter
71
76
  in the same Postgres database as your features; on `cloudflare-d1`, both use
72
77
  D1. A per-service map (`database: { auth: ..., features: ... }`) is rejected at
73
78
  compile time — mixed database providers are not supported.
@@ -126,6 +131,16 @@ The Worker connects through a single `DATABASE_URL` secret — auth and feature
126
131
  queries share it. See [Neon](/platform/database/neon) for
127
132
  connection modes, RLS, and the migration workflow.
128
133
 
134
+ #### PlanetScale Postgres Options
135
+
136
+ Same options, one transport: `connectionMode` accepts `"auto"` and
137
+ `"hyperdrive"` only (omitted is `"hyperdrive"`), `hyperdrive.id` is required,
138
+ and there is no `DATABASE_URL` Worker secret — the runtime reads
139
+ `env.HYPERDRIVE.connectionString`. `pooled` does not apply; Hyperdrive is the
140
+ pool. See [PlanetScale Postgres](/platform/database/planetscale-postgres) for
141
+ role bootstrap, the `role.branch_id` connection username, and the mandatory
142
+ cache-disabled Hyperdrive config.
143
+
129
144
  #### Audit Database
130
145
 
131
146
  Cross-tenant `unsafe` actions (see [Actions → Unsafe mode](/define/actions/scoped-db#unsafe-mode)) write mandatory audit events. Those events land in a dedicated D1 database — separate from your features DB — so audit history stays isolated from application data and can't be tampered with through a normal CRUD route.
@@ -74,11 +74,17 @@ intersected with the same authority context: a single or shared hydration
74
74
  target is required, while targets selected by distinct relationship lanes are
75
75
  optional and must be narrowed by the handler.
76
76
 
77
- For tables queried by authored actions, `resource.databaseAccess` adds an
78
- independent Postgres RLS policy without adding HTTP surface. It never mounts a
79
- read/CRUD route and never adds an OpenAPI operation. The action remains the API
80
- layer where validation, state transitions, side effects, and business logic
81
- belong; `databaseAccess` is only the database's row-level upper bound.
77
+ For tables queried by authored actions, `resource.databaseAccess` opens a
78
+ **delegated-principal lane** at the database: an independent Postgres RLS policy
79
+ with no HTTP surface. It never mounts a read/CRUD route and never adds an
80
+ OpenAPI operation. The action remains the API layer where validation, state
81
+ transitions, side effects, and business logic belong; `databaseAccess` is only
82
+ the database's row-level upper bound.
83
+
84
+ It exists for one reason. A delegated principal has no `userId`, no active
85
+ organization, and no membership roles, so the table's ordinary firewall
86
+ predicate — `organizationId = ctx.activeOrgId` — can never match for it. The
87
+ lane is the row rule that CAN: the principal's own verified claims.
82
88
 
83
89
  {/* doc-compile: skip — provider prerequisite: `resource.databaseAccess` compiles only on Cloudflare + Neon `connectionMode: "hyperdrive"` (RLS + transaction-local claims), and the gate's harness is D1. The file is otherwise whole and compiles on a Neon project. */}
84
90
  ```typescript
@@ -95,49 +101,81 @@ export const attendanceEvidence = q.table('attendanceEvidence', {
95
101
  });
96
102
 
97
103
  export default defineTable(attendanceEvidence, {
98
- // Ordinary account CRUD remains organization-scoped.
104
+ // The ACCOUNT lane: ordinary organization-scoped CRUD. This is the firewall,
105
+ // and the firewall is the only pillar that lowers to SQL.
99
106
  firewall: [
100
107
  { field: "organizationId", equals: "ctx.activeOrgId" },
101
108
  ],
102
109
 
103
- // Authored actions can use their caller-scoped db under one of two exact
104
- // row lanes. Sibling arms OR; fields in each arm AND.
110
+ // The DELEGATE lane: the event delegate has no active organization, so the
111
+ // firewall above can never admit it. Its rows are the ones its own claims
112
+ // name. Fields inside one arm AND; sibling `or` arms are independent lanes.
105
113
  databaseAccess: {
106
114
  select: {
107
- or: [
108
- {
109
- roles: ["AUTHENTICATED"],
110
- record: {
111
- organizationId: { equals: "$ctx.activeOrgId" },
112
- },
113
- },
114
- {
115
- principals: ["event_delegate"],
116
- record: {
117
- eventId: { equals: "$ctx.principal.claims.eventId" },
118
- personId: { equals: "$ctx.principal.claims.personId" },
119
- },
120
- },
121
- ],
115
+ principals: ["event_delegate"],
116
+ record: {
117
+ eventId: { equals: "$ctx.principal.claims.eventId" },
118
+ personId: { equals: "$ctx.principal.claims.personId" },
119
+ },
122
120
  },
123
121
  },
124
122
  });
125
123
  ```
126
124
 
127
- `databaseAccess` supports `select`, `insert`, `update`, and `delete` with a
128
- purpose-built, SQL-pushable rule language: `principals`, `roles`, recursive
129
- `or`/`and`, and record `equals` against a DB-visible account or principal
130
- context value. Application-only values such as `userRole`, functions, and
131
- request/body fields stay at the action access layer; the compiler refuses them
132
- inside database RLS rather than pretending PostgreSQL can evaluate them.
133
-
134
- Every authorization path must contain at least one nonempty record equality.
135
- A principal-only or role-only leaf is rejected; every `or` arm must be bounded.
136
- An `and` group is bounded when at least one child bounds every expansion (for
137
- example, a principal child AND an event-id record child). A node cannot mix
138
- leaf fields with `or`/`and`, because the boolean node is the complete rule.
139
- This mandatory shape prevents an action declaration from accidentally granting
140
- the delegated principal an entire table.
125
+ ### One lane, one policy
126
+
127
+ The compiler emits exactly **one** permissive policy per table with a lane,
128
+ `<table>_principal_scope`, whose `USING` is the OR over the declared principal
129
+ arms. Two principal types on the same table are two arms of that one policy,
130
+ not two policies.
131
+
132
+ Its **command is the lane's declared reach**:
133
+
134
+ | Declared | Emitted |
135
+ |----------|---------|
136
+ | `select` only | `FOR SELECT`, `USING` only — the lane reads and cannot write |
137
+ | any of `insert` / `update` / `delete` | `FOR ALL`, with the same predicate as `WITH CHECK` |
138
+
139
+ Whether a delegate may write is a property of the lane, declared once by the
140
+ author, so the database enforces it as the policy's command. Which *verb* a
141
+ caller may reach is still the API's decision — RLS is the lane backstop, not a
142
+ per-operation access matrix.
143
+
144
+ The policy is **permissive**, and PostgreSQL ORs permissive policies together,
145
+ so the lane opens *beside* the table's `<table>_scope` firewall policy rather
146
+ than narrowing it. That is the point — the delegated caller has no active
147
+ organization — but it means a `databaseAccess` arm is never a place to write a
148
+ restriction: a row that satisfies the arm is reachable even when the table
149
+ firewall would not have matched it, and even when it is soft-deleted.
150
+ Restrictions belong in `firewall`. The restrictive `<table>_deny_anon` and
151
+ `<table>_principal_fence` policies remain the only arms that cap every lane.
152
+
153
+ ### What the compiler refuses, and why
154
+
155
+ `databaseAccess` lowers **only** `principals` + `record`, plus recursive
156
+ `or`/`and` over those. Two shapes that used to be spellable here are now
157
+ compile errors:
158
+
159
+ - **`roles`, anywhere.** Authored roles are enforced by the API and never reach
160
+ SQL (generated RLS is a backstop, not a second copy of `access`), so a role
161
+ arm here promised an authorization the database did not enforce. `roles` is
162
+ absent from the `DatabaseAccessRule` type as well, so an editor rejects it
163
+ before the compiler does.
164
+ - **A `record` equality with no `principals` gate.** That is an owner or tenant
165
+ rule, and those go in `firewall` — the one pillar that lowers to SQL. If the
166
+ owner boundary must hold at the database, author it as a firewall arm.
167
+
168
+ Both produce: *databaseAccess lowers only delegated-principal lanes (principals
169
+ + record). Account-lane scope belongs in firewall; roles are enforced by the
170
+ API.*
171
+
172
+ Every authorization path must also contain at least one record equality. A
173
+ principal-only leaf is rejected; every `or` arm must be bounded on its own,
174
+ because each is an independent lane. An `and` group is one lane whose children
175
+ may split the principal gate and the row bound between them. A node cannot mix
176
+ leaf fields with `or`/`and`, because the boolean node is the complete rule. This
177
+ mandatory shape is what stops a lane declaration from quietly granting a
178
+ delegated principal an entire table.
141
179
 
142
180
  The supported equality sources are `ctx.userId`, `ctx.activeOrgId`,
143
181
  `ctx.activeTeamId`, `ctx.principal.actor.id`, optional principal session/family
@@ -145,10 +183,19 @@ ids, and `ctx.principal.claims.<name>` (with or without a leading `$`). The
145
183
  record keys are Drizzle/JavaScript table field names; Quickback resolves them
146
184
  through the table metadata and quotes the exact physical PostgreSQL identifier,
147
185
  so a field such as `eventId: text("event-id")` is safe. Unknown fields fail the
148
- compile. `ADMIN` and the app-only `INTERNAL` marker are forbidden on this DB
149
- surface, while `SYSADMIN` retains its explicit `cms.sysadmin` prerequisite. The
150
- feature is rejected outside Cloudflare + Neon Hyperdrive because those targets
151
- cannot guarantee request-scoped Postgres claims.
186
+ compile. Application-only values — `userRole`, functions, request/body fields —
187
+ stay at the action access layer; the compiler refuses them rather than
188
+ pretending PostgreSQL can evaluate them. The feature is rejected outside
189
+ Cloudflare + Neon Hyperdrive because no other target can guarantee
190
+ request-scoped Postgres claims.
191
+
192
+ > **Upgrading.** The four per-operation `<table>_database_<op>` policies are
193
+ > retired. One appended `quickback_rls` migration drops them on every table and
194
+ > creates the single `<table>_principal_scope` where a lane is declared —
195
+ > append-only, like every other security migration. A `databaseAccess` block that
196
+ > still carries `roles` (or a principal-less `record`) fails the compile with the
197
+ > message above; move the account arm to `firewall` and keep the principal arm.
198
+
152
199
 
153
200
  ### Scoped relational-query safety
154
201
 
@@ -395,7 +395,7 @@ For all Quickback-generated code, D1's application-layer security provides equiv
395
395
  2. **Generated code enforces rules** - All CRUD and Action endpoints automatically apply firewall, access, guards, and masking.
396
396
  3. **Single entry point** - Every request flows through your API where security is enforced.
397
397
 
398
- Unlike Neon, where PostgreSQL RLS provides database-level enforcement (protecting data even if application code has bugs), D1's security comes from architecture: the database is inaccessible except through your Worker, and all generated routes apply the four security pillars. The trade-off is that **custom routes you write outside Quickback must manually apply security** — there is no database-level safety net.
398
+ Unlike Neon, where PostgreSQL RLS provides a database-level backstop (protecting tenant scope, soft delete and lane admission even if application code has bugs — roles, status, transitions and masking stay with the API either way, see [Row Level Security](/platform/database/neon#row-level-security)), D1's security comes from architecture: the database is inaccessible except through your Worker, and all generated routes apply the four security pillars. The trade-off is that **custom routes you write outside Quickback must manually apply security** — there is no database-level safety net.
399
399
 
400
400
  ### Comparison with Neon RLS
401
401
 
@@ -403,7 +403,7 @@ Unlike Neon, where PostgreSQL RLS provides database-level enforcement (protectin
403
403
  |----------|------|-----|
404
404
  | CRUD endpoints | ✅ Secure (RLS + App) | ✅ Secure (App) |
405
405
  | Actions | ✅ Secure (RLS + App) | ✅ Secure (App) |
406
- | Manual routes | ✅ RLS still protects | ⚠️ Must apply firewall |
406
+ | Manual routes | ✅ RLS still fences tenant scope, soft delete and lane admission — not roles | ⚠️ Must apply firewall |
407
407
  | External DB access | ⚠️ Possible with credentials | ✅ Not possible |
408
408
  | Dashboard queries | Via the Neon console | ⚠️ Admin only (audit logged) |
409
409
 
@@ -10,6 +10,7 @@ security definitions compile to either provider.
10
10
  |----------|----------|---------------|
11
11
  | [Cloudflare D1](/platform/database/d1) | CRUD-heavy SaaS, content catalogs, internal tools, straightforward workflows | Managed SQLite, no connection strings or pooling, Cloudflare-native operations, FTS5 and JSON functions when needed |
12
12
  | [Neon](/platform/database/neon) | Data-intensive products and apps designed around PostgreSQL | Native JSONB/arrays, `tsvector` + GIN, PostGIS/extensions, database RLS, advanced indexing and interactive transactions through Hyperdrive |
13
+ | [PlanetScale Postgres](/platform/database/planetscale-postgres) | The same Postgres implementation, hosted on PlanetScale | Identical generated schema, RLS and migrations to Neon; Cloudflare Hyperdrive only |
13
14
 
14
15
  ## Quick decision
15
16
 
@@ -18,11 +19,15 @@ security definitions compile to either provider.
18
19
  - Pick **Neon/Postgres** up front when advanced search, rich data types,
19
20
  sustained concurrent writes, Postgres extensions, or database-level RLS are
20
21
  product requirements.
21
- - Hyperdrive is optional: Neon HTTP is the lightweight default on Cloudflare;
22
- Hyperdrive is the full-featured lane for interactive transactions.
22
+ - Hyperdrive is optional on Neon: HTTP is the lightweight default on
23
+ Cloudflare, Hyperdrive the full-featured lane for interactive transactions.
24
+ On **PlanetScale Postgres** Hyperdrive is the only transport.
25
+ - The Postgres choice is a hosting choice: `neon` and `planetscale-postgres`
26
+ emit byte-identical schema and security migrations for the same definitions.
23
27
 
24
28
  ## Getting Started
25
29
 
26
30
  - **[D1 Setup](/platform/database/d1)** — Bindings, wrangler config, migrations
27
31
  - **[Using D1](/platform/database/using-d1)** — Drizzle queries, dual-DB mode, schema patterns
28
32
  - **[Neon](/platform/database/neon)** — Serverless Postgres setup and usage
33
+ - **[PlanetScale Postgres](/platform/database/planetscale-postgres)** — Roles, connection usernames, the cache-disabled Hyperdrive binding