@@ -76,9 +76,19 @@ program
7676 . alias ( 'up' )
7777 . description ( 'Migrate to the given migration' )
7878 . action ( function ( to , options ) {
79- console . log ( 'Migrating up to: "%s" [TODO] ' , to ) ;
79+ console . log ( 'Migrating up to: "%s"' , to ) ;
8080 var server = program . server || process . cwd ( ) + '/server/server.js' ;
8181 var app = require ( path . resolve ( process . cwd ( ) , server ) ) ;
82+ app . models . Migration . migrate ( 'up' , to )
83+ . then ( function ( res ) {
84+ console . log ( 'Done.' ) ;
85+ } )
86+ . catch ( function ( err ) {
87+ console . log ( err ) ;
88+ } )
89+ . finally ( function ( ) {
90+ process . exit ( ) ;
91+ } ) ;
8292 } ) . on ( '--help' , function ( ) {
8393 console . log ( ' Examples:' ) ;
8494 console . log ( ) ;
@@ -92,9 +102,19 @@ program
92102 . alias ( 'down' )
93103 . description ( 'Rollback to the given migration' )
94104 . action ( function ( to , options ) {
95- console . log ( 'Rolling back to: "%s" [TODO] ' , to ) ;
105+ console . log ( 'Rolling back to: "%s"' , to ) ;
96106 var server = program . server || process . cwd ( ) + '/server/server.js' ;
97107 var app = require ( path . resolve ( process . cwd ( ) , server ) ) ;
108+ app . models . Migration . migrate ( 'down' , to )
109+ . then ( function ( res ) {
110+ console . log ( 'Done.' ) ;
111+ } )
112+ . catch ( function ( err ) {
113+ console . log ( err ) ;
114+ } )
115+ . finally ( function ( ) {
116+ process . exit ( ) ;
117+ } ) ;
98118 } ) . on ( '--help' , function ( ) {
99119 console . log ( ' Examples:' ) ;
100120 console . log ( ) ;
0 commit comments