help! rake db:migrate (in /var/www/jabber) rake aborted! Mysql::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version forthe right syntax to use near ''-items'' at line 1: SHOW FIELDS FROM disco-items (See full trace by running task with --trace) --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Julian Leviston
2008-Mar-31 04:32 UTC
Re: Mysql::Error: You have an error in your SQL syntax;
I think you need to not use hyphens in your table names. Julian. On 31/03/2008, at 3:29 PM, rek2 wrote:> > help! > > > rake db:migrate > (in /var/www/jabber) > rake aborted! > Mysql::Error: You have an error in your SQL syntax; check the manual > that corresponds to your MySQL server version forthe right syntax to > use > near ''-items'' at line 1: SHOW FIELDS FROM disco-items > > (See full trace by running task with --trace) > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Julian Leviston wrote:> I think you need to not use hyphens in your table names. > > Julian. > > On 31/03/2008, at 3:29 PM, rek2 wrote: > >Thanks Julian, I just figure that out when I dump the DB to a test and after erasing that table it got stuck on another one with hyphens ... but the issue here is that this is not a DB I created for my application, instead is an already DB used by jabberd2 and I wanted to create a front end on RoR.. so the question is.. is there a way to make this work? alias? using the models? help!! :-/>> help! >> >> >> rake db:migrate >> (in /var/www/jabber) >> rake aborted! >> Mysql::Error: You have an error in your SQL syntax; check the manual >> that corresponds to your MySQL server version forthe right syntax to >> use >> near ''-items'' at line 1: SHOW FIELDS FROM disco-items >> >> (See full trace by running task with --trace) >> >> > > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Julian Leviston
2008-Mar-31 05:18 UTC
Re: Mysql::Error: You have an error in your SQL syntax;
Can you show us your model? Learn about Ruby on Rails! CHECK OUT THE FREE VIDS (LIMITED TIME) http://sensei.zenunit.com/ On 31/03/2008, at 4:12 PM, rek2 wrote:> > Julian Leviston wrote: >> I think you need to not use hyphens in your table names. >> >> Julian. >> >> On 31/03/2008, at 3:29 PM, rek2 wrote: >> >> > > > > Thanks Julian, I just figure that out when I dump the DB to a test and > after erasing that table it got stuck on another one with hyphens > ... but the issue here is that this is not a DB I created for my > application, instead is an already DB used by jabberd2 and I wanted to > create > a front end on RoR.. so the question is.. is there a way to make this > work? alias? using the models? > help!! :-/ > >>> help! >>> >>> >>> rake db:migrate >>> (in /var/www/jabber) >>> rake aborted! >>> Mysql::Error: You have an error in your SQL syntax; check the manual >>> that corresponds to your MySQL server version forthe right syntax to >>> use >>> near ''-items'' at line 1: SHOW FIELDS FROM disco-items >>> >>> (See full trace by running task with --trace) >>> >>> >> >> >>> >> > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Rek, One way you could probably get around it is to explicitly put quotes around the table name. It''s been a while since I''ve had to worry about weird table names, but either single quotes or backticks should work. Or maybe try escaping the hyphen, although that seems to me less likely (but worth a quick try). -Danimal --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Julian Leviston escribió:> Can you show us your model? > > Learn about Ruby on Rails! CHECK OUT THE FREE VIDS (LIMITED TIME) > http://sensei.zenunit.com/ > >Hi Julian, I have no models so far.. I was going to start this project and got into that error a couple days a go and I am going nuts.. first I was trying to see if I could modify the db table names but looks like jabberd2 has this hardcoded :-( so basically I created the project.. and when a head to tell rails about my db when I got into this mess. if it helps how the jabberd2 db schema is here is a link In this link below almost at then end it shows the mysql Schema they use and I have. http://jabberd2.xiaoka.com/wiki/InstallGuide/Jabberd2Architecture --~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Julian Leviston
2008-Mar-31 06:50 UTC
Re: Mysql::Error: You have an error in your SQL syntax;
Um.... I don''t understand how you''re getting that error if you have no models... Julian. On 31/03/2008, at 5:14 PM, rek2 wrote:> > Julian Leviston escribió: >> Can you show us your model? >> >> Learn about Ruby on Rails! CHECK OUT THE FREE VIDS (LIMITED TIME) >> http://sensei.zenunit.com/ >> >> > Hi Julian, I have no models so far.. I was going to start this project > and got into that error a couple days a go > and I am going nuts.. first I was trying to see if I could modify > the db > table names but looks like jabberd2 has > this hardcoded :-( so basically I created the project.. and when a > head > to tell rails about my db when I got into this mess. > > if it helps how the jabberd2 db schema is here is a link > In this link below almost at then end it shows the mysql Schema they > use > and I have. > http://jabberd2.xiaoka.com/wiki/InstallGuide/Jabberd2Architecture > > > >--~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Julian Leviston escribió:> Um.... I don''t understand how you''re getting that error if you have no > models... > >hmm let me explain what I have done..(excuse me for my bad english) I have a DB that use for my jabberd2 server with around 2000 users and very populated.. I created a backup a username/password for that db for rails to use.. then I created the rails project rails --database=mysql(or something like that)lol then I put the DB info on config/datatabase.yml and after this step if I am using an inheritage DB I run rake db:migrate to create a scheme under db/schema.. not sure if this is the right thing to do.. so far it has worked fine if the DB was friendly to rails. so I get the error right there.. when I run rake db:migrate and the rails db scheme gets only populated till I get the error.. then drops. :-( Thanks for the help. I have the feeling I am going to learn something I din''t know about inheritage DB''s --~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Julian Leviston
2008-Mar-31 07:09 UTC
Re: Mysql::Error: You have an error in your SQL syntax;
Ah. Rails won''t automatically create a schema for you, unless you define some models. For instance, if you have a table called users, and the table name is users, add this model to your models folder file name: users.rb class User < ActiveRecord::Base end You don''t need to run rake db:migrate unless you want to do a migration (ie execute some code that does some stuff to the database). You can probably get around using hyphenated names by using table_name ''whatever-hyphenated-table-name'' like that under the beginning of the class. (I think that''s the right syntax). Each model you have (one per table) will wrapper a table. Julian. Learn about Ruby on Rails! CHECK OUT THE FREE VIDS (LIMITED TIME) http://sensei.zenunit.com/ On 31/03/2008, at 6:01 PM, rek2 wrote:> > Julian Leviston escribió: >> Um.... I don''t understand how you''re getting that error if you have >> no >> models... >> >> > hmm let me explain what I have done..(excuse me for my bad english) > > I have a DB that use for my jabberd2 server with around 2000 users and > very populated.. > I created a backup a username/password for that db for rails to use.. > then I created the rails project > rails --database=mysql(or something like that)lol > then I put the DB info on config/datatabase.yml > and after this step if I am using an inheritage DB I run rake > db:migrate > to create a scheme under > db/schema.. not sure if this is the right thing to do.. so far it has > worked fine if the DB was friendly to rails. > so I get the error right there.. when I run rake db:migrate and the > rails db scheme gets only populated till I get the error.. > then drops. :-( > > Thanks for the help. I have the feeling I am going to learn > something I > din''t know about inheritage DB''s > > > >--~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Julian Leviston escribió:> Ah. > > Rails won''t automatically create a schema for you, unless you define > some models. > > For instance, if you have a table called users, and the table name is > users, add this model to your models folder > > file name: users.rb > > class User < ActiveRecord::Base > end > > You don''t need to run rake db:migrate unless you want to do a > migration (ie execute some code that does some stuff to the database). > You can probably get around using hyphenated names by using table_name > ''whatever-hyphenated-table-name'' like that under the beginning of the > class. (I think that''s the right syntax). > > Each model you have (one per table) will wrapper a table. > > Julian. > >ohhh, this makes much more sense now.. in the book I read and the howtos it always ask you to create the DB and of course then comes db:migrate so I have always used that way !! :-/ ok so in my particular case you are telling me to create the class like: class Disco-items < ActiveRecord::Base but what for the purpuse of learning what if I did wanted to add something to the DB down the road.. how will I tell/force Rails to use disco-items or make disco-items appear to ruby as Disco_items on the application with out changing the table name in the DB? Thanks so much this clears a lot of things. --~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Julian Leviston
2008-Mar-31 08:15 UTC
Re: Mysql::Error: You have an error in your SQL syntax;
I''d prefer class DiscoItems < ActiveRecord::Base table-name ''disco-items'' end On 31/03/2008, at 6:30 PM, rek2 wrote:> > Julian Leviston escribió: >> Ah. >> >> Rails won''t automatically create a schema for you, unless you define >> some models. >> >> For instance, if you have a table called users, and the table name is >> users, add this model to your models folder >> >> file name: users.rb >> >> class User < ActiveRecord::Base >> end >> >> You don''t need to run rake db:migrate unless you want to do a >> migration (ie execute some code that does some stuff to the >> database). >> You can probably get around using hyphenated names by using >> table_name >> ''whatever-hyphenated-table-name'' like that under the beginning of the >> class. (I think that''s the right syntax). >> >> Each model you have (one per table) will wrapper a table. >> >> Julian. >> >> > ohhh, this makes much more sense now.. in the book I read and the > howtos > it always ask you to > create the DB and of course then comes db:migrate so I have always > used > that way !! :-/ > ok so in my particular case you are telling me to create the class > like: > > class Disco-items < ActiveRecord::Base > > but what for the purpuse of learning what if I did wanted to add > something to the DB down the road.. > how will I tell/force Rails to use disco-items or make disco-items > appear to ruby as Disco_items on the application > with out changing the table name in the DB? > > Thanks so much this clears a lot of things. > > >--~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Julian Leviston wrote:> I''d prefer > > class DiscoItems < ActiveRecord::Base > table-name ''disco-items'' > end > > On 31/03/2008, at 6:30 PM, rek2 wrote: > >thank you!! this works!! YEAY! --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---