Skip to content

data copy can't migrate a Supabase database #82

Open

Description

@shipmill-romamo

Found while writing a Supabase migration guide for the site.

cloudfall data copy runs pg_dump --no-owner --no-privileges --format custom over the whole source database and pg_restore into the declared one (engine/ansible/roles/cloudfall_data_migration/tasks/main.yml). A typical Supabase database would not restore on a stock Debian PostgreSQL:

  • Platform schemas: auth, storage, realtime, graphql, vault, supabase_functions and others come along with public
  • Extensions not packaged for Debian: pg_graphql, pgsodium, supabase_vault, pg_net among them
  • Row-level security policies written TO anon or TO authenticated, roles that do not exist on the target; --no-privileges skips grants, not policies
  • References into auth: functions and policies in public that call auth.uid() or reference auth.users

The row-count check only covers schema public, so it would not show what was left behind either.

Expected: a way to migrate the application's own schemas from Supabase, with the platform schemas and extensions left out (or handled), and the guide saying plainly that Supabase Auth, Storage and Realtime stay with Supabase or need replacing.

Where it shows: the site rotates "Move off Render" and "Move off Neon"; Supabase is left out until this works.

Activity

  1. shipmill-romamo commented on Oct 16, 2026

    @shipmill-romamo
    ContributorAuthor

    Triage: postponed to after 0.7.0. Confirmed on main (3c2d06c): engine/ansible/roles/cloudfall_data_migration/tasks/main.yml runs pg_dump --no-owner --no-privileges --format custom over the whole source database with no schema or extension filter, and the row-count check in defaults/main.yml reads only table_schema = 'public'. A Supabase source would carry its platform schemas, Supabase-only extensions and RLS policies on anon/authenticated into the restore. Supporting it is a new migration mode, and 0.7.0 is in release candidates, which take bug fixes and broken promises only. Nothing promises Supabase today: #83 kept it out of the site's rotation.

    The plan:

    • Let a migration name the schemas it copies (--schema per schema, default public only), with the row-count check covering exactly those schemas
    • Before dumping, refuse with a clear error when the selected schemas depend on extensions or roles the target doesn't have (pg_graphql, pgsodium, supabase_vault, pg_net, anon, authenticated), listing each one, instead of a half-failed pg_restore
    • Report policies and functions that reference auth.* as blockers the team must rewrite; Cloudfall won't recreate Supabase Auth
    • A Supabase guide that says plainly that Auth, Storage and Realtime stay with Supabase or need replacing, proven on a real Supabase project before it goes on the site

    This needs a spec with acceptance criteria before any code. It comes back when the next stable release is out, or sooner if the maintainer promotes it to a feature.

  2. added
    postponedTriage decided not now; revisited after the next stable release
    on Oct 16, 2026
  3. shipmill-romamo commented on Oct 20, 2026

    @shipmill-romamo
    ContributorAuthor

    Triage: feature, back after the 0.7.0 stable release (REVISIT).

    Still true on main (348ed73): cloudfall_data_migration dumps the whole source database with no schema or extension filter, and its row-count check reads only public. 0.7.0 is out, so the release-candidate bar no longer applies. The plan in the postponement stands (copy only named schemas, public by default, with the row count covering exactly those; refuse before dumping when they depend on extensions or roles the target lacks; report auth.* references as blockers), and it goes into a spec with acceptance criteria first. A Supabase guide follows only after a proving run on a real Supabase project, which the spec leaves out of its criteria.

    Written alongside #81's spec.

    The spec PR is being written now (docs/specs/007-data-copy-schemas.md); I'll put its link and the hold line here. Merging it is the approval.

  4. removed
    postponedTriage decided not now; revisited after the next stable release
    on Oct 20, 2026
  5. shipmill-romamo commented on Oct 20, 2026

    @shipmill-romamo
    ContributorAuthor

    The spec is in #103 (docs/specs/007-data-copy-schemas.md). One departure from the plan above: the default stays "every non-system schema", which is what pg_dump copies today, not public only. Narrowing the default would silently stop copying schemas such as Drizzle's drizzle. The row-count and empty-target checks then cover every copied schema. A restore now runs --single-transaction, so a failure leaves the target empty instead of half restored. Schemas are chosen with --schema on data copy and --data-schema on migrate.

    On hold: the build waits on #103, the spec

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions