Hi All, I created an 001-xxx initial migration and updated it with results of a schema::dump, removing the :force => true. Then I ran rake migrate and (as documented) rake added a schema_info table with version=0. I''ve got three databases defined in database.yml using scripting I found in Rails Recipes #17. I defined columns only for the development database. Happily, rake went to the development database both to dump the schema and add the schema_info table. Question: How did rake decide to use that database rather than test or production? Is it because development is specified first in the yml file? Is it because development is the only one with tables? Is it because there''s a setting somewhere that defaults to development but can be modified to target other databases? I''m running WinXP-Pro/SP2, Ruby 1.8.2-15, Rails 1.1.4, MySQL 5.0.15-nt, SciTE 1.59, FireFox 1.2.0.7, Java JDK 1.5.0_06 Thanks in Advance, Richard --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Morning (i still haven''t had that cup of coffee) I believe you set this using the RAILSENV=production parameter for rake, and that the default is development. I cannot find reference to this specifically at the moment - if anyone can point me to a link documenting the use of RAILSENV I will really appreciate it. The command that I have used is: rake db:migrate RAILSENV=production when migrating to production environment. Ivor Richard Lionheart wrote:> Hi All, > > > > I created an 001-xxx initial migration and updated it with results of a > schema::dump, removing the :force => true. > > > > Then I ran rake migrate and (as documented) rake added a schema_info table > with version=0. > > > > I''ve got three databases defined in database.yml using scripting I found in > Rails Recipes #17. > > > > I defined columns only for the development database. > > > > Happily, rake went to the development database both to dump the schema and > add the schema_info table. > > > > Question: How did rake decide to use that database rather than test or > production? > > > > Is it because development is specified first in the yml file? > > Is it because development is the only one with tables? > > Is it because there''s a setting somewhere that defaults to development but > can be modified to target other databases? > > > > I''m running WinXP-Pro/SP2, Ruby 1.8.2-15, Rails 1.1.4, MySQL 5.0.15-nt, > SciTE 1.59, FireFox 1.2.0.7, Java JDK 1.5.0_06 > > > > Thanks in Advance, > > Richard > > > > > > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Hi! On Tue, Oct 24, 2006 at 02:20:13AM -0400, Richard Lionheart wrote:> > Hi All,[..]> > Happily, rake went to the development database both to dump the schema and > add the schema_info table. > > Question: How did rake decide to use that database rather than test or > production? > > Is it because development is specified first in the yml file? > Is it because development is the only one with tables? > Is it because there''s a setting somewhere that defaults to development but > can be modified to target other databases?Rails defaults to the development environment (and therefore the development database). You can switch to production by setting the RAILS_ENV environment variable to ''production''. The test evironment is used automatically for running testcases. You can, however, specify additional database connections in database.yml, and explicitly tell activerecord to use these: class FromOtherDb < ActiveRecord::Base establish_connection configurations[''otherdb''] end Jens -- Jens Krämer jk-UayuY8ajoWPk1uMJSBkQmQ@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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
Hi Ivor and Jens, Thanks for your responses. It''s 2:43am my time so I''m going to crash for the night. I''ll try all your approaches tomorrow. Best wishes, Richard Richard Lionheart wrote:> Hi All, > > > > I created an 001-xxx initial migration and updated it with results of a > schema::dump, removing the :force => true. > > > > Then I ran rake migrate and (as documented) rake added a schema_info table > with version=0. > > > > I''ve got three databases defined in database.yml using scripting I found in > Rails Recipes #17. > > > > I defined columns only for the development database. > > > > Happily, rake went to the development database both to dump the schema and > add the schema_info table. > > > > Question: How did rake decide to use that database rather than test or > production? > > > > Is it because development is specified first in the yml file? > > Is it because development is the only one with tables? > > Is it because there''s a setting somewhere that defaults to development but > can be modified to target other databases? > > > > I''m running WinXP-Pro/SP2, Ruby 1.8.2-15, Rails 1.1.4, MySQL 5.0.15-nt, > SciTE 1.59, FireFox 1.2.0.7, Java JDK 1.5.0_06 > > > > Thanks in Advance, > > Richard--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Hi Jens and Ivor, Ivor, I used your RAILS_ENV=test clause (not the underscore!) and it created my (empty) test database. Jens, I saved your input. I''m not ready for a more sophisticated approach at this time. Thank you both very much for your responses. I couldn''t find any documention for this issue through Google searches. Best wishes, Richard Richard Lionheart wrote:> Hi All, > > > > I created an 001-xxx initial migration and updated it with results of a > schema::dump, removing the :force => true. > > > > Then I ran rake migrate and (as documented) rake added a schema_info table > with version=0. > > > > I''ve got three databases defined in database.yml using scripting I found in > Rails Recipes #17. > > > > I defined columns only for the development database. > > > > Happily, rake went to the development database both to dump the schema and > add the schema_info table. > > > > Question: How did rake decide to use that database rather than test or > production? > > > > Is it because development is specified first in the yml file? > > Is it because development is the only one with tables? > > Is it because there''s a setting somewhere that defaults to development but > can be modified to target other databases? > > > > I''m running WinXP-Pro/SP2, Ruby 1.8.2-15, Rails 1.1.4, MySQL 5.0.15-nt, > SciTE 1.59, FireFox 1.2.0.7, Java JDK 1.5.0_06 > > > > Thanks in Advance, > > Richard--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Richard Lionheart
2006-Nov-21 04:09 UTC
Re: How does rake decide which database to modify?
Hi Ivor and Jens, I saw your replies a month ago, for which I thank both of you. I just noticed today that I failed to acknowledge your response. Please accept this belated apology for that oversight. Best wishes, Richard --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---