Skip to main content

Module postgres

Module postgres 

Source
Expand description

One table in a PostgreSQL database.

A document is a row of document_storage keyed by tenant, project and name, with its body in a bytea column that Postgres keeps out of line. A put is one upsert and a get one select, so a reader never sees part of one body and part of its replacement. The body travels whole in both directions, as the Binary content layer handles it anyway; one Postgres value holds less than 1 GiB.

The table comes from the sqlx migrations haste-migrations holds (backend/crates/migrations/sql/document-storage), which admin migrate repo applies on PostgresDocumentStorage::pool. Their bookkeeping table is _document_storage_migrations, so they can share a database with another application’s sqlx migrations. In the Haste Health repository database the migration also ties a document to its project, so deleting the project deletes its documents.

Structs§

PostgresConfig
Settings for PostgresDocumentStorage.
PostgresDocumentStorage
DocumentStorage over one table of a PostgreSQL database.