I''m trying to add a migration with foreign keys like this:
execute ''ALTER TABLE projects ADD CONSTRAINT fk_project_user FOREIGN
KEY
( user_id ) REFERENCES users ( id )''
the problem is that for development i''m using sqlite and I
don''t think
that support foreign keys, at least the migration is giving me this
error:
-- execute("ALTER TABLE projects ADD CONSTRAINT fk_projects_user FOREIGN
KEY ( user_id ) REFERENCES users( id ) ")
rake aborted!
SQLite3::SQLException: near "ADD": syntax error: ALTER TABLE projects
ADD CONSTRAINT fk_projects_users FOREIGN KEY ( user_id ) REFERENCES
users( id )
So my question is how can I test to see what database the migration is
working on so that I can do the execute on mysql (production), but not
on sqlite (development)?
And of course if what I''m trying to do doesn''t really make
sense, or
there''s a better way, please let me know.
Thanks,
Jesse
--
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
-~----------~----~----~----~------~----~------~--~---
Can''t tell you anything about the error, but my question is. Why aren''t you you developing on mysql? in my opinion it makes no sense to develop on sqlite and deploy on mysql. install mysql on your box and develop on the same database. --~--~---------~--~----~------------~-------~--~----~ 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''d been using sqlite because it was a bit faster for development and running tests. But at this point in development your are probably right, I''ll move everything to mysql. 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 -~----------~----~----~----~------~----~------~--~---