I decided to just test the new feature in edge (and soon to be in Rails 2.1) where migrations are created using a UTC timestamp instead of a number. In a test project, where I''ve done a rake rails:freeze:edge, I did: ruby script/generate migration AddCourse title:string and it created a migration file: db/migrate/20080402130730_add_course.rb but all it contains is: class AddCourse < ActiveRecord::Migration def self.up end def self.down end end It doesn''t seem to want to automatically add the bits about creating the table and adding the columns. Am I doing something wrong? I did a quick search through the Rails Trac, but didn''t see anything. Thanks, jt -- 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 -~----------~----~----~----~------~----~------~--~---
John T. wrote:> I decided to just test the new feature in edge (and soon to be in Rails > 2.1) where migrations are created using a UTC timestamp instead of a > number. > > In a test project, where I''ve done a rake rails:freeze:edge, I did: >...> It doesn''t seem to want to automatically add the bits about creating the > table and adding the columns. > > Am I doing something wrong? I did a quick search through the Rails Trac, > but didn''t see anything.Well, I just tried using Rails 2.0.2 (with the latest updates) and either I''m doing something wrong, or migrations just are broken. Doing: ruby script/generate migration CreateCourses title:string, coursenumber:integer, teacher:string creates an empty migration file too. Just def up..end and def down..end 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 -~----------~----~----~----~------~----~------~--~---
Julian Leviston
2008-Apr-03 08:29 UTC
Re: Add Migration in Edge not adding requested columns
Isn''t that syntax normally reserved for script/generate model? Julian. Learn Ruby on Rails! CHECK OUT THE FREE VIDS (LIMITED TIME) NEW VIDEO (#2) OUT NOW! http://sensei.zenunit.com/ On 03/04/2008, at 2:34 AM, John T. wrote:> > John T. wrote: >> I decided to just test the new feature in edge (and soon to be in >> Rails >> 2.1) where migrations are created using a UTC timestamp instead of a >> number. >> >> In a test project, where I''ve done a rake rails:freeze:edge, I did: >> > ... >> It doesn''t seem to want to automatically add the bits about >> creating the >> table and adding the columns. >> >> Am I doing something wrong? I did a quick search through the Rails >> Trac, >> but didn''t see anything. > > Well, I just tried using Rails 2.0.2 (with the latest updates) and > either I''m doing something wrong, or migrations just are broken. > Doing: > > ruby script/generate migration CreateCourses title:string, > coursenumber:integer, teacher:string > > creates an empty migration file too. Just def up..end and def > down..end > > > 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 -~----------~----~----~----~------~----~------~--~---
Julian Leviston wrote:> Isn''t that syntax normally reserved for script/generate model? > > Julian.Using that syntax with script/generate model or script/generate resource does indeed create the proper file. However according to the help for script/generate migration, it implies that it should also work: Description: Stubs out a new database migration. Pass the migration name, either CamelCased or under_scored, and an optional list of attribute pairs as argum ents. A migration class is generated in db/migrate prefixed by the latest migratio n number. You can name your migration in either of these formats to generate add/remov e column lines from supplied attributes: AddColumnsToTable or RemoveColumnsFro mTable Example: `./script/generate migration AddSslFlag` With 4 existing migrations, this creates the AddSslFlag migration in db/migrate/005_add_ssl_flag.rb `./script/generate migration AddTitleBodyToPost title:string body:text publi shed:boolean` This will create the AddTitleBodyToPost in db/migrate/005_add_title_body_to_ post.rb with this in the Up migration: add_column :posts, :title, :string add_column :posts, :body, :text add_column :posts, :published, :boolean And this in the Down migration: remove_column :posts, :published remove_column :posts, :body remove_column :posts, :title -- 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 too have run into this problem. Has anyone confirmed that this is a defect? --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Frederick Cheung
2008-May-30 11:03 UTC
Re: Add Migration in Edge not adding requested columns
On 3 Apr 2008, at 14:31, John T. wrote:> > Julian Leviston wrote: >> Isn''t that syntax normally reserved for script/generate model? >> >> Julian. > > Using that syntax with script/generate model or script/generate > resource > does indeed create the proper file. However according to the help for > script/generate migration, it implies that it should also work: >Although it never mentions creating a table; it only discusses AddColumnsToTable & RemoveColumnsFromTable. If you look at the code, it''s not failing to recognise migrations like CreateFoos, it''s just not even trying at all. Fred --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---