Fix serialize migration. Fixes #7734
This commit is contained in:
parent
80174c16d6
commit
09cdd94322
2 changed files with 8 additions and 2 deletions
|
@ -17,7 +17,8 @@ class Service < ActiveRecord::Base
|
||||||
serialize :properties, JSON
|
serialize :properties, JSON
|
||||||
|
|
||||||
default_value_for :active, false
|
default_value_for :active, false
|
||||||
default_value_for :properties, {}
|
|
||||||
|
after_initialize :initialize_properties
|
||||||
|
|
||||||
belongs_to :project
|
belongs_to :project
|
||||||
has_one :service_hook
|
has_one :service_hook
|
||||||
|
@ -32,6 +33,10 @@ class Service < ActiveRecord::Base
|
||||||
:common
|
:common
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def initialize_properties
|
||||||
|
self.properties = {} if properties.nil?
|
||||||
|
end
|
||||||
|
|
||||||
def title
|
def title
|
||||||
# implement inside child
|
# implement inside child
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
class SerializeServiceProperties < ActiveRecord::Migration
|
class SerializeServiceProperties < ActiveRecord::Migration
|
||||||
def change
|
def change
|
||||||
add_column :services, :properties, :text
|
add_column :services, :properties, :text
|
||||||
|
Service.reset_column_information
|
||||||
|
|
||||||
associations =
|
associations =
|
||||||
{
|
{
|
||||||
|
@ -13,7 +14,7 @@ class SerializeServiceProperties < ActiveRecord::Migration
|
||||||
HipchatService: [:token, :room],
|
HipchatService: [:token, :room],
|
||||||
PivotaltrackerService: [:token],
|
PivotaltrackerService: [:token],
|
||||||
SlackService: [:subdomain, :token, :room],
|
SlackService: [:subdomain, :token, :room],
|
||||||
JenkinsService: [:token, :subdomain],
|
JenkinsService: [:project_url],
|
||||||
JiraService: [:project_url, :username, :password,
|
JiraService: [:project_url, :username, :password,
|
||||||
:api_version, :jira_issue_transition_id],
|
:api_version, :jira_issue_transition_id],
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue