Postgres export

One command writes a project out as a bundle you restore into your own Postgres: typed tables generated from your models, your published content, and links to download your files.

One command

foir export postgres writes an archive to the current directory. Give it a connection string as the target and the CLI applies the bundle from your own machine with psql, without sending the string to Fóir. The bundle is streamed to you and is not stored on our side. Restoring needs Postgres 15 or newer.

Typed tables and foreign keys

Each model that holds records becomes a typed table, generated from its published schema, with your field keys as snake-cased columns. Beside them are tables for files, per-locale translations, multi-valued references and access grants. A reference that points at one model becomes a foreign key, applied after the data loads. One that may point at several models gets none, because a single constraint cannot name several tables.

Published content, unless you ask for more

The typed tables hold the published version of each record. Drafts, older versions and unpublished variants are left out, and so is a record that was never published. A model without versioning or publishing exports its records as stored. Add --include-raw and the bundle gains one table holding every record as stored, as JSON.

Files as download links

The bundle does not contain the files themselves. It lists a time-limited download link for each file your exported content references, with a script that fetches each to the path the content points at. You get the originals, and files that nothing references are not listed. Anyone holding the list can download until the links expire, so treat it as a secret.

The verification file

The export prints what it could not carry: dangling references and values that would not fit their column, both written as NULL. It refuses to produce a bundle when the rows it unloaded disagree with an independent count of published records. On your restored database, validate.sql re-checks row counts and per-column checksums. It does not check the access rules.

Read the detail

The export guide walks through running the command, what is in the bundle, restoring it yourself and verifying the result.