Skip to content

Commit 7cac664

Browse files
authored
Merge pull request #394 from superfly/fix-backups
Use crsqlite connection when preparing backup
2 parents abc327f + c0b69f0 commit 7cac664

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

crates/corrosion/src/main.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ use corro_types::{
2020
api::{ExecResult, QueryEvent, Statement},
2121
base::CrsqlDbVersion,
2222
config::{default_admin_path, Config, ConfigError, LogFormat, OtelConfig},
23+
sqlite::CrConn,
2324
};
2425
use futures::StreamExt;
2526
use once_cell::sync::OnceCell;
@@ -180,7 +181,9 @@ async fn process_cli(cli: Cli) -> eyre::Result<()> {
180181
_ = tokio::fs::create_dir_all(parent).await;
181182
}
182183

183-
let conn = Connection::open(&path)?;
184+
// crsqlite connection here cause crsql_site_id table has a trigger
185+
// that calls a crsqlite function.
186+
let conn = CrConn::init(Connection::open(&path)?)?;
184187

185188
let tables: Vec<String> = conn.prepare("SELECT name FROM sqlite_schema WHERE type = 'table' AND name LIKE '%__crsql_clock'")?.query_map([], |row| row.get(0))?.collect::<Result<Vec<_>, _>>()?;
186189

0 commit comments

Comments
 (0)