1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
//! # pg_dbmigrator
//!
//! A Rust library for migrating PostgreSQL databases between two endpoints.
//!
//! * **Offline** — performs `pg_dump` against the source and `pg_restore` (or
//! `psql`) against the target. Equivalent to a one-shot dump-and-load.
//! * **Online** — first creates a logical replication slot on the source with
//! `EXPORT_SNAPSHOT`, runs a snapshot-consistent `pg_dump` / `pg_restore`,
//! and then issues `CREATE SUBSCRIPTION` on the target so PostgreSQL's
//! built-in apply worker streams WAL changes from the slot until the
//! operator triggers cutover.
//!
//! The crate is split into small, single-purpose modules so that it can be
//! consumed both as a library and from the bundled CLI binary.
//!
//! ## High level usage
//!
//! ```no_run
//! use pg_dbmigrator::{MigrationConfig, MigrationMode, Migrator, EndpointConfig};
//! use tokio_util::sync::CancellationToken;
//!
//! # async fn run() -> pg_dbmigrator::Result<()> {
//! let cfg = MigrationConfig {
//! mode: MigrationMode::Offline,
//! source: EndpointConfig::parse("postgresql://user:pw@src/db")?,
//! target: EndpointConfig::parse("postgresql://user:pw@dst/db")?,
//! ..MigrationConfig::default()
//! };
//!
//! let migrator = Migrator::new(cfg);
//! migrator.run(CancellationToken::new()).await?;
//! # Ok(())
//! # }
//! ```
//!
//! See the `examples/` directory for full programs.
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;