milesf-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-May-25 22:00 UTC
Migration not working on sqlite3, works on MySQL
I''m working through AWDwRoRv2 and have run into a snag on page 80. The code is a migration: http://pastie.textmate.org/64674 The error I get occurs when I run "rake db:migrate" using sqlite3 as my database: SQLite3::SQLException: near "ADD": syntax error: ALTER TABLE products ADD "price" decimal(8,2) DEFAULT 0 It works if I use MySQL instead. Is there a problem with sqlite3, rails, or a configuration error on my computer? Miles --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Not sure. Running on fumes here, but check that you''re not using incompatible options for sqlite3. Also, see if changing 0 to 0.00 helps. Again, I''m running on fumes. HTH On May 25, 6:00 pm, "mil...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org" <mil...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I''m working through AWDwRoRv2 and have run into a snag on page 80. > > The code is a migration:http://pastie.textmate.org/64674 > > The error I get occurs when I run "rake db:migrate" using sqlite3 as > my database: > SQLite3::SQLException: near "ADD": syntax error: ALTER TABLE > products ADD "price" decimal(8,2) DEFAULT 0 > > It works if I use MySQL instead. Is there a problem with sqlite3, > rails, or a configuration error on my computer? > > Miles--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
I''ve had a few SQL-based problems moving to SQLite, but I first had a few problems with compatability. I can''t speak for your environment, but I ended up re-installing SQLite and anything I could find similar to it to get it working correctly. I wish I had good notes from that day to remember what all the hangups were, but I was trying to rush out of town and wanted some rails apps to take with me on my laptop without taking the time to install mysql or something similar. I threw together a fast test to make sure I couldn''t see anything else wrong with what you''ve provided. It''s: * a fresh rails app (v1.2.3) * with a sqlite3 database configured * and a migration that uses a decimal type * with precision "8,2" and default 0 I''ve dropped it on www.showcase60.com/test_for_milesf.tar.gz if you''d like to take a look. Warm regards, David --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
milesf-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-May-26 03:45 UTC
Re: Migration not working on sqlite3, works on MySQL
Thanks David. The app you sent me throws an error too, so I''m assuming it''s something wrong with my install. Really appreciate your help :) Cheers, Miles On May 25, 3:45 pm, David Richards <dricha...-r0AmQGE5tMWBSXDBVWn4aQ@public.gmane.org> wrote:> I''ve had a few SQL-based problems moving to SQLite, but I first had a > few problems with compatability. I can''t speak for your environment, > but I ended up re-installing SQLite and anything I could find similar > to it to get it working correctly. I wish I had good notes from that > day to remember what all the hangups were, but I was trying to rush > out of town and wanted some rails apps to take with me on my laptop > without taking the time to install mysql or something similar. > > I threw together a fast test to make sure I couldn''t see anything else > wrong with what you''ve provided. It''s: > > * a fresh rails app (v1.2.3) > * with a sqlite3 database configured > * and a migration that uses a decimal type > * with precision "8,2" and default 0 > > I''ve dropped it onwww.showcase60.com/test_for_milesf.tar.gzif you''d > like to take a look. > > Warm regards, > > David--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
milesf-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote:> The error I get occurs when I run "rake db:migrate" using sqlite3 as > my database: > SQLite3::SQLException: near "ADD": syntax error: ALTER TABLE > products ADD "price" decimal(8,2) DEFAULT 0Are you on Mac? If so, then you need to install the most recent version of SQLite3. The version of SQLite3 that comes on 10.4 does not recognize the ''ADD (COLUMN)'' syntax. You may also need to uninstall the sqlite3-ruby gem and reinstall it. Worked for me. Karl -- 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 -~----------~----~----~----~------~----~------~--~---
milesf-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-May-27 00:18 UTC
Re: Migration not working on sqlite3, works on MySQL
Yep, that did it. I installed the latest version of sqlite from source and ripped ''n reinstalled the sqlite3-ruby gem and all works fine now. Thanks for the help! Miles On May 25, 11:49 pm, Karl Smith <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> mil...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote: > > The error I get occurs when I run "rake db:migrate" using sqlite3 as > > my database: > > SQLite3::SQLException: near "ADD": syntax error: ALTER TABLE > > products ADD "price" decimal(8,2) DEFAULT 0 > > Are you on Mac? If so, then you need to install the most recent version > of SQLite3. The version of SQLite3 that comes on 10.4 does not recognize > the ''ADD (COLUMN)'' syntax. You may also need to uninstall the > sqlite3-ruby gem and reinstall it. > > Worked for me. > > Karl > > -- > Posted viahttp://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 -~----------~----~----~----~------~----~------~--~---