Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Jérome Perrin
gitlab-ce
Commits
3704e146
Commit
3704e146
authored
Sep 12, 2014
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #7738 from dblessing/serialize_migration_fix
Fix serialize migration
parents
6c9cb565
09cdd943
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
2 deletions
+8
-2
app/models/service.rb
app/models/service.rb
+6
-1
db/migrate/20140907220153_serialize_service_properties.rb
db/migrate/20140907220153_serialize_service_properties.rb
+2
-1
No files found.
app/models/service.rb
View file @
3704e146
...
@@ -17,7 +17,8 @@ class Service < ActiveRecord::Base
...
@@ -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
...
@@ -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
...
...
db/migrate/20140907220153_serialize_service_properties.rb
View file @
3704e146
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
...
@@ -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
],
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment