 
       it 'should be able rollback once with many migrations', (done)->
         @tableName = 'many_migrations'
-        rollbackScopeDefault(@adapter, migrationsPath, @tableName, (err, versions)=>
+        rollbackScopeDefault(@adapter, migrationsPath, @tableName, true, (err, versions)=>
           return done(err) if err
           assert.equal(versions.length, 4)
           CustomAssertions.assertTableColumnCount(@AdapterWrapper, @tableName, 2, done)
         )
 
+      it 'should be able to rollback twice correctly', (done)->
+        @tableName = 'many_migrations'
+        rollbackScopeDefault(@adapter, migrationsPath, @tableName, true, (err, versions)=>
+          return done(err) if err
+          rollbackScopeDefault(@adapter, migrationsPath, @tableName, false, (e, vers)=>
+            return done(err) if err
+            assert.equal(vers.length, 3)
+            CustomAssertions.assertTableColumnCount(@AdapterWrapper, @tableName, 3, done)
+          )
+        )
+
     context 'when a valid steps argument is given', ->
       it 'should be able rollback two steps', (done)->
         @tableName = 'many_migrations'
-        rollbackScope(@adapter, migrationsPath, @tableName, 2, (err, versions)=>
+        rollbackScope(@adapter, migrationsPath, @tableName, 2, true, (err, versions)=>
           return done(err) if err
           assert.equal(versions.length, 3)
           CustomAssertions.assertTableColumnCount(@AdapterWrapper, @tableName, 3, done)

  migrateScope(adapter, migrationsPath, scope, null, cb)

# Runs rollback on the migration files that include provided name (scope)
rollbackScope = (adapter, migrationsPath, scope, steps, cb)->
  migrateScopeDefault(adapter, migrationsPath, scope, (err)=>
    return cb(err) if err
    Migrator.rollback(adapter, migrationsPath, steps, (err)=>
      return cb(err) if err
      SchemaMigration.getAllVersions(adapter, cb)
    )
  )

# Runs rollback with the default behavior which is when given no steps (null) then the migrator
# will rollback to the previous version
rollbackScopeDefault = (adapter, migrationsPath, scope, cb)->
  rollbackScope(adapter, migrationsPath, scope, null, cb)

describe 'migration', ->
  # reset the migrations folder


      it 'should be able to rollback once with two migrations', (done)->
        @tableName = 'two_migrations'
        rollbackScopeDefault(@adapter, migrationsPath, @tableName, true, (err, versions)=>
          return done(err) if err
          assert.equal(versions.length, 1)
          CustomAssertions.assertTableColumnCount(@AdapterWrapper, @tableName, 3, done)
