rake aborted! Mysql::Error: query: not connected:

Hello,

   In MySql, I created the database company_development.  Then in RM, I created the method Employee.  I then created a scaffold for Employee.  I then modified db/migrate/20100514200302_create_employees.rb by adding a few fields to it.  The revised file looks like...

class CreateEmployees < ActiveRecord::Migration
  def self.up
    create_table :employees do |t|
      # t.column  :name,  :string
      t.column  :name,  :string
      t.column  :hiredate,  :date
      t.column  :salary,  :float
      t.column  :fulltime,  :boolean
      t.column  :vacationdays,  :integer
      t.column  :comments,  :text

      t.timestamps
    end
  end

  def self.down
    drop_table :employees
  end
end

    I then saved it and performed a db:migrate.  I received the following feedback in the console...

C:\xampp\Ruby\bin\ruby.exe -e STDOUT.sync=true;STDERR.sync=true;load($0=ARGV.shift) C:\xampp\Ruby\bin/rake db:migrate --trace
(in C:/Documents and Settings/Chuck Wesley/RubymineProjects/company3)
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:migrate
rake aborted!
Mysql::Error: query: not connected: CREATE TABLE `schema_migrations` (`version` varchar(255) NOT NULL) ENGINE=InnoDB
C:/xampp/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract_adapter.rb:219:in `log'
C:/xampp/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/mysql_adapter.rb:323:in `execute'
C:/xampp/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract/schema_statements.rb:114:in `create_table'
C:/xampp/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/mysql_adapter.rb:476:in `create_table'
C:/xampp/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract/schema_statements.rb:320:in `initialize_schema_migrations_table'
C:/xampp/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/migration.rb:436:in `initialize'
C:/xampp/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/migration.rb:400:in `new'
C:/xampp/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/migration.rb:400:in `up'
C:/xampp/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/migration.rb:383:in `migrate'
C:/xampp/Ruby/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/tasks/databases.rake:116
C:/xampp/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `call'
C:/xampp/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `execute'
C:/xampp/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `each'
C:/xampp/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `execute'
C:/xampp/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:597:in `invoke_with_call_chain'
C:/xampp/Ruby/lib/ruby/1.8/monitor.rb:242:in `synchronize'
C:/xampp/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
C:/xampp/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:583:in `invoke'
C:/xampp/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2051:in `invoke_task'
C:/xampp/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
C:/xampp/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `each'
C:/xampp/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
C:/xampp/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
C:/xampp/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2023:in `top_level'
C:/xampp/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2001:in `run'
C:/xampp/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
C:/xampp/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
C:/xampp/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/bin/rake:31
C:\xampp\Ruby\bin/rake:19:in `load'
C:\xampp\Ruby\bin/rake:19
-e:1:in `load'
-e:1

Process finished with exit code 1

   I confirmed that the database was running.  Not sure what went wrong.  Please advise.

Thanks.  

   

1 comment

Probably some problems in db/database.yml configuration. Please try to run this rake task from console.

0

Please sign in to leave a comment.