AbsoluteJS

absolute db

Back up, restore, and seed any SQL database — whichever ORM you use.

#Usage

Run absolute db <backup|restore|seed> from your project root (available since @absolutejs/absolute 0.20.0-beta.121). The connection comes from DATABASE_URL (then POSTGRES_URL, DATABASE_URL_UNPOOLED, MYSQL_URL, TURSO_DATABASE_URL, LIBSQL_URL, MSSQL_URL), or pass --url. The engine is read from the URL scheme, falling back to the dialect in drizzle.config.ts or the Prisma datasource provider for a bare file path. It talks to the database directly, so it behaves the same whether you use Drizzle, Prisma, Kysely, or raw SQL.

BASH
# Back up every table to backups/<timestamp>.json (+ latest.json)
absolute db backup

# Scope, exclude, or send the dump elsewhere
absolute db backup --only users,posts
absolute db backup --exclude sessions --out ./snapshots

# Idempotent restore — upsert each row by primary key, foreign-key ordered
absolute db restore                      # newest backup: backups/latest.json
absolute db restore ./snapshots/backup-2026-05-25.json

# Wipe matching tables first, then restore (confirms; -y skips the prompt)
absolute db restore --truncate -y

# Run the project's seed script (db/seed.ts by default)
absolute db seed
absolute db seed ./db/demo-seed.ts

#Supported engines

PostgreSQL and CockroachDB (postgres://, postgresql://, cockroachdb://); MySQL, MariaDB, and SingleStore (mysql://, mariadb://, singlestore://); SQLite and local libSQL files (file:, sqlite:, or a path to a .db/.sqlite file); remote Turso (libsql://, https://, wss://); and SQL Server (sqlserver://, mssql://). Remote Turso needs @libsql/client installed and reads its token from TURSO_AUTH_TOKEN, LIBSQL_AUTH_TOKEN, or DATABASE_AUTH_TOKEN; SQL Server needs the mssql package. MongoDB and Gel are refused with an error rather than half-supported.

#Subcommands

backup dumps every table to a timestamped JSON file plus latest.json; scope it with --only, --exclude, and --out. restore is idempotent — it upserts each row by its real primary key, ordered so parent tables land before the rows that reference them, so re-running it changes nothing. Add --truncate for a clean reload (it confirms first, or pass -y). seed runs your project’s seed script (db/seed.ts by default, or a path you pass).

absolute db backup
$ absolute db backup
✓ backup → backups/backup-2026-05-25T18-30-42-239Z.json postgres: 8 tables, 1240 rows
absolute db restore
$ absolute db restore
✓ restored 8 tables, 1240 rows (idempotent upsert by primary key)

#How it works

The command introspects your database’s own catalog — information_schema on PostgreSQL and MySQL, pragma_table_xinfo on SQLite and libSQL, and the sys views on SQL Server — to discover tables, primary keys, and foreign keys. It reads and writes rows with Bun’s built-in SQL and SQLite clients, @libsql/client for remote Turso, and mssql for SQL Server — no coupling to your ORM. A backup records its engine, so restoring it into a different engine re-encodes values per column. Because restore keys off the real primary key, it is safe to run repeatedly and safe to bake a backup into your recovery runbook.