Charles R. wrote:
Martin M. wrote:
If you need to add a column to an existing table just create another
migration that adds just this one column. This is what migrations were
created for in the first place.
Yes, we’ve to do so. But i don’t know how to implement it…!!
I don’t know about this migration stuff, usually for any DB related
modifications, i directly work in the MySQL server and send the query
that helped to modify to the team-mates.
Kindly tell me how to create a migration for this particular change on
the particular table?? Please help…
ruby script/generate migration add_proj_to_qatest
will create a new migration (in my case it was the 26th)
inside that, in the self.up, add your columns
add_column :tablename, :fieldname, :fieldtype
class AddProjToQatest < ActiveRecord::Migration
add_column :qatests, :project_id, :integer
add_column :qatests, :projectname, :string
remove_column :qatests, :project_id
remove_column :qatests, :projectname
then just rake the migration…