Evan Dorn
2007-11-10 19:54:09 UTC
I'm trying to learn RoR using Locomotive and a number of different
tutorials. (I've also tried NetBeans, but any attempt to interact
with a database generates the error "cannot convert nil to String",
so it's back to Locomotive).
In my first test project, I've created a simple create_table
migration. "rake db:migrate" runs without any errors, but the table
is not created in mySQL. I've confirmed database connectivity by
changing the database name; lots of errors are generated in that
case, starting with "unknown database". So it sees the DB, but
won't actually create the table.
Here's the code of the migration (001_people.rb)
class People < ActiveRecord::Migration
def self.up
create_table :people do |table|
table.column :firstname, :string
table.column :lastname, :string
table.column :age, :integer
end
end
def self.down
drop_table :people
end
end
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:migrate
** Invoke db:schema:dump (first_time)
** Invoke environment
** Execute db:schema:dump
CLI tools or phpMyAdmin, the database is still empty; no tables other
than schema_info, which is empty.
How do I track this down? Please assist a noob, thanks.
Evan
Evan Dorn, Ph.D.
public-7UPuOxGa1lNWk0Htik3J/***@public.gmane.org
tutorials. (I've also tried NetBeans, but any attempt to interact
with a database generates the error "cannot convert nil to String",
so it's back to Locomotive).
In my first test project, I've created a simple create_table
migration. "rake db:migrate" runs without any errors, but the table
is not created in mySQL. I've confirmed database connectivity by
changing the database name; lots of errors are generated in that
case, starting with "unknown database". So it sees the DB, but
won't actually create the table.
Here's the code of the migration (001_people.rb)
class People < ActiveRecord::Migration
def self.up
create_table :people do |table|
table.column :firstname, :string
table.column :lastname, :string
table.column :age, :integer
end
end
def self.down
drop_table :people
end
end
SecretSanta$ rake db:migrate --trace
(in /Users/evan/Development/Ruby/SecretSanta/SecretSanta)** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:migrate
** Invoke db:schema:dump (first_time)
** Invoke environment
** Execute db:schema:dump
SecretSanta$
That would appear to be okay, but if i investigate the DB with eitherCLI tools or phpMyAdmin, the database is still empty; no tables other
than schema_info, which is empty.
How do I track this down? Please assist a noob, thanks.
Evan
Evan Dorn, Ph.D.
public-7UPuOxGa1lNWk0Htik3J/***@public.gmane.org