Forum: Ruby on Rails Rails 1.2.3 MySQL 3.23.58 incompatible?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
D51a24ae1017f53158d70b621494255d?d=identicon&s=25 Bontina Chen (abon)
on 2007-08-02 11:01
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:in
`execute'
/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:in
`create_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:in
`method_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:in `measure'
/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:in
`method_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:in
`send'
/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:in `measure'
/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:in
`migrate'
/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:in
`migrate'
/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:in
`migrate'
/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:in
`execute'
/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:in
`execute'
/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:in `synchronize'
/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:in
`top_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:in
`top_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:in
`top_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:in
`standard_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:in `load'
/usr/local/bin/rake:16

Anyone ran into this kind of problem before?
Many thanks.
Ef3aa7f7e577ea8cd620462724ddf73b?d=identicon&s=25 Rob Biedenharn (Guest)
on 2007-08-02 14:54
(Received via mailing list)
On Aug 2, 2007, at 5:01 AM, Bontina Chen 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 Biedenharn    http://agileconsultingllc.com
Rob@AgileConsultingLLC.com
D51a24ae1017f53158d70b621494255d?d=identicon&s=25 Bontina Chen (abon)
on 2007-08-03 03:13
It worked!!!

Thanks a lot.





Rob Biedenharn wrote:
> On Aug 2, 2007, at 5:01 AM, Bontina Chen 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 Biedenharn    http://agileconsultingllc.com
> Rob@AgileConsultingLLC.com
This topic is locked and can not be replied to.