Hi All,
I had a column-name "changed" that I wanted to replaced with
"accessed".
I tried:
class ModifyChangedAttribute < ActiveRecord::Migration
def self.up
rename_column(:csvs, :created, :accessed)
end
def self.down
rename_column(:csvs, :accessed, :created)
end
end
The migration failed:
1. It was apparent because rake db/migrate returned only one line
indicating the app''s "home"
2. Sqlite3''s .dump table_name showed that "created" was
unchanged.
I see now that I provided no table_name to the migration. How do I do
that?
I''m running:
ruby 1.8.6
Rails 2.2.1
Win-Pro/SP3
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?hl=en
-~----------~----~----~----~------~----~------~--~---
BTW, I put up all the code on http://www.pastie.org/343735 HTH, Richard On Dec 19, 10:51 pm, RichardOnRails <RichardDummyMailbox58...-FtJgd9dCuO3JTKoYRCtP1UEOCMrvLtNR@public.gmane.org> wrote:> Hi All, > > I had a column-name "changed" that I wanted to replaced with > "accessed". > > I tried: > class ModifyChangedAttribute < ActiveRecord::Migration > def self.up > rename_column(:csvs, :created, :accessed) > end > > def self.down > rename_column(:csvs, :accessed, :created) > end > end > > The migration failed: > 1. It was apparent because rake db/migrate returned only one line > indicating the app''s "home" > 2. Sqlite3''s .dump table_name showed that "created" was unchanged. > > I see now that I provided no table_name to the migration. How do I do > that? > > I''m running: > ruby 1.8.6 > Rails 2.2.1 > Win-Pro/SP3 > > 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
My earlier statement, "I don''t have a column name" is incorrect. The statement: rename_column(:csvs, :created, :accessed) provided the table_name "cvs" as symbol, the old_name "created" as a symbol, and the new_name. So I don''t have a clue as to what''s wrong. All the code is on http://www.pastie.org/343735, as I mentioned before. Again, thanks for any insights you may offer, Richard On Dec 19, 11:01 pm, RichardOnRails <RichardDummyMailbox58...-FtJgd9dCuO3JTKoYRCtP1UEOCMrvLtNR@public.gmane.org> wrote:> BTW, I put up all the code onhttp://www.pastie.org/343735 > > HTH, > Richard > > On Dec 19, 10:51 pm, RichardOnRails > > <RichardDummyMailbox58...-FtJgd9dCuO3JTKoYRCtP1UEOCMrvLtNR@public.gmane.org> wrote: > > Hi All, > > > I had a column-name "changed" that I wanted to replaced with > > "accessed". > > > I tried: > > class ModifyChangedAttribute < ActiveRecord::Migration > > def self.up > > rename_column(:csvs, :created, :accessed) > > end > > > def self.down > > rename_column(:csvs, :accessed, :created) > > end > > end > > > The migration failed: > > 1. It was apparent because rake db/migrate returned only one line > > indicating the app''s "home" > > 2. Sqlite3''s .dump table_name showed that "created" was unchanged. > > > I see now that I provided no table_name to the migration. How do I do > > that? > > > I''m running: > > ruby 1.8.6 > > Rails 2.2.1 > > Win-Pro/SP3 > > > 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---