From 48697451f2b0ba517c7d1861af3897b4ace896f9 Mon Sep 17 00:00:00 2001 From: Simon Brandhof Date: Fri, 17 Jul 2015 10:13:17 +0200 Subject: [PATCH] SONAR-6716 remove data migrations of v4.4 --- .../db/migrations/MigrationStepModule.java | 42 +----- .../CompleteIssueMessageMigrationStep.java | 58 ------- .../v42/PackageKeysMigrationStep.java | 74 --------- .../db/migrations/v42/package-info.java | 24 --- ...onvertIssueDebtToMinutesMigrationStep.java | 79 ---------- .../DevelopmentCostMeasuresMigrationStep.java | 75 --------- .../v43/IssueChangelogMigrationStep.java | 113 -------------- ...ssuesOnRemovedComponentsMigrationStep.java | 68 --------- .../v43/RequirementMeasuresMigrationStep.java | 61 -------- .../TechnicalDebtMeasuresMigrationStep.java | 108 ------------- .../migrations/v43/WorkDurationConvertor.java | 86 ----------- .../db/migrations/v43/package-info.java | 24 --- .../v44/ChangeLogMigrationStep.java | 129 ---------------- .../ConvertProfileMeasuresMigrationStep.java | 95 ------------ .../v44/FeedQProfileDatesMigrationStep.java | 71 --------- .../v44/FeedQProfileKeysMigrationStep.java | 87 ----------- .../v44/IssueActionPlanKeyMigrationStep.java | 70 --------- .../v44/MeasureDataMigrationStep.java | 63 -------- .../db/migrations/v44/package-info.java | 24 --- ...leParameterDefaultValuesMigrationStep.java | 121 --------------- ...easuresOnDeletedProfilesMigrationStep.java | 60 -------- .../db/migrations/v45/package-info.java | 24 --- .../migrations/MigrationStepModuleTest.java | 2 +- .../CompleteIssueMessageMigrationTest.java | 43 ------ .../v42/PackageKeysMigrationTest.java | 43 ------ ...rtIssueDebtToMinutesMigrationStepTest.java | 81 ---------- ...elopmentCostMeasuresMigrationStepTest.java | 71 --------- .../v43/IssueChangelogMigrationStepTest.java | 101 ------------- ...sOnRemovedComponentsMigrationStepTest.java | 62 -------- .../RequirementMeasuresMigrationStepTest.java | 49 ------ ...echnicalDebtMeasuresMigrationStepTest.java | 90 ----------- .../v43/WorkDurationConvertorTest.java | 103 ------------- .../v44/ChangeLogMigrationTest.java | 66 -------- .../ConvertProfileMeasuresMigrationTest.java | 114 -------------- .../v44/FeedQProfileDatesMigrationTest.java | 76 ---------- .../v44/FeedQProfileKeysMigrationTest.java | 69 --------- .../v44/IssueActionPlanKeyMigrationTest.java | 62 -------- .../v44/MeasureDataMigrationTest.java | 53 ------- ...leParameterDefaultValuesMigrationTest.java | 67 --------- ...easuresOnDeletedProfilesMigrationTest.java | 69 --------- .../after.xml | 26 ---- .../before.xml | 26 ---- .../schema.sql | 47 ------ .../v42/PackageKeysMigrationTest/after.xml | 23 --- .../v42/PackageKeysMigrationTest/before.xml | 23 --- .../v42/PackageKeysMigrationTest/schema.sql | 18 --- .../migrate_issues_debt.xml | 44 ------ .../migrate_issues_debt_result.xml | 44 ------ .../schema.sql | 28 ---- .../metric_does_not_exist.xml | 12 -- .../metric_does_not_exist_result.xml | 12 -- .../migrate_dev_cost_measures.xml | 12 -- .../migrate_dev_cost_measures_result.xml | 8 - .../schema.sql | 45 ------ .../migrate_issue_changelog_debt.xml | 10 -- .../migrate_issue_changelog_debt_result.xml | 11 -- .../schema.sql | 13 -- .../migrate_issues.xml | 35 ----- .../migrate_issues_result.xml | 27 ---- .../schema.sql | 46 ------ .../migrate_measures_on_requirements.xml | 44 ------ ...igrate_measures_on_requirements_result.xml | 27 ---- .../schema.sql | 44 ------ .../migrate_new_technical_debt_measures.xml | 29 ---- ...ate_new_technical_debt_measures_result.xml | 21 --- .../migrate_nothing.xml | 11 -- .../migrate_nothing_result.xml | 11 -- .../migrate_sqale_measures.xml | 64 -------- .../migrate_sqale_measures_result.xml | 41 ----- .../migrate_technical_debt_measures.xml | 35 ----- ...migrate_technical_debt_measures_result.xml | 27 ---- .../schema.sql | 45 ------ .../active_rules_changes.xml | 43 ------ .../migrate_when_no_changelog.xml | 18 --- .../v44/ChangeLogMigrationTest/schema.sql | 113 -------------- .../before.xml | 56 ------- .../measure_on_deleted_profile.xml | 31 ---- .../missing_profile_version.xml | 31 ---- .../schema.sql | 108 ------------- .../feed_created_at_and_updated_at.xml | 21 --- .../FeedQProfileDatesMigrationTest/schema.sql | 30 ---- .../use_default_dates_when_no_changes.xml | 12 -- .../feed_keys.xml | 15 -- .../FeedQProfileKeysMigrationTest/schema.sql | 12 -- .../migrate_issues_action_plan_key.xml | 22 --- .../migrate_issues_action_plan_key_result.xml | 19 --- .../schema.sql | 41 ----- .../migrate_measure_data-result.xml | 23 --- .../migrate_measure_data.xml | 24 --- .../v44/MeasureDataMigrationTest/schema.sql | 34 ----- .../db/migrate/215_create_notifications.rb | 1 - .../430_remove_notifications_created_at.rb | 30 ---- .../db/migrate/431_migrate_users_names.rb | 43 ------ ...p_by_key_search_in_measure_filters_data.rb | 38 ----- ...sqale_pyramid_to_technical_debt_pyramid.rb | 35 ----- .../db/migrate/444_resize_timeline_widgets.rb | 44 ------ ...0_add_unique_constraint_to_groups_users.rb | 14 -- .../db/migrate/462_migrate_characteristics.rb | 142 ------------------ .../466_add_network_use_sub_characteristic.rb | 47 ------ .../migrate/481_copy_rule_notes_to_rules.rb | 80 ---------- .../db/migrate/482_purge_group_roles.rb | 44 ------ ...rameters_name_to_active_rule_parameters.rb | 47 ------ .../485_update_rules_without_severity.rb | 34 ----- .../db/migrate/490_migrate_package_keys.rb | 31 ---- ...te_display_treemap_from_measure_filters.rb | 38 ----- ...delete_properties_on_unknown_components.rb | 34 ----- ...te_base_id_to_base_from_measure_filters.rb | 43 ------ .../migrate/496_delete_language_property.rb | 34 ----- ...ue_message_by_rule_name_when_no_message.rb | 30 ---- .../498_remove_duplicate_active_rules.rb | 54 ------- .../512_convert_alerts_to_quality_gates.rb | 78 ---------- .../513_convert_issue_debt_to_minutes.rb | 30 ---- ..._update_issue_changelog_debt_to_minutes.rb | 30 ---- .../515_update_measures_debt_to_minutes.rb | 30 ---- .../516_update_development_cost_to_minutes.rb | 30 ---- ...units_by_size_point_property_to_minutes.rb | 58 ------- ...18_update_conditions_on_debt_to_minutes.rb | 65 -------- ...date_measure_filters_on_debt_to_minutes.rb | 69 --------- .../521_update_requirement_measures.rb | 30 ---- ...ability_and_sub_characteristic_resource.rb | 69 --------- ...date_sub_characteristic_network_use_key.rb | 44 ------ ...t_resolved_issues_on_removed_components.rb | 31 ---- .../526_remove_unshared_active_dashboards.rb | 44 ------ ...erge_measure_data_into_project_measures.rb | 13 +- ..._action_plan_key_on_removed_action_plan.rb | 31 ---- .../migrate/539_insert_active_rule_dates.rb | 41 ----- ...541_add_unique_index_on_active_rule_key.rb | 28 ---- ...rename_rules_cardinality_to_is_template.rb | 4 - .../db/migrate/546_inverse_rule_key_index.rb | 99 ------------ ...s_extended_description_with_description.rb | 44 ------ .../db/migrate/549_feed_qprofile_keys.rb | 2 - .../migrate/550_convert_profile_measures.rb | 41 ----- .../migrate/551_update_logs_to_activities.rb | 31 ---- .../db/migrate/553_feed_qprofile_dates.rb | 30 ---- .../554_add_missing_user_unique_index.rb | 108 ------------- .../556_fill_rules_empty_name_and_desc.rb | 45 ------ ...pdate_existing_rules_description_format.rb | 35 ----- ...d_missing_rule_parameter_default_values.rb | 30 ---- ...584_delete_measures_on_deleted_profiles.rb | 30 ---- .../src/main/java/org/sonar/db/MyBatis.java | 3 +- .../org/sonar/db/version/DatabaseVersion.java | 2 +- .../org/sonar/db/version/v44/ChangeLog.java | 118 --------------- .../db/version/v44/Migration44Mapper.java | 63 -------- .../sonar/db/version/v44/ProfileMeasure.java | 50 ------ .../sonar/db/version/v44/QProfileDto44.java | 60 -------- .../sonar/db/version/v44/package-info.java | 25 --- .../db/version/v44/Migration44Mapper.xml | 105 ------------- .../sonar/db/version/v44/ChangeLogTest.java | 37 ----- .../db/version/v44/ProfileMeasureTest.java | 37 ----- 149 files changed, 5 insertions(+), 6917 deletions(-) delete mode 100644 server/sonar-server/src/main/java/org/sonar/server/db/migrations/v42/CompleteIssueMessageMigrationStep.java delete mode 100644 server/sonar-server/src/main/java/org/sonar/server/db/migrations/v42/PackageKeysMigrationStep.java delete mode 100644 server/sonar-server/src/main/java/org/sonar/server/db/migrations/v42/package-info.java delete mode 100644 server/sonar-server/src/main/java/org/sonar/server/db/migrations/v43/ConvertIssueDebtToMinutesMigrationStep.java delete mode 100644 server/sonar-server/src/main/java/org/sonar/server/db/migrations/v43/DevelopmentCostMeasuresMigrationStep.java delete mode 100644 server/sonar-server/src/main/java/org/sonar/server/db/migrations/v43/IssueChangelogMigrationStep.java delete mode 100644 server/sonar-server/src/main/java/org/sonar/server/db/migrations/v43/NotResolvedIssuesOnRemovedComponentsMigrationStep.java delete mode 100644 server/sonar-server/src/main/java/org/sonar/server/db/migrations/v43/RequirementMeasuresMigrationStep.java delete mode 100644 server/sonar-server/src/main/java/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationStep.java delete mode 100644 server/sonar-server/src/main/java/org/sonar/server/db/migrations/v43/WorkDurationConvertor.java delete mode 100644 server/sonar-server/src/main/java/org/sonar/server/db/migrations/v43/package-info.java delete mode 100644 server/sonar-server/src/main/java/org/sonar/server/db/migrations/v44/ChangeLogMigrationStep.java delete mode 100644 server/sonar-server/src/main/java/org/sonar/server/db/migrations/v44/ConvertProfileMeasuresMigrationStep.java delete mode 100644 server/sonar-server/src/main/java/org/sonar/server/db/migrations/v44/FeedQProfileDatesMigrationStep.java delete mode 100644 server/sonar-server/src/main/java/org/sonar/server/db/migrations/v44/FeedQProfileKeysMigrationStep.java delete mode 100644 server/sonar-server/src/main/java/org/sonar/server/db/migrations/v44/IssueActionPlanKeyMigrationStep.java delete mode 100644 server/sonar-server/src/main/java/org/sonar/server/db/migrations/v44/MeasureDataMigrationStep.java delete mode 100644 server/sonar-server/src/main/java/org/sonar/server/db/migrations/v44/package-info.java delete mode 100644 server/sonar-server/src/main/java/org/sonar/server/db/migrations/v45/AddMissingRuleParameterDefaultValuesMigrationStep.java delete mode 100644 server/sonar-server/src/main/java/org/sonar/server/db/migrations/v45/DeleteMeasuresOnDeletedProfilesMigrationStep.java delete mode 100644 server/sonar-server/src/main/java/org/sonar/server/db/migrations/v45/package-info.java delete mode 100644 server/sonar-server/src/test/java/org/sonar/server/db/migrations/v42/CompleteIssueMessageMigrationTest.java delete mode 100644 server/sonar-server/src/test/java/org/sonar/server/db/migrations/v42/PackageKeysMigrationTest.java delete mode 100644 server/sonar-server/src/test/java/org/sonar/server/db/migrations/v43/ConvertIssueDebtToMinutesMigrationStepTest.java delete mode 100644 server/sonar-server/src/test/java/org/sonar/server/db/migrations/v43/DevelopmentCostMeasuresMigrationStepTest.java delete mode 100644 server/sonar-server/src/test/java/org/sonar/server/db/migrations/v43/IssueChangelogMigrationStepTest.java delete mode 100644 server/sonar-server/src/test/java/org/sonar/server/db/migrations/v43/NotResolvedIssuesOnRemovedComponentsMigrationStepTest.java delete mode 100644 server/sonar-server/src/test/java/org/sonar/server/db/migrations/v43/RequirementMeasuresMigrationStepTest.java delete mode 100644 server/sonar-server/src/test/java/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationStepTest.java delete mode 100644 server/sonar-server/src/test/java/org/sonar/server/db/migrations/v43/WorkDurationConvertorTest.java delete mode 100644 server/sonar-server/src/test/java/org/sonar/server/db/migrations/v44/ChangeLogMigrationTest.java delete mode 100644 server/sonar-server/src/test/java/org/sonar/server/db/migrations/v44/ConvertProfileMeasuresMigrationTest.java delete mode 100644 server/sonar-server/src/test/java/org/sonar/server/db/migrations/v44/FeedQProfileDatesMigrationTest.java delete mode 100644 server/sonar-server/src/test/java/org/sonar/server/db/migrations/v44/FeedQProfileKeysMigrationTest.java delete mode 100644 server/sonar-server/src/test/java/org/sonar/server/db/migrations/v44/IssueActionPlanKeyMigrationTest.java delete mode 100644 server/sonar-server/src/test/java/org/sonar/server/db/migrations/v44/MeasureDataMigrationTest.java delete mode 100644 server/sonar-server/src/test/java/org/sonar/server/db/migrations/v45/AddMissingRuleParameterDefaultValuesMigrationTest.java delete mode 100644 server/sonar-server/src/test/java/org/sonar/server/db/migrations/v45/DeleteMeasuresOnDeletedProfilesMigrationTest.java delete mode 100644 server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v42/CompleteIssueMessageMigrationTest/after.xml delete mode 100644 server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v42/CompleteIssueMessageMigrationTest/before.xml delete mode 100644 server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v42/CompleteIssueMessageMigrationTest/schema.sql delete mode 100644 server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v42/PackageKeysMigrationTest/after.xml delete mode 100644 server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v42/PackageKeysMigrationTest/before.xml delete mode 100644 server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v42/PackageKeysMigrationTest/schema.sql delete mode 100644 server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/ConvertIssueDebtToMinutesMigrationStepTest/migrate_issues_debt.xml delete mode 100644 server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/ConvertIssueDebtToMinutesMigrationStepTest/migrate_issues_debt_result.xml delete mode 100644 server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/ConvertIssueDebtToMinutesMigrationStepTest/schema.sql delete mode 100644 server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/DevelopmentCostMeasuresMigrationStepTest/metric_does_not_exist.xml delete mode 100644 server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/DevelopmentCostMeasuresMigrationStepTest/metric_does_not_exist_result.xml delete mode 100644 server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/DevelopmentCostMeasuresMigrationStepTest/migrate_dev_cost_measures.xml delete mode 100644 server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/DevelopmentCostMeasuresMigrationStepTest/migrate_dev_cost_measures_result.xml delete mode 100644 server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/DevelopmentCostMeasuresMigrationStepTest/schema.sql delete mode 100644 server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/IssueChangelogMigrationStepTest/migrate_issue_changelog_debt.xml delete mode 100644 server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/IssueChangelogMigrationStepTest/migrate_issue_changelog_debt_result.xml delete mode 100644 server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/IssueChangelogMigrationStepTest/schema.sql delete mode 100644 server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/NotResolvedIssuesOnRemovedComponentsMigrationStepTest/migrate_issues.xml delete mode 100644 server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/NotResolvedIssuesOnRemovedComponentsMigrationStepTest/migrate_issues_result.xml delete mode 100644 server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/NotResolvedIssuesOnRemovedComponentsMigrationStepTest/schema.sql delete mode 100644 server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/RequirementMeasuresMigrationStepTest/migrate_measures_on_requirements.xml delete mode 100644 server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/RequirementMeasuresMigrationStepTest/migrate_measures_on_requirements_result.xml delete mode 100644 server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/RequirementMeasuresMigrationStepTest/schema.sql delete mode 100644 server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationStepTest/migrate_new_technical_debt_measures.xml delete mode 100644 server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationStepTest/migrate_new_technical_debt_measures_result.xml delete mode 100644 server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationStepTest/migrate_nothing.xml delete mode 100644 server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationStepTest/migrate_nothing_result.xml delete mode 100644 server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationStepTest/migrate_sqale_measures.xml delete mode 100644 server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationStepTest/migrate_sqale_measures_result.xml delete mode 100644 server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationStepTest/migrate_technical_debt_measures.xml delete mode 100644 server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationStepTest/migrate_technical_debt_measures_result.xml delete mode 100644 server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationStepTest/schema.sql delete mode 100644 server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/ChangeLogMigrationTest/active_rules_changes.xml delete mode 100644 server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/ChangeLogMigrationTest/migrate_when_no_changelog.xml delete mode 100644 server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/ChangeLogMigrationTest/schema.sql delete mode 100644 server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/ConvertProfileMeasuresMigrationTest/before.xml delete mode 100644 server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/ConvertProfileMeasuresMigrationTest/measure_on_deleted_profile.xml delete mode 100644 server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/ConvertProfileMeasuresMigrationTest/missing_profile_version.xml delete mode 100644 server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/ConvertProfileMeasuresMigrationTest/schema.sql delete mode 100644 server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/FeedQProfileDatesMigrationTest/feed_created_at_and_updated_at.xml delete mode 100644 server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/FeedQProfileDatesMigrationTest/schema.sql delete mode 100644 server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/FeedQProfileDatesMigrationTest/use_default_dates_when_no_changes.xml delete mode 100644 server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/FeedQProfileKeysMigrationTest/feed_keys.xml delete mode 100644 server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/FeedQProfileKeysMigrationTest/schema.sql delete mode 100644 server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/IssueActionPlanKeyMigrationTest/migrate_issues_action_plan_key.xml delete mode 100644 server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/IssueActionPlanKeyMigrationTest/migrate_issues_action_plan_key_result.xml delete mode 100644 server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/IssueActionPlanKeyMigrationTest/schema.sql delete mode 100644 server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/MeasureDataMigrationTest/migrate_measure_data-result.xml delete mode 100644 server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/MeasureDataMigrationTest/migrate_measure_data.xml delete mode 100644 server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/MeasureDataMigrationTest/schema.sql delete mode 100644 server/sonar-web/src/main/webapp/WEB-INF/db/migrate/430_remove_notifications_created_at.rb delete mode 100644 server/sonar-web/src/main/webapp/WEB-INF/db/migrate/431_migrate_users_names.rb delete mode 100644 server/sonar-web/src/main/webapp/WEB-INF/db/migrate/440_replace_key_regexp_by_key_search_in_measure_filters_data.rb delete mode 100644 server/sonar-web/src/main/webapp/WEB-INF/db/migrate/443_rename_widget_sqale_pyramid_to_technical_debt_pyramid.rb delete mode 100644 server/sonar-web/src/main/webapp/WEB-INF/db/migrate/444_resize_timeline_widgets.rb delete mode 100644 server/sonar-web/src/main/webapp/WEB-INF/db/migrate/462_migrate_characteristics.rb delete mode 100644 server/sonar-web/src/main/webapp/WEB-INF/db/migrate/466_add_network_use_sub_characteristic.rb delete mode 100644 server/sonar-web/src/main/webapp/WEB-INF/db/migrate/481_copy_rule_notes_to_rules.rb delete mode 100644 server/sonar-web/src/main/webapp/WEB-INF/db/migrate/482_purge_group_roles.rb delete mode 100644 server/sonar-web/src/main/webapp/WEB-INF/db/migrate/484_copy_rule_parameters_name_to_active_rule_parameters.rb delete mode 100644 server/sonar-web/src/main/webapp/WEB-INF/db/migrate/485_update_rules_without_severity.rb delete mode 100644 server/sonar-web/src/main/webapp/WEB-INF/db/migrate/490_migrate_package_keys.rb delete mode 100644 server/sonar-web/src/main/webapp/WEB-INF/db/migrate/493_delete_display_treemap_from_measure_filters.rb delete mode 100644 server/sonar-web/src/main/webapp/WEB-INF/db/migrate/494_delete_properties_on_unknown_components.rb delete mode 100644 server/sonar-web/src/main/webapp/WEB-INF/db/migrate/495_migrate_base_id_to_base_from_measure_filters.rb delete mode 100644 server/sonar-web/src/main/webapp/WEB-INF/db/migrate/496_delete_language_property.rb delete mode 100644 server/sonar-web/src/main/webapp/WEB-INF/db/migrate/497_update_issue_message_by_rule_name_when_no_message.rb delete mode 100644 server/sonar-web/src/main/webapp/WEB-INF/db/migrate/498_remove_duplicate_active_rules.rb delete mode 100644 server/sonar-web/src/main/webapp/WEB-INF/db/migrate/512_convert_alerts_to_quality_gates.rb delete mode 100644 server/sonar-web/src/main/webapp/WEB-INF/db/migrate/513_convert_issue_debt_to_minutes.rb delete mode 100644 server/sonar-web/src/main/webapp/WEB-INF/db/migrate/514_update_issue_changelog_debt_to_minutes.rb delete mode 100644 server/sonar-web/src/main/webapp/WEB-INF/db/migrate/515_update_measures_debt_to_minutes.rb delete mode 100644 server/sonar-web/src/main/webapp/WEB-INF/db/migrate/516_update_development_cost_to_minutes.rb delete mode 100644 server/sonar-web/src/main/webapp/WEB-INF/db/migrate/517_update_work_units_by_size_point_property_to_minutes.rb delete mode 100644 server/sonar-web/src/main/webapp/WEB-INF/db/migrate/518_update_conditions_on_debt_to_minutes.rb delete mode 100644 server/sonar-web/src/main/webapp/WEB-INF/db/migrate/519_update_measure_filters_on_debt_to_minutes.rb delete mode 100644 server/sonar-web/src/main/webapp/WEB-INF/db/migrate/521_update_requirement_measures.rb delete mode 100644 server/sonar-web/src/main/webapp/WEB-INF/db/migrate/523_add_characteristic_reusability_and_sub_characteristic_resource.rb delete mode 100644 server/sonar-web/src/main/webapp/WEB-INF/db/migrate/524_update_sub_characteristic_network_use_key.rb delete mode 100644 server/sonar-web/src/main/webapp/WEB-INF/db/migrate/525_update_not_resolved_issues_on_removed_components.rb delete mode 100644 server/sonar-web/src/main/webapp/WEB-INF/db/migrate/526_remove_unshared_active_dashboards.rb delete mode 100644 server/sonar-web/src/main/webapp/WEB-INF/db/migrate/531_update_issues_action_plan_key_on_removed_action_plan.rb delete mode 100644 server/sonar-web/src/main/webapp/WEB-INF/db/migrate/539_insert_active_rule_dates.rb delete mode 100644 server/sonar-web/src/main/webapp/WEB-INF/db/migrate/546_inverse_rule_key_index.rb delete mode 100644 server/sonar-web/src/main/webapp/WEB-INF/db/migrate/547_merge_custom_rules_extended_description_with_description.rb delete mode 100644 server/sonar-web/src/main/webapp/WEB-INF/db/migrate/550_convert_profile_measures.rb delete mode 100644 server/sonar-web/src/main/webapp/WEB-INF/db/migrate/551_update_logs_to_activities.rb delete mode 100644 server/sonar-web/src/main/webapp/WEB-INF/db/migrate/553_feed_qprofile_dates.rb delete mode 100644 server/sonar-web/src/main/webapp/WEB-INF/db/migrate/554_add_missing_user_unique_index.rb delete mode 100644 server/sonar-web/src/main/webapp/WEB-INF/db/migrate/556_fill_rules_empty_name_and_desc.rb delete mode 100644 server/sonar-web/src/main/webapp/WEB-INF/db/migrate/582_update_existing_rules_description_format.rb delete mode 100644 server/sonar-web/src/main/webapp/WEB-INF/db/migrate/583_add_missing_rule_parameter_default_values.rb delete mode 100644 server/sonar-web/src/main/webapp/WEB-INF/db/migrate/584_delete_measures_on_deleted_profiles.rb delete mode 100644 sonar-db/src/main/java/org/sonar/db/version/v44/ChangeLog.java delete mode 100644 sonar-db/src/main/java/org/sonar/db/version/v44/Migration44Mapper.java delete mode 100644 sonar-db/src/main/java/org/sonar/db/version/v44/ProfileMeasure.java delete mode 100644 sonar-db/src/main/java/org/sonar/db/version/v44/QProfileDto44.java delete mode 100644 sonar-db/src/main/java/org/sonar/db/version/v44/package-info.java delete mode 100644 sonar-db/src/main/resources/org/sonar/db/version/v44/Migration44Mapper.xml delete mode 100644 sonar-db/src/test/java/org/sonar/db/version/v44/ChangeLogTest.java delete mode 100644 sonar-db/src/test/java/org/sonar/db/version/v44/ProfileMeasureTest.java diff --git a/server/sonar-server/src/main/java/org/sonar/server/db/migrations/MigrationStepModule.java b/server/sonar-server/src/main/java/org/sonar/server/db/migrations/MigrationStepModule.java index f20252a9e75..7685c9f02e9 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/db/migrations/MigrationStepModule.java +++ b/server/sonar-server/src/main/java/org/sonar/server/db/migrations/MigrationStepModule.java @@ -20,22 +20,6 @@ package org.sonar.server.db.migrations; import org.sonar.core.platform.Module; -import org.sonar.server.db.migrations.v42.CompleteIssueMessageMigrationStep; -import org.sonar.server.db.migrations.v42.PackageKeysMigrationStep; -import org.sonar.server.db.migrations.v43.ConvertIssueDebtToMinutesMigrationStep; -import org.sonar.server.db.migrations.v43.DevelopmentCostMeasuresMigrationStep; -import org.sonar.server.db.migrations.v43.IssueChangelogMigrationStep; -import org.sonar.server.db.migrations.v43.NotResolvedIssuesOnRemovedComponentsMigrationStep; -import org.sonar.server.db.migrations.v43.RequirementMeasuresMigrationStep; -import org.sonar.server.db.migrations.v43.TechnicalDebtMeasuresMigrationStep; -import org.sonar.server.db.migrations.v44.ChangeLogMigrationStep; -import org.sonar.server.db.migrations.v44.ConvertProfileMeasuresMigrationStep; -import org.sonar.server.db.migrations.v44.FeedQProfileDatesMigrationStep; -import org.sonar.server.db.migrations.v44.FeedQProfileKeysMigrationStep; -import org.sonar.server.db.migrations.v44.IssueActionPlanKeyMigrationStep; -import org.sonar.server.db.migrations.v44.MeasureDataMigrationStep; -import org.sonar.server.db.migrations.v45.AddMissingRuleParameterDefaultValuesMigrationStep; -import org.sonar.server.db.migrations.v45.DeleteMeasuresOnDeletedProfilesMigrationStep; import org.sonar.server.db.migrations.v451.AddMissingCustomRuleParametersMigrationStep; import org.sonar.server.db.migrations.v451.DeleteUnescapedActivities; import org.sonar.server.db.migrations.v50.FeedFileSources; @@ -77,29 +61,6 @@ public class MigrationStepModule extends Module { @Override protected void configureModule() { add( - // 4.2 - PackageKeysMigrationStep.class, CompleteIssueMessageMigrationStep.class, - - // 4.3 - ConvertIssueDebtToMinutesMigrationStep.class, - IssueChangelogMigrationStep.class, - TechnicalDebtMeasuresMigrationStep.class, - DevelopmentCostMeasuresMigrationStep.class, - RequirementMeasuresMigrationStep.class, - NotResolvedIssuesOnRemovedComponentsMigrationStep.class, - - // 4.4 - IssueActionPlanKeyMigrationStep.class, - MeasureDataMigrationStep.class, - FeedQProfileKeysMigrationStep.class, - FeedQProfileDatesMigrationStep.class, - ChangeLogMigrationStep.class, - ConvertProfileMeasuresMigrationStep.class, - - // 4.5 - AddMissingRuleParameterDefaultValuesMigrationStep.class, - DeleteMeasuresOnDeletedProfilesMigrationStep.class, - // 4.5.1 AddMissingCustomRuleParametersMigrationStep.class, DeleteUnescapedActivities.class, @@ -142,7 +103,6 @@ public class MigrationStepModule extends Module { FeedManualMeasuresComponentUuid.class, RemoveSnapshotLibraries.class, RemoveComponentLibraries.class, - RemoveDuplicatedComponentKeys.class - ); + RemoveDuplicatedComponentKeys.class); } } diff --git a/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v42/CompleteIssueMessageMigrationStep.java b/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v42/CompleteIssueMessageMigrationStep.java deleted file mode 100644 index 0f5cca7b561..00000000000 --- a/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v42/CompleteIssueMessageMigrationStep.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2014 SonarSource - * mailto:contact AT sonarsource DOT com - * - * SonarQube is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * SonarQube 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser 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. - */ -package org.sonar.server.db.migrations.v42; - -import java.sql.SQLException; - -import org.sonar.db.Database; -import org.sonar.server.db.migrations.BaseDataChange; -import org.sonar.server.db.migrations.MassUpdate; -import org.sonar.server.db.migrations.Select; -import org.sonar.server.db.migrations.SqlStatement; - -/** - * Used in Rails migration 497 - * - * @since 4.2 - */ -public class CompleteIssueMessageMigrationStep extends BaseDataChange { - - public CompleteIssueMessageMigrationStep(Database database) { - super(database); - } - - @Override - public void execute(Context context) throws SQLException { - MassUpdate massUpdate = context.prepareMassUpdate(); - massUpdate.select("SELECT i.id, r.name FROM issues i INNER JOIN rules r ON r.id=i.rule_id WHERE i.message IS NULL"); - massUpdate.update("UPDATE issues SET message=? WHERE id=?"); - massUpdate.execute(new MassUpdate.Handler() { - @Override - public boolean handle(Select.Row row, SqlStatement update) throws SQLException { - Long issueId = row.getNullableLong(1); - String ruleName = row.getNullableString(2); - - update.setString(1, ruleName); - update.setLong(2, issueId); - return true; - } - }); - } -} diff --git a/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v42/PackageKeysMigrationStep.java b/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v42/PackageKeysMigrationStep.java deleted file mode 100644 index 32af9c4becf..00000000000 --- a/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v42/PackageKeysMigrationStep.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2014 SonarSource - * mailto:contact AT sonarsource DOT com - * - * SonarQube is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * SonarQube 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser 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. - */ -package org.sonar.server.db.migrations.v42; - -import java.sql.SQLException; - -import javax.annotation.CheckForNull; -import javax.annotation.Nullable; - -import org.apache.commons.lang.StringUtils; -import org.sonar.db.Database; -import org.sonar.server.db.migrations.BaseDataChange; -import org.sonar.server.db.migrations.MassUpdate; -import org.sonar.server.db.migrations.Select; -import org.sonar.server.db.migrations.SqlStatement; - -/** - * Used in Rails migration 490 - * - * @since 4.2 - */ -public class PackageKeysMigrationStep extends BaseDataChange { - - public PackageKeysMigrationStep(Database database) { - super(database); - } - - @Override - public void execute(Context context) throws SQLException { - MassUpdate massUpdate = context.prepareMassUpdate(); - massUpdate.select("SELECT id, kee FROM projects WHERE qualifier='PAC'"); - massUpdate.update("UPDATE projects SET qualifier='DIR', kee=? WHERE id=?"); - massUpdate.execute(new MassUpdate.Handler() { - @Override - public boolean handle(Select.Row row, SqlStatement update) throws SQLException { - Long id = row.getNullableLong(1); - String key = row.getNullableString(2); - update.setString(1, convertKey(key)); - update.setLong(2, id); - return true; - } - }); - } - - @CheckForNull - String convertKey(@Nullable String packageKey) { - if (packageKey != null) { - String prefix = StringUtils.substringBeforeLast(packageKey, ":") + ":"; - String key = StringUtils.substringAfterLast(packageKey, ":"); - if ("[default]".equals(key)) { - return prefix + "[root]"; - } - return prefix + StringUtils.replace(key, ".", "/"); - } - return null; - } -} diff --git a/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v42/package-info.java b/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v42/package-info.java deleted file mode 100644 index 57317fff74c..00000000000 --- a/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v42/package-info.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2014 SonarSource - * mailto:contact AT sonarsource DOT com - * - * SonarQube is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * SonarQube 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser 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. - */ - -@ParametersAreNonnullByDefault -package org.sonar.server.db.migrations.v42; - -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v43/ConvertIssueDebtToMinutesMigrationStep.java b/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v43/ConvertIssueDebtToMinutesMigrationStep.java deleted file mode 100644 index 34404ed8a14..00000000000 --- a/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v43/ConvertIssueDebtToMinutesMigrationStep.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2014 SonarSource - * mailto:contact AT sonarsource DOT com - * - * SonarQube is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * SonarQube 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser 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. - */ - -package org.sonar.server.db.migrations.v43; - -import java.sql.SQLException; -import java.util.Date; - -import org.sonar.api.utils.System2; -import org.sonar.db.Database; -import org.sonar.db.property.PropertiesDao; -import org.sonar.server.db.migrations.BaseDataChange; -import org.sonar.server.db.migrations.MassUpdate; -import org.sonar.server.db.migrations.Select; -import org.sonar.server.db.migrations.SqlStatement; - -/** - * Used in the Active Record Migration 513. - * WARNING - this migration is not re-entrant. - * - * @since 4.3 - */ -public class ConvertIssueDebtToMinutesMigrationStep extends BaseDataChange { - - private final WorkDurationConvertor workDurationConvertor; - private final System2 system2; - - public ConvertIssueDebtToMinutesMigrationStep(Database database, PropertiesDao propertiesDao, System2 system2) { - super(database); - this.workDurationConvertor = new WorkDurationConvertor(propertiesDao); - this.system2 = system2; - } - - @Override - public void execute(Context context) throws SQLException { - workDurationConvertor.init(); - final Date now = new Date(system2.now()); - MassUpdate massUpdate = context.prepareMassUpdate(); - - // See https://jira.sonarsource.com/browse/SONAR-5394 - // The SQL request should not set the filter on technical_debt is not null. There's no index - // on this column, so filtering is done programmatically. - massUpdate.select("select id, technical_debt from issues"); - - massUpdate.update("update issues set technical_debt=?, updated_at=? where id=?"); - massUpdate.execute(new MassUpdate.Handler() { - @Override - public boolean handle(Select.Row row, SqlStatement update) throws SQLException { - Long debt = row.getNullableLong(2); - if (debt != null) { - Long id = row.getNullableLong(1); - update.setLong(1, workDurationConvertor.createFromLong(debt)); - update.setDate(2, now); - update.setLong(3, id); - return true; - } - return false; - } - }); - } - -} diff --git a/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v43/DevelopmentCostMeasuresMigrationStep.java b/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v43/DevelopmentCostMeasuresMigrationStep.java deleted file mode 100644 index 6c3b65559f5..00000000000 --- a/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v43/DevelopmentCostMeasuresMigrationStep.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2014 SonarSource - * mailto:contact AT sonarsource DOT com - * - * SonarQube is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * SonarQube 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser 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. - */ - -package org.sonar.server.db.migrations.v43; - -import org.sonar.db.Database; -import org.sonar.db.property.PropertiesDao; -import org.sonar.server.db.migrations.BaseDataChange; -import org.sonar.server.db.migrations.MassUpdate; -import org.sonar.server.db.migrations.Select; -import org.sonar.server.db.migrations.SqlStatement; - -import javax.annotation.CheckForNull; - -import java.sql.SQLException; - -/** - * Used in the Active Record Migration 516 - * - * @since 4.3 - */ -public class DevelopmentCostMeasuresMigrationStep extends BaseDataChange { - - private final WorkDurationConvertor workDurationConvertor; - - public DevelopmentCostMeasuresMigrationStep(Database database, PropertiesDao propertiesDao) { - super(database); - this.workDurationConvertor = new WorkDurationConvertor(propertiesDao); - } - - @Override - public void execute(Context context) throws SQLException { - workDurationConvertor.init(); - - Long metricId = context.prepareSelect("select id from metrics where name='development_cost'").get(Select.LONG_READER); - if (metricId != null) { - MassUpdate massUpdate = context.prepareMassUpdate(); - massUpdate.select("select id, value from project_measures where metric_id=? and value is not null").setLong(1, metricId); - massUpdate.update("update project_measures set value=NULL,text_value=? where id=?"); - massUpdate.execute(new MassUpdate.Handler() { - @Override - public boolean handle(Select.Row row, SqlStatement update) throws SQLException { - Long id = row.getLong(1); - Double value = row.getDouble(2); - - update.setString(1, convertDebtForDays(value)); - update.setLong(2, id); - return true; - } - }); - } - } - - @CheckForNull - private String convertDebtForDays(Double data) { - return Long.toString(workDurationConvertor.createFromDays(data)); - } -} diff --git a/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v43/IssueChangelogMigrationStep.java b/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v43/IssueChangelogMigrationStep.java deleted file mode 100644 index b618ffed0e2..00000000000 --- a/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v43/IssueChangelogMigrationStep.java +++ /dev/null @@ -1,113 +0,0 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2014 SonarSource - * mailto:contact AT sonarsource DOT com - * - * SonarQube is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * SonarQube 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser 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. - */ - -package org.sonar.server.db.migrations.v43; - -import java.sql.SQLException; -import java.util.Date; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import javax.annotation.CheckForNull; -import javax.annotation.Nullable; - -import org.sonar.api.utils.System2; -import org.sonar.db.Database; -import org.sonar.db.property.PropertiesDao; -import org.sonar.server.db.migrations.BaseDataChange; -import org.sonar.server.db.migrations.MassUpdate; -import org.sonar.server.db.migrations.Select; -import org.sonar.server.db.migrations.SqlStatement; - -import com.google.common.annotations.VisibleForTesting; -import com.google.common.base.Strings; - -/** - * Used in the Active Record Migration 514 - * - * @since 4.3 - */ -public class IssueChangelogMigrationStep extends BaseDataChange { - - private final WorkDurationConvertor workDurationConvertor; - private final System2 system2; - private final Pattern pattern = Pattern.compile("technicalDebt=(\\d*)\\|(\\d*)", Pattern.CASE_INSENSITIVE); - - public IssueChangelogMigrationStep(Database database, System2 system2, PropertiesDao propertiesDao) { - this(database, system2, new WorkDurationConvertor(propertiesDao)); - } - - @VisibleForTesting - IssueChangelogMigrationStep(Database database, System2 system2, WorkDurationConvertor convertor) { - super(database); - this.workDurationConvertor = convertor; - this.system2 = system2; - } - - @Override - public void execute(Context context) throws SQLException { - workDurationConvertor.init(); - final Date now = new Date(system2.now()); - MassUpdate massUpdate = context.prepareMassUpdate(); - massUpdate.select("SELECT ic.id, ic.change_data FROM issue_changes ic " + - "WHERE ic.change_type = 'diff' AND ic.change_data LIKE '%technicalDebt%'"); - massUpdate.update("UPDATE issue_changes SET change_data=?,updated_at=? WHERE id=?"); - massUpdate.execute(new MassUpdate.Handler() { - @Override - public boolean handle(Select.Row row, SqlStatement update) throws SQLException { - Long id = row.getNullableLong(1); - String changeData = row.getNullableString(2); - - update.setString(1, convertChangelog(changeData)); - update.setDate(2, now); - update.setLong(3, id); - return true; - } - }); - } - - @VisibleForTesting - @CheckForNull - String convertChangelog(@Nullable String data) { - if (data == null) { - return null; - } - Matcher matcher = pattern.matcher(data); - StringBuffer sb = new StringBuffer(); - if (matcher.find()) { - String replacement = "technicalDebt="; - String oldValue = matcher.group(1); - if (!Strings.isNullOrEmpty(oldValue)) { - long oldDebt = workDurationConvertor.createFromLong(Long.parseLong(oldValue)); - replacement += Long.toString(oldDebt); - } - replacement += "|"; - String newValue = matcher.group(2); - if (!Strings.isNullOrEmpty(newValue)) { - long newDebt = workDurationConvertor.createFromLong(Long.parseLong(newValue)); - replacement += Long.toString(newDebt); - } - matcher.appendReplacement(sb, replacement); - } - matcher.appendTail(sb); - return sb.toString(); - } - -} diff --git a/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v43/NotResolvedIssuesOnRemovedComponentsMigrationStep.java b/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v43/NotResolvedIssuesOnRemovedComponentsMigrationStep.java deleted file mode 100644 index c7bf7d85150..00000000000 --- a/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v43/NotResolvedIssuesOnRemovedComponentsMigrationStep.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2014 SonarSource - * mailto:contact AT sonarsource DOT com - * - * SonarQube is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * SonarQube 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser 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. - */ - -package org.sonar.server.db.migrations.v43; - -import java.sql.SQLException; -import java.util.Date; - -import org.sonar.api.issue.Issue; -import org.sonar.api.utils.System2; -import org.sonar.db.Database; -import org.sonar.server.db.migrations.BaseDataChange; -import org.sonar.server.db.migrations.MassUpdate; -import org.sonar.server.db.migrations.Select; -import org.sonar.server.db.migrations.SqlStatement; - -/** - * Used in the Active Record Migration 525 - * - * @since 4.3 - */ -public class NotResolvedIssuesOnRemovedComponentsMigrationStep extends BaseDataChange { - - private final System2 system2; - - public NotResolvedIssuesOnRemovedComponentsMigrationStep(Database database, System2 system2) { - super(database); - this.system2 = system2; - } - - @Override - public void execute(Context context) throws SQLException { - final Date now = new Date(system2.now()); - MassUpdate massUpdate = context.prepareMassUpdate(); - massUpdate.select("SELECT i.id FROM issues i " + - "INNER JOIN projects p on p.id=i.component_id " + - "WHERE p.enabled=? AND i.resolution IS NULL ").setBoolean(1, false); - massUpdate.update("UPDATE issues SET status=?,resolution=?,updated_at=? WHERE id=?"); - massUpdate.execute(new MassUpdate.Handler() { - @Override - public boolean handle(Select.Row row, SqlStatement update) throws SQLException { - Long id = row.getNullableLong(1); - update.setString(1, Issue.STATUS_CLOSED); - update.setString(2, Issue.RESOLUTION_REMOVED); - update.setDate(3, now); - update.setLong(4, id); - return true; - } - }); - } -} diff --git a/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v43/RequirementMeasuresMigrationStep.java b/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v43/RequirementMeasuresMigrationStep.java deleted file mode 100644 index 3ca45b425de..00000000000 --- a/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v43/RequirementMeasuresMigrationStep.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2014 SonarSource - * mailto:contact AT sonarsource DOT com - * - * SonarQube is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * SonarQube 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser 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. - */ - -package org.sonar.server.db.migrations.v43; - -import java.sql.SQLException; - -import org.sonar.db.Database; -import org.sonar.server.db.migrations.BaseDataChange; -import org.sonar.server.db.migrations.MassUpdate; -import org.sonar.server.db.migrations.Select; -import org.sonar.server.db.migrations.SqlStatement; - -/** - * Used in the Active Record Migration 521 - * - * @since 4.3 - */ -public class RequirementMeasuresMigrationStep extends BaseDataChange { - - public RequirementMeasuresMigrationStep(Database database) { - super(database); - } - - @Override - public void execute(Context context) throws SQLException { - MassUpdate massUpdate = context.prepareMassUpdate(); - massUpdate.select("SELECT project_measures.id,characteristics.rule_id FROM project_measures " + - "INNER JOIN characteristics ON characteristics.id = project_measures.characteristic_id " + - "WHERE characteristics.rule_id IS NOT NULL"); - massUpdate.update("UPDATE project_measures SET characteristic_id=null,rule_id=? WHERE id=?"); - massUpdate.execute(new MassUpdate.Handler() { - @Override - public boolean handle(Select.Row row, SqlStatement update) throws SQLException { - Long id = row.getNullableLong(1); - Long ruleId = row.getNullableLong(2); - - update.setLong(1, ruleId); - update.setLong(2, id); - return true; - } - }); - } -} diff --git a/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationStep.java b/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationStep.java deleted file mode 100644 index 1ca04d2898c..00000000000 --- a/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationStep.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2014 SonarSource - * mailto:contact AT sonarsource DOT com - * - * SonarQube is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * SonarQube 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser 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. - */ - -package org.sonar.server.db.migrations.v43; - -import java.sql.SQLException; -import java.util.List; - -import javax.annotation.CheckForNull; -import javax.annotation.Nullable; - -import org.apache.commons.lang.StringUtils; -import org.sonar.db.Database; -import org.sonar.db.property.PropertiesDao; -import org.sonar.server.db.migrations.BaseDataChange; -import org.sonar.server.db.migrations.MassUpdate; -import org.sonar.server.db.migrations.Select; -import org.sonar.server.db.migrations.SqlStatement; - -/** - * Used in the Active Record Migration 515 - * - * @since 4.3 - */ -public class TechnicalDebtMeasuresMigrationStep extends BaseDataChange { - - private final WorkDurationConvertor workDurationConvertor; - - public TechnicalDebtMeasuresMigrationStep(Database database, PropertiesDao propertiesDao) { - super(database); - this.workDurationConvertor = new WorkDurationConvertor(propertiesDao); - } - - @Override - public void execute(Context context) throws SQLException { - workDurationConvertor.init(); - - List metricIds = context.prepareSelect("select id from metrics " + - "where name='sqale_index' or name='new_technical_debt' " + - "or name='sqale_effort_to_grade_a' or name='sqale_effort_to_grade_b' or name='sqale_effort_to_grade_c' " + - "or name='sqale_effort_to_grade_d' or name='blocker_remediation_cost' or name='critical_remediation_cost' " + - "or name='major_remediation_cost' or name='minor_remediation_cost' or name='info_remediation_cost'").list(Select.LONG_READER); - - if (!metricIds.isEmpty()) { - MassUpdate massUpdate = context.prepareMassUpdate(); - massUpdate.rowPluralName("measures"); - - SqlStatement select = massUpdate.select("SELECT pm.id, pm.value " + - ", pm.variation_value_1 , pm.variation_value_2, pm.variation_value_3 " + - ", pm.variation_value_4 , pm.variation_value_5 " + - " FROM project_measures pm " + - " WHERE pm.metric_id IN (" + StringUtils.repeat("?", ",", metricIds.size()) + ")"); - for (int i = 0; i < metricIds.size(); i++) { - select.setLong(i + 1, metricIds.get(i)); - } - massUpdate.update("UPDATE project_measures SET value=?," + - "variation_value_1=?,variation_value_2=?,variation_value_3=?,variation_value_4=?,variation_value_5=? WHERE id=?"); - massUpdate.execute(new Converter()); - } - } - - private class Converter implements MassUpdate.Handler { - @Override - public boolean handle(Select.Row row, SqlStatement update) throws SQLException { - Long id = row.getNullableLong(1); - Double value = row.getNullableDouble(2); - Double var1 = row.getNullableDouble(3); - Double var2 = row.getNullableDouble(4); - Double var3 = row.getNullableDouble(5); - Double var4 = row.getNullableDouble(6); - Double var5 = row.getNullableDouble(7); - - update.setLong(1, convertDebtForDays(value)); - update.setLong(2, convertDebtForDays(var1)); - update.setLong(3, convertDebtForDays(var2)); - update.setLong(4, convertDebtForDays(var3)); - update.setLong(5, convertDebtForDays(var4)); - update.setLong(6, convertDebtForDays(var5)); - update.setLong(7, id); - return true; - } - - @CheckForNull - private Long convertDebtForDays(@Nullable Double data) { - if (data != null) { - return workDurationConvertor.createFromDays(data); - } - return null; - } - } -} diff --git a/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v43/WorkDurationConvertor.java b/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v43/WorkDurationConvertor.java deleted file mode 100644 index 692d4449e86..00000000000 --- a/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v43/WorkDurationConvertor.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2014 SonarSource - * mailto:contact AT sonarsource DOT com - * - * SonarQube is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * SonarQube 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser 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. - */ - -package org.sonar.server.db.migrations.v43; - -import org.sonar.db.property.PropertiesDao; -import org.sonar.db.property.PropertyDto; - -class WorkDurationConvertor { - - static final long ONE_HOUR = 60L; - - static final String HOURS_IN_DAY_PROPERTY = "sonar.technicalDebt.hoursInDay"; - - private Integer hoursInDay; - - private final PropertiesDao propertiesDao; - - WorkDurationConvertor(PropertiesDao propertiesDao) { - this.propertiesDao = propertiesDao; - } - - long createFromLong(long durationInLong) { - checkHoursInDay(); - - long durationInMinutes = 0L; - - long remainingTime = durationInLong; - Long currentTime = remainingTime / 10000; - if (currentTime > 0) { - durationInMinutes = currentTime.intValue() * hoursInDay * ONE_HOUR; - remainingTime = remainingTime - (currentTime * 10000); - } - - currentTime = remainingTime / 100; - if (currentTime > 0) { - durationInMinutes += currentTime.intValue() * ONE_HOUR; - remainingTime = remainingTime - (currentTime * 100); - } - - currentTime = remainingTime; - if (currentTime > 0) { - durationInMinutes += currentTime.intValue(); - } - - return durationInMinutes; - } - - long createFromDays(double days) { - checkHoursInDay(); - - return ((Double) (days * hoursInDay * ONE_HOUR)).longValue(); - } - - void init() { - PropertyDto propertyDto = propertiesDao.selectGlobalProperty(HOURS_IN_DAY_PROPERTY); - String value = propertyDto != null ? propertyDto.getValue() : "8"; - hoursInDay = Integer.valueOf(value); - if (hoursInDay < 0) { - throw new IllegalArgumentException(String.format("Bad value of %s: %d", HOURS_IN_DAY_PROPERTY, hoursInDay)); - } - } - - private void checkHoursInDay() { - if (hoursInDay == null) { - throw new IllegalStateException("init() has not been called"); - } - } -} diff --git a/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v43/package-info.java b/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v43/package-info.java deleted file mode 100644 index c1cb03885f8..00000000000 --- a/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v43/package-info.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2014 SonarSource - * mailto:contact AT sonarsource DOT com - * - * SonarQube is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * SonarQube 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser 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. - */ - -@ParametersAreNonnullByDefault -package org.sonar.server.db.migrations.v43; - -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v44/ChangeLogMigrationStep.java b/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v44/ChangeLogMigrationStep.java deleted file mode 100644 index fab24b6f7d8..00000000000 --- a/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v44/ChangeLogMigrationStep.java +++ /dev/null @@ -1,129 +0,0 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2014 SonarSource - * mailto:contact AT sonarsource DOT com - * - * SonarQube is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * SonarQube 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser 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. - */ -package org.sonar.server.db.migrations.v44; - -import java.util.Date; -import java.util.Iterator; -import java.util.List; - -import org.apache.commons.lang.StringUtils; -import org.sonar.api.rule.RuleKey; -import org.sonar.api.utils.KeyValueFormat; -import org.sonar.api.utils.internal.Uuids; -import org.sonar.db.activity.ActivityDto; -import org.sonar.db.DbSession; -import org.sonar.db.version.v44.ChangeLog; -import org.sonar.db.version.v44.Migration44Mapper; -import org.sonar.db.qualityprofile.ActiveRuleKey; -import org.sonar.core.rule.SeverityUtil; -import org.sonar.server.activity.Activity; -import org.sonar.db.activity.ActivityDao; -import org.sonar.db.DbClient; -import org.sonar.server.db.migrations.MigrationStep; -import org.sonar.server.qualityprofile.ActiveRuleChange; - -/** - * SONAR-5329 - * Transition ActiveRuleChanges to ActivityLog - *

- * Used in the Active Record Migration 548. - * - * @since 4.4 - */ -public class ChangeLogMigrationStep implements MigrationStep { - - private final ActivityDao dao; - private final DbClient db; - - public ChangeLogMigrationStep(ActivityDao dao, DbClient db) { - this.dao = dao; - this.db = db; - } - - @Override - public void execute() { - DbSession session = db.openSession(false); - Migration44Mapper migrationMapper = session.getMapper(Migration44Mapper.class); - try { - executeUpsert(session, ActiveRuleChange.Type.ACTIVATED, migrationMapper.selectActiveRuleChange(true)); - executeUpsert(session, ActiveRuleChange.Type.UPDATED, migrationMapper.selectActiveRuleChange(null)); - executeUpsert(session, ActiveRuleChange.Type.DEACTIVATED, migrationMapper.selectActiveRuleChange(false)); - session.commit(); - } finally { - session.close(); - } - } - - private void executeUpsert(DbSession session, ActiveRuleChange.Type type, List changes) { - - Iterator changeLogIterator = changes.iterator(); - if (changeLogIterator.hasNext()) { - // startCase - ChangeLog change = changeLogIterator.next(); - int currentId = change.getId(); - Date currentTimeStamp = change.getCreatedAt(); - String currentAuthor = change.getUserLogin(); - ActiveRuleChange ruleChange = newActiveRuleChance(type, change); - processRuleChange(ruleChange, change); - - while (changeLogIterator.hasNext()) { - change = changeLogIterator.next(); - int id = change.getId(); - if (id != currentId) { - saveActiveRuleChange(session, ruleChange, currentAuthor, currentTimeStamp); - currentId = id; - currentTimeStamp = change.getCreatedAt(); - currentAuthor = change.getUserLogin(); - ruleChange = newActiveRuleChance(type, change); - } - processRuleChange(ruleChange, change); - } - // save the last - saveActiveRuleChange(session, ruleChange, currentAuthor, currentTimeStamp); - } - } - - private void saveActiveRuleChange(DbSession session, ActiveRuleChange ruleChange, String author, Date currentTimeStamp) { - Activity activity = ruleChange.toActivity(); - ActivityDto dto = new ActivityDto(); - dto.setKey(Uuids.create()); - dto.setType(Activity.Type.QPROFILE.name()); - dto.setAction(activity.getAction()); - dto.setMessage(activity.getMessage()); - dto.setAuthor(author); - dto.setData(KeyValueFormat.format(activity.getData())); - dto.setCreatedAt(currentTimeStamp); - dao.insert(session, dto); - } - - private void processRuleChange(ActiveRuleChange ruleChange, ChangeLog change) { - ruleChange.setSeverity(SeverityUtil.getSeverityFromOrdinal(change.getSeverity())); - String paramName = change.getParamKey(); - String paramValue = change.getParamValue(); - if (StringUtils.isNotEmpty(paramName)) { - ruleChange.setParameter(paramName, paramValue); - } - } - - private ActiveRuleChange newActiveRuleChance(ActiveRuleChange.Type type, ChangeLog change) { - return ActiveRuleChange.createFor(type, - ActiveRuleKey.of(change.getProfileKey(), RuleKey.of(change.getRepository(), change.getRuleKey()))); - } -} diff --git a/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v44/ConvertProfileMeasuresMigrationStep.java b/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v44/ConvertProfileMeasuresMigrationStep.java deleted file mode 100644 index a9f13c6efa5..00000000000 --- a/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v44/ConvertProfileMeasuresMigrationStep.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2014 SonarSource - * mailto:contact AT sonarsource DOT com - * - * SonarQube is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * SonarQube 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser 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. - */ - -package org.sonar.server.db.migrations.v44; - -import java.io.StringWriter; -import java.util.Date; - -import org.apache.commons.lang.ObjectUtils; -import org.sonar.api.utils.text.JsonWriter; -import org.sonar.core.util.UtcDateUtils; -import org.sonar.db.DbSession; -import org.sonar.db.version.v44.Migration44Mapper; -import org.sonar.db.version.v44.ProfileMeasure; -import org.sonar.db.version.v44.QProfileDto44; -import org.sonar.db.DbClient; -import org.sonar.server.db.migrations.MigrationStep; - -/** - * Feed the new columns RULES_PROFILE.KEE and PARENT_KEE. - * - * @since 4.4 - */ -public class ConvertProfileMeasuresMigrationStep implements MigrationStep { - - private final DbClient db; - - public ConvertProfileMeasuresMigrationStep(DbClient db) { - this.db = db; - } - - @Override - public void execute() { - DbSession session = db.openSession(false); - try { - int i = 0; - Date now = new Date(); - Migration44Mapper mapper = session.getMapper(Migration44Mapper.class); - for (ProfileMeasure profileMeasure : mapper.selectProfileMeasures()) { - boolean updated = false; - Integer version = mapper.selectProfileVersion(profileMeasure.getSnapshotId()); - QProfileDto44 profile = mapper.selectProfileById(profileMeasure.getProfileId()); - if (profile != null) { - Date date = now; - if (version != null) { - date = (Date) ObjectUtils.defaultIfNull( - mapper.selectProfileVersionDate(profileMeasure.getProfileId(), version), now); - } - // see format of JSON in org.sonar.batch.rule.UsedQProfiles - StringWriter writer = new StringWriter(); - JsonWriter json = JsonWriter.of(writer); - json - .beginArray() - .beginObject() - .prop("key", profile.getKee()) - .prop("language", profile.getLanguage()) - .prop("name", profile.getName()) - .prop("rulesUpdatedAt", UtcDateUtils.formatDateTime(date)) - .endObject() - .endArray() - .close(); - mapper.updateProfileMeasure(profileMeasure.getId(), writer.toString()); - updated = true; - } - if (!updated) { - mapper.deleteProfileMeasure(profileMeasure.getId()); - } - if (i % 100 == 0) { - session.commit(); - i++; - } - } - session.commit(); - } finally { - session.close(); - } - } -} diff --git a/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v44/FeedQProfileDatesMigrationStep.java b/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v44/FeedQProfileDatesMigrationStep.java deleted file mode 100644 index 520528ddfd4..00000000000 --- a/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v44/FeedQProfileDatesMigrationStep.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2014 SonarSource - * mailto:contact AT sonarsource DOT com - * - * SonarQube is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * SonarQube 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser 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. - */ - -package org.sonar.server.db.migrations.v44; - -import java.util.Date; - -import org.apache.commons.lang.ObjectUtils; -import org.sonar.api.utils.System2; -import org.sonar.core.util.UtcDateUtils; -import org.sonar.db.DbSession; -import org.sonar.db.version.v44.Migration44Mapper; -import org.sonar.db.version.v44.QProfileDto44; -import org.sonar.db.DbClient; -import org.sonar.server.db.migrations.MigrationStep; - -/** - * Feed the new columns RULES_PROFILES.CREATED_AT and UPDATED_AT - * - * @since 4.4 - */ -public class FeedQProfileDatesMigrationStep implements MigrationStep { - - private final DbClient db; - private final System2 system; - - public FeedQProfileDatesMigrationStep(DbClient db, System2 system) { - this.db = db; - this.system = system; - } - - @Override - public void execute() { - DbSession session = db.openSession(false); - try { - Date now = new Date(system.now()); - int i = 0; - Migration44Mapper migrationMapper = session.getMapper(Migration44Mapper.class); - for (QProfileDto44 profile : migrationMapper.selectAllProfiles()) { - Date createdAt = (Date) ObjectUtils.defaultIfNull(migrationMapper.selectProfileCreatedAt(profile.getId()), now); - Date updatedAt = (Date) ObjectUtils.defaultIfNull(migrationMapper.selectProfileUpdatedAt(profile.getId()), now); - - migrationMapper.updateProfileDates(profile.getId(), createdAt, updatedAt, UtcDateUtils.formatDateTime(updatedAt)); - if (i % 100 == 0) { - session.commit(); - i++; - } - } - session.commit(); - } finally { - session.close(); - } - } -} diff --git a/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v44/FeedQProfileKeysMigrationStep.java b/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v44/FeedQProfileKeysMigrationStep.java deleted file mode 100644 index cfd0b2532e7..00000000000 --- a/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v44/FeedQProfileKeysMigrationStep.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2014 SonarSource - * mailto:contact AT sonarsource DOT com - * - * SonarQube is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * SonarQube 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser 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. - */ - -package org.sonar.server.db.migrations.v44; - -import java.sql.SQLException; - -import org.apache.commons.lang.RandomStringUtils; -import org.sonar.db.Database; -import org.sonar.server.db.migrations.BaseDataChange; -import org.sonar.server.db.migrations.MassUpdate; -import org.sonar.server.db.migrations.Select; -import org.sonar.server.db.migrations.SqlStatement; -import org.sonar.core.util.Slug; - -/** - * Feed the new columns RULES_PROFILES.KEE and PARENT_KEE. - * - * @since 4.4 - */ -public class FeedQProfileKeysMigrationStep extends BaseDataChange { - - public FeedQProfileKeysMigrationStep(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - updateKeys(context); - updateParentKeys(context); - } - - private void updateKeys(Context context) throws SQLException { - MassUpdate massUpdate = context.prepareMassUpdate(); - massUpdate.select("SELECT id,language,name FROM rules_profiles"); - massUpdate.update("UPDATE rules_profiles SET kee=? WHERE id=?"); - massUpdate.rowPluralName("profiles"); - massUpdate.execute(new MassUpdate.Handler() { - @Override - public boolean handle(Select.Row row, SqlStatement update) throws SQLException { - Long id = row.getNullableLong(1); - String lang = row.getNullableString(2); - String name = row.getNullableString(3); - - update.setString(1, Slug.slugify(String.format("%s %s %s", lang, name, RandomStringUtils.randomNumeric(5)))); - update.setLong(2, id); - return true; - } - }); - } - - private void updateParentKeys(Context context) throws SQLException { - MassUpdate massUpdate = context.prepareMassUpdate(); - massUpdate.select("SELECT child.id,parent.kee FROM rules_profiles child, rules_profiles parent WHERE child.parent_name=parent.name " + - "and child.language=parent.language AND child.parent_name IS NOT NULL"); - massUpdate.update("UPDATE rules_profiles SET parent_kee=? WHERE id=?"); - massUpdate.execute(new MassUpdate.Handler() { - @Override - public boolean handle(Select.Row row, SqlStatement update) throws SQLException { - Long id = row.getNullableLong(1); - String parentKey = row.getNullableString(2); - - update.setString(1, parentKey); - update.setLong(2, id); - return true; - } - }); - - } -} diff --git a/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v44/IssueActionPlanKeyMigrationStep.java b/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v44/IssueActionPlanKeyMigrationStep.java deleted file mode 100644 index fb712740740..00000000000 --- a/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v44/IssueActionPlanKeyMigrationStep.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2014 SonarSource - * mailto:contact AT sonarsource DOT com - * - * SonarQube is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * SonarQube 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser 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. - */ - -package org.sonar.server.db.migrations.v44; - -import java.sql.SQLException; -import java.util.Date; - -import org.sonar.api.utils.System2; -import org.sonar.db.Database; -import org.sonar.server.db.migrations.BaseDataChange; -import org.sonar.server.db.migrations.MassUpdate; -import org.sonar.server.db.migrations.Select; -import org.sonar.server.db.migrations.SqlStatement; - -/** - * SONAR-5218 - * Update all issues having action plan linked on removed action plan. - *

- * Used in the Active Record Migration 531. - * - * @since 4.4 - */ -public class IssueActionPlanKeyMigrationStep extends BaseDataChange { - - private final System2 system2; - - public IssueActionPlanKeyMigrationStep(Database database, System2 system2) { - super(database); - this.system2 = system2; - } - - @Override - public void execute(Context context) throws SQLException { - final Date now = new Date(system2.now()); - MassUpdate massUpdate = context.prepareMassUpdate(); - massUpdate.select("SELECT i.id FROM issues i " + - "LEFT OUTER JOIN action_plans ap ON ap.kee=i.action_plan_key " + - "WHERE i.action_plan_key IS NOT NULL " + - "AND ap.kee is null"); - massUpdate.update("UPDATE issues SET action_plan_key=NULL,updated_at=? WHERE id=?"); - massUpdate.execute(new MassUpdate.Handler() { - @Override - public boolean handle(Select.Row row, SqlStatement update) throws SQLException { - Long id = row.getNullableLong(1); - - update.setDate(1, now); - update.setLong(2, id); - return true; - } - }); - } -} diff --git a/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v44/MeasureDataMigrationStep.java b/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v44/MeasureDataMigrationStep.java deleted file mode 100644 index 736152f2e05..00000000000 --- a/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v44/MeasureDataMigrationStep.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2014 SonarSource - * mailto:contact AT sonarsource DOT com - * - * SonarQube is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * SonarQube 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser 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. - */ - -package org.sonar.server.db.migrations.v44; - -import java.sql.SQLException; - -import org.sonar.db.Database; -import org.sonar.server.db.migrations.BaseDataChange; -import org.sonar.server.db.migrations.MassUpdate; -import org.sonar.server.db.migrations.Select; -import org.sonar.server.db.migrations.SqlStatement; - -/** - * SONAR-5249 - * Merge measure data table into project_measure - * - * Used in the Active Record Migration 530. - * @since 4.4 - */ -public class MeasureDataMigrationStep extends BaseDataChange { - - public MeasureDataMigrationStep(Database database) { - super(database); - } - - @Override - public void execute(Context context) throws SQLException { - MassUpdate massUpdate = context.prepareMassUpdate(); - massUpdate.rowPluralName("measures"); - massUpdate.select("select md.id, md.measure_id FROM measure_data md " + - "inner join project_measures m on m.id=md.measure_id and m.measure_data is null"); - massUpdate.update("update project_measures SET measure_data = (SELECT md.data FROM measure_data md WHERE md.id = ?) WHERE id=?"); - massUpdate.execute(new MassUpdate.Handler() { - @Override - public boolean handle(Select.Row row, SqlStatement update) throws SQLException { - Long id = row.getNullableLong(1); - Long measureId = row.getNullableLong(2); - - update.setLong(1, id); - update.setLong(2, measureId); - return true; - } - }); - } -} diff --git a/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v44/package-info.java b/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v44/package-info.java deleted file mode 100644 index 9d32d73158b..00000000000 --- a/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v44/package-info.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2014 SonarSource - * mailto:contact AT sonarsource DOT com - * - * SonarQube is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * SonarQube 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser 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. - */ - -@ParametersAreNonnullByDefault -package org.sonar.server.db.migrations.v44; - -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v45/AddMissingRuleParameterDefaultValuesMigrationStep.java b/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v45/AddMissingRuleParameterDefaultValuesMigrationStep.java deleted file mode 100644 index eb383f38286..00000000000 --- a/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v45/AddMissingRuleParameterDefaultValuesMigrationStep.java +++ /dev/null @@ -1,121 +0,0 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2014 SonarSource - * mailto:contact AT sonarsource DOT com - * - * SonarQube is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * SonarQube 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser 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. - */ -package org.sonar.server.db.migrations.v45; - -import java.sql.SQLException; -import java.util.Date; -import java.util.List; - -import javax.annotation.Nullable; - -import org.sonar.api.utils.System2; -import org.sonar.db.Database; -import org.sonar.server.db.migrations.BaseDataChange; -import org.sonar.server.db.migrations.Select; -import org.sonar.server.db.migrations.Upsert; - -/** - * SONAR-5446 - */ -public class AddMissingRuleParameterDefaultValuesMigrationStep extends BaseDataChange { - - private final System2 system; - - public AddMissingRuleParameterDefaultValuesMigrationStep(Database db, System2 system) { - super(db); - this.system = system; - } - - @Override - public void execute(Context context) throws SQLException { - // get all the parameters with default value - List ruleParameters = context.prepareSelect("select id,rule_id,name,default_value from rules_parameters where default_value is not null") - .list(new Select.RowReader() { - @Override - public RuleParam read(Select.Row row) throws SQLException { - return new RuleParam(row.getNullableLong(1), row.getNullableLong(2), row.getNullableString(3), row.getNullableString(4)); - } - }); - - for (RuleParam ruleParameter : ruleParameters) { - List activeRules = context.prepareSelect("select ar.id, ar.profile_id from active_rules ar " + - "left outer join active_rule_parameters arp on arp.active_rule_id=ar.id and arp.rules_parameter_id=? " + - "where ar.rule_id=? and arp.id is null") - .setLong(1, ruleParameter.id) - .setLong(2, ruleParameter.ruleId) - .list(new Select.RowReader() { - @Override - public ActiveRule read(Select.Row row) throws SQLException { - return new ActiveRule(row.getNullableLong(1), row.getNullableLong(2)); - } - }); - - Upsert upsert = context.prepareUpsert("insert into active_rule_parameters(active_rule_id, rules_parameter_id, value, rules_parameter_key) values (?, ?, ?, ?)"); - for (ActiveRule activeRule : activeRules) { - upsert - .setLong(1, activeRule.id) - .setLong(2, ruleParameter.id) - .setString(3, ruleParameter.defaultValue) - .setString(4, ruleParameter.name) - .addBatch(); - } - if (!activeRules.isEmpty()) { - upsert.execute().commit().close(); - } - - // update date for ES indexation - upsert = context.prepareUpsert("update active_rules set updated_at=? where id=?"); - Date now = new Date(system.now()); - for (ActiveRule activeRule : activeRules) { - upsert - .setDate(1, now) - .setLong(2, activeRule.id) - .addBatch(); - } - if (!activeRules.isEmpty()) { - upsert.execute().commit().close(); - } - } - } - - private static class RuleParam { - final Long id; - final Long ruleId; - final String defaultValue; - final String name; - - RuleParam(@Nullable Long id, @Nullable Long ruleId, @Nullable String name, @Nullable String defaultValue) { - this.id = id; - this.ruleId = ruleId; - this.name = name; - this.defaultValue = defaultValue; - } - } - - private static class ActiveRule { - final Long id; - final Long profileId; - - ActiveRule(@Nullable Long id, @Nullable Long profileId) { - this.id = id; - this.profileId = profileId; - } - } -} diff --git a/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v45/DeleteMeasuresOnDeletedProfilesMigrationStep.java b/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v45/DeleteMeasuresOnDeletedProfilesMigrationStep.java deleted file mode 100644 index fa2efde1b1e..00000000000 --- a/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v45/DeleteMeasuresOnDeletedProfilesMigrationStep.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2014 SonarSource - * mailto:contact AT sonarsource DOT com - * - * SonarQube is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * SonarQube 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser 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. - */ - -package org.sonar.server.db.migrations.v45; - -import org.sonar.db.DbSession; -import org.sonar.db.version.v44.Migration44Mapper; -import org.sonar.db.DbClient; -import org.sonar.server.db.migrations.MigrationStep; -import org.sonar.server.db.migrations.v44.ConvertProfileMeasuresMigrationStep; - -/** - * See http://jira.sonarsource.com/browse/SONAR-5580 - * {@link ConvertProfileMeasuresMigrationStep} - * introduced a regression in 4.4. Measures on orphan profiles were kept - * in old format (no JSON data but numeric value of profile id) - * - * @see ConvertProfileMeasuresMigrationStep - * @since 4.5 - */ -public class DeleteMeasuresOnDeletedProfilesMigrationStep implements MigrationStep { - - private final DbClient db; - - public DeleteMeasuresOnDeletedProfilesMigrationStep(DbClient db) { - this.db = db; - } - - @Override - public void execute() { - DbSession session = db.openSession(false); - try { - Migration44Mapper mapper = session.getMapper(Migration44Mapper.class); - for (Long measureId : mapper.selectMeasuresOnDeletedQualityProfiles()) { - mapper.deleteProfileMeasure(measureId); - } - session.commit(); - - } finally { - session.close(); - } - } -} diff --git a/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v45/package-info.java b/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v45/package-info.java deleted file mode 100644 index a2769c527fa..00000000000 --- a/server/sonar-server/src/main/java/org/sonar/server/db/migrations/v45/package-info.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2014 SonarSource - * mailto:contact AT sonarsource DOT com - * - * SonarQube is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * SonarQube 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser 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. - */ - -@ParametersAreNonnullByDefault -package org.sonar.server.db.migrations.v45; - -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/MigrationStepModuleTest.java b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/MigrationStepModuleTest.java index c2afa75acd7..2faccd0c35b 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/MigrationStepModuleTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/MigrationStepModuleTest.java @@ -29,6 +29,6 @@ public class MigrationStepModuleTest { public void verify_count_of_added_MigrationStep_types() { ComponentContainer container = new ComponentContainer(); new MigrationStepModule().configure(container); - assertThat(container.size()).isEqualTo(54); + assertThat(container.size()).isEqualTo(38); } } diff --git a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v42/CompleteIssueMessageMigrationTest.java b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v42/CompleteIssueMessageMigrationTest.java deleted file mode 100644 index c73347f3f9a..00000000000 --- a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v42/CompleteIssueMessageMigrationTest.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2014 SonarSource - * mailto:contact AT sonarsource DOT com - * - * SonarQube is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * SonarQube 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser 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. - */ -package org.sonar.server.db.migrations.v42; - -import org.junit.Rule; -import org.junit.Test; -import org.sonar.api.utils.System2; -import org.sonar.db.DbTester; -import org.sonar.server.db.migrations.MigrationStep; - -public class CompleteIssueMessageMigrationTest { - - @Rule - public DbTester db = DbTester.createForSchema(System2.INSTANCE, CompleteIssueMessageMigrationTest.class, "schema.sql"); - - MigrationStep migration = new CompleteIssueMessageMigrationStep(db.database()); - - @Test - public void execute() throws Exception { - db.prepareDbUnit(getClass(), "before.xml"); - - migration.execute(); - - db.assertDbUnit(getClass(), "after.xml", "issues"); - } -} diff --git a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v42/PackageKeysMigrationTest.java b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v42/PackageKeysMigrationTest.java deleted file mode 100644 index fdf970ce608..00000000000 --- a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v42/PackageKeysMigrationTest.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2014 SonarSource - * mailto:contact AT sonarsource DOT com - * - * SonarQube is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * SonarQube 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser 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. - */ -package org.sonar.server.db.migrations.v42; - -import org.junit.Rule; -import org.junit.Test; -import org.sonar.api.utils.System2; -import org.sonar.db.DbTester; -import org.sonar.server.db.migrations.MigrationStep; - -public class PackageKeysMigrationTest { - - @Rule - public DbTester db = DbTester.createForSchema(System2.INSTANCE, PackageKeysMigrationTest.class, "schema.sql"); - - MigrationStep migration = new PackageKeysMigrationStep(db.database()); - - @Test - public void execute() throws Exception { - db.prepareDbUnit(getClass(), "before.xml"); - - migration.execute(); - - db.assertDbUnit(getClass(), "after.xml", "projects"); - } -} diff --git a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v43/ConvertIssueDebtToMinutesMigrationStepTest.java b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v43/ConvertIssueDebtToMinutesMigrationStepTest.java deleted file mode 100644 index 0ea073e4ed8..00000000000 --- a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v43/ConvertIssueDebtToMinutesMigrationStepTest.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2014 SonarSource - * mailto:contact AT sonarsource DOT com - * - * SonarQube is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * SonarQube 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser 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. - */ - -package org.sonar.server.db.migrations.v43; - -import java.util.List; -import java.util.Map; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.Mock; -import org.mockito.runners.MockitoJUnitRunner; -import org.sonar.api.utils.DateUtils; -import org.sonar.api.utils.System2; -import org.sonar.db.DbTester; -import org.sonar.db.property.PropertiesDao; -import org.sonar.db.property.PropertyDto; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.Mockito.when; - -@RunWith(MockitoJUnitRunner.class) -public class ConvertIssueDebtToMinutesMigrationStepTest { - - @Rule - public DbTester db = DbTester.createForSchema(System2.INSTANCE, ConvertIssueDebtToMinutesMigrationStepTest.class, "schema.sql"); - - @Mock - System2 system2; - - @Mock - PropertiesDao propertiesDao; - - ConvertIssueDebtToMinutesMigrationStep migration; - - @Before - public void setUp() { - when(system2.now()).thenReturn(DateUtils.parseDateTime("2014-02-19T19:10:03+0100").getTime()); - when(propertiesDao.selectGlobalProperty(WorkDurationConvertor.HOURS_IN_DAY_PROPERTY)).thenReturn(new PropertyDto().setValue("8")); - - migration = new ConvertIssueDebtToMinutesMigrationStep(db.database(), propertiesDao, system2); - } - - @Test - public void migrate_issues_debt() throws Exception { - db.prepareDbUnit(getClass(), "migrate_issues_debt.xml"); - - migration.execute(); - - db.assertDbUnit(getClass(), "migrate_issues_debt_result.xml", new String[] {"updated_at"}, "issues"); - - // Check only updated_at columns values, but we could also remove db unit file and check all fields - List> results = db.select("select updated_at as \"updatedAt\" from issues"); - assertThat(results).hasSize(5); - assertThat(results.get(0).get("updatedAt").toString()).startsWith("2014"); - assertThat(results.get(1).get("updatedAt").toString()).startsWith("2014"); - assertThat(results.get(2).get("updatedAt").toString()).startsWith("2014"); - assertThat(results.get(3).get("updatedAt").toString()).startsWith("2014"); - // Not updated because no debt - assertThat(results.get(4).get("updatedAt").toString()).startsWith("2012"); - } - -} diff --git a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v43/DevelopmentCostMeasuresMigrationStepTest.java b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v43/DevelopmentCostMeasuresMigrationStepTest.java deleted file mode 100644 index cdd65574b63..00000000000 --- a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v43/DevelopmentCostMeasuresMigrationStepTest.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2014 SonarSource - * mailto:contact AT sonarsource DOT com - * - * SonarQube is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * SonarQube 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser 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. - */ - -package org.sonar.server.db.migrations.v43; - -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.Mock; -import org.mockito.runners.MockitoJUnitRunner; -import org.sonar.api.utils.System2; -import org.sonar.db.DbTester; -import org.sonar.db.property.PropertiesDao; -import org.sonar.db.property.PropertyDto; - -import static org.mockito.Mockito.when; - -@RunWith(MockitoJUnitRunner.class) -public class DevelopmentCostMeasuresMigrationStepTest { - - @Rule - public DbTester db = DbTester.createForSchema(System2.INSTANCE, DevelopmentCostMeasuresMigrationStepTest.class, "schema.sql"); - - @Mock - PropertiesDao propertiesDao; - - DevelopmentCostMeasuresMigrationStep migration; - - @Before - public void setUp() { - when(propertiesDao.selectGlobalProperty(WorkDurationConvertor.HOURS_IN_DAY_PROPERTY)).thenReturn(new PropertyDto().setValue("8")); - - migration = new DevelopmentCostMeasuresMigrationStep(db.database(), propertiesDao); - } - - @Test - public void migrate_dev_cost_measures() throws Exception { - db.prepareDbUnit(getClass(), "migrate_dev_cost_measures.xml"); - - migration.execute(); - - db.assertDbUnit(getClass(), "migrate_dev_cost_measures_result.xml", "project_measures"); - } - - @Test - public void metric_does_not_exist() throws Exception { - db.prepareDbUnit(getClass(), "metric_does_not_exist.xml"); - - migration.execute(); - - db.assertDbUnit(getClass(), "metric_does_not_exist_result.xml", "project_measures"); - } -} diff --git a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v43/IssueChangelogMigrationStepTest.java b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v43/IssueChangelogMigrationStepTest.java deleted file mode 100644 index d51b36fce56..00000000000 --- a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v43/IssueChangelogMigrationStepTest.java +++ /dev/null @@ -1,101 +0,0 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2014 SonarSource - * mailto:contact AT sonarsource DOT com - * - * SonarQube is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * SonarQube 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser 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. - */ - -package org.sonar.server.db.migrations.v43; - -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.Mock; -import org.mockito.runners.MockitoJUnitRunner; -import org.sonar.api.utils.DateUtils; -import org.sonar.api.utils.System2; -import org.sonar.db.DbTester; -import org.sonar.db.property.PropertiesDao; -import org.sonar.db.property.PropertyDto; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.Mockito.when; - -@RunWith(MockitoJUnitRunner.class) -public class IssueChangelogMigrationStepTest { - - @Rule - public DbTester db = DbTester.createForSchema(System2.INSTANCE, IssueChangelogMigrationStepTest.class, "schema.sql"); - - @Mock - System2 system2; - - @Mock - PropertiesDao propertiesDao; - - IssueChangelogMigrationStep migration; - - @Before - public void setUp() { - when(system2.now()).thenReturn(DateUtils.parseDateTime("2014-02-19T19:10:03+0100").getTime()); - when(propertiesDao.selectGlobalProperty(WorkDurationConvertor.HOURS_IN_DAY_PROPERTY)).thenReturn(new PropertyDto().setValue("8")); - - WorkDurationConvertor convertor = new WorkDurationConvertor(propertiesDao); - convertor.init(); - migration = new IssueChangelogMigrationStep(db.database(), system2, convertor); - } - - @Test - public void migrate_issue_changelog_debt() throws Exception { - db.prepareDbUnit(getClass(), "migrate_issue_changelog_debt.xml"); - - migration.execute(); - - db.assertDbUnit(getClass(), "migrate_issue_changelog_debt_result.xml", new String[] {"updated_at"}, "issue_changes"); - } - - @Test - public void convert_data_containing_only_debt_change() { - assertThat(migration.convertChangelog("technicalDebt=1|2")).isEqualTo("technicalDebt=1|2"); - assertThat(migration.convertChangelog("technicalDebt=100|200")).isEqualTo("technicalDebt=60|120"); - assertThat(migration.convertChangelog("technicalDebt=10000|20000")).isEqualTo("technicalDebt=480|960"); - - assertThat(migration.convertChangelog("technicalDebt=|2")).isEqualTo("technicalDebt=|2"); - assertThat(migration.convertChangelog("technicalDebt=1|")).isEqualTo("technicalDebt=1|"); - } - - @Test - public void convert_data_beginning_with_debt_change() { - assertThat(migration.convertChangelog("technicalDebt=100|200,status=RESOLVED|REOPENED")).isEqualTo("technicalDebt=60|120,status=RESOLVED|REOPENED"); - assertThat(migration.convertChangelog("technicalDebt=|200,status=RESOLVED|REOPENED")).isEqualTo("technicalDebt=|120,status=RESOLVED|REOPENED"); - assertThat(migration.convertChangelog("technicalDebt=100|,status=RESOLVED|REOPENED")).isEqualTo("technicalDebt=60|,status=RESOLVED|REOPENED"); - } - - @Test - public void convert_data_finishing_with_debt_change() { - assertThat(migration.convertChangelog("status=RESOLVED|REOPENED,technicalDebt=100|200")).isEqualTo("status=RESOLVED|REOPENED,technicalDebt=60|120"); - assertThat(migration.convertChangelog("status=RESOLVED|REOPENED,technicalDebt=|200")).isEqualTo("status=RESOLVED|REOPENED,technicalDebt=|120"); - assertThat(migration.convertChangelog("status=RESOLVED|REOPENED,technicalDebt=100|")).isEqualTo("status=RESOLVED|REOPENED,technicalDebt=60|"); - } - - @Test - public void convert_data_with_debt_change_in_the_middle() { - assertThat(migration.convertChangelog("status=RESOLVED|REOPENED,technicalDebt=100|200,resolution=")).isEqualTo("status=RESOLVED|REOPENED,technicalDebt=60|120,resolution="); - assertThat(migration.convertChangelog("status=RESOLVED|REOPENED,technicalDebt=|200,resolution=")).isEqualTo("status=RESOLVED|REOPENED,technicalDebt=|120,resolution="); - assertThat(migration.convertChangelog("status=RESOLVED|REOPENED,technicalDebt=100|,resolution=")).isEqualTo("status=RESOLVED|REOPENED,technicalDebt=60|,resolution="); - } -} diff --git a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v43/NotResolvedIssuesOnRemovedComponentsMigrationStepTest.java b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v43/NotResolvedIssuesOnRemovedComponentsMigrationStepTest.java deleted file mode 100644 index 015d7af03ab..00000000000 --- a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v43/NotResolvedIssuesOnRemovedComponentsMigrationStepTest.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2014 SonarSource - * mailto:contact AT sonarsource DOT com - * - * SonarQube is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * SonarQube 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser 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. - */ - -package org.sonar.server.db.migrations.v43; - -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.Mock; -import org.mockito.runners.MockitoJUnitRunner; -import org.sonar.api.utils.DateUtils; -import org.sonar.api.utils.System2; -import org.sonar.db.DbTester; - -import static org.mockito.Mockito.when; - -@RunWith(MockitoJUnitRunner.class) -public class NotResolvedIssuesOnRemovedComponentsMigrationStepTest { - - @Rule - public DbTester db = DbTester.createForSchema(System2.INSTANCE, NotResolvedIssuesOnRemovedComponentsMigrationStepTest.class, "schema.sql"); - - @Mock - System2 system2; - - NotResolvedIssuesOnRemovedComponentsMigrationStep migration; - - @Before - public void setUp() { - when(system2.now()).thenReturn(DateUtils.parseDate("2014-04-09").getTime()); - - migration = new NotResolvedIssuesOnRemovedComponentsMigrationStep(db.database(), system2); - } - - @Test - public void migrate_issues() throws Exception { - db.prepareDbUnit(getClass(), "migrate_issues.xml"); - - migration.execute(); - - db.assertDbUnit(getClass(), "migrate_issues_result.xml", "issues"); - } - -} diff --git a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v43/RequirementMeasuresMigrationStepTest.java b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v43/RequirementMeasuresMigrationStepTest.java deleted file mode 100644 index a47c06c8374..00000000000 --- a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v43/RequirementMeasuresMigrationStepTest.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2014 SonarSource - * mailto:contact AT sonarsource DOT com - * - * SonarQube is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * SonarQube 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser 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. - */ - -package org.sonar.server.db.migrations.v43; - -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.api.utils.System2; -import org.sonar.db.DbTester; - -public class RequirementMeasuresMigrationStepTest { - - @Rule - public DbTester db = DbTester.createForSchema(System2.INSTANCE, RequirementMeasuresMigrationStepTest.class, "schema.sql"); - - RequirementMeasuresMigrationStep migration; - - @Before - public void setUp() { - migration = new RequirementMeasuresMigrationStep(db.database()); - } - - @Test - public void migrate_measures_on_requirements() throws Exception { - db.prepareDbUnit(getClass(), "migrate_measures_on_requirements.xml"); - - migration.execute(); - - db.assertDbUnit(getClass(), "migrate_measures_on_requirements_result.xml", "project_measures"); - } -} diff --git a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationStepTest.java b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationStepTest.java deleted file mode 100644 index 4b2e17032da..00000000000 --- a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationStepTest.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2014 SonarSource - * mailto:contact AT sonarsource DOT com - * - * SonarQube is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * SonarQube 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser 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. - */ - -package org.sonar.server.db.migrations.v43; - -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.Mock; -import org.mockito.runners.MockitoJUnitRunner; -import org.sonar.api.utils.System2; -import org.sonar.db.DbTester; -import org.sonar.db.property.PropertiesDao; -import org.sonar.db.property.PropertyDto; - -import static org.mockito.Mockito.when; - -@RunWith(MockitoJUnitRunner.class) -public class TechnicalDebtMeasuresMigrationStepTest { - - @Rule - public DbTester db = DbTester.createForSchema(System2.INSTANCE, TechnicalDebtMeasuresMigrationStepTest.class, "schema.sql"); - - @Mock - PropertiesDao propertiesDao; - - TechnicalDebtMeasuresMigrationStep migration; - - @Before - public void setUp() { - when(propertiesDao.selectGlobalProperty(WorkDurationConvertor.HOURS_IN_DAY_PROPERTY)).thenReturn(new PropertyDto().setValue("8")); - - migration = new TechnicalDebtMeasuresMigrationStep(db.database(), propertiesDao); - } - - @Test - public void migrate_nothing() throws Exception { - db.prepareDbUnit(getClass(), "migrate_nothing.xml"); - - migration.execute(); - - db.assertDbUnit(getClass(), "migrate_nothing.xml", "project_measures"); - } - - @Test - public void migrate_technical_debt_measures() throws Exception { - db.prepareDbUnit(getClass(), "migrate_technical_debt_measures.xml"); - - migration.execute(); - - db.assertDbUnit(getClass(), "migrate_technical_debt_measures_result.xml", "project_measures"); - } - - @Test - public void migrate_added_technical_debt_measures() throws Exception { - db.prepareDbUnit(getClass(), "migrate_new_technical_debt_measures.xml"); - - migration.execute(); - - db.assertDbUnit(getClass(), "migrate_new_technical_debt_measures_result.xml", "project_measures"); - } - - @Test - public void migrate_sqale_measures() throws Exception { - db.prepareDbUnit(getClass(), "migrate_sqale_measures.xml"); - - migration.execute(); - - db.assertDbUnit(getClass(), "migrate_sqale_measures_result.xml", "project_measures"); - } - -} diff --git a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v43/WorkDurationConvertorTest.java b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v43/WorkDurationConvertorTest.java deleted file mode 100644 index b1702378e5a..00000000000 --- a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v43/WorkDurationConvertorTest.java +++ /dev/null @@ -1,103 +0,0 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2014 SonarSource - * mailto:contact AT sonarsource DOT com - * - * SonarQube is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * SonarQube 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser 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. - */ - -package org.sonar.server.db.migrations.v43; - -import org.junit.Test; -import org.sonar.db.property.PropertiesDao; -import org.sonar.db.property.PropertyDto; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.Assert.fail; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -public class WorkDurationConvertorTest { - - static final int HOURS_IN_DAY = 8; - static final Long ONE_MINUTE = 1L; - static final Long ONE_HOUR_IN_MINUTES = ONE_MINUTE * 60; - static final Long ONE_DAY_IN_MINUTES = ONE_HOUR_IN_MINUTES * HOURS_IN_DAY; - - PropertiesDao propertiesDao = mock(PropertiesDao.class); - - WorkDurationConvertor convertor = new WorkDurationConvertor(propertiesDao); - - @Test - public void convert_from_long() { - convertor.init(); - when(propertiesDao.selectGlobalProperty(WorkDurationConvertor.HOURS_IN_DAY_PROPERTY)).thenReturn(new PropertyDto().setValue(Integer.toString(HOURS_IN_DAY))); - - assertThat(convertor.createFromLong(1)).isEqualTo(ONE_MINUTE); - assertThat(convertor.createFromLong(100)).isEqualTo(ONE_HOUR_IN_MINUTES); - assertThat(convertor.createFromLong(10000)).isEqualTo(ONE_DAY_IN_MINUTES); - assertThat(convertor.createFromLong(10101)).isEqualTo(ONE_DAY_IN_MINUTES + ONE_HOUR_IN_MINUTES + ONE_MINUTE); - } - - @Test - public void convert_from_long_use_default_value_for_hours_in_day_when_no_property() { - convertor.init(); - assertThat(convertor.createFromLong(1)).isEqualTo(ONE_MINUTE); - } - - @Test - public void fail_convert_from_long_on_bad_hours_in_day_property() { - when(propertiesDao.selectGlobalProperty(WorkDurationConvertor.HOURS_IN_DAY_PROPERTY)).thenReturn(new PropertyDto().setValue("-2")); - WorkDurationConvertor workDurationConvertor = new WorkDurationConvertor(propertiesDao); - try { - workDurationConvertor.init(); - fail(); - } catch (Exception e) { - assertThat(e).isInstanceOf(IllegalArgumentException.class); - } - } - - @Test - public void convert_from_days() { - convertor.init(); - when(propertiesDao.selectGlobalProperty(WorkDurationConvertor.HOURS_IN_DAY_PROPERTY)).thenReturn(new PropertyDto().setValue(Integer.toString(HOURS_IN_DAY))); - - assertThat(convertor.createFromDays(1.0)).isEqualTo(ONE_DAY_IN_MINUTES); - assertThat(convertor.createFromDays(0.1)).isEqualTo(48L); - - // Should be 4.8 but as it's a long it's truncated after comma - assertThat(convertor.createFromDays(0.01)).isEqualTo(4L); - } - - @Test - public void fail_it_init_has_not_been_called() { - when(propertiesDao.selectGlobalProperty(WorkDurationConvertor.HOURS_IN_DAY_PROPERTY)).thenReturn(new PropertyDto().setValue(Integer.toString(HOURS_IN_DAY))); - - try { - assertThat(convertor.createFromLong(1L)); - fail(); - } catch (Exception e) { - assertThat(e).isInstanceOf(IllegalStateException.class); - } - - try { - assertThat(convertor.createFromDays(1.0)); - fail(); - } catch (Exception e) { - assertThat(e).isInstanceOf(IllegalStateException.class); - } - } - -} diff --git a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v44/ChangeLogMigrationTest.java b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v44/ChangeLogMigrationTest.java deleted file mode 100644 index 41b654e3e3f..00000000000 --- a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v44/ChangeLogMigrationTest.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2014 SonarSource - * mailto:contact AT sonarsource DOT com - * - * SonarQube is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * SonarQube 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser 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. - */ -package org.sonar.server.db.migrations.v44; - -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.api.utils.DateUtils; -import org.sonar.api.utils.System2; -import org.sonar.db.DbClient; -import org.sonar.db.DbTester; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -public class ChangeLogMigrationTest { - - @Rule - public DbTester db = DbTester.createForSchema(System2.INSTANCE, ChangeLogMigrationTest.class, "schema.sql"); - - System2 system2 = mock(System2.class); - DbClient dbClient = db.getDbClient(); - ChangeLogMigrationStep migration; - - @Before - public void setUp() { - when(system2.now()).thenReturn(DateUtils.parseDate("2014-03-13").getTime()); - migration = new ChangeLogMigrationStep(dbClient.activityDao(), dbClient); - } - - @Test - public void migrate() { - db.prepareDbUnit(getClass(), "active_rules_changes.xml"); - migration.execute(); - assertThat(db.countRowsOfTable("activities")).isEqualTo(5); - - int count = db.countSql("select count(*) from activities where data_field like '%param_PARAM1=TODO%'"); - assertThat(count).isGreaterThan(0); - } - - @Test - public void migrate_when_no_changelog() { - db.prepareDbUnit(getClass(), "migrate_when_no_changelog.xml"); - migration.execute(); - - assertThat(db.countRowsOfTable("activities")).isEqualTo(0); - } -} diff --git a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v44/ConvertProfileMeasuresMigrationTest.java b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v44/ConvertProfileMeasuresMigrationTest.java deleted file mode 100644 index 59207746e33..00000000000 --- a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v44/ConvertProfileMeasuresMigrationTest.java +++ /dev/null @@ -1,114 +0,0 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2014 SonarSource - * mailto:contact AT sonarsource DOT com - * - * SonarQube is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * SonarQube 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser 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. - */ - -package org.sonar.server.db.migrations.v44; - -import java.sql.Connection; -import java.sql.ResultSet; -import java.sql.Statement; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.api.utils.System2; -import org.sonar.db.DbTester; -import org.sonar.server.db.DbClient; - -import static org.assertj.core.api.Assertions.assertThat; - -public class ConvertProfileMeasuresMigrationTest { - - @Rule - public DbTester db = DbTester.createForSchema(System2.INSTANCE, ConvertProfileMeasuresMigrationTest.class, "schema.sql"); - - ConvertProfileMeasuresMigrationStep migration; - - @Before - public void setUp() { - DbClient dbClient = new DbClient(db.database(), db.myBatis()); - migration = new ConvertProfileMeasuresMigrationStep(dbClient); - } - - @Test - public void generate_profiles_measure_as_json() throws Exception { - db.prepareDbUnit(getClass(), "before.xml"); - - migration.execute(); - - Connection connection = db.openConnection(); - Statement stmt = connection.createStatement(); - ResultSet rs = stmt.executeQuery("select text_value from project_measures where id=2"); - try { - rs.next(); - // pb of comparison of timezones..., so using startsWith instead of equals - assertThat(rs.getString(1)).startsWith("[{\"key\":\"java-sonar-way\",\"language\":\"java\",\"name\":\"Sonar way\",\"rulesUpdatedAt\":\"2014-01-04T"); - } finally { - rs.close(); - stmt.close(); - connection.close(); - } - } - - /** - * http://jira.sonarsource.com/browse/SONAR-5515 - * Version of quality profile was introduced in SQ 2.9. Migration must not fail - * when there are still some projects which last analysis was done with SQ <= 2.8. - */ - @Test - public void missing_profile_version() throws Exception { - db.prepareDbUnit(getClass(), "missing_profile_version.xml"); - - migration.execute(); - - Connection connection = db.openConnection(); - Statement stmt = connection.createStatement(); - ResultSet rs = stmt.executeQuery("select text_value from project_measures where id=2"); - try { - rs.next(); - // pb of comparison of timezones..., so using startsWith instead of equals - assertThat(rs.getString(1)).startsWith("[{\"key\":\"java-sonar-way\",\"language\":\"java\",\"name\":\"Sonar way\",\"rulesUpdatedAt\":"); - } finally { - rs.close(); - stmt.close(); - connection.close(); - } - } - - /** - * http://jira.sonarsource.com/browse/SONAR-5580 - */ - @Test - public void delete_measure_when_profile_does_not_exist() throws Exception { - db.prepareDbUnit(getClass(), "measure_on_deleted_profile.xml"); - - migration.execute(); - - try (Connection connection = db.openConnection()) { - Statement stmt = connection.createStatement(); - ResultSet rs = stmt.executeQuery("select * from project_measures where id=2"); - try { - // measure is deleted - assertThat(rs.next()).isFalse(); - } finally { - rs.close(); - stmt.close(); - } - } - } -} diff --git a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v44/FeedQProfileDatesMigrationTest.java b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v44/FeedQProfileDatesMigrationTest.java deleted file mode 100644 index b74b1d52ca3..00000000000 --- a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v44/FeedQProfileDatesMigrationTest.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2014 SonarSource - * mailto:contact AT sonarsource DOT com - * - * SonarQube is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * SonarQube 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser 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. - */ - -package org.sonar.server.db.migrations.v44; - -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.api.utils.System2; -import org.sonar.core.util.UtcDateUtils; -import org.sonar.db.DbTester; -import org.sonar.server.db.DbClient; - -import java.util.Map; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -public class FeedQProfileDatesMigrationTest { - - @Rule - public DbTester db = DbTester.createForSchema(System2.INSTANCE, FeedQProfileDatesMigrationTest.class, "schema.sql"); - - FeedQProfileDatesMigrationStep migration; - - @Before - public void setUp() { - db.executeUpdateSql("truncate table active_rule_changes"); - db.executeUpdateSql("truncate table active_rule_param_changes"); - DbClient dbClient = new DbClient(db.database(), db.myBatis()); - System2 system = mock(System2.class); - when(system.now()).thenReturn(UtcDateUtils.parseDateTime("2014-07-03T12:00:00+0000").getTime()); - migration = new FeedQProfileDatesMigrationStep(dbClient, system); - } - - @Test - public void feed_created_at_and_updated_at() { - db.prepareDbUnit(getClass(), "feed_created_at_and_updated_at.xml"); - - migration.execute(); - - Map columns = db.selectFirst("select created_at as \"createdAt\", updated_at as \"updatedAt\" from rules_profiles where id=10"); - assertThat(columns.get("createdAt").toString()).startsWith("2011-12-2"); - assertThat(columns.get("updatedAt").toString()).startsWith("2014-01-2"); - } - - @Test - public void use_default_dates_when_no_changes() { - db.prepareDbUnit(getClass(), "use_default_dates_when_no_changes.xml"); - - migration.execute(); - - Map columns = db.selectFirst("select created_at as \"createdAt\", updated_at as \"updatedAt\" from rules_profiles where id=10"); - assertThat(columns.get("createdAt").toString()).startsWith("2014-07-0"); - assertThat(columns.get("updatedAt").toString()).startsWith("2014-07-0"); - } - -} diff --git a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v44/FeedQProfileKeysMigrationTest.java b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v44/FeedQProfileKeysMigrationTest.java deleted file mode 100644 index 445bf8d342d..00000000000 --- a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v44/FeedQProfileKeysMigrationTest.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2014 SonarSource - * mailto:contact AT sonarsource DOT com - * - * SonarQube is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * SonarQube 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser 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. - */ - -package org.sonar.server.db.migrations.v44; - -import org.junit.Rule; -import org.junit.Test; -import org.sonar.api.utils.System2; -import org.sonar.db.DbTester; - -import java.util.List; -import java.util.Map; - -import static org.assertj.core.api.Assertions.assertThat; - -public class FeedQProfileKeysMigrationTest { - - @Rule - public DbTester db = DbTester.createForSchema(System2.INSTANCE, FeedQProfileKeysMigrationTest.class, "schema.sql"); - - @Test - public void feed_keys() throws Exception { - db.prepareDbUnit(getClass(), "feed_keys.xml"); - - new FeedQProfileKeysMigrationStep(db.database()).execute(); - - List> profiles = db.select("SELECT kee, name, language, parent_kee FROM rules_profiles ORDER BY id ASC"); - - Map parentProfile = profiles.get(0); - assertThat((String) parentProfile.get("KEE")).startsWith("java-sonar-way-"); - assertThat(parentProfile.get("NAME")).isEqualTo("Sonar Way"); - assertThat(parentProfile.get("LANGUAGE")).isEqualTo("java"); - assertThat(parentProfile.get("PARENT_KEE")).isNull(); - - Map differentCaseProfile = profiles.get(1); - assertThat((String) differentCaseProfile.get("KEE")).startsWith("java-sonar-way-").isNotEqualTo(parentProfile.get("KEE")); - assertThat(differentCaseProfile.get("NAME")).isEqualTo("Sonar way"); - assertThat(differentCaseProfile.get("PARENT_KEE")).isNull(); - - Map childProfile = profiles.get(2); - assertThat((String) childProfile.get("KEE")).startsWith("java-child-"); - assertThat(childProfile.get("NAME")).isEqualTo("Child"); - assertThat(childProfile.get("PARENT_KEE")).isEqualTo(parentProfile.get("KEE")); - - Map phpProfile = profiles.get(3); - assertThat((String) phpProfile.get("KEE")).startsWith("php-sonar-way-"); - assertThat(phpProfile.get("NAME")).isEqualTo("Sonar Way"); - assertThat(phpProfile.get("LANGUAGE")).isEqualTo("php"); - assertThat(phpProfile.get("PARENT_KEE")).isNull(); - } - -} diff --git a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v44/IssueActionPlanKeyMigrationTest.java b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v44/IssueActionPlanKeyMigrationTest.java deleted file mode 100644 index e684184c0af..00000000000 --- a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v44/IssueActionPlanKeyMigrationTest.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2014 SonarSource - * mailto:contact AT sonarsource DOT com - * - * SonarQube is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * SonarQube 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser 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. - */ - -package org.sonar.server.db.migrations.v44; - -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.Mock; -import org.mockito.runners.MockitoJUnitRunner; -import org.sonar.api.utils.DateUtils; -import org.sonar.api.utils.System2; -import org.sonar.db.DbTester; - -import static org.mockito.Mockito.when; - -@RunWith(MockitoJUnitRunner.class) -public class IssueActionPlanKeyMigrationTest { - - @Rule - public DbTester db = DbTester.createForSchema(System2.INSTANCE, IssueActionPlanKeyMigrationTest.class, "schema.sql"); - - @Mock - System2 system2; - - IssueActionPlanKeyMigrationStep migration; - - @Before - public void setUp() { - when(system2.now()).thenReturn(DateUtils.parseDate("2014-04-28").getTime()); - - migration = new IssueActionPlanKeyMigrationStep(db.database(), system2); - } - - @Test - public void migrate_issues_action_plan_key() throws Exception { - db.prepareDbUnit(getClass(), "migrate_issues_action_plan_key.xml"); - - migration.execute(); - - db.assertDbUnit(getClass(), "migrate_issues_action_plan_key_result.xml", "issues"); - } - -} diff --git a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v44/MeasureDataMigrationTest.java b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v44/MeasureDataMigrationTest.java deleted file mode 100644 index 14b140e8235..00000000000 --- a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v44/MeasureDataMigrationTest.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2014 SonarSource - * mailto:contact AT sonarsource DOT com - * - * SonarQube is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * SonarQube 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser 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. - */ - -package org.sonar.server.db.migrations.v44; - -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.runners.MockitoJUnitRunner; -import org.sonar.api.utils.System2; -import org.sonar.db.DbTester; - -@RunWith(MockitoJUnitRunner.class) -public class MeasureDataMigrationTest { - - @Rule - public DbTester db = DbTester.createForSchema(System2.INSTANCE, MeasureDataMigrationTest.class, "schema.sql"); - - MeasureDataMigrationStep migration; - - @Before - public void setUp() { - migration = new MeasureDataMigrationStep(db.database()); - } - - @Test - public void migrate_issues_action_plan_key() throws Exception { - db.prepareDbUnit(getClass(), "migrate_measure_data.xml"); - - migration.execute(); - - db.assertDbUnit(getClass(), "migrate_measure_data-result.xml", "project_measures"); - } - -} diff --git a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v45/AddMissingRuleParameterDefaultValuesMigrationTest.java b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v45/AddMissingRuleParameterDefaultValuesMigrationTest.java deleted file mode 100644 index d2de3ac8ee4..00000000000 --- a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v45/AddMissingRuleParameterDefaultValuesMigrationTest.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2014 SonarSource - * mailto:contact AT sonarsource DOT com - * - * SonarQube is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * SonarQube 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser 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. - */ -package org.sonar.server.db.migrations.v45; - -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.api.utils.DateUtils; -import org.sonar.api.utils.System2; -import org.sonar.db.DbTester; -import org.sonar.server.db.migrations.MigrationStep; - -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -public class AddMissingRuleParameterDefaultValuesMigrationTest { - - @Rule - public DbTester db = DbTester.createForSchema(System2.INSTANCE, AddMissingRuleParameterDefaultValuesMigrationTest.class, "schema.sql"); - - MigrationStep migration; - System2 system = mock(System2.class); - - @Before - public void setUp() { - db.executeUpdateSql("truncate table rules_parameters"); - db.executeUpdateSql("truncate table active_rules"); - db.executeUpdateSql("truncate table active_rule_parameters"); - migration = new AddMissingRuleParameterDefaultValuesMigrationStep(db.database(), system); - when(system.now()).thenReturn(DateUtils.parseDate("2014-04-28").getTime()); - } - - @Test - public void execute() throws Exception { - db.prepareDbUnit(getClass(), "before.xml"); - - migration.execute(); - - db.assertDbUnit(getClass(), "after.xml", "rules_parameters", "active_rules", "active_rule_parameters"); - } - - @Test - public void no_changes() throws Exception { - db.prepareDbUnit(getClass(), "no_changes.xml"); - - migration.execute(); - - db.assertDbUnit(getClass(), "no_changes.xml", "rules_parameters", "active_rules", "active_rule_parameters"); - } -} diff --git a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v45/DeleteMeasuresOnDeletedProfilesMigrationTest.java b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v45/DeleteMeasuresOnDeletedProfilesMigrationTest.java deleted file mode 100644 index 7972ebaebac..00000000000 --- a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v45/DeleteMeasuresOnDeletedProfilesMigrationTest.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2014 SonarSource - * mailto:contact AT sonarsource DOT com - * - * SonarQube is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * SonarQube 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser 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. - */ - -package org.sonar.server.db.migrations.v45; - -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.api.utils.System2; -import org.sonar.db.DbTester; -import org.sonar.server.db.DbClient; -import org.sonar.server.db.migrations.MigrationStep; - -import java.sql.Connection; -import java.sql.ResultSet; -import java.sql.Statement; - -import static org.assertj.core.api.Assertions.assertThat; - -public class DeleteMeasuresOnDeletedProfilesMigrationTest { - - @Rule - public DbTester db = DbTester.createForSchema(System2.INSTANCE, DeleteMeasuresOnDeletedProfilesMigrationTest.class, "schema.sql"); - - MigrationStep migration; - - @Before - public void setUp() { - DbClient dbClient = new DbClient(db.database(), db.myBatis()); - migration = new DeleteMeasuresOnDeletedProfilesMigrationStep(dbClient); - } - - @Test - public void delete_measures_with_no_json_data() throws Exception { - db.prepareDbUnit(getClass(), "before.xml"); - - migration.execute(); - - Connection connection = db.openConnection(); - Statement stmt = connection.createStatement(); - ResultSet rs = stmt.executeQuery("select id from project_measures"); - try { - assertThat(rs.next()).isTrue(); - assertThat(rs.getInt(1)).isEqualTo(2); - assertThat(rs.next()).isFalse(); - } finally { - rs.close(); - stmt.close(); - connection.close(); - } - } -} diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v42/CompleteIssueMessageMigrationTest/after.xml b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v42/CompleteIssueMessageMigrationTest/after.xml deleted file mode 100644 index 8ff8b92f9ad..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v42/CompleteIssueMessageMigrationTest/after.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v42/CompleteIssueMessageMigrationTest/before.xml b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v42/CompleteIssueMessageMigrationTest/before.xml deleted file mode 100644 index f9ffbc7001b..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v42/CompleteIssueMessageMigrationTest/before.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v42/CompleteIssueMessageMigrationTest/schema.sql b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v42/CompleteIssueMessageMigrationTest/schema.sql deleted file mode 100644 index 1e55770612e..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v42/CompleteIssueMessageMigrationTest/schema.sql +++ /dev/null @@ -1,47 +0,0 @@ --- 4.2 -CREATE TABLE "RULES" ( - "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), - "PLUGIN_RULE_KEY" VARCHAR(200) NOT NULL, - "PLUGIN_NAME" VARCHAR(255) NOT NULL, - "DESCRIPTION" VARCHAR(16777215), - "PRIORITY" INTEGER, - "CARDINALITY" VARCHAR(10), - "PARENT_ID" INTEGER, - "PLUGIN_CONFIG_KEY" VARCHAR(500), - "NAME" VARCHAR(200), - "STATUS" VARCHAR(40), - "LANGUAGE" VARCHAR(20), - "CREATED_AT" TIMESTAMP, - "UPDATED_AT" TIMESTAMP, - "NOTE_CREATED_AT" TIMESTAMP, - "NOTE_UPDATED_AT" TIMESTAMP, - "NOTE_USER_LOGIN" VARCHAR(40), - "NOTE_DATA" CLOB(2147483647) -); - -CREATE TABLE "ISSUES" ( - "ID" BIGINT NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), - "KEE" VARCHAR(50) UNIQUE NOT NULL, - "COMPONENT_ID" INTEGER NOT NULL, - "ROOT_COMPONENT_ID" INTEGER, - "RULE_ID" INTEGER, - "SEVERITY" VARCHAR(10), - "MANUAL_SEVERITY" BOOLEAN NOT NULL, - "MESSAGE" VARCHAR(4000), - "LINE" INTEGER, - "EFFORT_TO_FIX" DOUBLE, - "TECHNICAL_DEBT" INTEGER, - "STATUS" VARCHAR(20), - "RESOLUTION" VARCHAR(20), - "CHECKSUM" VARCHAR(1000), - "REPORTER" VARCHAR(40), - "ASSIGNEE" VARCHAR(40), - "AUTHOR_LOGIN" VARCHAR(100), - "ACTION_PLAN_KEY" VARCHAR(50) NULL, - "ISSUE_ATTRIBUTES" VARCHAR(4000), - "ISSUE_CREATION_DATE" TIMESTAMP, - "ISSUE_CLOSE_DATE" TIMESTAMP, - "ISSUE_UPDATE_DATE" TIMESTAMP, - "CREATED_AT" TIMESTAMP, - "UPDATED_AT" TIMESTAMP -); diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v42/PackageKeysMigrationTest/after.xml b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v42/PackageKeysMigrationTest/after.xml deleted file mode 100644 index 142037441e8..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v42/PackageKeysMigrationTest/after.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v42/PackageKeysMigrationTest/before.xml b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v42/PackageKeysMigrationTest/before.xml deleted file mode 100644 index e750919484a..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v42/PackageKeysMigrationTest/before.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v42/PackageKeysMigrationTest/schema.sql b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v42/PackageKeysMigrationTest/schema.sql deleted file mode 100644 index 6860012ede7..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v42/PackageKeysMigrationTest/schema.sql +++ /dev/null @@ -1,18 +0,0 @@ --- 4.3 -CREATE TABLE "PROJECTS" ( - "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), - "NAME" VARCHAR(256), - "DESCRIPTION" VARCHAR(2000), - "ENABLED" BOOLEAN NOT NULL DEFAULT TRUE, - "SCOPE" VARCHAR(3), - "QUALIFIER" VARCHAR(10), - "KEE" VARCHAR(400), - "DEPRECATED_KEE" VARCHAR(400), - "PATH" VARCHAR(2000), - "ROOT_ID" INTEGER, - "LANGUAGE" VARCHAR(20), - "COPY_RESOURCE_ID" INTEGER, - "LONG_NAME" VARCHAR(256), - "PERSON_ID" INTEGER, - "CREATED_AT" TIMESTAMP -); diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/ConvertIssueDebtToMinutesMigrationStepTest/migrate_issues_debt.xml b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/ConvertIssueDebtToMinutesMigrationStepTest/migrate_issues_debt.xml deleted file mode 100644 index 7717330b452..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/ConvertIssueDebtToMinutesMigrationStepTest/migrate_issues_debt.xml +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - - - - - - - - - - - - - - diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/ConvertIssueDebtToMinutesMigrationStepTest/migrate_issues_debt_result.xml b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/ConvertIssueDebtToMinutesMigrationStepTest/migrate_issues_debt_result.xml deleted file mode 100644 index c8d9eaecc06..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/ConvertIssueDebtToMinutesMigrationStepTest/migrate_issues_debt_result.xml +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - - - - - - - - - - - - - - diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/ConvertIssueDebtToMinutesMigrationStepTest/schema.sql b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/ConvertIssueDebtToMinutesMigrationStepTest/schema.sql deleted file mode 100644 index f3f71cfa229..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/ConvertIssueDebtToMinutesMigrationStepTest/schema.sql +++ /dev/null @@ -1,28 +0,0 @@ --- 4.3 - -CREATE TABLE "ISSUES" ( - "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), - "KEE" VARCHAR(50) UNIQUE NOT NULL, - "COMPONENT_ID" INTEGER NOT NULL, - "ROOT_COMPONENT_ID" INTEGER, - "RULE_ID" INTEGER, - "SEVERITY" VARCHAR(10), - "MANUAL_SEVERITY" BOOLEAN NOT NULL, - "MESSAGE" VARCHAR(4000), - "LINE" INTEGER, - "EFFORT_TO_FIX" DOUBLE, - "STATUS" VARCHAR(20), - "RESOLUTION" VARCHAR(20), - "CHECKSUM" VARCHAR(1000), - "REPORTER" VARCHAR(40), - "ASSIGNEE" VARCHAR(40), - "AUTHOR_LOGIN" VARCHAR(100), - "ACTION_PLAN_KEY" VARCHAR(50) NULL, - "ISSUE_ATTRIBUTES" VARCHAR(4000), - "ISSUE_CREATION_DATE" TIMESTAMP, - "ISSUE_CLOSE_DATE" TIMESTAMP, - "ISSUE_UPDATE_DATE" TIMESTAMP, - "CREATED_AT" TIMESTAMP, - "UPDATED_AT" TIMESTAMP, - "TECHNICAL_DEBT" INTEGER -); diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/DevelopmentCostMeasuresMigrationStepTest/metric_does_not_exist.xml b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/DevelopmentCostMeasuresMigrationStepTest/metric_does_not_exist.xml deleted file mode 100644 index 0fb812f9a3d..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/DevelopmentCostMeasuresMigrationStepTest/metric_does_not_exist.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/DevelopmentCostMeasuresMigrationStepTest/metric_does_not_exist_result.xml b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/DevelopmentCostMeasuresMigrationStepTest/metric_does_not_exist_result.xml deleted file mode 100644 index 0fb812f9a3d..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/DevelopmentCostMeasuresMigrationStepTest/metric_does_not_exist_result.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/DevelopmentCostMeasuresMigrationStepTest/migrate_dev_cost_measures.xml b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/DevelopmentCostMeasuresMigrationStepTest/migrate_dev_cost_measures.xml deleted file mode 100644 index 2d1633de2ff..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/DevelopmentCostMeasuresMigrationStepTest/migrate_dev_cost_measures.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/DevelopmentCostMeasuresMigrationStepTest/migrate_dev_cost_measures_result.xml b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/DevelopmentCostMeasuresMigrationStepTest/migrate_dev_cost_measures_result.xml deleted file mode 100644 index 6db169e5b2e..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/DevelopmentCostMeasuresMigrationStepTest/migrate_dev_cost_measures_result.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/DevelopmentCostMeasuresMigrationStepTest/schema.sql b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/DevelopmentCostMeasuresMigrationStepTest/schema.sql deleted file mode 100644 index 1e29613934e..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/DevelopmentCostMeasuresMigrationStepTest/schema.sql +++ /dev/null @@ -1,45 +0,0 @@ --- 4.3 - -CREATE TABLE "PROJECT_MEASURES" ( - "ID" BIGINT NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), - "VALUE" DOUBLE, - "METRIC_ID" INTEGER NOT NULL, - "SNAPSHOT_ID" INTEGER, - "RULE_ID" INTEGER, - "RULES_CATEGORY_ID" INTEGER, - "TEXT_VALUE" VARCHAR(96), - "TENDENCY" INTEGER, - "MEASURE_DATE" TIMESTAMP, - "PROJECT_ID" INTEGER, - "ALERT_STATUS" VARCHAR(5), - "ALERT_TEXT" VARCHAR(4000), - "URL" VARCHAR(2000), - "DESCRIPTION" VARCHAR(4000), - "RULE_PRIORITY" INTEGER, - "CHARACTERISTIC_ID" INTEGER, - "PERSON_ID" INTEGER, - "VARIATION_VALUE_1" DOUBLE, - "VARIATION_VALUE_2" DOUBLE, - "VARIATION_VALUE_3" DOUBLE, - "VARIATION_VALUE_4" DOUBLE, - "VARIATION_VALUE_5" DOUBLE -); - -CREATE TABLE "METRICS" ( - "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), - "NAME" VARCHAR(64) NOT NULL, - "DESCRIPTION" VARCHAR(255), - "DIRECTION" INTEGER NOT NULL DEFAULT 0, - "DOMAIN" VARCHAR(64), - "SHORT_NAME" VARCHAR(64), - "QUALITATIVE" BOOLEAN NOT NULL DEFAULT FALSE, - "VAL_TYPE" VARCHAR(8), - "USER_MANAGED" BOOLEAN DEFAULT FALSE, - "ENABLED" BOOLEAN DEFAULT TRUE, - "ORIGIN" VARCHAR(3), - "WORST_VALUE" DOUBLE, - "BEST_VALUE" DOUBLE, - "OPTIMIZED_BEST_VALUE" BOOLEAN, - "HIDDEN" BOOLEAN, - "DELETE_HISTORICAL_DATA" BOOLEAN -); diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/IssueChangelogMigrationStepTest/migrate_issue_changelog_debt.xml b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/IssueChangelogMigrationStepTest/migrate_issue_changelog_debt.xml deleted file mode 100644 index 5116d3e270d..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/IssueChangelogMigrationStepTest/migrate_issue_changelog_debt.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/IssueChangelogMigrationStepTest/migrate_issue_changelog_debt_result.xml b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/IssueChangelogMigrationStepTest/migrate_issue_changelog_debt_result.xml deleted file mode 100644 index a42f67e500b..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/IssueChangelogMigrationStepTest/migrate_issue_changelog_debt_result.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/IssueChangelogMigrationStepTest/schema.sql b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/IssueChangelogMigrationStepTest/schema.sql deleted file mode 100644 index b6bcd85c6ff..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/IssueChangelogMigrationStepTest/schema.sql +++ /dev/null @@ -1,13 +0,0 @@ --- 4.3 - -CREATE TABLE "ISSUE_CHANGES" ( - "ID" BIGINT NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), - "KEE" VARCHAR(50), - "ISSUE_KEY" VARCHAR(50) NOT NULL, - "USER_LOGIN" VARCHAR(40), - "CHANGE_TYPE" VARCHAR(40), - "CHANGE_DATA" VARCHAR(16777215), - "CREATED_AT" TIMESTAMP, - "UPDATED_AT" TIMESTAMP, - "ISSUE_CHANGE_CREATION_DATE" TIMESTAMP, -); diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/NotResolvedIssuesOnRemovedComponentsMigrationStepTest/migrate_issues.xml b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/NotResolvedIssuesOnRemovedComponentsMigrationStepTest/migrate_issues.xml deleted file mode 100644 index 1e7e5ab984c..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/NotResolvedIssuesOnRemovedComponentsMigrationStepTest/migrate_issues.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/NotResolvedIssuesOnRemovedComponentsMigrationStepTest/migrate_issues_result.xml b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/NotResolvedIssuesOnRemovedComponentsMigrationStepTest/migrate_issues_result.xml deleted file mode 100644 index 4509c279724..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/NotResolvedIssuesOnRemovedComponentsMigrationStepTest/migrate_issues_result.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/NotResolvedIssuesOnRemovedComponentsMigrationStepTest/schema.sql b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/NotResolvedIssuesOnRemovedComponentsMigrationStepTest/schema.sql deleted file mode 100644 index c0129aa79f5..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/NotResolvedIssuesOnRemovedComponentsMigrationStepTest/schema.sql +++ /dev/null @@ -1,46 +0,0 @@ --- 4.3 - -CREATE TABLE "ISSUES" ( - "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), - "KEE" VARCHAR(50) UNIQUE NOT NULL, - "COMPONENT_ID" INTEGER NOT NULL, - "ROOT_COMPONENT_ID" INTEGER, - "RULE_ID" INTEGER, - "SEVERITY" VARCHAR(10), - "MANUAL_SEVERITY" BOOLEAN NOT NULL, - "MESSAGE" VARCHAR(4000), - "LINE" INTEGER, - "EFFORT_TO_FIX" DOUBLE, - "STATUS" VARCHAR(20), - "RESOLUTION" VARCHAR(20), - "CHECKSUM" VARCHAR(1000), - "REPORTER" VARCHAR(40), - "ASSIGNEE" VARCHAR(40), - "AUTHOR_LOGIN" VARCHAR(100), - "ACTION_PLAN_KEY" VARCHAR(50) NULL, - "ISSUE_ATTRIBUTES" VARCHAR(4000), - "ISSUE_CREATION_DATE" TIMESTAMP, - "ISSUE_CLOSE_DATE" TIMESTAMP, - "ISSUE_UPDATE_DATE" TIMESTAMP, - "CREATED_AT" TIMESTAMP, - "UPDATED_AT" TIMESTAMP, - "TECHNICAL_DEBT" INTEGER -); - -CREATE TABLE "PROJECTS" ( - "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), - "NAME" VARCHAR(256), - "DESCRIPTION" VARCHAR(2000), - "ENABLED" BOOLEAN NOT NULL DEFAULT TRUE, - "SCOPE" VARCHAR(3), - "QUALIFIER" VARCHAR(10), - "KEE" VARCHAR(400), - "DEPRECATED_KEE" VARCHAR(400), - "PATH" VARCHAR(2000), - "ROOT_ID" INTEGER, - "LANGUAGE" VARCHAR(20), - "COPY_RESOURCE_ID" INTEGER, - "LONG_NAME" VARCHAR(256), - "PERSON_ID" INTEGER, - "CREATED_AT" TIMESTAMP -); diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/RequirementMeasuresMigrationStepTest/migrate_measures_on_requirements.xml b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/RequirementMeasuresMigrationStepTest/migrate_measures_on_requirements.xml deleted file mode 100644 index a5249ee19f0..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/RequirementMeasuresMigrationStepTest/migrate_measures_on_requirements.xml +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/RequirementMeasuresMigrationStepTest/migrate_measures_on_requirements_result.xml b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/RequirementMeasuresMigrationStepTest/migrate_measures_on_requirements_result.xml deleted file mode 100644 index df20f63c880..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/RequirementMeasuresMigrationStepTest/migrate_measures_on_requirements_result.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/RequirementMeasuresMigrationStepTest/schema.sql b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/RequirementMeasuresMigrationStepTest/schema.sql deleted file mode 100644 index a60b5de5b5d..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/RequirementMeasuresMigrationStepTest/schema.sql +++ /dev/null @@ -1,44 +0,0 @@ --- 4.3 - -CREATE TABLE "PROJECT_MEASURES" ( - "ID" BIGINT NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), - "VALUE" DOUBLE, - "METRIC_ID" INTEGER NOT NULL, - "SNAPSHOT_ID" INTEGER, - "RULE_ID" INTEGER, - "RULES_CATEGORY_ID" INTEGER, - "TEXT_VALUE" VARCHAR(96), - "TENDENCY" INTEGER, - "MEASURE_DATE" TIMESTAMP, - "PROJECT_ID" INTEGER, - "ALERT_STATUS" VARCHAR(5), - "ALERT_TEXT" VARCHAR(4000), - "URL" VARCHAR(2000), - "DESCRIPTION" VARCHAR(4000), - "RULE_PRIORITY" INTEGER, - "CHARACTERISTIC_ID" INTEGER, - "PERSON_ID" INTEGER, - "VARIATION_VALUE_1" DOUBLE, - "VARIATION_VALUE_2" DOUBLE, - "VARIATION_VALUE_3" DOUBLE, - "VARIATION_VALUE_4" DOUBLE, - "VARIATION_VALUE_5" DOUBLE -); - -CREATE TABLE "CHARACTERISTICS" ( - "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), - "KEE" VARCHAR(100), - "NAME" VARCHAR(100), - "PARENT_ID" INTEGER, - "ROOT_ID" INTEGER, - "RULE_ID" INTEGER, - "FUNCTION_KEY" VARCHAR(100), - "FACTOR_VALUE" DOUBLE, - "FACTOR_UNIT" VARCHAR(100), - "OFFSET_VALUE" DOUBLE, - "OFFSET_UNIT" VARCHAR(100), - "CHARACTERISTIC_ORDER" INTEGER, - "ENABLED" BOOLEAN, - "CREATED_AT" TIMESTAMP, - "UPDATED_AT" TIMESTAMP -); diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationStepTest/migrate_new_technical_debt_measures.xml b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationStepTest/migrate_new_technical_debt_measures.xml deleted file mode 100644 index fec9c9c2d58..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationStepTest/migrate_new_technical_debt_measures.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - - diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationStepTest/migrate_new_technical_debt_measures_result.xml b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationStepTest/migrate_new_technical_debt_measures_result.xml deleted file mode 100644 index 0c77c0fb524..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationStepTest/migrate_new_technical_debt_measures_result.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - - diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationStepTest/migrate_nothing.xml b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationStepTest/migrate_nothing.xml deleted file mode 100644 index d4e3f4a0101..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationStepTest/migrate_nothing.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationStepTest/migrate_nothing_result.xml b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationStepTest/migrate_nothing_result.xml deleted file mode 100644 index d4e3f4a0101..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationStepTest/migrate_nothing_result.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationStepTest/migrate_sqale_measures.xml b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationStepTest/migrate_sqale_measures.xml deleted file mode 100644 index b9081d8e285..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationStepTest/migrate_sqale_measures.xml +++ /dev/null @@ -1,64 +0,0 @@ - - - - diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationStepTest/migrate_sqale_measures_result.xml b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationStepTest/migrate_sqale_measures_result.xml deleted file mode 100644 index b0e80bd9cf8..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationStepTest/migrate_sqale_measures_result.xml +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - - - - - - diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationStepTest/migrate_technical_debt_measures.xml b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationStepTest/migrate_technical_debt_measures.xml deleted file mode 100644 index 80c512c14dd..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationStepTest/migrate_technical_debt_measures.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationStepTest/migrate_technical_debt_measures_result.xml b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationStepTest/migrate_technical_debt_measures_result.xml deleted file mode 100644 index 2a3e2068a0f..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationStepTest/migrate_technical_debt_measures_result.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationStepTest/schema.sql b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationStepTest/schema.sql deleted file mode 100644 index 1e29613934e..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v43/TechnicalDebtMeasuresMigrationStepTest/schema.sql +++ /dev/null @@ -1,45 +0,0 @@ --- 4.3 - -CREATE TABLE "PROJECT_MEASURES" ( - "ID" BIGINT NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), - "VALUE" DOUBLE, - "METRIC_ID" INTEGER NOT NULL, - "SNAPSHOT_ID" INTEGER, - "RULE_ID" INTEGER, - "RULES_CATEGORY_ID" INTEGER, - "TEXT_VALUE" VARCHAR(96), - "TENDENCY" INTEGER, - "MEASURE_DATE" TIMESTAMP, - "PROJECT_ID" INTEGER, - "ALERT_STATUS" VARCHAR(5), - "ALERT_TEXT" VARCHAR(4000), - "URL" VARCHAR(2000), - "DESCRIPTION" VARCHAR(4000), - "RULE_PRIORITY" INTEGER, - "CHARACTERISTIC_ID" INTEGER, - "PERSON_ID" INTEGER, - "VARIATION_VALUE_1" DOUBLE, - "VARIATION_VALUE_2" DOUBLE, - "VARIATION_VALUE_3" DOUBLE, - "VARIATION_VALUE_4" DOUBLE, - "VARIATION_VALUE_5" DOUBLE -); - -CREATE TABLE "METRICS" ( - "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), - "NAME" VARCHAR(64) NOT NULL, - "DESCRIPTION" VARCHAR(255), - "DIRECTION" INTEGER NOT NULL DEFAULT 0, - "DOMAIN" VARCHAR(64), - "SHORT_NAME" VARCHAR(64), - "QUALITATIVE" BOOLEAN NOT NULL DEFAULT FALSE, - "VAL_TYPE" VARCHAR(8), - "USER_MANAGED" BOOLEAN DEFAULT FALSE, - "ENABLED" BOOLEAN DEFAULT TRUE, - "ORIGIN" VARCHAR(3), - "WORST_VALUE" DOUBLE, - "BEST_VALUE" DOUBLE, - "OPTIMIZED_BEST_VALUE" BOOLEAN, - "HIDDEN" BOOLEAN, - "DELETE_HISTORICAL_DATA" BOOLEAN -); diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/ChangeLogMigrationTest/active_rules_changes.xml b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/ChangeLogMigrationTest/active_rules_changes.xml deleted file mode 100644 index 1f449ff8edd..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/ChangeLogMigrationTest/active_rules_changes.xml +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/ChangeLogMigrationTest/migrate_when_no_changelog.xml b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/ChangeLogMigrationTest/migrate_when_no_changelog.xml deleted file mode 100644 index b6c5d34d773..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/ChangeLogMigrationTest/migrate_when_no_changelog.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/ChangeLogMigrationTest/schema.sql b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/ChangeLogMigrationTest/schema.sql deleted file mode 100644 index 9e353e72063..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/ChangeLogMigrationTest/schema.sql +++ /dev/null @@ -1,113 +0,0 @@ - -CREATE TABLE "RULES_PARAMETERS" ( - "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), - "RULE_ID" INTEGER NOT NULL, - "NAME" VARCHAR(128) NOT NULL, - "PARAM_TYPE" VARCHAR(512) NOT NULL, - "DEFAULT_VALUE" VARCHAR(4000), - "DESCRIPTION" VARCHAR(4000) - ); - - CREATE TABLE "RULES_PROFILES" ( - "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), - "NAME" VARCHAR(100) NOT NULL, - "LANGUAGE" VARCHAR(20), - "KEE" VARCHAR(255) NOT NULL, - "PARENT_KEE" VARCHAR(255), - "RULES_UPDATED_AT" VARCHAR(100), - "CREATED_AT" TIMESTAMP, - "UPDATED_AT" TIMESTAMP - ); - - CREATE TABLE "ACTIVE_RULE_PARAM_CHANGES" ( - "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), - "ACTIVE_RULE_CHANGE_ID" INTEGER NOT NULL, - "RULES_PARAMETER_ID" INTEGER NOT NULL, - "OLD_VALUE" VARCHAR(4000), - "NEW_VALUE" VARCHAR(4000) - ); - - CREATE TABLE "RULES" ( - "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), - "PLUGIN_RULE_KEY" VARCHAR(200) NOT NULL, - "PLUGIN_NAME" VARCHAR(255) NOT NULL, - "DESCRIPTION" VARCHAR(16777215), - "PRIORITY" INTEGER, - "CARDINALITY" VARCHAR(10), - "PARENT_ID" INTEGER, - "PLUGIN_CONFIG_KEY" VARCHAR(500), - "NAME" VARCHAR(200), - "STATUS" VARCHAR(40), - "LANGUAGE" VARCHAR(20), - "NOTE_DATA" CLOB(2147483647), - "NOTE_USER_LOGIN" VARCHAR(40), - "NOTE_CREATED_AT" TIMESTAMP, - "NOTE_UPDATED_AT" TIMESTAMP, - "CHARACTERISTIC_ID" INTEGER, - "DEFAULT_CHARACTERISTIC_ID" INTEGER, - "REMEDIATION_FUNCTION" VARCHAR(20), - "DEFAULT_REMEDIATION_FUNCTION" VARCHAR(20), - "REMEDIATION_COEFF" VARCHAR(20), - "DEFAULT_REMEDIATION_COEFF" VARCHAR(20), - "REMEDIATION_OFFSET" VARCHAR(20), - "DEFAULT_REMEDIATION_OFFSET" VARCHAR(20), - "EFFORT_TO_FIX_DESCRIPTION" VARCHAR(4000), - "CREATED_AT" TIMESTAMP, - "UPDATED_AT" TIMESTAMP - ); - - CREATE TABLE "ACTIVE_RULE_CHANGES" ( - "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), - "USERNAME" VARCHAR(200), - "PROFILE_ID" INTEGER NOT NULL, - "PROFILE_VERSION" INTEGER NOT NULL, - "RULE_ID" INTEGER NOT NULL, - "CHANGE_DATE" TIMESTAMP NOT NULL, - "ENABLED" BOOLEAN, - "OLD_SEVERITY" INTEGER, - "NEW_SEVERITY" INTEGER - ); - - CREATE TABLE "ACTIVE_RULES" ( - "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), - "PROFILE_ID" INTEGER NOT NULL, - "RULE_ID" INTEGER NOT NULL, - "FAILURE_LEVEL" INTEGER NOT NULL, - "INHERITANCE" VARCHAR(10), - "NOTE_CREATED_AT" TIMESTAMP, - "NOTE_UPDATED_AT" TIMESTAMP, - "NOTE_USER_LOGIN" VARCHAR(40), - "NOTE_DATA" CLOB(2147483647) - ); - - CREATE TABLE "ACTIVE_RULE_PARAMETERS" ( - "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), - "ACTIVE_RULE_ID" INTEGER NOT NULL, - "RULES_PARAMETER_ID" INTEGER NOT NULL, - "RULES_PARAMETER_KEY" VARCHAR(128), - "VALUE" VARCHAR(4000) - ); - - CREATE TABLE "USERS" ( - "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), - "LOGIN" VARCHAR(40), - "NAME" VARCHAR(200), - "EMAIL" VARCHAR(100), - "CRYPTED_PASSWORD" VARCHAR(40), - "SALT" VARCHAR(40), - "CREATED_AT" TIMESTAMP, - "UPDATED_AT" TIMESTAMP, - "REMEMBER_TOKEN" VARCHAR(500), - "REMEMBER_TOKEN_EXPIRES_AT" TIMESTAMP, - "ACTIVE" BOOLEAN DEFAULT TRUE - ); - - CREATE TABLE "ACTIVITIES" ( - "LOG_KEY" VARCHAR(250), - "CREATED_AT" TIMESTAMP, - "USER_LOGIN" VARCHAR(30), - "LOG_TYPE" VARCHAR(250), - "LOG_ACTION" VARCHAR(250), - "LOG_MESSAGE" VARCHAR(250), - "DATA_FIELD" CLOB(2147483647) - ); diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/ConvertProfileMeasuresMigrationTest/before.xml b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/ConvertProfileMeasuresMigrationTest/before.xml deleted file mode 100644 index 92cf512ca3c..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/ConvertProfileMeasuresMigrationTest/before.xml +++ /dev/null @@ -1,56 +0,0 @@ - - diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/ConvertProfileMeasuresMigrationTest/measure_on_deleted_profile.xml b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/ConvertProfileMeasuresMigrationTest/measure_on_deleted_profile.xml deleted file mode 100644 index 53071165f0f..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/ConvertProfileMeasuresMigrationTest/measure_on_deleted_profile.xml +++ /dev/null @@ -1,31 +0,0 @@ - - diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/ConvertProfileMeasuresMigrationTest/missing_profile_version.xml b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/ConvertProfileMeasuresMigrationTest/missing_profile_version.xml deleted file mode 100644 index 4366b94339d..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/ConvertProfileMeasuresMigrationTest/missing_profile_version.xml +++ /dev/null @@ -1,31 +0,0 @@ - - diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/ConvertProfileMeasuresMigrationTest/schema.sql b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/ConvertProfileMeasuresMigrationTest/schema.sql deleted file mode 100644 index 4736d0cdb2c..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/ConvertProfileMeasuresMigrationTest/schema.sql +++ /dev/null @@ -1,108 +0,0 @@ -CREATE TABLE "RULES_PROFILES" ( - "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), - "NAME" VARCHAR(100) NOT NULL, - "LANGUAGE" VARCHAR(20), - "KEE" VARCHAR(1000) NOT NULL, - "PARENT_KEE" VARCHAR(1000), - "RULES_UPDATED_AT" VARCHAR(100), - "CREATED_AT" TIMESTAMP, - "UPDATED_AT" TIMESTAMP -); - -CREATE TABLE "ACTIVE_RULE_CHANGES" ( - "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), - "USERNAME" VARCHAR(255), - "PROFILE_ID" INTEGER NOT NULL, - "PROFILE_VERSION" INTEGER NOT NULL, - "RULE_ID" INTEGER NOT NULL, - "CHANGE_DATE" TIMESTAMP NOT NULL, - "ENABLED" BOOLEAN, - "OLD_SEVERITY" INTEGER, - "NEW_SEVERITY" INTEGER -); - -CREATE TABLE "ACTIVE_RULE_PARAM_CHANGES" ( - "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), - "ACTIVE_RULE_CHANGE_ID" INTEGER NOT NULL, - "RULES_PARAMETER_ID" INTEGER NOT NULL, - "OLD_VALUE" VARCHAR(4000), - "NEW_VALUE" VARCHAR(4000) - ); - -CREATE TABLE "PROJECT_MEASURES" ( - "ID" BIGINT NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), - "VALUE" DOUBLE, - "METRIC_ID" INTEGER NOT NULL, - "SNAPSHOT_ID" INTEGER, - "RULE_ID" INTEGER, - "RULES_CATEGORY_ID" INTEGER, - "TEXT_VALUE" VARCHAR(4000), - "TENDENCY" INTEGER, - "MEASURE_DATE" TIMESTAMP, - "PROJECT_ID" INTEGER, - "ALERT_STATUS" VARCHAR(5), - "ALERT_TEXT" VARCHAR(4000), - "URL" VARCHAR(2000), - "DESCRIPTION" VARCHAR(4000), - "RULE_PRIORITY" INTEGER, - "CHARACTERISTIC_ID" INTEGER, - "PERSON_ID" INTEGER, - "VARIATION_VALUE_1" DOUBLE, - "VARIATION_VALUE_2" DOUBLE, - "VARIATION_VALUE_3" DOUBLE, - "VARIATION_VALUE_4" DOUBLE, - "VARIATION_VALUE_5" DOUBLE, - "MEASURE_DATA" BINARY(167772150) -); - -CREATE TABLE "METRICS" ( - "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), - "NAME" VARCHAR(64) NOT NULL, - "DESCRIPTION" VARCHAR(255), - "DIRECTION" INTEGER NOT NULL DEFAULT 0, - "DOMAIN" VARCHAR(64), - "SHORT_NAME" VARCHAR(64), - "QUALITATIVE" BOOLEAN NOT NULL DEFAULT FALSE, - "VAL_TYPE" VARCHAR(8), - "USER_MANAGED" BOOLEAN DEFAULT FALSE, - "ENABLED" BOOLEAN DEFAULT TRUE, - "ORIGIN" VARCHAR(3), - "WORST_VALUE" DOUBLE, - "BEST_VALUE" DOUBLE, - "OPTIMIZED_BEST_VALUE" BOOLEAN, - "HIDDEN" BOOLEAN, - "DELETE_HISTORICAL_DATA" BOOLEAN -); - -CREATE TABLE "SNAPSHOTS" ( - "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), - "CREATED_AT" TIMESTAMP, - "BUILD_DATE" TIMESTAMP, - "PROJECT_ID" INTEGER NOT NULL, - "PARENT_SNAPSHOT_ID" INTEGER, - "STATUS" VARCHAR(4) NOT NULL DEFAULT 'U', - "PURGE_STATUS" INTEGER, - "ISLAST" BOOLEAN NOT NULL DEFAULT FALSE, - "SCOPE" VARCHAR(3), - "QUALIFIER" VARCHAR(10), - "ROOT_SNAPSHOT_ID" INTEGER, - "VERSION" VARCHAR(500), - "PATH" VARCHAR(500), - "DEPTH" INTEGER, - "ROOT_PROJECT_ID" INTEGER, - "PERIOD1_MODE" VARCHAR(100), - "PERIOD1_PARAM" VARCHAR(100), - "PERIOD1_DATE" TIMESTAMP, - "PERIOD2_MODE" VARCHAR(100), - "PERIOD2_PARAM" VARCHAR(100), - "PERIOD2_DATE" TIMESTAMP, - "PERIOD3_MODE" VARCHAR(100), - "PERIOD3_PARAM" VARCHAR(100), - "PERIOD3_DATE" TIMESTAMP, - "PERIOD4_MODE" VARCHAR(100), - "PERIOD4_PARAM" VARCHAR(100), - "PERIOD4_DATE" TIMESTAMP, - "PERIOD5_MODE" VARCHAR(100), - "PERIOD5_PARAM" VARCHAR(100), - "PERIOD5_DATE" TIMESTAMP -); diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/FeedQProfileDatesMigrationTest/feed_created_at_and_updated_at.xml b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/FeedQProfileDatesMigrationTest/feed_created_at_and_updated_at.xml deleted file mode 100644 index 5f0a7a87f60..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/FeedQProfileDatesMigrationTest/feed_created_at_and_updated_at.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/FeedQProfileDatesMigrationTest/schema.sql b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/FeedQProfileDatesMigrationTest/schema.sql deleted file mode 100644 index a6237e63fff..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/FeedQProfileDatesMigrationTest/schema.sql +++ /dev/null @@ -1,30 +0,0 @@ -CREATE TABLE "RULES_PROFILES" ( - "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), - "NAME" VARCHAR(100) NOT NULL, - "LANGUAGE" VARCHAR(20), - "KEE" VARCHAR(1000) NOT NULL, - "PARENT_KEE" VARCHAR(1000), - "RULES_UPDATED_AT" VARCHAR(100), - "CREATED_AT" TIMESTAMP, - "UPDATED_AT" TIMESTAMP -); - -CREATE TABLE "ACTIVE_RULE_CHANGES" ( - "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), - "USERNAME" VARCHAR(255), - "PROFILE_ID" INTEGER NOT NULL, - "PROFILE_VERSION" INTEGER NOT NULL, - "RULE_ID" INTEGER NOT NULL, - "CHANGE_DATE" TIMESTAMP NOT NULL, - "ENABLED" BOOLEAN, - "OLD_SEVERITY" INTEGER, - "NEW_SEVERITY" INTEGER -); - -CREATE TABLE "ACTIVE_RULE_PARAM_CHANGES" ( - "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), - "ACTIVE_RULE_CHANGE_ID" INTEGER NOT NULL, - "RULES_PARAMETER_ID" INTEGER NOT NULL, - "OLD_VALUE" VARCHAR(4000), - "NEW_VALUE" VARCHAR(4000) - ); diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/FeedQProfileDatesMigrationTest/use_default_dates_when_no_changes.xml b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/FeedQProfileDatesMigrationTest/use_default_dates_when_no_changes.xml deleted file mode 100644 index 4c01980010c..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/FeedQProfileDatesMigrationTest/use_default_dates_when_no_changes.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/FeedQProfileKeysMigrationTest/feed_keys.xml b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/FeedQProfileKeysMigrationTest/feed_keys.xml deleted file mode 100644 index e40daebdde4..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/FeedQProfileKeysMigrationTest/feed_keys.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/FeedQProfileKeysMigrationTest/schema.sql b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/FeedQProfileKeysMigrationTest/schema.sql deleted file mode 100644 index 4a5185258d1..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/FeedQProfileKeysMigrationTest/schema.sql +++ /dev/null @@ -1,12 +0,0 @@ -CREATE TABLE "RULES_PROFILES" ( - "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), - "NAME" VARCHAR(100) NOT NULL, - "LANGUAGE" VARCHAR(20), - "PARENT_NAME" VARCHAR(255), - - "KEE" VARCHAR(100), - "PARENT_KEE" VARCHAR(255), - "RULES_UPDATED_AT" VARCHAR(100), - "CREATED_AT" TIMESTAMP, - "UPDATED_AT" TIMESTAMP -); diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/IssueActionPlanKeyMigrationTest/migrate_issues_action_plan_key.xml b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/IssueActionPlanKeyMigrationTest/migrate_issues_action_plan_key.xml deleted file mode 100644 index 51271c7c2d3..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/IssueActionPlanKeyMigrationTest/migrate_issues_action_plan_key.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - - diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/IssueActionPlanKeyMigrationTest/migrate_issues_action_plan_key_result.xml b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/IssueActionPlanKeyMigrationTest/migrate_issues_action_plan_key_result.xml deleted file mode 100644 index 6d10f936015..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/IssueActionPlanKeyMigrationTest/migrate_issues_action_plan_key_result.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/IssueActionPlanKeyMigrationTest/schema.sql b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/IssueActionPlanKeyMigrationTest/schema.sql deleted file mode 100644 index 1ad49679f5c..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/IssueActionPlanKeyMigrationTest/schema.sql +++ /dev/null @@ -1,41 +0,0 @@ --- 4.4 - -CREATE TABLE "ISSUES" ( - "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), - "KEE" VARCHAR(50) UNIQUE NOT NULL, - "COMPONENT_ID" INTEGER NOT NULL, - "ROOT_COMPONENT_ID" INTEGER, - "RULE_ID" INTEGER, - "SEVERITY" VARCHAR(10), - "MANUAL_SEVERITY" BOOLEAN NOT NULL, - "MESSAGE" VARCHAR(4000), - "LINE" INTEGER, - "EFFORT_TO_FIX" DOUBLE, - "STATUS" VARCHAR(20), - "RESOLUTION" VARCHAR(20), - "CHECKSUM" VARCHAR(1000), - "REPORTER" VARCHAR(40), - "ASSIGNEE" VARCHAR(40), - "AUTHOR_LOGIN" VARCHAR(100), - "ACTION_PLAN_KEY" VARCHAR(50) NULL, - "ISSUE_ATTRIBUTES" VARCHAR(4000), - "ISSUE_CREATION_DATE" TIMESTAMP, - "ISSUE_CLOSE_DATE" TIMESTAMP, - "ISSUE_UPDATE_DATE" TIMESTAMP, - "CREATED_AT" TIMESTAMP, - "UPDATED_AT" TIMESTAMP, - "TECHNICAL_DEBT" INTEGER -); - -CREATE TABLE "ACTION_PLANS" ( - "ID" BIGINT NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), - "KEE" VARCHAR(100), - "NAME" VARCHAR(200), - "DESCRIPTION" VARCHAR(1000), - "DEADLINE" TIMESTAMP, - "USER_LOGIN" VARCHAR(40), - "PROJECT_ID" INTEGER, - "STATUS" VARCHAR(10), - "CREATED_AT" TIMESTAMP, - "UPDATED_AT" TIMESTAMP -); diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/MeasureDataMigrationTest/migrate_measure_data-result.xml b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/MeasureDataMigrationTest/migrate_measure_data-result.xml deleted file mode 100644 index 209ce80d5d5..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/MeasureDataMigrationTest/migrate_measure_data-result.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/MeasureDataMigrationTest/migrate_measure_data.xml b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/MeasureDataMigrationTest/migrate_measure_data.xml deleted file mode 100644 index f15b86ae46b..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/MeasureDataMigrationTest/migrate_measure_data.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - - - - - diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/MeasureDataMigrationTest/schema.sql b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/MeasureDataMigrationTest/schema.sql deleted file mode 100644 index 84a37067998..00000000000 --- a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v44/MeasureDataMigrationTest/schema.sql +++ /dev/null @@ -1,34 +0,0 @@ --- 4.4 - -CREATE TABLE "PROJECT_MEASURES" ( - "ID" BIGINT NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), - "VALUE" DOUBLE, - "METRIC_ID" INTEGER NOT NULL, - "SNAPSHOT_ID" INTEGER, - "RULE_ID" INTEGER, - "RULES_CATEGORY_ID" INTEGER, - "TEXT_VALUE" VARCHAR(96), - "TENDENCY" INTEGER, - "MEASURE_DATE" TIMESTAMP, - "PROJECT_ID" INTEGER, - "ALERT_STATUS" VARCHAR(5), - "ALERT_TEXT" VARCHAR(4000), - "URL" VARCHAR(2000), - "DESCRIPTION" VARCHAR(4000), - "RULE_PRIORITY" INTEGER, - "CHARACTERISTIC_ID" INTEGER, - "PERSON_ID" INTEGER, - "VARIATION_VALUE_1" DOUBLE, - "VARIATION_VALUE_2" DOUBLE, - "VARIATION_VALUE_3" DOUBLE, - "VARIATION_VALUE_4" DOUBLE, - "VARIATION_VALUE_5" DOUBLE, - "MEASURE_DATA" BINARY(167772150) -); - -CREATE TABLE "MEASURE_DATA" ( - "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), - "MEASURE_ID" BIGINT, - "SNAPSHOT_ID" INTEGER, - "DATA" BINARY(167772150) -); diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/215_create_notifications.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/215_create_notifications.rb index 66fe6dec0f6..b432bc04210 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/215_create_notifications.rb +++ b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/215_create_notifications.rb @@ -25,7 +25,6 @@ class CreateNotifications < ActiveRecord::Migration def self.up create_table 'notifications' do |t| - t.column 'created_at', :datetime, :null => true t.column 'data', :binary, :null => true end end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/430_remove_notifications_created_at.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/430_remove_notifications_created_at.rb deleted file mode 100644 index 363bc5867f6..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/430_remove_notifications_created_at.rb +++ /dev/null @@ -1,30 +0,0 @@ -# -# SonarQube, open source software quality management tool. -# Copyright (C) 2008-2014 SonarSource -# mailto:contact AT sonarsource DOT com -# -# SonarQube is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 3 of the License, or (at your option) any later version. -# -# SonarQube 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 -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser 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. -# - -# -# Sonar 3.7.1 -# -class RemoveNotificationsCreatedAt < ActiveRecord::Migration - - def self.up - remove_column('notifications', 'created_at') - end - -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/431_migrate_users_names.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/431_migrate_users_names.rb deleted file mode 100644 index fc737725814..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/431_migrate_users_names.rb +++ /dev/null @@ -1,43 +0,0 @@ -# -# SonarQube, open source software quality management tool. -# Copyright (C) 2008-2014 SonarSource -# mailto:contact AT sonarsource DOT com -# -# SonarQube is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 3 of the License, or (at your option) any later version. -# -# SonarQube 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 -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser 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. -# - -# -# Sonar 3.7.1 -# SONAR-4434 -# -class MigrateUsersNames < ActiveRecord::Migration - - class User < ActiveRecord::Base - end - - def self.up - User.reset_column_information - - User.find(:all).each do |user| - if user.name.blank? - user.name = user.login - user.updated_at = Time.now - user.send(:update_without_callbacks) - end - end - - end - -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/440_replace_key_regexp_by_key_search_in_measure_filters_data.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/440_replace_key_regexp_by_key_search_in_measure_filters_data.rb deleted file mode 100644 index a000edc3025..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/440_replace_key_regexp_by_key_search_in_measure_filters_data.rb +++ /dev/null @@ -1,38 +0,0 @@ -# -# SonarQube, open source software quality management tool. -# Copyright (C) 2008-2014 SonarSource -# mailto:contact AT sonarsource DOT com -# -# SonarQube is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 3 of the License, or (at your option) any later version. -# -# SonarQube 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 -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser 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. -# - -# -# Sonar 4.0 -# SONAR-4195 -# -class ReplaceKeyRegexpByKeySearchInMeasureFiltersData < ActiveRecord::Migration - - class MeasureFilter < ActiveRecord::Base - end - - def self.up - filters = MeasureFilter.all(:conditions => "data like '%keyRegexp%'") - filters.each do |filter| - filter.data = filter.data.sub('keyRegexp', 'keySearch') - filter.save - end - end -end - diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/443_rename_widget_sqale_pyramid_to_technical_debt_pyramid.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/443_rename_widget_sqale_pyramid_to_technical_debt_pyramid.rb deleted file mode 100644 index c151be84261..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/443_rename_widget_sqale_pyramid_to_technical_debt_pyramid.rb +++ /dev/null @@ -1,35 +0,0 @@ -# -# SonarQube, open source software quality management tool. -# Copyright (C) 2008-2014 SonarSource -# mailto:contact AT sonarsource DOT com -# -# SonarQube is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 3 of the License, or (at your option) any later version. -# -# SonarQube 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 -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser 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. -# - -# -# Sonar 4.0 -# SONAR-4738 -# - -class RenameWidgetSqalePyramidToTechnicalDebtPyramid < ActiveRecord::Migration - - class Widget < ActiveRecord::Base - end - - def self.up - Widget.update_all({:widget_key => 'technical_debt_pyramid', :name => 'Technical Debt Pyramid'}, {:widget_key => 'sqalePyramid'}) - end - -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/444_resize_timeline_widgets.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/444_resize_timeline_widgets.rb deleted file mode 100644 index 84a4516848d..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/444_resize_timeline_widgets.rb +++ /dev/null @@ -1,44 +0,0 @@ -# -# SonarQube, open source software quality management tool. -# Copyright (C) 2008-2014 SonarSource -# mailto:contact AT sonarsource DOT com -# -# SonarQube is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 3 of the License, or (at your option) any later version. -# -# SonarQube 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 -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser 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. -# - -# -# Sonar 4.0 -# SONAR-4416 - Migrate saved timeline chart heights to adapt to new render code (chartHeight += 100) -# - -class ResizeTimelineWidgets < ActiveRecord::Migration - - class Widget < ActiveRecord::Base - end - - class WidgetProperty < ActiveRecord::Base - end - - def self.up - Widget.reset_column_information - WidgetProperty.reset_column_information - - Widget.find(:all, :conditions => { :widget_key => 'timeline' }).each do |widget| - WidgetProperty.find(:all, :conditions => { :widget_id => widget.id, :kee => 'chartHeight' }).each do |property| - property.update_attributes!(:text_value => (property.read_attribute(:text_value).to_i + 100).to_s) - end - end - end -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/460_add_unique_constraint_to_groups_users.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/460_add_unique_constraint_to_groups_users.rb index 8eeda227be9..e054abd8dca 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/460_add_unique_constraint_to_groups_users.rb +++ b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/460_add_unique_constraint_to_groups_users.rb @@ -23,21 +23,7 @@ # class AddUniqueConstraintToGroupsUsers < ActiveRecord::Migration - class GroupsUser < ActiveRecord::Base - end - def self.up - GroupsUser.reset_column_information - - duplicated_ids = ActiveRecord::Base.connection.select_rows('select user_id,group_id from groups_users group by user_id,group_id having count(*) > 1') - say_with_time "Remove duplications for #{duplicated_ids.size} user group associations" do - duplicated_ids.each do |user_id, group_id| - # delete all rows, then reinsert one - GroupsUser.delete_all([ "user_id=? and group_id=?", user_id, group_id ]) - ActiveRecord::Base.connection.execute("insert into groups_users (user_id,group_id) values (%s,%s)" % [user_id, group_id]) - end - end - add_index :groups_users, [:group_id, :user_id], :name => 'GROUPS_USERS_UNIQUE', :unique => true end end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/462_migrate_characteristics.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/462_migrate_characteristics.rb deleted file mode 100644 index 0d4a182d603..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/462_migrate_characteristics.rb +++ /dev/null @@ -1,142 +0,0 @@ -# -# SonarQube, open source software quality management tool. -# Copyright (C) 2008-2014 SonarSource -# mailto:contact AT sonarsource DOT com -# -# SonarQube is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 3 of the License, or (at your option) any later version. -# -# SonarQube 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 -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser 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. -# - -# -# Sonar 4.1 -# SONAR-4831 -# SONAR-4895 -# -class MigrateCharacteristics < ActiveRecord::Migration - - class QualityModel < ActiveRecord::Base - end - - class Characteristic < ActiveRecord::Base - end - - class CharacteristicEdge < ActiveRecord::Base - end - - class CharacteristicProperty < ActiveRecord::Base - end - - def self.up - sqale_model = QualityModel.first(:conditions => ['name=?', 'SQALE']) - - # Do nothing if there's no SQALE model installed - if sqale_model - - QualityModel.reset_column_information - Characteristic.reset_column_information - CharacteristicEdge.reset_column_information - CharacteristicProperty.reset_column_information - - now = Time.now - characteristics = Characteristic.all(:conditions => ['quality_model_id=?', sqale_model.id]) - characteristic_edges = CharacteristicEdge.all - parent_ids_by_characteristic_id = {} - characteristic_edges.each do |edge| - parent_ids_by_characteristic_id[edge.child_id] = edge.parent_id - end - - properties = CharacteristicProperty.all - properties_by_characteristic_id = {} - properties.each do |prop| - char_properties = properties_by_characteristic_id[prop.characteristic_id] || [] - char_properties << prop - properties_by_characteristic_id[prop.characteristic_id] = char_properties - end - - characteristics.each do |characteristic| - # Requirement - if characteristic.rule_id - char_properties = properties_by_characteristic_id[characteristic.id] - function = char_properties.find { |prop| prop.kee == 'remediationFunction' } if char_properties - - if char_properties && function - factor = char_properties.find { |prop| prop.kee == 'remediationFactor' } - offset = char_properties.find { |prop| prop.kee == 'offset' } - - case function.text_value - when 'linear' - characteristic.function_key = 'linear' - characteristic.factor_value = factor.value - characteristic.factor_unit = factor.text_value - characteristic.offset_value = 0.0 - characteristic.offset_unit = 'd' - - when 'linear_offset' - characteristic.function_key = 'linear_offset' - characteristic.factor_value = factor.value - characteristic.factor_unit = factor.text_value - characteristic.offset_value = offset.value - characteristic.offset_unit = offset.text_value - - # linear_threshold is depreciated and is replaced by linear - when 'linear_threshold' - characteristic.function_key = 'linear' - characteristic.factor_value = factor.value - characteristic.factor_unit = factor.text_value - characteristic.offset_value = 0.0 - characteristic.offset_unit = 'd' - - # constant_resource is no more managed anymore, it has to be disabled - when 'constant_resource' - characteristic.enabled = false - characteristic.function_key = 'constant_resource' - characteristic.factor_value = 0.0 - characteristic.factor_unit = 'd' - characteristic.offset_value = 0.0 - characteristic.offset_unit = 'd' - - end - # requirement without properties or without remediationFunction has to be disabled - else - characteristic.enabled = false - end - end - - parent_id = parent_ids_by_characteristic_id[characteristic.id] - # Not for root characteristics - if parent_id - characteristic.parent_id = parent_id - # Requirements - if characteristic.rule_id - root_id = parent_ids_by_characteristic_id[characteristic.parent_id] - if root_id - characteristic.root_id = root_id - else - # requirement linked to a root characteristic has to be disabled - characteristic.enabled = false - end - else - # Characteristics has same root_id as parent_id - characteristic.root_id = parent_id - end - end - characteristic.created_at = now - characteristic.updated_at = now - characteristic.save - end - end - end - -end - diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/466_add_network_use_sub_characteristic.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/466_add_network_use_sub_characteristic.rb deleted file mode 100644 index 1776eae0a56..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/466_add_network_use_sub_characteristic.rb +++ /dev/null @@ -1,47 +0,0 @@ -# -# SonarQube, open source software quality management tool. -# Copyright (C) 2008-2014 SonarSource -# mailto:contact AT sonarsource DOT com -# -# SonarQube is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 3 of the License, or (at your option) any later version. -# -# SonarQube 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 -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser 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. -# - -# -# SonarQube 4.1 -# SONAR-4870 -# - -class AddNetworkUseSubCharacteristic < ActiveRecord::Migration - - class Characteristic < ActiveRecord::Base - end - - def self.up - Characteristic.reset_column_information - - # On an empty DB, there are no characteristics, they're all gonna be created after (so new characteristics has always to be also added in the technical-debt-model.xml file) - if Characteristic.all.size > 0 - efficiency = Characteristic.first(:conditions => ['kee=? AND enabled=?', 'EFFICIENCY', true]) - network_use = Characteristic.first(:conditions => ['name=? AND enabled=?', 'Network use ', true]) - - # The Efficiency characteristic can have been deleted from the SQALE plugin - # And the Network use can already been created - if efficiency && !network_use - Characteristic.create(:kee => 'NETWORK_USE_EFFICIENCY', :name => 'Network use', :enabled => true, :parent_id => efficiency.id, :root_id => efficiency.id) if efficiency - end - end - end - -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/481_copy_rule_notes_to_rules.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/481_copy_rule_notes_to_rules.rb deleted file mode 100644 index 0d1dd5cf4c2..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/481_copy_rule_notes_to_rules.rb +++ /dev/null @@ -1,80 +0,0 @@ -# -# SonarQube, open source software quality management tool. -# Copyright (C) 2008-2014 SonarSource -# mailto:contact AT sonarsource DOT com -# -# SonarQube is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 3 of the License, or (at your option) any later version. -# -# SonarQube 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 -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser 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. -# - -# -# Sonar 4.2 -# SONAR-4923 -# Copy rule_notes (resp. active_rule_notes) contents to rules (resp. active_rules) -# -class CopyRuleNotesToRules < ActiveRecord::Migration - - class Rule < ActiveRecord::Base - end - - class RuleNote < ActiveRecord::Base - end - - class ActiveRule < ActiveRecord::Base - end - - class ActiveRuleNote < ActiveRecord::Base - end - - def self.up - Rule.reset_column_information - RuleNote.reset_column_information - ActiveRule.reset_column_information - ActiveRuleNote.reset_column_information - - rules = {} - Rule.all.each do |rule| - rules[rule.id] = rule - end - - RuleNote.all.each do |note| - rule = rules[note.rule_id] - if rule - rule.note_created_at = note.created_at - rule.note_updated_at = note.updated_at - rule.note_user_login = note.user_login - rule.note_data = note.data - rule.save - end - end - - active_rules = {} - ActiveRule.all.each do |rule| - active_rules[rule.id] = rule - end - - ActiveRuleNote.all.each do |note| - active_rule = active_rules[note.active_rule_id] - if active_rule - active_rule.note_created_at = note.created_at - active_rule.note_updated_at = note.updated_at - active_rule.note_user_login = note.user_login - active_rule.note_data = note.data - active_rule.save - end - end - end - -end - diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/482_purge_group_roles.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/482_purge_group_roles.rb deleted file mode 100644 index b6d3d169e71..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/482_purge_group_roles.rb +++ /dev/null @@ -1,44 +0,0 @@ -# -# SonarQube, open source software quality management tool. -# Copyright (C) 2008-2014 SonarSource -# mailto:contact AT sonarsource DOT com -# -# SonarQube is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 3 of the License, or (at your option) any later version. -# -# SonarQube 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 -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser 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. -# - -# -# SonarQube 4.2 -# See SONAR-4950 - reverted. Unique constraint is not created but duplications are still purged. -# -class PurgeGroupRoles < ActiveRecord::Migration - - class GroupRole < ActiveRecord::Base - end - - def self.up - GroupRole.reset_column_information - - duplicated_ids = ActiveRecord::Base.connection.select_rows('select group_id,resource_id,role from group_roles group by group_id,resource_id,role having count(*) > 1') - say_with_time "Remove #{duplicated_ids.size} duplicated group roles" do - duplicated_ids.each do |fields| - rows = GroupRole.find(:all, :conditions => {:group_id => fields[0], :resource_id => fields[1], :role => fields[2]}) - # delete all rows except the last one - rows[0...-1].each do |row| - GroupRole.delete(row.id) - end - end - end - end -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/484_copy_rule_parameters_name_to_active_rule_parameters.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/484_copy_rule_parameters_name_to_active_rule_parameters.rb deleted file mode 100644 index 09c4a649b5e..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/484_copy_rule_parameters_name_to_active_rule_parameters.rb +++ /dev/null @@ -1,47 +0,0 @@ -# -# SonarQube, open source software quality management tool. -# Copyright (C) 2008-2014 SonarSource -# mailto:contact AT sonarsource DOT com -# -# SonarQube is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 3 of the License, or (at your option) any later version. -# -# SonarQube 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 -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser 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. -# - -# -# SonarQube 4.2 -# SONAR-4950 -# -class CopyRuleParametersNameToActiveRuleParameters < ActiveRecord::Migration - - class ActiveRuleParameter < ActiveRecord::Base - end - - class RulesParameter < ActiveRecord::Base - end - - def self.up - ActiveRuleParameter.reset_column_information - - rule_params_by_id = {} - RulesParameter.all.each do |rule_param| - rule_params_by_id[rule_param.id] = rule_param - end - - ActiveRuleParameter.all.each do |active_rule_parameter| - rule_param = rule_params_by_id[active_rule_parameter.rules_parameter_id] - active_rule_parameter.rules_parameter_key = rule_param.name if rule_param - active_rule_parameter.save - end - end -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/485_update_rules_without_severity.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/485_update_rules_without_severity.rb deleted file mode 100644 index 86a27c1c8ad..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/485_update_rules_without_severity.rb +++ /dev/null @@ -1,34 +0,0 @@ -# -# SonarQube, open source software quality management tool. -# Copyright (C) 2008-2014 SonarSource -# mailto:contact AT sonarsource DOT com -# -# SonarQube is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 3 of the License, or (at your option) any later version. -# -# SonarQube 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 -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser 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. -# - -# -# SonarQube 4.2 -# SONAR-4993 -# -class UpdateRulesWithoutSeverity < ActiveRecord::Migration - - class Rule < ActiveRecord::Base - end - - def self.up - Rule.reset_column_information - Rule.update_all({:priority => 2, :updated_at => Time.now}, 'priority IS NULL') - end -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/490_migrate_package_keys.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/490_migrate_package_keys.rb deleted file mode 100644 index d17ed8c28c4..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/490_migrate_package_keys.rb +++ /dev/null @@ -1,31 +0,0 @@ -# -# SonarQube, open source software quality management tool. -# Copyright (C) 2008-2014 SonarSource -# mailto:contact AT sonarsource DOT com -# -# SonarQube is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 3 of the License, or (at your option) any later version. -# -# SonarQube 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 -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser 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. -# - -# -# SonarQube 4.2 -# SONAR-926 -# -class MigratePackageKeys < ActiveRecord::Migration - - def self.up - execute_java_migration('org.sonar.server.db.migrations.v42.PackageKeysMigrationStep') - end - -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/493_delete_display_treemap_from_measure_filters.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/493_delete_display_treemap_from_measure_filters.rb deleted file mode 100644 index 9710fabe06a..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/493_delete_display_treemap_from_measure_filters.rb +++ /dev/null @@ -1,38 +0,0 @@ -# -# SonarQube, open source software quality management tool. -# Copyright (C) 2008-2014 SonarSource -# mailto:contact AT sonarsource DOT com -# -# SonarQube is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 3 of the License, or (at your option) any later version. -# -# SonarQube 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 -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser 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. -# - -# -# SonarQube 4.2 -# SONAR-4997 -# -class DeleteDisplayTreemapFromMeasureFilters < ActiveRecord::Migration - - class MeasureFilter < ActiveRecord::Base - end - - def self.up - filters = MeasureFilter.all(:conditions => "data like '%display=treemap%'") - filters.each do |filter| - filter.data = filter.data.sub('display=treemap', '') - filter.save - end - end -end - diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/494_delete_properties_on_unknown_components.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/494_delete_properties_on_unknown_components.rb deleted file mode 100644 index 587ca29d79d..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/494_delete_properties_on_unknown_components.rb +++ /dev/null @@ -1,34 +0,0 @@ -# -# SonarQube, open source software quality management tool. -# Copyright (C) 2008-2014 SonarSource -# mailto:contact AT sonarsource DOT com -# -# SonarQube is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 3 of the License, or (at your option) any later version. -# -# SonarQube 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 -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser 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. -# - -# -# SonarQube 4.2 -# SONAR-5013 -# -class DeletePropertiesOnUnknownComponents < ActiveRecord::Migration - - class Property < ActiveRecord::Base - end - - def self.up - Property.delete_all('resource_id IS NOT NULL AND resource_id NOT IN (SELECT id FROM projects)') - end -end - diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/495_migrate_base_id_to_base_from_measure_filters.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/495_migrate_base_id_to_base_from_measure_filters.rb deleted file mode 100644 index 9bee50e2cda..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/495_migrate_base_id_to_base_from_measure_filters.rb +++ /dev/null @@ -1,43 +0,0 @@ -# -# SonarQube, open source software quality management tool. -# Copyright (C) 2008-2014 SonarSource -# mailto:contact AT sonarsource DOT com -# -# SonarQube is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 3 of the License, or (at your option) any later version. -# -# SonarQube 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 -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser 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. -# - -# -# SonarQube 4.2 -# SONAR-4921 -# -class MigrateBaseIdToBaseFromMeasureFilters < ActiveRecord::Migration - - class MeasureFilter < ActiveRecord::Base - end - - def self.up - filters = MeasureFilter.all(:conditions => "data LIKE '%baseId=%'") - filters.each do |filter| - matchBaseId = filter.data.match(/baseId=(\d+)/) - if matchBaseId - projectId = matchBaseId[1] - project = Project.find_by_id(projectId) - # If project exists, we replace the condition using project id by the condition using project key, otherwise we removed the condition - filter.data = filter.data.sub(/baseId=\d+/, project ? "base=#{project.kee}" : '') - filter.save - end - end - end -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/496_delete_language_property.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/496_delete_language_property.rb deleted file mode 100644 index 7f9f82d76a7..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/496_delete_language_property.rb +++ /dev/null @@ -1,34 +0,0 @@ -# -# SonarQube, open source software quality management tool. -# Copyright (C) 2008-2014 SonarSource -# mailto:contact AT sonarsource DOT com -# -# SonarQube is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 3 of the License, or (at your option) any later version. -# -# SonarQube 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 -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser 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. -# - -# -# SonarQube 4.2 -# SONAR-926 -# The property sonar.language must not be set in global settings -# -class DeleteLanguageProperty < ActiveRecord::Migration - - class Property < ActiveRecord::Base - end - - def self.up - Property.delete_all("prop_key = 'sonar.language'") - end -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/497_update_issue_message_by_rule_name_when_no_message.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/497_update_issue_message_by_rule_name_when_no_message.rb deleted file mode 100644 index 3eb73f963f4..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/497_update_issue_message_by_rule_name_when_no_message.rb +++ /dev/null @@ -1,30 +0,0 @@ -# -# SonarQube, open source software quality management tool. -# Copyright (C) 2008-2014 SonarSource -# mailto:contact AT sonarsource DOT com -# -# SonarQube is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 3 of the License, or (at your option) any later version. -# -# SonarQube 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 -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser 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. -# - -# -# SonarQube 4.2 -# SONAR-4785 -# -class UpdateIssueMessageByRuleNameWhenNoMessage < ActiveRecord::Migration - - def self.up - execute_java_migration('org.sonar.server.db.migrations.v42.CompleteIssueMessageMigrationStep') - end -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/498_remove_duplicate_active_rules.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/498_remove_duplicate_active_rules.rb deleted file mode 100644 index f9710ba9496..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/498_remove_duplicate_active_rules.rb +++ /dev/null @@ -1,54 +0,0 @@ -# -# SonarQube, open source software quality management tool. -# Copyright (C) 2008-2014 SonarSource -# mailto:contact AT sonarsource DOT com -# -# SonarQube is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 3 of the License, or (at your option) any later version. -# -# SonarQube 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 -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser 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. -# - -# -# SonarQube 4.2 -# SONAR-5067 -# -class RemoveDuplicateActiveRules < ActiveRecord::Migration - - class ActiveRuleParameters < ActiveRecord::Base - end - - class ActiveRule < ActiveRecord::Base - end - - def self.up - # Search for all rules activated many times on a same profile - rule_actived_many_times_on_same_profile = ActiveRule.all( - :select => 'rule_id,profile_id', - :group => 'rule_id,profile_id', - :having => 'COUNT(*) > 1' - ) - - rule_actived_many_times_on_same_profile.each do |duplicate_active_rule| - # Search for all duplication on current rule and profile - active_rules = ActiveRule.all( - :conditions => {:rule_id => duplicate_active_rule.rule_id, :profile_id => duplicate_active_rule.profile_id} - ) - # Remove duplication, keep only one active rule (first one) - active_rules.drop(1).each do |active_rule| - ActiveRuleParameters.delete_all(:active_rule_id => active_rule.id) - active_rule.delete - end - end - end - -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/512_convert_alerts_to_quality_gates.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/512_convert_alerts_to_quality_gates.rb deleted file mode 100644 index 408a8ebcafb..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/512_convert_alerts_to_quality_gates.rb +++ /dev/null @@ -1,78 +0,0 @@ -# -# SonarQube, open source software quality management tool. -# Copyright (C) 2008-2014 SonarSource -# mailto:contact AT sonarsource DOT com -# -# SonarQube is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 3 of the License, or (at your option) any later version. -# -# SonarQube 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 -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser 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. -# - -# -# SonarQube 4.3 -# -class ConvertAlertsToQualityGates < ActiveRecord::Migration - - class RulesProfile < ActiveRecord::Base - end - - class Alert < ActiveRecord::Base - end - - class QualityGate < ActiveRecord::Base - end - - class QualityGateCondition < ActiveRecord::Base - end - - def self.up - - RulesProfile.reset_column_information - Alert.reset_column_information - QualityGate.reset_column_information - QualityGateCondition.reset_column_information - - alerts = {} - Alert.all.each do |alert| - alerts[alert.profile_id] ||= [] - alerts[alert.profile_id].push alert - end - - new_operators = { - '=' => 'EQ', - '!=' => 'NE', - '>' => 'GT', - '<' => 'LT' - } - - RulesProfile.all.each do |profile| - if alerts.has_key?(profile.id) - qgate_name = profile.name + ' - ' + profile.language - - # This block allows re-execution in case of failure - old_qgate = QualityGate.find_by_name(qgate_name) - unless old_qgate.nil? - QualityGateCondition.destroy_all(:qgate_id => old_qgate.id) - old_qgate.destroy - end - - qgate = QualityGate.create(:name => qgate_name) - alerts[profile.id].each do |alert| - QualityGateCondition.create(:qgate_id => qgate.id, :metric_id => alert.metric_id, :operator => new_operators[alert.operator], - :value_warning => alert.value_warning, :value_error => alert.value_error, :period => alert.period) - end - end - end - end - -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/513_convert_issue_debt_to_minutes.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/513_convert_issue_debt_to_minutes.rb deleted file mode 100644 index c02eaf1a2b5..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/513_convert_issue_debt_to_minutes.rb +++ /dev/null @@ -1,30 +0,0 @@ -# -# SonarQube, open source software quality management tool. -# Copyright (C) 2008-2014 SonarSource -# mailto:contact AT sonarsource DOT com -# -# SonarQube is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 3 of the License, or (at your option) any later version. -# -# SonarQube 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 -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser 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. -# - -# -# SonarQube 4.3 -# SONAR-4996 -# -class ConvertIssueDebtToMinutes < ActiveRecord::Migration - - def self.up - execute_java_migration('org.sonar.server.db.migrations.v43.ConvertIssueDebtToMinutesMigrationStep') - end -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/514_update_issue_changelog_debt_to_minutes.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/514_update_issue_changelog_debt_to_minutes.rb deleted file mode 100644 index 5b755a77e44..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/514_update_issue_changelog_debt_to_minutes.rb +++ /dev/null @@ -1,30 +0,0 @@ -# -# SonarQube, open source software quality management tool. -# Copyright (C) 2008-2014 SonarSource -# mailto:contact AT sonarsource DOT com -# -# SonarQube is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 3 of the License, or (at your option) any later version. -# -# SonarQube 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 -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser 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. -# - -# -# SonarQube 4.3 -# SONAR-4996 -# -class UpdateIssueChangelogDebtToMinutes < ActiveRecord::Migration - - def self.up - execute_java_migration('org.sonar.server.db.migrations.v43.IssueChangelogMigrationStep') - end -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/515_update_measures_debt_to_minutes.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/515_update_measures_debt_to_minutes.rb deleted file mode 100644 index fe5ed6bbec6..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/515_update_measures_debt_to_minutes.rb +++ /dev/null @@ -1,30 +0,0 @@ -# -# SonarQube, open source software quality management tool. -# Copyright (C) 2008-2014 SonarSource -# mailto:contact AT sonarsource DOT com -# -# SonarQube is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 3 of the License, or (at your option) any later version. -# -# SonarQube 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 -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser 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. -# - -# -# SonarQube 4.3 -# SONAR-4996 -# -class UpdateMeasuresDebtToMinutes < ActiveRecord::Migration - - def self.up - execute_java_migration('org.sonar.server.db.migrations.v43.TechnicalDebtMeasuresMigrationStep') - end -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/516_update_development_cost_to_minutes.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/516_update_development_cost_to_minutes.rb deleted file mode 100644 index 39eca632abb..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/516_update_development_cost_to_minutes.rb +++ /dev/null @@ -1,30 +0,0 @@ -# -# SonarQube, open source software quality management tool. -# Copyright (C) 2008-2014 SonarSource -# mailto:contact AT sonarsource DOT com -# -# SonarQube is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 3 of the License, or (at your option) any later version. -# -# SonarQube 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 -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser 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. -# - -# -# SonarQube 4.3 -# SONAR-4996 -# -class UpdateDevelopmentCostToMinutes < ActiveRecord::Migration - - def self.up - execute_java_migration('org.sonar.server.db.migrations.v43.DevelopmentCostMeasuresMigrationStep') - end -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/517_update_work_units_by_size_point_property_to_minutes.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/517_update_work_units_by_size_point_property_to_minutes.rb deleted file mode 100644 index 212d76364ad..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/517_update_work_units_by_size_point_property_to_minutes.rb +++ /dev/null @@ -1,58 +0,0 @@ -# -# SonarQube, open source software quality management tool. -# Copyright (C) 2008-2014 SonarSource -# mailto:contact AT sonarsource DOT com -# -# SonarQube is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 3 of the License, or (at your option) any later version. -# -# SonarQube 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 -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser 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. -# - -# -# SonarQube 4.3 -# SONAR-4996 -# -class UpdateWorkUnitsBySizePointPropertyToMinutes < ActiveRecord::Migration - - class Property < ActiveRecord::Base - - end - - def self.up - hours_in_day_prop = Property.find_by_prop_key('sonar.technicalDebt.hoursInDay') - hours_in_day = hours_in_day_prop && hours_in_day_prop.text_value ? hours_in_day_prop.text_value.to_i : 8 - work_units_by_size_point = Property.find_by_prop_key('workUnitsBySizePoint') - if work_units_by_size_point && work_units_by_size_point.text_value && work_units_by_size_point.text_value.to_f - work_units_by_size_point.text_value = convert_days_to_minutes(work_units_by_size_point.text_value.to_f, hours_in_day).to_s - work_units_by_size_point.save! - end - - language_specific_parameters = Property.find_by_prop_key('languageSpecificParameters') - if language_specific_parameters - values = language_specific_parameters.text_value.split(',') - values.each do |value| - prop = Property.find_by_prop_key('languageSpecificParameters.' + value + '.man_days') - if prop && prop.text_value && prop.text_value.to_f - prop.text_value = convert_days_to_minutes(prop.text_value.to_f, hours_in_day).to_s - prop.save! - end - end - end - end - - def self.convert_days_to_minutes(hours, hours_in_day) - result = hours * hours_in_day * 60 - # Round value - result.ceil - end -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/518_update_conditions_on_debt_to_minutes.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/518_update_conditions_on_debt_to_minutes.rb deleted file mode 100644 index a2cca32e581..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/518_update_conditions_on_debt_to_minutes.rb +++ /dev/null @@ -1,65 +0,0 @@ -# -# SonarQube, open source software quality management tool. -# Copyright (C) 2008-2014 SonarSource -# mailto:contact AT sonarsource DOT com -# -# SonarQube is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 3 of the License, or (at your option) any later version. -# -# SonarQube 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 -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser 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. -# - -# -# SonarQube 4.3 -# SONAR-4996 -# -class UpdateConditionsOnDebtToMinutes < ActiveRecord::Migration - - class Property < ActiveRecord::Base - - end - - class QualityGateCondition < ActiveRecord::Base - - end - - class Metric < ActiveRecord::Base - - end - - def self.up - Property.reset_column_information - Metric.reset_column_information - QualityGateCondition.reset_column_information - - hours_in_day_prop = Property.find_by_prop_key('sonar.technicalDebt.hoursInDay') - hours_in_day = hours_in_day_prop && hours_in_day_prop.text_value ? hours_in_day_prop.text_value.to_i : 8 - - metrics = Metric.find(:all, :conditions => ['name in (?)', ['sqale_index', 'new_technical_debt', - 'sqale_effort_to_grade_a', 'sqale_effort_to_grade_b', 'sqale_effort_to_grade_c', 'sqale_effort_to_grade_d', - 'blocker_remediation_cost', 'critical_remediation_cost', 'major_remediation_cost', 'minor_remediation_cost', - 'info_remediation_cost']]) - conditions = QualityGateCondition.all(:conditions => ['metric_id in (?)', metrics.map { |m| m.id } ]) - - conditions.each do |condition| - condition.value_error = convert_days_to_minutes(condition.value_error.to_f, hours_in_day) unless condition.value_error.blank? - condition.value_warning = convert_days_to_minutes(condition.value_warning.to_f, hours_in_day) unless condition.value_warning.blank? - condition.save! - end - end - - def self.convert_days_to_minutes(hours, hours_in_day) - result = hours * hours_in_day * 60 - # Round value - result.ceil - end -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/519_update_measure_filters_on_debt_to_minutes.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/519_update_measure_filters_on_debt_to_minutes.rb deleted file mode 100644 index 0a45158a190..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/519_update_measure_filters_on_debt_to_minutes.rb +++ /dev/null @@ -1,69 +0,0 @@ -# -# SonarQube, open source software quality management tool. -# Copyright (C) 2008-2014 SonarSource -# mailto:contact AT sonarsource DOT com -# -# SonarQube is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 3 of the License, or (at your option) any later version. -# -# SonarQube 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 -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser 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. -# - -# -# SonarQube 4.3 -# SONAR-4996 -# -class UpdateMeasureFiltersOnDebtToMinutes < ActiveRecord::Migration - - class Property < ActiveRecord::Base - - end - - class MeasureFilter < ActiveRecord::Base - - end - - def self.up - Property.reset_column_information - MeasureFilter.reset_column_information - - hours_in_day_prop = Property.find_by_prop_key('sonar.technicalDebt.hoursInDay') - hours_in_day = hours_in_day_prop && hours_in_day_prop.text_value ? hours_in_day_prop.text_value.to_i : 8 - - filters = MeasureFilter.all(:conditions => "data LIKE '%_metric=sqale_index%' OR data LIKE '%_metric=new_technical_debt%'" + - " OR data LIKE '%_metric=sqale_effort_to_grade_a%' OR data LIKE '%_metric=sqale_effort_to_grade_b%' OR data LIKE '%_metric=sqale_effort_to_grade_c%' " + - " OR data LIKE '%_metric=sqale_effort_to_grade_d%'"+ - " OR data LIKE '%_metric=blocker_remediation_cost%' OR data LIKE '%_metric=critical_remediation_cost%' OR data LIKE '%_metric=major_remediation_cost%' "+ - " OR data LIKE '%_metric=minor_remediation_cost%' OR data LIKE '%_metric=info_remediation_cost%'" - ) - filters.each do |filter| - data = filter.data.to_s - data.scan(/c(\d+)_metric=(sqale_index|new_technical_debt|sqale_effort_to_grade_a|sqale_effort_to_grade_b|sqale_effort_to_grade_c|sqale_effort_to_grade_d|blocker_remediation_cost - |critical_remediation_cost|major_remediation_cost|minor_remediation_cost|info_remediation_cost)/) do |find| - index = find[0] - # Update filter value when it's before a '|' or at the end of the string - value = /c#{index}_val=((.+?)(\||\z))?/.match(data)[2] - if value - new_value = convert_days_to_minutes(value.to_f, hours_in_day) - filter.data = filter.data.sub("c#{index}_val=#{value}", "c#{index}_val=#{new_value}") - end - end - filter.save! - end - end - - def self.convert_days_to_minutes(hours, hours_in_day) - result = hours * hours_in_day * 60 - # Round value - result.ceil - end -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/521_update_requirement_measures.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/521_update_requirement_measures.rb deleted file mode 100644 index 436e864ae63..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/521_update_requirement_measures.rb +++ /dev/null @@ -1,30 +0,0 @@ -# -# SonarQube, open source software quality management tool. -# Copyright (C) 2008-2014 SonarSource -# mailto:contact AT sonarsource DOT com -# -# SonarQube is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 3 of the License, or (at your option) any later version. -# -# SonarQube 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 -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser 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. -# - -# -# SonarQube 4.3 -# SONAR-5056 -# -class UpdateRequirementMeasures < ActiveRecord::Migration - - def self.up - execute_java_migration('org.sonar.server.db.migrations.v43.RequirementMeasuresMigrationStep') - end -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/523_add_characteristic_reusability_and_sub_characteristic_resource.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/523_add_characteristic_reusability_and_sub_characteristic_resource.rb deleted file mode 100644 index 3d956e6126d..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/523_add_characteristic_reusability_and_sub_characteristic_resource.rb +++ /dev/null @@ -1,69 +0,0 @@ -# -# SonarQube, open source software quality management tool. -# Copyright (C) 2008-2014 SonarSource -# mailto:contact AT sonarsource DOT com -# -# SonarQube is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 3 of the License, or (at your option) any later version. -# -# SonarQube 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 -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser 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. -# - -# -# SonarQube 4.3 -# SONAR-5180 -# -class AddCharacteristicReusabilityAndSubCharacteristicResource < ActiveRecord::Migration - - class Characteristic < ActiveRecord::Base - end - - def self.up - Characteristic.reset_column_information - - # On an empty DB, there are no characteristics, they're all gonna be created after - if Characteristic.all.size > 0 - create_characteristic_reusability_and_its_sub_characteristics - create_sub_characteristic_resource - end - end - - def self.create_characteristic_reusability_and_its_sub_characteristics - # 'Reusability' is the new characteristic, it has two sub characteristics : 'Modularity' and 'Transportability' - reusability = Characteristic.first(:conditions => ['kee=? AND enabled=?', 'REUSABILITY', true]) - modularity = Characteristic.first(:conditions => ['kee=? AND enabled=?', 'MODULARITY', true]) - transportability = Characteristic.first(:conditions => ['kee=? AND enabled=?', 'TRANSPORTABILITY', true]) - - unless reusability - # Reusability should become the first characteristic - reusability = Characteristic.create(:name => 'Reusability', :kee => 'REUSABILITY', :characteristic_order => 1, :enabled => true) - # So all other characteristics have to moved down - Characteristic.all(:conditions => ['enabled=? AND parent_id IS NULL AND rule_id IS NULL', true]).each do |c| - c.characteristic_order = c.characteristic_order + 1 - c.save! - end - end - - Characteristic.create(:name => 'Modularity', :kee => 'MODULARITY', :parent_id => reusability.id, :enabled => true) unless modularity - Characteristic.create(:name => 'Transportability', :kee => 'TRANSPORTABILITY', :parent_id => reusability.id, :enabled => true) unless transportability - end - - def self.create_sub_characteristic_resource - # New sub characteristic 'Resource' (under characteristic 'Reliability') - resource = Characteristic.first(:conditions => ['kee=? AND enabled=?', 'RESOURCE_RELIABILITY', true]) - unless resource - reliability = Characteristic.first(:conditions => ['kee=? AND enabled=?', 'RELIABILITY', true]) - Characteristic.create(:name => 'Resource', :kee => 'RESOURCE_RELIABILITY', :parent_id => reliability.id, :enabled => true) if reliability - end - end - -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/524_update_sub_characteristic_network_use_key.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/524_update_sub_characteristic_network_use_key.rb deleted file mode 100644 index eed522f91ec..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/524_update_sub_characteristic_network_use_key.rb +++ /dev/null @@ -1,44 +0,0 @@ -# -# SonarQube, open source software quality management tool. -# Copyright (C) 2008-2014 SonarSource -# mailto:contact AT sonarsource DOT com -# -# SonarQube is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 3 of the License, or (at your option) any later version. -# -# SonarQube 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 -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser 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. -# - -# -# SonarQube 4.3 -# SONAR-5180 -# -class UpdateSubCharacteristicNetworkUseKey < ActiveRecord::Migration - - class Characteristic < ActiveRecord::Base - end - - def self.up - Characteristic.reset_column_information - - # On an empty DB, there are no characteristics, they're all gonna be created after - if Characteristic.all.size > 0 - # NETWORK_USE was created with a bad key in the migration 466 - network_use = Characteristic.first(:conditions => ['kee=? AND enabled=?', 'NETWORK_USE_EFFICIENCY', true]) - if network_use - network_use.kee = 'NETWORK_USE' - network_use.save! - end - end - end - -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/525_update_not_resolved_issues_on_removed_components.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/525_update_not_resolved_issues_on_removed_components.rb deleted file mode 100644 index 778d82658a0..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/525_update_not_resolved_issues_on_removed_components.rb +++ /dev/null @@ -1,31 +0,0 @@ -# -# SonarQube, open source software quality management tool. -# Copyright (C) 2008-2014 SonarSource -# mailto:contact AT sonarsource DOT com -# -# SonarQube is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 3 of the License, or (at your option) any later version. -# -# SonarQube 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 -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser 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. -# - -# -# SonarQube 4.3 -# SONAR-5200 -# -class UpdateNotResolvedIssuesOnRemovedComponents < ActiveRecord::Migration - - def self.up - execute_java_migration('org.sonar.server.db.migrations.v43.NotResolvedIssuesOnRemovedComponentsMigrationStep') - end - -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/526_remove_unshared_active_dashboards.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/526_remove_unshared_active_dashboards.rb deleted file mode 100644 index 6c35790ce4e..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/526_remove_unshared_active_dashboards.rb +++ /dev/null @@ -1,44 +0,0 @@ -# -# SonarQube, open source software quality management tool. -# Copyright (C) 2008-2014 SonarSource -# mailto:contact AT sonarsource DOT com -# -# SonarQube is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 3 of the License, or (at your option) any later version. -# -# SonarQube 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 -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser 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. -# - -# -# SonarQube 4.3 -# SONAR-4979 -# -class RemoveUnsharedActiveDashboards < ActiveRecord::Migration - - class Dashboard < ActiveRecord::Base - set_table_name 'dashboards' - end - - class ActiveDashboard < ActiveRecord::Base - set_table_name 'active_dashboards' - belongs_to :dashboard, :class_name => 'Dashboard' - end - - def self.up - Dashboard.reset_column_information - ActiveDashboard.reset_column_information - - # Delete every active_dashboards linked on unshared dashboard not owned by the user - ActiveDashboard.all(:joins => 'inner join dashboards on dashboards.id=active_dashboards.dashboard_id', :conditions => ['dashboards.shared=? AND active_dashboards.user_id<>dashboards.user_id', false]).each {|ad| ad.delete} - end - -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/530_merge_measure_data_into_project_measures.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/530_merge_measure_data_into_project_measures.rb index 401a74ffb42..78e35172f2c 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/530_merge_measure_data_into_project_measures.rb +++ b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/530_merge_measure_data_into_project_measures.rb @@ -34,18 +34,7 @@ class MergeMeasureDataIntoProjectMeasures < ActiveRecord::Migration ActiveRecord::Base.connection.commit_db_transaction end ProjectMeasure.reset_column_information - execute_java_migration('org.sonar.server.db.migrations.v44.MeasureDataMigrationStep') drop_table(:measure_data) end - - def self.execute_ddl(message, ddl) - begin - say_with_time(message) do - ActiveRecord::Base.connection.execute(ddl) - end - rescue - # already executed - end - end - + end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/531_update_issues_action_plan_key_on_removed_action_plan.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/531_update_issues_action_plan_key_on_removed_action_plan.rb deleted file mode 100644 index 479e36534ee..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/531_update_issues_action_plan_key_on_removed_action_plan.rb +++ /dev/null @@ -1,31 +0,0 @@ -# -# SonarQube, open source software quality management tool. -# Copyright (C) 2008-2014 SonarSource -# mailto:contact AT sonarsource DOT com -# -# SonarQube is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 3 of the License, or (at your option) any later version. -# -# SonarQube 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 -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser 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. -# - -# -# SonarQube 4.4 -# SONAR-5218 -# -class UpdateIssuesActionPlanKeyOnRemovedActionPlan < ActiveRecord::Migration - - def self.up - execute_java_migration('org.sonar.server.db.migrations.v44.IssueActionPlanKeyMigrationStep') - end - -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/539_insert_active_rule_dates.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/539_insert_active_rule_dates.rb deleted file mode 100644 index 0c2e5c8fe30..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/539_insert_active_rule_dates.rb +++ /dev/null @@ -1,41 +0,0 @@ -# -# SonarQube, open source software quality management tool. -# Copyright (C) 2008-2014 SonarSource -# mailto:contact AT sonarsource DOT com -# -# SonarQube is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 3 of the License, or (at your option) any later version. -# -# SonarQube 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 -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser 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. -# - -# -# SonarQube 4.4 -# SONAR-5007 -# -class InsertActiveRuleDates < ActiveRecord::Migration - - class ActiveRule < ActiveRecord::Base - end - - def self.up - ActiveRule.reset_column_information - now = Time.now - ActiveRule.find(:all).each do |active_rule| - active_rule.created_at=now - active_rule.updated_at=now - active_rule.save! - end - end - -end - diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/541_add_unique_index_on_active_rule_key.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/541_add_unique_index_on_active_rule_key.rb index 9885d253f77..730847f5aa6 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/541_add_unique_index_on_active_rule_key.rb +++ b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/541_add_unique_index_on_active_rule_key.rb @@ -25,35 +25,7 @@ class AddUniqueIndexOnActiveRuleKey < ActiveRecord::Migration - class ActiveRuleParameter < ActiveRecord::Base - end - - class ActiveRule < ActiveRecord::Base - end - def self.up - ActiveRule.reset_column_information - ActiveRuleParameter.reset_column_information - - # Search for all rules activated many times on a same profile - rule_actived_many_times_on_same_profile = ActiveRule.all( - :select => 'rule_id,profile_id', - :group => 'rule_id,profile_id', - :having => 'COUNT(*) > 1' - ) - - rule_actived_many_times_on_same_profile.each do |duplicate_active_rule| - # Search for all duplication on current rule and profile - active_rules = ActiveRule.all( - :conditions => {:rule_id => duplicate_active_rule.rule_id, :profile_id => duplicate_active_rule.profile_id} - ) - # Remove duplication, keep only one active rule (first one) - active_rules.drop(1).each do |active_rule| - ActiveRuleParameter.delete_all(:active_rule_id => active_rule.id) - active_rule.delete - end - end - add_index :active_rules, [:profile_id, :rule_id], :name => 'uniq_profile_rule_ids', :unique => true end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/545_rename_rules_cardinality_to_is_template.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/545_rename_rules_cardinality_to_is_template.rb index c8203cba112..c6eb7b3a858 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/545_rename_rules_cardinality_to_is_template.rb +++ b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/545_rename_rules_cardinality_to_is_template.rb @@ -30,10 +30,6 @@ class RenameRulesCardinalityToIsTemplate < ActiveRecord::Migration def self.up add_column 'rules', 'is_template', :boolean, :null => false, :default => false Rule.reset_column_information - Rule.all.each do |r| - r.is_template = r.cardinality == 'MULTIPLE' - r.save! - end remove_column 'rules', 'cardinality' end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/546_inverse_rule_key_index.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/546_inverse_rule_key_index.rb deleted file mode 100644 index 6cf46b03186..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/546_inverse_rule_key_index.rb +++ /dev/null @@ -1,99 +0,0 @@ -# -# SonarQube, open source software quality management tool. -# Copyright (C) 2008-2014 SonarSource -# mailto:contact AT sonarsource DOT com -# -# SonarQube is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 3 of the License, or (at your option) any later version. -# -# SonarQube 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 -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser 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. -# - -# -# SQ 4.4 -# SONAR-5001 -# -require 'set' -class InverseRuleKeyIndex < ActiveRecord::Migration - - - class ActiveRule < ActiveRecord::Base - set_table_name 'active_rules' - end - - class Characteristic < ActiveRecord::Base - set_table_name 'characteristics' - end - - class Issue < ActiveRecord::Base - set_table_name 'issues' - end - - class ActiveRuleChange < ActiveRecord::Base - set_table_name 'active_rule_changes' - end - - class ProjectMeasure < ActiveRecord::Base - set_table_name 'project_measures' - end - - class Rule < ActiveRecord::Base - end - - class RuleParameter < ActiveRecord::Base - set_table_name 'rules_parameters' - end - - def self.up - begin - remove_index :rules, :name => 'rules_plugin_key_and_name' - rescue - #ignore - end - - # rows can be duplicated because the unique index was sometimes missing - delete_duplicated_rules - - add_index :rules, [:plugin_name, :plugin_rule_key], :unique => true, :name => 'rules_repo_key' - end - - private - def self.delete_duplicated_rules - ActiveRule.reset_column_information - ActiveRuleChange.reset_column_information - Characteristic.reset_column_information - Issue.reset_column_information - ProjectMeasure.reset_column_information - Rule.reset_column_information - RuleParameter.reset_column_information - - say_with_time 'Delete duplicated rules' do - existing_keys = Set.new - rules=Rule.find(:all, :select => 'id,plugin_name,plugin_rule_key', :order => 'id') - rules.each do |rule| - key = "#{rule.plugin_name}:#{rule.plugin_rule_key}" - if existing_keys.include?(key) - say "Delete duplicated rule '#{key}' (id=#{rule.id})" - ActiveRule.delete_all(['rule_id=?', rule.id]) - ActiveRuleChange.delete_all(['rule_id=?', rule.id]) - Characteristic.delete_all(['rule_id=?', rule.id]) - Issue.delete_all(['rule_id=?', rule.id]) - ProjectMeasure.delete_all(['rule_id=?', rule.id]) - RuleParameter.delete_all(['rule_id=?', rule.id]) - rule.destroy - else - existing_keys.add(key) - end - end - end - end -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/547_merge_custom_rules_extended_description_with_description.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/547_merge_custom_rules_extended_description_with_description.rb deleted file mode 100644 index b8f2377212c..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/547_merge_custom_rules_extended_description_with_description.rb +++ /dev/null @@ -1,44 +0,0 @@ -# -# SonarQube, open source software quality management tool. -# Copyright (C) 2008-2014 SonarSource -# mailto:contact AT sonarsource DOT com -# -# SonarQube is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 3 of the License, or (at your option) any later version. -# -# SonarQube 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 -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser 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. -# - -# -# SonarQube 4.4 -# SONAR-5397 -# -class MergeCustomRulesExtendedDescriptionWithDescription < ActiveRecord::Migration - - class Rule < ActiveRecord::Base - end - - def self.up - Rule.reset_column_information - Rule.all(:conditions => ['template_id IS NOT NULL and note_data IS NOT NULL']).each do |r| - unless r.note_data.blank? - r.description += '
' + r.note_data - r.note_data = nil - r.note_user_login = nil - r.note_created_at = nil - r.note_updated_at = nil - r.save! - end - end - end - -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/549_feed_qprofile_keys.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/549_feed_qprofile_keys.rb index d2b579ccbd8..81724162b26 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/549_feed_qprofile_keys.rb +++ b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/549_feed_qprofile_keys.rb @@ -25,8 +25,6 @@ class FeedQprofileKeys < ActiveRecord::Migration def self.up - execute_java_migration('org.sonar.server.db.migrations.v44.FeedQProfileKeysMigrationStep') - # set as non-null and unique change_column :rules_profiles, :kee, :string, :limit => 255, :null => false add_index :rules_profiles, :kee, :name => 'uniq_qprof_key', :unique => true diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/550_convert_profile_measures.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/550_convert_profile_measures.rb deleted file mode 100644 index 1543cc3fadf..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/550_convert_profile_measures.rb +++ /dev/null @@ -1,41 +0,0 @@ -# -# SonarQube, open source software quality management tool. -# Copyright (C) 2008-2014 SonarSource -# mailto:contact AT sonarsource DOT com -# -# SonarQube is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 3 of the License, or (at your option) any later version. -# -# SonarQube 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 -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser 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. -# - -# -# SonarQube 4.4 -# SONAR-5218 -# -class ConvertProfileMeasures < ActiveRecord::Migration - - class Metric < ActiveRecord::Base - end - - def self.up - execute_java_migration('org.sonar.server.db.migrations.v44.ConvertProfileMeasuresMigrationStep') - - Metric.reset_column_information - metric = Metric.find_by_name('profile') - if metric - metric.name='quality_profiles' - metric.save! - end - end - -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/551_update_logs_to_activities.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/551_update_logs_to_activities.rb deleted file mode 100644 index d11201aee8e..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/551_update_logs_to_activities.rb +++ /dev/null @@ -1,31 +0,0 @@ -# -# SonarQube, open source software quality management tool. -# Copyright (C) 2008-2014 SonarSource -# mailto:contact AT sonarsource DOT com -# -# SonarQube is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 3 of the License, or (at your option) any later version. -# -# SonarQube 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 -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser 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. -# - -# -# SonarQube 4.4 -# SONAR-5218 -# -class UpdateLogsToActivities < ActiveRecord::Migration - - def self.up - execute_java_migration('org.sonar.server.db.migrations.v44.ChangeLogMigrationStep') - end - -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/553_feed_qprofile_dates.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/553_feed_qprofile_dates.rb deleted file mode 100644 index f8cc4868a22..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/553_feed_qprofile_dates.rb +++ /dev/null @@ -1,30 +0,0 @@ -# -# SonarQube, open source software quality management tool. -# Copyright (C) 2008-2014 SonarSource -# mailto:contact AT sonarsource DOT com -# -# SonarQube is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 3 of the License, or (at your option) any later version. -# -# SonarQube 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 -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser 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. -# - -# -# SonarQube 4.4 -# -class FeedQprofileDates < ActiveRecord::Migration - - def self.up - execute_java_migration 'org.sonar.server.db.migrations.v44.FeedQProfileDatesMigrationStep' - end - -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/554_add_missing_user_unique_index.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/554_add_missing_user_unique_index.rb deleted file mode 100644 index 3101ce1beef..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/554_add_missing_user_unique_index.rb +++ /dev/null @@ -1,108 +0,0 @@ -# -# SonarQube, open source software quality management tool. -# Copyright (C) 2008-2014 SonarSource -# mailto:contact AT sonarsource DOT com -# -# SonarQube is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 3 of the License, or (at your option) any later version. -# -# SonarQube 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 -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser 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. -# - -# -# SonarQube 4.4 -# See SONAR-5405 -# -require 'set' - -class AddMissingUserUniqueIndex < ActiveRecord::Migration - - class User < ActiveRecord::Base - end - - class UserRole < ActiveRecord::Base - end - - class Property < ActiveRecord::Base - set_table_name 'properties' - end - - class GroupsUsers < ActiveRecord::Base - set_table_name 'groups_users' - end - - class Dashboard < ActiveRecord::Base - set_table_name 'dashboards' - has_many :active_dashboards, :dependent => :destroy, :inverse_of => :dashboard - end - - class ActiveDashboard < ActiveRecord::Base - set_table_name 'active_dashboards' - belongs_to :dashboard - end - - class PermTemplatesUser < ActiveRecord::Base - set_table_name 'perm_templates_users' - end - - class MeasureFilter < ActiveRecord::Base - set_table_name 'measure_filters' - has_many :measure_filter_favourites, :dependent => :delete_all - end - - class MeasureFilterFavourite < ActiveRecord::Base - set_table_name 'measure_filter_favourites' - belongs_to :measure_filter - end - - def self.up - unless index_exists?(:users, :login, nil) - delete_duplicated_users - add_index :users, :login, :name => 'users_login', :unique => true - end - end - - private - def self.delete_duplicated_users - User.reset_column_information - UserRole.reset_column_information - Property.reset_column_information - GroupsUsers.reset_column_information - Dashboard.reset_column_information - ActiveDashboard.reset_column_information - PermTemplatesUser.reset_column_information - MeasureFilter.reset_column_information - MeasureFilterFavourite.reset_column_information - - say_with_time 'Delete duplicated users' do - existing_logins = Set.new - users=User.find(:all, :select => 'id,login', :order => 'id') - users.each do |user| - if existing_logins.include?(user.login) - say "Delete duplicated login '#{user.login}' (id=#{user.id})" - UserRole.delete_all(['user_id=?', user.id]) - Property.delete_all(['user_id=?', user.id]) - GroupsUsers.delete_all(['user_id=?', user.id]) - Dashboard.destroy_all(['user_id=?', user.id]) - ActiveDashboard.destroy_all(['user_id=?', user.id]) - PermTemplatesUser.destroy_all(['user_id=?', user.id]) - MeasureFilter.destroy_all(['user_id=?', user.id]) - MeasureFilterFavourite.destroy_all(['user_id=?', user.id]) - user.destroy - else - existing_logins.add(user.login) - end - end - end - end - -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/556_fill_rules_empty_name_and_desc.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/556_fill_rules_empty_name_and_desc.rb deleted file mode 100644 index 28b6f96f852..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/556_fill_rules_empty_name_and_desc.rb +++ /dev/null @@ -1,45 +0,0 @@ -# -# SonarQube, open source software quality management tool. -# Copyright (C) 2008-2014 SonarSource -# mailto:contact AT sonarsource DOT com -# -# SonarQube is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 3 of the License, or (at your option) any later version. -# -# SonarQube 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 -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser 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. -# - -# -# SonarQube 4.4 -# SONAR-5426 -# -class FillRulesEmptyNameAndDesc < ActiveRecord::Migration - - class Rule < ActiveRecord::Base - end - - def self.up - Rule.reset_column_information - - Rule.all(['name IS NULL OR description IS NULL']).each do |rule| - key = rule.plugin_rule_key - unless rule.name - rule.name = key - end - unless rule.description - rule.description = key - end - rule.save! - end - end - -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/582_update_existing_rules_description_format.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/582_update_existing_rules_description_format.rb deleted file mode 100644 index 4f5fc6be52a..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/582_update_existing_rules_description_format.rb +++ /dev/null @@ -1,35 +0,0 @@ -# -# SonarQube, open source software quality management tool. -# Copyright (C) 2008-2014 SonarSource -# mailto:contact AT sonarsource DOT com -# -# SonarQube is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 3 of the License, or (at your option) any later version. -# -# SonarQube 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 -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser 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. -# - -# -# SonarQube 4.5 -# SONAR-5001 -# -class UpdateExistingRulesDescriptionFormat < ActiveRecord::Migration - - class Rule < ActiveRecord::Base - end - - def self.up - Rule.reset_column_information - Rule.update_all({:description_format => 'HTML', :updated_at => Time.now}, "plugin_name != 'manual' AND template_id IS NULL") - Rule.update_all({:description_format => 'MARKDOWN', :updated_at => Time.now}, "plugin_name = 'manual' OR template_id IS NOT NULL") - end -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/583_add_missing_rule_parameter_default_values.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/583_add_missing_rule_parameter_default_values.rb deleted file mode 100644 index e8c6f8d70dd..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/583_add_missing_rule_parameter_default_values.rb +++ /dev/null @@ -1,30 +0,0 @@ -# -# SonarQube, open source software quality management tool. -# Copyright (C) 2008-2014 SonarSource -# mailto:contact AT sonarsource DOT com -# -# SonarQube is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 3 of the License, or (at your option) any later version. -# -# SonarQube 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 -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser 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. -# - -# -# SonarQube 4.5 -# -class AddMissingRuleParameterDefaultValues < ActiveRecord::Migration - - def self.up - execute_java_migration 'org.sonar.server.db.migrations.v45.AddMissingRuleParameterDefaultValuesMigrationStep' - end - -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/584_delete_measures_on_deleted_profiles.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/584_delete_measures_on_deleted_profiles.rb deleted file mode 100644 index 8a075d5fba9..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/584_delete_measures_on_deleted_profiles.rb +++ /dev/null @@ -1,30 +0,0 @@ -# -# SonarQube, open source software quality management tool. -# Copyright (C) 2008-2014 SonarSource -# mailto:contact AT sonarsource DOT com -# -# SonarQube is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 3 of the License, or (at your option) any later version. -# -# SonarQube 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 -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser 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. -# - -# -# SonarQube 4.5 -# -class DeleteMeasuresOnDeletedProfiles < ActiveRecord::Migration - - def self.up - execute_java_migration 'org.sonar.server.db.migrations.v45.DeleteMeasuresOnDeletedProfilesMigrationStep' - end - -end diff --git a/sonar-db/src/main/java/org/sonar/db/MyBatis.java b/sonar-db/src/main/java/org/sonar/db/MyBatis.java index e1a6fd9dfd9..d068c8fcf06 100644 --- a/sonar-db/src/main/java/org/sonar/db/MyBatis.java +++ b/sonar-db/src/main/java/org/sonar/db/MyBatis.java @@ -137,7 +137,6 @@ import org.sonar.db.user.UserMapper; import org.sonar.db.user.UserRoleDto; import org.sonar.db.version.SchemaMigrationDto; import org.sonar.db.version.SchemaMigrationMapper; -import org.sonar.db.version.v44.Migration44Mapper; import org.sonar.db.version.v45.Migration45Mapper; import org.sonar.db.version.v50.Migration50Mapper; @@ -245,7 +244,7 @@ public class MyBatis { DuplicationMapper.class, IssueMapper.class, IssueChangeMapper.class, IssueFilterMapper.class, IssueFilterFavouriteMapper.class, IsAliveMapper.class, - LoadedTemplateMapper.class, MeasureFilterMapper.class, Migration44Mapper.class, PermissionTemplateMapper.class, PropertiesMapper.class, PurgeMapper.class, + LoadedTemplateMapper.class, MeasureFilterMapper.class, PermissionTemplateMapper.class, PropertiesMapper.class, PurgeMapper.class, ResourceKeyUpdaterMapper.class, ResourceIndexMapper.class, RoleMapper.class, RuleMapper.class, SchemaMigrationMapper.class, UserMapper.class, GroupMapper.class, UserGroupMapper.class, WidgetMapper.class, WidgetPropertyMapper.class, FileSourceMapper.class, ActionPlanMapper.class, diff --git a/sonar-db/src/main/java/org/sonar/db/version/DatabaseVersion.java b/sonar-db/src/main/java/org/sonar/db/version/DatabaseVersion.java index f28a4378b04..db0a87e060f 100644 --- a/sonar-db/src/main/java/org/sonar/db/version/DatabaseVersion.java +++ b/sonar-db/src/main/java/org/sonar/db/version/DatabaseVersion.java @@ -36,7 +36,7 @@ public class DatabaseVersion { * versions must be previously upgraded to LTS version. * Note that the value can't be less than current LTS version. */ - public static final int MIN_UPGRADE_VERSION = 440; + public static final int MIN_UPGRADE_VERSION = 600; /** * List of all the tables. diff --git a/sonar-db/src/main/java/org/sonar/db/version/v44/ChangeLog.java b/sonar-db/src/main/java/org/sonar/db/version/v44/ChangeLog.java deleted file mode 100644 index 6306bb7704c..00000000000 --- a/sonar-db/src/main/java/org/sonar/db/version/v44/ChangeLog.java +++ /dev/null @@ -1,118 +0,0 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2014 SonarSource - * mailto:contact AT sonarsource DOT com - * - * SonarQube is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * SonarQube 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser 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. - */ -package org.sonar.db.version.v44; - -import java.util.Date; - -/** - * SONAR-5329 - * Transition ActiveRuleChanges to ActivityLog - *

- * Used in the Active Record Migration 548. - * - * @since 4.4 - */ -public class ChangeLog { - - private int id; - private Date createdAt; - private int severity; - private String paramKey; - private String paramValue; - private String userLogin; - private String ruleKey; - private String repository; - private String profileKey; - - public ChangeLog() { - } - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - public int getSeverity() { - return severity; - } - - public void setSeverity(int severity) { - this.severity = severity; - } - - public Date getCreatedAt() { - return createdAt; - } - - public void setCreatedAt(Date createdAt) { - this.createdAt = createdAt; - } - - public String getParamKey() { - return paramKey; - } - - public void setParamKey(String paramKey) { - this.paramKey = paramKey; - } - - public String getParamValue() { - return paramValue; - } - - public void setParamValue(String paramValue) { - this.paramValue = paramValue; - } - - public String getUserLogin() { - return userLogin; - } - - public void setUserLogin(String userLogin) { - this.userLogin = userLogin; - } - - public String getRuleKey() { - return ruleKey; - } - - public void setRuleKey(String ruleKey) { - this.ruleKey = ruleKey; - } - - public String getRepository() { - return repository; - } - - public void setRepository(String repository) { - this.repository = repository; - } - - public String getProfileKey() { - return profileKey; - } - - public void setProfileKey(String profileKey) { - this.profileKey = profileKey; - } -} diff --git a/sonar-db/src/main/java/org/sonar/db/version/v44/Migration44Mapper.java b/sonar-db/src/main/java/org/sonar/db/version/v44/Migration44Mapper.java deleted file mode 100644 index 875be56a080..00000000000 --- a/sonar-db/src/main/java/org/sonar/db/version/v44/Migration44Mapper.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2014 SonarSource - * mailto:contact AT sonarsource DOT com - * - * SonarQube is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * SonarQube 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser 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. - */ -package org.sonar.db.version.v44; - -import java.util.Date; -import java.util.List; -import javax.annotation.CheckForNull; -import javax.annotation.Nullable; -import org.apache.ibatis.annotations.Param; - -public interface Migration44Mapper { - - // migration of measures "profile" and "profile_version" - List selectProfileMeasures(); - - @CheckForNull - Integer selectProfileVersion(long snapshotId); - - @CheckForNull - Date selectProfileVersionDate(@Param("profileId") int profileId, @Param("profileVersion") int profileVersion); - - void updateProfileMeasure(@Param("measureId") long measureId, @Param("json") String json); - - void deleteProfileMeasure(long profileMeasureId); - - @CheckForNull - QProfileDto44 selectProfileById(int id); - - // creation of columns RULES_PROFILES.CREATED_AT and UPDATED_AT - List selectAllProfiles(); - - @CheckForNull - Date selectProfileCreatedAt(int profileId); - - @CheckForNull - Date selectProfileUpdatedAt(int profileId); - - void updateProfileDates(@Param("profileId") int profileId, - @Param("createdAt") Date createdAt, @Param("updatedAt") Date updatedAt, - @Param("rulesUpdatedAt") String rulesUpdatedAt); - - // migrate changeLog to Activities - List selectActiveRuleChange(@Nullable @Param("enabled") Boolean enabled); - - List selectMeasuresOnDeletedQualityProfiles(); -} diff --git a/sonar-db/src/main/java/org/sonar/db/version/v44/ProfileMeasure.java b/sonar-db/src/main/java/org/sonar/db/version/v44/ProfileMeasure.java deleted file mode 100644 index c3663442a87..00000000000 --- a/sonar-db/src/main/java/org/sonar/db/version/v44/ProfileMeasure.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2014 SonarSource - * mailto:contact AT sonarsource DOT com - * - * SonarQube is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * SonarQube 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser 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. - */ -package org.sonar.db.version.v44; - -public class ProfileMeasure { - private long id; - private int profileId; - private long snapshotId; - - public long getId() { - return id; - } - - public void setId(long id) { - this.id = id; - } - - public int getProfileId() { - return profileId; - } - - public void setProfileId(int profileId) { - this.profileId = profileId; - } - - public long getSnapshotId() { - return snapshotId; - } - - public void setSnapshotId(long snapshotId) { - this.snapshotId = snapshotId; - } -} diff --git a/sonar-db/src/main/java/org/sonar/db/version/v44/QProfileDto44.java b/sonar-db/src/main/java/org/sonar/db/version/v44/QProfileDto44.java deleted file mode 100644 index 7b659f52f13..00000000000 --- a/sonar-db/src/main/java/org/sonar/db/version/v44/QProfileDto44.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2014 SonarSource - * mailto:contact AT sonarsource DOT com - * - * SonarQube is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * SonarQube 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser 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. - */ -package org.sonar.db.version.v44; - -public class QProfileDto44 { - - private Integer id; - private String kee; - private String name; - private String language; - - public Integer getId() { - return id; - } - - public void setId(Integer id) { - this.id = id; - } - - public String getKee() { - return kee; - } - - public void setKee(String kee) { - this.kee = kee; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getLanguage() { - return language; - } - - public void setLanguage(String language) { - this.language = language; - } -} diff --git a/sonar-db/src/main/java/org/sonar/db/version/v44/package-info.java b/sonar-db/src/main/java/org/sonar/db/version/v44/package-info.java deleted file mode 100644 index 9d07e1f584a..00000000000 --- a/sonar-db/src/main/java/org/sonar/db/version/v44/package-info.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2014 SonarSource - * mailto:contact AT sonarsource DOT com - * - * SonarQube is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * SonarQube 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser 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. - */ - -@ParametersAreNonnullByDefault -package org.sonar.db.version.v44; - -import javax.annotation.ParametersAreNonnullByDefault; - diff --git a/sonar-db/src/main/resources/org/sonar/db/version/v44/Migration44Mapper.xml b/sonar-db/src/main/resources/org/sonar/db/version/v44/Migration44Mapper.xml deleted file mode 100644 index 30bcffddccb..00000000000 --- a/sonar-db/src/main/resources/org/sonar/db/version/v44/Migration44Mapper.xml +++ /dev/null @@ -1,105 +0,0 @@ - - - - - - - - - - - - - - - update project_measures - set text_value=#{json}, value=null - where id=#{measureId} - - - - delete from project_measures where id=#{id} - - - - - - - - - - - - update rules_profiles - set created_at=#{createdAt}, updated_at=#{updatedAt}, rules_updated_at=#{rulesUpdatedAt} - where id=#{profileId} - - - - - diff --git a/sonar-db/src/test/java/org/sonar/db/version/v44/ChangeLogTest.java b/sonar-db/src/test/java/org/sonar/db/version/v44/ChangeLogTest.java deleted file mode 100644 index b260b793146..00000000000 --- a/sonar-db/src/test/java/org/sonar/db/version/v44/ChangeLogTest.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2014 SonarSource - * mailto:contact AT sonarsource DOT com - * - * SonarQube is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * SonarQube 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser 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. - */ -package org.sonar.db.version.v44; - -import org.junit.Test; - -import static com.google.code.beanmatchers.BeanMatchers.hasValidBeanConstructor; -import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.allOf; - -public class ChangeLogTest { - - @Test - public void test_bean() throws Exception { - assertThat(ChangeLog.class, allOf( - hasValidBeanConstructor(), - hasValidGettersAndSetters())); - } -} diff --git a/sonar-db/src/test/java/org/sonar/db/version/v44/ProfileMeasureTest.java b/sonar-db/src/test/java/org/sonar/db/version/v44/ProfileMeasureTest.java deleted file mode 100644 index 050408aa4cd..00000000000 --- a/sonar-db/src/test/java/org/sonar/db/version/v44/ProfileMeasureTest.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2014 SonarSource - * mailto:contact AT sonarsource DOT com - * - * SonarQube is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * SonarQube 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser 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. - */ -package org.sonar.db.version.v44; - -import org.junit.Test; - -import static com.google.code.beanmatchers.BeanMatchers.hasValidBeanConstructor; -import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.allOf; - -public class ProfileMeasureTest { - - @Test - public void test_bean() throws Exception { - assertThat(ProfileMeasure.class, allOf( - hasValidBeanConstructor(), - hasValidGettersAndSetters())); - } -} -- 2.39.5