diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-09-10 20:47:47 +0300 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-09-10 20:47:47 +0300 |
commit | 6135eb0adf6e3f2a13b7ef1d998b02a0f3349cc4 (patch) | |
tree | 63e30bb9b5f8191ef341fd05eb255dbf9cdb4aa1 /db/migrate | |
parent | 4a5719f99075a1bdcce727899e9186ac78d096f0 (diff) | |
parent | a0dbcd2365b9c90892ccd0c5dfb18c7c58de8704 (diff) | |
download | gitlab-ce-6135eb0adf6e3f2a13b7ef1d998b02a0f3349cc4.tar.gz |
Merge pull request #7705 from dblessing/serialize_service_properties
Serialize service properties
Diffstat (limited to 'db/migrate')
-rw-r--r-- | db/migrate/20140907220153_serialize_service_properties.rb | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/db/migrate/20140907220153_serialize_service_properties.rb b/db/migrate/20140907220153_serialize_service_properties.rb new file mode 100644 index 00000000000..2326fd0aebf --- /dev/null +++ b/db/migrate/20140907220153_serialize_service_properties.rb @@ -0,0 +1,35 @@ +class SerializeServiceProperties < ActiveRecord::Migration + def change + add_column :services, :properties, :text + + associations = + { + AssemblaService: [:token, :subdomain], + CampfireService: [:token, :subdomain, :room], + EmailsOnPushService: [:recipients], + FlowdockService: [:token], + GemnasiumService: [:api_key, :token], + GitlabCiService: [:token, :project_url], + HipchatService: [:token, :room], + PivotaltrackerService: [:token], + SlackService: [:subdomain, :token, :room], + JenkinsService: [:token, :subdomain], + JiraService: [:project_url, :username, :password, + :api_version, :jira_issue_transition_id], + } + + Service.all.each do |service| + associations[service.type.to_sym].each do |attribute| + service.send("#{attribute}=", service.attributes[attribute.to_s]) + end + service.save! + end + + remove_column :services, :project_url, :string + remove_column :services, :subdomain, :string + remove_column :services, :room, :string + remove_column :services, :recipients, :text + remove_column :services, :api_key, :string + remove_column :services, :token, :string + end +end |