summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDrew Blessing <drew.blessing@me.com>2014-09-11 10:48:29 -0500
committerDrew Blessing <drew.blessing@me.com>2014-09-11 18:41:03 -0500
commit09cdd94322d078b44d1eeddb6fbd67a889bed1c3 (patch)
tree1392dc6d6c8c79f6ba82d5186213f306a40379ee
parent80174c16d6e28f751e6afc59f9ba28f8c6b792fc (diff)
downloadgitlab-ce-09cdd94322d078b44d1eeddb6fbd67a889bed1c3.tar.gz
Fix serialize migration. Fixes #7734
-rw-r--r--app/models/service.rb7
-rw-r--r--db/migrate/20140907220153_serialize_service_properties.rb3
2 files changed, 8 insertions, 2 deletions
diff --git a/app/models/service.rb b/app/models/service.rb
index edfb31cbe08..1f3a6520473 100644
--- a/app/models/service.rb
+++ b/app/models/service.rb
@@ -17,7 +17,8 @@ class Service < ActiveRecord::Base
serialize :properties, JSON
default_value_for :active, false
- default_value_for :properties, {}
+
+ after_initialize :initialize_properties
belongs_to :project
has_one :service_hook
@@ -32,6 +33,10 @@ class Service < ActiveRecord::Base
:common
end
+ def initialize_properties
+ self.properties = {} if properties.nil?
+ end
+
def title
# implement inside child
end
diff --git a/db/migrate/20140907220153_serialize_service_properties.rb b/db/migrate/20140907220153_serialize_service_properties.rb
index 2326fd0aebf..b95f5b82e03 100644
--- a/db/migrate/20140907220153_serialize_service_properties.rb
+++ b/db/migrate/20140907220153_serialize_service_properties.rb
@@ -1,6 +1,7 @@
class SerializeServiceProperties < ActiveRecord::Migration
def change
add_column :services, :properties, :text
+ Service.reset_column_information
associations =
{
@@ -13,7 +14,7 @@ class SerializeServiceProperties < ActiveRecord::Migration
HipchatService: [:token, :room],
PivotaltrackerService: [:token],
SlackService: [:subdomain, :token, :room],
- JenkinsService: [:token, :subdomain],
+ JenkinsService: [:project_url],
JiraService: [:project_url, :username, :password,
:api_version, :jira_issue_transition_id],
}