migration

moving from convex, supabase, raw postgres, prisma, drizzle, or firebase to briven.

every sentence on this page is proven by a real migration. the per-source detail (§ convex, § supabase, …) lands incrementally as each first migration clears. if a step on your source isn't covered yet, ping us — the missing part is a known gap, not a deliberate omission.

five principles

  1. 1

    read before write

    read this entire page once before running any command. migrations that go sideways almost always do so because someone skipped this step.

  2. 2

    parallel-run, don't switch

    for at least 48 hours, the old system and briven run side-by-side, on the same data, serving the same traffic. no cutover before the parallel-run window.

  3. 3

    back up twice

    two independent backups to two independent destinations before you touch anything. verify both before proceeding.

  4. 4

    schema first, data second, functions third, traffic last

    in that order, always. inverting the order leaves windows where something is half-migrated and a write goes to the wrong place.

  5. 5

    one product at a time

    never migrate two things in parallel. the cognitive load of one migration is enough.

the ten-step playbook

every migration follows these ten steps in order. specific commands vary per source — per-source detail pages cover those.

  1. 1

    inventory the source

    list every table, view, function, trigger, extension, env var, and external service the source project depends on. count rows per table. document the auth model in plain language. write it all into a migration-inventory.md so later steps don't surprise you.

  2. 2

    set up the briven project

    install @briven/cli, briven login, briven init, create the project in the dashboard, note the project id and the admin api key. configure the region closest to your users.

  3. 3

    back up the source twice

    non-negotiable. two backups, two destinations, both restored to a temp database and row-counted to verify. don't proceed to step 4 until both verify.

  4. 4

    port the schema

    translate the source schema into briven/schema.ts using the briven schema dsl. table-by-table — don't try to do it in one pass. preserve foreign-key relationships and indexes.

  5. 5

    port the functions

    every server-side function (convex query/mutation, supabase edge function, prisma RPC) becomes a file under briven/functions/. wrap each with query() or mutation() from @briven/cli/server.

  6. 6

    set up env vars

    briven env set <key> <value> for every secret the source project uses. encrypted at rest with the platform key. the runtime injects them into ctx.env at cold start.

  7. 7

    copy the data

    pg_dump from the source, pg_restore into the briven data plane via the project's dsn (briven db shell-token issues a short-lived dsn). row-count every table — it must match step 1.

  8. 8

    parallel-run for 48 hours

    point a fraction of read traffic at briven, keep writes on the source. observe error rates, p50/p99 latency, and any function failures. divergence here is the time to surface migration bugs — not after the cutover.

  9. 9

    cut over writes

    flip the dns or the client config. writes now go to briven; the source becomes read-only. keep the source running for at least another 7 days as a rollback target.

  10. 10

    decommission

    after 7 days of green metrics, archive the source database to cold storage and tear down the running source. keep the archive for 90 days minimum.

per-source guides

each source has its own path through the ten steps. these expand as the first migration of each kind clears.

when not to use this

  • moving between briven projects — wait for briven export / import (private beta)
  • moving a briven project between regions — file a support ticket
  • migrating only data without schema changes — use pg_dump / pg_restore directly