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. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Aug 2, 2007, at 5:01 AM, Bontina Chen wrote:> > 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 > > 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-xa9cJyRlE0mWcWVYNo9pwxS2lgjeYSpx@public.gmane.org --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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-xa9cJyRlE0mWcWVYNo9pwxS2lgjeYSpx@public.gmane.org-- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---