Developer beta 0.1.0-beta.1 documentation. The build is not available for download yet; these pages describe the beta as built and tested on Linux x86-64.

Migration from PostgreSQL

holadb migrate postgres://user:password@host:5432/dbname ./dest [--lossy] [--only a,b] [--batch 5000] [--no-resume] [--json]

holadb migrate connects with its built-in PostgreSQL client (trust, cleartext and SCRAM-SHA-256 authentication), reads the schema from information_schema, creates the tables and indexes in the destination directory, streams the rows in batches, rebuilds the indexes, and verifies row counts and a per-row checksum against the source. It prints a report:

migration postgres://app@db:5432/shop → ./dest
  ✓ schema  users (6 columns, key: id → PRIMARY KEY (id))
      id: bigint → BIGINT [Exact]
      email: character varying → TEXT [Lossless] — length limit not enforced
      joined: timestamp with time zone → TIMESTAMP [Lossless] — converted to UTC
      balance: numeric(12,2) → DOUBLE PRECISION [Lossy] — numeric(12,2) → double precision (precision loss)
  ✓ table   users (12304 rows in source)
  ✓ rows    12304 migrated
  ✓ indexes users_email_key, users_name_idx
  ! foreign keys recorded, NOT enforced: orders_user_id_fkey
  ✓ verification counts 12304/12304, hash match
    (812 ms)
  ✗ events: column "shape": geometry is unsupported (unknown PostgreSQL type)
  ! not migrated: view v_users
OK in 1420 ms

(Without --lossy the balance column above would have failed the table with column "balance": numeric(12,2) → DOUBLE PRECISION is lossy (…); rerun with --lossy to accept.)

Rules, which the report always makes visible:

  • A column whose type maps exactly or losslessly migrates as is.
  • A column whose type maps lossily (precision, time zone, an enum label) is refused unless --lossy is given; the report names every such column.
  • A column whose type is unsupported stops that table; other tables continue. Nothing is dropped silently.
  • Every index is recreated (unique indexes as unique). Foreign keys are recorded in the table’s metadata and reported as not enforced; CHECK constraints, sequences, views, triggers and functions are reported as not migrated — HolaDB does not have them.
  • A table without a primary key gets a hidden row id and the report says so.
  • Verification failures (count or checksum mismatch, a source that changed underneath) mark the table ✗ and the exit status is 1.

Resuming

The destination keeps MIGRATION_STATE.json. Re-running the same command skips the tables already migrated and verified, and redoes the ones that failed. --no-resume starts over (a table created by the failed run is dropped; a table that existed before is never touched).

Type mapping

PostgreSQL HolaDB Kind Note
boolean BOOLEAN exact
smallint / smallserial SMALLINT exact
integer / serial INTEGER exact
bigint / bigserial BIGINT exact
real REAL exact
double precision DOUBLE PRECISION exact
text TEXT exact
varchar, char, bpchar, name, citext TEXT lossless length limit not enforced
bytea BYTEA exact
timestamp TIMESTAMP exact
timestamptz TIMESTAMP lossless converted to UTC
date TIMESTAMP lossless midnight UTC
json JSON exact
jsonb JSON lossless canonical JSON text
uuid TEXT lossless 36-character text
numeric, decimal, money DOUBLE PRECISION lossy precision loss; needs --lossy
time, timetz, interval TEXT lossy kept as text
inet, cidr, macaddr, xml, geometric types, tsvector, bit, oid TEXT lossy kept as text
enum (user-defined) TEXT lossy the label as text
any array type JSON lossy stored as a JSON array
anything else — unsupported the table is refused

TLS: ?sslmode=require (also verify-ca, verify-full) negotiates TLS and fails if the server refuses it; the server certificate chain and host name are always verified, against ?sslrootcert=/path/ca.pem or the Mozilla roots (so require is as strict as verify-full). prefer (the default, as in libpq) uses TLS when offered and continues in clear otherwise — not a guarantee; disable never asks. A cleartext-password request from the server is only answered over TLS. Unix sockets (?host=/var/run/postgresql) are plaintext.