Cannot migrate database, strange error!

Im using restful authentication, and i changed the username model from
login to username. The error is Mysql::Error: Key column ‘login’ doesn’t
exist in table: CREATE UNIQUE INDEX index_users_on_login Heres the
trace:

DEPRECATION WARNING: Rake tasks in
vendor/plugins/restful-authentication/tasks are deprecated. Use
lib/tasks instead. (called from
/Users/Zack/.gem/ruby/1.8/gems/rails-2.3.8/lib/tasks/rails.rb:10)
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:migrate
== CreateUsers: migrating

– create_table(“users”, {:force=>true})
-> 0.1138s
– add_index(:users, :login, {:unique=>true})
rake aborted!
An error has occurred, all later migrations canceled:

Mysql::Error: Key column ‘login’ doesn’t exist in table: CREATE UNIQUE
INDEX index_users_on_login ON users (login)
/Users/Zack/.gem/ruby/1.8/gems/activerecord-2.3.8/lib/active_record/connection_adapters/abstract_adapter.rb:221:in
log' /Users/Zack/.gem/ruby/1.8/gems/activerecord-2.3.8/lib/active_record/connection_adapters/mysql_adapter.rb:323:inexecute’
/Users/Zack/.gem/ruby/1.8/gems/activerecord-2.3.8/lib/active_record/connection_adapters/abstract/schema_statements.rb:291:in
add_index' /Users/Zack/.gem/ruby/1.8/gems/activerecord-2.3.8/lib/active_record/migration.rb:352:insend’
/Users/Zack/.gem/ruby/1.8/gems/activerecord-2.3.8/lib/active_record/migration.rb:352:in
method_missing' /Users/Zack/.gem/ruby/1.8/gems/activerecord-2.3.8/lib/active_record/migration.rb:328:insay_with_time’
/opt/local/lib/ruby/1.8/benchmark.rb:293:in measure' /Users/Zack/.gem/ruby/1.8/gems/activerecord-2.3.8/lib/active_record/migration.rb:328:insay_with_time’
/Users/Zack/.gem/ruby/1.8/gems/activerecord-2.3.8/lib/active_record/migration.rb:348:in
method_missing' ./db/migrate//20100823072211_create_users.rb:21:inup_without_benchmarks’
/Users/Zack/.gem/ruby/1.8/gems/activerecord-2.3.8/lib/active_record/migration.rb:282:in
send' /Users/Zack/.gem/ruby/1.8/gems/activerecord-2.3.8/lib/active_record/migration.rb:282:inmigrate’
/opt/local/lib/ruby/1.8/benchmark.rb:293:in measure' /Users/Zack/.gem/ruby/1.8/gems/activerecord-2.3.8/lib/active_record/migration.rb:282:inmigrate’
/Users/Zack/.gem/ruby/1.8/gems/activerecord-2.3.8/lib/active_record/migration.rb:365:in
__send__' /Users/Zack/.gem/ruby/1.8/gems/activerecord-2.3.8/lib/active_record/migration.rb:365:inmigrate’
/Users/Zack/.gem/ruby/1.8/gems/activerecord-2.3.8/lib/active_record/migration.rb:491:in
migrate' /Users/Zack/.gem/ruby/1.8/gems/activerecord-2.3.8/lib/active_record/migration.rb:567:incall’
/Users/Zack/.gem/ruby/1.8/gems/activerecord-2.3.8/lib/active_record/migration.rb:567:in
ddl_transaction' /Users/Zack/.gem/ruby/1.8/gems/activerecord-2.3.8/lib/active_record/migration.rb:490:inmigrate’
/Users/Zack/.gem/ruby/1.8/gems/activerecord-2.3.8/lib/active_record/migration.rb:477:in
each' /Users/Zack/.gem/ruby/1.8/gems/activerecord-2.3.8/lib/active_record/migration.rb:477:inmigrate’
/Users/Zack/.gem/ruby/1.8/gems/activerecord-2.3.8/lib/active_record/migration.rb:401:in
up' /Users/Zack/.gem/ruby/1.8/gems/activerecord-2.3.8/lib/active_record/migration.rb:383:inmigrate’
/Users/Zack/.gem/ruby/1.8/gems/rails-2.3.8/lib/tasks/databases.rake:112
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in call' /opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:inexecute’
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in each' /opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:inexecute’
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:597:in
invoke_with_call_chain' /opt/local/lib/ruby/1.8/monitor.rb:242:insynchronize’
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in
invoke_with_call_chain' /opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:583:ininvoke’
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2051:in
invoke_task' /opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:intop_level’
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in each' /opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:intop_level’
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in
standard_exception_handling' /opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2023:intop_level’
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2001:in run' /opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:instandard_exception_handling’
/opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:1998:in run' /opt/local/lib/ruby/gems/1.8/gems/rake-0.8.7/bin/rake:31 /opt/local/bin/rake:19:inload’
/opt/local/bin/rake:19

On 23 August 2010 22:40, Zack N. [email protected] wrote:

Im using restful authentication, and i changed the username model from
login to username. The error is Mysql::Error: Key column ‘login’ doesn’t
exist in table: CREATE UNIQUE INDEX index_users_on_login Heres the
trace:

If you are only just starting with Resful Authentication I would
suggest not doing this, it is generally considered not the best
nowadays. Have a look at Authlogic instead.

====================================================
– create_table(“users”, {:force=>true})
-> 0.1138s
– add_index(:users, :login, {:unique=>true})
rake aborted!
An error has occurred, all later migrations canceled:

Mysql::Error: Key column ‘login’ doesn’t exist in table: CREATE UNIQUE
INDEX index_users_on_login ON users (login)

In the migration have you added the login field to the database? This
must be done before adding the index. The clue is in the error
message.

Colin

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs