@@ -103,7 +103,7 @@ pub fn run_pending_migrations_in_directory<Conn>(conn: &Conn, migrations_dir: &P
103103 -> Result < ( ) , RunMigrationsError > where
104104 Conn : MigrationConnection ,
105105{
106- try!( create_schema_migrations_table_if_needed ( conn) ) ;
106+ try!( setup_database ( conn) ) ;
107107 let already_run = try!( conn. previously_run_migration_versions ( ) ) ;
108108 let all_migrations = try!( migrations_in_directory ( migrations_dir) ) ;
109109 let pending_migrations = all_migrations. into_iter ( ) . filter ( |m| {
@@ -120,7 +120,7 @@ pub fn run_pending_migrations_in_directory<Conn>(conn: &Conn, migrations_dir: &P
120120pub fn revert_latest_migration < Conn > ( conn : & Conn ) -> Result < String , RunMigrationsError > where
121121 Conn : MigrationConnection ,
122122{
123- try!( create_schema_migrations_table_if_needed ( conn) ) ;
123+ try!( setup_database ( conn) ) ;
124124 let latest_migration_version = try!( conn. latest_run_migration_version ( ) ) ;
125125 revert_migration_with_version ( conn, & latest_migration_version, & mut stdout ( ) )
126126 . map ( |_| latest_migration_version)
@@ -158,7 +158,12 @@ fn migration_with_version(ver: &str) -> Result<Box<Migration>, MigrationError> {
158158}
159159
160160#[ doc( hidden) ]
161- pub fn create_schema_migrations_table_if_needed < Conn : Connection > ( conn : & Conn ) -> QueryResult < usize > {
161+ pub fn setup_database < Conn : Connection > ( conn : & Conn ) -> QueryResult < usize > {
162+ conn. setup_helper_functions ( ) ;
163+ create_schema_migrations_table_if_needed ( conn)
164+ }
165+
166+ fn create_schema_migrations_table_if_needed < Conn : Connection > ( conn : & Conn ) -> QueryResult < usize > {
162167 conn. silence_notices ( || {
163168 conn. execute ( "CREATE TABLE IF NOT EXISTS __diesel_schema_migrations (
164169 version VARCHAR PRIMARY KEY NOT NULL,
0 commit comments