Rails 1.2.3 MySQL 3.23.58 incompatible?


#1

Hi,

I was trying to create a table via action record by this file

class CreateTasks < ActiveRecord::Migration
def self.up
create_table :tasks do |t|
t.column :action, :string
t.column :issuer, :integer
t.column :receiver, :integer
t.column :created_at, :datetime
t.column :expected_time, :datetime
t.column :closed_time, :datetime

end

end

def self.down
drop_table :tasks
end
end
~
while I’m doing rake:migrate

I got syntax error message like this

Mysql::Error: You have an error in your SQL syntax near ‘ENGINE=InnoDB’
at line 1: CREATE TABLE tasks (id int(11) DEFAULT NULL auto_increment
PRIMARY KEY, action varchar(255) DEFAULT NULL, issuer int(11)
DEFAULT NULL, receiver int(11) DEFAULT NULL, created_at datetime
DEFAULT NULL, expected_time datetime DEFAULT NULL, closed_time
datetime DEFAULT 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/migrate//001_create_tasks.rb:3:in real_up' /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/migration.rb:212:insend’
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/migration.rb:212:in
migrate' /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:212:in
migrate' /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/migration.rb:335:inmigrate’
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/migration.rb:330:in
each' /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/migration.rb:330:inmigrate’
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/migration.rb:297:in
up' /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/migration.rb:288:inmigrate’
/usr/local/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/tasks/databases.rake:4
/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/1.8/thread.rb:135: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

Anyone ran into this kind of problem before?
Many thanks.


#2

On Aug 2, 2007, at 5:01 AM, Bontina C. wrote:

t.column :receiver, :integer

end
DEFAULT NULL, receiver int(11) DEFAULT NULL, created_at datetime
DEFAULT NULL, expected_time datetime DEFAULT NULL, closed_time
datetime DEFAULT NULL) ENGINE=InnoDB

Anyone ran into this kind of problem before?
Many thanks.

I think in 3.23 you need to have “TYPE=InnoDB”

  create_table :tasks, :options => 'TYPE=InnoDB' do |t|

See if that works for you, but I’d suggest updating to a more modern
MySQL!

-Rob

Rob B. http://agileconsultingllc.com
removed_email_address@domain.invalid


#3

It worked!!!

Thanks a lot.

Rob B. wrote:

On Aug 2, 2007, at 5:01 AM, Bontina C. wrote:

t.column :receiver, :integer

end
DEFAULT NULL, receiver int(11) DEFAULT NULL, created_at datetime
DEFAULT NULL, expected_time datetime DEFAULT NULL, closed_time
datetime DEFAULT NULL) ENGINE=InnoDB

Anyone ran into this kind of problem before?
Many thanks.

I think in 3.23 you need to have “TYPE=InnoDB”

  create_table :tasks, :options => 'TYPE=InnoDB' do |t|

See if that works for you, but I’d suggest updating to a more modern
MySQL!

-Rob

Rob B. http://agileconsultingllc.com
removed_email_address@domain.invalid