@@ -19,9 +19,7 @@ use crate::utils::migrations::get_existing_migrations;
1919pub mod config;
2020pub mod sql_builder;
2121
22- /**
23- Options for running migrations
24- */
22+ /// Options for running migrations
2523pub struct MigrateOptions {
2624 /// Directory, migrations exist in
2725 pub migration_dir : String ,
@@ -36,21 +34,19 @@ pub struct MigrateOptions {
3634 pub apply_until : Option < u16 > ,
3735}
3836
39- /**
40- Helper method to apply one migration. Writes also to last migration table.
41-
42- `migration`: [&Migration]: Reference to the migration to apply.
43- `pool`: [&SqlitePool]: Pool to apply the migration onto.
44- `last_migration_table_name`: [&str]: Name of the table to insert successful applied migrations into.
45- */
37+ /// Helper method to apply one migration. Writes also to last migration table.
38+ ///
39+ /// - `migration`: [`&Migration`](Migration): Reference to the migration to apply.
40+ /// - `db`: [`&Database`](Database): Database to apply the migration onto.
41+ /// - `last_migration_table_name`: [`&str`]: Name of the table to insert successful applied migrations into.
4642pub async fn apply_migration (
4743 dialect : DBImpl ,
4844 migration : & Migration ,
49- pool : & Database ,
45+ db : & Database ,
5046 last_migration_table_name : & str ,
5147 do_log : bool ,
5248) -> anyhow:: Result < ( ) > {
53- let mut tx = pool
49+ let mut tx = db
5450 . start_transaction ( )
5551 . await
5652 . with_context ( || format ! ( "Error while starting transaction {}" , migration. id) ) ?;
@@ -72,7 +68,7 @@ pub async fn apply_migration(
7268 println ! ( "{query_string}" ) ;
7369 }
7470
75- pool . execute :: < Nothing > ( query_string, bind_params) . await . with_context ( || {
71+ db . execute :: < Nothing > ( query_string, bind_params) . await . with_context ( || {
7672 format ! (
7773 "Error while inserting applied migration {last_migration_table_name} into last migration table" ,
7874 )
0 commit comments