diff --git a/Gemfile b/Gemfile index 59e781830f..c0440f64c8 100644 --- a/Gemfile +++ b/Gemfile @@ -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 diff --git a/Gemfile.lock b/Gemfile.lock index e707961004..e1f7e23f27 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -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 diff --git a/app/contracts/relations/base_contract.rb b/app/contracts/relations/base_contract.rb index 144dfa4ba8..0f0b6480a4 100644 --- a/app/contracts/relations/base_contract.rb +++ b/app/contracts/relations/base_contract.rb @@ -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 diff --git a/app/models/concerns/virtual_attribute.rb b/app/models/concerns/virtual_attribute.rb new file mode 100644 index 0000000000..e5325095ff --- /dev/null +++ b/app/models/concerns/virtual_attribute.rb @@ -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 diff --git a/app/models/custom_action.rb b/app/models/custom_action.rb index e74f6b88b8..8d12b56780 100644 --- a/app/models/custom_action.rb +++ b/app/models/custom_action.rb @@ -38,6 +38,7 @@ class CustomAction < ActiveRecord::Base after_save :persist_conditions + attribute :conditions define_attribute_method 'conditions' acts_as_list diff --git a/app/models/journal.rb b/app/models/journal.rb index d3112de416..005d773a11 100644 --- a/app/models/journal.rb +++ b/app/models/journal.rb @@ -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 diff --git a/app/models/message.rb b/app/models/message.rb index 8a2d5ceba5..68b7d198d4 100644 --- a/app/models/message.rb +++ b/app/models/message.rb @@ -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 diff --git a/app/models/project/activity.rb b/app/models/project/activity.rb index d519af4f8f..3ae763c8f7 100644 --- a/app/models/project/activity.rb +++ b/app/models/project/activity.rb @@ -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 diff --git a/app/models/relation.rb b/app/models/relation.rb index 3aa91a6f64..009fb0b805 100644 --- a/app/models/relation.rb +++ b/app/models/relation.rb @@ -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 diff --git a/app/models/relation/hierarchy_paths.rb b/app/models/relation/hierarchy_paths.rb index 09d2195ce4..463c1ef58d 100644 --- a/app/models/relation/hierarchy_paths.rb +++ b/app/models/relation/hierarchy_paths.rb @@ -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 diff --git a/app/models/version.rb b/app/models/version.rb index 1f9e167f10..6b23b58ce4 100644 --- a/app/models/version.rb +++ b/app/models/version.rb @@ -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 diff --git a/app/models/wiki_content.rb b/app/models/wiki_content.rb index f12f87a671..312ef12886 100644 --- a/app/models/wiki_content.rb +++ b/app/models/wiki_content.rb @@ -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 diff --git a/app/models/work_package/parent.rb b/app/models/work_package/parent.rb index e0ac2ee5d9..dea7c62529 100644 --- a/app/models/work_package/parent.rb +++ b/app/models/work_package/parent.rb @@ -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 diff --git a/config.ru b/config.ru index 4befaf6fcb..78f6f6434b 100644 --- a/config.ru +++ b/config.ru @@ -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 diff --git a/config/initializers/reload_api.rb b/config/initializers/reload_api.rb index a079b30bf9..57955ffe3f 100644 --- a/config/initializers/reload_api.rb +++ b/config/initializers/reload_api.rb @@ -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 diff --git a/db/migrate/000_aggregated_migrations.rb b/db/migrate/000_aggregated_migrations.rb index 1c3b5df073..188115f5c5 100644 --- a/db/migrate/000_aggregated_migrations.rb +++ b/db/migrate/000_aggregated_migrations.rb @@ -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 diff --git a/db/migrate/20110211160100_add_summary_to_projects.rb b/db/migrate/20110211160100_add_summary_to_projects.rb index a2dcfbab06..89f9d4dee4 100644 --- a/db/migrate/20110211160100_add_summary_to_projects.rb +++ b/db/migrate/20110211160100_add_summary_to_projects.rb @@ -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 diff --git a/db/migrate/20110817142220_add_display_sums_field_to_migration.rb b/db/migrate/20110817142220_add_display_sums_field_to_migration.rb index f5640c3b21..a7c34ad3ae 100644 --- a/db/migrate/20110817142220_add_display_sums_field_to_migration.rb +++ b/db/migrate/20110817142220_add_display_sums_field_to_migration.rb @@ -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 diff --git a/db/migrate/20111114124552_add_user_first_logged_in_and_impaired_fields.rb b/db/migrate/20111114124552_add_user_first_logged_in_and_impaired_fields.rb index 7b99cf2075..c9458caa0e 100644 --- a/db/migrate/20111114124552_add_user_first_logged_in_and_impaired_fields.rb +++ b/db/migrate/20111114124552_add_user_first_logged_in_and_impaired_fields.rb @@ -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 diff --git a/db/migrate/20120319095930_localize_email_header_and_footer.rb b/db/migrate/20120319095930_localize_email_header_and_footer.rb index 7fb8bb331f..63e5bee502 100644 --- a/db/migrate/20120319095930_localize_email_header_and_footer.rb +++ b/db/migrate/20120319095930_localize_email_header_and_footer.rb @@ -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' diff --git a/db/migrate/20120319135006_add_custom_field_translation_table.rb b/db/migrate/20120319135006_add_custom_field_translation_table.rb index 325b176051..a73c5a19f0 100644 --- a/db/migrate/20120319135006_add_custom_field_translation_table.rb +++ b/db/migrate/20120319135006_add_custom_field_translation_table.rb @@ -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 diff --git a/db/migrate/20120529090411_create_delayed_jobs.rb b/db/migrate/20120529090411_create_delayed_jobs.rb index a664bac18d..f2e58cbe21 100644 --- a/db/migrate/20120529090411_create_delayed_jobs.rb +++ b/db/migrate/20120529090411_create_delayed_jobs.rb @@ -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 diff --git a/db/migrate/20120731091543_use_the_full_sti_class_names_for_repositories.rb b/db/migrate/20120731091543_use_the_full_sti_class_names_for_repositories.rb index 616cdc67f7..216fc685cf 100644 --- a/db/migrate/20120731091543_use_the_full_sti_class_names_for_repositories.rb +++ b/db/migrate/20120731091543_use_the_full_sti_class_names_for_repositories.rb @@ -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)" diff --git a/db/migrate/20120731135140_create_wiki_menu_items.rb b/db/migrate/20120731135140_create_wiki_menu_items.rb index ef0d97d5a0..c1149003d0 100644 --- a/db/migrate/20120731135140_create_wiki_menu_items.rb +++ b/db/migrate/20120731135140_create_wiki_menu_items.rb @@ -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 diff --git a/db/migrate/20120802152122_rename_auth_source_ldap.rb b/db/migrate/20120802152122_rename_auth_source_ldap.rb index cff5cbc471..a71831e192 100644 --- a/db/migrate/20120802152122_rename_auth_source_ldap.rb +++ b/db/migrate/20120802152122_rename_auth_source_ldap.rb @@ -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 diff --git a/db/migrate/20120809131659_create_wiki_menu_item_for_existing_wikis.rb b/db/migrate/20120809131659_create_wiki_menu_item_for_existing_wikis.rb index b96622b9f2..8ff879335c 100644 --- a/db/migrate/20120809131659_create_wiki_menu_item_for_existing_wikis.rb +++ b/db/migrate/20120809131659_create_wiki_menu_item_for_existing_wikis.rb @@ -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" diff --git a/db/migrate/20120828171423_make_groups_users_a_model.rb b/db/migrate/20120828171423_make_groups_users_a_model.rb index e42becf2dc..b54803265a 100644 --- a/db/migrate/20120828171423_make_groups_users_a_model.rb +++ b/db/migrate/20120828171423_make_groups_users_a_model.rb @@ -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 diff --git a/db/migrate/20121004054229_add_wiki_list_attachments.rb b/db/migrate/20121004054229_add_wiki_list_attachments.rb index 19ca5641dc..0ece1be654 100644 --- a/db/migrate/20121004054229_add_wiki_list_attachments.rb +++ b/db/migrate/20121004054229_add_wiki_list_attachments.rb @@ -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) diff --git a/db/migrate/20121030111651_rename_acts_as_journalized_changes_column.rb b/db/migrate/20121030111651_rename_acts_as_journalized_changes_column.rb index 9cf662f799..214bb26e08 100644 --- a/db/migrate/20121030111651_rename_acts_as_journalized_changes_column.rb +++ b/db/migrate/20121030111651_rename_acts_as_journalized_changes_column.rb @@ -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') diff --git a/db/migrate/20121101111303_add_missing_indexes_on_wiki_menu_items.rb b/db/migrate/20121101111303_add_missing_indexes_on_wiki_menu_items.rb index b379e00a81..5be964ec9a 100644 --- a/db/migrate/20121101111303_add_missing_indexes_on_wiki_menu_items.rb +++ b/db/migrate/20121101111303_add_missing_indexes_on_wiki_menu_items.rb @@ -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 diff --git a/db/migrate/20121114100641_aggregated_announcements_migrations.rb b/db/migrate/20121114100641_aggregated_announcements_migrations.rb index 6e1c0e00b2..2a0362da36 100644 --- a/db/migrate/20121114100641_aggregated_announcements_migrations.rb +++ b/db/migrate/20121114100641_aggregated_announcements_migrations.rb @@ -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 diff --git a/db/migrate/20130204140624_add_index_on_identifier_to_projects.rb b/db/migrate/20130204140624_add_index_on_identifier_to_projects.rb index 7341d9622b..b3091ef6f4 100644 --- a/db/migrate/20130204140624_add_index_on_identifier_to_projects.rb +++ b/db/migrate/20130204140624_add_index_on_identifier_to_projects.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 diff --git a/db/migrate/20130315124655_add_longer_login_to_users.rb b/db/migrate/20130315124655_add_longer_login_to_users.rb index 6e87e61a3e..2133dade0f 100644 --- a/db/migrate/20130315124655_add_longer_login_to_users.rb +++ b/db/migrate/20130315124655_add_longer_login_to_users.rb @@ -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 diff --git a/db/migrate/20130325165622_remove_gantt_related_data_from_database.rb b/db/migrate/20130325165622_remove_gantt_related_data_from_database.rb index dbfd5d060a..c3066673ef 100644 --- a/db/migrate/20130325165622_remove_gantt_related_data_from_database.rb +++ b/db/migrate/20130325165622_remove_gantt_related_data_from_database.rb @@ -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 diff --git a/db/migrate/20130409133700_add_timelines_project_type_id_to_projects.rb b/db/migrate/20130409133700_add_timelines_project_type_id_to_projects.rb index c9371ca605..789d803ec4 100644 --- a/db/migrate/20130409133700_add_timelines_project_type_id_to_projects.rb +++ b/db/migrate/20130409133700_add_timelines_project_type_id_to_projects.rb @@ -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'!"\ diff --git a/db/migrate/20130409133701_create_timelines_project_types.rb b/db/migrate/20130409133701_create_timelines_project_types.rb index 40112dc5f1..565263c21b 100644 --- a/db/migrate/20130409133701_create_timelines_project_types.rb +++ b/db/migrate/20130409133701_create_timelines_project_types.rb @@ -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 diff --git a/db/migrate/20130409133702_create_timelines_planning_element_types.rb b/db/migrate/20130409133702_create_timelines_planning_element_types.rb index e5f1ce6223..c6e7224fed 100644 --- a/db/migrate/20130409133702_create_timelines_planning_element_types.rb +++ b/db/migrate/20130409133702_create_timelines_planning_element_types.rb @@ -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 diff --git a/db/migrate/20130409133703_create_timelines_planning_elements.rb b/db/migrate/20130409133703_create_timelines_planning_elements.rb index 50c0349849..70860c5c6f 100644 --- a/db/migrate/20130409133703_create_timelines_planning_elements.rb +++ b/db/migrate/20130409133703_create_timelines_planning_elements.rb @@ -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 diff --git a/db/migrate/20130409133704_create_timelines_scenarios.rb b/db/migrate/20130409133704_create_timelines_scenarios.rb index 365ae11a37..f3a4feff85 100644 --- a/db/migrate/20130409133704_create_timelines_scenarios.rb +++ b/db/migrate/20130409133704_create_timelines_scenarios.rb @@ -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 diff --git a/db/migrate/20130409133705_create_timelines_alternate_dates.rb b/db/migrate/20130409133705_create_timelines_alternate_dates.rb index 000e0ca667..f1b85c9b84 100644 --- a/db/migrate/20130409133705_create_timelines_alternate_dates.rb +++ b/db/migrate/20130409133705_create_timelines_alternate_dates.rb @@ -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 diff --git a/db/migrate/20130409133706_add_timelines_responsible_id_to_projects.rb b/db/migrate/20130409133706_add_timelines_responsible_id_to_projects.rb index bcb10e7b42..097a1c23da 100644 --- a/db/migrate/20130409133706_add_timelines_responsible_id_to_projects.rb +++ b/db/migrate/20130409133706_add_timelines_responsible_id_to_projects.rb @@ -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 diff --git a/db/migrate/20130409133707_create_timelines_colors.rb b/db/migrate/20130409133707_create_timelines_colors.rb index 419a01a5c2..e666b2a322 100644 --- a/db/migrate/20130409133707_create_timelines_colors.rb +++ b/db/migrate/20130409133707_create_timelines_colors.rb @@ -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 diff --git a/db/migrate/20130409133708_create_timelines_reportings.rb b/db/migrate/20130409133708_create_timelines_reportings.rb index 06ad214513..79e3fe8735 100644 --- a/db/migrate/20130409133708_create_timelines_reportings.rb +++ b/db/migrate/20130409133708_create_timelines_reportings.rb @@ -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 diff --git a/db/migrate/20130409133709_create_timelines_available_project_statuses.rb b/db/migrate/20130409133709_create_timelines_available_project_statuses.rb index e793d80fda..11ad3b7d31 100644 --- a/db/migrate/20130409133709_create_timelines_available_project_statuses.rb +++ b/db/migrate/20130409133709_create_timelines_available_project_statuses.rb @@ -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 diff --git a/db/migrate/20130409133710_create_timelines_project_associations.rb b/db/migrate/20130409133710_create_timelines_project_associations.rb index 3b9203b5ad..b59d1c1083 100644 --- a/db/migrate/20130409133710_create_timelines_project_associations.rb +++ b/db/migrate/20130409133710_create_timelines_project_associations.rb @@ -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 diff --git a/db/migrate/20130409133711_create_timelines_enabled_planning_element_types.rb b/db/migrate/20130409133711_create_timelines_enabled_planning_element_types.rb index 342ce1ad47..0ad0f13e2e 100644 --- a/db/migrate/20130409133711_create_timelines_enabled_planning_element_types.rb +++ b/db/migrate/20130409133711_create_timelines_enabled_planning_element_types.rb @@ -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 diff --git a/db/migrate/20130409133712_create_timelines_default_planning_element_types.rb b/db/migrate/20130409133712_create_timelines_default_planning_element_types.rb index 881569abf9..506b5a0c8f 100644 --- a/db/migrate/20130409133712_create_timelines_default_planning_element_types.rb +++ b/db/migrate/20130409133712_create_timelines_default_planning_element_types.rb @@ -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 diff --git a/db/migrate/20130409133713_migrate_planning_element_type_to_project_association.rb b/db/migrate/20130409133713_migrate_planning_element_type_to_project_association.rb index 0addae3fba..87e68a0164 100644 --- a/db/migrate/20130409133713_migrate_planning_element_type_to_project_association.rb +++ b/db/migrate/20130409133713_migrate_planning_element_type_to_project_association.rb @@ -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', diff --git a/db/migrate/20130409133714_remove_project_type_id_from_timelines_planning_element_types.rb b/db/migrate/20130409133714_remove_project_type_id_from_timelines_planning_element_types.rb index 41bfaa93f9..0cd4e562fa 100644 --- a/db/migrate/20130409133714_remove_project_type_id_from_timelines_planning_element_types.rb +++ b/db/migrate/20130409133714_remove_project_type_id_from_timelines_planning_element_types.rb @@ -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 diff --git a/db/migrate/20130409133715_create_timelines_timelines.rb b/db/migrate/20130409133715_create_timelines_timelines.rb index 761c27ab6a..bf2935b8f9 100644 --- a/db/migrate/20130409133715_create_timelines_timelines.rb +++ b/db/migrate/20130409133715_create_timelines_timelines.rb @@ -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 diff --git a/db/migrate/20130409133717_add_options_to_timelines_timelines.rb b/db/migrate/20130409133717_add_options_to_timelines_timelines.rb index 95c93201c2..dedf12f911 100644 --- a/db/migrate/20130409133717_add_options_to_timelines_timelines.rb +++ b/db/migrate/20130409133717_add_options_to_timelines_timelines.rb @@ -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 diff --git a/db/migrate/20130409133718_remove_content_from_timelines_timelines.rb b/db/migrate/20130409133718_remove_content_from_timelines_timelines.rb index 46ddadcdf0..751b3b86f3 100644 --- a/db/migrate/20130409133718_remove_content_from_timelines_timelines.rb +++ b/db/migrate/20130409133718_remove_content_from_timelines_timelines.rb @@ -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 diff --git a/db/migrate/20130409133719_add_indexes_to_timelines_alternate_dates_to_secure_at_scope.rb b/db/migrate/20130409133719_add_indexes_to_timelines_alternate_dates_to_secure_at_scope.rb index 7dc7e0db4b..1bea07a325 100644 --- a/db/migrate/20130409133719_add_indexes_to_timelines_alternate_dates_to_secure_at_scope.rb +++ b/db/migrate/20130409133719_add_indexes_to_timelines_alternate_dates_to_secure_at_scope.rb @@ -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], diff --git a/db/migrate/20130409133720_add_deleted_at_to_timelines_planning_elements.rb b/db/migrate/20130409133720_add_deleted_at_to_timelines_planning_elements.rb index 80a3bf796a..36c2e5259c 100644 --- a/db/migrate/20130409133720_add_deleted_at_to_timelines_planning_elements.rb +++ b/db/migrate/20130409133720_add_deleted_at_to_timelines_planning_elements.rb @@ -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 diff --git a/db/migrate/20130409133721_allow_null_position_in_colors.rb b/db/migrate/20130409133721_allow_null_position_in_colors.rb index 4149ccce74..16c197edfb 100644 --- a/db/migrate/20130409133721_allow_null_position_in_colors.rb +++ b/db/migrate/20130409133721_allow_null_position_in_colors.rb @@ -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 diff --git a/db/migrate/20130409133722_allow_null_position_in_planning_element_types.rb b/db/migrate/20130409133722_allow_null_position_in_planning_element_types.rb index 3e0368a95c..17f82cc663 100644 --- a/db/migrate/20130409133722_allow_null_position_in_planning_element_types.rb +++ b/db/migrate/20130409133722_allow_null_position_in_planning_element_types.rb @@ -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 diff --git a/db/migrate/20130409133723_allow_null_position_in_project_types.rb b/db/migrate/20130409133723_allow_null_position_in_project_types.rb index 13fef200af..6fa9a05c97 100644 --- a/db/migrate/20130409133723_allow_null_position_in_project_types.rb +++ b/db/migrate/20130409133723_allow_null_position_in_project_types.rb @@ -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 diff --git a/db/migrate/20130611154020_remove_timelines_namespace.rb b/db/migrate/20130611154020_remove_timelines_namespace.rb index bb1533e115..7eedca1b74 100644 --- a/db/migrate/20130611154020_remove_timelines_namespace.rb +++ b/db/migrate/20130611154020_remove_timelines_namespace.rb @@ -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. diff --git a/db/migrate/20130612120042_migrate_serialized_yaml_from_syck_to_psych.rb b/db/migrate/20130612120042_migrate_serialized_yaml_from_syck_to_psych.rb index c23a8c572e..fc12c90ac9 100644 --- a/db/migrate/20130612120042_migrate_serialized_yaml_from_syck_to_psych.rb +++ b/db/migrate/20130612120042_migrate_serialized_yaml_from_syck_to_psych.rb @@ -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 diff --git a/db/migrate/20130613075253_add_force_password_change_to_user.rb b/db/migrate/20130613075253_add_force_password_change_to_user.rb index 8650574103..fdaccbf165 100644 --- a/db/migrate/20130613075253_add_force_password_change_to_user.rb +++ b/db/migrate/20130613075253_add_force_password_change_to_user.rb @@ -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 diff --git a/db/migrate/20130619081234_create_user_passwords.rb b/db/migrate/20130619081234_create_user_passwords.rb index 98ee5f8acc..a4e953f957 100644 --- a/db/migrate/20130619081234_create_user_passwords.rb +++ b/db/migrate/20130619081234_create_user_passwords.rb @@ -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' diff --git a/db/migrate/20130620082322_create_work_packages.rb b/db/migrate/20130620082322_create_work_packages.rb index 6c3c7882b4..aab10579a1 100644 --- a/db/migrate/20130620082322_create_work_packages.rb +++ b/db/migrate/20130620082322_create_work_packages.rb @@ -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 diff --git a/db/migrate/20130625124242_work_package_custom_field_data_migration.rb b/db/migrate/20130625124242_work_package_custom_field_data_migration.rb index 6928375a14..d846f6b4ee 100644 --- a/db/migrate/20130625124242_work_package_custom_field_data_migration.rb +++ b/db/migrate/20130625124242_work_package_custom_field_data_migration.rb @@ -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') diff --git a/db/migrate/20130628092725_add_failed_login_count_last_failed_login_on_to_user.rb b/db/migrate/20130628092725_add_failed_login_count_last_failed_login_on_to_user.rb index 11c28c75fd..c3c6d4931b 100644 --- a/db/migrate/20130628092725_add_failed_login_count_last_failed_login_on_to_user.rb +++ b/db/migrate/20130628092725_add_failed_login_count_last_failed_login_on_to_user.rb @@ -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 diff --git a/db/migrate/20130709084751_rename_end_date_on_alternate_dates.rb b/db/migrate/20130709084751_rename_end_date_on_alternate_dates.rb index 90ea9eb166..b6d495a1e0 100644 --- a/db/migrate/20130709084751_rename_end_date_on_alternate_dates.rb +++ b/db/migrate/20130709084751_rename_end_date_on_alternate_dates.rb @@ -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 diff --git a/db/migrate/20130710145350_remove_end_date_from_work_packages.rb b/db/migrate/20130710145350_remove_end_date_from_work_packages.rb index 231ecced3c..598080f227 100644 --- a/db/migrate/20130710145350_remove_end_date_from_work_packages.rb +++ b/db/migrate/20130710145350_remove_end_date_from_work_packages.rb @@ -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 diff --git a/db/migrate/20130717134318_rename_changeset_wp_join_table.rb b/db/migrate/20130717134318_rename_changeset_wp_join_table.rb index 01ca8f8914..9368f3084d 100644 --- a/db/migrate/20130717134318_rename_changeset_wp_join_table.rb +++ b/db/migrate/20130717134318_rename_changeset_wp_join_table.rb @@ -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 diff --git a/db/migrate/20130719133922_rename_trackers_to_types.rb b/db/migrate/20130719133922_rename_trackers_to_types.rb index b8124c62bc..23f517183d 100644 --- a/db/migrate/20130719133922_rename_trackers_to_types.rb +++ b/db/migrate/20130719133922_rename_trackers_to_types.rb @@ -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 diff --git a/db/migrate/20130722154555_rename_work_package_sti_column.rb b/db/migrate/20130722154555_rename_work_package_sti_column.rb index 5189334a02..a451fecf92 100644 --- a/db/migrate/20130722154555_rename_work_package_sti_column.rb +++ b/db/migrate/20130722154555_rename_work_package_sti_column.rb @@ -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 diff --git a/db/migrate/20130723092240_add_activity_module.rb b/db/migrate/20130723092240_add_activity_module.rb index e26d889803..0714abb079 100644 --- a/db/migrate/20130723092240_add_activity_module.rb +++ b/db/migrate/20130723092240_add_activity_module.rb @@ -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| diff --git a/db/migrate/20130723134527_increase_journals_changed_data_limit.rb b/db/migrate/20130723134527_increase_journals_changed_data_limit.rb index 0fe4af61df..f74f2fefb4 100644 --- a/db/migrate/20130723134527_increase_journals_changed_data_limit.rb +++ b/db/migrate/20130723134527_increase_journals_changed_data_limit.rb @@ -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 diff --git a/db/migrate/20130724143418_add_planning_element_type_properties_to_type.rb b/db/migrate/20130724143418_add_planning_element_type_properties_to_type.rb index e9f86a6a55..16a1aa8d36 100644 --- a/db/migrate/20130724143418_add_planning_element_type_properties_to_type.rb +++ b/db/migrate/20130724143418_add_planning_element_type_properties_to_type.rb @@ -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 diff --git a/db/migrate/20130729114110_move_planning_element_types_to_legacy_planning_element_types.rb b/db/migrate/20130729114110_move_planning_element_types_to_legacy_planning_element_types.rb index 0cdb2d2f6e..5227ce300c 100644 --- a/db/migrate/20130729114110_move_planning_element_types_to_legacy_planning_element_types.rb +++ b/db/migrate/20130729114110_move_planning_element_types_to_legacy_planning_element_types.rb @@ -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 diff --git a/db/migrate/20130806075000_add_standard_column_to_type_table.rb b/db/migrate/20130806075000_add_standard_column_to_type_table.rb index 6a32ae9627..f6dc0efa9a 100644 --- a/db/migrate/20130806075000_add_standard_column_to_type_table.rb +++ b/db/migrate/20130806075000_add_standard_column_to_type_table.rb @@ -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 diff --git a/db/migrate/20130807081927_move_journals_to_legacy_journals.rb b/db/migrate/20130807081927_move_journals_to_legacy_journals.rb index b7373136f3..1a6a14d44e 100644 --- a/db/migrate/20130807081927_move_journals_to_legacy_journals.rb +++ b/db/migrate/20130807081927_move_journals_to_legacy_journals.rb @@ -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 diff --git a/db/migrate/20130807082645_create_normalized_journals.rb b/db/migrate/20130807082645_create_normalized_journals.rb index 3d451009f4..682b7b9fb8 100644 --- a/db/migrate/20130807082645_create_normalized_journals.rb +++ b/db/migrate/20130807082645_create_normalized_journals.rb @@ -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 diff --git a/db/migrate/20130807083715_create_attachment_journals.rb b/db/migrate/20130807083715_create_attachment_journals.rb index d4af7607fa..5f356171ea 100644 --- a/db/migrate/20130807083715_create_attachment_journals.rb +++ b/db/migrate/20130807083715_create_attachment_journals.rb @@ -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 diff --git a/db/migrate/20130807083716_change_attachment_journals_description_length.rb b/db/migrate/20130807083716_change_attachment_journals_description_length.rb index 0a39235e1f..3b4be31ac4 100644 --- a/db/migrate/20130807083716_change_attachment_journals_description_length.rb +++ b/db/migrate/20130807083716_change_attachment_journals_description_length.rb @@ -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, diff --git a/db/migrate/20130807084417_create_work_package_journals.rb b/db/migrate/20130807084417_create_work_package_journals.rb index a03fc3bd27..197e0deca3 100644 --- a/db/migrate/20130807084417_create_work_package_journals.rb +++ b/db/migrate/20130807084417_create_work_package_journals.rb @@ -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 diff --git a/db/migrate/20130807084708_create_message_journals.rb b/db/migrate/20130807084708_create_message_journals.rb index 0611bfa628..079005c8a4 100644 --- a/db/migrate/20130807084708_create_message_journals.rb +++ b/db/migrate/20130807084708_create_message_journals.rb @@ -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 diff --git a/db/migrate/20130807085108_create_news_journals.rb b/db/migrate/20130807085108_create_news_journals.rb index 1035d2b0c6..f93ea2f3f5 100644 --- a/db/migrate/20130807085108_create_news_journals.rb +++ b/db/migrate/20130807085108_create_news_journals.rb @@ -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 diff --git a/db/migrate/20130807085245_create_wiki_content_journals.rb b/db/migrate/20130807085245_create_wiki_content_journals.rb index 962f62c90a..c7beca94be 100644 --- a/db/migrate/20130807085245_create_wiki_content_journals.rb +++ b/db/migrate/20130807085245_create_wiki_content_journals.rb @@ -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 diff --git a/db/migrate/20130807085430_create_time_entry_journals.rb b/db/migrate/20130807085430_create_time_entry_journals.rb index 96312b737a..4d0b528761 100644 --- a/db/migrate/20130807085430_create_time_entry_journals.rb +++ b/db/migrate/20130807085430_create_time_entry_journals.rb @@ -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 diff --git a/db/migrate/20130807085714_create_changeset_journals.rb b/db/migrate/20130807085714_create_changeset_journals.rb index 7e29bbc10b..46c2bfaaf8 100644 --- a/db/migrate/20130807085714_create_changeset_journals.rb +++ b/db/migrate/20130807085714_create_changeset_journals.rb @@ -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 diff --git a/db/migrate/20130807141542_remove_files_attached_to_projects_and_versions.rb b/db/migrate/20130807141542_remove_files_attached_to_projects_and_versions.rb index 073e87e096..9afa6b35c7 100644 --- a/db/migrate/20130807141542_remove_files_attached_to_projects_and_versions.rb +++ b/db/migrate/20130807141542_remove_files_attached_to_projects_and_versions.rb @@ -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!'\ diff --git a/db/migrate/20130813062401_add_attachable_journal.rb b/db/migrate/20130813062401_add_attachable_journal.rb index 3e0e60b038..e0f5c1bf04 100644 --- a/db/migrate/20130813062401_add_attachable_journal.rb +++ b/db/migrate/20130813062401_add_attachable_journal.rb @@ -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 diff --git a/db/migrate/20130813062513_add_customizable_journal.rb b/db/migrate/20130813062513_add_customizable_journal.rb index f4f8031ab3..7effeef35f 100644 --- a/db/migrate/20130813062513_add_customizable_journal.rb +++ b/db/migrate/20130813062513_add_customizable_journal.rb @@ -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 diff --git a/db/migrate/20130813062523_fix_customizable_journal_value_column.rb b/db/migrate/20130813062523_fix_customizable_journal_value_column.rb index 750e78036a..e292a9d2a9 100644 --- a/db/migrate/20130813062523_fix_customizable_journal_value_column.rb +++ b/db/migrate/20130813062523_fix_customizable_journal_value_column.rb @@ -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 diff --git a/db/migrate/20130814130142_remove_documents.rb b/db/migrate/20130814130142_remove_documents.rb index 9669e507c5..8224de3ace 100644 --- a/db/migrate/20130814130142_remove_documents.rb +++ b/db/migrate/20130814130142_remove_documents.rb @@ -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? diff --git a/db/migrate/20130828093647_remove_alternate_dates_and_scenarios.rb b/db/migrate/20130828093647_remove_alternate_dates_and_scenarios.rb index 55cdef4a19..0e56d8b650 100644 --- a/db/migrate/20130828093647_remove_alternate_dates_and_scenarios.rb +++ b/db/migrate/20130828093647_remove_alternate_dates_and_scenarios.rb @@ -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) diff --git a/db/migrate/20130829084747_drop_model_journals_updated_on_column.rb b/db/migrate/20130829084747_drop_model_journals_updated_on_column.rb index b13168e5a8..1b4bf4bd5c 100644 --- a/db/migrate/20130829084747_drop_model_journals_updated_on_column.rb +++ b/db/migrate/20130829084747_drop_model_journals_updated_on_column.rb @@ -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 diff --git a/db/migrate/20130916094339_legacy_issues_to_work_packages.rb b/db/migrate/20130916094339_legacy_issues_to_work_packages.rb index 3249ccffc4..5f955d6664 100644 --- a/db/migrate/20130916094339_legacy_issues_to_work_packages.rb +++ b/db/migrate/20130916094339_legacy_issues_to_work_packages.rb @@ -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 diff --git a/db/migrate/20130916123916_planning_element_types_data_to_types.rb b/db/migrate/20130916123916_planning_element_types_data_to_types.rb index 33944695d1..3f61122479 100644 --- a/db/migrate/20130916123916_planning_element_types_data_to_types.rb +++ b/db/migrate/20130916123916_planning_element_types_data_to_types.rb @@ -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 diff --git a/db/migrate/20130917101922_migrate_query_tracker_references_to_type.rb b/db/migrate/20130917101922_migrate_query_tracker_references_to_type.rb index d20860eb34..dda6a8b30b 100644 --- a/db/migrate/20130917101922_migrate_query_tracker_references_to_type.rb +++ b/db/migrate/20130917101922_migrate_query_tracker_references_to_type.rb @@ -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' } diff --git a/db/migrate/20130917122118_remove_is_in_chlog_from_types.rb b/db/migrate/20130917122118_remove_is_in_chlog_from_types.rb index 32091784bd..3e7a99bade 100644 --- a/db/migrate/20130917122118_remove_is_in_chlog_from_types.rb +++ b/db/migrate/20130917122118_remove_is_in_chlog_from_types.rb @@ -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 diff --git a/db/migrate/20130917131710_planning_element_data_to_work_packages.rb b/db/migrate/20130917131710_planning_element_data_to_work_packages.rb index 5fa64db0aa..75f8ef9cce 100644 --- a/db/migrate/20130917131710_planning_element_data_to_work_packages.rb +++ b/db/migrate/20130917131710_planning_element_data_to_work_packages.rb @@ -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 diff --git a/db/migrate/20130918111753_migrate_user_rights.rb b/db/migrate/20130918111753_migrate_user_rights.rb index e98b1387c6..f4bf6e5079 100644 --- a/db/migrate/20130918111753_migrate_user_rights.rb +++ b/db/migrate/20130918111753_migrate_user_rights.rb @@ -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' diff --git a/db/migrate/20130919105841_migrate_settings_to_work_package.rb b/db/migrate/20130919105841_migrate_settings_to_work_package.rb index c38e7ec0f0..e75a631a36 100644 --- a/db/migrate/20130919105841_migrate_settings_to_work_package.rb +++ b/db/migrate/20130919105841_migrate_settings_to_work_package.rb @@ -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' diff --git a/db/migrate/20130919145142_rename_issue_relations_to_relations.rb b/db/migrate/20130919145142_rename_issue_relations_to_relations.rb index 3bba587309..6ca96dcde3 100644 --- a/db/migrate/20130919145142_rename_issue_relations_to_relations.rb +++ b/db/migrate/20130919145142_rename_issue_relations_to_relations.rb @@ -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 diff --git a/db/migrate/20130920081120_journal_indices.rb b/db/migrate/20130920081120_journal_indices.rb index f66571d63a..8ca6630969 100644 --- a/db/migrate/20130920081120_journal_indices.rb +++ b/db/migrate/20130920081120_journal_indices.rb @@ -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 diff --git a/db/migrate/20130920081135_legacy_attachment_journal_data.rb b/db/migrate/20130920081135_legacy_attachment_journal_data.rb index d600d65535..72020a3d87 100644 --- a/db/migrate/20130920081135_legacy_attachment_journal_data.rb +++ b/db/migrate/20130920081135_legacy_attachment_journal_data.rb @@ -29,7 +29,7 @@ require_relative 'migration_utils/legacy_journal_migrator' -class LegacyAttachmentJournalData < ActiveRecord::Migration[4.2] +class LegacyAttachmentJournalData < ActiveRecord::Migration[5.1] def up add_index 'attachment_journals', ['journal_id'] diff --git a/db/migrate/20130920085055_legacy_changeset_journal_data.rb b/db/migrate/20130920085055_legacy_changeset_journal_data.rb index 731e471ebb..e99c528446 100644 --- a/db/migrate/20130920085055_legacy_changeset_journal_data.rb +++ b/db/migrate/20130920085055_legacy_changeset_journal_data.rb @@ -29,7 +29,7 @@ require_relative 'migration_utils/legacy_journal_migrator' -class LegacyChangesetJournalData < ActiveRecord::Migration[4.2] +class LegacyChangesetJournalData < ActiveRecord::Migration[5.1] def up add_index 'changeset_journals', ['journal_id'] diff --git a/db/migrate/20130920090201_legacy_news_journal_data.rb b/db/migrate/20130920090201_legacy_news_journal_data.rb index 12894708ea..29216a3220 100644 --- a/db/migrate/20130920090201_legacy_news_journal_data.rb +++ b/db/migrate/20130920090201_legacy_news_journal_data.rb @@ -29,7 +29,7 @@ require_relative 'migration_utils/legacy_journal_migrator' -class LegacyNewsJournalData < ActiveRecord::Migration[4.2] +class LegacyNewsJournalData < ActiveRecord::Migration[5.1] def up add_index 'news_journals', ['journal_id'] diff --git a/db/migrate/20130920090641_legacy_message_journal_data.rb b/db/migrate/20130920090641_legacy_message_journal_data.rb index 8ab6e1314d..c3c4055887 100644 --- a/db/migrate/20130920090641_legacy_message_journal_data.rb +++ b/db/migrate/20130920090641_legacy_message_journal_data.rb @@ -30,7 +30,7 @@ require_relative 'migration_utils/legacy_journal_migrator' require_relative 'migration_utils/journal_migrator_concerns' -class LegacyMessageJournalData < ActiveRecord::Migration[4.2] +class LegacyMessageJournalData < ActiveRecord::Migration[5.1] def up add_index 'message_journals', ['journal_id'] diff --git a/db/migrate/20130920092800_legacy_time_entry_journal_data.rb b/db/migrate/20130920092800_legacy_time_entry_journal_data.rb index 123501c907..7dea9c3889 100644 --- a/db/migrate/20130920092800_legacy_time_entry_journal_data.rb +++ b/db/migrate/20130920092800_legacy_time_entry_journal_data.rb @@ -30,7 +30,7 @@ require_relative 'migration_utils/legacy_journal_migrator' require_relative 'migration_utils/journal_migrator_concerns' -class LegacyTimeEntryJournalData < ActiveRecord::Migration[4.2] +class LegacyTimeEntryJournalData < ActiveRecord::Migration[5.1] def up add_index 'time_entry_journals', ['journal_id'] diff --git a/db/migrate/20130920093823_legacy_wiki_content_journal_data.rb b/db/migrate/20130920093823_legacy_wiki_content_journal_data.rb index b81bd90b6d..e7d9fe2beb 100644 --- a/db/migrate/20130920093823_legacy_wiki_content_journal_data.rb +++ b/db/migrate/20130920093823_legacy_wiki_content_journal_data.rb @@ -29,7 +29,7 @@ require_relative 'migration_utils/legacy_journal_migrator' -class LegacyWikiContentJournalData < ActiveRecord::Migration[4.2] +class LegacyWikiContentJournalData < ActiveRecord::Migration[5.1] class UnsupportedWikiContentJournalCompressionError < ::StandardError end diff --git a/db/migrate/20130920094524_legacy_issue_journal_data.rb b/db/migrate/20130920094524_legacy_issue_journal_data.rb index 1d33ed3a0f..a68ebb711b 100644 --- a/db/migrate/20130920094524_legacy_issue_journal_data.rb +++ b/db/migrate/20130920094524_legacy_issue_journal_data.rb @@ -31,7 +31,7 @@ require_relative 'migration_utils/utils' require_relative 'migration_utils/legacy_journal_migrator' require_relative 'migration_utils/journal_migrator_concerns' -class LegacyIssueJournalData < ActiveRecord::Migration[4.2] +class LegacyIssueJournalData < ActiveRecord::Migration[5.1] include Migration::Utils def up diff --git a/db/migrate/20130920095747_legacy_planning_element_journal_data.rb b/db/migrate/20130920095747_legacy_planning_element_journal_data.rb index aa336927f9..78b9c19bb2 100644 --- a/db/migrate/20130920095747_legacy_planning_element_journal_data.rb +++ b/db/migrate/20130920095747_legacy_planning_element_journal_data.rb @@ -30,7 +30,7 @@ require_relative 'migration_utils/legacy_journal_migrator' require_relative 'migration_utils/journal_migrator_concerns' -class LegacyPlanningElementJournalData < ActiveRecord::Migration[4.2] +class LegacyPlanningElementJournalData < ActiveRecord::Migration[5.1] include Migration::Utils class UnknownJournaledError < ::StandardError diff --git a/db/migrate/20130920142714_update_attachment_container.rb b/db/migrate/20130920142714_update_attachment_container.rb index b466679176..a931e07da6 100644 --- a/db/migrate/20130920142714_update_attachment_container.rb +++ b/db/migrate/20130920142714_update_attachment_container.rb @@ -29,7 +29,7 @@ require_relative 'migration_utils/utils' -class UpdateAttachmentContainer < ActiveRecord::Migration[4.2] +class UpdateAttachmentContainer < ActiveRecord::Migration[5.1] include Migration::Utils def up diff --git a/db/migrate/20130920150143_journal_activities_data.rb b/db/migrate/20130920150143_journal_activities_data.rb index 36c2bfba9a..8255d66e68 100644 --- a/db/migrate/20130920150143_journal_activities_data.rb +++ b/db/migrate/20130920150143_journal_activities_data.rb @@ -29,7 +29,7 @@ require_relative 'migration_utils/utils' -class JournalActivitiesData < ActiveRecord::Migration[4.2] +class JournalActivitiesData < ActiveRecord::Migration[5.1] include Migration::Utils def up diff --git a/db/migrate/20131001075217_rename_issue_category_to_category.rb b/db/migrate/20131001075217_rename_issue_category_to_category.rb index 739206cea5..2fb85334d1 100644 --- a/db/migrate/20131001075217_rename_issue_category_to_category.rb +++ b/db/migrate/20131001075217_rename_issue_category_to_category.rb @@ -27,7 +27,7 @@ # See docs/COPYRIGHT.rdoc for more details. #++ -class RenameIssueCategoryToCategory < ActiveRecord::Migration[4.2] +class RenameIssueCategoryToCategory < ActiveRecord::Migration[5.1] def change rename_table :issue_categories, :categories end diff --git a/db/migrate/20131001105659_rename_issue_statuses_to_statuses.rb b/db/migrate/20131001105659_rename_issue_statuses_to_statuses.rb index 43c74c5cf6..2b9397bef0 100644 --- a/db/migrate/20131001105659_rename_issue_statuses_to_statuses.rb +++ b/db/migrate/20131001105659_rename_issue_statuses_to_statuses.rb @@ -27,7 +27,7 @@ # See docs/COPYRIGHT.rdoc for more details. #++ -class RenameIssueStatusesToStatuses < ActiveRecord::Migration[4.2] +class RenameIssueStatusesToStatuses < ActiveRecord::Migration[5.1] def change rename_table :issue_statuses, :statuses end diff --git a/db/migrate/20131004141959_generalize_wiki_menu_items.rb b/db/migrate/20131004141959_generalize_wiki_menu_items.rb index 8a0ecc7176..001df1adbd 100644 --- a/db/migrate/20131004141959_generalize_wiki_menu_items.rb +++ b/db/migrate/20131004141959_generalize_wiki_menu_items.rb @@ -27,7 +27,7 @@ # See docs/COPYRIGHT.rdoc for more details. #++ -class GeneralizeWikiMenuItems < ActiveRecord::Migration[4.2] +class GeneralizeWikiMenuItems < ActiveRecord::Migration[5.1] def up rename_table :wiki_menu_items, :menu_items add_column :menu_items, :type, :string diff --git a/db/migrate/20131007062401_migrate_text_references_to_issues_and_planning_elements.rb b/db/migrate/20131007062401_migrate_text_references_to_issues_and_planning_elements.rb index 6e1250d2be..a851098b21 100644 --- a/db/migrate/20131007062401_migrate_text_references_to_issues_and_planning_elements.rb +++ b/db/migrate/20131007062401_migrate_text_references_to_issues_and_planning_elements.rb @@ -29,7 +29,7 @@ require_relative 'migration_utils/text_references' -class MigrateTextReferencesToIssuesAndPlanningElements < ActiveRecord::Migration[4.2] +class MigrateTextReferencesToIssuesAndPlanningElements < ActiveRecord::Migration[5.1] include Migration::Utils COLUMNS_PER_TABLE = { diff --git a/db/migrate/20131009083648_work_package_indices.rb b/db/migrate/20131009083648_work_package_indices.rb index 2a10c529de..67be3d28b5 100644 --- a/db/migrate/20131009083648_work_package_indices.rb +++ b/db/migrate/20131009083648_work_package_indices.rb @@ -27,7 +27,7 @@ # See docs/COPYRIGHT.rdoc for more details. #++ -class WorkPackageIndices < ActiveRecord::Migration[4.2] +class WorkPackageIndices < ActiveRecord::Migration[5.1] def up # drop obsolete fields remove_column :work_packages, :planning_element_status_comment diff --git a/db/migrate/20131015064141_migrate_timelines_end_date_property_in_options.rb b/db/migrate/20131015064141_migrate_timelines_end_date_property_in_options.rb index 7b4a52a73a..7e1dcfe846 100644 --- a/db/migrate/20131015064141_migrate_timelines_end_date_property_in_options.rb +++ b/db/migrate/20131015064141_migrate_timelines_end_date_property_in_options.rb @@ -29,7 +29,7 @@ require_relative 'migration_utils/timelines' -class MigrateTimelinesEndDatePropertyInOptions < ActiveRecord::Migration[4.2] +class MigrateTimelinesEndDatePropertyInOptions < ActiveRecord::Migration[5.1] include Migration::Utils COLUMN = 'options' diff --git a/db/migrate/20131015121430_index_on_users.rb b/db/migrate/20131015121430_index_on_users.rb index 84ea4f74db..d3927deb76 100644 --- a/db/migrate/20131015121430_index_on_users.rb +++ b/db/migrate/20131015121430_index_on_users.rb @@ -27,7 +27,7 @@ # See docs/COPYRIGHT.rdoc for more details. #++ -class IndexOnUsers < ActiveRecord::Migration[4.2] +class IndexOnUsers < ActiveRecord::Migration[5.1] def change add_index :users, [:type, :login], length: { type: 255, login: 255 } add_index :users, [:type, :status] diff --git a/db/migrate/20131016075650_add_queue_to_delayed_jobs.rb b/db/migrate/20131016075650_add_queue_to_delayed_jobs.rb index fffc480d2f..405510b4cc 100644 --- a/db/migrate/20131016075650_add_queue_to_delayed_jobs.rb +++ b/db/migrate/20131016075650_add_queue_to_delayed_jobs.rb @@ -27,7 +27,7 @@ # See docs/COPYRIGHT.rdoc for more details. #++ -class AddQueueToDelayedJobs < ActiveRecord::Migration[4.2] +class AddQueueToDelayedJobs < ActiveRecord::Migration[5.1] def self.up add_column :delayed_jobs, :queue, :string end diff --git a/db/migrate/20131017064039_repair_work_packages_initial_attachable_journal.rb b/db/migrate/20131017064039_repair_work_packages_initial_attachable_journal.rb index 23243950d0..4d818421e6 100644 --- a/db/migrate/20131017064039_repair_work_packages_initial_attachable_journal.rb +++ b/db/migrate/20131017064039_repair_work_packages_initial_attachable_journal.rb @@ -29,7 +29,7 @@ require_relative 'migration_utils/attachable_utils' -class RepairWorkPackagesInitialAttachableJournal < ActiveRecord::Migration[4.2] +class RepairWorkPackagesInitialAttachableJournal < ActiveRecord::Migration[5.1] include Migration::Utils include Migration::Utils::AttachableUtils diff --git a/db/migrate/20131018134525_repair_messages_initial_attachable_journal.rb b/db/migrate/20131018134525_repair_messages_initial_attachable_journal.rb index 80c030dce3..e36ccebf17 100644 --- a/db/migrate/20131018134525_repair_messages_initial_attachable_journal.rb +++ b/db/migrate/20131018134525_repair_messages_initial_attachable_journal.rb @@ -29,7 +29,7 @@ require_relative 'migration_utils/attachable_utils' -class RepairMessagesInitialAttachableJournal < ActiveRecord::Migration[4.2] +class RepairMessagesInitialAttachableJournal < ActiveRecord::Migration[5.1] include Migration::Utils include Migration::Utils::AttachableUtils diff --git a/db/migrate/20131018134530_repair_customizable_journals.rb b/db/migrate/20131018134530_repair_customizable_journals.rb index 863443c6f3..13458efa4f 100644 --- a/db/migrate/20131018134530_repair_customizable_journals.rb +++ b/db/migrate/20131018134530_repair_customizable_journals.rb @@ -29,7 +29,7 @@ require_relative 'migration_utils/customizable_utils' -class RepairCustomizableJournals < ActiveRecord::Migration[4.2] +class RepairCustomizableJournals < ActiveRecord::Migration[5.1] include Migration::Utils include Migration::Utils::CustomizableUtils diff --git a/db/migrate/20131018134545_add_missing_attachable_journals.rb b/db/migrate/20131018134545_add_missing_attachable_journals.rb index 8a1cfedce5..9408e3336d 100644 --- a/db/migrate/20131018134545_add_missing_attachable_journals.rb +++ b/db/migrate/20131018134545_add_missing_attachable_journals.rb @@ -29,7 +29,7 @@ require_relative 'migration_utils/attachable_utils' -class AddMissingAttachableJournals < ActiveRecord::Migration[4.2] +class AddMissingAttachableJournals < ActiveRecord::Migration[5.1] include Migration::Utils include Migration::Utils::AttachableUtils diff --git a/db/migrate/20131018134590_add_missing_customizable_journals.rb b/db/migrate/20131018134590_add_missing_customizable_journals.rb index 14404e9ea4..cc6e11fcd2 100644 --- a/db/migrate/20131018134590_add_missing_customizable_journals.rb +++ b/db/migrate/20131018134590_add_missing_customizable_journals.rb @@ -29,7 +29,7 @@ require_relative 'migration_utils/customizable_utils' -class AddMissingCustomizableJournals < ActiveRecord::Migration[4.2] +class AddMissingCustomizableJournals < ActiveRecord::Migration[5.1] include Migration::Utils include Migration::Utils::CustomizableUtils diff --git a/db/migrate/20131024115743_migrate_remaining_core_settings.rb b/db/migrate/20131024115743_migrate_remaining_core_settings.rb index 9b39624db6..34ee3fdcfe 100644 --- a/db/migrate/20131024115743_migrate_remaining_core_settings.rb +++ b/db/migrate/20131024115743_migrate_remaining_core_settings.rb @@ -27,7 +27,7 @@ # See docs/COPYRIGHT.rdoc for more details. #++ -class MigrateRemainingCoreSettings < ActiveRecord::Migration[4.2] +class MigrateRemainingCoreSettings < ActiveRecord::Migration[5.1] REPLACED = { 'tracker' => 'type', 'issue_status_updated' => 'status_updated', diff --git a/db/migrate/20131024140048_migrate_timelines_options.rb b/db/migrate/20131024140048_migrate_timelines_options.rb index f98d276ef3..2b9bafe024 100644 --- a/db/migrate/20131024140048_migrate_timelines_options.rb +++ b/db/migrate/20131024140048_migrate_timelines_options.rb @@ -29,7 +29,7 @@ require_relative 'migration_utils/timelines' -class MigrateTimelinesOptions < ActiveRecord::Migration[4.2] +class MigrateTimelinesOptions < ActiveRecord::Migration[5.1] include Migration::Utils COLUMN = 'options' diff --git a/db/migrate/20131031170857_fix_watcher_work_package_associations.rb b/db/migrate/20131031170857_fix_watcher_work_package_associations.rb index 048f8589ea..12c112eb25 100644 --- a/db/migrate/20131031170857_fix_watcher_work_package_associations.rb +++ b/db/migrate/20131031170857_fix_watcher_work_package_associations.rb @@ -27,7 +27,7 @@ # See docs/COPYRIGHT.rdoc for more details. #++ -class FixWatcherWorkPackageAssociations < ActiveRecord::Migration[4.2] +class FixWatcherWorkPackageAssociations < ActiveRecord::Migration[5.1] def up rename_watchable_type('Issue', 'WorkPackage') adapt_planning_element_ids diff --git a/db/migrate/20131101125921_migrate_default_values_in_work_package_journals.rb b/db/migrate/20131101125921_migrate_default_values_in_work_package_journals.rb index 51a08616b9..a8b18becfe 100644 --- a/db/migrate/20131101125921_migrate_default_values_in_work_package_journals.rb +++ b/db/migrate/20131101125921_migrate_default_values_in_work_package_journals.rb @@ -29,7 +29,7 @@ require_relative 'migration_utils/utils' -class MigrateDefaultValuesInWorkPackageJournals < ActiveRecord::Migration[4.2] +class MigrateDefaultValuesInWorkPackageJournals < ActiveRecord::Migration[5.1] include Migration::Utils def up diff --git a/db/migrate/20131108124300_add_index_to_all_the_journals.rb b/db/migrate/20131108124300_add_index_to_all_the_journals.rb index a827f414ba..f1fc4a4c5c 100644 --- a/db/migrate/20131108124300_add_index_to_all_the_journals.rb +++ b/db/migrate/20131108124300_add_index_to_all_the_journals.rb @@ -27,7 +27,7 @@ # See docs/COPYRIGHT.rdoc for more details. #++ -class AddIndexToAllTheJournals < ActiveRecord::Migration[4.2] +class AddIndexToAllTheJournals < ActiveRecord::Migration[5.1] def change # This now is only a no op. # diff --git a/db/migrate/20131114132911_migrate_planning_element_links_in_journal_notes.rb b/db/migrate/20131114132911_migrate_planning_element_links_in_journal_notes.rb index ca3c7522df..58536fb303 100644 --- a/db/migrate/20131114132911_migrate_planning_element_links_in_journal_notes.rb +++ b/db/migrate/20131114132911_migrate_planning_element_links_in_journal_notes.rb @@ -29,7 +29,7 @@ require_relative 'migration_utils/text_references' -class MigratePlanningElementLinksInJournalNotes < ActiveRecord::Migration[4.2] +class MigratePlanningElementLinksInJournalNotes < ActiveRecord::Migration[5.1] include Migration::Utils COLUMNS_PER_TABLE = { diff --git a/db/migrate/20131115155147_fix_parent_ids_in_work_package_journals_of_former_planning_elements.rb b/db/migrate/20131115155147_fix_parent_ids_in_work_package_journals_of_former_planning_elements.rb index 45eb14e213..235bb1bf4a 100644 --- a/db/migrate/20131115155147_fix_parent_ids_in_work_package_journals_of_former_planning_elements.rb +++ b/db/migrate/20131115155147_fix_parent_ids_in_work_package_journals_of_former_planning_elements.rb @@ -29,7 +29,7 @@ require_relative 'migration_utils/utils' -class FixParentIdsInWorkPackageJournalsOfFormerPlanningElements < ActiveRecord::Migration[4.2] +class FixParentIdsInWorkPackageJournalsOfFormerPlanningElements < ActiveRecord::Migration[5.1] include Migration::Utils def up diff --git a/db/migrate/20131126112911_migrate_update_create_column_reference_in_queries.rb b/db/migrate/20131126112911_migrate_update_create_column_reference_in_queries.rb index 5badc791ea..d2df1bc6de 100644 --- a/db/migrate/20131126112911_migrate_update_create_column_reference_in_queries.rb +++ b/db/migrate/20131126112911_migrate_update_create_column_reference_in_queries.rb @@ -31,7 +31,7 @@ require 'yaml' require_relative 'migration_utils/queries' -class MigrateUpdateCreateColumnReferenceInQueries < ActiveRecord::Migration[4.2] +class MigrateUpdateCreateColumnReferenceInQueries < ActiveRecord::Migration[5.1] include Migration::Utils KEY = { 'updated_on' => 'updated_at', 'created_on' => 'created_at' } diff --git a/db/migrate/20131202094511_delete_former_deleted_planning_elements.rb b/db/migrate/20131202094511_delete_former_deleted_planning_elements.rb index 42fca35000..34f8c5a5f4 100644 --- a/db/migrate/20131202094511_delete_former_deleted_planning_elements.rb +++ b/db/migrate/20131202094511_delete_former_deleted_planning_elements.rb @@ -29,7 +29,7 @@ require_relative 'migration_utils/utils' -class DeleteFormerDeletedPlanningElements < ActiveRecord::Migration[4.2] +class DeleteFormerDeletedPlanningElements < ActiveRecord::Migration[5.1] include Migration::Utils def up diff --git a/db/migrate/20131210113056_repair_invalid_default_work_package_custom_values.rb b/db/migrate/20131210113056_repair_invalid_default_work_package_custom_values.rb index c1580d2706..a20ce81258 100644 --- a/db/migrate/20131210113056_repair_invalid_default_work_package_custom_values.rb +++ b/db/migrate/20131210113056_repair_invalid_default_work_package_custom_values.rb @@ -27,7 +27,7 @@ # See docs/COPYRIGHT.rdoc for more details. #++ -class RepairInvalidDefaultWorkPackageCustomValues < ActiveRecord::Migration[4.2] +class RepairInvalidDefaultWorkPackageCustomValues < ActiveRecord::Migration[5.1] class CurrentCustomField < ActiveRecord::Base self.table_name = "custom_fields" @@ -39,9 +39,9 @@ class RepairInvalidDefaultWorkPackageCustomValues < ActiveRecord::Migration[4.2] translates :name, :default_value, :possible_values end - [ - :user, :group, :work_package, :project, :version, - :time_entry_activity, :time_entry, :issue_priority, + %i[ + user group work_package project version + time_entry_activity time_entry issue_priority ] .each do |name| Kernel.const_set( @@ -57,9 +57,6 @@ class RepairInvalidDefaultWorkPackageCustomValues < ActiveRecord::Migration[4.2] end end - def down - end - private def create_missing_work_package_custom_values @@ -88,8 +85,7 @@ class RepairInvalidDefaultWorkPackageCustomValues < ActiveRecord::Migration[4.2] end end - def create_missing_custom_value(_table, _customized_id, _custom_field_id) - end + def create_missing_custom_value(_table, _customized_id, _custom_field_id); end def missing_custom_values @missing_custom_values ||= select_all <<-SQL diff --git a/db/migrate/20131216171110_migrate_timelines_enumerations.rb b/db/migrate/20131216171110_migrate_timelines_enumerations.rb index d103743a8c..90c2dc7442 100644 --- a/db/migrate/20131216171110_migrate_timelines_enumerations.rb +++ b/db/migrate/20131216171110_migrate_timelines_enumerations.rb @@ -27,7 +27,7 @@ # See docs/COPYRIGHT.rdoc for more details. #++ -class MigrateTimelinesEnumerations < ActiveRecord::Migration[4.2] +class MigrateTimelinesEnumerations < ActiveRecord::Migration[5.1] PROJECT_STATUS_TYPE_NAME = { 'Timelines::ReportedProjectStatus' => 'ReportedProjectStatus' } def up diff --git a/db/migrate/20131219084934_add_enabled_modules_name_index.rb b/db/migrate/20131219084934_add_enabled_modules_name_index.rb index 6c398f5acd..9a4aa74294 100644 --- a/db/migrate/20131219084934_add_enabled_modules_name_index.rb +++ b/db/migrate/20131219084934_add_enabled_modules_name_index.rb @@ -27,7 +27,7 @@ # See docs/COPYRIGHT.rdoc for more details. #++ -class AddEnabledModulesNameIndex < ActiveRecord::Migration[4.2] +class AddEnabledModulesNameIndex < ActiveRecord::Migration[5.1] def change add_index :enabled_modules, :name, length: 8 end diff --git a/db/migrate/20140122161742_remove_journal_columns.rb b/db/migrate/20140122161742_remove_journal_columns.rb index 919286f484..a483c035c2 100644 --- a/db/migrate/20140122161742_remove_journal_columns.rb +++ b/db/migrate/20140122161742_remove_journal_columns.rb @@ -27,7 +27,7 @@ # See docs/COPYRIGHT.rdoc for more details. #++ -class RemoveJournalColumns < ActiveRecord::Migration[4.2] +class RemoveJournalColumns < ActiveRecord::Migration[5.1] def up change_table :work_package_journals do |t| t.remove :lock_version, :created_at, :root_id, :lft, :rgt diff --git a/db/migrate/20140127134733_fix_issue_in_notifications.rb b/db/migrate/20140127134733_fix_issue_in_notifications.rb index a06223c0c2..eebca72992 100644 --- a/db/migrate/20140127134733_fix_issue_in_notifications.rb +++ b/db/migrate/20140127134733_fix_issue_in_notifications.rb @@ -27,7 +27,7 @@ # See docs/COPYRIGHT.rdoc for more details. #++ -class FixIssueInNotifications < ActiveRecord::Migration[4.2] +class FixIssueInNotifications < ActiveRecord::Migration[5.1] REPLACED = { 'issue_added' => 'work_package_added', 'issue_updated' => 'work_package_updated', diff --git a/db/migrate/20140203141127_rename_modulename_issue_tracking.rb b/db/migrate/20140203141127_rename_modulename_issue_tracking.rb index 3a475ed465..bcd9156be1 100644 --- a/db/migrate/20140203141127_rename_modulename_issue_tracking.rb +++ b/db/migrate/20140203141127_rename_modulename_issue_tracking.rb @@ -27,7 +27,7 @@ # See docs/COPYRIGHT.rdoc for more details. #++ -class RenameModulenameIssueTracking < ActiveRecord::Migration[4.2] +class RenameModulenameIssueTracking < ActiveRecord::Migration[5.1] def up update <<-SQL UPDATE enabled_modules diff --git a/db/migrate/20140311120609_add_sticked_on_field_to_messages.rb b/db/migrate/20140311120609_add_sticked_on_field_to_messages.rb index fd681827f4..f882d1c612 100644 --- a/db/migrate/20140311120609_add_sticked_on_field_to_messages.rb +++ b/db/migrate/20140311120609_add_sticked_on_field_to_messages.rb @@ -27,7 +27,7 @@ # See docs/COPYRIGHT.rdoc for more details. #++ -class AddStickedOnFieldToMessages < ActiveRecord::Migration[4.2] +class AddStickedOnFieldToMessages < ActiveRecord::Migration[5.1] def change add_column :messages, :sticked_on, :datetime, default: nil, null: true end diff --git a/db/migrate/20140411142338_clear_identity_urls_on_users.rb b/db/migrate/20140411142338_clear_identity_urls_on_users.rb index 056c1ce339..0fe579e51c 100644 --- a/db/migrate/20140411142338_clear_identity_urls_on_users.rb +++ b/db/migrate/20140411142338_clear_identity_urls_on_users.rb @@ -26,7 +26,7 @@ # See docs/COPYRIGHT.rdoc for more details. #++ -class ClearIdentityUrlsOnUsers < ActiveRecord::Migration[4.2] +class ClearIdentityUrlsOnUsers < ActiveRecord::Migration[5.1] def up create_table 'legacy_user_identity_urls' do |t| t.string 'login', limit: 256, default: '', null: false diff --git a/db/migrate/20140414141459_remove_openid_entirely.rb b/db/migrate/20140414141459_remove_openid_entirely.rb index 33170429cf..f228a8442e 100644 --- a/db/migrate/20140414141459_remove_openid_entirely.rb +++ b/db/migrate/20140414141459_remove_openid_entirely.rb @@ -26,7 +26,7 @@ # See docs/COPYRIGHT.rdoc for more details. #++ -class RemoveOpenidEntirely < ActiveRecord::Migration[4.2] +class RemoveOpenidEntirely < ActiveRecord::Migration[5.1] def up drop_table 'open_id_authentication_nonces' drop_table 'open_id_authentication_associations' diff --git a/db/migrate/20140429152018_add_sessions_table.rb b/db/migrate/20140429152018_add_sessions_table.rb index 9ce517f359..14d524d6ea 100644 --- a/db/migrate/20140429152018_add_sessions_table.rb +++ b/db/migrate/20140429152018_add_sessions_table.rb @@ -26,7 +26,7 @@ # See docs/COPYRIGHT.rdoc for more details. #++ -class AddSessionsTable < ActiveRecord::Migration[4.2] +class AddSessionsTable < ActiveRecord::Migration[5.1] def change create_table :sessions do |t| t.string :session_id, null: false diff --git a/db/migrate/20140430125956_reset_content_types.rb b/db/migrate/20140430125956_reset_content_types.rb index f82124690e..87c9c33024 100644 --- a/db/migrate/20140430125956_reset_content_types.rb +++ b/db/migrate/20140430125956_reset_content_types.rb @@ -26,7 +26,7 @@ # See docs/COPYRIGHT.rdoc for more details. #++ -class ResetContentTypes < ActiveRecord::Migration[4.2] +class ResetContentTypes < ActiveRecord::Migration[5.1] def up Attachment.all.each do |attachment| attachment.update_column(:content_type, Attachment.content_type_for(attachment.disk_filename)) diff --git a/db/migrate/20140602112515_drop_work_packages_priority_not_null_constraint.rb b/db/migrate/20140602112515_drop_work_packages_priority_not_null_constraint.rb index a8e4d7e535..79e23f26ca 100644 --- a/db/migrate/20140602112515_drop_work_packages_priority_not_null_constraint.rb +++ b/db/migrate/20140602112515_drop_work_packages_priority_not_null_constraint.rb @@ -26,7 +26,7 @@ # See docs/COPYRIGHT.rdoc for more details. #++ -class DropWorkPackagesPriorityNotNullConstraint < ActiveRecord::Migration[4.2] +class DropWorkPackagesPriorityNotNullConstraint < ActiveRecord::Migration[5.1] def change change_column :work_packages, :priority_id, :integer, null: true end diff --git a/db/migrate/20140610125207_add_updated_at_index_to_work_packages.rb b/db/migrate/20140610125207_add_updated_at_index_to_work_packages.rb index 9e8c6ff020..ac901d1250 100644 --- a/db/migrate/20140610125207_add_updated_at_index_to_work_packages.rb +++ b/db/migrate/20140610125207_add_updated_at_index_to_work_packages.rb @@ -26,7 +26,7 @@ # See docs/COPYRIGHT.rdoc for more details. #++ -class AddUpdatedAtIndexToWorkPackages < ActiveRecord::Migration[4.2] +class AddUpdatedAtIndexToWorkPackages < ActiveRecord::Migration[5.1] def change add_index :work_packages, :updated_at end diff --git a/db/migrate/20141215104802_migrate_attachments_to_carrier_wave.rb b/db/migrate/20141215104802_migrate_attachments_to_carrier_wave.rb index 803182a254..820f961423 100644 --- a/db/migrate/20141215104802_migrate_attachments_to_carrier_wave.rb +++ b/db/migrate/20141215104802_migrate_attachments_to_carrier_wave.rb @@ -28,7 +28,7 @@ require 'tasks/shared/legacy_attachment' -class MigrateAttachmentsToCarrierWave < ActiveRecord::Migration[4.2] +class MigrateAttachmentsToCarrierWave < ActiveRecord::Migration[5.1] def up add_column_if_missing :attachments, :file, :string diff --git a/db/migrate/20150116095004_patch_corrupt_attachments.rb b/db/migrate/20150116095004_patch_corrupt_attachments.rb index c77e9825fb..29ecfc29cd 100644 --- a/db/migrate/20150116095004_patch_corrupt_attachments.rb +++ b/db/migrate/20150116095004_patch_corrupt_attachments.rb @@ -43,7 +43,7 @@ # be displayed, if not downloaded. # # Important: The migration is irreversible. -class PatchCorruptAttachments < ActiveRecord::Migration[4.2] +class PatchCorruptAttachments < ActiveRecord::Migration[5.1] def up Attachment.all.each do |attachment| patch_attachment attachment diff --git a/db/migrate/20150623151337_hide_mail_by_default.rb b/db/migrate/20150623151337_hide_mail_by_default.rb index 8b2e839437..131fc70c3d 100644 --- a/db/migrate/20150623151337_hide_mail_by_default.rb +++ b/db/migrate/20150623151337_hide_mail_by_default.rb @@ -26,7 +26,7 @@ # See docs/COPYRIGHT.rdoc for more details. #++ -class HideMailByDefault < ActiveRecord::Migration[4.2] +class HideMailByDefault < ActiveRecord::Migration[5.1] def change change_column_default :user_preferences, :hide_mail, true end diff --git a/db/migrate/20150629075221_add_scm_type_to_repositories.rb b/db/migrate/20150629075221_add_scm_type_to_repositories.rb index 9021317078..2a2838ef6a 100644 --- a/db/migrate/20150629075221_add_scm_type_to_repositories.rb +++ b/db/migrate/20150629075221_add_scm_type_to_repositories.rb @@ -37,7 +37,7 @@ # - Repository::*: existing # - Repository::Git: local # -class AddScmTypeToRepositories < ActiveRecord::Migration[4.2] +class AddScmTypeToRepositories < ActiveRecord::Migration[5.1] def up add_column :repositories, :scm_type, :string, null: true diff --git a/db/migrate/20150716133712_add_unique_index_on_journals.rb b/db/migrate/20150716133712_add_unique_index_on_journals.rb index 0af2848a3b..e284a868fe 100644 --- a/db/migrate/20150716133712_add_unique_index_on_journals.rb +++ b/db/migrate/20150716133712_add_unique_index_on_journals.rb @@ -36,7 +36,7 @@ # In general we learned that up until now OpenProject was not very good at handling concurrent # updates to journables. By adding the index we ensure data consistency, but at the same time # provoke errors in those update scenarios. -class AddUniqueIndexOnJournals < ActiveRecord::Migration[4.2] +class AddUniqueIndexOnJournals < ActiveRecord::Migration[5.1] def up cleanup_duplicate_journals add_index :journals, [:journable_type, :journable_id, :version], unique: true diff --git a/db/migrate/20150716163704_remove_filesystem_repositories.rb b/db/migrate/20150716163704_remove_filesystem_repositories.rb index 6ce431ab6c..874200f984 100644 --- a/db/migrate/20150716163704_remove_filesystem_repositories.rb +++ b/db/migrate/20150716163704_remove_filesystem_repositories.rb @@ -29,7 +29,7 @@ ## # Removes all remaining Repository::Filesystem entries. # -class RemoveFilesystemRepositories < ActiveRecord::Migration[4.2] +class RemoveFilesystemRepositories < ActiveRecord::Migration[5.1] include Migration::Utils def up diff --git a/db/migrate/20150729145732_add_storage_information_to_repository.rb b/db/migrate/20150729145732_add_storage_information_to_repository.rb index 31431d3f49..fcd92d34a8 100644 --- a/db/migrate/20150729145732_add_storage_information_to_repository.rb +++ b/db/migrate/20150729145732_add_storage_information_to_repository.rb @@ -25,7 +25,7 @@ # # See docs/COPYRIGHT.rdoc for more details. #++ -class AddStorageInformationToRepository < ActiveRecord::Migration[4.2] +class AddStorageInformationToRepository < ActiveRecord::Migration[5.1] def change add_column :repositories, :required_storage_bytes, :integer, limit: 8, null: false, default: 0 diff --git a/db/migrate/20150819143300_underscore_scm_settings.rb b/db/migrate/20150819143300_underscore_scm_settings.rb index 8549757f1b..e91d2b1355 100644 --- a/db/migrate/20150819143300_underscore_scm_settings.rb +++ b/db/migrate/20150819143300_underscore_scm_settings.rb @@ -25,7 +25,7 @@ # # See docs/COPYRIGHT.rdoc for more details. #++ -class UnderscoreScmSettings < ActiveRecord::Migration[4.2] +class UnderscoreScmSettings < ActiveRecord::Migration[5.1] def up Setting.enabled_scm = Setting.enabled_scm.map(&:underscore) end diff --git a/db/migrate/20150820133700_denullify_display_sums.rb b/db/migrate/20150820133700_denullify_display_sums.rb index c6716f822e..0f16a0cbf7 100644 --- a/db/migrate/20150820133700_denullify_display_sums.rb +++ b/db/migrate/20150820133700_denullify_display_sums.rb @@ -25,7 +25,7 @@ # # See docs/COPYRIGHT.rdoc for more details. #++ -class DenullifyDisplaySums < ActiveRecord::Migration[4.2] +class DenullifyDisplaySums < ActiveRecord::Migration[5.1] def change change_column_default :queries, :display_sums, false change_column_null :queries, :display_sums, false, false diff --git a/db/migrate/20150827133700_remove_project_homepage.rb b/db/migrate/20150827133700_remove_project_homepage.rb index 2adf22a827..86c19c11a3 100644 --- a/db/migrate/20150827133700_remove_project_homepage.rb +++ b/db/migrate/20150827133700_remove_project_homepage.rb @@ -26,7 +26,7 @@ # # See docs/COPYRIGHT.rdoc for more details. #++ -class RemoveProjectHomepage < ActiveRecord::Migration[4.2] +class RemoveProjectHomepage < ActiveRecord::Migration[5.1] def change remove_column :projects, :homepage, :string, default: '' end diff --git a/db/migrate/20151005113102_remove_summary_from_project.rb b/db/migrate/20151005113102_remove_summary_from_project.rb index 40c4d4fc5b..8b7fa974e9 100644 --- a/db/migrate/20151005113102_remove_summary_from_project.rb +++ b/db/migrate/20151005113102_remove_summary_from_project.rb @@ -1,4 +1,4 @@ -class RemoveSummaryFromProject < ActiveRecord::Migration[4.2] +class RemoveSummaryFromProject < ActiveRecord::Migration[5.1] def change remove_column :projects, :summary end diff --git a/db/migrate/20151028063433_boolearlize_bool_custom_values.rb b/db/migrate/20151028063433_boolearlize_bool_custom_values.rb index f012b0bb3a..2763f7d6d9 100644 --- a/db/migrate/20151028063433_boolearlize_bool_custom_values.rb +++ b/db/migrate/20151028063433_boolearlize_bool_custom_values.rb @@ -1,4 +1,4 @@ -class BoolearlizeBoolCustomValues < ActiveRecord::Migration[4.2] +class BoolearlizeBoolCustomValues < ActiveRecord::Migration[5.1] def up update_custom_values(fake_true, db_true, fake_false, db_false) update_queries(fake_true, db_true_unquoted, fake_false, db_false_unquoted) diff --git a/db/migrate/20151116110245_fix_customizable_bool_values.rb b/db/migrate/20151116110245_fix_customizable_bool_values.rb index 9515b47304..a35991143a 100644 --- a/db/migrate/20151116110245_fix_customizable_bool_values.rb +++ b/db/migrate/20151116110245_fix_customizable_bool_values.rb @@ -1,4 +1,4 @@ -class FixCustomizableBoolValues < ActiveRecord::Migration[4.2] +class FixCustomizableBoolValues < ActiveRecord::Migration[5.1] def up update_customizable_values(quoted_true, unquoted_true, quoted_false, unquoted_false) end diff --git a/db/migrate/20160125143638_index_member_roles_inherited_from.rb b/db/migrate/20160125143638_index_member_roles_inherited_from.rb index 1acdff2181..97114e2123 100644 --- a/db/migrate/20160125143638_index_member_roles_inherited_from.rb +++ b/db/migrate/20160125143638_index_member_roles_inherited_from.rb @@ -27,7 +27,7 @@ # See docs/COPYRIGHT.rdoc for more details. #++ -class IndexMemberRolesInheritedFrom < ActiveRecord::Migration[4.2] +class IndexMemberRolesInheritedFrom < ActiveRecord::Migration[5.1] def change # The index is required for member/member_role deletion when a user # leaves a group. diff --git a/db/migrate/20160419103544_add_attribute_visibility_to_types.rb b/db/migrate/20160419103544_add_attribute_visibility_to_types.rb index d5f89d2dcc..71c75af8a4 100644 --- a/db/migrate/20160419103544_add_attribute_visibility_to_types.rb +++ b/db/migrate/20160419103544_add_attribute_visibility_to_types.rb @@ -1,4 +1,4 @@ -class AddAttributeVisibilityToTypes < ActiveRecord::Migration[4.2] +class AddAttributeVisibilityToTypes < ActiveRecord::Migration[5.1] def change add_column :types, :attribute_visibility, :text, hash: true end diff --git a/db/migrate/20160503150449_add_indexes_for_latest_activity.rb b/db/migrate/20160503150449_add_indexes_for_latest_activity.rb index 9aa0819872..b2913ada68 100644 --- a/db/migrate/20160503150449_add_indexes_for_latest_activity.rb +++ b/db/migrate/20160503150449_add_indexes_for_latest_activity.rb @@ -1,4 +1,4 @@ -class AddIndexesForLatestActivity < ActiveRecord::Migration[4.2] +class AddIndexesForLatestActivity < ActiveRecord::Migration[5.1] def change add_index :work_packages, [:project_id, :updated_at] add_index :news, [:project_id, :created_on] diff --git a/db/migrate/20160726090624_add_slug_to_wiki_pages.rb b/db/migrate/20160726090624_add_slug_to_wiki_pages.rb index e382520fac..b0be456b51 100644 --- a/db/migrate/20160726090624_add_slug_to_wiki_pages.rb +++ b/db/migrate/20160726090624_add_slug_to_wiki_pages.rb @@ -1,4 +1,4 @@ -class AddSlugToWikiPages < ActiveRecord::Migration[4.2] +class AddSlugToWikiPages < ActiveRecord::Migration[5.1] def up add_column :wiki_pages, :slug, :string add_index :wiki_pages, [:wiki_id, :slug], name: 'wiki_pages_wiki_id_slug', unique: true diff --git a/db/migrate/20160803094931_wiki_menu_titles_to_slug.rb b/db/migrate/20160803094931_wiki_menu_titles_to_slug.rb index 8a9974cdd2..d3ffef5873 100644 --- a/db/migrate/20160803094931_wiki_menu_titles_to_slug.rb +++ b/db/migrate/20160803094931_wiki_menu_titles_to_slug.rb @@ -1,4 +1,4 @@ -class WikiMenuTitlesToSlug < ActiveRecord::Migration[4.2] +class WikiMenuTitlesToSlug < ActiveRecord::Migration[5.1] def up migrate_menu_items end diff --git a/lib/plugins/acts_as_journalized/lib/redmine/acts/journalized/changes.rb b/lib/plugins/acts_as_journalized/lib/redmine/acts/journalized/changes.rb index 740b9bd49c..95652fb841 100644 --- a/lib/plugins/acts_as_journalized/lib/redmine/acts/journalized/changes.rb +++ b/lib/plugins/acts_as_journalized/lib/redmine/acts/journalized/changes.rb @@ -119,11 +119,9 @@ module Redmine::Acts::Journalized # creation. Incremental changes are reset when the record is saved because they represent # a subset of the dirty attribute changes, which are reset upon save. def incremental_journal_changes - changed.inject({}) { |h, attr| - h[attr] = attribute_change(attr) unless !attribute_change(attr).nil? && - attribute_change(attr)[0].blank? && attribute_change(attr)[1].blank? - h - }.slice(*journaled_columns) + saved_changes.reject do |_, change| + change[0].blank? && change[1].blank? + end.slice(*journaled_columns) end # Simply resets the cumulative changes after journal creation. diff --git a/lib/plugins/acts_as_journalized/lib/redmine/acts/journalized/creation.rb b/lib/plugins/acts_as_journalized/lib/redmine/acts/journalized/creation.rb index 2a3bbfd9d2..7c7145f5e2 100644 --- a/lib/plugins/acts_as_journalized/lib/redmine/acts/journalized/creation.rb +++ b/lib/plugins/acts_as_journalized/lib/redmine/acts/journalized/creation.rb @@ -142,8 +142,10 @@ module Redmine::Acts::Journalized attributes_setter.call(initial_changes) - # Call the journal creating method - changed_data = fill_object.send(:merge_journal_changes) + # Get the changed attributes + changed_data = fill_object.changes.reject do |_, change| + change[0].blank? && change[1].blank? + end.slice(*journaled_columns) new_journal.version = 1 new_journal.activity_type = activity_type diff --git a/lib/tasks/quote_strings_with_invalid_characters_in_legacy_journals.rake b/lib/tasks/quote_strings_with_invalid_characters_in_legacy_journals.rake index 3ea977f70d..1398847d5c 100644 --- a/lib/tasks/quote_strings_with_invalid_characters_in_legacy_journals.rake +++ b/lib/tasks/quote_strings_with_invalid_characters_in_legacy_journals.rake @@ -40,7 +40,7 @@ namespace :migrations do private - class InvalidChangedDataStringQuoter < ActiveRecord::Migration + class InvalidChangedDataStringQuoter < ActiveRecord::Migration[5.1] include Migration::Utils def quote_strings_with_invalid_characters diff --git a/script/ci_setup.sh b/script/ci_setup.sh index 6add23457d..849910403e 100644 --- a/script/ci_setup.sh +++ b/script/ci_setup.sh @@ -69,6 +69,8 @@ else run "mkdir -p app/assets/javascripts/bundles" run "touch app/assets/javascripts/bundles/openproject-core-app.js" run "touch app/assets/javascripts/bundles/openproject-vendors.js" + run "mkdir -p app/assets/javascripts/locales" + run "touch app/assets/javascripts/locales/en.js" run "mkdir -p app/assets/stylesheets/bundles" run "touch app/assets/javascripts/bundles/openproject-core-app.css" diff --git a/spec/controllers/sys_controller_spec.rb b/spec/controllers/sys_controller_spec.rb index 95f9ef7957..688739799d 100644 --- a/spec/controllers/sys_controller_spec.rb +++ b/spec/controllers/sys_controller_spec.rb @@ -30,8 +30,7 @@ require 'spec_helper' describe SysController, type: :controller do let(:commit_role) { - FactoryGirl.create(:role, permissions: [:commit_access, - :browse_repository]) + FactoryGirl.create(:role, permissions: %i[commit_access browse_repository]) } let(:browse_role) { FactoryGirl.create(:role, permissions: [:browse_repository]) } let(:guest_role) { FactoryGirl.create(:role, permissions: []) } @@ -315,13 +314,12 @@ describe SysController, type: :controller do end it 'should respond 403 not allowed for write (push)' do - post 'repo_auth', - key: api_key, - repository: project.identifier, - method: 'POST', - git_smart_http: '1', - uri: "/git/#{project.identifier}/git-receive-pack", - location: '/git' + post 'repo_auth', params: { key: api_key, + repository: project.identifier, + method: 'POST', + git_smart_http: '1', + uri: "/git/#{project.identifier}/git-receive-pack", + location: '/git' } expect(response.code).to eq('403') end diff --git a/spec/models/relation/hierarchy_paths_spec.rb b/spec/models/relation/hierarchy_paths_spec.rb index ff2b3834e1..32411c64d2 100644 --- a/spec/models/relation/hierarchy_paths_spec.rb +++ b/spec/models/relation/hierarchy_paths_spec.rb @@ -226,7 +226,7 @@ describe Relation, 'hierarchy_paths', type: :model do let!(:parent_child_relation) { Relation.create relation_type: 'hierarchy', from: parent, to: child } before do - ActiveRecord::Base.connection.select_rows <<-SQL + ActiveRecord::Base.connection.execute <<-SQL DELETE FROM hierarchy_paths SQL ActiveRecord::Base.connection.execute <<-SQL diff --git a/spec/models/work_package/work_package_acts_as_journalized_spec.rb b/spec/models/work_package/work_package_acts_as_journalized_spec.rb index 6760b87cbb..99a2ecf76a 100644 --- a/spec/models/work_package/work_package_acts_as_journalized_spec.rb +++ b/spec/models/work_package/work_package_acts_as_journalized_spec.rb @@ -448,6 +448,7 @@ describe WorkPackage, type: :model do @issue.save! @issue.description = '' + @issue.save! expect(@issue.send(:incremental_journal_changes)).to be_empty end end diff --git a/spec/services/authorization/user_allowed_query_spec.rb b/spec/services/authorization/user_allowed_query_spec.rb index 7218173f02..9efd4196b1 100644 --- a/spec/services/authorization/user_allowed_query_spec.rb +++ b/spec/services/authorization/user_allowed_query_spec.rb @@ -54,8 +54,8 @@ describe Authorization::UserAllowedQuery do non_member_role.save! end - it 'is a user relation' do - expect(described_class.query(action, project)).to be_a User::ActiveRecord_Relation + it 'is an AR relation' do + expect(described_class.query(action, project)).to be_a ActiveRecord::Relation end context 'w/o the project being public diff --git a/spec_legacy/functional/timelog_controller_spec.rb b/spec_legacy/functional/timelog_controller_spec.rb index cd2c957829..afd8bb7246 100644 --- a/spec_legacy/functional/timelog_controller_spec.rb +++ b/spec_legacy/functional/timelog_controller_spec.rb @@ -148,7 +148,9 @@ describe TimelogController, type: :controller do # simulate that this fails (e.g. due to a plugin), see #5700 TimeEntry.class_eval do before_destroy :stop_callback_chain - def stop_callback_chain; false; end + def stop_callback_chain + throw :abort + end end session[:user_id] = 2 diff --git a/spec_legacy/unit/mail_handler_spec.rb b/spec_legacy/unit/mail_handler_spec.rb index 6804fb2672..e1f989bfd8 100644 --- a/spec_legacy/unit/mail_handler_spec.rb +++ b/spec_legacy/unit/mail_handler_spec.rb @@ -256,6 +256,7 @@ describe MailHandler, type: :model do it 'should add work package with localized attributes' do User.find_by_mail('jsmith@somenet.foo').update_attribute 'language', 'de' + issue = submit_email('ticket_with_localized_attributes.eml', allow_override: 'type,category,priority') assert issue.is_a?(WorkPackage) assert !issue.new_record? diff --git a/spec_legacy/unit/repository_spec.rb b/spec_legacy/unit/repository_spec.rb index 5708f4e1e1..8521acdfad 100644 --- a/spec_legacy/unit/repository_spec.rb +++ b/spec_legacy/unit/repository_spec.rb @@ -1,4 +1,5 @@ #-- encoding: UTF-8 + #-- copyright # OpenProject is a project management system. # Copyright (C) 2012-2018 the OpenProject Foundation (OPF) @@ -26,7 +27,7 @@ # # See docs/COPYRIGHT.rdoc for more details. #++ -require 'legacy_spec_helper' +require_relative '../legacy_spec_helper' describe Repository, type: :model do fixtures :all