Clear resting sports orders once at scheduled kickoff

This commit is contained in:
2026-12-03 06:46:20 +08:00
parent 53b36cce82
commit 7b26767a97
10 changed files with 226 additions and 1 deletions
+8
View File
@@ -16,6 +16,7 @@ use validation::identifier;
mod book;
mod cancellation;
mod command;
mod kickoff;
mod ledger;
mod market;
mod minimum_size;
@@ -46,6 +47,13 @@ impl Exchange {
db.busy_timeout(Duration::from_secs(10))?;
db.execute_batch("PRAGMA foreign_keys=ON")?;
db.execute_batch(include_str!("schema.sql"))?;
let kickoff_ready: bool = db.query_row(
"SELECT EXISTS(SELECT 1 FROM sqlite_schema WHERE type='table' AND name='sports_kickoffs')",
[], |r| r.get(0),
)?;
if !kickoff_ready {
db.execute_batch(include_str!("kickoff_schema.sql"))?;
}
let activity_ready: bool = db.query_row(
"SELECT EXISTS(SELECT 1 FROM sqlite_schema WHERE type='table' AND name='wallet_migration')",
[], |r| r.get(0),