Problemas con migraciones para iniciar Ruby on Rails

Hola

Estoy trabajando en un proyecto nuevo con Ruby on Rails. Aplique (rake db:setup) para iniciar mi aplicación (GenieACS) y me indica que tengo migraciones pendientes.

Database ‘db/development.sqlite3’ already exists
Database ‘db/test.sqlite3’ already exists
You have 6 pending migrations:
20160202145722 CreateUsers
20160211140635 CreatePermissions
20160211142120 CreateRoles
20160212123229 CreateUserRoles
20160218145427 AddRoleIdToPermission
20160219094206 RenamePermissionsToPrivileges
Run rails db:migrate to update your database then try again.
rails db:migrate
rails aborted!

He intentado realizar la migración ( rails db:migrate, rake db:migrate) pero ocurre el siguiente error:

rake aborted!
NoMethodError: undefined method Migration' for ActiveRecord:Module /opt/genieacs-gui/db/migrate/20160202145722_create_users.rb:1:in<top (required)>’
/usr/local/rvm/gems/ruby-2.3.1/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:287:in require' /usr/local/rvm/gems/ruby-2.3.1/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:287:inblock in require’
/usr/local/rvm/gems/ruby-2.3.1/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:253:in load_dependency' /usr/local/rvm/gems/ruby-2.3.1/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:287:inrequire’
/usr/local/rvm/gems/ruby-2.3.1/gems/activerecord-5.2.1/lib/active_record/migration.rb:986:in load_migration' /usr/local/rvm/gems/ruby-2.3.1/gems/activerecord-5.2.1/lib/active_record/migration.rb:982:inmigration’
/usr/local/rvm/gems/ruby-2.3.1/gems/activerecord-5.2.1/lib/active_record/migration.rb:977:in disable_ddl_transaction' /usr/local/rvm/gems/ruby-2.3.1/gems/activerecord-5.2.1/lib/active_record/migration.rb:1350:inuse_transaction?’
/usr/local/rvm/gems/ruby-2.3.1/gems/activerecord-5.2.1/lib/active_record/migration.rb:1297:in rescue in execute_migration_in_transaction' /usr/local/rvm/gems/ruby-2.3.1/gems/activerecord-5.2.1/lib/active_record/migration.rb:1286:inexecute_migration_in_transaction’
/usr/local/rvm/gems/ruby-2.3.1/gems/activerecord-5.2.1/lib/active_record/migration.rb:1263:in block in migrate_without_lock' /usr/local/rvm/gems/ruby-2.3.1/gems/activerecord-5.2.1/lib/active_record/migration.rb:1262:ineach’
/usr/local/rvm/gems/ruby-2.3.1/gems/activerecord-5.2.1/lib/active_record/migration.rb:1262:in migrate_without_lock' /usr/local/rvm/gems/ruby-2.3.1/gems/activerecord-5.2.1/lib/active_record/migration.rb:1212:inmigrate’
/usr/local/rvm/gems/ruby-2.3.1/gems/activerecord-5.2.1/lib/active_record/migration.rb:1036:in up' /usr/local/rvm/gems/ruby-2.3.1/gems/activerecord-5.2.1/lib/active_record/migration.rb:1011:inmigrate’
/usr/local/rvm/gems/ruby-2.3.1/gems/activerecord-5.2.1/lib/active_record/tasks/database_tasks.rb:172:in migrate' /usr/local/rvm/gems/ruby-2.3.1/gems/activerecord-5.2.1/lib/active_record/railties/databases.rake:60:inblock (2 levels) in <top (required)>’
/usr/local/rvm/gems/ruby-2.3.1/gems/rake-12.3.1/exe/rake:27:in &lt;top (required)&gt;' /usr/local/rvm/gems/ruby-2.3.1/bin/ruby_executable_hooks:15:ineval’
/usr/local/rvm/gems/ruby-2.3.1/bin/ruby_executable_hooks:15:in `<main>’

Caused by:
NoMethodError: undefined method Migration' for ActiveRecord:Module /opt/genieacs-gui/db/migrate/20160202145722_create_users.rb:1:in<top (required)>’
/usr/local/rvm/gems/ruby-2.3.1/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:287:in require' /usr/local/rvm/gems/ruby-2.3.1/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:287:inblock in require’
/usr/local/rvm/gems/ruby-2.3.1/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:253:in load_dependency' /usr/local/rvm/gems/ruby-2.3.1/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:287:inrequire’
/usr/local/rvm/gems/ruby-2.3.1/gems/activerecord-5.2.1/lib/active_record/migration.rb:986:in load_migration' /usr/local/rvm/gems/ruby-2.3.1/gems/activerecord-5.2.1/lib/active_record/migration.rb:982:inmigration’
/usr/local/rvm/gems/ruby-2.3.1/gems/activerecord-5.2.1/lib/active_record/migration.rb:977:in disable_ddl_transaction' /usr/local/rvm/gems/ruby-2.3.1/gems/activerecord-5.2.1/lib/active_record/migration.rb:1350:inuse_transaction?’
/usr/local/rvm/gems/ruby-2.3.1/gems/activerecord-5.2.1/lib/active_record/migration.rb:1342:in ddl_transaction' /usr/local/rvm/gems/ruby-2.3.1/gems/activerecord-5.2.1/lib/active_record/migration.rb:1291:inexecute_migration_in_transaction’
/usr/local/rvm/gems/ruby-2.3.1/gems/activerecord-5.2.1/lib/active_record/migration.rb:1263:in block in migrate_without_lock' /usr/local/rvm/gems/ruby-2.3.1/gems/activerecord-5.2.1/lib/active_record/migration.rb:1262:ineach’
/usr/local/rvm/gems/ruby-2.3.1/gems/activerecord-5.2.1/lib/active_record/migration.rb:1262:in migrate_without_lock' /usr/local/rvm/gems/ruby-2.3.1/gems/activerecord-5.2.1/lib/active_record/migration.rb:1212:inmigrate’
/usr/local/rvm/gems/ruby-2.3.1/gems/activerecord-5.2.1/lib/active_record/migration.rb:1036:in up' /usr/local/rvm/gems/ruby-2.3.1/gems/activerecord-5.2.1/lib/active_record/migration.rb:1011:inmigrate’
/usr/local/rvm/gems/ruby-2.3.1/gems/activerecord-5.2.1/lib/active_record/tasks/database_tasks.rb:172:in migrate' /usr/local/rvm/gems/ruby-2.3.1/gems/activerecord-5.2.1/lib/active_record/railties/databases.rake:60:inblock (2 levels) in <top (required)>’
/usr/local/rvm/gems/ruby-2.3.1/gems/rake-12.3.1/exe/rake:27:in &lt;top (required)&gt;' /usr/local/rvm/gems/ruby-2.3.1/bin/ruby_executable_hooks:15:ineval’
/usr/local/rvm/gems/ruby-2.3.1/bin/ruby_executable_hooks:15:in `<main>’
Tasks: TOP => db:migrate
(See full trace by running task with --trace)

Revise los archivos de migración y no identifico cual es el problema. Estoy trabajando con (Ruby 2.3.1 y Rails 5.2.1). Este es uno de los archivos: 20160202145722_create_users.rb donde modifique de forma manual la versión [5.2]

class CreateUsers < ActiveRecord::Migration [ 5.2 ]
def change
create_table :users do |t|
t.string :username
t.string :password

t.timestamps
end
end
end

Leí en un foro que podía resolver con lo siguiente, pero lo intente y sigue el mismo problema:

rake db: reset
rm -f db/*.sqlite3
rake db:create
RAILS_ENV=development rake db:migrate
rails s -e development

Por favor si me pueden ayudar, no se cual es el problema…

Al parecer el problema lo está causando el versionado que estás usando en la migración. Debes cambiar [5.2] por [5.0], quedaría algo así:

class CreateUsers < ActiveRecord::Migration [5.0]
  def change
    create_table :users do |t|
      t.string :username
      t.string :password

      t.timestamps
    end
  end
end