Hi there,

I have some major structure change issues with an ruby on rails 
application, and I'd like to ask you about how i can handle that.  I will 
make some dummy problems for you to show what i want to reach:

1. Having a Client model with first_name and last_name should now come 
together as name:
For the model it would be easy to have just

def name
   first_name + ' ' + last_name
end

That works, but now I want to change the database this way, so we dont need 
the first_name and last_name anymore:

I could create a migration having a name:string:index field.
but after that - how can I make all the first_name and last_name applied 
there, and remove the first_name and last_name fields?

2. same for appointments:
We had a start_datetime and an end_datetime which until now was enaugh.  
but now we want to change it to
planned_start_time end actual_start_time (same for end time)

on the migration all the old data from start_datetime should be put into 
both (for historical data) planned end actual times.  For the future this 
will differ.

How can I make this migrations?

If I know about that later there will be some table changes, but maybe I 
understand the routines for that.
Is there also any sql way doing it with rails?  For sql itself it would be 
easy with INSERT..SELECT, so maybe I could generate migrations with sql 
code?

thanks,
Martin

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/dd62ccf4-ae52-4ce5-9477-3d21419faf17%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to