1use anyhow::Result as AnyhowResult;
2
3pub mod mysql;
4pub mod postgres;
5pub mod sqlite;
6
7pub type VecSerial = Vec<i64>;
8
9pub trait Driver {
10 fn ensure_midas_schema(&mut self) -> AnyhowResult<()>;
11 fn drop_migration_table(&mut self) -> AnyhowResult<()>;
12 fn drop_database(&mut self, db_name: &str) -> AnyhowResult<()>;
13 fn count_migrations(&mut self) -> AnyhowResult<i64>;
14 fn get_completed_migrations(&mut self) -> AnyhowResult<VecSerial>;
15 fn get_last_completed_migration(&mut self) -> AnyhowResult<i64>;
16 fn add_completed_migration(&mut self, migration_number: i64) -> AnyhowResult<()>;
17 fn delete_completed_migration(&mut self, migration_number: i64) -> AnyhowResult<()>;
18 fn delete_last_completed_migration(&mut self) -> AnyhowResult<()>;
19 fn migrate(&mut self, query: &str, migration_number: i64) -> AnyhowResult<()>;
20 fn db_name(&self) -> &str;
21}