Hi there, I just generated a migration to add a column to a table, and the change didn''t seem to take. I did: script/generate migration add_starts_at_to_gameweek starts_at:datetime which generated the file, no problem. I then ran: rake db:migrate and the migration didn''t happen. The table is still without a "starts_at" column. Where should I start looking for mistakes? Dave -- 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 -~----------~----~----~----~------~----~------~--~---
I just tried the exact same and it worked for me, i wonder if ur schema/db is in a bad state. Try:- rake db:migrate:reset Then try running the migrations again. Dave Amos wrote:> Hi there, > > I just generated a migration to add a column to a table, and the change > didn''t seem to take. I did: > > script/generate migration add_starts_at_to_gameweek starts_at:datetime > > which generated the file, no problem. I then ran: > > rake db:migrate > > and the migration didn''t happen. The table is still without a > "starts_at" column. Where should I start looking for mistakes? > > Dave > -- > 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 -~----------~----~----~----~------~----~------~--~---
Yes, that worked, though it wiped the contents of my db, as well. No biggie, though. Thanks! Jabbslad wrote:> I just tried the exact same and it worked for me, i wonder if ur > schema/db is in a bad state. Try:- > > rake db:migrate:reset > > Then try running the migrations again.-- 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 -~----------~----~----~----~------~----~------~--~---
Ah sorry should have mentioned that ;) "rake db:migrate:redo" might have done the trick and still kept the data in ur db. Have a glance at some of the rake tasks for your project (rake -T). theres loads of them that should help if u ever have the prob again :) Glad prob is solved now though. Jabbslad On Feb 28, 7:47 pm, Dave Amos <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Yes, that worked, though it wiped the contents of my db, as well. No > biggie, though. Thanks! > > Jabbslad wrote: > > I just tried the exact same and it worked for me, i wonder if ur > > schema/db is in a bad state. Try:- > > > rake db:migrate:reset > > > Then try running the migrations again. > > -- > 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
I''m experiencing the same issue. script/generate migration is stubbing the migration, minus the column info that i''m specifying. Here''s what I did in the Terminal: $ ruby script/generate migration AddPrimaryPlatformInfo os:string hardware:string exists db/migrate create db/migrate/005_add_primary_platform_info.rb My 005_add_primary_platform_info.rb file then has: class AddPrimaryPlatformInfo < ActiveRecord::Migration def self.up end def self.down end end I can add it manually, but shouldn''t we have some add_column and remove_column goodness added here already? Tried rake:db:redo and rake:db:reset - neither helped. Any suggestions from this point on would be greatly appreciated. Cheers, Joe On Feb 28, 1:11 pm, Jabbslad <jabbs...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Ah sorry should have mentioned that ;) > > "rake db:migrate:redo" might have done the trick and still kept the > data in ur db. > > Have a glance at some of the rake tasks for your project (rake -T). > theres loads of them that should help if u ever have the prob again :) > > Glad prob is solved now though. > > Jabbslad > > On Feb 28, 7:47 pm, Dave Amos <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> > wrote: > > > Yes, that worked, though it wiped the contents of my db, as well. No > > biggie, though. Thanks! > > > Jabbslad wrote: > > > I just tried the exact same and it worked for me, i wonder if ur > > > schema/db is in a bad state. Try:- > > > > rake db:migrate:reset > > > > Then try running the migrations again. > > > -- > > 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
You have to name it "Add(x)To(y)", so AddPrimaryPlatformInfoToMachines or some such. Otherwise Rails doesn''t know which table to add the columns to. :) --Jeremy On Sat, Apr 12, 2008 at 1:09 AM, Joe Lewis <joelewis-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > I''m experiencing the same issue. script/generate migration is stubbing > the migration, minus the column info that i''m specifying. Here''s what > I did in the Terminal: > > $ ruby script/generate migration AddPrimaryPlatformInfo os:string > hardware:string > exists db/migrate > create db/migrate/005_add_primary_platform_info.rb > > My 005_add_primary_platform_info.rb file then has: > > class AddPrimaryPlatformInfo < ActiveRecord::Migration > def self.up > end > > def self.down > end > end > > > I can add it manually, but shouldn''t we have some add_column and > remove_column goodness added here already? > > Tried rake:db:redo and rake:db:reset - neither helped. Any suggestions > from this point on would be greatly appreciated. > > Cheers, > Joe > > > > On Feb 28, 1:11 pm, Jabbslad <jabbs...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > Ah sorry should have mentioned that ;) > > > > "rake db:migrate:redo" might have done the trick and still kept the > > data in ur db. > > > > Have a glance at some of the rake tasks for your project (rake -T). > > theres loads of them that should help if u ever have the prob again :) > > > > Glad prob is solved now though. > > > > Jabbslad > > > > On Feb 28, 7:47 pm, Dave Amos <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> > > wrote: > > > > > Yes, that worked, though it wiped the contents of my db, as well. No > > > biggie, though. Thanks! > > > > > Jabbslad wrote: > > > > I just tried the exact same and it worked for me, i wonder if ur > > > > schema/db is in a bad state. Try:- > > > > > > rake db:migrate:reset > > > > > > Then try running the migrations again. > > > > > -- > > > Posted viahttp://www.ruby-forum.com/. > > >-- http://jeremymcanally.com/ http://entp.com Read my books: Ruby in Practice (http://manning.com/mcanally/) My free Ruby e-book (http://humblelittlerubybook.com/) Or, my blogs: http://mrneighborly.com http://rubyinpractice.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 -~----------~----~----~----~------~----~------~--~---
On Fri, 2008-04-11 at 22:09 -0700, Joe Lewis wrote:> I''m experiencing the same issue. script/generate migration is stubbing > the migration, minus the column info that i''m specifying. Here''s what > I did in the Terminal: > > $ ruby script/generate migration AddPrimaryPlatformInfo os:string > hardware:string > exists db/migrate > create db/migrate/005_add_primary_platform_info.rb > > My 005_add_primary_platform_info.rb file then has: > > class AddPrimaryPlatformInfo < ActiveRecord::Migration > def self.up > end > > def self.down > end > end---- if you did... script/generate model SomeNewModel you would get the base ''add table/column'' stuff inserted Craig --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
LOL - got it! Thanks!! I woke up this morning and realized I was omitting the obvious "To" part... ;-) Dang- this thing works perfectly. -Joe On Apr 11, 10:32 pm, "Jeremy McAnally" <jeremymcana...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> You have to name it "Add(x)To(y)", so AddPrimaryPlatformInfoToMachines > or some such. > > Otherwise Rails doesn''t know which table to add the columns to. :) > > --Jeremy > > > > On Sat, Apr 12, 2008 at 1:09 AM, Joe Lewis <joele...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > I''m experiencing the same issue. script/generate migration is stubbing > > the migration, minus the column info that i''m specifying. Here''s what > > I did in the Terminal: > > > $ ruby script/generate migration AddPrimaryPlatformInfo os:string > > hardware:string > > exists db/migrate > > create db/migrate/005_add_primary_platform_info.rb > > > My 005_add_primary_platform_info.rb file then has: > > > class AddPrimaryPlatformInfo < ActiveRecord::Migration > > def self.up > > end > > > def self.down > > end > > end > > > I can add it manually, but shouldn''t we have some add_column and > > remove_column goodness added here already? > > > Tried rake:db:redo and rake:db:reset - neither helped. Any suggestions > > from this point on would be greatly appreciated. > > > Cheers, > > Joe > > > On Feb 28, 1:11 pm, Jabbslad <jabbs...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Ah sorry should have mentioned that ;) > > > > "rake db:migrate:redo" might have done the trick and still kept the > > > data in ur db. > > > > Have a glance at some of the rake tasks for your project (rake -T). > > > theres loads of them that should help if u ever have the prob again :) > > > > Glad prob is solved now though. > > > > Jabbslad > > > > On Feb 28, 7:47 pm, Dave Amos <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> > > > wrote: > > > > > Yes, that worked, though it wiped the contents of my db, as well. No > > > > biggie, though. Thanks! > > > > > Jabbslad wrote: > > > > > I just tried the exact same and it worked for me, i wonder if ur > > > > > schema/db is in a bad state. Try:- > > > > > > rake db:migrate:reset > > > > > > Then try running the migrations again. > > > > > -- > > > > Posted viahttp://www.ruby-forum.com/. > > --http://jeremymcanally.com/http://entp.com > > Read my books: > Ruby in Practice (http://manning.com/mcanally/) > My free Ruby e-book (http://humblelittlerubybook.com/) > > Or, my blogs:http://mrneighborly.comhttp://rubyinpractice.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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
I thought calling db:migrate was supposed to automatically update the model. On Apr 12, 1:40 am, Craig White <craigwh...-BQ75lA0ptkhBDgjK7y7TUQ@public.gmane.org> wrote:> On Fri, 2008-04-11 at 22:09 -0700, Joe Lewis wrote: > > I''m experiencing the same issue. script/generatemigrationis stubbing > > themigration, minus the column info that i''m specifying. Here''s what > > I did in the Terminal: > > > $ ruby script/generatemigrationAddPrimaryPlatformInfo os:string > > hardware:string > > exists db/migrate > > create db/migrate/005_add_primary_platform_info.rb > > > My 005_add_primary_platform_info.rb file then has: > > > class AddPrimaryPlatformInfo < ActiveRecord::Migration > > def self.up > > end > > > def self.down > > end > > end > > ---- > if you did... > > script/generate model SomeNewModel > > you would get the base ''add table/column'' stuff inserted > > Craig--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---