Skip to content

Phase 1: Core self-verifying D1 backup script #795

Closed

Description

@neuromechanist

Part of epic #794 (expands #655).

Build the backup engine in nemarOrg/nemar-db-backup:

  • scripts/lib.sh: wrangler/cfman wrapper + real-table enumeration (exclude _cf_*, sqlite_* except sqlite_sequence, datasets_fts virtual + 4 shadow tables; keep d1_migrations).
  • scripts/backup.sh: capture schema.sql from sqlite_master (filtered, tables->indexes->triggers, incl CREATE VIRTUAL TABLE datasets_fts); export each real table via d1 export --table <t> --no-schema, concatenate to data.sql; write manifest.json (timestamp, per-table row counts, schema sha).
  • Self-verify: load schema.sql+data.sql into a temp sqlite, compare row counts to the manifest, assert FTS rebuilds. Fail loud on mismatch.
  • Tested against live prod (read-only export) + local sqlite restore round-trip.
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

    feature

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions