Migrating
Moving to Napalm
A move means writing a schema, access rules and queries, then copying people, rows and files. These pages cover each step from your current platform.
- API
- —
- In the schema
- —
Parts of a move#
Six parts move from any platform. You write the first three and copy the last three.
Draft the schema and rules
Translate tables, models or collections into dbschema/default.gel with default-closed access.
Copy rows in batches
Page through existing records and import them cleanly through idempotent old_id statements.
- The schema
- Tables, collections or documents become types in
dbschema/default.gel. A foreign key becomes a link, and a join table becomes a link to many. - The rules
- Row-level security, security rules and handler checks become access rules on each type. A type with no rule is closed, so a forgotten rule never leaves data open.
- The queries
- SQL, ORM calls and server functions become one file each in
dbschema/queries, deployed by name.napalm generateemits a typed call for every query in your language. - People
- Each account becomes a person who reclaims every owned row at first sign-in. Moving your users walks through the flow.
- Rows
- A script reads the old system and sends batches to import statements you write. Switching over has the sender and the order.
- Files
- Napalm copies the bytes from any S3-compatible store into file records your schema checks.
Things left behind#
| You had | Here | So |
|---|---|---|
A database connection: psql, an ORM or a pooler | One HTTPS endpoint per project | SoThe app calls deployed queries over HTTPS. A project’s address speaks neither SQL nor Gel’s wire protocol. |
| SQL functions, triggers, PL/pgSQL | Statements, rules and jobs | SoA function’s computation becomes a query. A trigger’s check becomes a rule or constraint. Work a trigger kicked off becomes a job queued in the same commit. |
| Transactions held open across requests | One statement per request | SoA single statement reads, inserts and updates many types at once and commits whole or not at all. |
| Password hashes | The project’s own sign-in | SoHashes cannot be imported. People return with a magic link, a sign-in provider or a fresh password. |
| A key that skips every check | Service keys under the same rules | SoA key reads and writes only the rows a rule grants its role. napalm keys reach measures that reach before you rely on the key. |
Starting points#
| Coming from | Start with | Covers |
|---|---|---|
| Postgres with an ORM or SQL | Coming from Postgres | CoversTables to types, the checks in your code to rules and ORM calls to queries. |
| Supabase | Coming from Supabase | CoversRLS policies, auth.users, Storage buckets, Realtime and Edge Functions. |
| Firebase | Coming from Firebase | CoversCollections, security rules, listeners, Cloud Functions and Firebase Authentication. |
| Convex | Coming from Convex | CoversTables and ids, query and mutation functions, scheduled work and file storage. |
| Gel | Coming from Gel | CoversYour schema and EdgeQL carry over. The client, the rules and the schema push process change. |
| Anything, with a coding agent | Moving with a coding agent | CoversThe files to hand the agent, its output and the commands that verify each step. |
The order of a move#
Every move follows five steps, rehearsed end to end on an isolated branch before main takes a single write.
Rehearse on an isolated branch first
Push schema and queries, load a copy of your data and check real caller reach before touching main.
Write the schema, the rules and the queries
Work on a branch of a new project.
napalm schema draftwrites an initial schema from Postgres, Prisma or Convex, as How a schema is translated shows.napalm schema push --branchandnapalm queries push --branchverify the schema and queries without touchingmain.Move a copy and verify the counts
Run the move against the branch and compare its row counts with the old system. Check access as real people with
napalm people reach.Turn sign-in on
Enable the sign-in methods your users already rely on and deploy the claim query that binds each person’s rows at first sign-in.
Switch
Load
mainwhile the old system serves traffic. Pause writes on the old system, send one final pass and ship the app pointed at Napalm.Clean up
Revoke the move’s key and remove its rules. Drop the temporary old-id fields once no query reads them.