A very minimal subset of pg_dump --data-only
with multi-tenancy in mind. A solution to: https://postgrespro.com/list/thread-id/1715772
Most options are specified via config file.
```toml columnname = "customerid" schemaname = "public" databaseurl = "postgres://localhost:15432/postgres" features = ["currency", "audit"] skiptables = [ "backup&", "^obsolete_" # ... more regular expressions ]
[overrides]
customers = """ select * from customers where id in :ids """
user_files
table doesn't have a customer_id column, so we need to join.userfiles = """ select userfiles.* from usersfiles join users on users.id = userfiles.userid where users.customerid in :ids """ dailyexchangerates = """ select * from dailyexchangerates where 'currency' = any (currentsetting('pgparcel.features')::text[]) """ auditlog = """ select * from auditlog where customerid in :ids and ( ARRAY['audit'] && (currentsetting('pgparcel.features')::text[]) or createdat >= NOW() - INTERVAL '30 days' or updated_at >= NOW() - INTERVAL '30 days' ); """ ```
| Session Variable | Contains |
| ---------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| pg_parcel.ids
| The list of all values passed with --id
|
| pg_parcel.features
| The list of features defined in the pg_parcel.toml
file, minus any features turned off with --no-feature
. If --features
is set, they take precedence over the config file, but --no-features
is final. |
| pg_partial.feature.
myfeature
| Same rules as pg_parcel.features
, but one variable per setting. The value is just true
Override queries can still use IN :ids
but session variables are now preferred. |
We publish binaries for both Linux x86_64 (any distro, using musl) and macOS Universal (both Intel and Apple Silicon in a single binary).
To create a new release, update Cargo.toml
and create a tag like v1.2.3
(SemVer, prefixed with v
).
Licensed under either of
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.