rails/rails — pull request #14012 by d-unseductable (2014-02-11 12:27:30+00:00)
Title: db:schema:load with migrations in subdirectories

Example directories structure:
```
db/
migrate/
archive/
1_create_people.rb
2_add_age_to_people.rb
3_add_phone_number_to_people.rb
```
If the db/migrate directory contains any migrations in its subdirectories,
their versions are not inserted into schema_migrations table.

As for the example above,
```ruby
ActiveRecord::ConnectionAdapters::SchemaStatements.assume_migrated_upto_version
```
method inserts only the 3rd version into the schema_migrations table.
But
```ruby
ActiveRecord::Migrator.migrations
```
method expects the table to include all of the 3 versions. 1 and 2 are
perceived as pending and this fact causes the pending migrations error.

The assume_migrated_upto_version fetched migrations files using
````ruby
paths = migrations_paths.map {|p| "#{p}/[0-9]*_*.rb" }
````
So there were no subdirectories support.
The behaviour is fixed by
````ruby
paths = migrations_paths.map {|p| "#{p}/**/[0-9]*_*.rb" }
````
Added a test case.