mirror of
https://github.com/Portabase/agent.git
synced 2026-10-20 11:21:34 +00:00
fix: pgdump-cluster (#68)
* feat: add as_str/from_str to PostgresDumpFormat * feat: resolve pg_dumpall/psql binary names * feat: add include_globals field to database config * feat: add pg_dumpall/psql globals dump and apply * feat: add postgres backup bundle (manifest + build + resolve) * feat: bundle globals into postgres backup when include_globals is set * feat: replay globals before pg_restore when backup archive is a bundle * refactor: bind FD restore tempdir guard once to clear unused warnings * docs: demonstrate include_globals in sample databases.json * chore: silence test-only re-export warning in non-test builds * revert: remove include_globals feature, restore plain pg_dump/pg_restore * feat: add pg_dumpall/psql binary names and is_superuser check * feat: add postgresql-cluster db type and config parsing * feat: pg_dumpall cluster backup and psql restore * feat: route postgresql-cluster through PostgresClusterDatabase * docs: add postgresql-cluster sample to databases.json * refactor: split cluster mode into cluster/ module (backup, restore, database) * test: mirror cluster tests into src/tests/domain/cluster/
This commit is contained in:
+19
-6
@@ -17,6 +17,8 @@ pub enum DbType {
|
||||
Mysql,
|
||||
Mariadb,
|
||||
Postgresql,
|
||||
#[serde(rename = "postgresql-cluster")]
|
||||
PostgresqlCluster,
|
||||
MongoDB,
|
||||
Sqlite,
|
||||
Redis,
|
||||
@@ -31,6 +33,7 @@ impl DbType {
|
||||
DbType::Mysql => "mysql",
|
||||
DbType::Mariadb => "mariadb",
|
||||
DbType::Postgresql => "postgresql",
|
||||
DbType::PostgresqlCluster => "postgresql-cluster",
|
||||
DbType::MongoDB => "mongodb",
|
||||
DbType::Sqlite => "sqlite",
|
||||
DbType::Redis => "redis",
|
||||
@@ -169,21 +172,26 @@ impl ConfigService {
|
||||
}
|
||||
|
||||
let username = match db.db_type {
|
||||
DbType::Postgresql | DbType::Mysql | DbType::Mariadb | DbType::Mssql => {
|
||||
required(&db.username, &db.name, "username")?
|
||||
}
|
||||
DbType::Postgresql
|
||||
| DbType::PostgresqlCluster
|
||||
| DbType::Mysql
|
||||
| DbType::Mariadb
|
||||
| DbType::Mssql => required(&db.username, &db.name, "username")?,
|
||||
_ => optional(&db.username),
|
||||
};
|
||||
|
||||
let password = match db.db_type {
|
||||
DbType::Postgresql | DbType::Mysql | DbType::Mariadb | DbType::Mssql => {
|
||||
required(&db.password, &db.name, "password")?
|
||||
}
|
||||
DbType::Postgresql
|
||||
| DbType::PostgresqlCluster
|
||||
| DbType::Mysql
|
||||
| DbType::Mariadb
|
||||
| DbType::Mssql => required(&db.password, &db.name, "password")?,
|
||||
_ => optional(&db.password),
|
||||
};
|
||||
|
||||
let host = match db.db_type {
|
||||
DbType::Postgresql
|
||||
| DbType::PostgresqlCluster
|
||||
| DbType::Mysql
|
||||
| DbType::Mariadb
|
||||
| DbType::MongoDB
|
||||
@@ -196,6 +204,7 @@ impl ConfigService {
|
||||
|
||||
let port = match db.db_type {
|
||||
DbType::Postgresql
|
||||
| DbType::PostgresqlCluster
|
||||
| DbType::Mysql
|
||||
| DbType::Mariadb
|
||||
| DbType::MongoDB
|
||||
@@ -208,6 +217,10 @@ impl ConfigService {
|
||||
|
||||
let database_name = match db.db_type {
|
||||
DbType::Sqlite | DbType::Redis | DbType::Valkey => optional(&db.database),
|
||||
DbType::PostgresqlCluster => db
|
||||
.database
|
||||
.clone()
|
||||
.unwrap_or_else(|| "postgres".to_string()),
|
||||
_ => required(&db.database, &db.name, "database")?,
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user