-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add internal_name to service #202
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
class AddInternalNameToService < ActiveRecord::Migration | ||
|
||
def up | ||
add_column :services, :internal_name, :string | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not well-versed in the migration stuff, but I'm thinking that we probably also need to do some sort of data manipulation as part of this. If the user already has services in the their DB we'll want to update all those records and copy the |
||
|
||
Service.all.each do |s| | ||
s.update_attribute(:internal_name, s.name) | ||
end | ||
end | ||
|
||
def down | ||
remove_column :services, :internal_name | ||
end | ||
|
||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the significance of this line is definitely worth exercising in your tests. Specifically the fact that this internal_name is not updated on subsequent changes (updates)... Hit me up if you want me to ellaborate
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated to add another testing case.