File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -14,6 +14,11 @@ for Rust libraries in [RFC #1105](https://github.com/rust-lang/rfcs/blob/master/
1414* Added support for the ` timestamp with time zone ` type in PostgreSQL (referred
1515 to as ` diesel::types::Timestamptz ` )
1616
17+ ### Fixed
18+
19+ * ` diesel migrations run ` will now respect migration directories overridden by
20+ command line argument or environment variable
21+
1722## [ 0.7.2] - 2016-08-20
1823
1924* Updated nightly version and syntex support.
Original file line number Diff line number Diff line change @@ -15,19 +15,27 @@ use std::{env, fs};
1515use std:: path:: Path ;
1616
1717macro_rules! call_with_conn {
18- ( $database_url: ident,
19- $func: path
18+ (
19+ $database_url: ident,
20+ $( $func: ident) ::+
21+ ) => { {
22+ call_with_conn!( $database_url, $( $func) ::+ ( ) )
23+ } } ;
24+
25+ (
26+ $database_url: ident,
27+ $( $func: ident) ::+ ( $( $args: expr) ,* )
2028 ) => { {
2129 match :: database:: backend( & $database_url) {
2230 #[ cfg( feature = "postgres" ) ]
2331 "postgres" => {
2432 let conn = PgConnection :: establish( & $database_url) . unwrap( ) ;
25- $func( & conn)
33+ $( $ func) ::+ ( & conn, $ ( $args ) , * )
2634 } ,
2735 #[ cfg( feature = "sqlite" ) ]
2836 "sqlite" => {
2937 let conn = SqliteConnection :: establish( & $database_url) . unwrap( ) ;
30- $func( & conn)
38+ $( $ func) ::+ ( & conn, $ ( $args ) , * )
3139 } ,
3240 _ => unreachable!( "The backend function should ensure we never get here." ) ,
3341 }
Original file line number Diff line number Diff line change @@ -114,9 +114,10 @@ fn main() {
114114
115115fn run_migration_command ( matches : & ArgMatches ) {
116116 match matches. subcommand ( ) {
117- ( "run" , Some ( _ ) ) => {
117+ ( "run" , Some ( args ) ) => {
118118 let database_url = database:: database_url ( matches) ;
119- call_with_conn ! ( database_url, migrations:: run_pending_migrations)
119+ let dir = migrations_dir ( args) ;
120+ call_with_conn ! ( database_url, migrations:: run_pending_migrations_in_directory( & dir, & mut stdout( ) ) )
120121 . unwrap_or_else ( handle_error) ;
121122 }
122123 ( "revert" , Some ( _) ) => {
You can’t perform that action at this time.
0 commit comments