gaffer_driver_pgo (gaffer v0.6.0)
View SourcePostgres driver for gaffer using pgo.
Summary
Types
PGO driver state.
PGO pool configuration passed to pgo:start_pool/2.
Options for starting the PGO driver.
Functions
Lists known and applied migration versions.
Rolls back migrations down to the given version.
Starts the driver and optionally a pool.
Stop the driver.
Types
-opaque driver_state()
PGO driver state.
-type pool_config() :: map().
PGO pool configuration passed to pgo:start_pool/2.
-type start_opts() :: #{pool := atom(), start => pool_config()}.
Options for starting the PGO driver.
Use a PGO pool with the identifier pool. If start options are supplied, the
driver starts its own PGO pool with that name and those options. Otherwise an
existing pool is used, and ensuring this pool is started is the responsibility
of the user.
Functions
-spec migrations(driver_state()) -> #{all := [non_neg_integer()], applied := [non_neg_integer()]}.
Lists known and applied migration versions.
Returns a map with two keys. all is the static list of versions known to this
binary, sorted ascending. applied is the set of versions recorded in the
migrations table, sorted ascending.
-spec rollback(TargetVersion :: non_neg_integer(), driver_state()) -> ok.
Rolls back migrations down to the given version.
Runs the entire rollback inside one transaction guarded by a transaction-scoped advisory lock.
Raises error({migration_checksum_mismatch, Version, Stored, Expected}) if a
stored migration's SQL has changed since it was applied.
Starts the driver and optionally a pool.
Runs any pending migrations atomically inside one transaction guarded by a transaction-scoped advisory lock, so concurrent boots serialise. Verifies the SHA-256 checksum of every already-applied migration against the static SQL in the current version of this library.
Raises error({migration_checksum_mismatch, Version, Stored, Expected}) if a
stored migration's SQL has changed since it was applied.
Stop the driver.
Also stops the connection pool if started by the driver.