Merge pull request #6116 from opf/feature/bump_rails_to_5_1

bump rails to 5.1
pull/6218/head
Oliver Günther 7 years ago committed by GitHub
commit b25c14df25
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      Gemfile
  2. 126
      Gemfile.lock
  3. 7
      app/contracts/relations/base_contract.rb
  4. 95
      app/models/concerns/virtual_attribute.rb
  5. 1
      app/models/custom_action.rb
  6. 4
      app/models/journal.rb
  7. 33
      app/models/message.rb
  8. 3
      app/models/project/activity.rb
  9. 72
      app/models/relation.rb
  10. 12
      app/models/relation/hierarchy_paths.rb
  11. 12
      app/models/version.rb
  12. 5
      app/models/wiki_content.rb
  13. 55
      app/models/work_package/parent.rb
  14. 2
      config.ru
  15. 2
      config/initializers/reload_api.rb
  16. 2
      db/migrate/000_aggregated_migrations.rb
  17. 2
      db/migrate/20110211160100_add_summary_to_projects.rb
  18. 2
      db/migrate/20110817142220_add_display_sums_field_to_migration.rb
  19. 2
      db/migrate/20111114124552_add_user_first_logged_in_and_impaired_fields.rb
  20. 4
      db/migrate/20120319095930_localize_email_header_and_footer.rb
  21. 2
      db/migrate/20120319135006_add_custom_field_translation_table.rb
  22. 2
      db/migrate/20120529090411_create_delayed_jobs.rb
  23. 2
      db/migrate/20120731091543_use_the_full_sti_class_names_for_repositories.rb
  24. 2
      db/migrate/20120731135140_create_wiki_menu_items.rb
  25. 2
      db/migrate/20120802152122_rename_auth_source_ldap.rb
  26. 2
      db/migrate/20120809131659_create_wiki_menu_item_for_existing_wikis.rb
  27. 2
      db/migrate/20120828171423_make_groups_users_a_model.rb
  28. 4
      db/migrate/20121004054229_add_wiki_list_attachments.rb
  29. 2
      db/migrate/20121030111651_rename_acts_as_journalized_changes_column.rb
  30. 2
      db/migrate/20121101111303_add_missing_indexes_on_wiki_menu_items.rb
  31. 2
      db/migrate/20121114100641_aggregated_announcements_migrations.rb
  32. 2
      db/migrate/20130204140624_add_index_on_identifier_to_projects.rb
  33. 2
      db/migrate/20130315124655_add_longer_login_to_users.rb
  34. 2
      db/migrate/20130325165622_remove_gantt_related_data_from_database.rb
  35. 4
      db/migrate/20130409133700_add_timelines_project_type_id_to_projects.rb
  36. 2
      db/migrate/20130409133701_create_timelines_project_types.rb
  37. 5
      db/migrate/20130409133702_create_timelines_planning_element_types.rb
  38. 8
      db/migrate/20130409133703_create_timelines_planning_elements.rb
  39. 4
      db/migrate/20130409133704_create_timelines_scenarios.rb
  40. 4
      db/migrate/20130409133705_create_timelines_alternate_dates.rb
  41. 4
      db/migrate/20130409133706_add_timelines_responsible_id_to_projects.rb
  42. 2
      db/migrate/20130409133707_create_timelines_colors.rb
  43. 5
      db/migrate/20130409133708_create_timelines_reportings.rb
  44. 7
      db/migrate/20130409133709_create_timelines_available_project_statuses.rb
  45. 5
      db/migrate/20130409133710_create_timelines_project_associations.rb
  46. 7
      db/migrate/20130409133711_create_timelines_enabled_planning_element_types.rb
  47. 9
      db/migrate/20130409133712_create_timelines_default_planning_element_types.rb
  48. 2
      db/migrate/20130409133713_migrate_planning_element_type_to_project_association.rb
  49. 2
      db/migrate/20130409133714_remove_project_type_id_from_timelines_planning_element_types.rb
  50. 4
      db/migrate/20130409133715_create_timelines_timelines.rb
  51. 2
      db/migrate/20130409133717_add_options_to_timelines_timelines.rb
  52. 2
      db/migrate/20130409133718_remove_content_from_timelines_timelines.rb
  53. 2
      db/migrate/20130409133719_add_indexes_to_timelines_alternate_dates_to_secure_at_scope.rb
  54. 2
      db/migrate/20130409133720_add_deleted_at_to_timelines_planning_elements.rb
  55. 2
      db/migrate/20130409133721_allow_null_position_in_colors.rb
  56. 2
      db/migrate/20130409133722_allow_null_position_in_planning_element_types.rb
  57. 2
      db/migrate/20130409133723_allow_null_position_in_project_types.rb
  58. 2
      db/migrate/20130611154020_remove_timelines_namespace.rb
  59. 2
      db/migrate/20130612120042_migrate_serialized_yaml_from_syck_to_psych.rb
  60. 2
      db/migrate/20130613075253_add_force_password_change_to_user.rb
  61. 2
      db/migrate/20130619081234_create_user_passwords.rb
  62. 11
      db/migrate/20130620082322_create_work_packages.rb
  63. 2
      db/migrate/20130625124242_work_package_custom_field_data_migration.rb
  64. 2
      db/migrate/20130628092725_add_failed_login_count_last_failed_login_on_to_user.rb
  65. 2
      db/migrate/20130709084751_rename_end_date_on_alternate_dates.rb
  66. 2
      db/migrate/20130710145350_remove_end_date_from_work_packages.rb
  67. 2
      db/migrate/20130717134318_rename_changeset_wp_join_table.rb
  68. 2
      db/migrate/20130719133922_rename_trackers_to_types.rb
  69. 2
      db/migrate/20130722154555_rename_work_package_sti_column.rb
  70. 2
      db/migrate/20130723092240_add_activity_module.rb
  71. 2
      db/migrate/20130723134527_increase_journals_changed_data_limit.rb
  72. 2
      db/migrate/20130724143418_add_planning_element_type_properties_to_type.rb
  73. 2
      db/migrate/20130729114110_move_planning_element_types_to_legacy_planning_element_types.rb
  74. 2
      db/migrate/20130806075000_add_standard_column_to_type_table.rb
  75. 2
      db/migrate/20130807081927_move_journals_to_legacy_journals.rb
  76. 2
      db/migrate/20130807082645_create_normalized_journals.rb
  77. 2
      db/migrate/20130807083715_create_attachment_journals.rb
  78. 2
      db/migrate/20130807083716_change_attachment_journals_description_length.rb
  79. 2
      db/migrate/20130807084417_create_work_package_journals.rb
  80. 2
      db/migrate/20130807084708_create_message_journals.rb
  81. 2
      db/migrate/20130807085108_create_news_journals.rb
  82. 2
      db/migrate/20130807085245_create_wiki_content_journals.rb
  83. 2
      db/migrate/20130807085430_create_time_entry_journals.rb
  84. 2
      db/migrate/20130807085714_create_changeset_journals.rb
  85. 2
      db/migrate/20130807141542_remove_files_attached_to_projects_and_versions.rb
  86. 2
      db/migrate/20130813062401_add_attachable_journal.rb
  87. 2
      db/migrate/20130813062513_add_customizable_journal.rb
  88. 2
      db/migrate/20130813062523_fix_customizable_journal_value_column.rb
  89. 2
      db/migrate/20130814130142_remove_documents.rb
  90. 2
      db/migrate/20130828093647_remove_alternate_dates_and_scenarios.rb
  91. 2
      db/migrate/20130829084747_drop_model_journals_updated_on_column.rb
  92. 2
      db/migrate/20130916094339_legacy_issues_to_work_packages.rb
  93. 2
      db/migrate/20130916123916_planning_element_types_data_to_types.rb
  94. 2
      db/migrate/20130917101922_migrate_query_tracker_references_to_type.rb
  95. 2
      db/migrate/20130917122118_remove_is_in_chlog_from_types.rb
  96. 2
      db/migrate/20130917131710_planning_element_data_to_work_packages.rb
  97. 2
      db/migrate/20130918111753_migrate_user_rights.rb
  98. 2
      db/migrate/20130919105841_migrate_settings_to_work_package.rb
  99. 2
      db/migrate/20130919145142_rename_issue_relations_to_relations.rb
  100. 2
      db/migrate/20130920081120_journal_indices.rb
  101. Some files were not shown because too many files have changed in this diff Show More

@ -33,14 +33,14 @@ ruby '~> 2.4.2'
gem 'actionpack-xml_parser', '~> 2.0.0'
gem 'activemodel-serializers-xml', '~> 1.0.1'
gem 'activerecord-session_store', '~> 1.1.0'
gem 'rails', '~> 5.0.6'
gem 'rails', '~> 5.1.5'
gem 'responders', '~> 2.4'
gem 'coderay', '~> 1.1.2'
gem 'rubytree', git: 'https://github.com/dr0verride/RubyTree.git', ref: '06f53ee'
gem 'rdoc', '>= 2.4.2'
gem 'globalize', git: 'https://github.com/globalize/globalize', ref: '38443bcd', require: false
gem 'globalize', '~> 5.1.0.beta2', require: false
gem 'omniauth', git: 'https://github.com/oliverguenther/omniauth', ref: '40c6f5f751d2da7cce5444bbd96c390c450440a9'
gem 'request_store', '~> 1.3.1'
@ -106,7 +106,7 @@ gem 'rack-attack', '~> 5.0.1'
gem 'okcomputer', '~> 1.16.0'
# Patch Rails HTML whitelisting for Angular curly braces
gem 'rails-angular-xss', git: 'https://github.com/opf/rails-angular-xss', ref: 'a45267d5'
gem 'rails-angular-xss', git: 'https://github.com/opf/rails-angular-xss', ref: '00b588b8b8b18c0f53fcb5232be1a2c34dbd1fac'
gem 'gon', '~> 6.2.0'
gem "syck", '~> 1.3.0', require: false

@ -20,16 +20,6 @@ GIT
transactional_lock (0.1.0)
activerecord (>= 4.0)
GIT
remote: https://github.com/globalize/globalize
revision: 38443bcd07da78b7b8a9433e4c6c32dd51f964a3
ref: 38443bcd
specs:
globalize (5.1.0)
activemodel (>= 4.2, < 5.1)
activerecord (>= 4.2, < 5.1)
request_store (~> 1.0)
GIT
remote: https://github.com/goodwill/capybara-select2
revision: 585192e4bb0db8d52e761ab68f08c17294806447
@ -60,11 +50,11 @@ GIT
GIT
remote: https://github.com/opf/rails-angular-xss
revision: a45267d53d32610bad01f903e9f1b49a81b7c37b
ref: a45267d5
revision: 00b588b8b8b18c0f53fcb5232be1a2c34dbd1fac
ref: 00b588b8b8b18c0f53fcb5232be1a2c34dbd1fac
specs:
rails-angular-xss (0.3.0.pre.pre)
rails (>= 5.0.0, < 5.1)
rails (>= 5.0.0)
GIT
remote: https://github.com/rspec/rspec-activemodel-mocks
@ -78,54 +68,54 @@ GIT
GEM
remote: https://rubygems.org/
specs:
actioncable (5.0.6)
actionpack (= 5.0.6)
nio4r (>= 1.2, < 3.0)
actioncable (5.1.5)
actionpack (= 5.1.5)
nio4r (~> 2.0)
websocket-driver (~> 0.6.1)
actionmailer (5.0.6)
actionpack (= 5.0.6)
actionview (= 5.0.6)
activejob (= 5.0.6)
actionmailer (5.1.5)
actionpack (= 5.1.5)
actionview (= 5.1.5)
activejob (= 5.1.5)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 2.0)
actionpack (5.0.6)
actionview (= 5.0.6)
activesupport (= 5.0.6)
actionpack (5.1.5)
actionview (= 5.1.5)
activesupport (= 5.1.5)
rack (~> 2.0)
rack-test (~> 0.6.3)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
actionpack-xml_parser (2.0.1)
actionpack (>= 5.0)
railties (>= 5.0)
actionview (5.0.6)
activesupport (= 5.0.6)
actionview (5.1.5)
activesupport (= 5.1.5)
builder (~> 3.1)
erubis (~> 2.7.0)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.3)
active_record_query_trace (1.5.4)
activejob (5.0.6)
activesupport (= 5.0.6)
activejob (5.1.5)
activesupport (= 5.1.5)
globalid (>= 0.3.6)
activemodel (5.0.6)
activesupport (= 5.0.6)
activemodel (5.1.5)
activesupport (= 5.1.5)
activemodel-serializers-xml (1.0.1)
activemodel (> 5.x)
activerecord (> 5.x)
activesupport (> 5.x)
builder (~> 3.1)
activerecord (5.0.6)
activemodel (= 5.0.6)
activesupport (= 5.0.6)
arel (~> 7.0)
activerecord (5.1.5)
activemodel (= 5.1.5)
activesupport (= 5.1.5)
arel (~> 8.0)
activerecord-session_store (1.1.0)
actionpack (>= 4.0, < 5.2)
activerecord (>= 4.0, < 5.2)
multi_json (~> 1.11, >= 1.11.2)
rack (>= 1.5.2, < 3)
railties (>= 4.0, < 5.2)
activesupport (5.0.6)
activesupport (5.1.5)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (~> 0.7)
minitest (~> 5.1)
@ -139,7 +129,7 @@ GEM
airbrake (5.1.0)
airbrake-ruby (~> 1.1)
airbrake-ruby (1.5.0)
arel (7.1.4)
arel (8.0.0)
ast (2.3.0)
autoprefixer-rails (7.1.5)
execjs
@ -205,7 +195,7 @@ GEM
concurrent-ruby (1.0.5)
crack (0.4.3)
safe_yaml (~> 1.0.0)
crass (1.0.2)
crass (1.0.3)
crowdin-api (0.5.0)
rest-client (~> 2.0)
cucumber (3.0.1)
@ -262,7 +252,7 @@ GEM
equivalent-xml (0.6.0)
nokogiri (>= 1.4.3)
erbse (0.0.2)
erubis (2.7.0)
erubi (1.7.0)
eventmachine (1.2.3)
excon (0.52.0)
execjs (2.7.0)
@ -297,8 +287,12 @@ GEM
ruby-progressbar (~> 1.4)
get_process_mem (0.2.1)
gherkin (4.1.3)
globalid (0.4.0)
globalid (0.4.1)
activesupport (>= 4.2.0)
globalize (5.1.0)
activemodel (>= 4.2, < 5.2)
activerecord (>= 4.2, < 5.2)
request_store (~> 1.0)
gon (6.2.0)
actionpack (>= 3.0)
multi_json
@ -317,7 +311,7 @@ GEM
htmldiff (0.0.1)
http-cookie (1.0.3)
domain_name (~> 0.5)
i18n (0.9.0)
i18n (0.9.5)
concurrent-ruby (~> 1.0)
i18n-js (3.0.1)
i18n (~> 0.6, >= 0.6.6)
@ -341,7 +335,7 @@ GEM
sass
thor
tilt
loofah (2.1.1)
loofah (2.2.0)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
mail (2.6.6)
@ -349,11 +343,13 @@ GEM
meta-tags (2.6.0)
actionpack (>= 3.2.0, < 5.3)
method_source (0.8.2)
mime-types (2.99.3)
mini_mime (0.1.4)
mime-types (3.1)
mime-types-data (~> 3.2015)
mime-types-data (3.2016.0521)
mini_mime (1.0.0)
mini_portile2 (2.3.0)
minisyntax (0.2.5)
minitest (5.10.3)
minitest (5.11.3)
mixlib-shellout (2.1.0)
msgpack (1.1.0)
multi_json (1.12.2)
@ -365,7 +361,7 @@ GEM
net-ldap (0.16.0)
netrc (0.11.0)
newrelic_rpm (4.5.0.337)
nio4r (2.1.0)
nio4r (2.2.0)
nokogiri (1.8.2)
mini_portile2 (~> 2.3.0)
oj (3.3.8)
@ -410,7 +406,7 @@ GEM
public_suffix (3.0.0)
rabl (0.13.1)
activesupport (>= 2.3.14)
rack (2.0.3)
rack (2.0.4)
rack-accept (0.4.5)
rack (>= 0.4)
rack-attack (5.0.1)
@ -422,17 +418,17 @@ GEM
rack_session_access (0.1.1)
builder (>= 2.0.0)
rack (>= 1.0.0)
rails (5.0.6)
actioncable (= 5.0.6)
actionmailer (= 5.0.6)
actionpack (= 5.0.6)
actionview (= 5.0.6)
activejob (= 5.0.6)
activemodel (= 5.0.6)
activerecord (= 5.0.6)
activesupport (= 5.0.6)
rails (5.1.5)
actioncable (= 5.1.5)
actionmailer (= 5.1.5)
actionpack (= 5.1.5)
actionview (= 5.1.5)
activejob (= 5.1.5)
activemodel (= 5.1.5)
activerecord (= 5.1.5)
activesupport (= 5.1.5)
bundler (>= 1.3.0)
railties (= 5.0.6)
railties (= 5.1.5)
sprockets-rails (>= 2.0.0)
rails-controller-testing (1.0.2)
actionpack (~> 5.x, >= 5.0.1)
@ -450,16 +446,16 @@ GEM
rails (> 3.1)
rails_serve_static_assets (0.0.5)
rails_stdout_logging (0.0.5)
railties (5.0.6)
actionpack (= 5.0.6)
activesupport (= 5.0.6)
railties (5.1.5)
actionpack (= 5.1.5)
activesupport (= 5.1.5)
method_source
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
rainbow (2.2.2)
rake
raindrops (0.19.0)
rake (12.1.0)
rake (12.3.0)
rb-fsevent (0.10.2)
rb-inotify (0.9.10)
ffi (>= 0.5.0, < 2)
@ -573,7 +569,7 @@ GEM
ttfunk (1.5.0)
typed_dag (2.0.2)
rails (>= 5.0.4)
tzinfo (1.2.3)
tzinfo (1.2.5)
thread_safe (~> 0.1)
tzinfo-data (1.2017.2)
tzinfo (>= 1.0.0)
@ -603,7 +599,7 @@ GEM
hashdiff
websocket-driver (0.6.5)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.2)
websocket-extensions (0.1.3)
will_paginate (3.1.6)
xpath (2.1.0)
nokogiri (~> 1.3)
@ -649,7 +645,7 @@ DEPENDENCIES
fog-aws
friendly_id (~> 5.2.1)
fuubar (~> 2.2.0)
globalize!
globalize (~> 5.1.0.beta2)
gon (~> 6.2.0)
grape (~> 1.0)
health_check
@ -685,7 +681,7 @@ DEPENDENCIES
rack-protection (~> 2.0.0)
rack-test (~> 0.6.3)
rack_session_access
rails (~> 5.0.6)
rails (~> 5.1.5)
rails-angular-xss!
rails-controller-testing (~> 1.0.2)
rails_12factor

@ -42,6 +42,7 @@ module Relations
validate :validate_from_exists
validate :validate_to_exists
validate :validate_only_one_follow_direction_between_hierarchies
validate :validate_accepted_type
attr_reader :user
@ -79,6 +80,12 @@ module Relations
end
end
def validate_accepted_type
return if (Relation::TYPES.keys + [Relation::TYPE_HIERARCHY]).include?(model.relation_type)
errors.add :relation_type, :inclusion
end
def manage_relations_permission?
if !manage_relations?
errors.add :base, :error_unauthorized

@ -0,0 +1,95 @@
#-- copyright
# OpenProject is a project management system.
# Copyright (C) 2012-2017 the OpenProject Foundation (OPF)
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License version 3.
#
# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
# Copyright (C) 2006-2017 Jean-Philippe Lang
# Copyright (C) 2010-2013 the ChiliProject Team
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# See doc/COPYRIGHT.rdoc for more details.
#++
module Concerns
module VirtualAttribute
extend ActiveSupport::Concern
class_methods do
def virtual_attribute(attribute, cast_type: :string, &block)
attribute attribute, cast_type
define_attribute_method attribute
include InstanceMethods
_define_virtual_attribute_setter(attribute)
_define_virtual_attribute_getter(attribute, &block)
_define_virtual_attribute_reload(attribute)
end
private
def _define_virtual_attribute_setter(attribute)
define_method "#{attribute}=" do |value|
set_virtual_attribute(attribute, value) if send(attribute) != value
instance_variable_set(:"@#{attribute}_set", true)
instance_variable_set(:"@#{attribute}", value)
end
end
def _define_virtual_attribute_getter(attribute, &block)
define_method attribute do
if instance_variable_get(:"@#{attribute}_set")
instance_variable_get(:"@#{attribute}")
else
value = instance_eval(&block)
set_virtual_attribute_was(attribute, value)
instance_variable_set(:"@#{attribute}", value)
end
end
end
def _define_virtual_attribute_reload(attribute)
define_method :reload do |*args|
instance_variable_set(:"@#{attribute}", nil)
instance_variable_set(:"@#{attribute}_set", nil)
super(*args)
end
end
end
module InstanceMethods
# Used to persists the changes to the virtual attribute in the mutation_tracker used by
# AR::Dirty so that it looks like every other attribute.
# Using attribute_will_change! does not place the value in the tracker but merely forces
# the attribute to be returned when asking the object for changes.
def set_virtual_attribute_was(attribute, value)
attributes = mutation_tracker.send(:attributes)
attributes[attribute.to_s].instance_variable_set(:@value_before_type_cast, value)
end
def set_virtual_attribute(attribute, value)
attributes = mutation_tracker.send(:attributes)
attributes[attribute.to_s] = attributes[attribute.to_s].with_value_from_user(value)
end
end
end
end

@ -38,6 +38,7 @@ class CustomAction < ActiveRecord::Base
after_save :persist_conditions
attribute :conditions
define_attribute_method 'conditions'
acts_as_list

@ -44,8 +44,8 @@ class Journal < ActiveRecord::Base
belongs_to :user
belongs_to :journable, polymorphic: true
has_many :attachable_journals, class_name: Journal::AttachableJournal, dependent: :destroy
has_many :customizable_journals, class_name: Journal::CustomizableJournal, dependent: :destroy
has_many :attachable_journals, class_name: 'Journal::AttachableJournal', dependent: :destroy
has_many :customizable_journals, class_name: 'Journal::CustomizableJournal', dependent: :destroy
after_create :save_data, if: :data
after_save :save_data, :touch_journable

@ -67,10 +67,10 @@ class Message < ActiveRecord::Base
after_create :add_author_as_watcher,
:update_last_reply_in_parent,
:send_message_posted_mail
after_update :update_ancestors
after_update :update_ancestors, if: :saved_change_to_board_id?
after_destroy :reset_counters
scope :visible, -> (*args) {
scope :visible, ->(*args) {
includes(board: :project)
.references(:projects)
.merge(Project.allowed_to(args.first || User.current, :view_messages))
@ -90,11 +90,9 @@ class Message < ActiveRecord::Base
end
def set_sticked_on_date
if sticky?
self.sticked_on = sticked_on.nil? ? Time.now : sticked_on
else
self.sticked_on = nil
end
self.sticked_on = if sticky?
sticked_on.nil? ? Time.now : sticked_on
end
end
def update_last_reply_in_parent
@ -104,15 +102,6 @@ class Message < ActiveRecord::Base
board.reset_counters!
end
def update_ancestors
if board_id_changed?
Message.where(['id = ? OR parent_id = ?', root.id, root.id])
.update_all("board_id = #{board_id}")
Board.reset_counters!(board_id_was)
Board.reset_counters!(board_id)
end
end
def reset_counters
board.reset_counters!
end
@ -135,6 +124,18 @@ class Message < ActiveRecord::Base
private
def update_ancestors
with_id = Message.where(id: root.id)
with_parent_id = Message.where(parent_id: root.id)
with_id
.or(with_parent_id)
.update_all("board_id = #{board_id}")
Board.reset_counters!(board_id_before_last_save)
Board.reset_counters!(board_id)
end
def add_author_as_watcher
Watcher.create(watchable: root, user: author)
# update watchers and watcher_users

@ -52,7 +52,8 @@ module Project::Activity
def with_latest_activity
Project
.select('projects.*, activity.latest_activity_at')
.select('projects.*')
.select('activity.latest_activity_at')
.joins("LEFT JOIN (#{latest_activity_sql}) activity ON projects.id = activity.project_id")
end

@ -29,9 +29,26 @@
#++
class Relation < ActiveRecord::Base
include Concerns::VirtualAttribute
scope :of_work_package,
->(work_package) { where('from_id = ? OR to_id = ?', work_package, work_package) }
virtual_attribute :relation_type do
types = ((TYPES.keys + [TYPE_HIERARCHY]) & Relation.column_names).select do |name|
send(name) > 0
end
case types.length
when 1
types[0]
when 0
nil
else
TYPE_MIXED
end
end
TYPE_RELATES = 'relates'.freeze
TYPE_DUPLICATES = 'duplicates'.freeze
TYPE_DUPLICATED = 'duplicated'.freeze
@ -90,7 +107,6 @@ class Relation < ActiveRecord::Base
}
}.freeze
validates_inclusion_of :relation_type, in: TYPES.keys + [TYPE_HIERARCHY]
validates_numericality_of :delay, allow_nil: true
validate :validate_sanity_of_relation
@ -99,6 +115,20 @@ class Relation < ActiveRecord::Base
before_save :set_type_column
[TYPE_RELATES,
TYPE_DUPLICATES,
TYPE_BLOCKS,
TYPE_PRECEDES,
TYPE_FOLLOWS,
TYPE_INCLUDES,
TYPE_REQUIRES,
TYPE_HIERARCHY].each do |type|
define_method "#{type}=" do |value|
instance_variable_set(:"@relation_type_set", nil)
super(value)
end
end
def self.relation_column(type)
if TYPES.key?(type) && TYPES[type][:reverse]
TYPES[type][:reverse]
@ -168,42 +198,6 @@ class Relation < ActiveRecord::Base
.where(from_id: work_package.parent_id)
end
def relation_type=(type)
attribute_will_change!('relation_type') if relation_type != type
@relation_type = type
end
def relation_type_changed?
changed.include?('relation_type')
end
def relation_type_was
if changes['relation_type']
changes['relation_type'].first
else
relation_type
end
end
def relation_type
if @relation_type.present?
@relation_type
else
types = ((TYPES.keys + [TYPE_HIERARCHY]) & Relation.column_names).select do |name|
send(name) > 0
end
@relation_type = case types.length
when 1
types[0]
when 0
nil
else
TYPE_MIXED
end
end
end
def other_work_package(work_package)
from_id == work_package.id ? to : from
end
@ -282,13 +276,13 @@ class Relation < ActiveRecord::Base
def set_type_column
if relation_type_changed? && relation_type_was
was_column = self.class.relation_column(relation_type_was)
send("#{was_column}=", 0)
write_attribute was_column, 0
end
return unless relation_type
new_column = self.class.relation_column(relation_type)
send("#{new_column}=", 1)
send("#{new_column}=", 1) if new_column
end
# Reverses the relation if needed so that it gets stored in the proper way

@ -63,25 +63,25 @@ module Relation::HierarchyPaths
remove_hierarchy_path
elsif now_hierarchy_relation_or_former_id_changed?
add_hierarchy_path
elsif hierarchy_relatin_and_to_id_changed?
elsif hierarchy_relation_and_to_id_changed?
alter_hierarchy_path
end
end
def was_hierarchy_relation?
relation_type_changed? && relation_type_was == Relation::TYPE_HIERARCHY
saved_change_to_relation_type? && relation_type_before_last_save == Relation::TYPE_HIERARCHY
end
def now_hierarchy_relation_or_former_id_changed?
(relation_type_changed? || from_id_changed?) && hierarchy?
(saved_change_to_relation_type? || saved_change_to_from_id?) && hierarchy?
end
def hierarchy_relatin_and_to_id_changed?
hierarchy? && to_id_changed?
def hierarchy_relation_and_to_id_changed?
hierarchy? && saved_change_to_to_id?
end
def alter_hierarchy_path
self.class.execute_sql self.class.remove_hierarchy_path_sql(to_id_was)
self.class.execute_sql self.class.remove_hierarchy_path_sql(to_id_before_last_save)
self.class.execute_sql self.class.add_hierarchy_path_sql(to_id)
end

@ -33,7 +33,7 @@ class Version < ActiveRecord::Base
include Version::ProjectSharing
after_update :update_issues_from_sharing_change
after_update :update_issues_from_sharing_change, if: :saved_change_to_sharing?
belongs_to :project
has_many :fixed_issues, class_name: 'WorkPackage', foreign_key: 'fixed_version_id', dependent: :nullify
has_many :work_packages, foreign_key: :fixed_version_id
@ -228,12 +228,10 @@ class Version < ActiveRecord::Base
# Update the issue's fixed versions. Used if a version's sharing changes.
def update_issues_from_sharing_change
if sharing_changed?
if VERSION_SHARINGS.index(sharing_was).nil? ||
VERSION_SHARINGS.index(sharing).nil? ||
VERSION_SHARINGS.index(sharing_was) > VERSION_SHARINGS.index(sharing)
WorkPackage.update_versions_from_sharing_change self
end
if VERSION_SHARINGS.index(sharing_before_last_save).nil? ||
VERSION_SHARINGS.index(sharing).nil? ||
VERSION_SHARINGS.index(sharing_before_last_save) > VERSION_SHARINGS.index(sharing)
WorkPackage.update_versions_from_sharing_change self
end
end

@ -39,7 +39,7 @@ class WikiContent < ActiveRecord::Base
before_save :comments_to_journal_notes
after_create :send_content_added_mail
after_update :send_content_updated_mail
after_update :send_content_updated_mail, if: :saved_change_to_text?
acts_as_journalized
@ -94,8 +94,7 @@ class WikiContent < ActiveRecord::Base
end
def send_content_updated_mail
return unless text_changed? &&
Setting.notified_events.include?('wiki_content_updated')
return unless Setting.notified_events.include?('wiki_content_updated')
update_recipients.uniq.each do |user|
UserMailer.wiki_content_updated(user, self, User.current).deliver_now

@ -30,8 +30,11 @@
module WorkPackage::Parent
def self.prepended(base)
base.after_save :update_parent_relation
base.attribute 'parent_id', :integer
base.after_save :update_parent_relation, if: :saved_change_to_parent_id?
base.include Concerns::VirtualAttribute
base.virtual_attribute 'parent_id', cast_type: :integer
base.define_attribute_method 'parent'
end
@ -39,24 +42,15 @@ module WorkPackage::Parent
:do_halt
def parent=(work_package)
parent_id_will_change! if parent_id != (work_package && work_package.id)
@parent_set = true
id = work_package && work_package.id
if work_package
@parent_id = work_package.id
@parent_object = work_package
else
@parent_object = nil
@parent_id = nil
end
end
self.parent_id = id
def parent_will_change!
parent_id_will_change!
@parent_object = work_package
end
def parent
if @parent_set
if @parent_id_set
@parent_object || parent_from_id
else
@parent_object || parent_from_relation || parent_from_id
@ -65,44 +59,26 @@ module WorkPackage::Parent
def reload(*args)
@parent_object = nil
@parent_id = nil
@parent_set = nil
@parent_id_previous_changes = nil
super
end
def changes_applied
@parent_id_previous_changes = changes.slice(:parent_id)
super
end
def previous_changes
super.merge(@parent_id_previous_changes || {})
end
def parent_id=(id)
id = id.to_i > 0 ? id.to_i : nil
parent_id_will_change! if parent_id != id
@parent_set = true
super(id)
@parent_object = nil if @parent_object && @parent_object.id != id
@parent_id = id
@parent_id
end
def parent_id
return @parent_id if @parent_set
return @parent_id if @parent_id_set
@parent_id || parent && parent.id
end
private
def update_parent_relation
return unless changes[:parent_id]
if parent_relation
parent_relation.destroy
end
@ -114,8 +90,11 @@ module WorkPackage::Parent
end
end
private
def parent_from_relation
if parent_relation && ((@parent_id && parent_relation.from.id == @parent_id) || !@parent_id)
set_virtual_attribute_was('parent_id', parent_relation.from_id)
parent_relation.from
end
end
@ -123,6 +102,8 @@ module WorkPackage::Parent
def parent_from_id
if @parent_id
@parent_object = WorkPackage.find(@parent_id)
set_virtual_attribute_was('parent_id', @parent_id)
@parent_object
end
end
end

@ -29,7 +29,7 @@
# This file is used by Rack-based servers to start the application.
require ::File.expand_path('../config/environment', __FILE__)
require ::File.expand_path('../config/environment', __FILE__)
##
# Use the worker killer when Unicorn is being used

@ -33,7 +33,7 @@ if Rails.env.development?
api_reloader = ActiveSupport::FileUpdateChecker.new(api_files) do
Rails.application.reload_routes!
end
ActionDispatch::Callbacks.to_prepare do
ActiveSupport::Reloader.to_prepare do
api_reloader.execute_if_updated
end
end

@ -29,7 +29,7 @@
# This migration aggregates the migrations detailed in the @@migrations
# heredoc
class AggregatedMigrations < ActiveRecord::Migration[4.2]
class AggregatedMigrations < ActiveRecord::Migration[5.1]
class IncompleteMigrationsError < ::StandardError
end

@ -27,7 +27,7 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
class AddSummaryToProjects < ActiveRecord::Migration[4.2]
class AddSummaryToProjects < ActiveRecord::Migration[5.1]
def self.up
add_column :projects, :summary, :text
end

@ -27,7 +27,7 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
class AddDisplaySumsFieldToMigration < ActiveRecord::Migration[4.2]
class AddDisplaySumsFieldToMigration < ActiveRecord::Migration[5.1]
def self.up
add_column :queries, :display_sums, :boolean, null: true
end

@ -27,7 +27,7 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
class AddUserFirstLoggedInAndImpairedFields < ActiveRecord::Migration[4.2]
class AddUserFirstLoggedInAndImpairedFields < ActiveRecord::Migration[5.1]
def self.up
add_column :users, :first_login, :boolean, null: false, default: true
add_column :user_preferences, :impaired, :boolean, default: false

@ -28,7 +28,9 @@
#++
# store email header and footer localized (take Setting.default_language first, then english)
class LocalizeEmailHeaderAndFooter < ActiveRecord::Migration[4.2]
class LocalizeEmailHeaderAndFooter < ActiveRecord::Migration[5.1]
require 'globalize'
def self.up
emails_header = Setting.find_by name: 'emails_header'
emails_footer = Setting.find_by name: 'emails_footer'

@ -27,7 +27,7 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
class AddCustomFieldTranslationTable < ActiveRecord::Migration[4.2]
class AddCustomFieldTranslationTable < ActiveRecord::Migration[5.1]
class OldCustomField < ActiveRecord::Base
self.table_name = :custom_fields
self.inheritance_column = nil

@ -27,7 +27,7 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
class CreateDelayedJobs < ActiveRecord::Migration[4.2]
class CreateDelayedJobs < ActiveRecord::Migration[5.1]
def self.up
create_table :delayed_jobs, force: true do |table|
table.integer :priority, default: 0 # Allows some jobs to jump to the front of the queue

@ -27,7 +27,7 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
class UseTheFullStiClassNamesForRepositories < ActiveRecord::Migration[4.2]
class UseTheFullStiClassNamesForRepositories < ActiveRecord::Migration[5.1]
def self.up
concatenation = "('Repository::' || type)"

@ -27,7 +27,7 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
class CreateWikiMenuItems < ActiveRecord::Migration[4.2]
class CreateWikiMenuItems < ActiveRecord::Migration[5.1]
def self.up
create_table :wiki_menu_items do |t|
t.column :name, :string

@ -27,7 +27,7 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
class RenameAuthSourceLdap < ActiveRecord::Migration[4.2]
class RenameAuthSourceLdap < ActiveRecord::Migration[5.1]
def self.up
AuthSource.where(['type = ?', 'AuthSourceLdap']).update_all ['type = ?', 'LdapAuthSource']
end

@ -27,7 +27,7 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
class CreateWikiMenuItemForExistingWikis < ActiveRecord::Migration[4.2]
class CreateWikiMenuItemForExistingWikis < ActiveRecord::Migration[5.1]
class OldWikiMenuItem < ActiveRecord::Base
self.table_name = "wiki_menu_items"

@ -27,7 +27,7 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
class MakeGroupsUsersAModel < ActiveRecord::Migration[4.2]
class MakeGroupsUsersAModel < ActiveRecord::Migration[5.1]
def self.up
remove_index :groups_users, name: :groups_users_ids
rename_table :groups_users, :group_users

@ -27,11 +27,11 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
class AddWikiListAttachments < ActiveRecord::Migration[4.2]
class AddWikiListAttachments < ActiveRecord::Migration[5.1]
# model removed
class Role < ActiveRecord::Base; end
class AddViewWikiEditsPermission < ActiveRecord::Migration[4.2]
class AddViewWikiEditsPermission < ActiveRecord::Migration[5.1]
def self.up
Role.all.each do |r|
r.add_permission!(:list_attachments) if r.has_permission?(:view_wiki_pages) || r.has_permission?(:view_issues)

@ -27,7 +27,7 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
class RenameActsAsJournalizedChangesColumn < ActiveRecord::Migration[4.2]
class RenameActsAsJournalizedChangesColumn < ActiveRecord::Migration[5.1]
def self.up
# This is provided here for migrating up after the JournalDetails has been removed
unless Object.const_defined?('JournalDetails')

@ -27,7 +27,7 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
class AddMissingIndexesOnWikiMenuItems < ActiveRecord::Migration[4.2]
class AddMissingIndexesOnWikiMenuItems < ActiveRecord::Migration[5.1]
def self.up
add_index :wiki_menu_items, [:wiki_id, :title]
add_index :wiki_menu_items, :parent_id

@ -1,7 +1,7 @@
require Rails.root.join('db', 'migrate', 'migration_utils', 'migration_squasher').to_s
require 'open_project/plugins/migration_mapping'
# This migration aggregates the migrations detailed in the MIGRATION_FILES
class AggregatedAnnouncementsMigrations < ActiveRecord::Migration[4.2]
class AggregatedAnnouncementsMigrations < ActiveRecord::Migration[5.1]
MIGRATION_FILES = <<-MIGRATIONS
001_create_announcements.rb
20121114100640_index_on_announcements.rb

@ -27,7 +27,7 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
class AddIndexOnIdentifierToProjects < ActiveRecord::Migration[4.2]
class AddIndexOnIdentifierToProjects < ActiveRecord::Migration[5.1]
def self.up
add_index :projects, :identifier
end

@ -27,7 +27,7 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
class AddLongerLoginToUsers < ActiveRecord::Migration[4.2]
class AddLongerLoginToUsers < ActiveRecord::Migration[5.1]
def self.up
change_table :users do |t|
t.change 'login', :string, limit: 256, default: '', null: false

@ -27,7 +27,7 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
class RemoveGanttRelatedDataFromDatabase < ActiveRecord::Migration[4.2]
class RemoveGanttRelatedDataFromDatabase < ActiveRecord::Migration[5.1]
def up
EnabledModule.where(name: 'gantt').delete_all
end

@ -27,12 +27,10 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
class AddTimelinesProjectTypeIdToProjects < ActiveRecord::Migration[4.2]
class AddTimelinesProjectTypeIdToProjects < ActiveRecord::Migration[5.1]
def self.up
change_table(:projects) do |t|
t.belongs_to :timelines_project_type
t.index :timelines_project_type_id
end
rescue
raise "Error: Cannot migrate table 'projects'!"\

@ -27,7 +27,7 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
class CreateTimelinesProjectTypes < ActiveRecord::Migration[4.2]
class CreateTimelinesProjectTypes < ActiveRecord::Migration[5.1]
def self.up
create_table(:timelines_project_types) do |t|
t.column :name, :string, default: '', null: false

@ -27,7 +27,7 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
class CreateTimelinesPlanningElementTypes < ActiveRecord::Migration[4.2]
class CreateTimelinesPlanningElementTypes < ActiveRecord::Migration[5.1]
def self.up
create_table(:timelines_planning_element_types) do |t|
t.column :name, :string, null: false
@ -43,9 +43,6 @@ class CreateTimelinesPlanningElementTypes < ActiveRecord::Migration[4.2]
t.timestamps
end
add_index :timelines_planning_element_types, :color_id
add_index :timelines_planning_element_types, :project_type_id
end
def self.down

@ -27,7 +27,7 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
class CreateTimelinesPlanningElements < ActiveRecord::Migration[4.2]
class CreateTimelinesPlanningElements < ActiveRecord::Migration[5.1]
def self.up
create_table(:timelines_planning_elements) do |t|
t.column :name, :string, null: false
@ -45,12 +45,6 @@ class CreateTimelinesPlanningElements < ActiveRecord::Migration[4.2]
t.timestamps
end
add_index :timelines_planning_elements, :parent_id
add_index :timelines_planning_elements, :project_id
add_index :timelines_planning_elements, :responsible_id
add_index :timelines_planning_elements, :planning_element_type_id
add_index :timelines_planning_elements, :planning_element_status_id
end
def self.down

@ -27,7 +27,7 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
class CreateTimelinesScenarios < ActiveRecord::Migration[4.2]
class CreateTimelinesScenarios < ActiveRecord::Migration[5.1]
def self.up
create_table(:timelines_scenarios) do |t|
t.column :name, :string, null: false
@ -37,8 +37,6 @@ class CreateTimelinesScenarios < ActiveRecord::Migration[4.2]
t.timestamps
end
add_index :timelines_scenarios, :project_id
end
def self.down

@ -27,7 +27,7 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
class CreateTimelinesAlternateDates < ActiveRecord::Migration[4.2]
class CreateTimelinesAlternateDates < ActiveRecord::Migration[5.1]
def self.up
create_table(:timelines_alternate_dates) do |t|
t.column :start_date, :date, null: false
@ -38,8 +38,6 @@ class CreateTimelinesAlternateDates < ActiveRecord::Migration[4.2]
t.timestamps
end
add_index :timelines_alternate_dates, :planning_element_id
add_index :timelines_alternate_dates, :scenario_id
end
def self.down

@ -27,12 +27,10 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
class AddTimelinesResponsibleIdToProjects < ActiveRecord::Migration[4.2]
class AddTimelinesResponsibleIdToProjects < ActiveRecord::Migration[5.1]
def self.up
change_table(:projects) do |t|
t.belongs_to :timelines_responsible
t.index :timelines_responsible_id
end
end

@ -27,7 +27,7 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
class CreateTimelinesColors < ActiveRecord::Migration[4.2]
class CreateTimelinesColors < ActiveRecord::Migration[5.1]
def self.up
create_table(:timelines_colors) do |t|
t.column :name, :string, null: false

@ -27,7 +27,7 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
class CreateTimelinesReportings < ActiveRecord::Migration[4.2]
class CreateTimelinesReportings < ActiveRecord::Migration[5.1]
def self.up
create_table(:timelines_reportings) do |t|
t.column :reported_project_status_comment, :text
@ -38,9 +38,6 @@ class CreateTimelinesReportings < ActiveRecord::Migration[4.2]
t.timestamps
end
add_index :timelines_reportings, :project_id
add_index :timelines_reportings, :reporting_to_project_id
add_index :timelines_reportings, :reported_project_status_id
end
def self.down

@ -27,17 +27,14 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
class CreateTimelinesAvailableProjectStatuses < ActiveRecord::Migration[4.2]
class CreateTimelinesAvailableProjectStatuses < ActiveRecord::Migration[5.1]
def self.up
create_table(:timelines_available_project_statuses) do |t|
t.belongs_to :project_type
t.belongs_to :reported_project_status
t.belongs_to :reported_project_status, index: { name: 'index_avail_project_statuses_on_rep_project_status_id' }
t.timestamps
end
add_index :timelines_available_project_statuses, :project_type_id
add_index :timelines_available_project_statuses, :reported_project_status_id, name: 'index_avail_project_statuses_on_rep_project_status_id'
end
def self.down

@ -27,7 +27,7 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
class CreateTimelinesProjectAssociations < ActiveRecord::Migration[4.2]
class CreateTimelinesProjectAssociations < ActiveRecord::Migration[5.1]
def self.up
create_table(:timelines_project_associations) do |t|
t.belongs_to :project_a
@ -37,9 +37,6 @@ class CreateTimelinesProjectAssociations < ActiveRecord::Migration[4.2]
t.timestamps
end
add_index :timelines_project_associations, :project_a_id
add_index :timelines_project_associations, :project_b_id
end
def self.down

@ -27,17 +27,14 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
class CreateTimelinesEnabledPlanningElementTypes < ActiveRecord::Migration[4.2]
class CreateTimelinesEnabledPlanningElementTypes < ActiveRecord::Migration[5.1]
def self.up
create_table :timelines_enabled_planning_element_types do |t|
t.belongs_to :project
t.belongs_to :planning_element_type
t.belongs_to :planning_element_type, index: { name: 'index_enabled_pe_types_on_pe_type_id' }
t.timestamps
end
add_index :timelines_enabled_planning_element_types, :project_id
add_index :timelines_enabled_planning_element_types, :planning_element_type_id, name: 'index_enabled_pe_types_on_pe_type_id'
end
def self.down

@ -27,17 +27,14 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
class CreateTimelinesDefaultPlanningElementTypes < ActiveRecord::Migration[4.2]
class CreateTimelinesDefaultPlanningElementTypes < ActiveRecord::Migration[5.1]
def self.up
create_table :timelines_default_planning_element_types do |t|
t.belongs_to :project_type
t.belongs_to :planning_element_type
t.belongs_to :project_type, index: { name: 'index_default_pe_types_on_project_type_id' }
t.belongs_to :planning_element_type, index: { name: 'index_default_pe_types_on_pe_type_id' }
t.timestamps
end
add_index :timelines_default_planning_element_types, :project_type_id, name: 'index_default_pe_types_on_project_type_id'
add_index :timelines_default_planning_element_types, :planning_element_type_id, name: 'index_default_pe_types_on_pe_type_id'
end
def self.down

@ -27,7 +27,7 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
class MigratePlanningElementTypeToProjectAssociation < ActiveRecord::Migration[4.2]
class MigratePlanningElementTypeToProjectAssociation < ActiveRecord::Migration[5.1]
{
DefaultPlanningElementType: 'timelines_default_planning_element_types',
EnabledPlanningElementType: 'timelines_enabled_planning_element_types',

@ -27,7 +27,7 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
class RemoveProjectTypeIdFromTimelinesPlanningElementTypes < ActiveRecord::Migration[4.2]
class RemoveProjectTypeIdFromTimelinesPlanningElementTypes < ActiveRecord::Migration[5.1]
def self.up
change_table(:timelines_planning_element_types) do |t|
t.remove :project_type_id

@ -27,7 +27,7 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
class CreateTimelinesTimelines < ActiveRecord::Migration[4.2]
class CreateTimelinesTimelines < ActiveRecord::Migration[5.1]
def self.up
create_table :timelines_timelines do |t|
t.column :name, :string, null: false
@ -37,8 +37,6 @@ class CreateTimelinesTimelines < ActiveRecord::Migration[4.2]
t.timestamps
end
add_index :timelines_timelines, :project_id
end
def self.down

@ -27,7 +27,7 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
class AddOptionsToTimelinesTimelines < ActiveRecord::Migration[4.2]
class AddOptionsToTimelinesTimelines < ActiveRecord::Migration[5.1]
def self.up
change_table(:timelines_timelines) do |t|
t.text :options

@ -27,7 +27,7 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
class RemoveContentFromTimelinesTimelines < ActiveRecord::Migration[4.2]
class RemoveContentFromTimelinesTimelines < ActiveRecord::Migration[5.1]
def self.up
change_table(:timelines_timelines) do |t|
t.remove :content

@ -27,7 +27,7 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
class AddIndexesToTimelinesAlternateDatesToSecureAtScope < ActiveRecord::Migration[4.2]
class AddIndexesToTimelinesAlternateDatesToSecureAtScope < ActiveRecord::Migration[5.1]
def self.up
add_index :timelines_alternate_dates,
[:updated_at, :planning_element_id, :scenario_id],

@ -27,7 +27,7 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
class AddDeletedAtToTimelinesPlanningElements < ActiveRecord::Migration[4.2]
class AddDeletedAtToTimelinesPlanningElements < ActiveRecord::Migration[5.1]
def self.up
add_column :timelines_planning_elements, :deleted_at, :datetime
end

@ -27,7 +27,7 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
class AllowNullPositionInColors < ActiveRecord::Migration[4.2]
class AllowNullPositionInColors < ActiveRecord::Migration[5.1]
def self.up
change_column :timelines_colors, :position, :integer, default: 1, null: true
end

@ -27,7 +27,7 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
class AllowNullPositionInPlanningElementTypes < ActiveRecord::Migration[4.2]
class AllowNullPositionInPlanningElementTypes < ActiveRecord::Migration[5.1]
def self.up
change_column :timelines_planning_element_types, :position, :integer, default: 1, null: true
end

@ -27,7 +27,7 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
class AllowNullPositionInProjectTypes < ActiveRecord::Migration[4.2]
class AllowNullPositionInProjectTypes < ActiveRecord::Migration[5.1]
def self.up
change_column :timelines_project_types, :position, :integer, default: 1, null: true
end

@ -27,7 +27,7 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
class RemoveTimelinesNamespace < ActiveRecord::Migration[4.2]
class RemoveTimelinesNamespace < ActiveRecord::Migration[5.1]
def self.up
# rename all tables.
# this changes everything. again.

@ -29,7 +29,7 @@
require_relative 'migration_utils/legacy_yamler'
class MigrateSerializedYamlFromSyckToPsych < ActiveRecord::Migration[4.2]
class MigrateSerializedYamlFromSyckToPsych < ActiveRecord::Migration[5.1]
include Migration::LegacyYamler
def up

@ -27,7 +27,7 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
class AddForcePasswordChangeToUser < ActiveRecord::Migration[4.2]
class AddForcePasswordChangeToUser < ActiveRecord::Migration[5.1]
def change
add_column :users, :force_password_change, :boolean, default: false
User.reset_column_information

@ -27,7 +27,7 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
class CreateUserPasswords < ActiveRecord::Migration[4.2]
class CreateUserPasswords < ActiveRecord::Migration[5.1]
def initialize(*)
super
@former_passwords_table_exists = ActiveRecord::Base.connection.tables.include? 'former_user_passwords'

@ -27,7 +27,7 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
class CreateWorkPackages < ActiveRecord::Migration[4.2]
class CreateWorkPackages < ActiveRecord::Migration[5.1]
def up
create_table 'work_packages' do |t|
# Issue
@ -77,20 +77,11 @@ class CreateWorkPackages < ActiveRecord::Migration[4.2]
t.change :project_id, :integer, default: 0, null: false
end
# Planning Elements
add_index :work_packages, :parent_id
add_index :work_packages, :project_id
add_index :work_packages, :responsible_id
add_index :work_packages, :planning_element_type_id
add_index :work_packages, :planning_element_status_id
# Nested Set
add_index :work_packages, [:root_id, :lft, :rgt]
change_table(:projects) do |t|
t.belongs_to :work_packages_responsible
t.index :work_packages_responsible_id
end
# Time Entry

@ -27,7 +27,7 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
class WorkPackageCustomFieldDataMigration < ActiveRecord::Migration[4.2]
class WorkPackageCustomFieldDataMigration < ActiveRecord::Migration[5.1]
def self.up
set_custom_fields_type('IssueCustomField', 'WorkPackageCustomField')
set_custom_values_type('Issue', 'WorkPackage')

@ -27,7 +27,7 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
class AddFailedLoginCountLastFailedLoginOnToUser < ActiveRecord::Migration[4.2]
class AddFailedLoginCountLastFailedLoginOnToUser < ActiveRecord::Migration[5.1]
def change
begin
add_column :users, :failed_login_count, :integer, default: 0

@ -27,7 +27,7 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
class RenameEndDateOnAlternateDates < ActiveRecord::Migration[4.2]
class RenameEndDateOnAlternateDates < ActiveRecord::Migration[5.1]
def change
rename_column :alternate_dates, :end_date, :due_date
end

@ -27,7 +27,7 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
class RemoveEndDateFromWorkPackages < ActiveRecord::Migration[4.2]
class RemoveEndDateFromWorkPackages < ActiveRecord::Migration[5.1]
def up
# This operation is destructive. The end dates of work packages will
# be removed, updating due dates to the end date where due dates

@ -27,7 +27,7 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
class RenameChangesetWpJoinTable < ActiveRecord::Migration[4.2]
class RenameChangesetWpJoinTable < ActiveRecord::Migration[5.1]
def up
remove_index :changesets_issues, name: :changesets_issues_ids

@ -27,7 +27,7 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
class RenameTrackersToTypes < ActiveRecord::Migration[4.2]
class RenameTrackersToTypes < ActiveRecord::Migration[5.1]
# This migration leaves legacy issues as they are. After this
# migration, those legacy issues have tracker_id columns as well as
# having indexes that mention both tracker and issue, since there was

@ -27,7 +27,7 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
class RenameWorkPackageStiColumn < ActiveRecord::Migration[4.2]
class RenameWorkPackageStiColumn < ActiveRecord::Migration[5.1]
def up
rename_column :work_packages, :type, :sti_type
end

@ -27,7 +27,7 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
class AddActivityModule < ActiveRecord::Migration[4.2]
class AddActivityModule < ActiveRecord::Migration[5.1]
def up
# activate activity module for all projects
Project.all.each do |project|

@ -27,7 +27,7 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
class IncreaseJournalsChangedDataLimit < ActiveRecord::Migration[4.2]
class IncreaseJournalsChangedDataLimit < ActiveRecord::Migration[5.1]
def up
# fixes the inconsistency introduced in
# 20091227112908_change_wiki_contents_text_limit.rb, which

@ -27,7 +27,7 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
class AddPlanningElementTypePropertiesToType < ActiveRecord::Migration[4.2]
class AddPlanningElementTypePropertiesToType < ActiveRecord::Migration[5.1]
def up
add_column :types, :in_aggregation, :boolean, default: true, null: false
add_column :types, :is_milestone, :boolean, default: false, null: false

@ -27,7 +27,7 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
class MovePlanningElementTypesToLegacyPlanningElementTypes < ActiveRecord::Migration[4.2]
class MovePlanningElementTypesToLegacyPlanningElementTypes < ActiveRecord::Migration[5.1]
def up
rename_table :default_planning_element_types, :legacy_default_planning_element_types
rename_table :enabled_planning_element_types, :legacy_enabled_planning_element_types

@ -27,7 +27,7 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
class AddStandardColumnToTypeTable < ActiveRecord::Migration[4.2]
class AddStandardColumnToTypeTable < ActiveRecord::Migration[5.1]
def change
add_column :types, :is_standard, :boolean, null: false, default: false
end

@ -27,7 +27,7 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
class MoveJournalsToLegacyJournals < ActiveRecord::Migration[4.2]
class MoveJournalsToLegacyJournals < ActiveRecord::Migration[5.1]
def up
rename_table :journals, :legacy_journals
end

@ -27,7 +27,7 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
class CreateNormalizedJournals < ActiveRecord::Migration[4.2]
class CreateNormalizedJournals < ActiveRecord::Migration[5.1]
def change
create_table :journals do |t|
t.references :journable, polymorphic: true

@ -27,7 +27,7 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
class CreateAttachmentJournals < ActiveRecord::Migration[4.2]
class CreateAttachmentJournals < ActiveRecord::Migration[5.1]
def change
create_table :attachment_journals do |t|
t.integer :journal_id, null: false

@ -27,7 +27,7 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
class ChangeAttachmentJournalsDescriptionLength < ActiveRecord::Migration[4.2]
class ChangeAttachmentJournalsDescriptionLength < ActiveRecord::Migration[5.1]
def change
change_column :attachment_journals,
:description,

@ -27,7 +27,7 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
class CreateWorkPackageJournals < ActiveRecord::Migration[4.2]
class CreateWorkPackageJournals < ActiveRecord::Migration[5.1]
def change
create_table :work_package_journals do |t|
t.integer :journal_id, null: false

@ -27,7 +27,7 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
class CreateMessageJournals < ActiveRecord::Migration[4.2]
class CreateMessageJournals < ActiveRecord::Migration[5.1]
def change
create_table :message_journals do |t|
t.integer :journal_id, null: false

@ -27,7 +27,7 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
class CreateNewsJournals < ActiveRecord::Migration[4.2]
class CreateNewsJournals < ActiveRecord::Migration[5.1]
def change
create_table :news_journals do |t|
t.integer :journal_id, null: false

@ -27,7 +27,7 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
class CreateWikiContentJournals < ActiveRecord::Migration[4.2]
class CreateWikiContentJournals < ActiveRecord::Migration[5.1]
def change
create_table :wiki_content_journals do |t|
t.integer :journal_id, null: false

@ -27,7 +27,7 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
class CreateTimeEntryJournals < ActiveRecord::Migration[4.2]
class CreateTimeEntryJournals < ActiveRecord::Migration[5.1]
def change
create_table :time_entry_journals do |t|
t.integer :journal_id, null: false

@ -27,7 +27,7 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
class CreateChangesetJournals < ActiveRecord::Migration[4.2]
class CreateChangesetJournals < ActiveRecord::Migration[5.1]
def change
create_table :changeset_journals do |t|
t.integer :journal_id, null: false

@ -27,7 +27,7 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
class RemoveFilesAttachedToProjectsAndVersions < ActiveRecord::Migration[4.2]
class RemoveFilesAttachedToProjectsAndVersions < ActiveRecord::Migration[5.1]
def up
if !skip? && Attachment.where(container_type: ['Version', 'Project']).any?
raise 'Error: There are still attachments attached to Versions or Projects!'\

@ -27,7 +27,7 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
class AddAttachableJournal < ActiveRecord::Migration[4.2]
class AddAttachableJournal < ActiveRecord::Migration[5.1]
def change
create_table :attachable_journals do |t|
t.integer :journal_id, null: false

@ -27,7 +27,7 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
class AddCustomizableJournal < ActiveRecord::Migration[4.2]
class AddCustomizableJournal < ActiveRecord::Migration[5.1]
def change
create_table :customizable_journals do |t|
t.integer :journal_id, null: false

@ -27,7 +27,7 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
class FixCustomizableJournalValueColumn < ActiveRecord::Migration[4.2]
class FixCustomizableJournalValueColumn < ActiveRecord::Migration[5.1]
def up
change_column :customizable_journals, :value, :text
end

@ -27,7 +27,7 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
class RemoveDocuments < ActiveRecord::Migration[4.2]
class RemoveDocuments < ActiveRecord::Migration[5.1]
def up
unless Redmine::Plugin.registered_plugins.include?(:openproject_documents)
if Document.any? || Attachment.where(container_type: ['Document']).any?

@ -27,7 +27,7 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
class RemoveAlternateDatesAndScenarios < ActiveRecord::Migration[4.2]
class RemoveAlternateDatesAndScenarios < ActiveRecord::Migration[5.1]
def up
drop_table(:alternate_dates)
drop_table(:scenarios)

@ -27,7 +27,7 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
class DropModelJournalsUpdatedOnColumn < ActiveRecord::Migration[4.2]
class DropModelJournalsUpdatedOnColumn < ActiveRecord::Migration[5.1]
def up
remove_column :work_package_journals, :updated_at
remove_column :wiki_content_journals, :updated_on

@ -29,7 +29,7 @@
require_relative 'migration_utils/utils'
class LegacyIssuesToWorkPackages < ActiveRecord::Migration[4.2]
class LegacyIssuesToWorkPackages < ActiveRecord::Migration[5.1]
include Migration::Utils
class ExistingWorkPackagesError < ::StandardError

@ -29,7 +29,7 @@
require_relative 'migration_utils/utils'
class PlanningElementTypesDataToTypes < ActiveRecord::Migration[4.2]
class PlanningElementTypesDataToTypes < ActiveRecord::Migration[5.1]
include Migration::Utils
def up

@ -31,7 +31,7 @@ require 'yaml'
require_relative 'migration_utils/queries'
class MigrateQueryTrackerReferencesToType < ActiveRecord::Migration[4.2]
class MigrateQueryTrackerReferencesToType < ActiveRecord::Migration[5.1]
include Migration::Utils
KEY = { 'tracker_id' => 'type_id', 'tracker' => 'type' }

@ -27,7 +27,7 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
class RemoveIsInChlogFromTypes < ActiveRecord::Migration[4.2]
class RemoveIsInChlogFromTypes < ActiveRecord::Migration[5.1]
def up
remove_column :types, :is_in_chlog
end

@ -29,7 +29,7 @@
require_relative 'migration_utils/utils'
class PlanningElementDataToWorkPackages < ActiveRecord::Migration[4.2]
class PlanningElementDataToWorkPackages < ActiveRecord::Migration[5.1]
include Migration::Utils
def up

@ -31,7 +31,7 @@ require 'yaml'
require_relative 'migration_utils/utils'
class MigrateUserRights < ActiveRecord::Migration[4.2]
class MigrateUserRights < ActiveRecord::Migration[5.1]
include Migration::Utils
COLUMN = 'permissions'

@ -29,7 +29,7 @@
require_relative 'migration_utils/utils'
class MigrateSettingsToWorkPackage < ActiveRecord::Migration[4.2]
class MigrateSettingsToWorkPackage < ActiveRecord::Migration[5.1]
include Migration::Utils
COLUMN = 'name'

@ -27,7 +27,7 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
class RenameIssueRelationsToRelations < ActiveRecord::Migration[4.2]
class RenameIssueRelationsToRelations < ActiveRecord::Migration[5.1]
def up
rename_table :issue_relations, :relations

@ -27,7 +27,7 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
class JournalIndices < ActiveRecord::Migration[4.2]
class JournalIndices < ActiveRecord::Migration[5.1]
def up
# remove existing indices on legacy_issues, if they still exist to avoid name-clashes with
# the real(tm) journals-table

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save