My db:migrate code as generated by ROR refuses to run. I''m running MySQL as the db, and *think* I have everything installed and configured correctly. I''ve tried deletion of the colon, quoting with single and double quotes, and nothing seems to work, I just keep getting different syntax errors. I''m new to ROR, but had a similar version working on a different machine with a Debian install, and this is on gOS, an Ubuntu derivative (it pretty much sucks(give me something that isn''t broken by design.)) Code and a trace are copied below. Does anybody know how to solve this? 001_create_cars.rb: class CreateCars < ActiveRecord::Migration def self.up create_table :cars do |t| t.varchar(64) :Title t.varchar(255) :Img t.varchar(64) :Maker t.varchar(64) :Year t.text :Desc t.varchar(64) :Price t.boolean :Show t.boolean :Sold t.timestamps : ID end end def self.down drop_table :cars end end>rake db:migrate --trace(in /usr/local/aptana/workspace/CarSales) rake db:migrate ** Invoke db:migrate (first_time) ** Invoke environment (first_time) ** Execute environment ** Execute db:migrate rake aborted! ./db/migrate//001_create_cars.rb:4: syntax error, unexpected '':'', expecting kEND t.varchar(64) :Title ^ ./db/migrate//001_create_cars.rb:5: syntax error, unexpected '':'', expecting kEND t.varchar(255) :Img ^ ./db/migrate//001_create_cars.rb:6: syntax error, unexpected '':'', expecting kEND t.varchar(64) :Maker ^ ./db/migrate//001_create_cars.rb:7: syntax error, unexpected '':'', expecting kEND t.varchar(64) :Year ^ ./db/migrate//001_create_cars.rb:9: syntax error, unexpected '':'', expecting kEND t.varchar(64) :Price ^ /var/lib/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:489:in `load'' /var/lib/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:489:in `load'' /var/lib/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:342:in `new_constants_in'' /var/lib/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:489:in `load'' /var/lib/gems/1.8/gems/activerecord-2.0.2/lib/active_record/migration.rb:360:in `migration_classes'' /var/lib/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/mysql_adapter.rb:286:in `inject'' /var/lib/gems/1.8/gems/activerecord-2.0.2/lib/active_record/migration.rb:359:in `each'' /var/lib/gems/1.8/gems/activerecord-2.0.2/lib/active_record/migration.rb:359:in `inject'' /var/lib/gems/1.8/gems/activerecord-2.0.2/lib/active_record/migration.rb:359:in `migration_classes'' /var/lib/gems/1.8/gems/activerecord-2.0.2/lib/active_record/migration.rb:339:in `migrate'' /var/lib/gems/1.8/gems/activerecord-2.0.2/lib/active_record/migration.rb:307:in `up'' /var/lib/gems/1.8/gems/activerecord-2.0.2/lib/active_record/migration.rb:298:in `migrate'' /var/lib/gems/1.8/gems/rails-2.0.2/lib/tasks/databases.rake:85 /usr/lib/ruby/1.8/rake.rb:387:in `call'' /usr/lib/ruby/1.8/rake.rb:387:in `execute'' /usr/lib/ruby/1.8/rake.rb:387:in `each'' /usr/lib/ruby/1.8/rake.rb:387:in `execute'' /usr/lib/ruby/1.8/rake.rb:357:in `invoke'' /usr/lib/ruby/1.8/rake.rb:350:in `synchronize'' /usr/lib/ruby/1.8/rake.rb:350:in `invoke'' /usr/lib/ruby/1.8/rake.rb:1924:in `run'' /usr/lib/ruby/1.8/rake.rb:1924:in `each'' /usr/lib/ruby/1.8/rake.rb:1924:in `run'' /usr/bin/rake:4 -- 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 -~----------~----~----~----~------~----~------~--~---
With this syntax I think you''re passing ''64'' as the only parameter: t.varchar(64) :Title Here''s how I''m used to seeing it: t.string :title, :limit => 64 -Mack On Wed, Apr 23, 2008 at 12:50 PM, Charles Hernandez <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > My db:migrate code as generated by ROR refuses to run. I''m running MySQL > as the db, and *think* I have everything installed and configured > correctly. I''ve tried deletion of the colon, quoting with single and > double quotes, and nothing seems to work, I just keep getting different > syntax errors. I''m new to ROR, but had a similar version working on a > different machine with a Debian install, and this is on gOS, an Ubuntu > derivative (it pretty much sucks(give me something that isn''t broken by > design.)) Code and a trace are copied below. Does anybody know how to > solve this? > > 001_create_cars.rb: > > class CreateCars < ActiveRecord::Migration > def self.up > create_table :cars do |t| > t.varchar(64) :Title > t.varchar(255) :Img > t.varchar(64) :Maker > t.varchar(64) :Year > t.text :Desc > t.varchar(64) :Price > t.boolean :Show > t.boolean :Sold > > t.timestamps : ID > end > end > > def self.down > drop_table :cars > end > end > > >rake db:migrate --trace > (in /usr/local/aptana/workspace/CarSales) > rake db:migrate > ** Invoke db:migrate (first_time) > ** Invoke environment (first_time) > ** Execute environment > ** Execute db:migrate > rake aborted! > ./db/migrate//001_create_cars.rb:4: syntax error, unexpected '':'', > expecting kEND > t.varchar(64) :Title > ^ > ./db/migrate//001_create_cars.rb:5: syntax error, unexpected '':'', > expecting kEND > t.varchar(255) :Img > ^ > ./db/migrate//001_create_cars.rb:6: syntax error, unexpected '':'', > expecting kEND > t.varchar(64) :Maker > ^ > ./db/migrate//001_create_cars.rb:7: syntax error, unexpected '':'', > expecting kEND > t.varchar(64) :Year > ^ > ./db/migrate//001_create_cars.rb:9: syntax error, unexpected '':'', > expecting kEND > t.varchar(64) :Price > ^ > /var/lib/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:489:in > `load'' > /var/lib/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:489:in > `load'' > /var/lib/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:342:in > `new_constants_in'' > /var/lib/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:489:in > `load'' > /var/lib/gems/1.8/gems/activerecord-2.0.2/lib/active_record/migration.rb:360:in > `migration_classes'' > /var/lib/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/mysql_adapter.rb:286:in > `inject'' > /var/lib/gems/1.8/gems/activerecord-2.0.2/lib/active_record/migration.rb:359:in > `each'' > /var/lib/gems/1.8/gems/activerecord-2.0.2/lib/active_record/migration.rb:359:in > `inject'' > /var/lib/gems/1.8/gems/activerecord-2.0.2/lib/active_record/migration.rb:359:in > `migration_classes'' > /var/lib/gems/1.8/gems/activerecord-2.0.2/lib/active_record/migration.rb:339:in > `migrate'' > /var/lib/gems/1.8/gems/activerecord-2.0.2/lib/active_record/migration.rb:307:in > `up'' > /var/lib/gems/1.8/gems/activerecord-2.0.2/lib/active_record/migration.rb:298:in > `migrate'' > /var/lib/gems/1.8/gems/rails-2.0.2/lib/tasks/databases.rake:85 > /usr/lib/ruby/1.8/rake.rb:387:in `call'' > /usr/lib/ruby/1.8/rake.rb:387:in `execute'' > /usr/lib/ruby/1.8/rake.rb:387:in `each'' > /usr/lib/ruby/1.8/rake.rb:387:in `execute'' > /usr/lib/ruby/1.8/rake.rb:357:in `invoke'' > /usr/lib/ruby/1.8/rake.rb:350:in `synchronize'' > /usr/lib/ruby/1.8/rake.rb:350:in `invoke'' > /usr/lib/ruby/1.8/rake.rb:1924:in `run'' > /usr/lib/ruby/1.8/rake.rb:1924:in `each'' > /usr/lib/ruby/1.8/rake.rb:1924:in `run'' > /usr/bin/rake:4 > -- > 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 -~----------~----~----~----~------~----~------~--~---
Charles Hernandez
2008-Apr-23 17:05 UTC
Re: syntax error, unexpected '':'', expecting kEND
Mack Earnhardt wrote:> With this syntax I think you''re passing ''64'' as the only parameter: > > t.varchar(64) :Title > > Here''s how I''m used to seeing it: > > t.string :title, :limit => 64 > > -Mack > > On Wed, Apr 23, 2008 at 12:50 PM, Charles HernandezHi Mack, Thanks for the quick response, the ''64'' is to tell mysql how long to make the field. The same code worked (at least I seem to remember it being the same form "t.fieldtype(size) :Fieldname") worked previously. I just can''t figure out what the problem is with the colon placement, and I really don''t know what the ''kEND'' is supposed to be. Since the generator created the code, you''d kind of expect it to run. :S -- 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 -~----------~----~----~----~------~----~------~--~---
Charles Hernandez wrote:> Mack Earnhardt wrote: >> With this syntax I think you''re passing ''64'' as the only parameter: >> >> t.varchar(64) :Title >> >> Here''s how I''m used to seeing it: >> >> t.string :title, :limit => 64 >> >> -Mack >> >> On Wed, Apr 23, 2008 at 12:50 PM, Charles Hernandez > > Hi Mack, > Thanks for the quick response, the ''64'' is to tell mysql how long to > make the field. The same code worked (at least I seem to remember it > being the same form "t.fieldtype(size) :Fieldname") worked previously. I > just can''t figure out what the problem is with the colon placement, and > I really don''t know what the ''kEND'' is supposed to be. Since the > generator created the code, you''d kind of expect it to run. :SCorrect style is t.string :title, :limit =>64 Your mixing how you do it in MySQL, with how you do it in Rails. -- 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 -~----------~----~----~----~------~----~------~--~---
Charles Hernandez
2008-Apr-23 22:01 UTC
Re: syntax error, unexpected '':'', expecting kEND
Charles Hernandez wrote: Duh, I figured it out, I was remembering the datatypes in the DB itself. Defective brain, sorry to have taken your time. -- 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 -~----------~----~----~----~------~----~------~--~---