OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Autofix some style issues.
Pavel Balashov0905809ea668
diff --git a/db/migrate/20171106074835_move_hashed_token_to_core.rb b/db/migrate/20171106074835_move_hashed_token_to_core.rbindex dd4886319d3..1cabf8d6bd8 100644--- a/db/migrate/20171106074835_move_hashed_token_to_core.rb+++ b/db/migrate/20171106074835_move_hashed_token_to_core.rb@@ -27,7 +27,7 @@#++class MoveHashedTokenToCore < ActiveRecord::Migration[5.1]- class OldToken < ActiveRecord::Base+ class OldToken < ApplicationRecordself.table_name = :plaintext_tokensenddiff --git a/db/migrate/20180830120550_migrate_light_background_themes.rb b/db/migrate/20180830120550_migrate_light_background_themes.rbindex dd2f97fab18..e7ad7f59ff4 100644--- a/db/migrate/20180830120550_migrate_light_background_themes.rb+++ b/db/migrate/20180830120550_migrate_light_background_themes.rb@@ -68,7 +68,7 @@ class MigrateLightBackgroundThemes < ActiveRecord::Migration[5.1]enddef set_variable(variable_name, hexcode)- DesignColor.create(variable: variable_name, hexcode: hexcode)+ DesignColor.create(variable: variable_name, hexcode:)enddef apply?diff --git a/db/migrate/20190124081710_remove_accessibility_mode.rb b/db/migrate/20190124081710_remove_accessibility_mode.rbindex 4322e194c74..ef7d8fefeef 100644--- a/db/migrate/20190124081710_remove_accessibility_mode.rb+++ b/db/migrate/20190124081710_remove_accessibility_mode.rb@@ -35,7 +35,7 @@ class RemoveAccessibilityMode < ActiveRecord::Migration[5.2]privatedef delete_accessibility_mode_from_settings- delete <<-SQL+ delete <<-SQL.squishDELETE FROM settingsWHERE name = 'accessibility_mode_for_anonymous'SQLdiff --git a/db/migrate/20190220080647_migrate_my_page_layout.rb b/db/migrate/20190220080647_migrate_my_page_layout.rbindex 16f2234cef5..06f6e8c01fe 100644--- a/db/migrate/20190220080647_migrate_my_page_layout.rb+++ b/db/migrate/20190220080647_migrate_my_page_layout.rb@@ -55,7 +55,7 @@ class MigrateMyPageLayout < ActiveRecord::Migration[5.2]### Migrate a single preference entry and remove the my pagedef migrate_my_page(user_id, old_layout)- my_page = ::Grids::MyPage.new user_id: user_id, column_count: 4+ my_page = ::Grids::MyPage.new user_id:, column_count: 4# Migrate topstart_row = 1@@ -64,7 +64,7 @@ class MigrateMyPageLayout < ActiveRecord::Migration[5.2](old_layout['top'] || []).each do |block|map_widget my_page,old_name: block,- start_row: start_row,+ start_row:,end_row: start_row + widget_height,start_column: 1,end_column: 5@@ -132,10 +132,10 @@ class MigrateMyPageLayout < ActiveRecord::Migration[5.2]my_page.widgets << Grids::Widget.new(identifier: mapping,- start_row: start_row,- end_row: end_row,- start_column: start_column,- end_column: end_column+ start_row:,+ end_row:,+ start_column:,+ end_column:)enddiff --git a/db/migrate/20190502102512_ensure_postgres_index_names.rb b/db/migrate/20190502102512_ensure_postgres_index_names.rbindex 323950cd87c..51f256b4d50 100644--- a/db/migrate/20190502102512_ensure_postgres_index_names.rb+++ b/db/migrate/20190502102512_ensure_postgres_index_names.rb@@ -30,7 +30,7 @@ class EnsurePostgresIndexNames < ActiveRecord::Migration[5.2]disable_ddl_transaction!def up- sql = <<~SQL+ sql = <<~SQL.squishSELECTFORMAT('%s_pkey', table_name) as new_name,constraint_name as old_namediff --git a/db/migrate/20190710132957_rename_my_page_widgets.rb b/db/migrate/20190710132957_rename_my_page_widgets.rbindex f8b4aba2a4f..87834d43ae2 100644--- a/db/migrate/20190710132957_rename_my_page_widgets.rb+++ b/db/migrate/20190710132957_rename_my_page_widgets.rb@@ -62,11 +62,11 @@ class RenameMyPageWidgets < ActiveRecord::Migration[5.2]def update_table_widget(widget, filter_name)widget.options = {- "name": I18n.t("js.grid.widgets.#{widget.identifier}.title"),- "queryProps": {- "columns[]": %w(id project type subject),- "filters": JSON.dump([{ "status": { "operator": "o", "values": [] } },- { filter_name => { "operator": "=", "values": ["me"] } }])+ name: I18n.t("js.grid.widgets.#{widget.identifier}.title"),+ queryProps: {+ 'columns[]': %w(id project type subject),+ filters: JSON.dump([{ status: { operator: "o", values: [] } },+ { filter_name => { operator: "=", values: ["me"] } }])}}widget.identifier = 'work_packages_table'@@ -76,7 +76,7 @@ class RenameMyPageWidgets < ActiveRecord::Migration[5.2]def update_widget_name(widget)widget.options = {- "name": I18n.t("js.grid.widgets.#{widget.identifier}.title")+ name: I18n.t("js.grid.widgets.#{widget.identifier}.title")}widget.save(validate: false)@@ -85,11 +85,11 @@ class RenameMyPageWidgets < ActiveRecord::Migration[5.2]def update_query_widget(widget)query_id = widget.options['queryId']- name = Query.where(id: query_id).limit(1).pluck(:name).first || I18n.t('js.grid.widgets.work_packages_table.title')+ name = Query.where(id: query_id).limit(1).pick(:name) || I18n.t('js.grid.widgets.work_packages_table.title')widget.options = {- "name": name,- "queryId": query_id+ name:,+ queryId: query_id}widget.save(validate: false)diff --git a/db/migrate/20190722082648_add_derived_estimated_hours_to_work_packages.rb b/db/migrate/20190722082648_add_derived_estimated_hours_to_work_packages.rbindex 8d93699c5f6..f7a033cfc55 100644--- a/db/migrate/20190722082648_add_derived_estimated_hours_to_work_packages.rb+++ b/db/migrate/20190722082648_add_derived_estimated_hours_to_work_packages.rb@@ -27,7 +27,7 @@#++class AddDerivedEstimatedHoursToWorkPackages < ActiveRecord::Migration[5.2]- class WorkPackageWithRelations < ActiveRecord::Base+ class WorkPackageWithRelations < ApplicationRecordself.table_name = "work_packages"scope :with_children, ->(*_args) do@@ -67,31 +67,31 @@ class AddDerivedEstimatedHoursToWorkPackages < ActiveRecord::Migration[5.2]# for parent work packages separately while the UpdateAncestorsService# only touches the derived_estimated_hours column.def migrate_to_derived_estimated_hours!- last_id = Journal.order(id: :desc).limit(1).pluck(:id).first || 0+ last_id = Journal.order(id: :desc).limit(1).pick(:id) || 0work_packages = WorkPackageWithRelations.with_children.where("estimated_hours > ?", 0)work_packages.update_all("derived_estimated_hours = estimated_hours, estimated_hours = NULL")work_packages = WorkPackageWithRelations.with_children.where("derived_estimated_hours > ?", 0)create_journals_for work_packages- create_work_package_journals last_id: last_id- create_customizable_journals last_id: last_id- create_attachable_journals last_id: last_id+ create_work_package_journals(last_id:)+ create_customizable_journals(last_id:)+ create_attachable_journals(last_id:)touch_work_packages work_packages # to invalidate cacheenddef rollback_from_derived_estimated_hours!- last_id = Journal.order(id: :desc).limit(1).pluck(:id).first || 0+ last_id = Journal.order(id: :desc).limit(1).pick(:id) || 0work_packages = WorkPackageWithRelations.with_children.where("derived_estimated_hours > ?", 0)work_packages.update_all("estimated_hours = derived_estimated_hours, derived_estimated_hours = NULL")work_packages = WorkPackageWithRelations.with_children.where("estimated_hours > ?", 0)create_journals_for work_packages, notes: rollback_notes- create_work_package_journals last_id: last_id- create_customizable_journals last_id: last_id- create_attachable_journals last_id: last_id+ create_work_package_journals(last_id:)+ create_customizable_journals(last_id:)+ create_attachable_journals(last_id:)touch_work_packages work_packages # to invalidate cacheenddiff --git a/db/migrate/20190724093332_add_journal_versions_table.rb b/db/migrate/20190724093332_add_journal_versions_table.rbindex cd609733a8d..ca75eac5a73 100644--- a/db/migrate/20190724093332_add_journal_versions_table.rb+++ b/db/migrate/20190724093332_add_journal_versions_table.rb@@ -41,7 +41,7 @@ class AddJournalVersionsTable < ActiveRecord::Migration[5.2]unique: trueend- ActiveRecord::Base.connection.execute <<-SQL+ ActiveRecord::Base.connection.execute <<-SQL.squishINSERT INTO journal_versions (journable_type, journable_id, version)(SELECTjournable_type, journable_id, MAX(version)diff --git a/db/migrate/20190923123858_simplify_project_active_and_timestamp.rb b/db/migrate/20190923123858_simplify_project_active_and_timestamp.rbindex f36a06fa7b2..3ec05625b9b 100644--- a/db/migrate/20190923123858_simplify_project_active_and_timestamp.rb+++ b/db/migrate/20190923123858_simplify_project_active_and_timestamp.rb@@ -30,7 +30,7 @@ class SimplifyProjectActiveAndTimestamp < ActiveRecord::Migration[6.0]STATUS_ACTIVE = 1STATUS_ARCHIVED = 9- class Project < ActiveRecord::Base; end+ class Project < ApplicationRecord; enddef changechange_project_columns@@ -56,7 +56,8 @@ class SimplifyProjectActiveAndTimestamp < ActiveRecord::Migration[6.0]enddef fill_active_column- add_column :projects, :active, :boolean, default: true, index: true, null: false+ add_column :projects, :active, :boolean, default: true, null: false+ add_index :projects, :activeProject.reset_column_informationProject.where(status: STATUS_ARCHIVED).update_all(active: false)diff --git a/db/migrate/20191106132533_make_system_user_active.rb b/db/migrate/20191106132533_make_system_user_active.rbindex 918d07fa336..c3abf136232 100644--- a/db/migrate/20191106132533_make_system_user_active.rb+++ b/db/migrate/20191106132533_make_system_user_active.rb@@ -28,7 +28,7 @@class MakeSystemUserActive < ActiveRecord::Migration[6.0]# Remember the integer mapped to previous builtin status- BUILTIN_STATUS ||= 0+ BUILTIN_STATUS = 0def upPrincipal.where(status: BUILTIN_STATUS).update_all(status: Principal.statuses[:active])diff --git a/db/migrate/20191216135213_join_table_for_active_activities.rb b/db/migrate/20191216135213_join_table_for_active_activities.rbindex 4e22619a4dd..217cedacf55 100644--- a/db/migrate/20191216135213_join_table_for_active_activities.rb+++ b/db/migrate/20191216135213_join_table_for_active_activities.rb@@ -27,11 +27,11 @@#++class JoinTableForActiveActivities < ActiveRecord::Migration[6.0]- class ActivitiesJoinTable < ActiveRecord::Base+ class ActivitiesJoinTable < ApplicationRecordself.table_name = :time_entry_activities_projectsend- class TimeEntryActivity < ActiveRecord::Base+ class TimeEntryActivity < ApplicationRecordself.table_name = :enumerationsend@@ -66,7 +66,7 @@ class JoinTableForActiveActivities < ActiveRecord::Migration[6.0]# existing projects.def delete_invalid_project_activitiesActiveRecord::Base.connection.exec_query(- <<-SQL+ <<-SQL.squishDELETE FROM enumerationsUSING enumerations AS enumsLEFT OUTER JOIN projects on enums.project_id = projects.id@@ -77,7 +77,7 @@ class JoinTableForActiveActivities < ActiveRecord::Migration[6.0]def link_time_entries_to_root_activitiesActiveRecord::Base.connection.exec_query(- <<-SQL+ <<-SQL.squishUPDATEtime_entries te_sinkSET@@ -93,7 +93,7 @@ class JoinTableForActiveActivities < ActiveRecord::Migration[6.0]def link_time_entries_to_project_activitiesActiveRecord::Base.connection.exec_query(- <<-SQL+ <<-SQL.squishUPDATEtime_entries te_sinkSET@@ -113,7 +113,7 @@ class JoinTableForActiveActivities < ActiveRecord::Migration[6.0].where.not(parent_id: nil).pluck(:project_id, :parent_id, :active)- .map { |project_id, parent_id, active| { project_id: project_id, activity_id: parent_id, active: active } }+ .map { |project_id, parent_id, active| { project_id:, activity_id: parent_id, active: } }ActivitiesJoinTable.insert_all(values) if values.present?end@@ -124,7 +124,7 @@ class JoinTableForActiveActivities < ActiveRecord::Migration[6.0]def create_project_specific_activitiesActiveRecord::Base.connection.exec_query(- <<-SQL+ <<-SQL.squishINSERT INTO enumerations (name, is_default, type, position, parent_id, project_id, active, created_at, updated_at)SELECTtea.name,diff --git a/db/migrate/20200115090742_fix_parent_id_for_wiki_pages.rb b/db/migrate/20200115090742_fix_parent_id_for_wiki_pages.rbindex c2cff5ead0a..49c2c4c2015 100644--- a/db/migrate/20200115090742_fix_parent_id_for_wiki_pages.rb+++ b/db/migrate/20200115090742_fix_parent_id_for_wiki_pages.rb@@ -27,7 +27,7 @@#++class FixParentIdForWikiPages < ActiveRecord::Migration[6.0]- class MyWikiPages < ActiveRecord::Base+ class MyWikiPages < ApplicationRecordself.table_name = "wiki_pages"enddiff --git a/db/migrate/20200217155632_rename_tokens.rb b/db/migrate/20200217155632_rename_tokens.rbindex 41be5626b53..46bd72a54fa 100644--- a/db/migrate/20200217155632_rename_tokens.rb+++ b/db/migrate/20200217155632_rename_tokens.rb@@ -27,7 +27,7 @@#++class RenameTokens < ActiveRecord::Migration[6.0]- class Token < ActiveRecord::Base+ class Token < ApplicationRecordenddef updiff --git a/db/migrate/20200302100431_fix_attachable_journals.rb b/db/migrate/20200302100431_fix_attachable_journals.rbindex 77260a6d99f..b8970b34327 100644--- a/db/migrate/20200302100431_fix_attachable_journals.rb+++ b/db/migrate/20200302100431_fix_attachable_journals.rb@@ -34,7 +34,7 @@ class FixAttachableJournals < ActiveRecord::Migration[6.0]# This does not fix journals where the attachment has been deleted in the meantime as# we no longer have the necessary information to recreate the journals.def up- statement = <<~SQL+ statement = <<~SQL.squishWITHexisting_attachments AS (SELECTdiff --git a/db/migrate/20200326102408_rename_fixed_version.rb b/db/migrate/20200326102408_rename_fixed_version.rbindex 786bad66fe5..c1430f1d051 100644--- a/db/migrate/20200326102408_rename_fixed_version.rb+++ b/db/migrate/20200326102408_rename_fixed_version.rb@@ -43,7 +43,7 @@ class RenameFixedVersion < ActiveRecord::Migration[6.0]def rename_query_attributes(from, to)ActiveRecord::Base.connection.exec_query(- <<-SQL+ <<-SQL.squishUPDATEqueries q_sinkSETdiff --git a/db/migrate/20200522131255_splash_multi_list_customizable_journals.rb b/db/migrate/20200522131255_splash_multi_list_customizable_journals.rbindex 860e6e0d849..e050cdea616 100644--- a/db/migrate/20200522131255_splash_multi_list_customizable_journals.rb+++ b/db/migrate/20200522131255_splash_multi_list_customizable_journals.rb@@ -33,7 +33,7 @@ class SplashMultiListCustomizableJournals < ActiveRecord::Migration[6.0]# be returned as three rows with the value_part `1`, `2` and `3` respectively.# Those are then inserted into the journals table.# Lastly, the entries with the unsplashed values are deleted.- execute <<~SQL+ execute <<~SQL.squishWITH existing_journals AS (SELECT *FROM (@@ -76,7 +76,7 @@ class SplashMultiListCustomizableJournals < ActiveRecord::Migration[6.0]# Lastly, all customizable_journals entries that where not just created and that belong to a group of more than one# value per journal and custom field are deleted.def down- execute <<~SQL+ execute <<~SQL.squishWITH aggregated_value AS (SELECTjournal_id,diff --git a/db/migrate/20200625133727_fix_inherited_group_member_roles.rb b/db/migrate/20200625133727_fix_inherited_group_member_roles.rbindex eb9748af7b5..101687dd906 100644--- a/db/migrate/20200625133727_fix_inherited_group_member_roles.rb+++ b/db/migrate/20200625133727_fix_inherited_group_member_roles.rb@@ -40,7 +40,7 @@ class FixInheritedGroupMemberRoles < ActiveRecord::Migration[6.0]# Recreate member_roles for all group membersGroups::UpdateRolesService.new(member.principal, current_user: SystemUser.first, contract_class: EmptyContract)- .call(member: member, send_notifications: false)+ .call(member:, send_notifications: false)endenddiff --git a/db/migrate/20200708065116_fix_members_inconsistencies.rb b/db/migrate/20200708065116_fix_members_inconsistencies.rbindex 9af0c7eb762..78d3ae166fa 100644--- a/db/migrate/20200708065116_fix_members_inconsistencies.rb+++ b/db/migrate/20200708065116_fix_members_inconsistencies.rb@@ -31,7 +31,7 @@ class FixMembersInconsistencies < ActiveRecord::Migration[6.0]change_column_default :members, :created_on, -> { 'CURRENT_TIMESTAMP' }# Update all members without created_on which got created by CTE- Member.where(created_on: nil).update_all(created_on: Time.now)+ Member.where(created_on: nil).update_all(created_on: Time.zone.now)# Delete members without member_rolesMember.includes(:member_roles).where(member_roles: { id: nil }).destroy_alldiff --git a/db/migrate/20200820140526_remove_summable_setting.rb b/db/migrate/20200820140526_remove_summable_setting.rbindex c911365b373..07dee884425 100644--- a/db/migrate/20200820140526_remove_summable_setting.rb+++ b/db/migrate/20200820140526_remove_summable_setting.rb@@ -29,7 +29,7 @@class RemoveSummableSetting < ActiveRecord::Migration[6.0]# Do not need a down migration as we simply fall back on the default settingsdef up- execute <<~SQL+ execute <<~SQL.squishDELETE FROM settings WHERE name = 'work_package_list_summable_columns'SQLenddiff --git a/db/migrate/20200924085508_cleanup_orphaned_journal_data.rb b/db/migrate/20200924085508_cleanup_orphaned_journal_data.rbindex a676f289e76..c744139ef8d 100644--- a/db/migrate/20200924085508_cleanup_orphaned_journal_data.rb+++ b/db/migrate/20200924085508_cleanup_orphaned_journal_data.rb@@ -43,7 +43,7 @@ class CleanupOrphanedJournalData < ActiveRecord::Migration[6.0]privatedef cleanup_orphaned_journals(table)- execute <<~SQL+ execute <<~SQL.squishDELETEFROM#{table}diff --git a/db/migrate/20200925084550_members_allow_null_on_project.rb b/db/migrate/20200925084550_members_allow_null_on_project.rbindex 83ba11b4201..26f9d1978a0 100644--- a/db/migrate/20200925084550_members_allow_null_on_project.rb+++ b/db/migrate/20200925084550_members_allow_null_on_project.rb@@ -56,7 +56,7 @@ class MembersAllowNullOnProject < ActiveRecord::Migration[6.0]privatedef add_updated_at_values- execute <<~SQL+ execute <<~SQL.squishUPDATEmembersSET#{' '}@@ -67,7 +67,7 @@ class MembersAllowNullOnProject < ActiveRecord::Migration[6.0]def migrate_principal_roles_datafetch_principal_roles.each do |principal_id, records|member_id = insert_into_members(principal_id, records.first['created_at'], records.first['updated_at'])- insert_into_member_roles(member_id, records.map { |r| r['role_id'] })+ insert_into_member_roles(member_id, records.pluck('role_id'))endend@@ -78,7 +78,7 @@ class MembersAllowNullOnProject < ActiveRecord::Migration[6.0]enddef insert_into_members(principal_id, created_at, updated_at)- member_id = select_all <<~SQL+ member_id = select_all <<~SQL.squishINSERT INTOmembers(user_id, created_on, updated_at)VALUES (#{principal_id}, '#{created_at}', '#{updated_at}')@@ -91,7 +91,7 @@ class MembersAllowNullOnProject < ActiveRecord::Migration[6.0]def insert_into_member_roles(member_id, role_ids)values = role_ids.map { |role_id| "(#{member_id}, #{role_id})" }- execute <<~SQL+ execute <<~SQL.squishINSERT INTOmember_roles(member_id, role_id)VALUES #{values.join(', ')}@@ -104,7 +104,7 @@ class MembersAllowNullOnProject < ActiveRecord::Migration[6.0]enddef insert_into_principal_roles- execute <<~SQL+ execute <<~SQL.squishINSERT INTOprincipal_roles (principal_id, role_id, created_at, updated_at)SELECT@@ -124,7 +124,7 @@ class MembersAllowNullOnProject < ActiveRecord::Migration[6.0]enddef delete_global_members- execute <<~SQL+ execute <<~SQL.squishDELETEFROMmembers@@ -132,7 +132,7 @@ class MembersAllowNullOnProject < ActiveRecord::Migration[6.0]project_id IS NULLSQL- execute <<~SQL+ execute <<~SQL.squishDELETEFROMmember_rolesdiff --git a/db/migrate/20201005184411_rename_timestamps.rb b/db/migrate/20201005184411_rename_timestamps.rbindex 54627ffdf0c..5b23977b0f7 100644--- a/db/migrate/20201005184411_rename_timestamps.rb+++ b/db/migrate/20201005184411_rename_timestamps.rb@@ -80,7 +80,7 @@ class RenameTimestamps < ActiveRecord::Migration[6.0]reversible do |dir|dir.up do- execute <<~SQL+ execute <<~SQL.squishUPDATE#{table}SET #{column_name} = #{from_column}diff --git a/db/migrate/20210126112238_add_uniqueness_constrain_on_lastname_for_groups_and_placeholder_users.rb b/db/migrate/20210126112238_add_uniqueness_constrain_on_lastname_for_groups_and_placeholder_users.rbindex d5c9789453e..b51337efc4f 100644--- a/db/migrate/20210126112238_add_uniqueness_constrain_on_lastname_for_groups_and_placeholder_users.rb+++ b/db/migrate/20210126112238_add_uniqueness_constrain_on_lastname_for_groups_and_placeholder_users.rb@@ -29,7 +29,7 @@class AddUniquenessConstrainOnLastnameForGroupsAndPlaceholderUsers < ActiveRecord::Migration[6.1]def up# Partial unique index- execute <<-SQL+ execute <<-SQL.squishCREATE UNIQUE INDEX unique_lastname_for_groups_and_placeholder_users ONusers (lastname, type)WHERE (type = 'Group' OR type = 'PlaceholderUser');@@ -38,7 +38,7 @@ class AddUniquenessConstrainOnLastnameForGroupsAndPlaceholderUsers < ActiveRecordef down# Remove unique index- execute <<-SQL+ execute <<-SQL.squishDROP INDEX IF EXISTS unique_lastname_for_groups_and_placeholder_users;SQLenddiff --git a/db/migrate/20210331085058_migrate_sessions_unlogged.rb b/db/migrate/20210331085058_migrate_sessions_unlogged.rbindex ac0c1c21016..844e9464679 100644--- a/db/migrate/20210331085058_migrate_sessions_unlogged.rb+++ b/db/migrate/20210331085058_migrate_sessions_unlogged.rb@@ -31,7 +31,7 @@ class MigrateSessionsUnlogged < ActiveRecord::Migration[6.1]truncate :sessions# Set the table to unlogged- execute <<~SQL+ execute <<~SQL.squishALTER TABLE "sessions" SET UNLOGGEDSQLdiff --git a/db/migrate/20210512121322_make_project_identifier_unique.rb b/db/migrate/20210512121322_make_project_identifier_unique.rbindex 504df2ad324..e43297f2cde 100644--- a/db/migrate/20210512121322_make_project_identifier_unique.rb+++ b/db/migrate/20210512121322_make_project_identifier_unique.rb@@ -30,7 +30,7 @@ class MakeProjectIdentifierUnique < ActiveRecord::Migration[6.1]def changebeginremove_index :projects, :identifier- rescue => e+ rescue StandardError => eraise <<~MESSAGEFailed to remove an index from the OpenProject database: #{e.message}@@ -44,7 +44,7 @@ class MakeProjectIdentifierUnique < ActiveRecord::Migration[6.1]beginadd_index :projects, :identifier, unique: true- rescue => e+ rescue StandardError => eraise "You have a duplicate project identifier in your database: #{e.message}"endenddiff --git a/db/migrate/20210615150558_aggregate_journals.rb b/db/migrate/20210615150558_aggregate_journals.rbindex fb6b71fb302..46068af4612 100644--- a/db/migrate/20210615150558_aggregate_journals.rb+++ b/db/migrate/20210615150558_aggregate_journals.rb@@ -80,7 +80,7 @@ class AggregateJournals < ActiveRecord::Migration[6.1]enddef update_journal_notes(mismatched_journal)- sql = <<~SQL+ sql = <<~SQL.squishUPDATE journalsSET notes = :notesWHERE id = :id@@ -218,7 +218,7 @@ class AggregateJournals < ActiveRecord::Migration[6.1]# The journals that are considered for aggregation can also be reduced by providing a subselect. Doing so, one# can e.g. consider only the journals created after a certain time.def select_sql(journals_preselection)- <<~SQL+ <<~SQL.squish(#{Journal.from(start_group_journals_select(journals_preselection)).joins(end_group_journals_join(journals_preselection))@@ -229,7 +229,7 @@ class AggregateJournals < ActiveRecord::Migration[6.1]enddef user_or_time_group_breaking_journals_subselect(journals_preselection)- <<~SQL+ <<~SQL.squishSELECTpredecessor.*,row_number() OVER (ORDER BY predecessor.journable_type, predecessor.journable_id, predecessor.version ASC) #{group_number_alias}@@ -245,7 +245,7 @@ class AggregateJournals < ActiveRecord::Migration[6.1]enddef notes_journals_subselect(journals_preselection)- <<~SQL+ <<~SQL.squish(SELECTnotes_journals.*FROM #{journals_preselection} notes_journals@@ -258,13 +258,13 @@ class AggregateJournals < ActiveRecord::Migration[6.1]enddef end_group_journals_join(journals_preselection)- group_journals_join_condition = <<~SQL+ group_journals_join_condition = <<~SQL.squish#{start_group_journals_alias}.#{group_number_alias} = #{end_group_journals_alias}.#{group_number_alias} - 1AND #{start_group_journals_alias}.journable_type = #{end_group_journals_alias}.journable_typeAND #{start_group_journals_alias}.journable_id = #{end_group_journals_alias}.journable_idSQL- end_group_journals = <<~SQL+ end_group_journals = <<~SQL.squishRIGHT OUTER JOIN(#{user_or_time_group_breaking_journals_subselect(journals_preselection)}) #{end_group_journals_alias}ON #{group_journals_join_condition}@@ -279,14 +279,14 @@ class AggregateJournals < ActiveRecord::Migration[6.1]# This also works if we do not fetch the whole set of journals starting from the first journal but rather# start somewhere within the set. This might take place e.g. when fetching only the journals that are# created after a certain point in time which is done when displaying of the last month in the activity module.- breaking_journals_notes_join_condition = <<~SQL+ breaking_journals_notes_join_condition = <<~SQL.squishCOALESCE(#{start_group_journals_alias}.version, 0) + 1 <= #{notes_in_group_alias}.versionAND #{end_group_journals_alias}.version >= #{notes_in_group_alias}.versionAND #{end_group_journals_alias}.journable_type = #{notes_in_group_alias}.journable_typeAND #{end_group_journals_alias}.journable_id = #{notes_in_group_alias}.journable_idSQL- breaking_journals_notes = <<~SQL+ breaking_journals_notes = <<~SQL.squishLEFT OUTER JOIN#{notes_journals_subselect(journals_preselection)} #{notes_in_group_alias}ON #{breaking_journals_notes_join_condition}@@ -296,14 +296,14 @@ class AggregateJournals < ActiveRecord::Migration[6.1]enddef additional_notes_in_group_join(journals_preselection)- successor_journals_notes_join_condition = <<~SQL+ successor_journals_notes_join_condition = <<~SQL.squish#{notes_in_group_alias}.version < successor_notes.versionAND #{end_group_journals_alias}.version >= successor_notes.versionAND #{end_group_journals_alias}.journable_type = successor_notes.journable_typeAND #{end_group_journals_alias}.journable_id = successor_notes.journable_idSQL- successor_journals_notes = <<~SQL+ successor_journals_notes = <<~SQL.squishLEFT OUTER JOIN#{notes_journals_subselect(journals_preselection)} successor_notesON #{successor_journals_notes_join_condition}@@ -313,7 +313,7 @@ class AggregateJournals < ActiveRecord::Migration[6.1]enddef projection_list- projections = <<~SQL+ projections = <<~SQL.squish#{end_group_journals_alias}.journable_type,#{end_group_journals_alias}.journable_id,#{end_group_journals_alias}.user_id,@@ -347,7 +347,7 @@ class AggregateJournals < ActiveRecord::Migration[6.1]enddef attribute_projection(attribute)- <<~SQL+ <<~SQL.squishCASEWHEN successor_notes.version IS NOT NULL THEN #{notes_in_group_alias}.#{attribute}ELSE #{end_group_journals_alias}.#{attribute} END@@ -355,13 +355,13 @@ class AggregateJournals < ActiveRecord::Migration[6.1]enddef notes_id_projection- <<~SQL+ <<~SQL.squishCOALESCE(#{notes_in_group_alias}.id, #{end_group_journals_alias}.id)SQLenddef notes_projection- <<~SQL+ <<~SQL.squishCOALESCE(#{notes_in_group_alias}.notes, '')SQLend@@ -374,7 +374,7 @@ class AggregateJournals < ActiveRecord::Migration[6.1]elsif journablelimit = until_version ? "AND journals.version <= #{until_version}" : ''- <<~SQL+ <<~SQL.squish(SELECT * from journalsWHERE journals.journable_id = #{journable.id}@@ -385,7 +385,7 @@ class AggregateJournals < ActiveRecord::Migration[6.1]elsewhere = until_version ? "WHERE journals.version <= #{until_version}" : ''- <<~SQL+ <<~SQL.squish(SELECT * from journals #{where})SQLenddiff --git a/db/migrate/20210616145324_polymorphic_journal_data.rb b/db/migrate/20210616145324_polymorphic_journal_data.rbindex 982c8fc58c4..6bbb95a4c69 100644--- a/db/migrate/20210616145324_polymorphic_journal_data.rb+++ b/db/migrate/20210616145324_polymorphic_journal_data.rb@@ -38,7 +38,7 @@ class PolymorphicJournalData < ActiveRecord::Migration[6.1]add_data_and_remove_indexdata_journals.each do |journal_data|- execute <<~SQL+ execute <<~SQL.squishUPDATE journalsSET data_id = data.id, data_type = '#{journal_data.name}'FROM #{journal_data.table_name} data@@ -53,9 +53,10 @@ class PolymorphicJournalData < ActiveRecord::Migration[6.1]def downdata_journals.each do |journal_data|- add_column journal_data.table_name, :journal_id, :integer, index: true+ add_column journal_data.table_name, :journal_id, :integer+ add_index journal_data.table_name, :journal_id- execute <<~SQL+ execute <<~SQL.squishUPDATE #{journal_data.table_name} dataSET journal_id = journals.idFROM journalsdiff --git a/db/migrate/20210618125430_authors_as_watchers.rb b/db/migrate/20210618125430_authors_as_watchers.rbindex da092d1f8b4..4a30bbb0605 100644--- a/db/migrate/20210618125430_authors_as_watchers.rb+++ b/db/migrate/20210618125430_authors_as_watchers.rb@@ -34,7 +34,7 @@ class AuthorsAsWatchers < ActiveRecord::Migration[6.1]# * the author isn't locked and has the permission to see the work package# * member of the project in a role with the necessary permission OR# * non member in a public project and the non member role has the necessary permission- execute <<~SQL+ execute <<~SQL.squishINSERT INTO watchers (watchable_id,watchable_type,diff --git a/db/migrate/20210701073944_add_digest_setting.rb b/db/migrate/20210701073944_add_digest_setting.rbindex e19803bf7bb..a864ef79a21 100644--- a/db/migrate/20210701073944_add_digest_setting.rb+++ b/db/migrate/20210701073944_add_digest_setting.rb@@ -39,7 +39,7 @@ class AddDigestSetting < ActiveRecord::Migration[6.1]# also have been added not by the migration but in the cause of the functionality# the migration was added for.def remove_digest_channels- execute <<~SQL+ execute <<~SQL.squishDELETE FROMnotification_settingsWHEREdiff --git a/db/migrate/20210914065555_cleanup_notifications.rb b/db/migrate/20210914065555_cleanup_notifications.rbindex 4923aee6a14..2da582c378f 100644--- a/db/migrate/20210914065555_cleanup_notifications.rb+++ b/db/migrate/20210914065555_cleanup_notifications.rb@@ -56,7 +56,6 @@ class CleanupNotifications < ActiveRecord::Migration[6.1]endend- # rubocop:disable Metrics/AbcSizedef downchange_table :notifications, bulk: true do |t|t.boolean :read_mail, default: false, index: true@@ -84,5 +83,4 @@ class CleanupNotifications < ActiveRecord::Migration[6.1]name: 'index_notification_settings_unique_project'endend- # rubocop:enable Metrics/AbcSizeenddiff --git a/db/migrate/20211005135637_remove_invalid_group_users.rb b/db/migrate/20211005135637_remove_invalid_group_users.rbindex 20aaaf181ef..df267a9c9db 100644--- a/db/migrate/20211005135637_remove_invalid_group_users.rb+++ b/db/migrate/20211005135637_remove_invalid_group_users.rb@@ -28,6 +28,6 @@class RemoveInvalidGroupUsers < ActiveRecord::Migration[6.1]def up- GroupUser.left_outer_joins(:user).where(users: { id: nil }).destroy_all+ GroupUser.where.missing(:user).destroy_allendenddiff --git a/db/migrate/20211117195121_remove_destroyed_help_texts.rb b/db/migrate/20211117195121_remove_destroyed_help_texts.rbindex 6a349251c59..bd0279cf3f3 100644--- a/db/migrate/20211117195121_remove_destroyed_help_texts.rb+++ b/db/migrate/20211117195121_remove_destroyed_help_texts.rb@@ -30,7 +30,7 @@ class RemoveDestroyedHelpTexts < ActiveRecord::Migration[6.1]def upcustom_field_ids = CustomField.pluck(:id)- .map { |id| "custom_field_#{id}"}+ .map { |id| "custom_field_#{id}" }AttributeHelpText.where("attribute_name LIKE 'custom_field_%'")diff --git a/db/migrate/20220818074159_fix_deleted_data_journals.rb b/db/migrate/20220818074159_fix_deleted_data_journals.rbindex 4c71397c087..ff212b424d2 100644--- a/db/migrate/20220818074159_fix_deleted_data_journals.rb+++ b/db/migrate/20220818074159_fix_deleted_data_journals.rb@@ -29,7 +29,7 @@class FixDeletedDataJournals < ActiveRecord::Migration[7.0]def upget_missing_journals.each do |journable_type, relation|- puts "Cleaning up journals on #{journable_type}"+ Rails.logger.debug { "Cleaning up journals on #{journable_type}" }relation.find_each { |journal| fix_journal_data(journal) }@@ -120,9 +120,9 @@ class FixDeletedDataJournals < ActiveRecord::Migration[7.0]table_name = journal_class.table_namerelation = Journal- .joins("LEFT OUTER JOIN #{table_name} ON journals.data_type = '#{journal_class.to_s}' AND #{table_name}.id = journals.data_id")+ .joins("LEFT OUTER JOIN #{table_name} ON journals.data_type = '#{journal_class}' AND #{table_name}.id = journals.data_id").where("#{table_name}.id IS NULL")- .where(journable_type: journable_type)+ .where(journable_type:).where.not(data_type: nil) # Ignore special tenants with data_type nil errors.order('journals.version ASC').includes(:journable)diff --git a/modules/bim/db/migrate/20210521080035_update_xkt_to_version8.rb b/modules/bim/db/migrate/20210521080035_update_xkt_to_version8.rbindex 6cfb5dbf9b0..57fa697fd43 100644--- a/modules/bim/db/migrate/20210521080035_update_xkt_to_version8.rb+++ b/modules/bim/db/migrate/20210521080035_update_xkt_to_version8.rb@@ -98,12 +98,10 @@ class UpdateXktToVersion8 < ActiveRecord::Migration[6.1]enddef get_file(name)- path = 'modules/bim/files/ifc_models/' + name + '/'- file_name = name + '.xkt'+ path = "modules/bim/files/ifc_models/#{name}/"+ file_name = "#{name}.xkt"return unless File.exist?(path + file_name)- File.new(File.join(Rails.root,- path,- file_name))+ File.new(Rails.root.join(path, file_name))endenddiff --git a/modules/budgets/db/migrate/20200810152654_rename_cost_object_to_budget.rb b/modules/budgets/db/migrate/20200810152654_rename_cost_object_to_budget.rbindex b0ed916fb06..a43a0af9966 100644--- a/modules/budgets/db/migrate/20200810152654_rename_cost_object_to_budget.rb+++ b/modules/budgets/db/migrate/20200810152654_rename_cost_object_to_budget.rb@@ -39,31 +39,31 @@ class RenameCostObjectToBudget < ActiveRecord::Migration[6.0]remove_column :cost_objects, :typerename_table :cost_objects, :budgets- execute <<~SQL+ execute <<~SQL.squishUPDATE typesSET attribute_groups = REGEXP_REPLACE(attribute_groups, ' cost_object', ' budget')WHERE attribute_groups LIKE '%cost_object%'SQL- execute <<~SQL+ execute <<~SQL.squishUPDATE role_permissionsSET permission = 'view_budgets'WHERE permission = 'view_cost_objects'SQL- execute <<~SQL+ execute <<~SQL.squishUPDATE role_permissionsSET permission = 'edit_budgets'WHERE permission = 'edit_cost_objects'SQL- execute <<~SQL+ execute <<~SQL.squishUPDATE journalsSET activity_type = 'budgets'WHERE activity_type = 'cost_objects'SQL- execute <<~SQL+ execute <<~SQL.squishUPDATE attachmentsSET container_type = 'Budget'WHERE container_type = 'CostObject'@@ -103,31 +103,31 @@ class RenameCostObjectToBudget < ActiveRecord::Migration[6.0]rename_in_queries('budget', 'cost_object')rename_in_cost_queries('Budget', 'CostObject')- execute <<~SQL+ execute <<~SQL.squishUPDATE attachmentsSET container_type = 'CostObject'WHERE container_type = 'Budget'SQL- execute <<~SQL+ execute <<~SQL.squishUPDATE journalsSET activity_type = 'cost_objects'WHERE activity_type = 'budgets'SQL- execute <<~SQL+ execute <<~SQL.squishUPDATE role_permissionsSET permission = 'view_cost_objects'WHERE permission = 'view_budgets'SQL- execute <<~SQL+ execute <<~SQL.squishUPDATE role_permissionsSET permission = 'edit_cost_objects'WHERE permission = 'edit_budgets'SQL- execute <<~SQL+ execute <<~SQL.squishUPDATE typesSET attribute_groups = REGEXP_REPLACE(attribute_groups, ' budget', ' cost_object')WHERE attribute_groups LIKE '%budget%'@@ -135,7 +135,7 @@ class RenameCostObjectToBudget < ActiveRecord::Migration[6.0]add_column :budgets, :type, :string- execute <<~SQL+ execute <<~SQL.squishUPDATE budgets SET type = 'VariableCostObject'SQL@@ -145,31 +145,31 @@ class RenameCostObjectToBudget < ActiveRecord::Migration[6.0]enddef rename_in_queries(old, new)- execute <<~SQL+ execute <<~SQL.squishUPDATE queriesSET filters = REGEXP_REPLACE(filters, '#{old}_id:', '#{new}_id:')WHERE filters LIKE '%#{old}_id%'SQL- execute <<~SQL+ execute <<~SQL.squishUPDATE queriesSET sort_criteria = REGEXP_REPLACE(sort_criteria, '#{old}', '#{new}')WHERE sort_criteria LIKE '%#{old}%'SQL- execute <<~SQL+ execute <<~SQL.squishUPDATE queriesSET column_names = REGEXP_REPLACE(column_names, '#{old}', '#{new}')WHERE column_names LIKE '%#{old}%'SQL- execute <<~SQL+ execute <<~SQL.squishUPDATE queriesSET group_by = REGEXP_REPLACE(group_by, '#{old}', '#{new}')WHERE group_by LIKE '%#{old}%'SQL- execute <<~SQL+ execute <<~SQL.squishUPDATE queriesSET timeline_labels = REGEXP_REPLACE(timeline_labels, '#{old.camelize(:lower)}', '#{new.camelize(:lower)}')WHERE timeline_labels LIKE '%#{old.camelize(:lower)}%'@@ -177,7 +177,7 @@ class RenameCostObjectToBudget < ActiveRecord::Migration[6.0]enddef rename_in_cost_queries(old, new)- execute <<~SQL+ execute <<~SQL.squishUPDATE cost_queriesSET serialized = REGEXP_REPLACE(serialized, '#{old}', '#{new}')WHERE serialized LIKE '%#{old}%'@@ -189,6 +189,6 @@ class RenameCostObjectToBudget < ActiveRecord::Migration[6.0]table = connection.quote table_namesql = "SELECT indexname FROM pg_indexes WHERE tablename = #{table} AND indexdef LIKE '%(id)';"- connection.execute(sql).map { |row| row['indexname'] }.compact.first+ connection.execute(sql).pluck('indexname').compact.firstendenddiff --git a/modules/costs/db/migrate/20200327074416_rename_fixed_version_in_cost_query.rb b/modules/costs/db/migrate/20200327074416_rename_fixed_version_in_cost_query.rbindex 62d26277b78..ec026c5e920 100644--- a/modules/costs/db/migrate/20200327074416_rename_fixed_version_in_cost_query.rb+++ b/modules/costs/db/migrate/20200327074416_rename_fixed_version_in_cost_query.rb@@ -37,7 +37,7 @@ class RenameFixedVersionInCostQuery < ActiveRecord::Migration[6.0]def rename_query_attributes(from, to)ActiveRecord::Base.connection.exec_query(- <<-SQL+ <<-SQL.squishUPDATEcost_queries q_sinkSETdiff --git a/modules/job_status/db/migrate/20200422105623_add_job_status.rb b/modules/job_status/db/migrate/20200422105623_add_job_status.rbindex 6a7bf6730a4..f008987da86 100644--- a/modules/job_status/db/migrate/20200422105623_add_job_status.rb+++ b/modules/job_status/db/migrate/20200422105623_add_job_status.rb@@ -28,7 +28,7 @@class AddJobStatus < ActiveRecord::Migration[6.0]def up- execute <<-SQL+ execute <<-SQL.squishCREATE TYPE delayed_job_status AS ENUM ('in_queue', 'error', 'in_process', 'success', 'failure');SQL@@ -46,7 +46,7 @@ class AddJobStatus < ActiveRecord::Migration[6.0]def downdrop_table :delayed_job_statuses- execute <<-SQL+ execute <<-SQL.squishDROP TYPE delayed_job_status;SQLenddiff --git a/modules/job_status/db/migrate/20200610124259_extend_job_status.rb b/modules/job_status/db/migrate/20200610124259_extend_job_status.rbindex 02299801658..05df41813e5 100644--- a/modules/job_status/db/migrate/20200610124259_extend_job_status.rb+++ b/modules/job_status/db/migrate/20200610124259_extend_job_status.rb@@ -33,7 +33,7 @@ class ExtendJobStatus < ActiveRecord::Migration[6.0]def changereversible do |dir|dir.up do- execute <<-SQL+ execute <<-SQL.squishALTER TYPE delayed_job_status ADD VALUE IF NOT EXISTS 'cancelled';SQLenddiff --git a/modules/two_factor_authentication/db/migrate/20120214103300_aggregated_mobile_otp_migrations.rb b/modules/two_factor_authentication/db/migrate/20120214103300_aggregated_mobile_otp_migrations.rbindex b25dc0b3a79..25790e122c5 100644--- a/modules/two_factor_authentication/db/migrate/20120214103300_aggregated_mobile_otp_migrations.rb+++ b/modules/two_factor_authentication/db/migrate/20120214103300_aggregated_mobile_otp_migrations.rb@@ -26,20 +26,20 @@# See COPYRIGHT and LICENSE files for more details.#++-require Rails.root.to_s + '/db/migrate/migration_utils/migration_squasher'-require Rails.root.to_s + '/db/migrate/migration_utils/setting_renamer'+require "#{Rails.root}/db/migrate/migration_utils/migration_squasher"+require "#{Rails.root}/db/migrate/migration_utils/setting_renamer"require 'open_project/plugins/migration_mapping'# This migration aggregates the migrations detailed in MIGRATION_FILESclass AggregatedMobileOtpMigrations < ActiveRecord::Migration[5.0]- MIGRATION_FILES = <<-MIGRATIONS+ MIGRATION_FILES = <<-MIGRATIONS.freeze001_add_user_phone.rb002_create_extended_tokens.rb003_remove_user_phone.rb004_add_user_verified_phone_unverified_phone.rbMIGRATIONS- OLD_PLUGIN_NAME = "redmine_two_factor_authentication_authentication"+ OLD_PLUGIN_NAME = "redmine_two_factor_authentication_authentication".freezedef upmigration_names = OpenProject::Plugins::MigrationMapping.migration_files_to_migration_names(MIGRATION_FILES, OLD_PLUGIN_NAME)diff --git a/modules/two_factor_authentication/db/migrate/20171023190036_model_reorganization.rb b/modules/two_factor_authentication/db/migrate/20171023190036_model_reorganization.rbindex 82a6acf75db..8bac7fd7e7a 100644--- a/modules/two_factor_authentication/db/migrate/20171023190036_model_reorganization.rb+++ b/modules/two_factor_authentication/db/migrate/20171023190036_model_reorganization.rb@@ -63,7 +63,7 @@ class ModelReorganization < ActiveRecord::Migration[5.0]User.transaction doUser.find_each do |user|phone = user.verified_phone || user.unverified_phone- next unless phone.present?+ next if phone.blank?sms = ::TwoFactorAuthentication::Device::Sms.create!(user_id: user.id,