Commit c5cdd07899df5cc5d87c514a7649979056fcced7

Authored by Dmitriy Zaporozhets
1 parent 9a02e27b

Add values to default fields to prevent 500 error when migrate from MySQL to Postgres

Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
app/models/note.rb
@@ -23,6 +23,8 @@ require &#39;file_size_validator&#39; @@ -23,6 +23,8 @@ require &#39;file_size_validator&#39;
23 class Note < ActiveRecord::Base 23 class Note < ActiveRecord::Base
24 include Mentionable 24 include Mentionable
25 25
  26 + default_value_for :system, false
  27 +
26 attr_accessible :note, :noteable, :noteable_id, :noteable_type, :project_id, 28 attr_accessible :note, :noteable, :noteable_id, :noteable_type, :project_id,
27 :attachment, :line_code, :commit_id 29 :attachment, :line_code, :commit_id
28 attr_mentionable :note 30 attr_mentionable :note
app/models/project.rb
@@ -29,6 +29,12 @@ class Project &lt; ActiveRecord::Base @@ -29,6 +29,12 @@ class Project &lt; ActiveRecord::Base
29 extend Enumerize 29 extend Enumerize
30 30
31 default_value_for :archived, false 31 default_value_for :archived, false
  32 + default_value_for :issues_enabled, true
  33 + default_value_for :wall_enabled, false
  34 + default_value_for :merge_requests_enabled, true
  35 + default_value_for :wiki_enabled, true
  36 + default_value_for :snippets_enabled, false
  37 + default_value_for :imported, false
32 38
33 ActsAsTaggableOn.strict_case_match = true 39 ActsAsTaggableOn.strict_case_match = true
34 40
app/models/user.rb
@@ -49,6 +49,11 @@ require &#39;carrierwave/orm/activerecord&#39; @@ -49,6 +49,11 @@ require &#39;carrierwave/orm/activerecord&#39;
49 require 'file_size_validator' 49 require 'file_size_validator'
50 50
51 class User < ActiveRecord::Base 51 class User < ActiveRecord::Base
  52 + default_value_for :admin, false
  53 + default_value_for :can_create_group, true
  54 + default_value_for :can_create_team, false
  55 + default_value_for :hide_no_ssh_key, false
  56 +
52 devise :database_authenticatable, :token_authenticatable, :lockable, :async, 57 devise :database_authenticatable, :token_authenticatable, :lockable, :async,
53 :recoverable, :rememberable, :trackable, :validatable, :omniauthable, :confirmable, :registerable 58 :recoverable, :rememberable, :trackable, :validatable, :omniauthable, :confirmable, :registerable
54 59