On Tue, Jun 7, 2011 at 10:47 AM, Rodrigo Ruiz <[email protected]>wrote:
> Thank, one more thing, is there a way to alter only the original migration > so all the attributes stay listed in the same file and that can be easily > altered? > > The best practice would be to create a new migration everytime you want to change the database structure. Sure, you can edit the previous migrations but you have to drop your database before you can run the migration. Also, editing a migration will cause lots of confusion if it's already pushed to the remote repository and some other developers have already ran them. > > On Mon, Jun 6, 2011 at 9:53 PM, Jim Ruther Nill <[email protected]> wrote: > >> >> >> On Tue, Jun 7, 2011 at 9:25 AM, Rodrigo Ruiz <[email protected]>wrote: >> >>> I made a database with rails generate model User password:string ... >>> now I want to delete the password attribute, because I'm going to encrypt >>> it before saving, so I want to make an attribute with name >>> encrypted_password instead of password. >>> How can I do that without deleting the whole file of migration and making >>> all from scratch? >>> >>> >> you can do this by creating a *NEW *migration like >> >> >> add_column :users, :encrypted_password, :string >> # insert here the steps that will convert password to encrypted_password >> remove_column :users, :password >> >> >> or use devise/authlogic. >> >> >> >>> Thank you >>> >>> -- >>> 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 [email protected]. >>> To unsubscribe from this group, send email to >>> [email protected]. >>> For more options, visit this group at >>> http://groups.google.com/group/rubyonrails-talk?hl=en. >>> >> >> >> >> -- >> ------------------------------------------------------------- >> visit my blog at http://jimlabs.heroku.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 [email protected]. >> To unsubscribe from this group, send email to >> [email protected]. >> For more options, visit this group at >> http://groups.google.com/group/rubyonrails-talk?hl=en. >> > > -- > 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 [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > -- ------------------------------------------------------------- visit my blog at http://jimlabs.heroku.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 [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

