Skip to content
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

Merged
merged 1 commit into from
Sep 11, 2014
Merged

Conversation

rheinwein
Copy link
Collaborator

We want users to be able to update service.name, but that value is used within the unit file. This introduces a new field on the service called 'internal_name' which is immutable and will be used in places where a string is used a unique identifier.

[finishes #70098068]

@@ -2,6 +2,7 @@ class CreateServices < ActiveRecord::Migration
def change
create_table :services do |t|
t.string :name
t.string :internal_name
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is our first schema change since being out in the wild -- I think we might need to do this as a dedicated migration.

@rheinwein rheinwein force-pushed the feature/add-internal-name-70098068 branch 2 times, most recently from 5c83ef4 to 793edc5 Compare September 10, 2014 19:12
@@ -0,0 +1,5 @@
class AddInternalNameToService < ActiveRecord::Migration
def change
add_column :services, :internal_name, :string
Copy link
Collaborator

Choose a reason for hiding this comment

The 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 name field to the internal_name field. Not sure if that logic is appropriate to put in the migration file or if it goes someplace else. Maybe @alexwelch can weigh-in.

@@ -29,6 +29,7 @@ class Service < ActiveRecord::Base
serialize :volumes, Array

before_save :resolve_name_conflicts
before_create :set_internal_name
Copy link
Contributor

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

Copy link
Collaborator Author

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.

@rheinwein rheinwein force-pushed the feature/add-internal-name-70098068 branch from 3faff8b to 98b3dd0 Compare September 11, 2014 15:18
@alexwelch
Copy link
Contributor

👍

1 similar comment
@bdehamer
Copy link
Collaborator

👍

@rheinwein rheinwein force-pushed the feature/add-internal-name-70098068 branch from 98b3dd0 to 10c7bc6 Compare September 11, 2014 19:24
@rheinwein rheinwein force-pushed the feature/add-internal-name-70098068 branch from 10c7bc6 to ae651c9 Compare September 11, 2014 19:27
@rheinwein rheinwein merged commit ae651c9 into master Sep 11, 2014
@rheinwein rheinwein deleted the feature/add-internal-name-70098068 branch September 11, 2014 19:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants