Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDrew Blessing <drew.blessing@me.com>2014-09-08 04:54:18 +0400
committerDrew Blessing <drew.blessing@me.com>2014-09-10 18:56:39 +0400
commita0dbcd2365b9c90892ccd0c5dfb18c7c58de8704 (patch)
tree09b0e5a4027cb9187d9f46f4cd6ff75ac64ea1e6 /db/migrate
parentf42a1ded99920998a9b63b309adc227485428d2c (diff)
Serialize services properties
Diffstat (limited to 'db/migrate')
-rw-r--r--db/migrate/20140907220153_serialize_service_properties.rb35
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