Rake test fails on MySQL error

I am a VERY newbie, so please forgive me.

I created a project from a tutorial availible online, and when I ran the
rake test, it came up with the following error:

218 % rake test_units
(in /rubydev/devblog)
rake aborted!
Mysql::Error: You have an error in your SQL syntax near ‘ENGINE=InnoDB’
at lin
e 1: CREATE TABLE comments (id int(11) DEFAULT NULL auto_increment
PRIMARY K
EY, body text DEFAULT ‘’ NOT NULL, post_id int(11) DEFAULT 0 NOT
NULL) ENG
INE=InnoDB

(See full trace by running task with --trace)

I ran it with ‘–trace’ and of couse it errored out also. here is what
it said:

219 % rake test_units --trace
(in /rubydev/devblog)
** Invoke test_units (first_time)
** Invoke test:units (first_time)
** Invoke db:test:prepare (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:test:prepare
** Invoke db:test:clone (first_time)
** Invoke db:schema:dump (first_time)
** Invoke environment
** Execute db:schema:dump
** Invoke db:test:purge (first_time)
** Invoke environment
** Execute db:test:purge
** Execute db:test:clone
** Invoke db:schema:load (first_time)
** Invoke environment
** Execute db:schema:load
rake aborted!
Mysql::Error: You have an error in your SQL syntax near ‘ENGINE=InnoDB’
at line 1:
CREATE TABLE comments (id int(11) DEFAULT NULL auto_increment PRIMARY
KEY, body text DEFAULT ‘’ NOT NULL, post_id int(11) DEFAULT 0 NOT
NULL) ENGINE=InnoDB
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/connection_adapters/abstract_adapter.rb:128:in
log' /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/connection_adapters/mysql_adapter.rb:243:inexecute’
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/connection_adapters/abstract/schema_statements.rb:104:in
create_table' /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/connection_adapters/mysql_adapter.rb:353:increate_table’
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/migration.rb:275:in
send' /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/migration.rb:275:inmethod_missing’
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/migration.rb:259:in
say_with_time' /usr/local/lib/ruby/1.8/benchmark.rb:293:inmeasure’
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/migration.rb:259:in
say_with_time' /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/migration.rb:273:inmethod_missing’
./db/schema.rb:7
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/schema.rb:43:in
instance_eval' /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/schema.rb:43:indefine’
./db/schema.rb:5
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:488:in
load' /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:488:inload’
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:342:in
new_constants_in' /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:488:inload’
/usr/local/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/tasks/databases.rake:31
/usr/local/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:392:in call' /usr/local/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:392:inexecute’
/usr/local/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:392:in each' /usr/local/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:392:inexecute’
/usr/local/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:362:in invoke' /usr/local/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:355:insynchronize’
/usr/local/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:355:in invoke' /usr/local/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/tasks/databases.rake:76 /usr/local/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:392:incall’
/usr/local/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:392:in
execute' /usr/local/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:392:ineach’
/usr/local/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:392:in
execute' /usr/local/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:362:ininvoke’
/usr/local/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:355:in
synchronize' /usr/local/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:355:ininvoke’
/usr/local/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/tasks/databases.rake:153
/usr/local/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:392:in call' /usr/local/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:392:inexecute’
/usr/local/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:392:in each' /usr/local/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:392:inexecute’
/usr/local/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:362:in invoke' /usr/local/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:355:insynchronize’
/usr/local/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:355:in invoke' /usr/local/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:369:ininvoke_prerequisites’
/usr/local/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:1003:in each' /usr/local/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:1003:insend’
/usr/local/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:1003:in each' /usr/local/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:368:ininvoke_prerequisites’
/usr/local/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:361:in invoke' /usr/local/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:355:insynchronize’
/usr/local/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:355:in invoke' /usr/local/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:369:ininvoke_prerequisites’
/usr/local/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:1003:in each' /usr/local/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:1003:insend’
/usr/local/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:1003:in each' /usr/local/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:368:ininvoke_prerequisites’
/usr/local/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:361:in invoke' /usr/local/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:355:insynchronize’
/usr/local/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:355:in invoke' /usr/local/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:1739:intop_level’
/usr/local/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:1739:in each' /usr/local/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:1739:intop_level’
/usr/local/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:1761:in
standard_exception_handling' /usr/local/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:1733:intop_level’
/usr/local/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:1711:in run' /usr/local/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:1761:instandard_exception_handling’
/usr/local/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:1708:in run' /usr/local/lib/ruby/gems/1.8/gems/rake-0.7.3/bin/rake:7 /usr/local/bin/rake:16:inload’
/usr/local/bin/rake:16

I understand that the problem is that RNR is unable to create the tables
needed in the test database, the question is how do I fix the problem so
that it will run the test correctly?

On Jul 5, 2007, at 5:57 PM, Jim Tittle wrote:

‘ENGINE=InnoDB’
problem so
that it will run the test correctly?

What version of MySQL are you using? Does it support the
ENGINE=InnoDB syntax (I think the syntax prior to 5.x was TYPE=InnoDB)?

-Rob

Rob B. http://agileconsultingllc.com
[email protected]

Rob B. wrote:

On Jul 5, 2007, at 5:57 PM, Jim Tittle wrote:

‘ENGINE=InnoDB’
problem so
that it will run the test correctly?

What version of MySQL are you using? Does it support the
ENGINE=InnoDB syntax (I think the syntax prior to 5.x was TYPE=InnoDB)?

-Rob

Rob B. http://agileconsultingllc.com
[email protected]

Yes it is an old version of MySQL - 3.23.54. Is there a way to make this
distinction?

On Jul 5, 2007, at 6:39 PM, Jim Tittle wrote:

-Rob

Rob B. http://agileconsultingllc.com
[email protected]

Yes it is an old version of MySQL - 3.23.54. Is there a way to make
this
distinction?

Hey, I found an old migration in an old project:

class CreateUsersTable < ActiveRecord::Migration
def self.up
create_table(:users,
:options => ‘TYPE=InnoDB’) do |t| # DEFAULT
CHARSET=utf8
t.column :first_name, :string, :limit => 30, :null => false
t.column :last_name, :string, :limit => 30, :null => false
t.column :department, :string
t.column :phone, :string, :limit => 24
end
end

def self.down
drop_table(:users)
end
end

This was when the default was MyIsam and might have also been with
4.x (like I said, it was old), but the server was running 3.23 so I
think that’s how I landed on this syntax.

-Rob

Rob B. http://agileconsultingllc.com
[email protected]