From 905642ccc24e3f2b68c0549cad07328a71ed48e0 Mon Sep 17 00:00:00 2001 From: Jacek Date: Mon, 14 Jun 2021 11:36:38 +0200 Subject: [PATCH] SONAR-14792 Drop migration classes prior 8.9 --- .../MigrationConfigurationModule.java | 24 +- .../version/v80/CreateNewCodePeriodTable.java | 109 --- .../v80/CreateProjectQualityGatesTable.java | 68 -- .../db/migration/version/v80/DbVersion80.java | 40 - ...eprecatedRuleKeysRuleIdIndexNonUnique.java | 54 -- .../v80/MakeOrganizationsGuardedNullable.java | 46 - .../v80/PopulateNewCodePeriodTable.java | 292 ------- .../v80/PopulateProjectQualityGatesTable.java | 80 -- ...DefaultQualityGateFromPropertiesTable.java | 39 - ...GitHubLoginGenerationStrategyProperty.java | 39 - .../v80/RemoveLeakPeriodProperties.java | 39 - .../RenameAnalysisPropertiesSnapshotUuid.java | 63 -- .../migration/version/v80/package-info.java | 23 - .../v81/AddExcludeBranchFromPurgeColumn.java | 49 -- .../version/v81/CreateAlmSettingsTable.java | 98 --- .../v81/CreateProjectAlmSettingsTable.java | 97 --- .../db/migration/version/v81/DbVersion81.java | 48 -- ...eleteSonarPullRequestProviderProperty.java | 44 - .../version/v81/MigrateAzureAlmSettings.java | 353 -------- .../v81/MigrateBitbucketAlmSettings.java | 362 -------- .../MigrateDefaultBranchesToKeepSetting.java | 106 --- ...ateDeprecatedGithubPrivateKeyToNewKey.java | 66 -- .../version/v81/MigrateGithubAlmSettings.java | 335 -------- .../v81/MigrateSlbsAndLlbsToCommonType.java | 46 - ...grateSlbsAndLlbsToCommonTypeInCeTasks.java | 41 - .../PopulateExcludeBranchFromPurgeColumn.java | 47 - .../version/v81/RemoveLLBRegexSetting.java | 40 - .../RemoveNewsboxDismissHotspotsProperty.java | 38 - ...eDaysBeforeDeletingInactiveSLBSetting.java | 43 - .../migration/version/v81/package-info.java | 23 - .../AddIndexOnSlugOfProjectAlmSettings.java | 65 -- .../version/v82/CreateAlmPatsTable.java | 86 -- .../version/v82/CreateProjectsTable.java | 118 --- .../db/migration/version/v82/DbVersion82.java | 44 - ...ConditionsUsingSecurityHotspotMetrics.java | 46 - ...eleteSecurityReviewRatingLiveMeasures.java | 67 -- .../DropSecurityHotSpotsInReviewStatus.java | 58 -- .../DropTagsColumnFromComponentsTable.java | 40 - .../EnsureHotspotDefaultStatusIsToReview.java | 50 -- ...nualVulnerabilitiesToSecurityHotSpots.java | 68 -- .../version/v82/PopulateProjectsTable.java | 64 -- .../RemoveNewsboxDismissHotspotsProperty.java | 38 - .../v82/RenameProjectsTableToComponents.java | 35 - .../migration/version/v82/package-info.java | 23 - .../AddSummaryEnabledColumnToAlmSettings.java | 50 -- .../db/migration/version/v83/DbVersion83.java | 52 -- .../v83/DropIdFromComponentsTable.java | 45 - ...eSummaryCommentEnabledColumnForGitHub.java | 52 -- .../AddComponentUuidColumnToGroupRoles.java | 58 -- .../DropResourceIdFromGroupRolesTable.java | 60 -- .../MigrateResourceIdToUuidInGroupRoles.java | 51 -- .../version/v83/grouproles/package-info.java | 23 - .../migration/version/v83/package-info.java | 23 - .../AddComponentUuidColumnToProperties.java | 49 -- .../DropResourceIdFromPropertiesTable.java | 40 - .../MigrateResourceIdToUuidInProperties.java | 51 -- .../version/v83/properties/package-info.java | 23 - .../AddComponentUuidColumnToUserRoles.java | 58 -- .../DropResourceIdFromUserRolesTable.java | 42 - .../MigrateResourceIdToUuidInUserRoles.java | 52 -- .../version/v83/userroles/package-info.java | 23 - .../v84/AddProjectBranchesNeedIssueSync.java | 43 - .../v84/CreateSamlMessageIdsTable.java | 71 -- .../version/v84/CreateSessionTokensTable.java | 76 -- .../db/migration/version/v84/DbVersion84.java | 798 ----------------- ...keProjectBranchesNeedIssueSyncNonNull.java | 43 - .../PopulateProjectBranchesNeedIssueSync.java | 44 - .../RemoveFilesFavouritesFromProperties.java | 48 -- ...UuidColumnOfActiveRuleParametersTable.java | 38 - ...UuidColumnToActiveRuleParametersTable.java | 31 - ...opIdColumnOfActiveRuleParametersTable.java | 31 - ...OnIdColumnOfActiveRuleParametersTable.java | 32 - ...veRuleParametersUuidColumnNotNullable.java | 31 - .../PopulateActiveRuleParametersUuid.java | 50 -- .../activeruleparameters/package-info.java | 23 - ...eRuleUuidColumnToActiveRuleParameters.java | 50 -- ...veRuleUuidOfActiveRuleParametersTable.java | 61 -- ...maryKeyOnUuidColumnOfActiveRulesTable.java | 38 - .../AddUuidColumnToActiveRulesTable.java | 31 - ...leIdColumnOfActiveRuleParametersTable.java | 36 - .../DropIdColumnOfActiveRulesTable.java | 31 - ...tiveRuleIdOfActiveRuleParametersTable.java | 32 - ...rimaryKeyOnIdColumnOfActiveRulesTable.java | 32 - ...leParametersActiveRuleUuidNotNullable.java | 50 -- .../MakeActiveRulesUuidColumnNotNullable.java | 31 - ...ateActiveRuleParametersActiveRuleUuid.java | 51 -- .../activerules/PopulateActiveRulesUuid.java | 50 -- .../version/v84/activerules/package-info.java | 23 - .../AddClientIdAndClientSecretColumns.java | 52 -- .../version/v84/alm/package-info.java | 23 - ...imaryKeyOnUuidColumnOfCeActivityTable.java | 38 - .../DropIdColumnOfCeActivityTable.java | 31 - ...PrimaryKeyOnIdColumnOfCeActivityTable.java | 32 - .../version/v84/ceactivity/package-info.java | 23 - ...dPrimaryKeyOnUuidColumnOfCeQueueTable.java | 38 - .../cequeue/DropIdColumnOfCeQueueTable.java | 31 - ...ropPrimaryKeyOnIdColumnOfCeQueueTable.java | 32 - ...UniqueIndexOnUuidColumnOfCeQueueTable.java | 32 - .../version/v84/cequeue/package-info.java | 23 - .../v84/common/AddUuidColumnToTable.java | 52 -- .../version/v84/common/DropIdColumn.java | 42 - .../v84/common/DropPrimaryKeyOnIdColumn.java | 41 - .../v84/common/MakeUuidColumnNotNullable.java | 51 -- .../version/v84/common/package-info.java | 23 - ...yOnUuidColumnOfDuplicationsIndexTable.java | 38 - .../AddUuidToDuplicationsIndexTable.java | 31 - .../DropIdColumnOfDuplicationsIndexTable.java | 31 - ...KeyOnIdColumnOfDuplicationsIndexTable.java | 32 - ...uplicationsIndexUuidColumnNotNullable.java | 31 - .../PopulateDuplicationsIndexUuid.java | 50 -- .../v84/duplicationsindex/package-info.java | 23 - ...ddPrimaryKeyOnUuidColumnOfEventsTable.java | 38 - .../v84/events/DropIdColumnOfEventsTable.java | 31 - ...DropPrimaryKeyOnIdColumnOfEventsTable.java | 32 - .../version/v84/events/package-info.java | 23 - ...maryKeyOnUuidColumnOfFileSourcesTable.java | 38 - .../AddUuidColumnToFileSourcesTable.java | 31 - .../DropIdColumnOfFileSourcesTable.java | 31 - ...rimaryKeyOnIdColumnOfFileSourcesTable.java | 32 - .../MakeFileSourcesUuidColumnNotNullable.java | 31 - .../filesources/PopulateFileSourcesUuid.java | 50 -- .../version/v84/filesources/package-info.java | 23 - ...imaryKeyOnUuidColumnOfGroupRolesTable.java | 38 - .../AddUuidColumnToGroupRolesTable.java | 31 - .../DropIdColumnOfGroupRolesTable.java | 41 - ...PrimaryKeyOnIdColumnOfGroupRolesTable.java | 32 - .../MakeGroupRolesUuidColumnNotNullable.java | 31 - .../grouproles/PopulateGroupRolesUuid.java | 50 -- .../version/v84/grouproles/package-info.java | 23 - ...ddPrimaryKeyOnUuidColumnOfGroupsTable.java | 38 - .../groups/AddUuidColumnToGroupsTable.java | 31 - .../v84/groups/DropIdColumnOfGroupsTable.java | 31 - ...DropPrimaryKeyOnIdColumnOfGroupsTable.java | 32 - .../MakeGroupsUuidColumnNotNullable.java | 31 - .../v84/groups/PopulateGroupsUuid.java | 50 -- .../AddGroupUuidColumnToGroupRoles.java | 50 -- .../AddIndexOnGroupUuidOfGroupRolesTable.java | 76 -- .../DropGroupIdColumnOfGroupRolesTable.java | 36 - .../DropIndexOnGroupIdOfGroupRolesTable.java | 32 - .../PopulateGroupRolesGroupUuid.java | 61 -- .../v84/groups/grouproles/package-info.java | 23 - .../AddGroupUuidColumnToGroupsUsers.java | 50 -- ...AddIndexOnGroupUuidOfGroupsUsersTable.java | 76 -- .../DropGroupIdColumnOfGroupsUsersTable.java | 36 - .../DropIndexOnGroupIdOfGroupsUsersTable.java | 56 -- .../MakeGroupsUsersGroupUuidNotNullable.java | 50 -- .../PopulateGroupsUsersGroupUuid.java | 67 -- .../v84/groups/groupsusers/package-info.java | 23 - ...DefaultGroupUuidColumnToOrganizations.java | 50 -- ...aultGroupIdColumnOfOrganizationsTable.java | 36 - ...PopulateOrganizationsDefaultGroupUuid.java | 64 -- .../groups/organizations/package-info.java | 23 - .../version/v84/groups/package-info.java | 23 - ...dGroupUuidColumnToPermTemplatesGroups.java | 50 -- ...oupIdColumnOfPermTemplatesGroupsTable.java | 36 - .../PopulatePermTemplatesGroupsGroupUuid.java | 63 -- .../permtemplatesgroups/package-info.java | 23 - ...ddGroupUuidColumnToQProfileEditGroups.java | 50 -- ...xOnGroupUuidOfQProfileEditGroupsTable.java | 66 -- ...roupIdColumnOfQProfileEditGroupsTable.java | 36 - ...dexOnGroupIdOfQProfileEditGroupsTable.java | 32 - ...ProfileEditGroupsGroupUuidNotNullable.java | 50 -- .../PopulateQProfileEditGroupsGroupUuid.java | 52 -- .../qprofileeditgroups/package-info.java | 23 - ...AddIndexOnIssueKeyOfIssueChangesTable.java | 60 -- .../AddIndexOnKeeOfIssueChangesTable.java | 60 -- ...aryKeyOnUuidColumnOfIssueChangesTable.java | 38 - .../issuechanges/CopyIssueChangesTable.java | 81 -- .../issuechanges/DropIssueChangesTable.java | 36 - .../RenameIssueChangesCopyToIssueChanges.java | 39 - .../v84/issuechanges/package-info.java | 23 - ...AddPrimaryKeyOnKeeColumnOfIssuesTable.java | 39 - .../version/v84/issues/package-info.java | 23 - ...yKeyOnUuidColumnOfManualMeasuresTable.java | 38 - .../AddUuidColumnToManualMeasures.java | 50 -- .../DropIdColumnOfManualMeasuresTable.java | 37 - ...aryKeyOnIdColumnOfManualMeasuresTable.java | 41 - ...keManualMeasuresUuidColumnNotNullable.java | 50 -- .../PopulateManualMeasureUuid.java | 50 -- .../v84/manualmeasures/package-info.java | 23 - ...dPrimaryKeyOnUuidColumnOfMetricsTable.java | 38 - .../metrics/AddUuidColumnToMetricsTable.java | 31 - .../metrics/DropIdColumnOfMetricsTable.java | 31 - ...ropPrimaryKeyOnIdColumnOfMetricsTable.java | 32 - .../MakeMetricsUuidColumnNotNullable.java | 31 - .../v84/metrics/PopulateMetricsUuid.java | 46 - ...dIndexOnMetricUuidOfLiveMeasuresTable.java | 66 -- ...IndexOnProjectUuidOfLiveMeasuresTable.java | 61 -- .../AddPKeyOnUuidOfLiveMeasuresTable.java | 38 - .../livemeasures/CopyLiveMeasuresTable.java | 69 -- .../livemeasures/DropLiveMeasuresTable.java | 35 - .../RenameLiveMeasuresCopyToLiveMeasures.java | 39 - .../metrics/livemeasures/package-info.java | 23 - .../AddMetricUuidColumnToManualMeasures.java | 50 -- ...opMetricIdColumnOfManualMeasuresTable.java | 36 - ...keManualMeasuresMetricUuidNotNullable.java | 50 -- .../PopulateManualMeasuresMetricUuid.java | 59 -- .../metrics/manualmeasures/package-info.java | 23 - .../version/v84/metrics/package-info.java | 23 - ...AndAnalysisUuidOfProjectMeasuresTable.java | 66 -- ...dexOnMetricUuidOfProjectMeasuresTable.java | 61 -- .../AddMetricUuidColumnToProjectMeasures.java | 50 -- ...teSecurityReviewRatingProjectMeasures.java | 74 -- ...IndexOnMetricIdOfProjectMeasuresTable.java | 32 - ...pMetricIdColumnOfProjectMeasuresTable.java | 36 - ...eProjectMeasuresMetricUuidNotNullable.java | 50 -- .../PopulateProjectMeasuresMetricUuid.java | 58 -- .../metrics/projectmeasures/package-info.java | 23 - ...tricUuidColumnToQualityGateConditions.java | 50 -- ...cIdColumnOfQualityGateConditionsTable.java | 36 - ...tyGateConditionsMetricUuidNotNullable.java | 50 -- ...pulateQualityGateConditionsMetricUuid.java | 59 -- .../qualitygateconditions/package-info.java | 23 - ...aryKeyOnUuidColumnOfNotificationTable.java | 38 - ...UuidAndCreatedAtColumnsToNotification.java | 58 -- .../DropIdColumnOfNotificationTable.java | 31 - ...imaryKeyOnIdColumnOfNotificationTable.java | 32 - ...ionUuidAndCreatedAtColumnsNotNullable.java | 59 -- .../PopulateNotificationUuidAndCreatedAt.java | 60 -- .../v84/notifications/package-info.java | 23 - .../migration/version/v84/package-info.java | 23 - ...nUuidColumnOfPermissionTemplatesTable.java | 38 - .../AddUuidColumnToPermissionTemplates.java | 31 - ...ropIdColumnOfPermissionTemplatesTable.java | 31 - ...opKeeColumnOfPermissionTemplatesTable.java | 37 - ...yOnIdColumnOfPermissionTemplatesTable.java | 32 - ...rmissionTemplateUuidColumnNotNullable.java | 31 - .../PopulatePermissionTemplatesUuid.java | 58 -- .../permissiontemplates/fk/package-info.java | 23 - ...mplateUuidColumnToPermTemplatesGroups.java | 50 -- ...ateIdColumnOfPermTemplatesGroupsTable.java | 37 - ...esGroupsTemplateUuidColumnNotNullable.java | 50 -- ...PermTemplatesGroupsTemplateUuidColumn.java | 59 -- .../fk/permtemplatesgroups/package-info.java | 23 - ...emplateUuidColumnToPermTemplatesUsers.java | 50 -- ...lateIdColumnOfPermTemplatesUsersTable.java | 37 - ...tesUsersTemplateUuidColumnNotNullable.java | 50 -- ...ePermTemplatesUsersTemplateUuidColumn.java | 59 -- .../fk/permtemplatesusers/package-info.java | 23 - ...ateUuidColumnToPermTplCharacteristics.java | 50 -- ...yColumnsOfPermTplCharacteristicsTable.java | 67 -- ...IdColumnOfPermTplCharacteristicsTable.java | 37 - ...yColumnsOfPermTplCharacteristicsTable.java | 32 - ...eristicsTemplateUuidColumnNotNullable.java | 50 -- ...mTplCharacteristicsTemplateUuidColumn.java | 59 -- .../permtplcharacteristics/package-info.java | 23 - .../v84/permissiontemplates/package-info.java | 23 - ...nUuidColumnOfPermTemplatesGroupsTable.java | 38 - ...dUuidColumnToPermTemplatesGroupsTable.java | 31 - ...ropIdColumnOfPermTemplatesGroupsTable.java | 31 - ...yOnIdColumnOfPermTemplatesGroupsTable.java | 32 - ...mTemplatesGroupsUuidColumnNotNullable.java | 31 - .../PopulatePermTemplatesGroupsUuid.java | 50 -- .../v84/permtemplatesgroups/package-info.java | 23 - ...OnUuidColumnOfPermTemplatesUsersTable.java | 38 - ...ddUuidColumnToPermTemplatesUsersTable.java | 31 - ...DropIdColumnOfPermTemplatesUsersTable.java | 31 - ...eyOnIdColumnOfPermTemplatesUsersTable.java | 32 - ...rmTemplatesUsersUuidColumnNotNullable.java | 31 - .../PopulatePermTemplatesUsersUuid.java | 50 -- .../v84/permtemplatesusers/package-info.java | 23 - ...idColumnOfPermTplCharacteristicsTable.java | 38 - ...idColumnToPermTplCharacteristicsTable.java | 31 - ...IdColumnOfPermTplCharacteristicsTable.java | 31 - ...IdColumnOfPermTplCharacteristicsTable.java | 32 - ...lCharacteristicsUuidColumnNotNullable.java | 31 - .../PopulatePermTplCharacteristicsUuid.java | 50 -- .../permtplcharacteristics/package-info.java | 23 - ...KeyOnUuidColumnOfProjectMeasuresTable.java | 38 - ...TechIndexOnUuidOfProjectMeasuresTable.java | 61 -- .../AddUuidColumnToProjectMeasures.java | 31 - .../DropIdColumnOfProjectMeasuresTable.java | 31 - ...ryKeyOnIdColumnOfProjectMeasuresTable.java | 32 - ...TechIndexOnUuidOfProjectMeasuresTable.java | 33 - ...eProjectMeasuresUuidColumnNotNullable.java | 31 - .../PopulateProjectMeasureUuid.java | 50 -- .../v84/projectmeasures/package-info.java | 23 - ...eyOnUuidColumnOfProjectQProfilesTable.java | 38 - .../AddUuidColumnToProjectQProfilesTable.java | 50 -- .../DropIdColumnOfProjectQProfilesTable.java | 41 - ...yKeyOnIdColumnOfProjectQProfilesTable.java | 41 - ...ProjectQProfilesUuidColumnNotNullable.java | 50 -- .../PopulateProjectQProfilesUuid.java | 50 -- .../v84/projectqprofiles/package-info.java | 23 - ...imaryKeyOnUuidColumnOfPropertiesTable.java | 38 - .../properties/AddUuidColumnToProperties.java | 31 - .../DropIdColumnOfPropertiesTable.java | 37 - ...PrimaryKeyOnIdColumnOfPropertiesTable.java | 34 - .../MakePropertiesUuidColumnNotNullable.java | 31 - .../properties/PopulatePropertiesUuid.java | 50 -- .../version/v84/properties/package-info.java | 23 - ...uidColumnOfQualityGateConditionsTable.java | 38 - ...uidColumnToQualityGateConditionsTable.java | 31 - ...pIdColumnOfQualityGateConditionsTable.java | 31 - ...nIdColumnOfQualityGateConditionsTable.java | 32 - ...tyGateConditionsUuidColumnNotNullable.java | 31 - .../PopulateQualityGateConditionsUuid.java | 50 -- .../qualitygateconditions/package-info.java | 23 - ...ddPrimaryKeyOnUuidColumnOfQGatesTable.java | 38 - .../AddQGateUuidColumnForQGateConditions.java | 50 -- .../DropIdColumnOfQGateTable.java | 31 - .../DropOrphansQGateConditions.java | 45 - ...DropPrimaryKeyOnIdColumnOfQGatesTable.java | 34 - .../DropQGateIdColumnForQGateConditions.java | 41 - ...eIndexOnUuidColumnOfQualityGatesTable.java | 32 - ...idColumnNotNullableForQGateConditions.java | 50 -- ...lateQGateUuidColumnForQGateConditions.java | 46 - .../v84/qualitygates/package-info.java | 23 - ...AddPrimaryKeyOnUuidColumnOfRulesTable.java | 38 - .../AddUuidAndTemplateUuidColumnsToRules.java | 58 -- .../v84/rules/DropIdColumnOfRulesTable.java | 37 - .../DropPrimaryKeyOnIdColumnOfRulesTable.java | 41 - .../DropTemplateIdColumnOfRulesTable.java | 37 - .../rules/MakeRulesUuidColumnNotNullable.java | 50 -- .../v84/rules/PopulateRulesTemplateUuid.java | 49 -- .../version/v84/rules/PopulateRulesUuid.java | 46 - .../AddIndexToActiveRulesTable.java | 70 -- .../AddRuleUuidColumnToActiveRulesTable.java | 50 -- ...IndexOnRuleIdColumnOfActiveRulesTable.java | 32 - .../DropRuleIdColumnOfActiveRulesTable.java | 37 - ...eActiveRulesRuleUuidColumnNotNullable.java | 50 -- .../PopulateActiveRulesRuleUuidColumn.java | 52 -- .../v84/rules/activerules/package-info.java | 23 - .../AddIndexToDeprecatedRuleKeysTable.java | 63 -- ...leUuidColumnToDeprecatedRuleKeysTable.java | 50 -- ...RuleIdColumnOfDeprecatedRuleKeysTable.java | 32 - ...RuleIdColumnOfDeprecatedRuleKeysTable.java | 37 - ...atedRuleKeysRuleUuidColumnNotNullable.java | 50 -- ...ulateDeprecatedRuleKeysRuleUuidColumn.java | 52 -- .../deprecatedrulekeys/package-info.java | 23 - .../rules/issues/AddIndexesToIssuesTable.java | 105 --- .../v84/rules/issues/CopyIssuesTable.java | 104 --- .../v84/rules/issues/DropIssuesTable.java | 35 - .../issues/RenameIssuesCopyToIssues.java | 39 - .../v84/rules/issues/package-info.java | 23 - .../version/v84/rules/package-info.java | 23 - ...izationUuidColumnOfRulesMetadataTable.java | 38 - ...AddRuleUuidColumnToRulesMetadataTable.java | 50 -- ...maryKeyOnIdColumnOfRulesMetadataTable.java | 41 - .../DropRuleIdColumnOfRulesMetadataTable.java | 37 - ...ulesMetadataRuleUuidColumnNotNullable.java | 50 -- .../PopulateRulesMetadataRuleUuidColumn.java | 60 -- .../v84/rules/rulesmetadata/package-info.java | 23 - .../AddIndexesToRulesParametersTable.java | 81 -- ...dRuleUuidColumnToRulesParametersTable.java | 50 -- ...sOnRuleIdColumnOfRulesParametersTable.java | 54 -- ...ropRuleIdColumnOfRulesParametersTable.java | 37 - ...esParametersRuleUuidColumnNotNullable.java | 50 -- ...PopulateRulesParametersRuleUuidColumn.java | 66 -- .../rules/rulesparameters/package-info.java | 23 - ...KeyOnUuidColumnOfRulesParametersTable.java | 38 - .../AddUuidColumnToRulesParameters.java | 31 - .../DropIdColumnOfRulesParametersTable.java | 31 - ...ryKeyOnIdColumnOfRulesParametersTable.java | 32 - ...eRulesParametersUuidColumnNotNullable.java | 31 - .../PopulateRulesParametersUuid.java | 50 -- ...meterUuidColumnToActiveRuleParameters.java | 50 -- ...erIdColumnOfActiveRuleParametersTable.java | 37 - ...rsRulesParameterUuidColumnNotNullable.java | 50 -- ...ctiveRuleParametersRulesParameterUuid.java | 59 -- .../v84/rulesparameters/fk/package-info.java | 23 - .../v84/rulesparameters/package-info.java | 23 - ...ryKeyOnUuidColumnOfRulesProfilesTable.java | 38 - .../AddUuidColumnToRulesProfilesTable.java | 31 - .../DropIdColumnOfRulesProfilesTable.java | 33 - .../DropKeeColumnOfRulesProfilesTable.java | 41 - ...maryKeyOnIdColumnOfRulesProfilesTable.java | 32 - ...eIndexOnKeeColumnOfRulesProfilesTable.java | 32 - ...akeRulesProfilesUuidColumnNotNullable.java | 32 - .../PopulateRulesProfilesUuid.java | 50 -- ...ddProfileUuidColumnToActiveRulesTable.java | 50 -- ...OnProfileUuidColumnOfActiveRulesTable.java | 67 -- ...DropProfileIdColumnOfActiveRulesTable.java | 41 - ...exOnProfileIdColumnOfActiveRulesTable.java | 32 - ...tiveRulesProfileUuidColumnNotNullable.java | 50 -- .../PopulateActiveRulesProfileUuid.java | 59 -- .../fk/activerules/package-info.java | 23 - .../PopulateOrgQProfilesRulesProfileUuid.java | 48 -- .../fk/orgqprofiles/package-info.java | 23 - .../v84/rulesprofiles/fk/package-info.java | 23 - ...pulateQProfileChangesRulesProfileUuid.java | 48 -- .../fk/qprofilechanges/package-info.java | 23 - .../v84/rulesprofiles/package-info.java | 23 - ...rimaryKeyOnUuidColumnOfSnapshotsTable.java | 38 - .../issues/DropIdColumnOfSnapshotsTable.java | 31 - ...pPrimaryKeyOnIdColumnOfSnapshotsTable.java | 41 - .../v84/snapshots/issues/package-info.java | 23 - .../version/v84/snapshots/package-info.java | 23 - ...rimaryKeyOnUuidColumnOfUserRolesTable.java | 38 - .../AddUuidColumnToUserRolesTable.java | 31 - .../DropIdColumnOfUserRolesTable.java | 29 - ...pPrimaryKeyOnIdColumnOfUserRolesTable.java | 32 - .../MakeUserRolesUuidColumnNotNullable.java | 31 - .../v84/userroles/PopulateUserRolesUuid.java | 50 -- .../version/v84/userroles/package-info.java | 23 - ...AddPrimaryKeyOnUuidColumnOfUsersTable.java | 38 - .../v84/users/DropIdColumnOfUsersTable.java | 32 - .../DropPrimaryKeyOnIdColumnOfUsersTable.java | 33 - ...opUniqueIndexOnUuidColumnOfUsersTable.java | 33 - .../AddIndexOnUserUuidOfGroupsUsersTable.java | 60 -- ...nUserUuidAndGroupIdOfGroupsUsersTable.java | 64 -- .../AddUserUuidColumnToGroupsUsers.java | 29 - .../DropIndexOnUserIdOfGroupsUsersTable.java | 32 - ...xOnUserIdAndGroupIdOfGroupsUsersTable.java | 33 - .../DropUserIdColumnOfGroupsUsersTable.java | 37 - ...eGroupsUsersUserUuidColumnNotNullable.java | 51 -- .../PopulateGroupsUsersUserUuid.java | 68 -- .../users/fk/groupsusers/package-info.java | 23 - ...xOnUserUuidOfOrganizationMembersTable.java | 60 -- ...ganizationUuidColumnsOfUserRolesTable.java | 38 - ...ddUserUuidColumnToOrganizationMembers.java | 29 - ...dexOnUserIdOfOrganizationMembersTable.java | 32 - ...izationUuidOfOrganizationMembersTable.java | 41 - ...serIdColumnOfOrganizationMembersTable.java | 36 - ...ationMembersUserUuidColumnNotNullable.java | 31 - .../PopulateOrganizationMembersUserUuid.java | 67 -- .../fk/organizationmembers/package-info.java | 23 - .../version/v84/users/fk/package-info.java | 23 - ...AddUserUuidColumnToPermTemplatesUsers.java | 30 - ...UserIdColumnOfPermTemplatesUsersTable.java | 36 - ...mplatesUsersUserUuidColumnNotNullable.java | 31 - .../PopulatePermTemplatesUsersUserUuid.java | 62 -- .../fk/permtemplatesusers/package-info.java | 23 - .../AddUserUuidColumnToPropertiesUsers.java | 30 - .../DropUserIdColumnOfPropertiesTable.java | 36 - .../PopulatePropertiesUserUuid.java | 63 -- .../v84/users/fk/properties/package-info.java | 23 - ...dQProfileUuidOfQProfileEditUsersTable.java | 64 -- .../AddUserUuidColumnToQProfileEditUsers.java | 30 - ...dQProfileUuidOfQProfileEditUsersTable.java | 32 - ...pUserIdColumnOfQProfileEditUsersTable.java | 36 - ...ileEditUsersUserUuidColumnNotNullable.java | 31 - .../PopulateQProfileEditUsersUserUuid.java | 55 -- .../fk/qprofileeditusers/package-info.java | 23 - .../AddIndexOnUserUuidOfUserRolesTable.java | 60 -- .../AddUserUuidColumnToUserRoles.java | 30 - .../DropIndexOnUserIdOfUserRolesTable.java | 32 - .../DropUserIdColumnOfUserRolesTable.java | 36 - .../userroles/PopulateUserRolesUserUuid.java | 52 -- .../v84/users/fk/userroles/package-info.java | 23 - .../fk/util/AddUserUuidColumnToTable.java | 51 -- .../util/MakeUserUuidColumnNotNullable.java | 51 -- .../v84/users/fk/util/package-info.java | 23 - .../version/v84/users/package-info.java | 23 - ...imaryKeyOnUuidColumnOfUserTokensTable.java | 38 - .../usertokens/AddUuidColumnToUserTokens.java | 31 - .../DropIdColumnOfUserTokensTable.java | 31 - ...PrimaryKeyOnIdColumnOfUserTokensTable.java | 32 - .../MakeUserTokensUuidNotNullable.java | 31 - .../usertokens/PopulateUserTokensUuid.java | 50 -- .../version/v84/usertokens/package-info.java | 23 - .../version/v84/util/OrphanData.java | 45 - .../version/v84/util/package-info.java | 23 - ...ddIndexOnIssueKeyForIssueChangesTable.java | 62 -- .../AddIndexOnKeeForIssueChangesTable.java | 62 -- ...MessageTypeColumnOfCeTaskMessageTable.java | 42 - ...IndexOnProjectUuidOnIssueChangesTable.java | 61 -- ...MessageTypeColumnToCeTaskMessageTable.java | 49 -- ...dPrimaryKeyOnUuidForIssueChangesTable.java | 45 - .../version/v85/AddTypeToPlugins.java | 44 - .../v85/AlterTypeInPluginNotNullable.java | 44 - .../v85/CreateTmpIssueChangesTable.java | 61 -- .../v85/CreateUserDismissedMessagesTable.java | 102 --- .../db/migration/version/v85/DbVersion85.java | 61 -- .../v85/DeleteProjectAlmSettingsOrphans.java | 46 - .../version/v85/DropIssueChangesTable.java | 42 - .../DropOrphanFavoritesFromProperties.java | 47 - ...ColumnsFromQualityGateConditionsTable.java | 37 - .../version/v85/DropProjectAlmBindings.java | 40 - .../v85/DropProjectBranchesKeyType.java | 49 -- .../version/v85/DropUnusedIndexes.java | 45 - .../v85/DropUnusedPeriodsInSnapshots.java | 48 -- ...DropUnusedVariationsInProjectMeasures.java | 46 - .../v85/FillProjectBranchesBranchType.java | 46 - ...akeIssueKeyNotNullOnIssueChangesTable.java | 51 -- ...ColumnNotNullableOnCeTaskMessageTable.java | 47 - ...eProjectBranchesBranchTypeNotNullable.java | 43 - ...ProjectUuidNotNullOnIssueChangesTable.java | 51 -- .../MakeUuidNotNullOnIssueChangesTable.java | 51 -- .../v85/PopulateFileSourceLineCount.java | 56 -- ...MessageTypeColumnOfCeTaskMessageTable.java | 43 - .../version/v85/PopulateTypeInPlugins.java | 37 - .../RenameTmpIssueChangesToIssueChanges.java | 46 - .../migration/version/v85/package-info.java | 23 - .../v86/AddIndexToApplicationBranchProjs.java | 68 -- .../v86/AddIndexToApplicationProjects.java | 56 -- .../v86/AddPkToApplicationBranchProjs.java | 38 - .../v86/AddPkToApplicationProjects.java | 38 - .../v86/AddPrimaryKeyToDefaultQProfiles.java | 36 - .../v86/AddResetPasswordColumnToUsers.java | 48 -- ...dUniqueIndexOnNameColumnOfGroupsTable.java | 50 -- .../v86/CreateApplicationBranchProjs.java | 48 -- .../v86/CreateApplicationProjectsTable.java | 45 - .../db/migration/version/v86/DbVersion86.java | 64 -- .../version/v86/DropDefaultQProfilesPk.java | 41 - .../DropOrganizationFromDefaultQProfiles.java | 36 - ...opOrganizationFromQualityProfileTable.java | 37 - .../v86/DropOrganizationInGroupRoles.java | 54 -- .../version/v86/DropOrganizationInGroups.java | 39 - ...DropOrganizationInPermissionTemplates.java | 39 - .../v86/DropOrganizationInRulesMetadata.java | 45 - .../v86/DropOrganizationInUserRoles.java | 39 - .../version/v86/DropOrganizationInUsers.java | 39 - ...ationUuidIndexFromQualityProfileTable.java | 32 - ...akeNameColumnInGroupsTableNotNullable.java | 50 -- .../v86/MakeResetPasswordColumnNotNull.java | 49 -- ...rateApplicationDefinitionsFromXmlToDb.java | 743 ---------------- ...eDefaultTemplatesToInternalProperties.java | 109 --- .../PopulateResetPasswordDefaultValue.java | 51 -- .../v86/SecureGitlabSecretParameters.java | 45 - .../v86/SetForceAuthenticationSettings.java | 65 -- .../UpdateChangeDataOfQProfileChanges.java | 47 - .../migration/version/v86/package-info.java | 23 - ...norepoColumnToProjectAlmSettingsTable.java | 49 -- .../db/migration/version/v87/DbVersion87.java | 51 -- .../version/v87/DropAlmAppInstallsTable.java | 46 - .../v87/DropDescriptionInProjectMeasures.java | 38 - .../version/v87/DropOrgMembersTable.java | 45 - .../version/v87/DropOrgQualityGatesTable.java | 44 - .../v87/DropOrganizationAlmBindingsTable.java | 45 - .../v87/DropOrganizationInComponents.java | 40 - .../v87/DropOrganizationInProjects.java | 38 - .../v87/DropOrganizationInWebhooks.java | 42 - .../version/v87/DropOrganizationsTable.java | 44 - ...nInProjectAlmSettingsTableNotNullable.java | 48 -- ...ltProjectVisibilityToGlobalProperties.java | 58 -- ...eDefaultQualityGateToGlobalProperties.java | 58 -- ...norepoColumnToProjectAlmSettingsTable.java | 43 - .../AddLastSonarlintConnectionToUsers.java | 39 - .../db/migration/version/v88/DbVersion88.java | 33 - ...OnWebhookUuidInWebhookDeliveriesTable.java | 54 -- .../v89/AddIndicesToNewCodePeriodTable.java | 75 -- ...ranchProjectUuidIndexToComponentTable.java | 62 -- .../db/migration/version/v89/DbVersion89.java | 36 - ...opGithubEndpointOnProjectLevelSetting.java | 38 - ...izeOfValueColumnInNewCodePeriodsTable.java | 45 - .../v89/util/NetworkInterfaceProvider.java | 37 - .../MigrationConfigurationModuleTest.java | 2 +- .../v80/CreateNewCodePeriodTableTest.java | 59 -- .../CreateProjectQualityGatesTableTest.java | 52 -- .../version/v80/DbVersion80Test.java | 41 - ...catedRuleKeysRuleIdIndexNonUniqueTest.java | 42 - .../MakeOrganizationsGuardedNullableTest.java | 48 -- .../v80/PopulateNewCodePeriodTableTest.java | 260 ------ .../PopulateProjectQualityGatesTableTest.java | 131 --- ...ultQualityGateFromPropertiesTableTest.java | 70 -- ...ubLoginGenerationStrategyPropertyTest.java | 65 -- .../v80/RemoveLeakPeriodPropertiesTest.java | 69 -- ...ameAnalysisPropertiesSnapshotUuidTest.java | 56 -- .../AddExcludeBranchFromPurgeColumnTest.java | 94 -- .../v81/CreateAlmSettingsTableTest.java | 62 -- .../CreateProjectAlmSettingsTableTest.java | 59 -- .../version/v81/DbVersion81Test.java | 42 - ...eSonarPullRequestProviderPropertyTest.java | 105 --- .../v81/MigrateAzureAlmSettingsTest.java | 375 -------- .../v81/MigrateBitbucketAlmSettingsTest.java | 309 ------- ...grateDefaultBranchesToKeepSettingTest.java | 165 ---- ...eprecatedGithubPrivateKeyToNewKeyTest.java | 107 --- .../v81/MigrateGithubAlmSettingsTest.java | 308 ------- ...eSlbsAndLlbsToCommonTypeInCeTasksTest.java | 91 -- .../MigrateSlbsAndLlbsToCommonTypeTest.java | 111 --- ...ulateExcludeBranchFromPurgeColumnTest.java | 109 --- .../v81/RemoveLLBRegexSettingTest.java | 86 -- ...oveNewsboxDismissHotspotsPropertyTest.java | 93 -- ...sBeforeDeletingInactiveSLBSettingTest.java | 96 --- ...ddIndexOnSlugOfProjectAlmSettingsTest.java | 50 -- .../version/v82/CreateAlmPATsTableTest.java | 59 -- .../version/v82/CreateProjectsTableTest.java | 62 -- .../version/v82/DbVersion82Test.java | 42 - ...itionsUsingSecurityHotspotMetricsTest.java | 119 --- ...eSecurityReviewRatingLiveMeasuresTest.java | 214 ----- ...ropSecurityHotSpotsInReviewStatusTest.java | 116 --- ...DropTagsColumnFromComponentsTableTest.java | 60 -- ...ureHotspotDefaultStatusIsToReviewTest.java | 121 --- ...VulnerabilitiesToSecurityHotSpotsTest.java | 138 --- .../v82/PopulateProjectsTableTest.java | 124 --- ...oveNewsboxDismissHotspotsPropertyTest.java | 93 -- .../RenameProjectsTableToComponentsTest.java | 58 -- ...SummaryEnabledColumnToAlmSettingsTest.java | 68 -- .../version/v83/DbVersion83Test.java | 42 - .../v83/DropIdFromComponentsTableTest.java | 49 -- ...maryCommentEnabledColumnForGitHubTest.java | 140 --- ...ddComponentUuidColumnToGroupRolesTest.java | 48 -- ...DropResourceIdFromGroupRolesTableTest.java | 51 -- ...grateResourceIdToUuidInGroupRolesTest.java | 90 -- ...ddComponentUuidColumnToPropertiesTest.java | 47 - ...DropResourceIdFromPropertiesTableTest.java | 46 - ...grateResourceIdToUuidInPropertiesTest.java | 91 -- ...AddComponentUuidColumnToUserRolesTest.java | 48 -- .../DropResourceIdFromUserRolesTableTest.java | 49 -- ...igrateResourceIdToUuidInUserRolesTest.java | 90 -- .../AddProjectBranchesNeedIssueSyncTest.java | 66 -- .../v84/CreateSamlMessageIdsTableTest.java | 57 -- .../v84/CreateSessionTokensTableTest.java | 58 -- .../version/v84/DbVersion84Test.java | 42 - ...ojectBranchesNeedIssueSyncNonNullTest.java | 43 - ...ulateProjectBranchesNeedIssueSyncTest.java | 75 -- ...moveFilesFavouritesFromPropertiesTest.java | 147 ---- ...ColumnOfActiveRuleParametersTableTest.java | 51 -- ...dUuidColumnToActiveRuleParametersTest.java | 62 -- ...ColumnOfActiveRuleParametersTableTest.java | 51 -- ...ColumnOfActiveRuleParametersTableTest.java | 55 -- ...leParametersUuidColumnNotNullableTest.java | 43 - .../PopulateActiveRuleParametersUuidTest.java | 81 -- ...eUuidColumnToActiveRuleParametersTest.java | 61 -- ...leUuidOfActiveRuleParametersTableTest.java | 50 -- ...KeyOnUuidColumnOfActiveRulesTableTest.java | 50 -- .../AddUuidColumnToActiveRulesTableTest.java | 62 -- ...ColumnOfActiveRuleParametersTableTest.java | 50 -- .../DropIdColumnOfActiveRulesTableTest.java | 51 -- ...RuleIdOfActiveRuleParametersTableTest.java | 54 -- ...ryKeyOnIdColumnOfActiveRulesTableTest.java | 54 -- ...rametersActiveRuleUuidNotNullableTest.java | 42 - ...eActiveRulesUuidColumnNotNullableTest.java | 42 - ...ctiveRuleParametersActiveRuleUuidTest.java | 120 --- .../PopulateActiveRulesUuidTest.java | 81 -- ...AddClientIdAndClientSecretColumnsTest.java | 51 -- ...yKeyOnUuidColumnOfCeActivityTableTest.java | 49 -- .../DropIdColumnOfCeActivityTableTest.java | 49 -- ...aryKeyOnIdColumnOfCeActivityTableTest.java | 55 -- ...maryKeyOnUuidColumnOfCeQueueTableTest.java | 50 -- .../DropIdColumnOfCeQueueTableTest.java | 51 -- ...rimaryKeyOnIdColumnOfCeQueueTableTest.java | 54 -- ...ueIndexOnUuidColumnOfCeQueueTableTest.java | 44 - ...uidColumnOfDuplicationsIndexTableTest.java | 51 -- .../AddUuidToDuplicationsIndexTableTest.java | 70 -- ...pIdColumnOfDuplicationsIndexTableTest.java | 51 -- ...nIdColumnOfDuplicationsIndexTableTest.java | 55 -- ...cationsIndexUuidColumnNotNullableTest.java | 43 - .../PopulateDuplicationsIndexUuidTest.java | 85 -- ...imaryKeyOnUuidColumnOfEventsTableTest.java | 49 -- .../events/DropIdColumnOfEventsTableTest.java | 50 -- ...PrimaryKeyOnIdColumnOfEventsTableTest.java | 53 -- ...KeyOnUuidColumnOfFileSourcesTableTest.java | 50 -- .../AddUuidColumnToFileSourcesTableTest.java | 69 -- .../DropIdColumnOfFileSourcesTableTest.java | 51 -- ...ryKeyOnIdColumnOfFileSourcesTableTest.java | 54 -- ...eFileSourcesUuidColumnNotNullableTest.java | 42 - .../PopulateFileSourcesUuidTest.java | 83 -- ...yKeyOnUuidColumnOfGroupRolesTableTest.java | 49 -- .../AddUuidColumnToGroupRolesTableTest.java | 68 -- .../DropIdColumnOfGroupRolesTableTest.java | 50 -- ...aryKeyOnIdColumnOfGroupRolesTableTest.java | 53 -- ...keGroupRolesUuidColumnNotNullableTest.java | 42 - .../PopulateGroupRolesUuidTest.java | 84 -- ...imaryKeyOnUuidColumnOfGroupsTableTest.java | 50 -- .../AddUuidColumnToGroupsTableTest.java | 61 -- .../groups/DropIdColumnOfGroupsTableTest.java | 51 -- ...PrimaryKeyOnIdColumnOfGroupsTableTest.java | 54 -- .../MakeGroupsUuidColumnNotNullableTest.java | 42 - .../v84/groups/PopulateGroupsUuidTest.java | 80 -- .../AddGroupUuidColumnToGroupRolesTest.java | 64 -- ...IndexOnGroupUuidOfGroupRolesTableTest.java | 54 -- ...ropGroupIdColumnOfGroupRolesTableTest.java | 52 -- ...opIndexOnGroupIdOfGroupRolesTableTest.java | 56 -- .../PopulateGroupRolesGroupUuidTest.java | 124 --- .../AddGroupUuidColumnToGroupsUsersTest.java | 62 -- ...ndexOnGroupUuidOfGroupsUsersTableTest.java | 54 -- ...opGroupIdColumnOfGroupsUsersTableTest.java | 52 -- ...pIndexOnGroupIdOfGroupsUsersTableTest.java | 60 -- ...keGroupsUsersGroupUuidNotNullableTest.java | 44 - .../PopulateGroupsUsersGroupUuidTest.java | 121 --- ...ultGroupUuidColumnToOrganizationsTest.java | 68 -- ...GroupIdColumnOfOrganizationsTableTest.java | 52 -- ...lateOrganizationsDefaultGroupUuidTest.java | 128 --- ...upUuidColumnToPermTemplatesGroupsTest.java | 64 -- ...dColumnOfPermTemplatesGroupsTableTest.java | 52 -- ...ulatePermTemplatesGroupsGroupUuidTest.java | 123 --- ...oupUuidColumnToQProfileEditGroupsTest.java | 63 -- ...roupUuidOfQProfileEditGroupsTableTest.java | 53 -- ...IdColumnOfQProfileEditGroupsTableTest.java | 52 -- ...nGroupIdOfQProfileEditGroupsTableTest.java | 56 -- ...ileEditGroupsGroupUuidNotNullableTest.java | 44 - ...pulateQProfileEditGroupsGroupUuidTest.java | 120 --- ...ndexOnIssueKeyOfIssueChangesTableTest.java | 50 -- .../AddIndexOnKeeOfIssueChangesTableTest.java | 50 -- ...eyOnUuidColumnOfIssueChangesTableTest.java | 50 -- .../CopyIssueChangesTableTest.java | 48 -- .../DropIssueChangesTableTest.java | 51 -- ...ameIssueChangesCopyToIssueChangesTest.java | 42 - ...rimaryKeyOnKeeColumnOfIssuesTableTest.java | 49 -- ...yOnUuidColumnOfManualMeasureTableTest.java | 51 -- .../AddUuidToManualMeasuresTest.java | 66 -- ...DropIdColumnOfManualMeasuresTableTest.java | 51 -- ...eyOnIdColumnOfManualMeasuresTableTest.java | 55 -- ...nualMeasuresUuidColumnNotNullableTest.java | 43 - .../PopulateManualMeasuresUuidTest.java | 81 -- ...maryKeyOnUuidColumnOfMetricsTableTest.java | 50 -- .../AddUuidColumnToMetricsTableTest.java | 60 -- .../DropIdColumnOfMetricsTableTest.java | 51 -- ...rimaryKeyOnIdColumnOfMetricsTableTest.java | 56 -- .../MakeMetricsUuidColumnNotNullableTest.java | 42 - ...exOnMetricUuidOfLiveMeasuresTableTest.java | 50 -- ...xOnProjectUuidOfLiveMeasuresTableTest.java | 50 -- .../CopyLiveMeasuresTableTest.java | 48 -- .../DropLiveMeasuresTableTest.java | 52 -- ...ameLiveMeasuresCopyToLiveMeasuresTest.java | 45 - ...dMetricUuidColumnToManualMeasuresTest.java | 60 -- ...tricIdColumnOfManualMeasuresTableTest.java | 50 -- ...nualMeasuresMetricUuidNotNullableTest.java | 42 - .../PopulateManualMeasuresMetricUuidTest.java | 117 --- ...nalysisUuidOfProjectMeasuresTableTest.java | 50 -- ...nMetricUuidOfProjectMeasuresTableTest.java | 50 -- ...MetricUuidColumnToProjectMeasuresTest.java | 61 -- ...curityReviewRatingProjectMeasuresTest.java | 87 -- ...xOnMetricIdOfProjectMeasuresTableTest.java | 54 -- ...ricIdColumnOfProjectMeasuresTableTest.java | 50 -- ...jectMeasuresMetricUuidNotNullableTest.java | 42 - ...PopulateProjectMeasuresMetricUuidTest.java | 118 --- ...UuidColumnToQualityGateConditionsTest.java | 59 -- ...olumnOfQualityGateConditionsTableTest.java | 50 -- ...teConditionsMetricUuidNotNullableTest.java | 42 - ...teQualityGateConditionsMetricUuidTest.java | 138 --- ...eyOnUuidColumnOfNotificationTableTest.java | 51 -- ...AndCreatedAtColumnsToNotificationTest.java | 83 -- .../DropIdColumnOfNotificationTableTest.java | 51 -- ...yKeyOnIdColumnOfNotificationTableTest.java | 55 -- ...uidAndCreatedAtColumnsNotNullableTest.java | 45 - ...ulateNotificationUuidAndCreatedAtTest.java | 110 --- ...dColumnOfPermissionTemplatesTableTest.java | 51 -- ...ddUuidColumnToPermissionTemplatesTest.java | 67 -- ...dColumnOfPermissionTemplatesTableTest.java | 51 -- ...eColumnOfPermissionTemplatesTableTest.java | 51 -- ...dColumnOfPermissionTemplatesTableTest.java | 55 -- ...sionTemplateUuidColumnNotNullableTest.java | 43 - .../PopulatePermissionTemplatesUuidTest.java | 87 -- ...teUuidColumnToPermTemplatesGroupsTest.java | 66 -- ...dColumnOfPermTemplatesGroupsTableTest.java | 51 -- ...oupsTemplateUuidColumnNotNullableTest.java | 43 - ...TemplatesGroupsTemplateUuidColumnTest.java | 138 --- ...ateUuidColumnToPermTemplatesUsersTest.java | 67 -- ...IdColumnOfPermTemplatesUsersTableTest.java | 51 -- ...sersTemplateUuidColumnNotNullableTest.java | 43 - ...mTemplatesUsersTemplateUuidColumnTest.java | 144 ---- ...uidColumnToPermTplCharacteristicsTest.java | 70 -- ...umnsOfPermTplCharacteristicsTableTest.java | 52 -- ...lumnOfPermTplCharacteristicsTableTest.java | 51 -- ...umnsOfPermTplCharacteristicsTableTest.java | 52 -- ...ticsTemplateUuidColumnNotNullableTest.java | 43 - ...CharacteristicsTemplateUuidColumnTest.java | 146 ---- ...dColumnOfPermTemplatesGroupsTableTest.java | 51 -- ...dColumnToPermTemplatesGroupsTableTest.java | 64 -- ...dColumnOfPermTemplatesGroupsTableTest.java | 51 -- ...dColumnOfPermTemplatesGroupsTableTest.java | 55 -- ...platesGroupsUuidColumnNotNullableTest.java | 42 - .../PopulatePermTemplatesGroupsUuidTest.java | 81 -- ...idColumnOfPermTemplatesUsersTableTest.java | 51 -- ...idColumnToPermTemplatesUsersTableTest.java | 64 -- ...IdColumnOfPermTemplatesUsersTableTest.java | 51 -- ...IdColumnOfPermTemplatesUsersTableTest.java | 55 -- ...mplatesUsersUuidColumnNotNullableTest.java | 42 - .../PopulatePermTemplatesUsersUuidTest.java | 81 -- ...lumnOfPermTplCharacteristicsTableTest.java | 51 -- ...lumnToPermTplCharacteristicsTableTest.java | 66 -- ...lumnOfPermTplCharacteristicsTableTest.java | 51 -- ...lumnOfPermTplCharacteristicsTableTest.java | 55 -- ...racteristicsUuidColumnNotNullableTest.java | 42 - ...opulatePermTplCharacteristicsUuidTest.java | 83 -- ...OnUuidColumnOfProjectMeasureTableTest.java | 51 -- ...IndexOnUuidOfProjectMeasuresTableTest.java | 51 -- .../AddUuidToProjectMeasuresTest.java | 67 -- ...ropIdColumnOfProjectMeasuresTableTest.java | 51 -- ...yOnIdColumnOfProjectMeasuresTableTest.java | 54 -- ...IndexOnUuidOfProjectMeasuresTableTest.java | 52 -- ...jectMeasuresUuidColumnNotNullableTest.java | 43 - .../PopulateProjectMeasuresUuidTest.java | 82 -- ...UuidColumnOfProjectQProfilesTableTest.java | 49 -- ...UuidColumnToProjectQProfilesTableTest.java | 66 -- ...opIdColumnOfProjectQProfilesTableTest.java | 49 -- ...OnIdColumnOfProjectQProfilesTableTest.java | 53 -- ...ectQProfilesUuidColumnNotNullableTest.java | 43 - .../PopulateProjectQProfilesUuidTest.java | 80 -- ...yKeyOnUuidColumnOfPropertiesTableTest.java | 51 -- .../AddUuidColumnToPropertiesTest.java | 64 -- .../DropIdColumnOfPropertiesTableTest.java | 51 -- ...aryKeyOnIdColumnOfPropertiesTableTest.java | 55 -- ...NotificationUuidColumnNotNullableTest.java | 43 - ...opulatePropertiesUuidAndCreatedAtTest.java | 84 -- ...olumnOfQualityGateConditionsTableTest.java | 50 -- ...olumnToQualityGateConditionsTableTest.java | 66 -- ...olumnOfQualityGateConditionsTableTest.java | 51 -- ...olumnOfQualityGateConditionsTableTest.java | 54 -- ...teConditionsUuidColumnNotNullableTest.java | 42 - ...PopulateQualityGateConditionsUuidTest.java | 81 -- ...imaryKeyOnUuidColumnOfQGatesTableTest.java | 50 -- ...QGateUuidColumnForQGateConditionsTest.java | 52 -- .../DropIdColumnOfQGateTableTest.java | 51 -- .../DropOrphansQGateConditionsTest.java | 73 -- ...PrimaryKeyOnIdColumnOfQGatesTableTest.java | 55 -- ...opQGateIdColumnForQGateConditionsTest.java | 50 -- ...exOnUuidColumnOfQualityGatesTableTest.java | 43 - ...lumnNotNullableForQGateConditionsTest.java | 43 - ...QGateUuidColumnForQGateConditionsTest.java | 93 -- ...rimaryKeyOnUuidColumnOfRulesTableTest.java | 50 -- ...UuidAndTemplateUuidColumnsToRulesTest.java | 66 -- .../rules/DropIdColumnOfRulesTableTest.java | 50 -- ...pPrimaryKeyOnIdColumnOfRulesTableTest.java | 58 -- .../DropTemplateIdColumnOfRulesTableTest.java | 50 -- .../MakeRulesUuidColumnNotNullableTest.java | 43 - .../rules/PopulateRulesTemplateUuidTest.java | 74 -- .../AddIndexToActiveRulesTableTest.java | 51 -- ...dRuleUuidColumnToActiveRulesTableTest.java | 79 -- ...xOnRuleIdColumnOfActiveRulesTableTest.java | 54 -- ...ropRuleIdColumnOfActiveRulesTableTest.java | 50 -- ...iveRulesRuleUuidColumnNotNullableTest.java | 43 - ...PopulateActiveRulesRuleUuidColumnTest.java | 86 -- ...AddIndexToDeprecatedRuleKeysTableTest.java | 51 -- ...idColumnToDeprecatedRuleKeysTableTest.java | 80 -- ...IdColumnOfDeprecatedRuleKeysTableTest.java | 54 -- ...IdColumnOfDeprecatedRuleKeysTableTest.java | 50 -- ...RuleKeysRuleUuidColumnNotNullableTest.java | 43 - ...eDeprecatedRuleKeysRuleUuidColumnTest.java | 88 -- .../issues/AddIndexesToIssuesTableTest.java | 51 -- .../v84/rules/issues/CopyIssuesTableTest.java | 48 -- .../v84/rules/issues/DropIssuesTableTest.java | 52 -- .../issues/RenameIssuesCopyToIssuesTest.java | 45 - ...ionUuidColumnOfRulesMetadataTableTest.java | 50 -- ...uleUuidColumnToRulesMetadataTableTest.java | 80 -- ...KeyOnIdColumnOfRulesMetadataTableTest.java | 56 -- ...pRuleIdColumnOfRulesMetadataTableTest.java | 50 -- ...MetadataRuleUuidColumnNotNullableTest.java | 43 - ...pulateRulesMetadataRuleUuidColumnTest.java | 87 -- .../AddIndexesToRulesParametersTableTest.java | 53 -- ...eUuidColumnToRulesParametersTableTest.java | 78 -- ...uleIdColumnOfRulesParametersTableTest.java | 57 -- ...uleIdColumnOfRulesParametersTableTest.java | 50 -- ...rametersRuleUuidColumnNotNullableTest.java | 43 - ...lateRulesParametersRuleUuidColumnTest.java | 99 --- ...nUuidColumnOfRulesParametersTableTest.java | 51 -- .../AddUuidColumnToRulesParametersTest.java | 67 -- ...ropIdColumnOfRulesParametersTableTest.java | 51 -- ...yOnIdColumnOfRulesParametersTableTest.java | 55 -- ...esParametersUuidColumnNotNullableTest.java | 43 - .../PopulateRulesParametersUuidTest.java | 82 -- ...rUuidColumnToActiveRuleParametersTest.java | 66 -- ...ColumnOfActiveRuleParametersTableTest.java | 51 -- ...lesParameterUuidColumnNotNullableTest.java | 43 - ...eRuleParametersRulesParameterUuidTest.java | 142 --- ...yOnUuidColumnOfRulesProfilesTableTest.java | 49 -- ...AddUuidColumnToRulesProfilesTableTest.java | 67 -- .../DropIdColumnOfRulesProfilesTableTest.java | 49 -- ...DropKeeColumnOfRulesProfilesTableTest.java | 49 -- ...KeyOnIdColumnOfRulesProfilesTableTest.java | 53 -- ...exOnKeeColumnOfRulesProfilesTableTest.java | 54 -- ...ulesProfilesUuidColumnNotNullableTest.java | 43 - .../PopulateRulesProfilesUuidTest.java | 81 -- ...ofileUuidColumnToActiveRulesTableTest.java | 63 -- ...ofileUuidColumnOfActiveRulesTableTest.java | 51 -- ...ProfileIdColumnOfActiveRulesTableTest.java | 49 -- ...ProfileIdColumnOfActiveRulesTableTest.java | 51 -- ...RulesProfileUuidColumnNotNullableTest.java | 43 - .../PopulateActiveRulesProfileUuidTest.java | 140 --- ...ulateOrgQProfilesRulesProfileUuidTest.java | 137 --- ...teQProfileChangesRulesProfileUuidTest.java | 136 --- ...ryKeyOnUuidColumnOfSnapshotsTableTest.java | 50 -- .../DropIdColumnOfSnapshotsTableTest.java | 51 -- ...maryKeyOnIdColumnOfSnapshotsTableTest.java | 54 -- ...rimaryKeyOnUuidColumnOfUsersTableTest.java | 49 -- .../users/DropIdColumnOfUsersTableTest.java | 49 -- ...pPrimaryKeyOnIdColumnOfUsersTableTest.java | 53 -- ...iqueIndexOnUuidColumnOfUsersTableTest.java | 50 -- ...IndexOnUserUuidOfGroupsUsersTableTest.java | 49 -- ...rUuidAndGroupIdOfGroupsUsersTableTest.java | 51 -- .../AddUserUuidColumnToGroupsUsersTest.java | 62 -- ...opIndexOnUserIdOfGroupsUsersTableTest.java | 50 -- ...serIdAndGroupIdOfGroupsUsersTableTest.java | 50 -- ...ropUserIdColumnOfGroupsUsersTableTest.java | 50 -- ...upsUsersUserUuidColumnNotNullableTest.java | 43 - .../PopulateGroupsUsersUserUuidTest.java | 143 ---- ...serUuidOfOrganizationMembersTableTest.java | 49 -- ...zationUuidColumnsOfUserRolesTableTest.java | 51 -- ...erUuidColumnToOrganizationMembersTest.java | 61 -- ...nUserIdOfOrganizationMembersTableTest.java | 50 -- ...ionUuidOfOrganizationMembersTableTest.java | 53 -- ...dColumnOfOrganizationMembersTableTest.java | 51 -- ...nMembersUserUuidColumnNotNullableTest.java | 42 - ...pulateOrganizationMembersUserUuidTest.java | 145 ---- ...serUuidColumnToPermTemplatesUsersTest.java | 65 -- ...IdColumnOfPermTemplatesUsersTableTest.java | 51 -- ...tesUsersUserUuidColumnNotNullableTest.java | 42 - ...opulatePermTemplatesUsersUserUuidTest.java | 150 ---- ...ddUserUuidColumnToPropertiesUsersTest.java | 65 -- ...DropUserIdColumnOfPropertiesTableTest.java | 51 -- .../PopulatePropertiesUserUuidTest.java | 182 ---- ...ofileUuidOfQProfileEditUsersTableTest.java | 49 -- ...UserUuidColumnToQProfileEditUsersTest.java | 64 -- ...ofileUuidOfQProfileEditUsersTableTest.java | 50 -- ...rIdColumnOfQProfileEditUsersTableTest.java | 51 -- ...ditUsersUserUuidColumnNotNullableTest.java | 42 - ...PopulateQProfileEditUsersUserUuidTest.java | 150 ---- ...ddIndexOnUserUuidOfUserRolesTableTest.java | 49 -- .../AddUserUuidColumnToUserRolesTest.java | 64 -- ...DropIndexOnUserIdOfUserRolesTableTest.java | 52 -- .../DropUserIdColumnOfUserRolesTableTest.java | 51 -- .../PopulateUserRolesUserUuidTest.java | 145 ---- ...yKeyOnUuidColumnOfUserTokensTableTest.java | 49 -- .../AddUuidColumnToUserTokensTest.java | 63 -- .../DropIdColumnOfUserTokensTableTest.java | 49 -- ...aryKeyOnIdColumnOfUserTokensTableTest.java | 54 -- .../MakeUserTokensUuidNotNullableTest.java | 43 - .../PopulateUserTokensUuidTest.java | 97 --- ...dexOnIssueKeyForIssueChangesTableTest.java | 49 -- ...AddIndexOnKeeForIssueChangesTableTest.java | 49 -- ...ageTypeColumnOfCeTaskMessageTableTest.java | 43 - ...xOnProjectUuidOnIssueChangesTableTest.java | 50 -- ...ageTypeColumnToCeTaskMessageTableTest.java | 63 -- ...maryKeyOnUuidForIssueChangesTableTest.java | 60 -- .../version/v85/AddTypeToPluginsTest.java | 57 -- .../v85/AlterTypeInPluginNotNullableTest.java | 58 -- .../v85/CreateTmpIssueChangesTableTest.java | 69 -- .../CreateUserDismissedMessagesTableTest.java | 55 -- .../version/v85/DbVersion85Test.java | 42 - .../DeleteProjectAlmSettingsOrphansTest.java | 108 --- .../v85/DropIssueChangesTableTest.java | 58 -- ...DropOrphanFavoritesFromPropertiesTest.java | 119 --- ...mnsFromQualityGateConditionsTableTest.java | 50 -- .../v85/DropProjectAlmBindingsTest.java | 53 -- .../v85/DropProjectBranchesKeyTypeTest.java | 66 -- .../version/v85/DropUnusedIndexesTest.java | 50 -- .../v85/DropUnusedPeriodsInSnapshotsTest.java | 102 --- ...UnusedVariationsInProjectMeasuresTest.java | 70 -- .../FillProjectBranchesBranchTypeTest.java | 70 -- ...ssueKeyNotNullOnIssueChangesTableTest.java | 51 -- ...mnNotNullableOnCeTaskMessageTableTest.java | 43 - ...jectBranchesBranchTypeNotNullableTest.java | 65 -- ...ectUuidNotNullOnIssueChangesTableTest.java | 51 -- ...akeUuidNotNullOnIssueChangesTableTest.java | 52 -- .../v85/PopulateFileSourceLineCountTest.java | 159 ---- ...ageTypeColumnOfCeTaskMessageTableTest.java | 73 -- .../v85/PopulateTypeInPluginsTest.java | 62 -- ...nameTmpIssueChangesToIssueChangesTest.java | 58 -- .../AddIndexToApplicationBranchProjsTest.java | 44 - .../AddIndexToApplicationProjectsTest.java | 42 - .../AddPkToApplicationBranchProjsTest.java | 40 - .../v86/AddPkToApplicationProjectsTest.java | 40 - .../AddPrimaryKeyToDefaultQProfilesTest.java | 40 - .../AddResetPasswordColumnToUsersTest.java | 82 -- ...queIndexOnNameColumnOfGroupsTableTest.java | 41 - .../CreateApplicationProjectsTableTest.java | 43 - .../version/v86/DbVersion86Test.java | 43 - .../v86/DropDefaultQProfilesPkTest.java | 43 - ...pOrganizationFromDefaultQProfilesTest.java | 41 - ...ganizationFromQualityProfileTableTest.java | 40 - .../v86/DropOrganizationInGroupRolesTest.java | 42 - .../v86/DropOrganizationInGroupsTest.java | 41 - ...OrganizationInPermissionTemplatesTest.java | 41 - .../DropOrganizationInRulesMetadataTest.java | 43 - .../v86/DropOrganizationInUserRolesTest.java | 41 - .../v86/DropOrganizationInUsersTest.java | 41 - ...nUuidIndexFromQualityProfileTableTest.java | 57 -- ...ameColumnInGroupsTableNotNullableTest.java | 42 - .../MakeResetPasswordColumnNotNullTest.java | 42 - ...ApplicationDefinitionsFromXmlToDbTest.java | 809 ------------------ ...aultTemplatesToInternalPropertiesTest.java | 150 ---- ...PopulateResetPasswordDefaultValueTest.java | 121 --- .../v86/SecureGitlabSecretParametersTest.java | 71 -- .../SetForceAuthenticationSettingsTest.java | 120 --- ...UpdateChangeDataOfQProfileChangesTest.java | 88 -- ...poColumnToProjectAlmSettingsTableTest.java | 62 -- .../version/v87/DbVersion87Test.java | 42 - .../v87/DropAlmAppInstallsTableTest.java | 45 - .../DropDescriptionInProjectMeasuresTest.java | 40 - .../version/v87/DropOrgMembersTableTest.java | 43 - .../v87/DropOrgQualityGatesTableTest.java | 45 - .../DropOrganizationAlmBindingsTableTest.java | 45 - .../v87/DropOrganizationInComponentsTest.java | 40 - .../v87/DropOrganizationInProjectsTest.java | 40 - .../v87/DropOrganizationInWebhooksTest.java | 41 - .../v87/DropOrganizationsTableTest.java | 45 - ...rojectAlmSettingsTableNotNullableTest.java | 64 -- ...ojectVisibilityToGlobalPropertiesTest.java | 97 --- ...aultQualityGateToGlobalPropertiesTest.java | 88 -- ...poColumnToProjectAlmSettingsTableTest.java | 67 -- ...AddLastSonarlintConnectionToUsersTest.java | 43 - .../version/v88/DbVersion88Test.java | 42 - ...bhookUuidInWebhookDeliveriesTableTest.java | 53 -- .../AddIndicesToNewCodePeriodTableTest.java | 54 -- ...hProjectUuidIndexToComponentTableTest.java | 52 -- .../version/v89/DbVersion89Test.java | 42 - ...thubEndpointOnProjectLevelSettingTest.java | 108 --- ...fValueColumnInNewCodePeriodsTableTest.java | 86 -- .../util/NetworkInterfaceProviderTest.java | 37 - .../deprecated_rule_keys.sql | 11 - .../organizations.sql | 21 - .../PopulateNewCodePeriodTableTest/schema.sql | 86 -- .../schema.sql | 77 -- .../schema.sql | 11 - .../schema.sql | 11 - .../RemoveLeakPeriodPropertiesTest/schema.sql | 11 - .../analysis_properties.sql | 12 - .../schema.sql | 12 - .../schema.sql | 11 - .../MigrateAzureAlmSettingsTest/schema.sql | 86 -- .../schema.sql | 86 -- .../schema.sql | 58 -- .../schema.sql | 11 - .../MigrateGithubAlmSettingsTest/schema.sql | 86 -- .../schema.sql | 9 - .../schema.sql | 15 - .../schema.sql | 13 - .../v81/RemoveLLBRegexSettingTest/schema.sql | 11 - .../schema.sql | 11 - .../schema.sql | 11 - .../schema.sql | 12 - .../schema.sql | 34 - .../schema.sql | 82 -- .../schema.sql | 54 -- .../schema.sql | 47 - .../issues.sql | 39 - .../schema.sql | 54 -- .../v82/PopulateProjectsTableTest/schema.sql | 64 -- .../schema.sql | 11 - .../schema.sql | 48 -- .../schema.sql | 13 - .../DropIdFromComponentsTableTest/schema.sql | 44 - .../schema.sql | 28 - .../schema.sql | 10 - .../schema.sql | 12 - .../schema.sql | 58 -- .../schema.sql | 12 - .../schema.sql | 13 - .../schema.sql | 58 -- .../schema.sql | 10 - .../schema.sql | 12 - .../schema.sql | 57 -- .../schema.sql | 15 - .../schema.sql | 16 - .../schema.sql | 16 - .../schema.sql | 55 -- .../schema.sql | 10 - .../schema.sql | 9 - .../schema.sql | 10 - .../schema.sql | 10 - .../schema.sql | 10 - .../schema.sql | 10 - .../schema.sql | 9 - .../schema.sql | 9 - .../schema.sql | 11 - .../schema.sql | 11 - .../schema.sql | 10 - .../schema.sql | 12 - .../schema.sql | 10 - .../schema.sql | 12 - .../schema.sql | 10 - .../schema.sql | 12 - .../schema.sql | 23 - .../PopulateActiveRulesUuidTest/schema.sql | 12 - .../schema.sql | 13 - .../schema.sql | 32 - .../schema.sql | 33 - .../schema.sql | 33 - .../schema.sql | 16 - .../DropIdColumnOfCeQueueTableTest/schema.sql | 17 - .../schema.sql | 17 - .../schema.sql | 18 - .../schema.sql | 12 - .../schema.sql | 13 - .../schema.sql | 13 - .../schema.sql | 13 - .../schema.sql | 13 - .../schema.sql | 13 - .../schema.sql | 15 - .../DropIdColumnOfEventsTableTest/schema.sql | 16 - .../schema.sql | 16 - .../schema.sql | 18 - .../schema.sql | 18 - .../schema.sql | 19 - .../schema.sql | 19 - .../schema.sql | 19 - .../PopulateFileSourcesUuidTest/schema.sql | 19 - .../schema.sql | 11 - .../schema.sql | 10 - .../schema.sql | 11 - .../schema.sql | 11 - .../schema.sql | 11 - .../PopulateGroupRolesUuidTest/schema.sql | 11 - .../schema.sql | 9 - .../AddUuidColumnToGroupsTableTest/schema.sql | 9 - .../DropIdColumnOfGroupsTableTest/schema.sql | 10 - .../schema.sql | 10 - .../schema.sql | 10 - .../groups/PopulateGroupsUuidTest/schema.sql | 10 - .../schema.sql | 10 - .../schema.sql | 10 - .../schema.sql | 11 - .../schema.sql | 11 - .../schema.sql | 22 - .../schema.sql | 7 - .../schema.sql | 6 - .../schema.sql | 8 - .../schema.sql | 8 - .../schema.sql | 8 - .../schema.sql | 19 - .../schema.sql | 20 - .../schema.sql | 21 - .../schema.sql | 32 - .../schema.sql | 9 - .../schema.sql | 10 - .../schema.sql | 21 - .../schema.sql | 9 - .../schema.sql | 9 - .../schema.sql | 10 - .../schema.sql | 10 - .../schema.sql | 10 - .../schema.sql | 21 - .../schema.sql | 11 - .../schema.sql | 11 - .../schema.sql | 13 - .../CopyIssueChangesTableTest/schema.sql | 52 -- .../DropIssueChangesTableTest/schema.sql | 26 - .../schema.sql | 11 - .../schema.sql | 38 - .../schema.sql | 13 - .../AddUuidToManualMeasuresTest/schema.sql | 13 - .../schema.sql | 13 - .../schema.sql | 14 - .../schema.sql | 14 - .../PopulateManualMeasuresUuidTest/schema.sql | 14 - .../schema.sql | 20 - .../schema.sql | 20 - .../DropIdColumnOfMetricsTableTest/schema.sql | 21 - .../schema.sql | 21 - .../schema.sql | 21 - .../PopulateMetricsUuidTest/schema.sql | 21 - .../schema.sql | 13 - .../schema.sql | 13 - .../CopyLiveMeasuresTableTest/schema.sql | 16 - .../DropLiveMeasuresTableTest/schema.sql | 30 - .../schema.sql | 13 - .../schema.sql | 35 - .../schema.sql | 36 - .../schema.sql | 36 - .../schema.sql | 36 - .../schema.sql | 21 - .../schema.sql | 21 - .../schema.sql | 21 - .../schema.sql | 42 - .../schema.sql | 22 - .../schema.sql | 22 - .../schema.sql | 22 - .../schema.sql | 44 - .../schema.sql | 34 - .../schema.sql | 35 - .../schema.sql | 35 - .../schema.sql | 35 - .../schema.sql | 6 - .../schema.sql | 5 - .../schema.sql | 7 - .../schema.sql | 7 - .../schema.sql | 7 - .../schema.sql | 7 - .../schema.sql | 12 - .../schema.sql | 11 - .../schema.sql | 12 - .../schema.sql | 11 - .../schema.sql | 12 - .../schema.sql | 12 - .../schema.sql | 12 - .../schema.sql | 9 - .../schema.sql | 10 - .../schema.sql | 10 - .../schema.sql | 23 - .../schema.sql | 9 - .../schema.sql | 10 - .../schema.sql | 10 - .../schema.sql | 23 - .../schema.sql | 10 - .../schema.sql | 11 - .../schema.sql | 11 - .../schema.sql | 11 - .../schema.sql | 11 - .../schema.sql | 24 - .../schema.sql | 9 - .../schema.sql | 9 - .../schema.sql | 10 - .../schema.sql | 10 - .../schema.sql | 10 - .../schema.sql | 10 - .../schema.sql | 9 - .../schema.sql | 9 - .../schema.sql | 10 - .../schema.sql | 10 - .../schema.sql | 10 - .../schema.sql | 10 - .../schema.sql | 10 - .../schema.sql | 10 - .../schema.sql | 11 - .../schema.sql | 11 - .../schema.sql | 11 - .../schema.sql | 11 - .../schema.sql | 21 - .../schema.sql | 22 - .../AddUuidToProjectMeasuresTest/schema.sql | 21 - .../schema.sql | 22 - .../schema.sql | 22 - .../schema.sql | 23 - .../schema.sql | 22 - .../schema.sql | 22 - .../schema.sql | 7 - .../schema.sql | 7 - .../schema.sql | 8 - .../schema.sql | 8 - .../schema.sql | 8 - .../schema.sql | 8 - .../schema.sql | 12 - .../AddUuidColumnToPropertiesTest/schema.sql | 12 - .../schema.sql | 13 - .../schema.sql | 13 - .../schema.sql | 13 - .../schema.sql | 13 - .../schema.sql | 13 - .../schema.sql | 12 - .../schema.sql | 12 - .../schema.sql | 13 - .../schema.sql | 13 - .../schema.sql | 12 - .../schema.sql | 13 - .../schema.sql | 9 - .../schema.sql | 23 - .../DropIdColumnOfQGateTableTest/schema.sql | 10 - .../DropOrphansQGateConditionsTest/schema.sql | 24 - .../schema.sql | 10 - .../schema.sql | 13 - .../schema.sql | 9 - .../schema.sql | 13 - .../schema.sql | 24 - .../schema.sql | 29 - .../schema.sql | 29 - .../DropIdColumnOfRulesTableTest/schema.sql | 30 - .../schema.sql | 30 - .../schema.sql | 31 - .../schema.sql | 31 - .../PopulateRulesTemplateUuidTest/schema.sql | 31 - .../rules/PopulateRulesUuidTest/schema.sql | 31 - .../AddIndexToActiveRulesTableTest/schema.sql | 42 - .../schema.sql | 42 - .../schema.sql | 43 - .../schema.sql | 43 - .../schema.sql | 43 - .../schema.sql | 43 - .../schema.sql | 41 - .../schema.sql | 41 - .../schema.sql | 42 - .../schema.sql | 42 - .../schema.sql | 42 - .../schema.sql | 42 - .../AddIndexesToIssuesTableTest/schema.sql | 31 - .../issues/CopyIssuesTableTest/schema.sql | 39 - .../issues/DropIssuesTableTest/schema.sql | 70 -- .../RenameIssuesCopyToIssuesTest/schema.sql | 30 - .../schema.sql | 50 -- .../schema.sql | 50 -- .../schema.sql | 51 -- .../schema.sql | 51 -- .../schema.sql | 51 -- .../schema.sql | 51 -- .../schema.sql | 41 - .../schema.sql | 42 - .../schema.sql | 43 - .../schema.sql | 43 - .../schema.sql | 43 - .../schema.sql | 43 - .../schema.sql | 11 - .../schema.sql | 11 - .../schema.sql | 12 - .../schema.sql | 12 - .../schema.sql | 12 - .../schema.sql | 12 - .../schema.sql | 9 - .../schema.sql | 10 - .../schema.sql | 10 - .../schema.sql | 23 - .../schema.sql | 10 - .../schema.sql | 12 - .../schema.sql | 11 - .../schema.sql | 13 - .../schema.sql | 11 - .../schema.sql | 13 - .../schema.sql | 13 - .../PopulateRulesProfilesUuidTest/schema.sql | 13 - .../schema.sql | 11 - .../schema.sql | 11 - .../schema.sql | 12 - .../schema.sql | 12 - .../schema.sql | 26 - .../schema.sql | 26 - .../schema.sql | 28 - .../schema.sql | 24 - .../schema.sql | 30 - .../schema.sql | 31 - .../schema.sql | 31 - .../schema.sql | 10 - .../schema.sql | 10 - .../schema.sql | 11 - .../schema.sql | 11 - .../schema.sql | 11 - .../PopulateUserRolesUuidTest/schema.sql | 11 - .../schema.sql | 29 - .../DropIdColumnOfUsersTableTest/schema.sql | 30 - .../schema.sql | 30 - .../schema.sql | 29 - .../schema.sql | 7 - .../schema.sql | 7 - .../schema.sql | 7 - .../schema.sql | 8 - .../schema.sql | 8 - .../schema.sql | 8 - .../schema.sql | 8 - .../schema.sql | 40 - .../schema.sql | 7 - .../schema.sql | 7 - .../schema.sql | 7 - .../schema.sql | 8 - .../schema.sql | 8 - .../schema.sql | 7 - .../schema.sql | 8 - .../schema.sql | 40 - .../schema.sql | 9 - .../schema.sql | 11 - .../schema.sql | 11 - .../schema.sql | 42 - .../schema.sql | 11 - .../schema.sql | 15 - .../PopulatePropertiesUserUuidTest/schema.sql | 44 - .../schema.sql | 9 - .../schema.sql | 9 - .../schema.sql | 10 - .../schema.sql | 10 - .../schema.sql | 10 - .../schema.sql | 41 - .../schema.sql | 10 - .../schema.sql | 10 - .../schema.sql | 11 - .../schema.sql | 11 - .../PopulateUserRolesUserUuidTest/schema.sql | 42 - .../schema.sql | 11 - .../AddUuidColumnToUserTokensTest/schema.sql | 11 - .../schema.sql | 12 - .../schema.sql | 11 - .../schema.sql | 12 - .../PopulateUserTokensUuidTest/schema.sql | 12 - .../schema.sql | 13 - .../schema.sql | 14 - .../schema.sql | 9 - .../schema.sql | 15 - .../schema.sql | 8 - .../schema.sql | 9 - .../schema.sql | 12 - .../v85/AddTypeToPluginsTest/schema.sql | 10 - .../schema.sql | 11 - .../CreateTmpIssueChangesTableTest/schema.sql | 53 -- .../schema.sql | 30 - .../v85/DropIssueChangesTableTest/schema.sql | 39 - .../schema.sql | 12 - .../schema.sql | 12 - .../v85/DropProjectAlmBindingsTest/schema.sql | 13 - .../DropProjectBranchesKeyTypeTest/schema.sql | 16 - .../v85/DropUnusedIndexesTest/schema.sql | 111 --- .../schema.sql | 30 - .../schema.sql | 21 - .../schema.sql | 16 - .../schema.sql | 9 - .../schema.sql | 12 - .../schema.sql | 9 - .../schema.sql | 16 - .../schema.sql | 12 - .../schema.sql | 12 - .../schema.sql | 18 - .../schema.sql | 9 - .../schema.sql | 9 - .../v85/PopulateTypeInPluginsTest/schema.sql | 11 - .../schema.sql | 12 - .../schema.sql | 9 - .../schema.sql | 7 - .../schema.sql | 8 - .../AddPkToApplicationProjectsTest/schema.sql | 6 - .../schema.sql | 7 - .../schema.sql | 28 - .../schema.sql | 8 - .../v86/DropDefaultQProfilesPkTest/schema.sql | 9 - .../schema.sql | 8 - .../schema.sql | 13 - .../schema.sql | 10 - .../DropOrganizationInGroupsTest/schema.sql | 9 - .../schema.sql | 10 - .../schema.sql | 19 - .../schema.sql | 10 - .../DropOrganizationInUsersTest/schema.sql | 28 - .../schema.sql | 15 - .../schema.sql | 8 - .../schema.sql | 29 - .../schema.sql | 66 -- .../schema.sql | 29 - .../schema.sql | 29 - .../schema.sql | 12 - .../schema.sql | 12 - .../schema.sql | 10 - .../schema.sql | 14 - .../DropAlmAppInstallsTableTest/schema.sql | 14 - .../schema.sql | 17 - .../v87/DropOrgMembersTableTest/schema.sql | 28 - .../DropOrgQualityGatesTableTest/schema.sql | 7 - .../schema.sql | 13 - .../schema.sql | 42 - .../DropOrganizationInProjectsTest/schema.sql | 15 - .../DropOrganizationInWebhooksTest/schema.sql | 34 - .../v87/DropOrganizationsTableTest/schema.sql | 20 - .../schema.sql | 15 - .../schema.sql | 33 - .../schema.sql | 33 - .../schema.sql | 15 - .../schema.sql | 28 - .../schema.sql | 18 - .../schema.sql | 11 - .../schema.sql | 40 - .../schema.sql | 12 - .../schema.sql | 13 - 1417 files changed, 2 insertions(+), 63888 deletions(-) delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v80/CreateNewCodePeriodTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v80/CreateProjectQualityGatesTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v80/DbVersion80.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v80/MakeDeprecatedRuleKeysRuleIdIndexNonUnique.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v80/MakeOrganizationsGuardedNullable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v80/PopulateNewCodePeriodTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v80/PopulateProjectQualityGatesTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v80/RemoveDefaultQualityGateFromPropertiesTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v80/RemoveGitHubLoginGenerationStrategyProperty.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v80/RemoveLeakPeriodProperties.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v80/RenameAnalysisPropertiesSnapshotUuid.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v80/package-info.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v81/AddExcludeBranchFromPurgeColumn.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v81/CreateAlmSettingsTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v81/CreateProjectAlmSettingsTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v81/DbVersion81.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v81/DeleteSonarPullRequestProviderProperty.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v81/MigrateAzureAlmSettings.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v81/MigrateBitbucketAlmSettings.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v81/MigrateDefaultBranchesToKeepSetting.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v81/MigrateDeprecatedGithubPrivateKeyToNewKey.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v81/MigrateGithubAlmSettings.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v81/MigrateSlbsAndLlbsToCommonType.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v81/MigrateSlbsAndLlbsToCommonTypeInCeTasks.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v81/PopulateExcludeBranchFromPurgeColumn.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v81/RemoveLLBRegexSetting.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v81/RemoveNewsboxDismissHotspotsProperty.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v81/RenameDaysBeforeDeletingInactiveSLBSetting.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v81/package-info.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v82/AddIndexOnSlugOfProjectAlmSettings.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v82/CreateAlmPatsTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v82/CreateProjectsTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v82/DbVersion82.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v82/DeleteQgateConditionsUsingSecurityHotspotMetrics.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v82/DeleteSecurityReviewRatingLiveMeasures.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v82/DropSecurityHotSpotsInReviewStatus.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v82/DropTagsColumnFromComponentsTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v82/EnsureHotspotDefaultStatusIsToReview.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v82/MigrateManualVulnerabilitiesToSecurityHotSpots.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v82/PopulateProjectsTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v82/RemoveNewsboxDismissHotspotsProperty.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v82/RenameProjectsTableToComponents.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v82/package-info.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v83/AddSummaryEnabledColumnToAlmSettings.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v83/DbVersion83.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v83/DropIdFromComponentsTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v83/PopulateSummaryCommentEnabledColumnForGitHub.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v83/grouproles/AddComponentUuidColumnToGroupRoles.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v83/grouproles/DropResourceIdFromGroupRolesTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v83/grouproles/MigrateResourceIdToUuidInGroupRoles.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v83/grouproles/package-info.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v83/package-info.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v83/properties/AddComponentUuidColumnToProperties.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v83/properties/DropResourceIdFromPropertiesTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v83/properties/MigrateResourceIdToUuidInProperties.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v83/properties/package-info.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v83/userroles/AddComponentUuidColumnToUserRoles.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v83/userroles/DropResourceIdFromUserRolesTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v83/userroles/MigrateResourceIdToUuidInUserRoles.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v83/userroles/package-info.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/AddProjectBranchesNeedIssueSync.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/CreateSamlMessageIdsTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/CreateSessionTokensTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/DbVersion84.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/MakeProjectBranchesNeedIssueSyncNonNull.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/PopulateProjectBranchesNeedIssueSync.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/RemoveFilesFavouritesFromProperties.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/activeruleparameters/AddPrimaryKeyOnUuidColumnOfActiveRuleParametersTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/activeruleparameters/AddUuidColumnToActiveRuleParametersTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/activeruleparameters/DropIdColumnOfActiveRuleParametersTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/activeruleparameters/DropPrimaryKeyOnIdColumnOfActiveRuleParametersTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/activeruleparameters/MakeActiveRuleParametersUuidColumnNotNullable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/activeruleparameters/PopulateActiveRuleParametersUuid.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/activeruleparameters/package-info.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/activerules/AddActiveRuleUuidColumnToActiveRuleParameters.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/activerules/AddIndexOnActiveRuleUuidOfActiveRuleParametersTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/activerules/AddPrimaryKeyOnUuidColumnOfActiveRulesTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/activerules/AddUuidColumnToActiveRulesTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/activerules/DropActiveRuleIdColumnOfActiveRuleParametersTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/activerules/DropIdColumnOfActiveRulesTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/activerules/DropIndexOnActiveRuleIdOfActiveRuleParametersTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/activerules/DropPrimaryKeyOnIdColumnOfActiveRulesTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/activerules/MakeActiveRuleParametersActiveRuleUuidNotNullable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/activerules/MakeActiveRulesUuidColumnNotNullable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/activerules/PopulateActiveRuleParametersActiveRuleUuid.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/activerules/PopulateActiveRulesUuid.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/activerules/package-info.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/alm/AddClientIdAndClientSecretColumns.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/alm/package-info.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/ceactivity/AddPrimaryKeyOnUuidColumnOfCeActivityTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/ceactivity/DropIdColumnOfCeActivityTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/ceactivity/DropPrimaryKeyOnIdColumnOfCeActivityTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/ceactivity/package-info.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/cequeue/AddPrimaryKeyOnUuidColumnOfCeQueueTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/cequeue/DropIdColumnOfCeQueueTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/cequeue/DropPrimaryKeyOnIdColumnOfCeQueueTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/cequeue/DropUniqueIndexOnUuidColumnOfCeQueueTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/cequeue/package-info.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/common/AddUuidColumnToTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/common/DropIdColumn.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/common/DropPrimaryKeyOnIdColumn.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/common/MakeUuidColumnNotNullable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/common/package-info.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/duplicationsindex/AddPrimaryKeyOnUuidColumnOfDuplicationsIndexTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/duplicationsindex/AddUuidToDuplicationsIndexTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/duplicationsindex/DropIdColumnOfDuplicationsIndexTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/duplicationsindex/DropPrimaryKeyOnIdColumnOfDuplicationsIndexTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/duplicationsindex/MakeDuplicationsIndexUuidColumnNotNullable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/duplicationsindex/PopulateDuplicationsIndexUuid.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/duplicationsindex/package-info.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/events/AddPrimaryKeyOnUuidColumnOfEventsTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/events/DropIdColumnOfEventsTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/events/DropPrimaryKeyOnIdColumnOfEventsTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/events/package-info.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/filesources/AddPrimaryKeyOnUuidColumnOfFileSourcesTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/filesources/AddUuidColumnToFileSourcesTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/filesources/DropIdColumnOfFileSourcesTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/filesources/DropPrimaryKeyOnIdColumnOfFileSourcesTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/filesources/MakeFileSourcesUuidColumnNotNullable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/filesources/PopulateFileSourcesUuid.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/filesources/package-info.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/grouproles/AddPrimaryKeyOnUuidColumnOfGroupRolesTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/grouproles/AddUuidColumnToGroupRolesTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/grouproles/DropIdColumnOfGroupRolesTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/grouproles/DropPrimaryKeyOnIdColumnOfGroupRolesTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/grouproles/MakeGroupRolesUuidColumnNotNullable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/grouproles/PopulateGroupRolesUuid.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/grouproles/package-info.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/AddPrimaryKeyOnUuidColumnOfGroupsTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/AddUuidColumnToGroupsTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/DropIdColumnOfGroupsTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/DropPrimaryKeyOnIdColumnOfGroupsTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/MakeGroupsUuidColumnNotNullable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/PopulateGroupsUuid.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/grouproles/AddGroupUuidColumnToGroupRoles.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/grouproles/AddIndexOnGroupUuidOfGroupRolesTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/grouproles/DropGroupIdColumnOfGroupRolesTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/grouproles/DropIndexOnGroupIdOfGroupRolesTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/grouproles/PopulateGroupRolesGroupUuid.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/grouproles/package-info.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/groupsusers/AddGroupUuidColumnToGroupsUsers.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/groupsusers/AddIndexOnGroupUuidOfGroupsUsersTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/groupsusers/DropGroupIdColumnOfGroupsUsersTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/groupsusers/DropIndexOnGroupIdOfGroupsUsersTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/groupsusers/MakeGroupsUsersGroupUuidNotNullable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/groupsusers/PopulateGroupsUsersGroupUuid.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/groupsusers/package-info.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/organizations/AddDefaultGroupUuidColumnToOrganizations.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/organizations/DropDefaultGroupIdColumnOfOrganizationsTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/organizations/PopulateOrganizationsDefaultGroupUuid.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/organizations/package-info.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/package-info.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/permtemplatesgroups/AddGroupUuidColumnToPermTemplatesGroups.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/permtemplatesgroups/DropGroupIdColumnOfPermTemplatesGroupsTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/permtemplatesgroups/PopulatePermTemplatesGroupsGroupUuid.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/permtemplatesgroups/package-info.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/qprofileeditgroups/AddGroupUuidColumnToQProfileEditGroups.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/qprofileeditgroups/AddIndexOnGroupUuidOfQProfileEditGroupsTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/qprofileeditgroups/DropGroupIdColumnOfQProfileEditGroupsTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/qprofileeditgroups/DropIndexOnGroupIdOfQProfileEditGroupsTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/qprofileeditgroups/MakeQProfileEditGroupsGroupUuidNotNullable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/qprofileeditgroups/PopulateQProfileEditGroupsGroupUuid.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/qprofileeditgroups/package-info.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/issuechanges/AddIndexOnIssueKeyOfIssueChangesTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/issuechanges/AddIndexOnKeeOfIssueChangesTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/issuechanges/AddPrimaryKeyOnUuidColumnOfIssueChangesTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/issuechanges/CopyIssueChangesTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/issuechanges/DropIssueChangesTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/issuechanges/RenameIssueChangesCopyToIssueChanges.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/issuechanges/package-info.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/issues/AddPrimaryKeyOnKeeColumnOfIssuesTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/issues/package-info.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/manualmeasures/AddPrimaryKeyOnUuidColumnOfManualMeasuresTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/manualmeasures/AddUuidColumnToManualMeasures.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/manualmeasures/DropIdColumnOfManualMeasuresTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/manualmeasures/DropPrimaryKeyOnIdColumnOfManualMeasuresTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/manualmeasures/MakeManualMeasuresUuidColumnNotNullable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/manualmeasures/PopulateManualMeasureUuid.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/manualmeasures/package-info.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/AddPrimaryKeyOnUuidColumnOfMetricsTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/AddUuidColumnToMetricsTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/DropIdColumnOfMetricsTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/DropPrimaryKeyOnIdColumnOfMetricsTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/MakeMetricsUuidColumnNotNullable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/PopulateMetricsUuid.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/livemeasures/AddIndexOnMetricUuidOfLiveMeasuresTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/livemeasures/AddIndexOnProjectUuidOfLiveMeasuresTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/livemeasures/AddPKeyOnUuidOfLiveMeasuresTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/livemeasures/CopyLiveMeasuresTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/livemeasures/DropLiveMeasuresTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/livemeasures/RenameLiveMeasuresCopyToLiveMeasures.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/livemeasures/package-info.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/manualmeasures/AddMetricUuidColumnToManualMeasures.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/manualmeasures/DropMetricIdColumnOfManualMeasuresTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/manualmeasures/MakeManualMeasuresMetricUuidNotNullable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/manualmeasures/PopulateManualMeasuresMetricUuid.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/manualmeasures/package-info.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/package-info.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/projectmeasures/AddIndexOnMetricUuidAndAnalysisUuidOfProjectMeasuresTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/projectmeasures/AddIndexOnMetricUuidOfProjectMeasuresTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/projectmeasures/AddMetricUuidColumnToProjectMeasures.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/projectmeasures/DeleteSecurityReviewRatingProjectMeasures.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/projectmeasures/DropIndexOnMetricIdOfProjectMeasuresTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/projectmeasures/DropMetricIdColumnOfProjectMeasuresTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/projectmeasures/MakeProjectMeasuresMetricUuidNotNullable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/projectmeasures/PopulateProjectMeasuresMetricUuid.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/projectmeasures/package-info.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/qualitygateconditions/AddMetricUuidColumnToQualityGateConditions.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/qualitygateconditions/DropMetricIdColumnOfQualityGateConditionsTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/qualitygateconditions/MakeQualityGateConditionsMetricUuidNotNullable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/qualitygateconditions/PopulateQualityGateConditionsMetricUuid.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/qualitygateconditions/package-info.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/notifications/AddPrimaryKeyOnUuidColumnOfNotificationTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/notifications/AddUuidAndCreatedAtColumnsToNotification.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/notifications/DropIdColumnOfNotificationTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/notifications/DropPrimaryKeyOnIdColumnOfNotificationTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/notifications/MakeNotificationUuidAndCreatedAtColumnsNotNullable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/notifications/PopulateNotificationUuidAndCreatedAt.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/notifications/package-info.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/package-info.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/AddPrimaryKeyOnUuidColumnOfPermissionTemplatesTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/AddUuidColumnToPermissionTemplates.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/DropIdColumnOfPermissionTemplatesTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/DropKeeColumnOfPermissionTemplatesTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/DropPrimaryKeyOnIdColumnOfPermissionTemplatesTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/MakePermissionTemplateUuidColumnNotNullable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/PopulatePermissionTemplatesUuid.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/package-info.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtemplatesgroups/AddTemplateUuidColumnToPermTemplatesGroups.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtemplatesgroups/DropTemplateIdColumnOfPermTemplatesGroupsTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtemplatesgroups/MakePermTemplatesGroupsTemplateUuidColumnNotNullable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtemplatesgroups/PopulatePermTemplatesGroupsTemplateUuidColumn.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtemplatesgroups/package-info.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtemplatesusers/AddTemplateUuidColumnToPermTemplatesUsers.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtemplatesusers/DropTemplateIdColumnOfPermTemplatesUsersTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtemplatesusers/MakePermTemplatesUsersTemplateUuidColumnNotNullable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtemplatesusers/PopulatePermTemplatesUsersTemplateUuidColumn.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtemplatesusers/package-info.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtplcharacteristics/AddTemplateUuidColumnToPermTplCharacteristics.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtplcharacteristics/AddUniqueIndexOnTemplateUuidAndPermissionKeyColumnsOfPermTplCharacteristicsTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtplcharacteristics/DropTemplateIdColumnOfPermTplCharacteristicsTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtplcharacteristics/DropUniqueIndexOnTemplateIdAndPermissionKeyColumnsOfPermTplCharacteristicsTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtplcharacteristics/MakePermTplCharacteristicsTemplateUuidColumnNotNullable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtplcharacteristics/PopulatePermTplCharacteristicsTemplateUuidColumn.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtplcharacteristics/package-info.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/package-info.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permtemplatesgroups/AddPrimaryKeyOnUuidColumnOfPermTemplatesGroupsTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permtemplatesgroups/AddUuidColumnToPermTemplatesGroupsTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permtemplatesgroups/DropIdColumnOfPermTemplatesGroupsTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permtemplatesgroups/DropPrimaryKeyOnIdColumnOfPermTemplatesGroupsTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permtemplatesgroups/MakePermTemplatesGroupsUuidColumnNotNullable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permtemplatesgroups/PopulatePermTemplatesGroupsUuid.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permtemplatesgroups/package-info.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permtemplatesusers/AddPrimaryKeyOnUuidColumnOfPermTemplatesUsersTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permtemplatesusers/AddUuidColumnToPermTemplatesUsersTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permtemplatesusers/DropIdColumnOfPermTemplatesUsersTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permtemplatesusers/DropPrimaryKeyOnIdColumnOfPermTemplatesUsersTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permtemplatesusers/MakePermTemplatesUsersUuidColumnNotNullable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permtemplatesusers/PopulatePermTemplatesUsersUuid.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permtemplatesusers/package-info.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permtplcharacteristics/AddPrimaryKeyOnUuidColumnOfPermTplCharacteristicsTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permtplcharacteristics/AddUuidColumnToPermTplCharacteristicsTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permtplcharacteristics/DropIdColumnOfPermTplCharacteristicsTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permtplcharacteristics/DropPrimaryKeyOnIdColumnOfPermTplCharacteristicsTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permtplcharacteristics/MakePermTplCharacteristicsUuidColumnNotNullable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permtplcharacteristics/PopulatePermTplCharacteristicsUuid.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permtplcharacteristics/package-info.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/projectmeasures/AddPrimaryKeyOnUuidColumnOfProjectMeasuresTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/projectmeasures/AddTechIndexOnUuidOfProjectMeasuresTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/projectmeasures/AddUuidColumnToProjectMeasures.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/projectmeasures/DropIdColumnOfProjectMeasuresTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/projectmeasures/DropPrimaryKeyOnIdColumnOfProjectMeasuresTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/projectmeasures/DropTechIndexOnUuidOfProjectMeasuresTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/projectmeasures/MakeProjectMeasuresUuidColumnNotNullable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/projectmeasures/PopulateProjectMeasureUuid.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/projectmeasures/package-info.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/projectqprofiles/AddPrimaryKeyOnUuidColumnOfProjectQProfilesTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/projectqprofiles/AddUuidColumnToProjectQProfilesTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/projectqprofiles/DropIdColumnOfProjectQProfilesTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/projectqprofiles/DropPrimaryKeyOnIdColumnOfProjectQProfilesTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/projectqprofiles/MakeProjectQProfilesUuidColumnNotNullable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/projectqprofiles/PopulateProjectQProfilesUuid.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/projectqprofiles/package-info.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/properties/AddPrimaryKeyOnUuidColumnOfPropertiesTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/properties/AddUuidColumnToProperties.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/properties/DropIdColumnOfPropertiesTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/properties/DropPrimaryKeyOnIdColumnOfPropertiesTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/properties/MakePropertiesUuidColumnNotNullable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/properties/PopulatePropertiesUuid.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/properties/package-info.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/qualitygateconditions/AddPrimaryKeyOnUuidColumnOfQualityGateConditionsTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/qualitygateconditions/AddUuidColumnToQualityGateConditionsTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/qualitygateconditions/DropIdColumnOfQualityGateConditionsTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/qualitygateconditions/DropPrimaryKeyOnIdColumnOfQualityGateConditionsTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/qualitygateconditions/MakeQualityGateConditionsUuidColumnNotNullable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/qualitygateconditions/PopulateQualityGateConditionsUuid.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/qualitygateconditions/package-info.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/qualitygates/AddPrimaryKeyOnUuidColumnOfQGatesTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/qualitygates/AddQGateUuidColumnForQGateConditions.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/qualitygates/DropIdColumnOfQGateTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/qualitygates/DropOrphansQGateConditions.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/qualitygates/DropPrimaryKeyOnIdColumnOfQGatesTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/qualitygates/DropQGateIdColumnForQGateConditions.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/qualitygates/DropUniqueIndexOnUuidColumnOfQualityGatesTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/qualitygates/MakeQGateUuidColumnNotNullableForQGateConditions.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/qualitygates/PopulateQGateUuidColumnForQGateConditions.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/qualitygates/package-info.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/AddPrimaryKeyOnUuidColumnOfRulesTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/AddUuidAndTemplateUuidColumnsToRules.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/DropIdColumnOfRulesTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/DropPrimaryKeyOnIdColumnOfRulesTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/DropTemplateIdColumnOfRulesTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/MakeRulesUuidColumnNotNullable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/PopulateRulesTemplateUuid.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/PopulateRulesUuid.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/activerules/AddIndexToActiveRulesTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/activerules/AddRuleUuidColumnToActiveRulesTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/activerules/DropIndexOnRuleIdColumnOfActiveRulesTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/activerules/DropRuleIdColumnOfActiveRulesTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/activerules/MakeActiveRulesRuleUuidColumnNotNullable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/activerules/PopulateActiveRulesRuleUuidColumn.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/activerules/package-info.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/deprecatedrulekeys/AddIndexToDeprecatedRuleKeysTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/deprecatedrulekeys/AddRuleUuidColumnToDeprecatedRuleKeysTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/deprecatedrulekeys/DropIndexOnRuleIdColumnOfDeprecatedRuleKeysTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/deprecatedrulekeys/DropRuleIdColumnOfDeprecatedRuleKeysTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/deprecatedrulekeys/MakeDeprecatedRuleKeysRuleUuidColumnNotNullable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/deprecatedrulekeys/PopulateDeprecatedRuleKeysRuleUuidColumn.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/deprecatedrulekeys/package-info.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/issues/AddIndexesToIssuesTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/issues/CopyIssuesTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/issues/DropIssuesTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/issues/RenameIssuesCopyToIssues.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/issues/package-info.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/package-info.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/rulesmetadata/AddPrimaryKeyOnUuidAndOrganizationUuidColumnOfRulesMetadataTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/rulesmetadata/AddRuleUuidColumnToRulesMetadataTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/rulesmetadata/DropPrimaryKeyOnIdColumnOfRulesMetadataTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/rulesmetadata/DropRuleIdColumnOfRulesMetadataTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/rulesmetadata/MakeRulesMetadataRuleUuidColumnNotNullable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/rulesmetadata/PopulateRulesMetadataRuleUuidColumn.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/rulesmetadata/package-info.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/rulesparameters/AddIndexesToRulesParametersTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/rulesparameters/AddRuleUuidColumnToRulesParametersTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/rulesparameters/DropIndexesOnRuleIdColumnOfRulesParametersTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/rulesparameters/DropRuleIdColumnOfRulesParametersTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/rulesparameters/MakeRulesParametersRuleUuidColumnNotNullable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/rulesparameters/PopulateRulesParametersRuleUuidColumn.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/rulesparameters/package-info.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesparameters/AddPrimaryKeyOnUuidColumnOfRulesParametersTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesparameters/AddUuidColumnToRulesParameters.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesparameters/DropIdColumnOfRulesParametersTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesparameters/DropPrimaryKeyOnIdColumnOfRulesParametersTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesparameters/MakeRulesParametersUuidColumnNotNullable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesparameters/PopulateRulesParametersUuid.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesparameters/fk/AddRulesParameterUuidColumnToActiveRuleParameters.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesparameters/fk/DropRulesParameterIdColumnOfActiveRuleParametersTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesparameters/fk/MakeActiveRuleParametersRulesParameterUuidColumnNotNullable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesparameters/fk/PopulateActiveRuleParametersRulesParameterUuid.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesparameters/fk/package-info.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesparameters/package-info.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/AddPrimaryKeyOnUuidColumnOfRulesProfilesTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/AddUuidColumnToRulesProfilesTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/DropIdColumnOfRulesProfilesTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/DropKeeColumnOfRulesProfilesTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/DropPrimaryKeyOnIdColumnOfRulesProfilesTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/DropUniqueIndexOnKeeColumnOfRulesProfilesTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/MakeRulesProfilesUuidColumnNotNullable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/PopulateRulesProfilesUuid.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/fk/activerules/AddProfileUuidColumnToActiveRulesTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/fk/activerules/AddUniqueIndexOnProfileUuidColumnOfActiveRulesTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/fk/activerules/DropProfileIdColumnOfActiveRulesTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/fk/activerules/DropUniqueIndexOnProfileIdColumnOfActiveRulesTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/fk/activerules/MakeActiveRulesProfileUuidColumnNotNullable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/fk/activerules/PopulateActiveRulesProfileUuid.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/fk/activerules/package-info.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/fk/orgqprofiles/PopulateOrgQProfilesRulesProfileUuid.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/fk/orgqprofiles/package-info.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/fk/package-info.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/fk/qprofilechanges/PopulateQProfileChangesRulesProfileUuid.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/fk/qprofilechanges/package-info.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/package-info.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/snapshots/issues/AddPrimaryKeyOnUuidColumnOfSnapshotsTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/snapshots/issues/DropIdColumnOfSnapshotsTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/snapshots/issues/DropPrimaryKeyOnIdColumnOfSnapshotsTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/snapshots/issues/package-info.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/snapshots/package-info.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/userroles/AddPrimaryKeyOnUuidColumnOfUserRolesTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/userroles/AddUuidColumnToUserRolesTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/userroles/DropIdColumnOfUserRolesTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/userroles/DropPrimaryKeyOnIdColumnOfUserRolesTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/userroles/MakeUserRolesUuidColumnNotNullable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/userroles/PopulateUserRolesUuid.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/userroles/package-info.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/AddPrimaryKeyOnUuidColumnOfUsersTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/DropIdColumnOfUsersTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/DropPrimaryKeyOnIdColumnOfUsersTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/DropUniqueIndexOnUuidColumnOfUsersTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/groupsusers/AddIndexOnUserUuidOfGroupsUsersTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/groupsusers/AddUniqueIndexOnUserUuidAndGroupIdOfGroupsUsersTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/groupsusers/AddUserUuidColumnToGroupsUsers.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/groupsusers/DropIndexOnUserIdOfGroupsUsersTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/groupsusers/DropUniqueIndexOnUserIdAndGroupIdOfGroupsUsersTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/groupsusers/DropUserIdColumnOfGroupsUsersTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/groupsusers/MakeGroupsUsersUserUuidColumnNotNullable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/groupsusers/PopulateGroupsUsersUserUuid.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/groupsusers/package-info.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/organizationmembers/AddIndexOnUserUuidOfOrganizationMembersTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/organizationmembers/AddPrimaryKeyOnUserUuidAndOrganizationUuidColumnsOfUserRolesTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/organizationmembers/AddUserUuidColumnToOrganizationMembers.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/organizationmembers/DropIndexOnUserIdOfOrganizationMembersTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/organizationmembers/DropPrimaryKeyOnUserIdAndOrganizationUuidOfOrganizationMembersTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/organizationmembers/DropUserIdColumnOfOrganizationMembersTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/organizationmembers/MakeOrganizationMembersUserUuidColumnNotNullable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/organizationmembers/PopulateOrganizationMembersUserUuid.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/organizationmembers/package-info.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/package-info.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/permtemplatesusers/AddUserUuidColumnToPermTemplatesUsers.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/permtemplatesusers/DropUserIdColumnOfPermTemplatesUsersTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/permtemplatesusers/MakePermTemplatesUsersUserUuidColumnNotNullable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/permtemplatesusers/PopulatePermTemplatesUsersUserUuid.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/permtemplatesusers/package-info.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/properties/AddUserUuidColumnToPropertiesUsers.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/properties/DropUserIdColumnOfPropertiesTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/properties/PopulatePropertiesUserUuid.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/properties/package-info.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/qprofileeditusers/AddUniqueIndexOnUserUuidAndQProfileUuidOfQProfileEditUsersTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/qprofileeditusers/AddUserUuidColumnToQProfileEditUsers.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/qprofileeditusers/DropUniqueIndexOnUserIdAndQProfileUuidOfQProfileEditUsersTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/qprofileeditusers/DropUserIdColumnOfQProfileEditUsersTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/qprofileeditusers/MakeQProfileEditUsersUserUuidColumnNotNullable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/qprofileeditusers/PopulateQProfileEditUsersUserUuid.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/qprofileeditusers/package-info.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/userroles/AddIndexOnUserUuidOfUserRolesTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/userroles/AddUserUuidColumnToUserRoles.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/userroles/DropIndexOnUserIdOfUserRolesTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/userroles/DropUserIdColumnOfUserRolesTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/userroles/PopulateUserRolesUserUuid.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/userroles/package-info.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/util/AddUserUuidColumnToTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/util/MakeUserUuidColumnNotNullable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/util/package-info.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/package-info.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/usertokens/AddPrimaryKeyOnUuidColumnOfUserTokensTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/usertokens/AddUuidColumnToUserTokens.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/usertokens/DropIdColumnOfUserTokensTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/usertokens/DropPrimaryKeyOnIdColumnOfUserTokensTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/usertokens/MakeUserTokensUuidNotNullable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/usertokens/PopulateUserTokensUuid.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/usertokens/package-info.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/util/OrphanData.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/util/package-info.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/AddIndexOnIssueKeyForIssueChangesTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/AddIndexOnKeeForIssueChangesTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/AddIndexOnMessageTypeColumnOfCeTaskMessageTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/AddIndexOnProjectUuidOnIssueChangesTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/AddMessageTypeColumnToCeTaskMessageTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/AddPrimaryKeyOnUuidForIssueChangesTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/AddTypeToPlugins.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/AlterTypeInPluginNotNullable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/CreateTmpIssueChangesTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/CreateUserDismissedMessagesTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/DbVersion85.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/DeleteProjectAlmSettingsOrphans.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/DropIssueChangesTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/DropOrphanFavoritesFromProperties.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/DropPeriodAndValueWarningColumnsFromQualityGateConditionsTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/DropProjectAlmBindings.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/DropProjectBranchesKeyType.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/DropUnusedIndexes.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/DropUnusedPeriodsInSnapshots.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/DropUnusedVariationsInProjectMeasures.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/FillProjectBranchesBranchType.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/MakeIssueKeyNotNullOnIssueChangesTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/MakeMessageTypeColumnNotNullableOnCeTaskMessageTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/MakeProjectBranchesBranchTypeNotNullable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/MakeProjectUuidNotNullOnIssueChangesTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/MakeUuidNotNullOnIssueChangesTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/PopulateFileSourceLineCount.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/PopulateMessageTypeColumnOfCeTaskMessageTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/PopulateTypeInPlugins.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/RenameTmpIssueChangesToIssueChanges.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/package-info.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v86/AddIndexToApplicationBranchProjs.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v86/AddIndexToApplicationProjects.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v86/AddPkToApplicationBranchProjs.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v86/AddPkToApplicationProjects.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v86/AddPrimaryKeyToDefaultQProfiles.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v86/AddResetPasswordColumnToUsers.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v86/AddUniqueIndexOnNameColumnOfGroupsTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v86/CreateApplicationBranchProjs.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v86/CreateApplicationProjectsTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v86/DbVersion86.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v86/DropDefaultQProfilesPk.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v86/DropOrganizationFromDefaultQProfiles.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v86/DropOrganizationFromQualityProfileTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v86/DropOrganizationInGroupRoles.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v86/DropOrganizationInGroups.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v86/DropOrganizationInPermissionTemplates.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v86/DropOrganizationInRulesMetadata.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v86/DropOrganizationInUserRoles.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v86/DropOrganizationInUsers.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v86/DropOrganizationUuidIndexFromQualityProfileTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v86/MakeNameColumnInGroupsTableNotNullable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v86/MakeResetPasswordColumnNotNull.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v86/MigrateApplicationDefinitionsFromXmlToDb.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v86/MoveDefaultTemplatesToInternalProperties.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v86/PopulateResetPasswordDefaultValue.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v86/SecureGitlabSecretParameters.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v86/SetForceAuthenticationSettings.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v86/UpdateChangeDataOfQProfileChanges.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v86/package-info.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v87/AddMonorepoColumnToProjectAlmSettingsTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v87/DbVersion87.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v87/DropAlmAppInstallsTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v87/DropDescriptionInProjectMeasures.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v87/DropOrgMembersTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v87/DropOrgQualityGatesTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v87/DropOrganizationAlmBindingsTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v87/DropOrganizationInComponents.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v87/DropOrganizationInProjects.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v87/DropOrganizationInWebhooks.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v87/DropOrganizationsTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v87/MakeMonorepoColumnInProjectAlmSettingsTableNotNullable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v87/MoveDefaultProjectVisibilityToGlobalProperties.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v87/MoveDefaultQualityGateToGlobalProperties.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v87/PopulateMonorepoColumnToProjectAlmSettingsTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v88/AddLastSonarlintConnectionToUsers.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v88/DbVersion88.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v89/AddIndexOnWebhookUuidInWebhookDeliveriesTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v89/AddIndicesToNewCodePeriodTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v89/AddMainBranchProjectUuidIndexToComponentTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v89/DbVersion89.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v89/DropGithubEndpointOnProjectLevelSetting.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v89/IncreaseSizeOfValueColumnInNewCodePeriodsTable.java delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v89/util/NetworkInterfaceProvider.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v80/CreateNewCodePeriodTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v80/CreateProjectQualityGatesTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v80/DbVersion80Test.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v80/MakeDeprecatedRuleKeysRuleIdIndexNonUniqueTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v80/MakeOrganizationsGuardedNullableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v80/PopulateNewCodePeriodTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v80/PopulateProjectQualityGatesTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v80/RemoveDefaultQualityGateFromPropertiesTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v80/RemoveGitHubLoginGenerationStrategyPropertyTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v80/RemoveLeakPeriodPropertiesTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v80/RenameAnalysisPropertiesSnapshotUuidTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v81/AddExcludeBranchFromPurgeColumnTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v81/CreateAlmSettingsTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v81/CreateProjectAlmSettingsTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v81/DbVersion81Test.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v81/DeleteSonarPullRequestProviderPropertyTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v81/MigrateAzureAlmSettingsTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v81/MigrateBitbucketAlmSettingsTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v81/MigrateDefaultBranchesToKeepSettingTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v81/MigrateDeprecatedGithubPrivateKeyToNewKeyTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v81/MigrateGithubAlmSettingsTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v81/MigrateSlbsAndLlbsToCommonTypeInCeTasksTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v81/MigrateSlbsAndLlbsToCommonTypeTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v81/PopulateExcludeBranchFromPurgeColumnTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v81/RemoveLLBRegexSettingTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v81/RemoveNewsboxDismissHotspotsPropertyTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v81/RenameDaysBeforeDeletingInactiveSLBSettingTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v82/AddIndexOnSlugOfProjectAlmSettingsTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v82/CreateAlmPATsTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v82/CreateProjectsTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v82/DbVersion82Test.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v82/DeleteQgateConditionsUsingSecurityHotspotMetricsTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v82/DeleteSecurityReviewRatingLiveMeasuresTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v82/DropSecurityHotSpotsInReviewStatusTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v82/DropTagsColumnFromComponentsTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v82/EnsureHotspotDefaultStatusIsToReviewTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v82/MigrateManualVulnerabilitiesToSecurityHotSpotsTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v82/PopulateProjectsTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v82/RemoveNewsboxDismissHotspotsPropertyTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v82/RenameProjectsTableToComponentsTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v83/AddSummaryEnabledColumnToAlmSettingsTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v83/DbVersion83Test.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v83/DropIdFromComponentsTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v83/PopulateSummaryCommentEnabledColumnForGitHubTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v83/grouproles/AddComponentUuidColumnToGroupRolesTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v83/grouproles/DropResourceIdFromGroupRolesTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v83/grouproles/MigrateResourceIdToUuidInGroupRolesTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v83/properties/AddComponentUuidColumnToPropertiesTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v83/properties/DropResourceIdFromPropertiesTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v83/properties/MigrateResourceIdToUuidInPropertiesTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v83/userroles/AddComponentUuidColumnToUserRolesTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v83/userroles/DropResourceIdFromUserRolesTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v83/userroles/MigrateResourceIdToUuidInUserRolesTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/AddProjectBranchesNeedIssueSyncTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/CreateSamlMessageIdsTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/CreateSessionTokensTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/DbVersion84Test.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/MakeProjectBranchesNeedIssueSyncNonNullTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/PopulateProjectBranchesNeedIssueSyncTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/RemoveFilesFavouritesFromPropertiesTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/activeruleparameters/AddPrimaryKeyOnUuidColumnOfActiveRuleParametersTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/activeruleparameters/AddUuidColumnToActiveRuleParametersTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/activeruleparameters/DropIdColumnOfActiveRuleParametersTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/activeruleparameters/DropPrimaryKeyOnIdColumnOfActiveRuleParametersTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/activeruleparameters/MakeActiveRuleParametersUuidColumnNotNullableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/activeruleparameters/PopulateActiveRuleParametersUuidTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/activerules/AddActiveRuleUuidColumnToActiveRuleParametersTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/activerules/AddIndexOnActiveRuleUuidOfActiveRuleParametersTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/activerules/AddPrimaryKeyOnUuidColumnOfActiveRulesTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/activerules/AddUuidColumnToActiveRulesTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/activerules/DropActiveRuleIdColumnOfActiveRuleParametersTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/activerules/DropIdColumnOfActiveRulesTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/activerules/DropIndexOnActiveRuleIdOfActiveRuleParametersTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/activerules/DropPrimaryKeyOnIdColumnOfActiveRulesTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/activerules/MakeActiveRuleParametersActiveRuleUuidNotNullableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/activerules/MakeActiveRulesUuidColumnNotNullableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/activerules/PopulateActiveRuleParametersActiveRuleUuidTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/activerules/PopulateActiveRulesUuidTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/alm/AddClientIdAndClientSecretColumnsTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/ceactivity/AddPrimaryKeyOnUuidColumnOfCeActivityTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/ceactivity/DropIdColumnOfCeActivityTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/ceactivity/DropPrimaryKeyOnIdColumnOfCeActivityTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/cequeue/AddPrimaryKeyOnUuidColumnOfCeQueueTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/cequeue/DropIdColumnOfCeQueueTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/cequeue/DropPrimaryKeyOnIdColumnOfCeQueueTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/cequeue/DropUniqueIndexOnUuidColumnOfCeQueueTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/duplicationsindex/AddPrimaryKeyOnUuidColumnOfDuplicationsIndexTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/duplicationsindex/AddUuidToDuplicationsIndexTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/duplicationsindex/DropIdColumnOfDuplicationsIndexTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/duplicationsindex/DropPrimaryKeyOnIdColumnOfDuplicationsIndexTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/duplicationsindex/MakeDuplicationsIndexUuidColumnNotNullableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/duplicationsindex/PopulateDuplicationsIndexUuidTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/events/AddPrimaryKeyOnUuidColumnOfEventsTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/events/DropIdColumnOfEventsTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/events/DropPrimaryKeyOnIdColumnOfEventsTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/filesources/AddPrimaryKeyOnUuidColumnOfFileSourcesTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/filesources/AddUuidColumnToFileSourcesTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/filesources/DropIdColumnOfFileSourcesTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/filesources/DropPrimaryKeyOnIdColumnOfFileSourcesTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/filesources/MakeFileSourcesUuidColumnNotNullableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/filesources/PopulateFileSourcesUuidTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/grouproles/AddPrimaryKeyOnUuidColumnOfGroupRolesTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/grouproles/AddUuidColumnToGroupRolesTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/grouproles/DropIdColumnOfGroupRolesTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/grouproles/DropPrimaryKeyOnIdColumnOfGroupRolesTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/grouproles/MakeGroupRolesUuidColumnNotNullableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/grouproles/PopulateGroupRolesUuidTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/groups/AddPrimaryKeyOnUuidColumnOfGroupsTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/groups/AddUuidColumnToGroupsTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/groups/DropIdColumnOfGroupsTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/groups/DropPrimaryKeyOnIdColumnOfGroupsTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/groups/MakeGroupsUuidColumnNotNullableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/groups/PopulateGroupsUuidTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/groups/grouproles/AddGroupUuidColumnToGroupRolesTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/groups/grouproles/AddIndexOnGroupUuidOfGroupRolesTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/groups/grouproles/DropGroupIdColumnOfGroupRolesTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/groups/grouproles/DropIndexOnGroupIdOfGroupRolesTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/groups/grouproles/PopulateGroupRolesGroupUuidTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/groups/groupsusers/AddGroupUuidColumnToGroupsUsersTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/groups/groupsusers/AddIndexOnGroupUuidOfGroupsUsersTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/groups/groupsusers/DropGroupIdColumnOfGroupsUsersTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/groups/groupsusers/DropIndexOnGroupIdOfGroupsUsersTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/groups/groupsusers/MakeGroupsUsersGroupUuidNotNullableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/groups/groupsusers/PopulateGroupsUsersGroupUuidTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/groups/organizations/AddDefaultGroupUuidColumnToOrganizationsTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/groups/organizations/DropDefaultGroupIdColumnOfOrganizationsTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/groups/organizations/PopulateOrganizationsDefaultGroupUuidTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/groups/permtemplatesgroups/AddGroupUuidColumnToPermTemplatesGroupsTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/groups/permtemplatesgroups/DropGroupIdColumnOfPermTemplatesGroupsTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/groups/permtemplatesgroups/PopulatePermTemplatesGroupsGroupUuidTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/groups/qprofileeditgroups/AddGroupUuidColumnToQProfileEditGroupsTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/groups/qprofileeditgroups/AddIndexOnGroupUuidOfQProfileEditGroupsTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/groups/qprofileeditgroups/DropGroupIdColumnOfQProfileEditGroupsTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/groups/qprofileeditgroups/DropIndexOnGroupIdOfQProfileEditGroupsTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/groups/qprofileeditgroups/MakeQProfileEditGroupsGroupUuidNotNullableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/groups/qprofileeditgroups/PopulateQProfileEditGroupsGroupUuidTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/issuechanges/AddIndexOnIssueKeyOfIssueChangesTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/issuechanges/AddIndexOnKeeOfIssueChangesTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/issuechanges/AddPrimaryKeyOnUuidColumnOfIssueChangesTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/issuechanges/CopyIssueChangesTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/issuechanges/DropIssueChangesTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/issuechanges/RenameIssueChangesCopyToIssueChangesTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/issues/AddPrimaryKeyOnKeeColumnOfIssuesTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/manualmeasures/AddPrimaryKeyOnUuidColumnOfManualMeasureTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/manualmeasures/AddUuidToManualMeasuresTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/manualmeasures/DropIdColumnOfManualMeasuresTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/manualmeasures/DropPrimaryKeyOnIdColumnOfManualMeasuresTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/manualmeasures/MakeManualMeasuresUuidColumnNotNullableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/manualmeasures/PopulateManualMeasuresUuidTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/metrics/AddPrimaryKeyOnUuidColumnOfMetricsTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/metrics/AddUuidColumnToMetricsTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/metrics/DropIdColumnOfMetricsTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/metrics/DropPrimaryKeyOnIdColumnOfMetricsTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/metrics/MakeMetricsUuidColumnNotNullableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/metrics/livemeasures/AddIndexOnMetricUuidOfLiveMeasuresTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/metrics/livemeasures/AddIndexOnProjectUuidOfLiveMeasuresTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/metrics/livemeasures/CopyLiveMeasuresTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/metrics/livemeasures/DropLiveMeasuresTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/metrics/livemeasures/RenameLiveMeasuresCopyToLiveMeasuresTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/metrics/manualmeasures/AddMetricUuidColumnToManualMeasuresTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/metrics/manualmeasures/DropMetricIdColumnOfManualMeasuresTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/metrics/manualmeasures/MakeManualMeasuresMetricUuidNotNullableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/metrics/manualmeasures/PopulateManualMeasuresMetricUuidTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/metrics/projectmeasures/AddIndexOnMetricUuidAndAnalysisUuidOfProjectMeasuresTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/metrics/projectmeasures/AddIndexOnMetricUuidOfProjectMeasuresTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/metrics/projectmeasures/AddMetricUuidColumnToProjectMeasuresTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/metrics/projectmeasures/DeleteSecurityReviewRatingProjectMeasuresTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/metrics/projectmeasures/DropIndexOnMetricIdOfProjectMeasuresTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/metrics/projectmeasures/DropMetricIdColumnOfProjectMeasuresTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/metrics/projectmeasures/MakeProjectMeasuresMetricUuidNotNullableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/metrics/projectmeasures/PopulateProjectMeasuresMetricUuidTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/metrics/qualitygateconditions/AddMetricUuidColumnToQualityGateConditionsTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/metrics/qualitygateconditions/DropMetricIdColumnOfQualityGateConditionsTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/metrics/qualitygateconditions/MakeQualityGateConditionsMetricUuidNotNullableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/metrics/qualitygateconditions/PopulateQualityGateConditionsMetricUuidTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/notifications/AddPrimaryKeyOnUuidColumnOfNotificationTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/notifications/AddUuidAndCreatedAtColumnsToNotificationTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/notifications/DropIdColumnOfNotificationTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/notifications/DropPrimaryKeyOnIdColumnOfNotificationTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/notifications/MakeNotificationUuidAndCreatedAtColumnsNotNullableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/notifications/PopulateNotificationUuidAndCreatedAtTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/AddPrimaryKeyOnUuidColumnOfPermissionTemplatesTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/AddUuidColumnToPermissionTemplatesTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/DropIdColumnOfPermissionTemplatesTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/DropKeeColumnOfPermissionTemplatesTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/DropPrimaryKeyOnIdColumnOfPermissionTemplatesTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/MakePermissionTemplateUuidColumnNotNullableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/PopulatePermissionTemplatesUuidTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtemplatesgroups/AddTemplateUuidColumnToPermTemplatesGroupsTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtemplatesgroups/DropTemplateIdColumnOfPermTemplatesGroupsTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtemplatesgroups/MakePermTemplatesGroupsTemplateUuidColumnNotNullableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtemplatesgroups/PopulatePermTemplatesGroupsTemplateUuidColumnTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtemplatesusers/AddTemplateUuidColumnToPermTemplatesUsersTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtemplatesusers/DropTemplateIdColumnOfPermTemplatesUsersTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtemplatesusers/MakePermTemplatesUsersTemplateUuidColumnNotNullableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtemplatesusers/PopulatePermTemplatesUsersTemplateUuidColumnTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtplcharacteristics/AddTemplateUuidColumnToPermTplCharacteristicsTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtplcharacteristics/AddUniqueIndexOnTemplateUuidAndPermissionKeyColumnsOfPermTplCharacteristicsTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtplcharacteristics/DropTemplateIdColumnOfPermTplCharacteristicsTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtplcharacteristics/DropUniqueIndexOnTemplateIdAndPermissionKeyColumnsOfPermTplCharacteristicsTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtplcharacteristics/MakePermTplCharacteristicsTemplateUuidColumnNotNullableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtplcharacteristics/PopulatePermTplCharacteristicsTemplateUuidColumnTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permtemplatesgroups/AddPrimaryKeyOnUuidColumnOfPermTemplatesGroupsTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permtemplatesgroups/AddUuidColumnToPermTemplatesGroupsTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permtemplatesgroups/DropIdColumnOfPermTemplatesGroupsTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permtemplatesgroups/DropPrimaryKeyOnIdColumnOfPermTemplatesGroupsTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permtemplatesgroups/MakePermTemplatesGroupsUuidColumnNotNullableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permtemplatesgroups/PopulatePermTemplatesGroupsUuidTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permtemplatesusers/AddPrimaryKeyOnUuidColumnOfPermTemplatesUsersTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permtemplatesusers/AddUuidColumnToPermTemplatesUsersTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permtemplatesusers/DropIdColumnOfPermTemplatesUsersTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permtemplatesusers/DropPrimaryKeyOnIdColumnOfPermTemplatesUsersTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permtemplatesusers/MakePermTemplatesUsersUuidColumnNotNullableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permtemplatesusers/PopulatePermTemplatesUsersUuidTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permtplcharacteristics/AddPrimaryKeyOnUuidColumnOfPermTplCharacteristicsTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permtplcharacteristics/AddUuidColumnToPermTplCharacteristicsTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permtplcharacteristics/DropIdColumnOfPermTplCharacteristicsTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permtplcharacteristics/DropPrimaryKeyOnIdColumnOfPermTplCharacteristicsTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permtplcharacteristics/MakePermTplCharacteristicsUuidColumnNotNullableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permtplcharacteristics/PopulatePermTplCharacteristicsUuidTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/projectmeasures/AddPrimaryKeyOnUuidColumnOfProjectMeasureTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/projectmeasures/AddTechIndexOnUuidOfProjectMeasuresTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/projectmeasures/AddUuidToProjectMeasuresTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/projectmeasures/DropIdColumnOfProjectMeasuresTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/projectmeasures/DropPrimaryKeyOnIdColumnOfProjectMeasuresTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/projectmeasures/DropTechIndexOnUuidOfProjectMeasuresTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/projectmeasures/MakeProjectMeasuresUuidColumnNotNullableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/projectmeasures/PopulateProjectMeasuresUuidTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/projectqprofiles/AddPrimaryKeyOnUuidColumnOfProjectQProfilesTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/projectqprofiles/AddUuidColumnToProjectQProfilesTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/projectqprofiles/DropIdColumnOfProjectQProfilesTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/projectqprofiles/DropPrimaryKeyOnIdColumnOfProjectQProfilesTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/projectqprofiles/MakeProjectQProfilesUuidColumnNotNullableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/projectqprofiles/PopulateProjectQProfilesUuidTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/properties/AddPrimaryKeyOnUuidColumnOfPropertiesTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/properties/AddUuidColumnToPropertiesTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/properties/DropIdColumnOfPropertiesTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/properties/DropPrimaryKeyOnIdColumnOfPropertiesTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/properties/MakeNotificationUuidColumnNotNullableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/properties/PopulatePropertiesUuidAndCreatedAtTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/qualitygateconditions/AddPrimaryKeyOnUuidColumnOfQualityGateConditionsTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/qualitygateconditions/AddUuidColumnToQualityGateConditionsTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/qualitygateconditions/DropIdColumnOfQualityGateConditionsTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/qualitygateconditions/DropPrimaryKeyOnIdColumnOfQualityGateConditionsTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/qualitygateconditions/MakeQualityGateConditionsUuidColumnNotNullableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/qualitygateconditions/PopulateQualityGateConditionsUuidTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/qualitygates/AddPrimaryKeyOnUuidColumnOfQGatesTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/qualitygates/AddQGateUuidColumnForQGateConditionsTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/qualitygates/DropIdColumnOfQGateTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/qualitygates/DropOrphansQGateConditionsTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/qualitygates/DropPrimaryKeyOnIdColumnOfQGatesTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/qualitygates/DropQGateIdColumnForQGateConditionsTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/qualitygates/DropUniqueIndexOnUuidColumnOfQualityGatesTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/qualitygates/MakeQGateUuidColumnNotNullableForQGateConditionsTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/qualitygates/PopulateQGateUuidColumnForQGateConditionsTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/AddPrimaryKeyOnUuidColumnOfRulesTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/AddUuidAndTemplateUuidColumnsToRulesTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/DropIdColumnOfRulesTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/DropPrimaryKeyOnIdColumnOfRulesTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/DropTemplateIdColumnOfRulesTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/MakeRulesUuidColumnNotNullableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/PopulateRulesTemplateUuidTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/activerules/AddIndexToActiveRulesTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/activerules/AddRuleUuidColumnToActiveRulesTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/activerules/DropIndexOnRuleIdColumnOfActiveRulesTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/activerules/DropRuleIdColumnOfActiveRulesTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/activerules/MakeActiveRulesRuleUuidColumnNotNullableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/activerules/PopulateActiveRulesRuleUuidColumnTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/deprecatedrulekeys/AddIndexToDeprecatedRuleKeysTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/deprecatedrulekeys/AddRuleUuidColumnToDeprecatedRuleKeysTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/deprecatedrulekeys/DropIndexOnRuleIdColumnOfDeprecatedRuleKeysTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/deprecatedrulekeys/DropRuleIdColumnOfDeprecatedRuleKeysTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/deprecatedrulekeys/MakeDeprecatedRuleKeysRuleUuidColumnNotNullableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/deprecatedrulekeys/PopulateDeprecatedRuleKeysRuleUuidColumnTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/issues/AddIndexesToIssuesTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/issues/CopyIssuesTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/issues/DropIssuesTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/issues/RenameIssuesCopyToIssuesTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/rulesmetadata/AddPrimaryKeyOnUuidAndOrganizationUuidColumnOfRulesMetadataTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/rulesmetadata/AddRuleUuidColumnToRulesMetadataTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/rulesmetadata/DropPrimaryKeyOnIdColumnOfRulesMetadataTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/rulesmetadata/DropRuleIdColumnOfRulesMetadataTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/rulesmetadata/MakeRulesMetadataRuleUuidColumnNotNullableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/rulesmetadata/PopulateRulesMetadataRuleUuidColumnTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/rulesparameters/AddIndexesToRulesParametersTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/rulesparameters/AddRuleUuidColumnToRulesParametersTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/rulesparameters/DropIndexesOnRuleIdColumnOfRulesParametersTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/rulesparameters/DropRuleIdColumnOfRulesParametersTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/rulesparameters/MakeRulesParametersRuleUuidColumnNotNullableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/rulesparameters/PopulateRulesParametersRuleUuidColumnTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rulesparameters/AddPrimaryKeyOnUuidColumnOfRulesParametersTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rulesparameters/AddUuidColumnToRulesParametersTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rulesparameters/DropIdColumnOfRulesParametersTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rulesparameters/DropPrimaryKeyOnIdColumnOfRulesParametersTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rulesparameters/MakeRulesParametersUuidColumnNotNullableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rulesparameters/PopulateRulesParametersUuidTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rulesparameters/fk/AddRulesParameterUuidColumnToActiveRuleParametersTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rulesparameters/fk/DropRulesParameterIdColumnOfActiveRuleParametersTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rulesparameters/fk/MakeActiveRuleParametersRulesParameterUuidColumnNotNullableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rulesparameters/fk/PopulateActiveRuleParametersRulesParameterUuidTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/AddPrimaryKeyOnUuidColumnOfRulesProfilesTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/AddUuidColumnToRulesProfilesTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/DropIdColumnOfRulesProfilesTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/DropKeeColumnOfRulesProfilesTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/DropPrimaryKeyOnIdColumnOfRulesProfilesTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/DropUniqueIndexOnKeeColumnOfRulesProfilesTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/MakeRulesProfilesUuidColumnNotNullableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/PopulateRulesProfilesUuidTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/fk/activerules/AddProfileUuidColumnToActiveRulesTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/fk/activerules/AddUniqueIndexOnProfileUuidColumnOfActiveRulesTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/fk/activerules/DropProfileIdColumnOfActiveRulesTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/fk/activerules/DropUniqueIndexOnProfileIdColumnOfActiveRulesTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/fk/activerules/MakeActiveRulesProfileUuidColumnNotNullableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/fk/activerules/PopulateActiveRulesProfileUuidTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/fk/orgqprofiles/PopulateOrgQProfilesRulesProfileUuidTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/fk/qprofilechanges/PopulateQProfileChangesRulesProfileUuidTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/snapshots/AddPrimaryKeyOnUuidColumnOfSnapshotsTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/snapshots/DropIdColumnOfSnapshotsTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/snapshots/DropPrimaryKeyOnIdColumnOfSnapshotsTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/AddPrimaryKeyOnUuidColumnOfUsersTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/DropIdColumnOfUsersTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/DropPrimaryKeyOnIdColumnOfUsersTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/DropUniqueIndexOnUuidColumnOfUsersTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/groupsusers/AddIndexOnUserUuidOfGroupsUsersTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/groupsusers/AddUniqueIndexOnUserUuidAndGroupIdOfGroupsUsersTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/groupsusers/AddUserUuidColumnToGroupsUsersTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/groupsusers/DropIndexOnUserIdOfGroupsUsersTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/groupsusers/DropUniqueIndexOnUserIdAndGroupIdOfGroupsUsersTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/groupsusers/DropUserIdColumnOfGroupsUsersTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/groupsusers/MakeGroupsUsersUserUuidColumnNotNullableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/groupsusers/PopulateGroupsUsersUserUuidTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/organizationmembers/AddIndexOnUserUuidOfOrganizationMembersTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/organizationmembers/AddPrimaryKeyOnUserUuidAndOrganizationUuidColumnsOfUserRolesTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/organizationmembers/AddUserUuidColumnToOrganizationMembersTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/organizationmembers/DropIndexOnUserIdOfOrganizationMembersTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/organizationmembers/DropPrimaryKeyOnUserIdAndOrganizationUuidOfOrganizationMembersTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/organizationmembers/DropUserIdColumnOfOrganizationMembersTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/organizationmembers/MakeOrganizationMembersUserUuidColumnNotNullableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/organizationmembers/PopulateOrganizationMembersUserUuidTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/permtemplatesusers/AddUserUuidColumnToPermTemplatesUsersTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/permtemplatesusers/DropUserIdColumnOfPermTemplatesUsersTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/permtemplatesusers/MakePermTemplatesUsersUserUuidColumnNotNullableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/permtemplatesusers/PopulatePermTemplatesUsersUserUuidTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/properties/AddUserUuidColumnToPropertiesUsersTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/properties/DropUserIdColumnOfPropertiesTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/properties/PopulatePropertiesUserUuidTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/qprofileeditusers/AddUniqueIndexOnUserUuidAndQProfileUuidOfQProfileEditUsersTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/qprofileeditusers/AddUserUuidColumnToQProfileEditUsersTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/qprofileeditusers/DropUniqueIndexOnUserIdAndQProfileUuidOfQProfileEditUsersTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/qprofileeditusers/DropUserIdColumnOfQProfileEditUsersTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/qprofileeditusers/MakeQProfileEditUsersUserUuidColumnNotNullableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/qprofileeditusers/PopulateQProfileEditUsersUserUuidTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/userroles/AddIndexOnUserUuidOfUserRolesTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/userroles/AddUserUuidColumnToUserRolesTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/userroles/DropIndexOnUserIdOfUserRolesTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/userroles/DropUserIdColumnOfUserRolesTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/userroles/PopulateUserRolesUserUuidTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/usertokens/AddPrimaryKeyOnUuidColumnOfUserTokensTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/usertokens/AddUuidColumnToUserTokensTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/usertokens/DropIdColumnOfUserTokensTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/usertokens/DropPrimaryKeyOnIdColumnOfUserTokensTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/usertokens/MakeUserTokensUuidNotNullableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/usertokens/PopulateUserTokensUuidTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v85/AddIndexOnIssueKeyForIssueChangesTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v85/AddIndexOnKeeForIssueChangesTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v85/AddIndexOnMessageTypeColumnOfCeTaskMessageTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v85/AddIndexOnProjectUuidOnIssueChangesTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v85/AddMessageTypeColumnToCeTaskMessageTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v85/AddPrimaryKeyOnUuidForIssueChangesTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v85/AddTypeToPluginsTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v85/AlterTypeInPluginNotNullableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v85/CreateTmpIssueChangesTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v85/CreateUserDismissedMessagesTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v85/DbVersion85Test.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v85/DeleteProjectAlmSettingsOrphansTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v85/DropIssueChangesTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v85/DropOrphanFavoritesFromPropertiesTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v85/DropPeriodAndValueWarningColumnsFromQualityGateConditionsTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v85/DropProjectAlmBindingsTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v85/DropProjectBranchesKeyTypeTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v85/DropUnusedIndexesTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v85/DropUnusedPeriodsInSnapshotsTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v85/DropUnusedVariationsInProjectMeasuresTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v85/FillProjectBranchesBranchTypeTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v85/MakeIssueKeyNotNullOnIssueChangesTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v85/MakeMessageTypeColumnNotNullableOnCeTaskMessageTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v85/MakeProjectBranchesBranchTypeNotNullableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v85/MakeProjectUuidNotNullOnIssueChangesTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v85/MakeUuidNotNullOnIssueChangesTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v85/PopulateFileSourceLineCountTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v85/PopulateMessageTypeColumnOfCeTaskMessageTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v85/PopulateTypeInPluginsTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v85/RenameTmpIssueChangesToIssueChangesTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v86/AddIndexToApplicationBranchProjsTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v86/AddIndexToApplicationProjectsTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v86/AddPkToApplicationBranchProjsTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v86/AddPkToApplicationProjectsTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v86/AddPrimaryKeyToDefaultQProfilesTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v86/AddResetPasswordColumnToUsersTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v86/AddUniqueIndexOnNameColumnOfGroupsTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v86/CreateApplicationProjectsTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v86/DbVersion86Test.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v86/DropDefaultQProfilesPkTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v86/DropOrganizationFromDefaultQProfilesTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v86/DropOrganizationFromQualityProfileTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v86/DropOrganizationInGroupRolesTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v86/DropOrganizationInGroupsTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v86/DropOrganizationInPermissionTemplatesTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v86/DropOrganizationInRulesMetadataTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v86/DropOrganizationInUserRolesTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v86/DropOrganizationInUsersTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v86/DropOrganizationUuidIndexFromQualityProfileTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v86/MakeNameColumnInGroupsTableNotNullableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v86/MakeResetPasswordColumnNotNullTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v86/MigrateApplicationDefinitionsFromXmlToDbTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v86/MoveDefaultTemplatesToInternalPropertiesTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v86/PopulateResetPasswordDefaultValueTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v86/SecureGitlabSecretParametersTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v86/SetForceAuthenticationSettingsTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v86/UpdateChangeDataOfQProfileChangesTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v87/AddMonorepoColumnToProjectAlmSettingsTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v87/DbVersion87Test.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v87/DropAlmAppInstallsTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v87/DropDescriptionInProjectMeasuresTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v87/DropOrgMembersTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v87/DropOrgQualityGatesTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v87/DropOrganizationAlmBindingsTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v87/DropOrganizationInComponentsTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v87/DropOrganizationInProjectsTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v87/DropOrganizationInWebhooksTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v87/DropOrganizationsTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v87/MakeMonorepoColumnInProjectAlmSettingsTableNotNullableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v87/MoveDefaultProjectVisibilityToGlobalPropertiesTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v87/MoveDefaultQualityGateToGlobalPropertiesTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v87/PopulateMonorepoColumnToProjectAlmSettingsTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v88/AddLastSonarlintConnectionToUsersTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v88/DbVersion88Test.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v89/AddIndexOnWebhookUuidInWebhookDeliveriesTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v89/AddIndicesToNewCodePeriodTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v89/AddMainBranchProjectUuidIndexToComponentTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v89/DbVersion89Test.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v89/DropGithubEndpointOnProjectLevelSettingTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v89/IncreaseSizeOfValueColumnInNewCodePeriodsTableTest.java delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v89/util/NetworkInterfaceProviderTest.java delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v80/MakeDeprecatedRuleKeysRuleIdIndexNonUniqueTest/deprecated_rule_keys.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v80/MakeOrganizationsGuardedNullable/organizations.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v80/PopulateNewCodePeriodTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v80/PopulateProjectQualityGatesTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v80/RemoveDefaultQualityGateFromPropertiesTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v80/RemoveGitHubLoginGenerationStrategyPropertyTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v80/RemoveLeakPeriodPropertiesTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v80/RenameAnalysisPropertiesSnapshotUuidTest/analysis_properties.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v81/AddExcludeBranchFromPurgeColumnTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v81/DeleteSonarPullRequestProviderPropertyTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v81/MigrateAzureAlmSettingsTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v81/MigrateBitbucketAlmSettingsTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v81/MigrateDefaultBranchesToKeepSettingTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v81/MigrateDeprecatedGithubPrivateKeyToNewKeyTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v81/MigrateGithubAlmSettingsTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v81/MigrateSlbsAndLlbsToCommonTypeInCeTasksTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v81/MigrateSlbsAndLlbsToCommonTypeTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v81/PopulateExcludeBranchFromPurgeColumnTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v81/RemoveLLBRegexSettingTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v81/RemoveNewsboxDismissHotspotsPropertyTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v81/RenameDaysBeforeDeletingInactiveSLBSettingTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v82/AddIndexOnSlugOfProjectAlmSettingsTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v82/DeleteQgateConditionsUsingSecurityHotspotMetricsTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v82/DeleteSecurityReviewRatingLiveMeasuresTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v82/DropSecurityHotSpotsInReviewStatusTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v82/DropTagsColumnFromComponentsTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v82/EnsureHotspotDefaultStatusIsToReviewTest/issues.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v82/MigrateManualVulnerabilitiesToSecurityHotSpotsTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v82/PopulateProjectsTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v82/RemoveNewsboxDismissHotspotsPropertyTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v82/RenameProjectsTableToComponentsTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v83/AddSummaryEnabledColumnToAlmSettingsTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v83/DropIdFromComponentsTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v83/PopulateSummaryCommentEnabledColumnForGitHubTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v83/grouproles/AddComponentUuidColumnToGroupRolesTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v83/grouproles/DropResourceIdFromGroupRolesTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v83/grouproles/MigrateResourceIdToUuidInGroupRolesTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v83/properties/AddComponentUuidColumnToPropertiesTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v83/properties/DropResourceIdFromPropertiesTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v83/properties/MigrateResourceIdToUuidInPropertiesTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v83/userroles/AddComponentUuidColumnToUserRolesTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v83/userroles/DropResourceIdFromUserRolesTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v83/userroles/MigrateResourceIdToUuidInUserRolesTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/AddProjectBranchesNeedIssueSyncTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/MakeProjectBranchesNeedIssueSyncNonNullTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/PopulateProjectBranchesNeedIssueSyncTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/RemoveFilesFavouritesFromPropertiesTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/activeruleparameters/AddPrimaryKeyOnUuidColumnOfActiveRuleParametersTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/activeruleparameters/AddUuidColumnToActiveRuleParametersTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/activeruleparameters/DropIdColumnOfActiveRuleParametersTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/activeruleparameters/DropPrimaryKeyOnIdColumnOfActiveRuleParametersTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/activeruleparameters/MakeActiveRuleParametersUuidColumnNotNullableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/activeruleparameters/PopulateActiveRuleParametersUuidTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/activerules/AddActiveRuleUuidColumnToActiveRuleParametersTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/activerules/AddIndexOnActiveRuleUuidOfActiveRuleParametersTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/activerules/AddPrimaryKeyOnUuidColumnOfActiveRulesTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/activerules/AddUuidColumnToActiveRulesTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/activerules/DropActiveRuleIdColumnOfActiveRuleParametersTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/activerules/DropIdColumnOfActiveRulesTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/activerules/DropIndexOnActiveRuleIdOfActiveRuleParametersTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/activerules/DropPrimaryKeyOnIdColumnOfActiveRulesTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/activerules/MakeActiveRuleParametersActiveRuleUuidNotNullableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/activerules/MakeActiveRulesUuidColumnNotNullableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/activerules/PopulateActiveRuleParametersActiveRuleUuidTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/activerules/PopulateActiveRulesUuidTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/alm/AddClientIdAndClientSecretColumnsTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/ceactivity/AddPrimaryKeyOnUuidColumnOfCeActivityTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/ceactivity/DropIdColumnOfCeActivityTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/ceactivity/DropPrimaryKeyOnIdColumnOfCeActivityTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/cequeue/AddPrimaryKeyOnUuidColumnOfCeQueueTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/cequeue/DropIdColumnOfCeQueueTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/cequeue/DropPrimaryKeyOnIdColumnOfCeQueueTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/cequeue/DropUniqueIndexOnUuidColumnOfCeQueueTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/duplicationsindex/AddPrimaryKeyOnUuidColumnOfDuplicationsIndexTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/duplicationsindex/AddUuidToDuplicationsIndexTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/duplicationsindex/DropIdColumnOfDuplicationsIndexTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/duplicationsindex/DropPrimaryKeyOnIdColumnOfDuplicationsIndexTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/duplicationsindex/MakeDuplicationsIndexUuidColumnNotNullableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/duplicationsindex/PopulateDuplicationsIndexUuidTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/events/AddPrimaryKeyOnUuidColumnOfEventsTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/events/DropIdColumnOfEventsTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/events/DropPrimaryKeyOnIdColumnOfEventsTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/filesources/AddPrimaryKeyOnUuidColumnOfFileSourcesTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/filesources/AddUuidColumnToFileSourcesTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/filesources/DropIdColumnOfFileSourcesTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/filesources/DropPrimaryKeyOnIdColumnOfFileSourcesTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/filesources/MakeFileSourcesUuidColumnNotNullableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/filesources/PopulateFileSourcesUuidTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/grouproles/AddPrimaryKeyOnUuidColumnOfGroupRolesTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/grouproles/AddUuidColumnToGroupRolesTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/grouproles/DropIdColumnOfGroupRolesTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/grouproles/DropPrimaryKeyOnIdColumnOfGroupRolesTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/grouproles/MakeGroupRolesUuidColumnNotNullableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/grouproles/PopulateGroupRolesUuidTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/groups/AddPrimaryKeyOnUuidColumnOfGroupsTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/groups/AddUuidColumnToGroupsTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/groups/DropIdColumnOfGroupsTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/groups/DropPrimaryKeyOnIdColumnOfGroupsTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/groups/MakeGroupsUuidColumnNotNullableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/groups/PopulateGroupsUuidTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/groups/grouproles/AddGroupUuidColumnToGroupRolesTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/groups/grouproles/AddIndexOnGroupUuidOfGroupRolesTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/groups/grouproles/DropGroupIdColumnOfGroupRolesTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/groups/grouproles/DropIndexOnGroupIdOfGroupRolesTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/groups/grouproles/PopulateGroupRolesGroupUuidTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/groups/groupsusers/AddGroupUuidColumnToGroupsUsersTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/groups/groupsusers/AddIndexOnGroupUuidOfGroupsUsersTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/groups/groupsusers/DropGroupIdColumnOfGroupsUsersTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/groups/groupsusers/DropIndexOnGroupIdOfGroupsUsersTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/groups/groupsusers/MakeGroupsUsersGroupUuidNotNullableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/groups/groupsusers/PopulateGroupsUsersGroupUuidTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/groups/organizations/AddDefaultGroupUuidColumnToOrganizationsTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/groups/organizations/DropDefaultGroupIdColumnOfOrganizationsTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/groups/organizations/PopulateOrganizationsDefaultGroupUuidTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/groups/permtemplatesgroups/AddGroupUuidColumnToPermTemplatesGroupsTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/groups/permtemplatesgroups/DropGroupIdColumnOfPermTemplatesGroupsTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/groups/permtemplatesgroups/PopulatePermTemplatesGroupsGroupUuidTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/groups/qprofileeditgroups/AddGroupUuidColumnToQProfileEditGroupsTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/groups/qprofileeditgroups/AddIndexOnGroupUuidOfQProfileEditGroupsTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/groups/qprofileeditgroups/DropGroupIdColumnOfQProfileEditGroupsTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/groups/qprofileeditgroups/DropIndexOnGroupIdOfQProfileEditGroupsTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/groups/qprofileeditgroups/MakeQProfileEditGroupsGroupUuidNotNullableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/groups/qprofileeditgroups/PopulateQProfileEditGroupsGroupUuidTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/issuechanges/AddIndexOnIssueKeyOfIssueChangesTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/issuechanges/AddIndexOnKeeOfIssueChangesTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/issuechanges/AddPrimaryKeyOnUuidColumnOfIssueChangesTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/issuechanges/CopyIssueChangesTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/issuechanges/DropIssueChangesTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/issuechanges/RenameIssueChangesCopyToIssueChangesTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/issues/AddPrimaryKeyOnKeeColumnOfIssuesTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/manualmeasures/AddPrimaryKeyOnUuidColumnOfManualMeasureTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/manualmeasures/AddUuidToManualMeasuresTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/manualmeasures/DropIdColumnOfManualMeasuresTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/manualmeasures/DropPrimaryKeyOnIdColumnOfManualMeasuresTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/manualmeasures/MakeManualMeasuresUuidColumnNotNullableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/manualmeasures/PopulateManualMeasuresUuidTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/metrics/AddPrimaryKeyOnUuidColumnOfMetricsTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/metrics/AddUuidColumnToMetricsTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/metrics/DropIdColumnOfMetricsTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/metrics/DropPrimaryKeyOnIdColumnOfMetricsTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/metrics/MakeMetricsUuidColumnNotNullableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/metrics/PopulateMetricsUuidTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/metrics/livemeasures/AddIndexOnMetricUuidOfLiveMeasuresTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/metrics/livemeasures/AddIndexOnProjectUuidOfLiveMeasuresTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/metrics/livemeasures/CopyLiveMeasuresTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/metrics/livemeasures/DropLiveMeasuresTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/metrics/livemeasures/RenameLiveMeasuresCopyToLiveMeasuresTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/metrics/manualmeasures/AddMetricUuidColumnToManualMeasuresTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/metrics/manualmeasures/DropMetricIdColumnOfManualMeasuresTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/metrics/manualmeasures/MakeManualMeasuresMetricUuidNotNullableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/metrics/manualmeasures/PopulateManualMeasuresMetricUuidTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/metrics/projectmeasures/AddIndexOnMetricUuidAndAnalysisUuidOfProjectMeasuresTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/metrics/projectmeasures/AddIndexOnMetricUuidOfProjectMeasuresTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/metrics/projectmeasures/AddMetricUuidColumnToProjectMeasuresTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/metrics/projectmeasures/DeleteSecurityReviewRatingProjectMeasuresTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/metrics/projectmeasures/DropIndexOnMetricIdOfProjectMeasuresTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/metrics/projectmeasures/DropMetricIdColumnOfProjectMeasuresTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/metrics/projectmeasures/MakeProjectMeasuresMetricUuidNotNullableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/metrics/projectmeasures/PopulateProjectMeasuresMetricUuidTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/metrics/qualitygateconditions/AddMetricUuidColumnToQualityGateConditionsTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/metrics/qualitygateconditions/DropMetricIdColumnOfQualityGateConditionsTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/metrics/qualitygateconditions/MakeQualityGateConditionsMetricUuidNotNullableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/metrics/qualitygateconditions/PopulateQualityGateConditionsMetricUuidTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/notifications/AddPrimaryKeyOnUuidColumnOfNotificationTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/notifications/AddUuidAndCreatedAtColumnsToNotificationTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/notifications/DropIdColumnOfNotificationTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/notifications/DropPrimaryKeyOnIdColumnOfNotificationTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/notifications/MakeNotificationUuidAndCreatedAtColumnsNotNullableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/notifications/PopulateNotificationUuidAndCreatedAtTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/AddPrimaryKeyOnUuidColumnOfPermissionTemplatesTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/AddUuidColumnToPermissionTemplatesTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/DropIdColumnOfPermissionTemplatesTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/DropKeeColumnOfPermissionTemplatesTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/DropPrimaryKeyOnIdColumnOfPermissionTemplatesTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/MakePermissionTemplateUuidColumnNotNullableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/PopulatePermissionTemplatesUuidTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtemplatesgroups/AddTemplateUuidColumnToPermTemplatesGroupsTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtemplatesgroups/DropTemplateIdColumnOfPermTemplatesGroupsTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtemplatesgroups/MakePermTemplatesGroupsTemplateUuidColumnNotNullableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtemplatesgroups/PopulatePermTemplatesGroupsTemplateUuidColumnTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtemplatesusers/AddTemplateUuidColumnToPermTemplatesUsersTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtemplatesusers/DropTemplateIdColumnOfPermTemplatesUsersTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtemplatesusers/MakePermTemplatesUsersTemplateUuidColumnNotNullableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtemplatesusers/PopulatePermTemplatesUsersTemplateUuidColumnTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtplcharacteristics/AddTemplateUuidColumnToPermTplCharacteristicsTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtplcharacteristics/AddUniqueIndexOnTemplateUuidAndPermissionKeyColumnsOfPermTplCharacteristicsTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtplcharacteristics/DropTemplateIdColumnOfPermTplCharacteristicsTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtplcharacteristics/DropUniqueIndexOnTemplateIdAndPermissionKeyColumnsOfPermTplCharacteristicsTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtplcharacteristics/MakePermTplCharacteristicsTemplateUuidColumnNotNullableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtplcharacteristics/PopulatePermTplCharacteristicsTemplateUuidColumnTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permtemplatesgroups/AddPrimaryKeyOnUuidColumnOfPermTemplatesGroupsTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permtemplatesgroups/AddUuidColumnToPermTemplatesGroupsTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permtemplatesgroups/DropIdColumnOfPermTemplatesGroupsTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permtemplatesgroups/DropPrimaryKeyOnIdColumnOfPermTemplatesGroupsTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permtemplatesgroups/MakePermTemplatesGroupsUuidColumnNotNullableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permtemplatesgroups/PopulatePermTemplatesGroupsUuidTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permtemplatesusers/AddPrimaryKeyOnUuidColumnOfPermTemplatesUsersTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permtemplatesusers/AddUuidColumnToPermTemplatesUsersTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permtemplatesusers/DropIdColumnOfPermTemplatesUsersTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permtemplatesusers/DropPrimaryKeyOnIdColumnOfPermTemplatesUsersTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permtemplatesusers/MakePermTemplatesUsersUuidColumnNotNullableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permtemplatesusers/PopulatePermTemplatesUsersUuidTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permtplcharacteristics/AddPrimaryKeyOnUuidColumnOfPermTplCharacteristicsTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permtplcharacteristics/AddUuidColumnToPermTplCharacteristicsTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permtplcharacteristics/DropIdColumnOfPermTplCharacteristicsTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permtplcharacteristics/DropPrimaryKeyOnIdColumnOfPermTplCharacteristicsTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permtplcharacteristics/MakePermTplCharacteristicsUuidColumnNotNullableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permtplcharacteristics/PopulatePermTplCharacteristicsUuidTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/projectmeasures/AddPrimaryKeyOnUuidColumnOfProjectMeasureTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/projectmeasures/AddTechIndexOnUuidOfProjectMeasuresTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/projectmeasures/AddUuidToProjectMeasuresTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/projectmeasures/DropIdColumnOfProjectMeasuresTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/projectmeasures/DropPrimaryKeyOnIdColumnOfProjectMeasuresTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/projectmeasures/DropTechIndexOnUuidOfProjectMeasuresTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/projectmeasures/MakeProjectMeasuresUuidColumnNotNullableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/projectmeasures/PopulateProjectMeasuresUuidTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/projectqprofiles/AddPrimaryKeyOnUuidColumnOfProjectQProfilesTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/projectqprofiles/AddUuidColumnToProjectQProfilesTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/projectqprofiles/DropIdColumnOfProjectQProfilesTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/projectqprofiles/DropPrimaryKeyOnIdColumnOfProjectQProfilesTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/projectqprofiles/MakeProjectQProfilesUuidColumnNotNullableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/projectqprofiles/PopulateProjectQProfilesUuidTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/properties/AddPrimaryKeyOnUuidColumnOfPropertiesTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/properties/AddUuidColumnToPropertiesTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/properties/DropIdColumnOfPropertiesTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/properties/DropPrimaryKeyOnIdColumnOfPropertiesTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/properties/MakeNotificationUuidColumnNotNullableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/properties/MakePropertiesUuidColumnNotNullable/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/properties/PopulatePropertiesUuidAndCreatedAtTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/qualitygateconditions/AddPrimaryKeyOnUuidColumnOfQualityGateConditionsTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/qualitygateconditions/AddUuidColumnToQualityGateConditionsTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/qualitygateconditions/DropIdColumnOfQualityGateConditionsTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/qualitygateconditions/DropPrimaryKeyOnIdColumnOfQualityGateConditionsTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/qualitygateconditions/MakeQualityGateConditionsUuidColumnNotNullableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/qualitygateconditions/PopulateQualityGateConditionsUuidTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/qualitygates/AddPrimaryKeyOnUuidColumnOfQGatesTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/qualitygates/AddQGateUuidColumnForQGateConditionsTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/qualitygates/DropIdColumnOfQGateTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/qualitygates/DropOrphansQGateConditionsTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/qualitygates/DropPrimaryKeyOnIdColumnOfQGatesTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/qualitygates/DropQGateIdColumnForQGateConditionsTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/qualitygates/DropUniqueIndexOnUuidColumnOfQualityGatesTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/qualitygates/MakeQGateUuidColumnNotNullableForQGateConditionsTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/qualitygates/PopulateQGateUuidColumnForQGateConditionsTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/AddPrimaryKeyOnUuidColumnOfRulesTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/AddUuidAndTemplateUuidColumnsToRulesTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/DropIdColumnOfRulesTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/DropPrimaryKeyOnIdColumnOfRulesTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/DropTemplateIdColumnOfRulesTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/MakeRulesUuidColumnNotNullableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/PopulateRulesTemplateUuidTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/PopulateRulesUuidTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/activerules/AddIndexToActiveRulesTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/activerules/AddRuleUuidColumnToActiveRulesTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/activerules/DropIndexOnRuleIdColumnOfActiveRulesTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/activerules/DropRuleIdColumnOfActiveRulesTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/activerules/MakeActiveRulesRuleUuidColumnNotNullableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/activerules/PopulateActiveRulesRuleUuidColumnTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/deprecatedrulekeys/AddIndexToDeprecatedRuleKeysTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/deprecatedrulekeys/AddRuleUuidColumnToDeprecatedRuleKeysTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/deprecatedrulekeys/DropIndexOnRuleIdColumnOfDeprecatedRuleKeysTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/deprecatedrulekeys/DropRuleIdColumnOfDeprecatedRuleKeysTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/deprecatedrulekeys/MakeDeprecatedRuleKeysRuleUuidColumnNotNullableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/deprecatedrulekeys/PopulateDeprecatedRuleKeysRuleUuidColumnTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/issues/AddIndexesToIssuesTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/issues/CopyIssuesTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/issues/DropIssuesTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/issues/RenameIssuesCopyToIssuesTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/rulesmetadata/AddPrimaryKeyOnUuidAndOrganizationUuidColumnOfRulesMetadataTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/rulesmetadata/AddRuleUuidColumnToRulesMetadataTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/rulesmetadata/DropPrimaryKeyOnIdColumnOfRulesMetadataTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/rulesmetadata/DropRuleIdColumnOfRulesMetadataTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/rulesmetadata/MakeRulesMetadataRuleUuidColumnNotNullableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/rulesmetadata/PopulateRulesMetadataRuleUuidColumnTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/rulesparameters/AddIndexesToRulesParametersTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/rulesparameters/AddRuleUuidColumnToRulesParametersTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/rulesparameters/DropIndexesOnRuleIdColumnOfRulesParametersTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/rulesparameters/DropRuleIdColumnOfRulesParametersTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/rulesparameters/MakeRulesParametersRuleUuidColumnNotNullableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/rulesparameters/PopulateRulesParametersRuleUuidColumnTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rulesparameters/AddPrimaryKeyOnUuidColumnOfRulesParametersTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rulesparameters/AddUuidColumnToRulesParametersTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rulesparameters/DropIdColumnOfRulesParametersTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rulesparameters/DropPrimaryKeyOnIdColumnOfRulesParametersTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rulesparameters/MakeRulesParametersUuidColumnNotNullableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rulesparameters/PopulateRulesParametersUuidTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rulesparameters/fk/AddRulesParameterUuidColumnToActiveRuleParametersTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rulesparameters/fk/DropRulesParameterIdColumnOfActiveRuleParametersTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rulesparameters/fk/MakeActiveRuleParametersRulesParameterUuidColumnNotNullableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rulesparameters/fk/PopulateActiveRuleParametersRulesParameterUuidTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/AddPrimaryKeyOnUuidColumnOfRulesProfilesTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/AddUuidColumnToRulesProfilesTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/DropIdColumnOfRulesProfilesTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/DropKeeColumnOfRulesProfilesTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/DropPrimaryKeyOnIdColumnOfRulesProfilesTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/DropUniqueIndexOnKeeColumnOfRulesProfilesTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/MakeRulesProfilesUuidColumnNotNullableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/PopulateRulesProfilesUuidTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/fk/activerules/AddProfileUuidColumnToActiveRulesTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/fk/activerules/AddUniqueIndexOnProfileUuidColumnOfActiveRulesTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/fk/activerules/DropProfileIdColumnOfActiveRulesTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/fk/activerules/DropUniqueIndexOnProfileIdColumnOfActiveRulesTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/fk/activerules/MakeActiveRulesProfileUuidColumnNotNullableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/fk/activerules/PopulateActiveRulesProfileUuidTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/fk/orgqprofiles/PopulateOrgQProfilesRulesProfileUuidTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/fk/qprofilechanges/PopulateQProfileChangesRulesProfileUuidTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/snapshots/AddPrimaryKeyOnUuidColumnOfSnapshotsTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/snapshots/DropIdColumnOfSnapshotsTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/snapshots/DropPrimaryKeyOnIdColumnOfSnapshotsTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/userroles/AddPrimaryKeyOnUuidColumnOfUserRolesTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/userroles/AddUuidColumnToUserRolesTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/userroles/DropIdColumnOfUserRolesTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/userroles/DropPrimaryKeyOnIdColumnOfUserRolesTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/userroles/MakeUserRolesUuidColumnNotNullableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/userroles/PopulateUserRolesUuidTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/AddPrimaryKeyOnUuidColumnOfUsersTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/DropIdColumnOfUsersTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/DropPrimaryKeyOnIdColumnOfUsersTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/DropUniqueIndexOnUuidColumnOfUsersTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/groupsusers/AddIndexOnUserUuidOfGroupsUsersTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/groupsusers/AddUniqueIndexOnUserUuidAndGroupIdOfGroupsUsersTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/groupsusers/AddUserUuidColumnToGroupsUsersTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/groupsusers/DropIndexOnUserIdOfGroupsUsersTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/groupsusers/DropUniqueIndexOnUserIdAndGroupIdOfGroupsUsersTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/groupsusers/DropUserIdColumnOfGroupsUsersTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/groupsusers/MakeGroupsUsersUserUuidColumnNotNullableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/groupsusers/PopulateGroupsUsersUserUuidTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/organizationmembers/AddIndexOnUserUuidOfOrganizationMembersTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/organizationmembers/AddPrimaryKeyOnUserUuidAndOrganizationUuidColumnsOfUserRolesTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/organizationmembers/AddUserUuidColumnToOrganizationMembersTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/organizationmembers/DropIndexOnUserIdOfOrganizationMembersTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/organizationmembers/DropPrimaryKeyOnUserIdAndOrganizationUuidOfOrganizationMembersTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/organizationmembers/DropUserIdColumnOfOrganizationMembersTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/organizationmembers/MakeOrganizationMembersUserUuidColumnNotNullableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/organizationmembers/PopulateOrganizationMembersUserUuidTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/permtemplatesusers/AddUserUuidColumnToPermTemplatesUsersTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/permtemplatesusers/DropUserIdColumnOfPermTemplatesUsersTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/permtemplatesusers/MakePermTemplatesUsersUserUuidColumnNotNullableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/permtemplatesusers/PopulatePermTemplatesUsersUserUuidTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/properties/AddUserUuidColumnToPropertiesUsersTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/properties/DropUserIdColumnOfPropertiesTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/properties/PopulatePropertiesUserUuidTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/qprofileeditusers/AddUniqueIndexOnUserUuidAndQProfileUuidOfQProfileEditUsersTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/qprofileeditusers/AddUserUuidColumnToQProfileEditUsersTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/qprofileeditusers/DropUniqueIndexOnUserIdAndQProfileUuidOfQProfileEditUsersTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/qprofileeditusers/DropUserIdColumnOfQProfileEditUsersTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/qprofileeditusers/MakeQProfileEditUsersUserUuidColumnNotNullableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/qprofileeditusers/PopulateQProfileEditUsersUserUuidTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/userroles/AddIndexOnUserUuidOfUserRolesTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/userroles/AddUserUuidColumnToUserRolesTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/userroles/DropIndexOnUserIdOfUserRolesTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/userroles/DropUserIdColumnOfUserRolesTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/userroles/PopulateUserRolesUserUuidTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/usertokens/AddPrimaryKeyOnUuidColumnOfUserTokensTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/usertokens/AddUuidColumnToUserTokensTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/usertokens/DropIdColumnOfUserTokensTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/usertokens/DropPrimaryKeyOnIdColumnOfUserTokensTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/usertokens/MakeUserTokensUuidNotNullableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/usertokens/PopulateUserTokensUuidTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/AddIndexOnIssueKeyForIssueChangesTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/AddIndexOnKeeForIssueChangesTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/AddIndexOnMessageTypeColumnOfCeTaskMessageTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/AddIndexOnProjectUuidOnIssueChangesTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/AddIsDismissibleColumnToCeTaskMessageTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/AddMessageTypeColumnToCeTaskMessageTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/AddPrimaryKeyOnUuidForIssueChangesTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/AddTypeToPluginsTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/AlterTypeInPluginNotNullableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/CreateTmpIssueChangesTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/DeleteProjectAlmSettingsOrphansTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/DropIssueChangesTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/DropOrphanFavoritesFromPropertiesTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/DropPeriodAndValueWarningColumnsFromQualityGateConditionsTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/DropProjectAlmBindingsTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/DropProjectBranchesKeyTypeTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/DropUnusedIndexesTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/DropUnusedPeriodsInSnapshotsTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/DropUnusedVariationsInProjectMeasuresTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/FillProjectBranchesBranchTypeTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/MakeIsDismissibleColumnNotNullableOnCeTaskMessageTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/MakeIssueKeyNotNullOnIssueChangesTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/MakeMessageTypeColumnNotNullableOnCeTaskMessageTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/MakeProjectBranchesBranchTypeNotNullableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/MakeProjectUuidNotNullOnIssueChangesTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/MakeUuidNotNullOnIssueChangesTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/PopulateFileSourceLineCountTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/PopulateIsDismissibleColumnOfCeTaskMessageTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/PopulateMessageTypeColumnOfCeTaskMessageTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/PopulateTypeInPluginsTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/RenameTmpIssueChangesToIssueChangesTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v86/AddIndexToApplicationBranchProjsTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v86/AddIndexToApplicationProjectsTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v86/AddPkToApplicationBranchProjsTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v86/AddPkToApplicationProjectsTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v86/AddPrimaryKeyToDefaultQProfilesTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v86/AddResetPasswordColumnToUsersTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v86/AddUniqueIndexOnNameColumnOfGroupsTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v86/DropDefaultQProfilesPkTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v86/DropOrganizationFromDefaultQProfilesTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v86/DropOrganizationFromQualityProfileTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v86/DropOrganizationInGroupRolesTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v86/DropOrganizationInGroupsTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v86/DropOrganizationInPermissionTemplatesTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v86/DropOrganizationInRulesMetadataTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v86/DropOrganizationInUserRolesTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v86/DropOrganizationInUsersTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v86/DropOrganizationUuidIndexFromQualityProfileTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v86/MakeNameColumnInGroupsTableNotNullableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v86/MakeResetPasswordColumnNotNullTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v86/MigrateApplicationDefinitionsFromXmlToDbTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v86/MoveDefaultTemplatesToInternalPropertiesTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v86/PopulateResetPasswordDefaultValueTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v86/SecureGitlabSecretParametersTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v86/SetForceAuthenticationSettingsTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v86/UpdateChangeDataOfQProfileChangesTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v87/AddMonorepoColumnToProjectAlmSettingsTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v87/DropAlmAppInstallsTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v87/DropDescriptionInProjectMeasuresTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v87/DropOrgMembersTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v87/DropOrgQualityGatesTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v87/DropOrganizationAlmBindingsTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v87/DropOrganizationInComponentsTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v87/DropOrganizationInProjectsTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v87/DropOrganizationInWebhooksTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v87/DropOrganizationsTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v87/MakeMonorepoColumnInProjectAlmSettingsTableNotNullableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v87/MoveDefaultProjectVisibilityToGlobalPropertiesTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v87/MoveDefaultQualityGateToGlobalPropertiesTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v87/PopulateMonorepoColumnToProjectAlmSettingsTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v88/AddLastSonarlintConnectionToUsersTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v89/AddIndexOnWebhookUuidInWebhookDeliveriesTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v89/AddIndicesToNewCodePeriodTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v89/AddMainBranchProjectUuidIndexToComponentTableTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v89/DropGithubEndpointOnProjectLevelSettingTest/schema.sql delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v89/IncreaseSizeOfValueColumnInNewCodePeriodsTableTest/schema.sql diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/MigrationConfigurationModule.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/MigrationConfigurationModule.java index 29853fbbb5e..d2d6988d15c 100644 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/MigrationConfigurationModule.java +++ b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/MigrationConfigurationModule.java @@ -27,17 +27,6 @@ import org.sonar.server.platform.db.migration.sql.DropPrimaryKeySqlGenerator; import org.sonar.server.platform.db.migration.step.MigrationStepRegistryImpl; import org.sonar.server.platform.db.migration.step.MigrationStepsProvider; import org.sonar.server.platform.db.migration.version.v00.DbVersion00; -import org.sonar.server.platform.db.migration.version.v80.DbVersion80; -import org.sonar.server.platform.db.migration.version.v81.DbVersion81; -import org.sonar.server.platform.db.migration.version.v82.DbVersion82; -import org.sonar.server.platform.db.migration.version.v83.DbVersion83; -import org.sonar.server.platform.db.migration.version.v84.DbVersion84; -import org.sonar.server.platform.db.migration.version.v85.DbVersion85; -import org.sonar.server.platform.db.migration.version.v86.DbVersion86; -import org.sonar.server.platform.db.migration.version.v87.DbVersion87; -import org.sonar.server.platform.db.migration.version.v88.DbVersion88; -import org.sonar.server.platform.db.migration.version.v89.DbVersion89; -import org.sonar.server.platform.db.migration.version.v89.util.NetworkInterfaceProvider; public class MigrationConfigurationModule extends Module { @Override @@ -45,16 +34,6 @@ public class MigrationConfigurationModule extends Module { add( // DbVersion implementations DbVersion00.class, - DbVersion80.class, - DbVersion81.class, - DbVersion82.class, - DbVersion83.class, - DbVersion84.class, - DbVersion85.class, - DbVersion86.class, - DbVersion87.class, - DbVersion88.class, - DbVersion89.class, // migration steps MigrationStepRegistryImpl.class, @@ -66,7 +45,6 @@ public class MigrationConfigurationModule extends Module { // Utility classes DbPrimaryKeyConstraintFinder.class, - DropPrimaryKeySqlGenerator.class, - NetworkInterfaceProvider.class); + DropPrimaryKeySqlGenerator.class); } } diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v80/CreateNewCodePeriodTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v80/CreateNewCodePeriodTable.java deleted file mode 100644 index 563378f2575..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v80/CreateNewCodePeriodTable.java +++ /dev/null @@ -1,109 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v80; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.def.BigIntegerColumnDef; -import org.sonar.server.platform.db.migration.def.VarcharColumnDef; -import org.sonar.server.platform.db.migration.sql.CreateIndexBuilder; -import org.sonar.server.platform.db.migration.sql.CreateTableBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.sonar.server.platform.db.migration.def.BigIntegerColumnDef.newBigIntegerColumnDefBuilder; -import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.UUID_SIZE; -import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder; - -public class CreateNewCodePeriodTable extends DdlChange { - - private static final String TABLE_NAME = "new_code_periods"; - - private static final VarcharColumnDef UUID_COLUMN = newVarcharColumnDefBuilder() - .setColumnName("uuid") - .setIsNullable(false) - .setLimit(UUID_SIZE) - .build(); - - private static final VarcharColumnDef PROJECT_UUID_COLUMN = newVarcharColumnDefBuilder() - .setColumnName("project_uuid") - .setIsNullable(true) - .setLimit(UUID_SIZE) - .build(); - private static final VarcharColumnDef BRANCH_UUID_COLUMN = newVarcharColumnDefBuilder() - .setColumnName("branch_uuid") - .setIsNullable(true) - .setLimit(UUID_SIZE) - .build(); - - /** - * Available values: - * * PREVIOUS_VERSION - * * NUMBER_OF_DAYS - * * DATE - * * SPECIFIC_ANALYSIS - */ - private static final VarcharColumnDef TYPE = newVarcharColumnDefBuilder() - .setColumnName("type") - .setIsNullable(false) - .setLimit(30) - .build(); - - private static final VarcharColumnDef VALUE = newVarcharColumnDefBuilder() - .setColumnName("value") - .setIsNullable(true) - .setLimit(40) - .build(); - - private static final BigIntegerColumnDef UPDATED_AT = newBigIntegerColumnDefBuilder() - .setColumnName("updated_at") - .setIsNullable(false) - .build(); - - private static final BigIntegerColumnDef CREATED_AT = newBigIntegerColumnDefBuilder() - .setColumnName("created_at") - .setIsNullable(false) - .build(); - - public CreateNewCodePeriodTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new CreateTableBuilder(getDialect(), TABLE_NAME) - .addPkColumn(UUID_COLUMN) - .addColumn(PROJECT_UUID_COLUMN) - .addColumn(BRANCH_UUID_COLUMN) - .addColumn(TYPE) - .addColumn(VALUE) - .addColumn(UPDATED_AT) - .addColumn(CREATED_AT) - .build()); - - context.execute(new CreateIndexBuilder() - .setTable(TABLE_NAME) - .setName("uniq_new_code_periods") - .setUnique(true) - .addColumn(PROJECT_UUID_COLUMN) - .addColumn(BRANCH_UUID_COLUMN) - .build()); - } - -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v80/CreateProjectQualityGatesTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v80/CreateProjectQualityGatesTable.java deleted file mode 100644 index fc35c06625d..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v80/CreateProjectQualityGatesTable.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v80; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.SupportsBlueGreen; -import org.sonar.server.platform.db.migration.def.VarcharColumnDef; -import org.sonar.server.platform.db.migration.sql.CreateIndexBuilder; -import org.sonar.server.platform.db.migration.sql.CreateTableBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.UUID_SIZE; -import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder; - -@SupportsBlueGreen -public class CreateProjectQualityGatesTable extends DdlChange { - - private static final String TABLE_NAME = "project_qgates"; - - private static final VarcharColumnDef PROJECT_UUID_COLUMN = newVarcharColumnDefBuilder() - .setColumnName("project_uuid") - .setIsNullable(false) - .setLimit(UUID_SIZE) - .build(); - private static final VarcharColumnDef QUALITY_GATE_UUID_COLUMN = newVarcharColumnDefBuilder() - .setColumnName("quality_gate_uuid") - .setIsNullable(false) - .setLimit(UUID_SIZE) - .build(); - - public CreateProjectQualityGatesTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new CreateTableBuilder(getDialect(), TABLE_NAME) - .addPkColumn(PROJECT_UUID_COLUMN) - .addColumn(QUALITY_GATE_UUID_COLUMN) - .build()); - - context.execute(new CreateIndexBuilder() - .setTable(TABLE_NAME) - .setName("uniq_project_qgates") - .setUnique(true) - .addColumn(PROJECT_UUID_COLUMN) - .addColumn(QUALITY_GATE_UUID_COLUMN) - .build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v80/DbVersion80.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v80/DbVersion80.java deleted file mode 100644 index 80ffa0eabd2..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v80/DbVersion80.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v80; - -import org.sonar.server.platform.db.migration.step.MigrationStepRegistry; -import org.sonar.server.platform.db.migration.version.DbVersion; - -public class DbVersion80 implements DbVersion { - @Override - public void addSteps(MigrationStepRegistry registry) { - registry - .add(3000, "Set Organizations#guarded column nullable", MakeOrganizationsGuardedNullable.class) - .add(3001, "Create ProjectQualityGates table", CreateProjectQualityGatesTable.class) - .add(3002, "Make index on DEPRECATED_RULE_KEYS.RULE_ID non unique", MakeDeprecatedRuleKeysRuleIdIndexNonUnique.class) - .add(3003, "Populate ProjectQualityGate table from Properties table", PopulateProjectQualityGatesTable.class) - .add(3004, "Rename ANALYSIS_PROPERTIES.SNAPSHOT_UUID to ANALYSIS_UUID", RenameAnalysisPropertiesSnapshotUuid.class) - .add(3005, "Remove default quality gate property from Properties table", RemoveDefaultQualityGateFromPropertiesTable.class) - .add(3006, "Create NEW_CODE_PERIOD table", CreateNewCodePeriodTable.class) - .add(3007, "Populate NEW_CODE_PERIOD table", PopulateNewCodePeriodTable.class) - .add(3008, "Remove leak period properties", RemoveLeakPeriodProperties.class) - .add(3009, "Remove GitHub login generation strategy property", RemoveGitHubLoginGenerationStrategyProperty.class); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v80/MakeDeprecatedRuleKeysRuleIdIndexNonUnique.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v80/MakeDeprecatedRuleKeysRuleIdIndexNonUnique.java deleted file mode 100644 index 6b317ed906c..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v80/MakeDeprecatedRuleKeysRuleIdIndexNonUnique.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v80; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.def.IntegerColumnDef; -import org.sonar.server.platform.db.migration.sql.CreateIndexBuilder; -import org.sonar.server.platform.db.migration.sql.DropIndexBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class MakeDeprecatedRuleKeysRuleIdIndexNonUnique extends DdlChange { - private static final String TABLE_NAME = "deprecated_rule_keys"; - private static final IntegerColumnDef RULE_ID_COLUMN = IntegerColumnDef.newIntegerColumnDefBuilder() - .setColumnName("rule_id") - .setIsNullable(false) - .build(); - - public MakeDeprecatedRuleKeysRuleIdIndexNonUnique(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new DropIndexBuilder(getDialect()) - .setTable(TABLE_NAME) - .setName("rule_id_deprecated_rule_keys") - .build()); - - context.execute(new CreateIndexBuilder() - .setTable(TABLE_NAME) - .setName("rule_id_deprecated_rule_keys") - .setUnique(false) - .addColumn(RULE_ID_COLUMN) - .build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v80/MakeOrganizationsGuardedNullable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v80/MakeOrganizationsGuardedNullable.java deleted file mode 100644 index 209e623bcd3..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v80/MakeOrganizationsGuardedNullable.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v80; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.SupportsBlueGreen; -import org.sonar.server.platform.db.migration.sql.AlterColumnsBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.sonar.server.platform.db.migration.def.BooleanColumnDef.newBooleanColumnDefBuilder; - -@SupportsBlueGreen -public class MakeOrganizationsGuardedNullable extends DdlChange { - - public MakeOrganizationsGuardedNullable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new AlterColumnsBuilder(getDialect(), "organizations") - .updateColumn(newBooleanColumnDefBuilder() - .setColumnName("guarded") - .setIsNullable(true) - .build()) - .build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v80/PopulateNewCodePeriodTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v80/PopulateNewCodePeriodTable.java deleted file mode 100644 index 37e3c5a42d7..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v80/PopulateNewCodePeriodTable.java +++ /dev/null @@ -1,292 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v80; - -import java.sql.SQLException; -import java.time.LocalDate; -import java.time.ZoneId; -import java.time.format.DateTimeParseException; -import java.util.ArrayList; -import java.util.List; -import java.util.Optional; -import java.util.stream.Collectors; -import javax.annotation.Nullable; -import org.sonar.api.utils.System2; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; -import org.sonar.core.util.UuidFactory; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.step.DataChange; -import org.sonar.server.platform.db.migration.step.Upsert; - -public class PopulateNewCodePeriodTable extends DataChange { - private static final Logger LOG = Loggers.get(PopulateNewCodePeriodTable.class); - - private static final String TYPE_PREVIOUS_VERSION = "PREVIOUS_VERSION"; - private static final String TYPE_NUMBER_OF_DAYS = "NUMBER_OF_DAYS"; - private static final String TYPE_SPECIFIC_ANALYSIS = "SPECIFIC_ANALYSIS"; - - private static final String LEAK_PERIOD_PROP_KEY = "sonar.leak.period"; - - private final UuidFactory uuidFactory; - private final System2 system2; - - public PopulateNewCodePeriodTable(Database db, UuidFactory uuidFactory, System2 system2) { - super(db); - this.uuidFactory = uuidFactory; - this.system2 = system2; - } - - @Override - protected void execute(Context context) throws SQLException { - List branchUuidsAlreadyMigrated = populateFromManualBaselines(context); - populateFromSettings(context, branchUuidsAlreadyMigrated); - } - - private List populateFromManualBaselines(Context context) throws SQLException { - List projectBranchManualBaselines = context.prepareSelect( - "SELECT pb.uuid, pb.project_uuid, pb.manual_baseline_analysis_uuid FROM project_branches pb WHERE pb.manual_baseline_analysis_uuid IS NOT NULL") - .list(row -> { - String branchUuid = row.getString(1); - String projectUuid = row.getString(2); - String manualBaselineAnalysisUuid = row.getString(3); - return new ProjectBranchManualBaselineDto(branchUuid, projectUuid, manualBaselineAnalysisUuid); - }); - - if (!projectBranchManualBaselines.isEmpty()) { - populateWithManualBaselines(context, projectBranchManualBaselines); - } - - return projectBranchManualBaselines.stream() - .map(pb -> pb.branchUuid) - .collect(Collectors.toList()); - } - - private void populateFromSettings(Context context, List branchUuidsAlreadyMigrated) throws SQLException { - // migrate global setting - String globalSetting = context - .prepareSelect("SELECT props.text_value FROM properties props WHERE props.prop_key = '" + LEAK_PERIOD_PROP_KEY + "' AND props.resource_id IS NULL") - .get(r -> r.getString(1)); - if (globalSetting != null) { - populateGlobalSetting(context, globalSetting); - } - - List projectLeakPeriodProperties = new ArrayList<>(); - context.prepareSelect( - "SELECT projs.uuid, projs.main_branch_project_uuid, props.text_value " - + "FROM properties props INNER JOIN projects projs ON props.resource_id = projs.id " - + "WHERE props.prop_key = '" + LEAK_PERIOD_PROP_KEY + "' AND props.resource_id IS NOT NULL ") - .scroll(row -> { - String branchUuid = row.getString(1); - if (branchUuidsAlreadyMigrated.contains(branchUuid)) { - return; - } - String mainBranchUuid = row.getString(2); - String value = row.getString(3); - if (mainBranchUuid == null) { - mainBranchUuid = branchUuid; - } - projectLeakPeriodProperties.add(new BranchLeakPeriodPropertyDto(branchUuid, mainBranchUuid, value)); - }); - - populateWithSettings(context, projectLeakPeriodProperties); - } - - private void populateGlobalSetting(Context context, String value) { - Optional typeValue = tryParse(context, null, value); - typeValue.ifPresent(tp -> { - try (Upsert upsertQuery = prepareUpsertNewCodePeriodQuery(context)) { - long currentTime = system2.now(); - insert(upsertQuery, null, null, tp.type, tp.value, currentTime); - upsertQuery - .execute() - .commit(); - } catch (SQLException e) { - LOG.warn("Failed to migrate the global property for the new code period", e); - } - }); - } - - private void populateWithSettings(Context context, List projectLeakPeriodProperties) throws SQLException { - try (Upsert upsertQuery = prepareUpsertNewCodePeriodQuery(context)) { - long currentTime = system2.now(); - boolean commit = false; - - for (BranchLeakPeriodPropertyDto branchLeakPeriodProperty : projectLeakPeriodProperties) { - Optional typeValueOpt = tryParse(context, branchLeakPeriodProperty.branchUuid, branchLeakPeriodProperty.value); - if (!typeValueOpt.isPresent()) { - continue; - } - - TypeValuePair typeValue = typeValueOpt.get(); - - String branchUuid = null; - if (!branchLeakPeriodProperty.isMainBranch() || TYPE_SPECIFIC_ANALYSIS.equals(typeValue.type)) { - branchUuid = branchLeakPeriodProperty.branchUuid; - } - - insert(upsertQuery, branchLeakPeriodProperty.mainBranchUuid, branchUuid, typeValue.type, typeValue.value, currentTime); - commit = true; - } - - if (commit) { - upsertQuery - .execute() - .commit(); - } - } - } - - private void populateWithManualBaselines(Context context, List projectBranchManualBaselines) throws SQLException { - try (Upsert upsertQuery = prepareUpsertNewCodePeriodQuery(context)) { - long currentTime = system2.now(); - - for (ProjectBranchManualBaselineDto projectBranchManualBaseline : projectBranchManualBaselines) { - insert(upsertQuery, projectBranchManualBaseline.projectUuid, projectBranchManualBaseline.branchUuid, TYPE_SPECIFIC_ANALYSIS, - projectBranchManualBaseline.manualBaselineAnalysisUuid, currentTime); - } - upsertQuery - .execute() - .commit(); - } - } - - private void insert(Upsert upsert, @Nullable String projectUuid, @Nullable String branchUuid, String type, @Nullable String value, long currentTime) throws SQLException { - upsert - .setString(1, uuidFactory.create()) - .setString(2, projectUuid) - .setString(3, branchUuid) - .setString(4, type) - .setString(5, value) - .setLong(6, currentTime) - .setLong(7, currentTime) - .addBatch(); - } - - private static Upsert prepareUpsertNewCodePeriodQuery(Context context) throws SQLException { - return context.prepareUpsert("INSERT INTO new_code_periods(" + - "uuid, " + - "project_uuid," + - "branch_uuid," + - "type," + - "value," + - "updated_at," + - "created_at" + - ") VALUES (?, ?, ?, ?, ?, ?, ?)"); - } - - private static Optional tryParse(Context context, @Nullable String branchUuid, String value) { - try { - if (value.equals("previous_version")) { - return Optional.of(new TypeValuePair(TYPE_PREVIOUS_VERSION, null)); - } - - try { - Integer.parseInt(value); - return Optional.of(new TypeValuePair(TYPE_NUMBER_OF_DAYS, value)); - } catch (NumberFormatException e) { - // ignore - } - - if (branchUuid == null) { - return Optional.empty(); - } - - try { - LocalDate localDate = LocalDate.parse(value); - Optional snapshot = findFirstSnapshot(context, branchUuid, localDate.atStartOfDay(ZoneId.systemDefault()).toInstant().toEpochMilli()); - return snapshot.map(uuid -> new TypeValuePair(TYPE_SPECIFIC_ANALYSIS, uuid)); - } catch (DateTimeParseException e) { - // ignore - } - - List versions = getVersionsByMostRecentFirst(context, branchUuid); - Optional versionMatch = versions.stream().filter(v -> v.version.equals(value)).findFirst(); - return versionMatch.map(e -> new TypeValuePair(TYPE_SPECIFIC_ANALYSIS, e.analysisUuid)); - } catch (SQLException e) { - LOG.warn("Failed to migrate a property for the new code period", e); - return Optional.empty(); - } - } - - private static List getVersionsByMostRecentFirst(Context context, String branchUuid) throws SQLException { - return context.prepareSelect("SELECT name, analysis_uuid FROM events " - + "WHERE component_uuid = '" + branchUuid + "' AND category = 'Version' " - + "ORDER BY created_at DESC") - .list(r -> new EventDto(r.getString(1), r.getString(2))); - } - - private static Optional findFirstSnapshot(Context context, String branchUuid, long date) throws SQLException { - String analysisUuid = context.prepareSelect("SELECT uuid FROM snapshots " - + "WHERE component_uuid = '" + branchUuid + "' AND created_at > " + date + " AND status = 'P' " - + "ORDER BY created_at ASC") - .get(r -> r.getString(1)); - return Optional.ofNullable(analysisUuid); - } - - private static class TypeValuePair { - private final String type; - @Nullable - private final String value; - - private TypeValuePair(String type, @Nullable String value) { - this.type = type; - this.value = value; - } - } - - private static class EventDto { - private final String version; - private final String analysisUuid; - - private EventDto(String version, String analysisUuid) { - this.version = version; - this.analysisUuid = analysisUuid; - } - } - - private static class ProjectBranchManualBaselineDto { - private final String branchUuid; - private final String projectUuid; - private final String manualBaselineAnalysisUuid; - - ProjectBranchManualBaselineDto(String branchUuid, String projectUuid, String manualBaselineAnalysisUuid) { - this.branchUuid = branchUuid; - this.projectUuid = projectUuid; - this.manualBaselineAnalysisUuid = manualBaselineAnalysisUuid; - } - } - - private static class BranchLeakPeriodPropertyDto { - private final String branchUuid; - private final String mainBranchUuid; - private final String value; - - BranchLeakPeriodPropertyDto(String branchUuid, String mainBranchUuid, String value) { - this.branchUuid = branchUuid; - this.mainBranchUuid = mainBranchUuid; - this.value = value; - } - - private boolean isMainBranch() { - return mainBranchUuid.equals(branchUuid); - } - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v80/PopulateProjectQualityGatesTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v80/PopulateProjectQualityGatesTable.java deleted file mode 100644 index 4fe66e59e36..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v80/PopulateProjectQualityGatesTable.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v80; - -import java.sql.SQLException; -import java.util.List; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.step.DataChange; -import org.sonar.server.platform.db.migration.step.Upsert; - -public class PopulateProjectQualityGatesTable extends DataChange { - - public PopulateProjectQualityGatesTable(Database db) { - super(db); - } - - @Override - protected void execute(Context context) throws SQLException { - List projectQualityGates = context.prepareSelect( - "select prj.uuid, qg.uuid from properties p \n" + - "join projects prj on p.resource_id = prj.id\n" + - "join quality_gates qg on qg.id = CAST(p.text_value AS int)\n" + - "where p.prop_key = 'sonar.qualitygate'\n" + - "and not exists(select pqg.project_uuid from project_qgates pqg where pqg.project_uuid = prj.uuid)") - .list(row -> { - String projectUuid = row.getString(1); - String qualityGateUuid = row.getString(2); - return new ProjectQualityGate(projectUuid, qualityGateUuid); - }); - - if (!projectQualityGates.isEmpty()) { - populateProjectQualityGates(context, projectQualityGates); - } - } - - private static void populateProjectQualityGates(Context context, List projectQualityGates) throws SQLException { - Upsert insertQuery = prepareInsertProjectQualityGateQuery(context); - for (ProjectQualityGate projectQualityGate : projectQualityGates) { - insertQuery - .setString(1, projectQualityGate.projectUuid) - .setString(2, projectQualityGate.qualityGateUuid) - .addBatch(); - } - insertQuery - .execute() - .commit(); - } - - private static Upsert prepareInsertProjectQualityGateQuery(Context context) throws SQLException { - return context.prepareUpsert("insert into project_qgates(project_uuid, quality_gate_uuid) VALUES (?, ?)"); - } - - private static class ProjectQualityGate { - private final String projectUuid; - private final String qualityGateUuid; - - ProjectQualityGate(String projectUuid, String qualityGateUuid) { - this.projectUuid = projectUuid; - this.qualityGateUuid = qualityGateUuid; - } - } - -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v80/RemoveDefaultQualityGateFromPropertiesTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v80/RemoveDefaultQualityGateFromPropertiesTable.java deleted file mode 100644 index 3675a5d40b1..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v80/RemoveDefaultQualityGateFromPropertiesTable.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v80; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.step.DataChange; - -public class RemoveDefaultQualityGateFromPropertiesTable extends DataChange { - - public RemoveDefaultQualityGateFromPropertiesTable(Database db) { - super(db); - } - - @Override - protected void execute(Context context) throws SQLException { - context.prepareUpsert("delete from properties where prop_key='sonar.qualitygate'") - .execute() - .commit(); - } - -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v80/RemoveGitHubLoginGenerationStrategyProperty.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v80/RemoveGitHubLoginGenerationStrategyProperty.java deleted file mode 100644 index e9dc7060369..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v80/RemoveGitHubLoginGenerationStrategyProperty.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v80; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.step.DataChange; - -public class RemoveGitHubLoginGenerationStrategyProperty extends DataChange { - private static final String GH_LOGIN_STRATEGY_PROP_KEY = "sonar.auth.github.loginStrategy"; - - public RemoveGitHubLoginGenerationStrategyProperty(Database db) { - super(db); - } - - @Override - protected void execute(Context context) throws SQLException { - context.prepareUpsert("delete from properties where prop_key='" + GH_LOGIN_STRATEGY_PROP_KEY + "'") - .execute() - .commit(); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v80/RemoveLeakPeriodProperties.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v80/RemoveLeakPeriodProperties.java deleted file mode 100644 index f591b89b770..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v80/RemoveLeakPeriodProperties.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v80; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.step.DataChange; - -public class RemoveLeakPeriodProperties extends DataChange { - private static final String LEAK_PERIOD_PROP_KEY = "sonar.leak.period"; - - public RemoveLeakPeriodProperties(Database db) { - super(db); - } - - @Override - protected void execute(DataChange.Context context) throws SQLException { - context.prepareUpsert("delete from properties where prop_key='" + LEAK_PERIOD_PROP_KEY + "'") - .execute() - .commit(); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v80/RenameAnalysisPropertiesSnapshotUuid.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v80/RenameAnalysisPropertiesSnapshotUuid.java deleted file mode 100644 index 78f88ddf4af..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v80/RenameAnalysisPropertiesSnapshotUuid.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v80; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.def.VarcharColumnDef; -import org.sonar.server.platform.db.migration.sql.CreateIndexBuilder; -import org.sonar.server.platform.db.migration.sql.DropIndexBuilder; -import org.sonar.server.platform.db.migration.sql.RenameColumnsBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.UUID_SIZE; - -public class RenameAnalysisPropertiesSnapshotUuid extends DdlChange { - private static final VarcharColumnDef ANALYSIS_UUID_COLUMN = VarcharColumnDef.newVarcharColumnDefBuilder() - .setColumnName("analysis_uuid") - .setIsNullable(false) - .setLimit(UUID_SIZE) - .build(); - - public RenameAnalysisPropertiesSnapshotUuid(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - String tableName = "analysis_properties"; - - context.execute(new DropIndexBuilder(getDialect()) - .setTable(tableName) - .setName("ix_snapshot_uuid") - .build()); - - context.execute(new RenameColumnsBuilder(getDialect(), tableName) - .renameColumn("snapshot_uuid", ANALYSIS_UUID_COLUMN) - .build()); - - context.execute(new CreateIndexBuilder() - .setTable(tableName) - .setName("analysis_properties_analysis") - .setUnique(false) - .addColumn(ANALYSIS_UUID_COLUMN) - .build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v80/package-info.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v80/package-info.java deleted file mode 100644 index 1e1cfe4f8dd..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v80/package-info.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v80; - -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v81/AddExcludeBranchFromPurgeColumn.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v81/AddExcludeBranchFromPurgeColumn.java deleted file mode 100644 index ce976e3e689..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v81/AddExcludeBranchFromPurgeColumn.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v81; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.SupportsBlueGreen; -import org.sonar.server.platform.db.migration.sql.AddColumnsBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.sonar.server.platform.db.migration.def.BooleanColumnDef.newBooleanColumnDefBuilder; - -@SupportsBlueGreen -public class AddExcludeBranchFromPurgeColumn extends DdlChange { - private static final String TABLE = "project_branches"; - private static final String NEW_COLUMN = "exclude_from_purge"; - - public AddExcludeBranchFromPurgeColumn(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new AddColumnsBuilder(getDialect(), TABLE) - .addColumn(newBooleanColumnDefBuilder() - .setColumnName(NEW_COLUMN) - .setIsNullable(false) - .setDefaultValue(false) - .build()) - .build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v81/CreateAlmSettingsTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v81/CreateAlmSettingsTable.java deleted file mode 100644 index a1794a86f6e..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v81/CreateAlmSettingsTable.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v81; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.def.VarcharColumnDef; -import org.sonar.server.platform.db.migration.sql.CreateIndexBuilder; -import org.sonar.server.platform.db.migration.sql.CreateTableBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.sonar.server.platform.db.migration.def.BigIntegerColumnDef.newBigIntegerColumnDefBuilder; -import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.UUID_SIZE; -import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder; - -public class CreateAlmSettingsTable extends DdlChange { - - private static final String TABLE_NAME = "alm_settings"; - - private static final VarcharColumnDef KEY = newVarcharColumnDefBuilder() - .setColumnName("kee") - .setIsNullable(false) - .setLimit(200) - .build(); - - public CreateAlmSettingsTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new CreateTableBuilder(getDialect(), TABLE_NAME) - .addPkColumn(newVarcharColumnDefBuilder() - .setColumnName("uuid") - .setIsNullable(false) - .setLimit(UUID_SIZE) - .build()) - .addColumn(newVarcharColumnDefBuilder() - .setColumnName("alm_id") - .setIsNullable(false) - .setLimit(40) - .build()) - .addColumn(KEY) - .addColumn(newVarcharColumnDefBuilder() - .setColumnName("url") - .setIsNullable(true) - .setLimit(2000) - .build()) - .addColumn(newVarcharColumnDefBuilder() - .setColumnName("app_id") - .setIsNullable(true) - .setLimit(80) - .build()) - .addColumn(newVarcharColumnDefBuilder() - .setColumnName("private_key") - .setIsNullable(true) - .setLimit(2000) - .build()) - .addColumn(newVarcharColumnDefBuilder() - .setColumnName("pat") - .setIsNullable(true) - .setLimit(2000) - .build()) - .addColumn(newBigIntegerColumnDefBuilder() - .setColumnName("updated_at") - .setIsNullable(false) - .build()) - .addColumn(newBigIntegerColumnDefBuilder() - .setColumnName("created_at") - .setIsNullable(false) - .build()) - .build()); - - context.execute(new CreateIndexBuilder() - .setTable(TABLE_NAME) - .addColumn(KEY) - .setName("uniq_alm_settings") - .setUnique(true) - .build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v81/CreateProjectAlmSettingsTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v81/CreateProjectAlmSettingsTable.java deleted file mode 100644 index 7ab94318864..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v81/CreateProjectAlmSettingsTable.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v81; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.def.VarcharColumnDef; -import org.sonar.server.platform.db.migration.sql.CreateIndexBuilder; -import org.sonar.server.platform.db.migration.sql.CreateTableBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.sonar.server.platform.db.migration.def.BigIntegerColumnDef.newBigIntegerColumnDefBuilder; -import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.UUID_SIZE; -import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.UUID_VARCHAR_SIZE; -import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder; - -public class CreateProjectAlmSettingsTable extends DdlChange { - - private static final String TABLE_NAME = "project_alm_settings"; - - private static final VarcharColumnDef PROJECT_UUID = newVarcharColumnDefBuilder() - .setColumnName("project_uuid") - .setIsNullable(false) - .setLimit(UUID_VARCHAR_SIZE) - .build(); - - private static final VarcharColumnDef ALM_SETTING_UUID = newVarcharColumnDefBuilder() - .setColumnName("alm_setting_uuid") - .setIsNullable(false) - .setLimit(UUID_SIZE) - .build(); - - public CreateProjectAlmSettingsTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new CreateTableBuilder(getDialect(), TABLE_NAME) - .addPkColumn(newVarcharColumnDefBuilder() - .setColumnName("uuid") - .setIsNullable(false) - .setLimit(UUID_SIZE) - .build()) - .addColumn(ALM_SETTING_UUID) - .addColumn(PROJECT_UUID) - .addColumn(newVarcharColumnDefBuilder() - .setColumnName("alm_repo") - .setIsNullable(true) - .setLimit(256) - .build()) - .addColumn(newVarcharColumnDefBuilder() - .setColumnName("alm_slug") - .setIsNullable(true) - .setLimit(256) - .build()) - .addColumn(newBigIntegerColumnDefBuilder() - .setColumnName("updated_at") - .setIsNullable(false) - .build()) - .addColumn(newBigIntegerColumnDefBuilder() - .setColumnName("created_at") - .setIsNullable(false) - .build()) - .build()); - - context.execute(new CreateIndexBuilder() - .setTable(TABLE_NAME) - .addColumn(PROJECT_UUID) - .setName("uniq_project_alm_settings") - .setUnique(true) - .build()); - - context.execute(new CreateIndexBuilder() - .setTable(TABLE_NAME) - .addColumn(ALM_SETTING_UUID) - .setName("project_alm_settings_alm") - .build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v81/DbVersion81.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v81/DbVersion81.java deleted file mode 100644 index 5fd5f8dc0f4..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v81/DbVersion81.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v81; - -import org.sonar.server.platform.db.migration.step.MigrationStepRegistry; -import org.sonar.server.platform.db.migration.version.DbVersion; - -public class DbVersion81 implements DbVersion { - @Override - public void addSteps(MigrationStepRegistry registry) { - registry - .add(3100, "Create ALM_SETTINGS table", CreateAlmSettingsTable.class) - .add(3101, "Create PROJECT_ALM_SETTINGS table", CreateProjectAlmSettingsTable.class) - .add(3102, "Migrate property 'sonar.alm.github.app.privateKey.secured' to 'sonar.alm.github.app.privateKeyContent.secured'", - MigrateDeprecatedGithubPrivateKeyToNewKey.class) - .add(3103, "Migrate GitHub ALM settings from PROPERTIES to ALM_SETTINGS tables", MigrateGithubAlmSettings.class) - .add(3104, "Migrate Bitbucket ALM settings from PROPERTIES to ALM_SETTINGS tables", MigrateBitbucketAlmSettings.class) - .add(3105, "Migrate Azure ALM settings from PROPERTIES to ALM_SETTINGS tables", MigrateAzureAlmSettings.class) - .add(3106, "Delete 'sonar.pullrequest.provider' property", DeleteSonarPullRequestProviderProperty.class) - .add(3107, "Migrate default branches to keep global setting", MigrateDefaultBranchesToKeepSetting.class) - .add(3108, "Add EXCLUDE_FROM_PURGE column", AddExcludeBranchFromPurgeColumn.class) - .add(3109, "Populate EXCLUDE_FROM_PURGE column", PopulateExcludeBranchFromPurgeColumn.class) - .add(3110, "Remove 'sonar.branch.longLivedBranches.regex'", RemoveLLBRegexSetting.class) - .add(3111, "Rename 'sonar.dbcleaner.daysBeforeDeletingInactiveShortLivingBranches' setting", - RenameDaysBeforeDeletingInactiveSLBSetting.class) - .add(3112, "Migrate short and long living branches types to common BRANCH type", MigrateSlbsAndLlbsToCommonType.class) - .add(3113, "Migrate short and long living branches types to common BRANCH type in ce tasks table", - MigrateSlbsAndLlbsToCommonTypeInCeTasks.class) - ; - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v81/DeleteSonarPullRequestProviderProperty.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v81/DeleteSonarPullRequestProviderProperty.java deleted file mode 100644 index b5fd4fe1215..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v81/DeleteSonarPullRequestProviderProperty.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v81; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.step.DataChange; -import org.sonar.server.platform.db.migration.step.MassUpdate; - -public class DeleteSonarPullRequestProviderProperty extends DataChange { - - public DeleteSonarPullRequestProviderProperty(Database db) { - super(db); - } - - @Override - protected void execute(Context context) throws SQLException { - MassUpdate massUpdate = context.prepareMassUpdate(); - massUpdate.select("select id from properties where prop_key = ?") - .setString(1, "sonar.pullrequest.provider"); - massUpdate.update("delete from properties where id = ?"); - massUpdate.execute((row, handler) -> { - handler.setLong(1, row.getLong(1)); - return true; - }); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v81/MigrateAzureAlmSettings.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v81/MigrateAzureAlmSettings.java deleted file mode 100644 index bde1abf615e..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v81/MigrateAzureAlmSettings.java +++ /dev/null @@ -1,353 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v81; - -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.TreeSet; -import java.util.function.Function; -import java.util.stream.Collectors; -import javax.annotation.CheckForNull; -import javax.annotation.Nullable; -import org.sonar.api.utils.System2; -import org.sonar.core.util.UuidFactory; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.step.DataChange; -import org.sonar.server.platform.db.migration.step.MassUpdate; -import org.sonar.server.platform.db.migration.step.Select; -import org.sonar.server.platform.db.migration.step.SqlStatement; -import org.sonar.server.platform.db.migration.step.Upsert; - -public class MigrateAzureAlmSettings extends DataChange { - - private static final String PROVIDER = "sonar.pullrequest.provider"; - private static final String AZURE_TOKEN = "sonar.pullrequest.vsts.token.secured"; - private static final String PROVIDER_VALUE = "Azure DevOps"; - private static final String ALM_SETTING_ID = "azure_devops"; - - private static final String INSERT_SQL = "insert into project_alm_settings (uuid, project_uuid, alm_setting_uuid, created_at, updated_at) values (?, ?, ?, ?, ?)"; - private static final String DELETE_SQL = "delete from properties where prop_key = ? and resource_id=?"; - - private final UuidFactory uuidFactory; - private final System2 system2; - - public MigrateAzureAlmSettings(Database db, UuidFactory uuidFactory, System2 system2) { - super(db); - this.uuidFactory = uuidFactory; - this.system2 = system2; - } - - @Override - protected void execute(Context context) throws SQLException { - List tokens = loadTokens(context); - if (tokens.isEmpty()) { - return; - } - Map globalPropertiesByKey = loadGlobalProperties(context); - Map almSettingUuidByTokens = loadOrInsertAlmSettings(context, tokens); - - String globalProvider = getGlobalProperty(globalPropertiesByKey, PROVIDER); - String globalToken = getGlobalProperty(globalPropertiesByKey, AZURE_TOKEN); - - insertProjectAlmSettings(context, globalProvider, globalToken, almSettingUuidByTokens); - context.prepareUpsert("delete from properties where prop_key = ?") - .setString(1, AZURE_TOKEN) - .execute() - .commit(); - } - - @CheckForNull - private static String getGlobalProperty(Map globalPropertiesByKey, String propertyKey) { - Property globalProperty = globalPropertiesByKey.getOrDefault(propertyKey, null); - return globalProperty != null ? globalProperty.getValue() : null; - } - - private static Map loadGlobalProperties(Context context) throws SQLException { - return context - .prepareSelect("select prop_key, text_value from properties where prop_key in (?, ?) " + - "and resource_id is null " + - "and text_value is not null ") - .setString(1, PROVIDER) - .setString(2, AZURE_TOKEN) - .list(Property::new) - .stream() - .collect(Collectors.toMap(Property::getKey, Function.identity())); - } - - private static List loadTokens(Context context) throws SQLException { - return new ArrayList<>(context - .prepareSelect("select distinct text_value from properties where prop_key = ?") - .setString(1, AZURE_TOKEN) - .list(row -> row.getString(1))); - } - - private Map loadOrInsertAlmSettings(Context context, List tokens) throws SQLException { - Map almSettingUuidByTokens = loadExistingAlmSettingUuidByToken(context); - TreeSet tokensWithNoAlmSetting = new TreeSet<>(tokens); - tokensWithNoAlmSetting.removeAll(almSettingUuidByTokens.keySet()); - if (tokensWithNoAlmSetting.isEmpty()) { - return almSettingUuidByTokens; - } - int index = almSettingUuidByTokens.isEmpty() ? 0 : (almSettingUuidByTokens.size() + 1); - if (tokensWithNoAlmSetting.size() == 1) { - String token = tokensWithNoAlmSetting.first(); - String almSettingUuid = insertAlmSetting(context, token, index); - almSettingUuidByTokens.put(token, almSettingUuid); - return almSettingUuidByTokens; - } - for (String token : tokensWithNoAlmSetting) { - String almSettingUuid = insertAlmSetting(context, token, index); - almSettingUuidByTokens.put(token, almSettingUuid); - index++; - } - return almSettingUuidByTokens; - } - - private static Map loadExistingAlmSettingUuidByToken(Context context) throws SQLException { - Select select = context.prepareSelect("select uuid, pat from alm_settings where alm_id=?") - .setString(1, ALM_SETTING_ID); - return select - .list(row -> new AlmSetting(row.getString(1), row.getString(2))) - .stream() - .collect(Collectors.toMap(AlmSetting::getPersonalAccessToken, AlmSetting::getUuid)); - } - - private String insertAlmSetting(Context context, String token, int index) throws SQLException { - String almSettingUuid = uuidFactory.create(); - context.prepareUpsert("insert into alm_settings (uuid, alm_id, kee, pat, updated_at, created_at) values (?, ?, ?, ?, ?, ?)") - .setString(1, almSettingUuid) - .setString(2, ALM_SETTING_ID) - .setString(3, index == 0 ? PROVIDER_VALUE : (PROVIDER_VALUE + " " + index)) - .setString(4, token) - .setLong(5, system2.now()) - .setLong(6, system2.now()) - .execute() - .commit(); - return almSettingUuid; - } - - private void insertProjectAlmSettings(Context context, @Nullable String globalProvider, @Nullable String globalToken, - Map almSettingUuidByTokens) throws SQLException { - final Buffer buffer = new Buffer(globalProvider); - MassUpdate massUpdate = context.prepareMassUpdate(); - massUpdate.select("select prop_key, text_value, prj.uuid, prj.id from properties prop " + - "inner join projects prj on prj.id=prop.resource_id " + - "where prop.prop_key in (?, ?) " + - "order by prj.id asc") - .setString(1, PROVIDER) - .setString(2, AZURE_TOKEN); - massUpdate.update(INSERT_SQL); - massUpdate.update(DELETE_SQL); - massUpdate.execute((row, update, updateIndex) -> { - boolean shouldExecuteUpdate = false; - String projectUuid = row.getString(3); - Long projectId = row.getLong(4); - // Set last projectUuid the first time - if (buffer.getLastProjectUuid() == null) { - buffer.setLastProject(projectUuid, projectId); - } - - // When current projectUuid is different from last processed projectUuid, feed the prepared statement - if (!projectUuid.equals(buffer.getLastProjectUuid())) { - if (updateIndex == 0) { - // Insert new row in PROJECT_ALM_SETTINGS - shouldExecuteUpdate = updateStatementIfNeeded(buffer, buffer.getLastProjectUuid(), update, globalToken, almSettingUuidByTokens); - } else { - // Delete old property - shouldExecuteUpdate = deleteProperty(buffer.getLastProjectId(), buffer, update); - buffer.clear(); - // Update last projectUuid in buffer only when it has changed - buffer.setLastProject(projectUuid, projectId); - } - } - // Update remaining buffer values only once, and only after delete - if (updateIndex == 1) { - String propertyKey = row.getString(1); - String propertyValue = row.getString(2); - if (propertyKey.equals(PROVIDER)) { - buffer.setProvider(propertyValue); - } else if (propertyKey.equals(AZURE_TOKEN)) { - buffer.setToken(propertyValue); - } - buffer.setCurrentProject(projectUuid, projectId); - } - return shouldExecuteUpdate; - }); - String projectUuid = buffer.getCurrentProjectUuid(); - if (projectUuid == null) { - return; - } - // Process last entry - Upsert upsert = context.prepareUpsert(INSERT_SQL); - boolean shouldExecuteInsert = updateStatementIfNeeded(buffer, projectUuid, upsert, globalToken, almSettingUuidByTokens); - if (shouldExecuteInsert) { - upsert.execute().commit(); - } - if (buffer.shouldUpdate()) { - context.prepareUpsert(DELETE_SQL) - .setString(1, AZURE_TOKEN) - .setLong(2, buffer.getCurrentProjectId()) - .execute() - .commit(); - } - } - - private static boolean deleteProperty(long effectiveProjectId, Buffer buffer, SqlStatement update) throws SQLException { - if (buffer.shouldUpdate()) { - update.setString(1, AZURE_TOKEN); - update.setLong(2, effectiveProjectId); - return true; - } - return false; - } - - private boolean updateStatementIfNeeded(Buffer buffer, String projectUuid, SqlStatement update, @Nullable String globalToken, - Map almSettingUuidByTokens) - throws SQLException { - String token = buffer.getToken(); - String almSettingUuid = token == null ? almSettingUuidByTokens.get(globalToken) : almSettingUuidByTokens.get(token); - if (!buffer.shouldUpdate() || almSettingUuid == null) { - return false; - } - update.setString(1, uuidFactory.create()); - update.setString(2, projectUuid); - update.setString(3, almSettingUuid); - update.setLong(4, system2.now()); - update.setLong(5, system2.now()); - return true; - } - - private static class AlmSetting { - private final String uuid; - private final String personalAccessToken; - - AlmSetting(String uuid, String personalAccessToken) { - this.uuid = uuid; - this.personalAccessToken = personalAccessToken; - } - - String getUuid() { - return uuid; - } - - String getPersonalAccessToken() { - return personalAccessToken; - } - } - - private static class Property { - private final String key; - private final String value; - - Property(Select.Row row) throws SQLException { - this.key = row.getString(1); - this.value = row.getString(2); - } - - String getKey() { - return key; - } - - String getValue() { - return value; - } - } - - private static class Buffer { - private final String globalProvider; - private String lastProjectUuid; - private String currentProjectUuid; - private Long lastProjectId; - private Long currentProjectId; - private String provider; - private String token; - - private Buffer(@Nullable String globalProvider) { - this.globalProvider = globalProvider; - } - - Buffer setLastProject(@Nullable String projectUuid, @Nullable Long projectId) { - this.lastProjectUuid = projectUuid; - this.lastProjectId = projectId; - return this; - } - - @CheckForNull - String getLastProjectUuid() { - return lastProjectUuid; - } - - @CheckForNull - Long getLastProjectId() { - return lastProjectId; - } - - Buffer setCurrentProject(@Nullable String projectUuid, @Nullable Long projectId) { - this.currentProjectUuid = projectUuid; - this.currentProjectId = projectId; - return this; - } - - @CheckForNull - String getCurrentProjectUuid() { - return currentProjectUuid; - } - - @CheckForNull - Long getCurrentProjectId() { - return currentProjectId; - } - - Buffer setProvider(@Nullable String provider) { - this.provider = provider; - return this; - } - - @CheckForNull - String getToken() { - return token; - } - - Buffer setToken(@Nullable String token) { - this.token = token; - return this; - } - - boolean shouldUpdate() { - if (provider != null) { - return provider.equals(PROVIDER_VALUE); - } - return Objects.equals(globalProvider, PROVIDER_VALUE); - } - - void clear() { - this.lastProjectUuid = null; - this.currentProjectUuid = null; - this.lastProjectId = null; - this.currentProjectId = null; - this.provider = null; - this.token = null; - } - } - -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v81/MigrateBitbucketAlmSettings.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v81/MigrateBitbucketAlmSettings.java deleted file mode 100644 index c4abd3d9843..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v81/MigrateBitbucketAlmSettings.java +++ /dev/null @@ -1,362 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v81; - -import com.google.common.collect.ImmutableSet; -import java.sql.SQLException; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import java.util.function.Function; -import java.util.stream.Collectors; -import javax.annotation.CheckForNull; -import javax.annotation.Nullable; -import org.sonar.api.utils.System2; -import org.sonar.core.util.UuidFactory; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.step.DataChange; -import org.sonar.server.platform.db.migration.step.MassUpdate; -import org.sonar.server.platform.db.migration.step.Select; -import org.sonar.server.platform.db.migration.step.SqlStatement; -import org.sonar.server.platform.db.migration.step.Upsert; - -public class MigrateBitbucketAlmSettings extends DataChange { - - private static final String PROVIDER = "sonar.pullrequest.provider"; - - // Global settings - private static final String BITBUCKET_SERVER_URL = "sonar.pullrequest.bitbucketserver.serverUrl"; - private static final String BITBUCKET_TOKEN = "sonar.pullrequest.bitbucketserver.token.secured"; - // Project setting - private static final String BITBUCKET_PROJECT = "sonar.pullrequest.bitbucketserver.project"; - private static final String BITBUCKET_REPOSITORY = "sonar.pullrequest.bitbucketserver.repository"; - - private static final Set MANDATORY_GLOBAL_KEYS = ImmutableSet.of(BITBUCKET_SERVER_URL, BITBUCKET_TOKEN); - - private static final String PROVIDER_VALUE = "Bitbucket Server"; - - private static final String ALM_SETTING_BITBUCKET_ID = "bitbucket"; - - private static final String INSERT_SQL = "insert into project_alm_settings (uuid, project_uuid, alm_setting_uuid, alm_repo, alm_slug, created_at, updated_at) values " + - "(?, ?, ?, ?, ?, ?, ?)"; - private static final String DELETE_SQL = "delete from properties where prop_key in (?, ?) and resource_id=?"; - - private final UuidFactory uuidFactory; - private final System2 system2; - - public MigrateBitbucketAlmSettings(Database db, UuidFactory uuidFactory, System2 system2) { - super(db); - this.uuidFactory = uuidFactory; - this.system2 = system2; - } - - @Override - protected void execute(Context context) throws SQLException { - Map globalPropertiesByKey = loadGlobalProperties(context); - - if (globalPropertiesByKey.keySet().containsAll(MANDATORY_GLOBAL_KEYS)) { - String almSettingUuid = loadOrInsertAlmSetting(context, globalPropertiesByKey); - Property globalProviderProperty = globalPropertiesByKey.getOrDefault(PROVIDER, null); - String globalProvider = globalProviderProperty != null ? globalProviderProperty.getValue() : null; - - insertProjectAlmSettings(context, globalProvider, almSettingUuid); - } - context.prepareUpsert("delete from properties where prop_key in (?, ?, ?, ?)") - .setString(1, BITBUCKET_SERVER_URL) - .setString(2, BITBUCKET_TOKEN) - .setString(3, BITBUCKET_PROJECT) - .setString(4, BITBUCKET_REPOSITORY) - .execute() - .commit(); - } - - private static Map loadGlobalProperties(Context context) throws SQLException { - return context - .prepareSelect("select id, prop_key, text_value from properties where prop_key in (?, ?, ?) " + - "and resource_id is null " + - "and text_value is not null ") - .setString(1, PROVIDER) - .setString(2, BITBUCKET_SERVER_URL) - .setString(3, BITBUCKET_TOKEN) - .list(Property::new) - .stream() - .collect(Collectors.toMap(Property::getKey, Function.identity())); - } - - private String loadOrInsertAlmSetting(Context context, Map globalPropertiesByKey) throws SQLException { - String almSettingUuid = loadAlmSetting(context); - if (almSettingUuid != null) { - return almSettingUuid; - } - return insertAlmSetting(context, globalPropertiesByKey); - } - - @CheckForNull - private static String loadAlmSetting(Context context) throws SQLException { - List list = context.prepareSelect("select uuid from alm_settings where alm_id=?") - .setString(1, ALM_SETTING_BITBUCKET_ID) - .list(row -> row.getString(1)); - if (list.isEmpty()) { - return null; - } - return list.get(0); - } - - private String insertAlmSetting(Context context, Map globalPropertiesByKey) throws SQLException { - String almSettingUuid = uuidFactory.create(); - context.prepareUpsert("insert into alm_settings (uuid, alm_id, kee, url, pat, updated_at, created_at) values (?, ?, ?, ?, ?, ?, ?)") - .setString(1, almSettingUuid) - .setString(2, ALM_SETTING_BITBUCKET_ID) - .setString(3, PROVIDER_VALUE) - .setString(4, globalPropertiesByKey.get(BITBUCKET_SERVER_URL).getValue()) - .setString(5, globalPropertiesByKey.get(BITBUCKET_TOKEN).getValue()) - .setLong(6, system2.now()) - .setLong(7, system2.now()) - .execute() - .commit(); - return almSettingUuid; - } - - private void insertProjectAlmSettings(Context context, @Nullable String globalProvider, String almSettingUuid) throws SQLException { - final Buffer buffer = new Buffer(globalProvider); - MassUpdate massUpdate = context.prepareMassUpdate(); - massUpdate.select("select prop_key, text_value, prj.uuid, prj.id from properties prop " + - "inner join projects prj on prj.id=prop.resource_id " + - "where prop.prop_key in (?, ?, ?) " + - "order by prj.id asc") - .setString(1, PROVIDER) - .setString(2, BITBUCKET_PROJECT) - .setString(3, BITBUCKET_REPOSITORY); - massUpdate.update(INSERT_SQL); - massUpdate.update(DELETE_SQL); - massUpdate.execute((row, update, updateIndex) -> { - boolean shouldExecuteUpdate = false; - String projectUuid = row.getString(3); - Long projectId = row.getLong(4); - // Set last projectUuid the first time - if (buffer.getLastProjectUuid() == null) { - buffer.setLastProject(projectUuid, projectId); - } - - // When current projectUuid is different from last processed projectUuid, feed the prepared statement - if (!projectUuid.equals(buffer.getLastProjectUuid())) { - if (updateIndex == 0) { - // Insert new row in PROJECT_ALM_SETTINGS - shouldExecuteUpdate = updateStatementIfNeeded(buffer, buffer.getLastProjectUuid(), update, almSettingUuid); - } else { - // Delete old property - shouldExecuteUpdate = deleteProperty(buffer.getLastProjectId(), buffer, update); - buffer.clear(); - // Update last projectUuid in buffer only when it has changed - buffer.setLastProject(projectUuid, projectId); - } - } - // Update remaining buffer values only once, and only after delete - if (updateIndex == 1) { - String propertyKey = row.getString(1); - String propertyValue = row.getString(2); - switch (propertyKey) { - case PROVIDER: - buffer.setProvider(propertyValue); - break; - case BITBUCKET_PROJECT: - buffer.setRepository(propertyValue); - break; - case BITBUCKET_REPOSITORY: - buffer.setSlug(propertyValue); - break; - default: - throw new IllegalStateException("Provider " + propertyKey + " is unknown"); - } - buffer.setCurrentProject(projectUuid, projectId); - } - return shouldExecuteUpdate; - }); - String projectUuid = buffer.getCurrentProjectUuid(); - if (projectUuid == null) { - return; - } - // Process last entry - Upsert upsert = context.prepareUpsert(INSERT_SQL); - if (updateStatementIfNeeded(buffer, projectUuid, upsert, almSettingUuid)) { - upsert.execute().commit(); - } - if (buffer.shouldDelete()) { - context.prepareUpsert(DELETE_SQL) - .setString(1, BITBUCKET_PROJECT) - .setString(2, BITBUCKET_REPOSITORY) - .setLong(3, buffer.getCurrentProjectId()) - .execute() - .commit(); - } - } - - private static boolean deleteProperty(long effectiveProjectId, Buffer buffer, SqlStatement update) throws SQLException { - if (buffer.shouldDelete()) { - update.setString(1, BITBUCKET_PROJECT); - update.setString(2, BITBUCKET_REPOSITORY); - update.setLong(3, effectiveProjectId); - return true; - } - return false; - } - - private boolean updateStatementIfNeeded(Buffer buffer, String effectiveProjectUuid, SqlStatement update, String almSettingUuid) - throws SQLException { - String repository = buffer.getRepository(); - String slug = buffer.getSlug(); - if (!buffer.shouldUpdate()) { - return false; - } - update.setString(1, uuidFactory.create()); - update.setString(2, effectiveProjectUuid); - update.setString(3, almSettingUuid); - update.setString(4, repository); - update.setString(5, slug); - update.setLong(6, system2.now()); - update.setLong(7, system2.now()); - return true; - } - - private static class Property { - private final long id; - private final String key; - private final String value; - - Property(Select.Row row) throws SQLException { - this.id = row.getLong(1); - this.key = row.getString(2); - this.value = row.getString(3); - } - - public long getId() { - return id; - } - - public String getKey() { - return key; - } - - public String getValue() { - return value; - } - } - - private static class Buffer { - private final String globalProvider; - private String lastProjectUuid; - private String currentProjectUuid; - private Long lastProjectId; - private Long currentProjectId; - private String provider; - private String repository; - private String slug; - - private Buffer(@Nullable String globalProvider) { - this.globalProvider = globalProvider; - } - - Buffer setLastProject(@Nullable String projectUuid, @Nullable Long projectId) { - this.lastProjectUuid = projectUuid; - this.lastProjectId = projectId; - return this; - } - - @CheckForNull - String getLastProjectUuid() { - return lastProjectUuid; - } - - @CheckForNull - Long getLastProjectId() { - return lastProjectId; - } - - Buffer setCurrentProject(@Nullable String projectUuid, @Nullable Long projectId) { - this.currentProjectUuid = projectUuid; - this.currentProjectId = projectId; - return this; - } - - @CheckForNull - String getCurrentProjectUuid() { - return currentProjectUuid; - } - - @CheckForNull - Long getCurrentProjectId() { - return currentProjectId; - } - - Buffer setProvider(@Nullable String provider) { - this.provider = provider; - return this; - } - - @CheckForNull - String getRepository() { - return repository; - } - - Buffer setRepository(@Nullable String repository) { - this.repository = repository; - return this; - } - - @CheckForNull - String getSlug() { - return slug; - } - - Buffer setSlug(@Nullable String slug) { - this.slug = slug; - return this; - } - - boolean shouldUpdate() { - if (repository == null || slug == null) { - return false; - } - if (Objects.equals(provider, PROVIDER_VALUE)) { - return true; - } - return provider == null && Objects.equals(globalProvider, PROVIDER_VALUE); - } - - boolean shouldDelete() { - if (provider != null) { - return provider.equals(PROVIDER_VALUE); - } - return Objects.equals(globalProvider, PROVIDER_VALUE); - } - - void clear() { - this.lastProjectUuid = null; - this.currentProjectUuid = null; - this.lastProjectId = null; - this.currentProjectId = null; - this.provider = null; - this.repository = null; - this.slug = null; - } - } - -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v81/MigrateDefaultBranchesToKeepSetting.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v81/MigrateDefaultBranchesToKeepSetting.java deleted file mode 100644 index ab9c6635b03..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v81/MigrateDefaultBranchesToKeepSetting.java +++ /dev/null @@ -1,106 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v81; - -import java.sql.SQLException; -import org.sonar.api.utils.System2; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.SupportsBlueGreen; -import org.sonar.server.platform.db.migration.step.DataChange; -import org.sonar.server.platform.db.migration.step.MassUpdate; - -import static java.lang.Boolean.FALSE; -import static java.lang.Boolean.TRUE; - -@SupportsBlueGreen -public class MigrateDefaultBranchesToKeepSetting extends DataChange { - private static final Logger LOG = Loggers.get(MigrateDefaultBranchesToKeepSetting.class); - private static final String DEPRECATED_KEY = "sonar.branch.longLivedBranches.regex"; - private static final String NEW_KEY = "sonar.dbcleaner.branchesToKeepWhenInactive"; - - private final System2 system; - - public MigrateDefaultBranchesToKeepSetting(Database db, System2 system) { - super(db); - this.system = system; - } - - @Override - protected void execute(Context context) throws SQLException { - Long now = system.now(); - try { - Long numberOfNewProps = context.prepareSelect("select count(*) from properties props where props.prop_key = '" + NEW_KEY + "'") - .get(row -> row.getLong(1)); - if (numberOfNewProps != null && numberOfNewProps > 0) { - // no need for a migration - return; - } - - Boolean defaultPropertyOverridden = context.prepareSelect("select count(*) from properties props where props.prop_key = '" + DEPRECATED_KEY + "'") - .get(row -> row.getLong(1) > 0); - if (FALSE.equals(defaultPropertyOverridden)) { - migrateDefaultDeprecatedSettings(context, now); - } else { - migrateOverriddenDeprecatedSettings(context, now); - } - } catch (Exception ex) { - LOG.error("Failed to migrate to new '{}' setting.", NEW_KEY); - throw ex; - } - } - - private static void migrateDefaultDeprecatedSettings(Context context, Long time) throws SQLException { - Boolean anyProjectAlreadyExists = context.prepareSelect("select count(*) from projects").get(row -> row.getLong(1) > 0); - String newSettingValue = "master,develop,trunk"; - - // if old `sonar.branch.longLivedBranches.regex` setting was at default value but there were already projects analyzed we need to add the - // old defaults of - // that setting to the defaults of the new `sonar.dbcleaner.branchesToKeepWhenInactive` setting for backward compatibility - if (TRUE.equals(anyProjectAlreadyExists)) { - newSettingValue = "master,develop,trunk,branch-.*,release-.*"; - } - - context - .prepareUpsert("insert into properties (prop_key, is_empty, text_value, created_at) values (?, ?, ?, ?)") - .setString(1, NEW_KEY) - .setBoolean(2, false) - .setString(3, newSettingValue) - .setLong(4, time) - .execute() - .commit(); - } - - private static void migrateOverriddenDeprecatedSettings(Context context, Long time) throws SQLException { - MassUpdate massUpdate = context.prepareMassUpdate(); - massUpdate.select("select resource_id, text_value from properties props where props.prop_key = '" + DEPRECATED_KEY + "'"); - massUpdate.rowPluralName("properties"); - massUpdate.update("insert into properties (resource_id, prop_key, is_empty, text_value, created_at) values (?, ?, ?, ?, ?)"); - massUpdate.execute((row, update) -> { - update.setLong(1, row.getNullableLong(1)); - update.setString(2, NEW_KEY); - update.setBoolean(3, false); - update.setString(4, row.getString(2)); - update.setLong(5, time); - return true; - }); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v81/MigrateDeprecatedGithubPrivateKeyToNewKey.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v81/MigrateDeprecatedGithubPrivateKeyToNewKey.java deleted file mode 100644 index 93e0ff7dba0..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v81/MigrateDeprecatedGithubPrivateKeyToNewKey.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v81; - -import java.sql.SQLException; -import java.util.Base64; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.step.DataChange; -import org.sonar.server.platform.db.migration.step.MassUpdate; -import org.sonar.server.platform.db.migration.step.Select; - -import static java.nio.charset.StandardCharsets.UTF_8; - -public class MigrateDeprecatedGithubPrivateKeyToNewKey extends DataChange { - - private static final String OLD_KEY = "sonar.alm.github.app.privateKey.secured"; - private static final String NEW_KEY = "sonar.alm.github.app.privateKeyContent.secured"; - - public MigrateDeprecatedGithubPrivateKeyToNewKey(Database db) { - super(db); - } - - @Override - protected void execute(Context context) throws SQLException { - Long newPropertyId = context.prepareSelect("select id from properties where prop_key = ?") - .setString(1, NEW_KEY) - .get(Select.LONG_READER); - if (newPropertyId != null) { - context.prepareUpsert("delete from properties where prop_key = ? ") - .setString(1, OLD_KEY) - .execute() - .commit(); - return; - } - MassUpdate massUpdate = context.prepareMassUpdate(); - massUpdate.select("select id, text_value from properties where prop_key = ?") - .setString(1, OLD_KEY); - massUpdate.update("update properties set prop_key = ?, text_value = ? where id = ?"); - massUpdate.execute((row, handler) -> { - String propertyEncodedInBAse64 = row.getString(2); - String propertyDecoded = new String(Base64.getDecoder().decode(propertyEncodedInBAse64), UTF_8); - handler.setString(1, NEW_KEY); - handler.setString(2, propertyDecoded); - handler.setLong(3, row.getLong(1)); - return true; - }); - } - -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v81/MigrateGithubAlmSettings.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v81/MigrateGithubAlmSettings.java deleted file mode 100644 index 7a104dc6037..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v81/MigrateGithubAlmSettings.java +++ /dev/null @@ -1,335 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v81; - -import com.google.common.collect.ImmutableSet; -import java.sql.SQLException; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import java.util.function.Function; -import java.util.stream.Collectors; -import javax.annotation.CheckForNull; -import javax.annotation.Nullable; -import org.sonar.api.utils.System2; -import org.sonar.core.util.UuidFactory; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.step.DataChange; -import org.sonar.server.platform.db.migration.step.MassUpdate; -import org.sonar.server.platform.db.migration.step.Select; -import org.sonar.server.platform.db.migration.step.SqlStatement; -import org.sonar.server.platform.db.migration.step.Upsert; - -public class MigrateGithubAlmSettings extends DataChange { - - private static final String PROVIDER = "sonar.pullrequest.provider"; - - // Global settings - private static final String GITHUB_ENDPOINT = "sonar.pullrequest.github.endpoint"; - private static final String GITHUB_APP_ID = "sonar.alm.github.app.id"; - private static final String GITHUB_APP_PRIVATE_KEY = "sonar.alm.github.app.privateKeyContent.secured"; - private static final String GITHUB_APP_NAME = "sonar.alm.github.app.name"; - // Project setting - private static final String GITHUB_REPOSITORY = "sonar.pullrequest.github.repository"; - - private static final Set MANDATORY_GLOBAL_KEYS = ImmutableSet.of(GITHUB_ENDPOINT, GITHUB_APP_ID, GITHUB_APP_PRIVATE_KEY); - - private static final String PROVIDER_VALUE = "GitHub"; - - private static final String ALM_SETTING_GITHUB_ID = "github"; - - private static final String INSERT_SQL = "insert into project_alm_settings (uuid, project_uuid, alm_setting_uuid, alm_repo, created_at, updated_at) values (?, ?, ?, ?, ?, ?)"; - private static final String DELETE_SQL = "delete from properties where prop_key = ? and resource_id = ?"; - - private final UuidFactory uuidFactory; - private final System2 system2; - - public MigrateGithubAlmSettings(Database db, UuidFactory uuidFactory, System2 system2) { - super(db); - this.uuidFactory = uuidFactory; - this.system2 = system2; - } - - @Override - protected void execute(Context context) throws SQLException { - Map globalPropertiesByKey = loadGlobalProperties(context); - - if (globalPropertiesByKey.keySet().containsAll(MANDATORY_GLOBAL_KEYS)) { - String gitHubAlmSettingUuid = loadOrInsertAlmSetting(context, globalPropertiesByKey); - Property globalProviderProperty = globalPropertiesByKey.getOrDefault(PROVIDER, null); - String globalProvider = globalProviderProperty != null ? globalProviderProperty.getValue() : null; - - insertProjectAlmSettings(context, globalProvider, gitHubAlmSettingUuid); - } - - context.prepareUpsert("delete from properties where prop_key in (?, ?, ?, ?, ?)") - .setString(1, GITHUB_ENDPOINT) - .setString(2, GITHUB_APP_ID) - .setString(3, GITHUB_APP_PRIVATE_KEY) - .setString(4, GITHUB_APP_NAME) - .setString(5, GITHUB_REPOSITORY) - .execute() - .commit(); - } - - private static Map loadGlobalProperties(Context context) throws SQLException { - return context - .prepareSelect("select prop_key, text_value from properties where prop_key in (?, ?, ?, ?, ?) " + - "and resource_id is null " + - "and text_value is not null ") - .setString(1, PROVIDER) - .setString(2, GITHUB_ENDPOINT) - .setString(3, GITHUB_APP_ID) - .setString(4, GITHUB_APP_PRIVATE_KEY) - .setString(5, GITHUB_APP_NAME) - .list(Property::new) - .stream() - .collect(Collectors.toMap(Property::getKey, Function.identity())); - } - - private String loadOrInsertAlmSetting(Context context, Map globalPropertiesByKey) throws SQLException { - String gitHubAlmSettingUuid = loadAlmSetting(context); - if (gitHubAlmSettingUuid != null) { - return gitHubAlmSettingUuid; - } - return insertAlmSetting(context, globalPropertiesByKey); - } - - @CheckForNull - private static String loadAlmSetting(Context context) throws SQLException { - List list = context.prepareSelect("select uuid from alm_settings where alm_id=?") - .setString(1, ALM_SETTING_GITHUB_ID) - .list(row -> row.getString(1)); - if (list.isEmpty()) { - return null; - } - return list.get(0); - } - - private String insertAlmSetting(Context context, Map globalPropertiesByKey) throws SQLException { - String gitHubAlmSettingUuid = uuidFactory.create(); - Property appName = globalPropertiesByKey.get(GITHUB_APP_NAME); - context.prepareUpsert("insert into alm_settings (uuid, alm_id, kee, url, app_id, private_key, updated_at, created_at) values (?, ?, ?, ?, ?, ?, ?, ?)") - .setString(1, gitHubAlmSettingUuid) - .setString(2, ALM_SETTING_GITHUB_ID) - .setString(3, appName == null ? PROVIDER_VALUE : appName.getValue()) - .setString(4, globalPropertiesByKey.get(GITHUB_ENDPOINT).getValue()) - .setString(5, globalPropertiesByKey.get(GITHUB_APP_ID).getValue()) - .setString(6, globalPropertiesByKey.get(GITHUB_APP_PRIVATE_KEY).getValue()) - .setLong(7, system2.now()) - .setLong(8, system2.now()) - .execute() - .commit(); - return gitHubAlmSettingUuid; - } - - private void insertProjectAlmSettings(Context context, @Nullable String globalProvider, String almSettingUuid) throws SQLException { - final Buffer buffer = new Buffer(globalProvider); - MassUpdate massUpdate = context.prepareMassUpdate(); - massUpdate.select("select prop_key, text_value, prj.uuid, prj.id from properties prop " + - "inner join projects prj on prj.id=prop.resource_id " + - "where prop.prop_key in (?, ?) " + - "order by prj.id asc") - .setString(1, PROVIDER) - .setString(2, GITHUB_REPOSITORY); - massUpdate.update(INSERT_SQL); - massUpdate.update(DELETE_SQL); - massUpdate.execute((row, update, updateIndex) -> { - boolean shouldExecuteUpdate = false; - String projectUuid = row.getString(3); - Long projectId = row.getLong(4); - // Set last projectUuid the first time - if (buffer.getLastProjectUuid() == null) { - buffer.setLastProject(projectUuid, projectId); - } - // When current projectUuid is different from last processed projectUuid, feed the prepared statement - if (!projectUuid.equals(buffer.getLastProjectUuid())) { - if (updateIndex == 0) { - // Insert new row in PROJECT_ALM_SETTINGS - shouldExecuteUpdate = updateStatementIfNeeded(buffer.getLastProjectUuid(), buffer, update, almSettingUuid); - } else { - // Delete old property - shouldExecuteUpdate = deleteProperty(buffer.getLastProjectId(), buffer, update); - buffer.clear(); - // Update last projectUuid in buffer only when it has changed - buffer.setLastProject(projectUuid, projectId); - } - } - // Update remaining buffer values only once, and only after delete - if (updateIndex == 1) { - String propertyKey = row.getString(1); - String propertyValue = row.getString(2); - if (propertyKey.equals(PROVIDER)) { - buffer.setProvider(propertyValue); - } else if (propertyKey.equals(GITHUB_REPOSITORY)) { - buffer.setRepository(propertyValue); - } - buffer.setCurrentProject(projectUuid, projectId); - } - return shouldExecuteUpdate; - }); - String projectUuid = buffer.getCurrentProjectUuid(); - if (projectUuid == null) { - return; - } - // Process last entry - Upsert upsert = context.prepareUpsert(INSERT_SQL); - if (updateStatementIfNeeded(projectUuid, buffer, upsert, almSettingUuid)) { - upsert.execute().commit(); - } - if (buffer.shouldDelete()) { - context.prepareUpsert(DELETE_SQL) - .setString(1, GITHUB_REPOSITORY) - .setLong(2, buffer.getCurrentProjectId()) - .execute() - .commit(); - } - } - - private static boolean deleteProperty(long effectiveProjectId, Buffer buffer, SqlStatement update) throws SQLException { - if (buffer.shouldDelete()) { - update.setString(1, GITHUB_REPOSITORY); - update.setLong(2, effectiveProjectId); - return true; - } - return false; - } - - private boolean updateStatementIfNeeded(String effectiveProjectUuid, Buffer buffer, SqlStatement update, String almSettingUuid) - throws SQLException { - if (!buffer.shouldUpdate()) { - return false; - } - update.setString(1, uuidFactory.create()); - update.setString(2, effectiveProjectUuid); - update.setString(3, almSettingUuid); - update.setString(4, buffer.getRepository()); - update.setLong(5, system2.now()); - update.setLong(6, system2.now()); - return true; - } - - private static class Property { - private final String key; - private final String value; - - Property(Select.Row row) throws SQLException { - this.key = row.getString(1); - this.value = row.getString(2); - } - - String getKey() { - return key; - } - - String getValue() { - return value; - } - } - - private static class Buffer { - private final String globalProvider; - private String lastProjectUuid; - private String currentProjectUuid; - private Long lastProjectId; - private Long currentProjectId; - private String provider; - private String repository; - - public Buffer(@Nullable String globalProvider) { - this.globalProvider = globalProvider; - } - - Buffer setLastProject(@Nullable String projectUuid, @Nullable Long projectId) { - this.lastProjectUuid = projectUuid; - this.lastProjectId = projectId; - return this; - } - - @CheckForNull - String getLastProjectUuid() { - return lastProjectUuid; - } - - @CheckForNull - Long getLastProjectId() { - return lastProjectId; - } - - Buffer setCurrentProject(@Nullable String projectUuid, @Nullable Long projectId) { - this.currentProjectUuid = projectUuid; - this.currentProjectId = projectId; - return this; - } - - @CheckForNull - String getCurrentProjectUuid() { - return currentProjectUuid; - } - - @CheckForNull - Long getCurrentProjectId() { - return currentProjectId; - } - - Buffer setProvider(@Nullable String provider) { - this.provider = provider; - return this; - } - - @CheckForNull - String getRepository() { - return repository; - } - - Buffer setRepository(@Nullable String repository) { - this.repository = repository; - return this; - } - - boolean shouldUpdate() { - if (repository == null) { - return false; - } - if (Objects.equals(provider, PROVIDER_VALUE)) { - return true; - } - return provider == null && Objects.equals(globalProvider, PROVIDER_VALUE); - } - - boolean shouldDelete() { - if (provider != null) { - return provider.equals(PROVIDER_VALUE); - } - return Objects.equals(globalProvider, PROVIDER_VALUE); - } - - void clear() { - this.lastProjectUuid = null; - this.currentProjectUuid = null; - this.lastProjectId = null; - this.currentProjectId = null; - this.provider = null; - this.repository = null; - } - } - -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v81/MigrateSlbsAndLlbsToCommonType.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v81/MigrateSlbsAndLlbsToCommonType.java deleted file mode 100644 index cb0ead3e85f..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v81/MigrateSlbsAndLlbsToCommonType.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v81; - -import java.sql.SQLException; -import org.sonar.api.utils.System2; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.SupportsBlueGreen; -import org.sonar.server.platform.db.migration.step.DataChange; - -@SupportsBlueGreen -public class MigrateSlbsAndLlbsToCommonType extends DataChange { - private final System2 system; - - public MigrateSlbsAndLlbsToCommonType(Database db, System2 system) { - super(db); - this.system = system; - } - - @Override - protected void execute(Context context) throws SQLException { - long now = system.now(); - - context.prepareUpsert("update project_branches set branch_type = 'BRANCH', updated_at=? where branch_type = 'SHORT' or branch_type = 'LONG'") - .setLong(1, now) - .execute() - .commit(); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v81/MigrateSlbsAndLlbsToCommonTypeInCeTasks.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v81/MigrateSlbsAndLlbsToCommonTypeInCeTasks.java deleted file mode 100644 index 8e5d7832212..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v81/MigrateSlbsAndLlbsToCommonTypeInCeTasks.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v81; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.SupportsBlueGreen; -import org.sonar.server.platform.db.migration.step.DataChange; - -@SupportsBlueGreen -public class MigrateSlbsAndLlbsToCommonTypeInCeTasks extends DataChange { - static final String TABLE = "ce_task_characteristics"; - - public MigrateSlbsAndLlbsToCommonTypeInCeTasks(Database db) { - super(db); - } - - @Override - protected void execute(Context context) throws SQLException { - context.prepareUpsert("update " + TABLE + " set text_value = 'BRANCH' where kee = 'branchType' and text_value in ('LONG', 'SHORT')") - .execute() - .commit(); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v81/PopulateExcludeBranchFromPurgeColumn.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v81/PopulateExcludeBranchFromPurgeColumn.java deleted file mode 100644 index 6474a9e3833..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v81/PopulateExcludeBranchFromPurgeColumn.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v81; - -import java.sql.SQLException; -import org.sonar.api.utils.System2; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.SupportsBlueGreen; -import org.sonar.server.platform.db.migration.step.DataChange; - -@SupportsBlueGreen -public class PopulateExcludeBranchFromPurgeColumn extends DataChange { - private final System2 system; - - public PopulateExcludeBranchFromPurgeColumn(Database db, System2 system) { - super(db); - this.system = system; - } - - @Override - public void execute(Context context) throws SQLException { - Long now = system.now(); - context.prepareUpsert("update project_branches set exclude_from_purge = ?, updated_at = ? where branch_type = ?") - .setBoolean(1, true) - .setLong(2, now) - .setString(3, "LONG") - .execute() - .commit(); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v81/RemoveLLBRegexSetting.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v81/RemoveLLBRegexSetting.java deleted file mode 100644 index 0857f2cf101..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v81/RemoveLLBRegexSetting.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v81; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.SupportsBlueGreen; -import org.sonar.server.platform.db.migration.step.DataChange; - -@SupportsBlueGreen -public class RemoveLLBRegexSetting extends DataChange { - - public RemoveLLBRegexSetting(Database db) { - super(db); - } - - @Override - protected void execute(Context context) throws SQLException { - context.prepareUpsert("delete from properties where prop_key='sonar.branch.longLivedBranches.regex'") - .execute() - .commit(); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v81/RemoveNewsboxDismissHotspotsProperty.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v81/RemoveNewsboxDismissHotspotsProperty.java deleted file mode 100644 index 7bcdf01d684..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v81/RemoveNewsboxDismissHotspotsProperty.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v81; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.step.DataChange; - -public class RemoveNewsboxDismissHotspotsProperty extends DataChange { - - public RemoveNewsboxDismissHotspotsProperty(Database db) { - super(db); - } - - @Override - protected void execute(Context context) throws SQLException { - context.prepareUpsert("delete from user_properties where kee='newsbox.dismiss.hotspots'") - .execute() - .commit(); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v81/RenameDaysBeforeDeletingInactiveSLBSetting.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v81/RenameDaysBeforeDeletingInactiveSLBSetting.java deleted file mode 100644 index d6be247387f..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v81/RenameDaysBeforeDeletingInactiveSLBSetting.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v81; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.SupportsBlueGreen; -import org.sonar.server.platform.db.migration.step.DataChange; - -@SupportsBlueGreen -public class RenameDaysBeforeDeletingInactiveSLBSetting extends DataChange { - static final String TABLE = "properties"; - static final String OLD_PROPERTY_NAME = "sonar.dbcleaner.daysBeforeDeletingInactiveShortLivingBranches"; - static final String NEW_PROPERTY_NAME = "sonar.dbcleaner.daysBeforeDeletingInactiveBranchesAndPRs"; - - public RenameDaysBeforeDeletingInactiveSLBSetting(Database db) { - super(db); - } - - @Override - protected void execute(Context context) throws SQLException { - context.prepareUpsert("update " + TABLE + " set prop_key='" + NEW_PROPERTY_NAME + "' where prop_key='" + OLD_PROPERTY_NAME + "'") - .execute() - .commit(); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v81/package-info.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v81/package-info.java deleted file mode 100644 index 9150f9723b2..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v81/package-info.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v81; - -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v82/AddIndexOnSlugOfProjectAlmSettings.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v82/AddIndexOnSlugOfProjectAlmSettings.java deleted file mode 100644 index cfa57b122dd..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v82/AddIndexOnSlugOfProjectAlmSettings.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v82; - -import java.sql.Connection; -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.db.DatabaseUtils; -import org.sonar.server.platform.db.migration.sql.CreateIndexBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder; - -public class AddIndexOnSlugOfProjectAlmSettings extends DdlChange { - - private static final String TABLE_NAME = "project_alm_settings"; - private static final String INDEX_NAME = "project_alm_settings_slug"; - - public AddIndexOnSlugOfProjectAlmSettings(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - if (indexExists()) { - return; - } - - CreateIndexBuilder builder = new CreateIndexBuilder() - .setTable(TABLE_NAME) - .addColumn(newVarcharColumnDefBuilder() - .setColumnName("alm_slug") - .setIsNullable(true) - .setLimit(256) - .build()) - .setName(INDEX_NAME) - .setUnique(false); - - context.execute(builder.build()); - } - - private boolean indexExists() throws SQLException { - try (Connection connection = getDatabase().getDataSource().getConnection()) { - return DatabaseUtils.indexExistsIgnoreCase(TABLE_NAME, INDEX_NAME, connection); - } - } - -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v82/CreateAlmPatsTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v82/CreateAlmPatsTable.java deleted file mode 100644 index 4cd963d865d..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v82/CreateAlmPatsTable.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v82; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.def.VarcharColumnDef; -import org.sonar.server.platform.db.migration.sql.CreateIndexBuilder; -import org.sonar.server.platform.db.migration.sql.CreateTableBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.sonar.server.platform.db.migration.def.BigIntegerColumnDef.newBigIntegerColumnDefBuilder; -import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.UUID_SIZE; -import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder; - -public class CreateAlmPatsTable extends DdlChange { - - private static final String TABLE_NAME = "alm_pats"; - - private static final VarcharColumnDef userUuidColumn = newVarcharColumnDefBuilder() - .setColumnName("user_uuid") - .setIsNullable(false) - .setLimit(256) - .build(); - - private static final VarcharColumnDef alm_setting_uuid = newVarcharColumnDefBuilder() - .setColumnName("alm_setting_uuid") - .setIsNullable(false) - .setLimit(UUID_SIZE) - .build(); - - public CreateAlmPatsTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new CreateTableBuilder(getDialect(), TABLE_NAME) - .addPkColumn(newVarcharColumnDefBuilder() - .setColumnName("uuid") - .setIsNullable(false) - .setLimit(UUID_SIZE) - .build()) - .addColumn(newVarcharColumnDefBuilder() - .setColumnName("pat") - .setIsNullable(false) - .setLimit(2000) - .build()) - .addColumn(userUuidColumn) - .addColumn(alm_setting_uuid) - .addColumn(newBigIntegerColumnDefBuilder() - .setColumnName("updated_at") - .setIsNullable(false) - .build()) - .addColumn(newBigIntegerColumnDefBuilder() - .setColumnName("created_at") - .setIsNullable(false) - .build()) - .build()); - - context.execute(new CreateIndexBuilder() - .setTable(TABLE_NAME) - .addColumn(userUuidColumn) - .addColumn(alm_setting_uuid) - .setName("uniq_alm_pats") - .setUnique(true) - .build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v82/CreateProjectsTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v82/CreateProjectsTable.java deleted file mode 100644 index 488da0ba18b..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v82/CreateProjectsTable.java +++ /dev/null @@ -1,118 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v82; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.def.BigIntegerColumnDef; -import org.sonar.server.platform.db.migration.def.BooleanColumnDef; -import org.sonar.server.platform.db.migration.def.VarcharColumnDef; -import org.sonar.server.platform.db.migration.sql.CreateIndexBuilder; -import org.sonar.server.platform.db.migration.sql.CreateTableBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.sonar.server.platform.db.migration.def.BigIntegerColumnDef.newBigIntegerColumnDefBuilder; -import static org.sonar.server.platform.db.migration.def.BooleanColumnDef.newBooleanColumnDefBuilder; -import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.UUID_SIZE; -import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder; - -public class CreateProjectsTable extends DdlChange { - - private static final String TABLE_NAME = "projects"; - - private static final VarcharColumnDef UUID_COLUMN = newVarcharColumnDefBuilder() - .setColumnName("uuid") - .setIsNullable(false) - .setLimit(UUID_SIZE) - .build(); - private static final VarcharColumnDef KEE_COLUMN = newVarcharColumnDefBuilder() - .setColumnName("kee") - .setIsNullable(false) - .setLimit(400) - .build(); - private static final VarcharColumnDef QUALIFIER_COLUMN = newVarcharColumnDefBuilder() - .setColumnName("qualifier") - .setIsNullable(false) - .setLimit(10) - .build(); - private static final VarcharColumnDef ORGANIZATION_UUID_COLUMN = newVarcharColumnDefBuilder() - .setColumnName("organization_uuid") - .setIsNullable(false) - .setLimit(UUID_SIZE) - .build(); - private static final VarcharColumnDef NAME_COLUMN = newVarcharColumnDefBuilder() - .setColumnName("name") - .setLimit(2000) - .build(); - private static final VarcharColumnDef DESCRIPTION_COLUMN = newVarcharColumnDefBuilder() - .setColumnName("description") - .setLimit(2000) - .build(); - private static final BooleanColumnDef PRIVATE_COLUMN = newBooleanColumnDefBuilder() - .setColumnName("private") - .setIsNullable(false) - .build(); - private static final VarcharColumnDef TAGS_COLUMN = newVarcharColumnDefBuilder() - .setColumnName("tags") - .setLimit(500) - .build(); - private static final BigIntegerColumnDef CREATED_AT = newBigIntegerColumnDefBuilder() - .setColumnName("created_at") - .setIsNullable(true) - .build(); - private static final BigIntegerColumnDef UPDATED_AT = newBigIntegerColumnDefBuilder() - .setColumnName("updated_at") - .setIsNullable(false) - .build(); - - public CreateProjectsTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new CreateTableBuilder(getDialect(), TABLE_NAME) - .withPkConstraintName("pk_new_projects") - .addPkColumn(UUID_COLUMN) - .addColumn(KEE_COLUMN) - .addColumn(QUALIFIER_COLUMN) - .addColumn(ORGANIZATION_UUID_COLUMN) - .addColumn(NAME_COLUMN) - .addColumn(DESCRIPTION_COLUMN) - .addColumn(PRIVATE_COLUMN) - .addColumn(TAGS_COLUMN) - .addColumn(CREATED_AT) - .addColumn(UPDATED_AT) - .build()); - - context.execute(new CreateIndexBuilder() - .setTable(TABLE_NAME) - .setName("uniq_projects_kee") - .setUnique(true) - .addColumn(KEE_COLUMN) - .build()); - - context.execute(new CreateIndexBuilder() - .setTable(TABLE_NAME) - .setName("idx_qualifier") - .addColumn(QUALIFIER_COLUMN) - .build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v82/DbVersion82.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v82/DbVersion82.java deleted file mode 100644 index 475899465d7..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v82/DbVersion82.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v82; - -import org.sonar.server.platform.db.migration.step.MigrationStepRegistry; -import org.sonar.server.platform.db.migration.version.DbVersion; - -public class DbVersion82 implements DbVersion { - @Override - public void addSteps(MigrationStepRegistry registry) { - registry - .add(3200, "Drop 'In Review' Security Hotspots status ", DropSecurityHotSpotsInReviewStatus.class) - .add(3201, "Migrate Manual Vulnerabilities to Security Hotspots ", MigrateManualVulnerabilitiesToSecurityHotSpots.class) - .add(3202, "Remove 'newsbox.dismiss.hotspots' user property", RemoveNewsboxDismissHotspotsProperty.class) - .add(3203, "Ensure Security Hotspots have status TO_REVIEW", EnsureHotspotDefaultStatusIsToReview.class) - .add(3204, "Rename table 'PROJECTS' to 'COMPONENTS'", RenameProjectsTableToComponents.class) - .add(3205, "Add PROJECTS table", CreateProjectsTable.class) - .add(3206, "Populate PROJECTS table", PopulateProjectsTable.class) - .add(3207, "Drop 'TAGS' column from COMPONENTS table", DropTagsColumnFromComponentsTable.class) - .add(3209, "Create ALM_PATS table", CreateAlmPatsTable.class) - .add(3210, "Add index on ALM_slug", AddIndexOnSlugOfProjectAlmSettings.class) - .add(3211, "Delete conditions using 'security_hotspots' and 'new_security_hotspots' metrics", DeleteQgateConditionsUsingSecurityHotspotMetrics.class) - .add(3212, "Remove old Security Review Rating LiveMeasures", DeleteSecurityReviewRatingLiveMeasures.class) - - ; - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v82/DeleteQgateConditionsUsingSecurityHotspotMetrics.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v82/DeleteQgateConditionsUsingSecurityHotspotMetrics.java deleted file mode 100644 index 724d9bcbd6c..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v82/DeleteQgateConditionsUsingSecurityHotspotMetrics.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v82; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.step.DataChange; -import org.sonar.server.platform.db.migration.step.MassUpdate; - -public class DeleteQgateConditionsUsingSecurityHotspotMetrics extends DataChange { - - public DeleteQgateConditionsUsingSecurityHotspotMetrics(Database db) { - super(db); - } - - @Override - protected void execute(Context context) throws SQLException { - MassUpdate massUpdate = context.prepareMassUpdate(); - massUpdate.select("select qgc.id from quality_gate_conditions qgc " + - " inner join metrics m on m.id = qgc.metric_id and " + - " m.name in ('security_hotspots', 'new_security_hotspots')"); - massUpdate.update("delete from quality_gate_conditions where id = ?"); - massUpdate.execute((row, handler) -> { - handler.setLong(1, row.getLong(1)); - return true; - }); - } - -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v82/DeleteSecurityReviewRatingLiveMeasures.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v82/DeleteSecurityReviewRatingLiveMeasures.java deleted file mode 100644 index 4808e77bb89..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v82/DeleteSecurityReviewRatingLiveMeasures.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v82; - -import java.sql.SQLException; -import javax.annotation.Nullable; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.step.DataChange; -import org.sonar.server.platform.db.migration.step.MassUpdate; - -public class DeleteSecurityReviewRatingLiveMeasures extends DataChange { - - private static final String SECURITY_REVIEW_RATING_METRIC_KEY = "security_review_rating"; - private static final String SECURITY_REVIEW_RATING_EFFORT_METRIC_KEY = "security_review_rating_effort"; - - public DeleteSecurityReviewRatingLiveMeasures(Database db) { - super(db); - } - - @Override - protected void execute(Context context) throws SQLException { - Integer reviewRatingId = getMetricId(context, SECURITY_REVIEW_RATING_METRIC_KEY); - Integer reviewRatingEffortId = getMetricId(context, SECURITY_REVIEW_RATING_EFFORT_METRIC_KEY); - deleteMetricFromLiveMeasures(context, reviewRatingId); - deleteMetricFromLiveMeasures(context, reviewRatingEffortId); - } - - @Nullable - private static Integer getMetricId(Context context, String metricName) throws SQLException { - return context.prepareSelect("select id from metrics where name = ?") - .setString(1, metricName) - .get(row -> row.getNullableInt(1)); - } - - private static void deleteMetricFromLiveMeasures(Context context, @Nullable Integer metricId) throws SQLException { - if (metricId == null) { - return; - } - MassUpdate massUpdate = context.prepareMassUpdate(); - - massUpdate.select("select lm.uuid from live_measures lm inner join components c on lm.component_uuid = c.uuid and lm.metric_id = ?") - .setInt(1, metricId); - massUpdate.update("delete from live_measures where uuid = ?"); - - massUpdate.execute((row, update) -> { - update.setString(1, row.getString(1)); - return true; - }); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v82/DropSecurityHotSpotsInReviewStatus.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v82/DropSecurityHotSpotsInReviewStatus.java deleted file mode 100644 index 61914b44438..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v82/DropSecurityHotSpotsInReviewStatus.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v82; - -import java.sql.SQLException; -import org.sonar.api.utils.System2; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.step.DataChange; -import org.sonar.server.platform.db.migration.step.MassUpdate; - -public class DropSecurityHotSpotsInReviewStatus extends DataChange { - - private System2 system; - - public DropSecurityHotSpotsInReviewStatus(Database db, System2 system) { - super(db); - this.system = system; - } - - @Override - protected void execute(Context context) throws SQLException { - MassUpdate massUpdate = context.prepareMassUpdate(); - massUpdate.select("select id,kee from issues where status = 'IN_REVIEW'"); - massUpdate.update("update issues set status = 'TO_REVIEW' where id = ? and status = 'IN_REVIEW'"); - massUpdate.update("insert into issue_changes(issue_key, change_type, change_data, created_at, updated_at, issue_change_creation_date) " + - "VALUES(?, 'diff', 'status=IN_REVIEW|TO_REVIEW', ?, ?, ?)"); - massUpdate.execute((row, update, updateIndex) -> { - - if (updateIndex == 0) { - update.setLong(1, row.getLong(1)); - } else if (updateIndex == 1) { - long currentTime = system.now(); - update.setString(1, row.getString(2)) - .setLong(2, currentTime) - .setLong(3, currentTime) - .setLong(4, currentTime); - } - return true; - }); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v82/DropTagsColumnFromComponentsTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v82/DropTagsColumnFromComponentsTable.java deleted file mode 100644 index 24e1a4419d9..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v82/DropTagsColumnFromComponentsTable.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v82; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.DropColumnsBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class DropTagsColumnFromComponentsTable extends DdlChange { - - static final String TABLE = "components"; - static final String[] COLUMNS_TO_DROP = new String[] {"tags", "developer_uuid", "authorization_updated_at"}; - - public DropTagsColumnFromComponentsTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new DropColumnsBuilder(getDialect(), TABLE, COLUMNS_TO_DROP).build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v82/EnsureHotspotDefaultStatusIsToReview.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v82/EnsureHotspotDefaultStatusIsToReview.java deleted file mode 100644 index f4437c6e642..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v82/EnsureHotspotDefaultStatusIsToReview.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v82; - -import java.sql.SQLException; -import org.sonar.api.rules.RuleType; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.step.DataChange; -import org.sonar.server.platform.db.migration.step.MassUpdate; - -import static org.sonar.api.issue.Issue.STATUS_OPEN; -import static org.sonar.api.issue.Issue.STATUS_TO_REVIEW; - -public class EnsureHotspotDefaultStatusIsToReview extends DataChange { - public EnsureHotspotDefaultStatusIsToReview(Database db) { - super(db); - } - - @Override - protected void execute(Context context) throws SQLException { - MassUpdate massUpdate = context.prepareMassUpdate(); - massUpdate.select("select id from issues where issue_type = ? and status = ?") - .setInt(1, RuleType.SECURITY_HOTSPOT.getDbConstant()) - .setString(2, STATUS_OPEN); - massUpdate.update("update issues set status = ? where id = ?"); - massUpdate.execute((row, update) -> { - long id = row.getLong(1); - update.setString(1, STATUS_TO_REVIEW); - update.setLong(2, id); - return true; - }); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v82/MigrateManualVulnerabilitiesToSecurityHotSpots.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v82/MigrateManualVulnerabilitiesToSecurityHotSpots.java deleted file mode 100644 index bb352a65947..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v82/MigrateManualVulnerabilitiesToSecurityHotSpots.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v82; - -import java.sql.SQLException; -import org.sonar.api.utils.System2; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.step.DataChange; -import org.sonar.server.platform.db.migration.step.MassUpdate; - -import static org.sonar.api.issue.Issue.STATUS_TO_REVIEW; -import static org.sonar.api.rules.RuleType.VULNERABILITY; - -public class MigrateManualVulnerabilitiesToSecurityHotSpots extends DataChange { - private System2 system; - - public MigrateManualVulnerabilitiesToSecurityHotSpots(Database db, System2 system) { - super(db); - this.system = system; - } - - @Override - protected void execute(Context context) throws SQLException { - MassUpdate updateIssues = context.prepareMassUpdate(); - updateIssues.select("select id, kee, project_uuid, component_uuid from issues where from_hotspot = ? and issue_type = ?") - .setBoolean(1, true) - .setInt(2, 3); - updateIssues.update("update issues set issue_type = ?, status = ? where id = ? and from_hotspot = ? and issue_type = ?"); - updateIssues.update("insert into issue_changes(issue_key, change_type, change_data, created_at, updated_at, issue_change_creation_date) " + - "VALUES(?, ?, ?, ?, ?, ?)"); - - updateIssues.execute((row, update, updateIndex) -> { - if (updateIndex == 0) { - update.setInt(1, 4) - .setString(2, STATUS_TO_REVIEW) - .setLong(3, row.getLong(1)) - .setBoolean(4, true) - .setInt(5, VULNERABILITY.getDbConstant()); - } else if (updateIndex == 1) { - long currentTime = system.now(); - update.setString(1, row.getString(2)) - .setString(2, "diff") - .setString(3, "type=VULNERABILITY|SECURITY_HOTSPOT,status=OPEN|TO_REVIEW") - .setLong(4, currentTime) - .setLong(5, currentTime) - .setLong(6, currentTime); - } - return true; - }); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v82/PopulateProjectsTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v82/PopulateProjectsTable.java deleted file mode 100644 index b89b46b3371..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v82/PopulateProjectsTable.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v82; - -import java.sql.SQLException; -import java.util.Date; -import org.sonar.api.utils.System2; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.SupportsBlueGreen; -import org.sonar.server.platform.db.migration.step.DataChange; -import org.sonar.server.platform.db.migration.step.MassUpdate; - -@SupportsBlueGreen -public class PopulateProjectsTable extends DataChange { - private final System2 system; - - public PopulateProjectsTable(Database db, System2 system) { - super(db); - this.system = system; - } - - @Override - protected void execute(Context context) throws SQLException { - MassUpdate massUpdate = context.prepareMassUpdate(); - massUpdate.select("select cp.uuid, cp.kee, cp.qualifier, cp.organization_uuid, cp.name, cp.description, cp.private, cp.tags, cp.created_at " + - "from components cp " + - "left join projects np on np.uuid = cp.uuid " + - "where cp.scope = 'PRJ' and cp.qualifier in ('TRK', 'APP') and cp.main_branch_project_uuid is null and np.uuid is null"); - massUpdate.rowPluralName("projects"); - massUpdate.update("insert into projects (uuid, kee, qualifier, organization_uuid, name, description, private, tags, created_at, updated_at) " + - "values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"); - massUpdate.execute((row, update) -> { - update.setString(1, row.getString(1)); - update.setString(2, row.getString(2)); - update.setString(3, row.getString(3)); - update.setString(4, row.getString(4)); - update.setString(5, row.getNullableString(5)); - update.setString(6, row.getNullableString(6)); - update.setBoolean(7, row.getBoolean(7)); - update.setString(8, row.getNullableString(8)); - Date createdAtDate = row.getNullableDate(9); - update.setLong(9, createdAtDate != null ? createdAtDate.getTime() : null); - update.setLong(10, system.now()); - return true; - }); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v82/RemoveNewsboxDismissHotspotsProperty.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v82/RemoveNewsboxDismissHotspotsProperty.java deleted file mode 100644 index fb64d412c0f..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v82/RemoveNewsboxDismissHotspotsProperty.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v82; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.step.DataChange; - -public class RemoveNewsboxDismissHotspotsProperty extends DataChange { - - public RemoveNewsboxDismissHotspotsProperty(Database db) { - super(db); - } - - @Override - protected void execute(Context context) throws SQLException { - context.prepareUpsert("delete from user_properties where kee='newsbox.dismiss.hotspots'") - .execute() - .commit(); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v82/RenameProjectsTableToComponents.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v82/RenameProjectsTableToComponents.java deleted file mode 100644 index dffc71544a3..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v82/RenameProjectsTableToComponents.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v82; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.RenameTableBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class RenameProjectsTableToComponents extends DdlChange { - public RenameProjectsTableToComponents(Database db) { - super(db); - } - - @Override public void execute(Context context) throws SQLException { - context.execute(new RenameTableBuilder(getDialect()).setName("projects").setNewName("components").build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v82/package-info.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v82/package-info.java deleted file mode 100644 index ea0fd57ccf1..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v82/package-info.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v82; - -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v83/AddSummaryEnabledColumnToAlmSettings.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v83/AddSummaryEnabledColumnToAlmSettings.java deleted file mode 100644 index fde0f229578..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v83/AddSummaryEnabledColumnToAlmSettings.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v83; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.def.BooleanColumnDef; -import org.sonar.server.platform.db.migration.sql.AddColumnsBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.sonar.server.platform.db.migration.def.BooleanColumnDef.newBooleanColumnDefBuilder; - -public class AddSummaryEnabledColumnToAlmSettings extends DdlChange { - private static final String TABLE = "project_alm_settings"; - private static final String NEW_COLUMN = "summary_comment_enabled"; - - private static final BooleanColumnDef SUMMARY_COMMENT_ENABLED = newBooleanColumnDefBuilder() - .setColumnName(NEW_COLUMN) - .setIsNullable(true) - .setDefaultValue(null) - .build(); - - public AddSummaryEnabledColumnToAlmSettings(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new AddColumnsBuilder(getDialect(), TABLE) - .addColumn(SUMMARY_COMMENT_ENABLED) - .build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v83/DbVersion83.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v83/DbVersion83.java deleted file mode 100644 index 0722bc53b96..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v83/DbVersion83.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v83; - -import org.sonar.server.platform.db.migration.step.MigrationStepRegistry; -import org.sonar.server.platform.db.migration.version.DbVersion; -import org.sonar.server.platform.db.migration.version.v83.grouproles.AddComponentUuidColumnToGroupRoles; -import org.sonar.server.platform.db.migration.version.v83.grouproles.DropResourceIdFromGroupRolesTable; -import org.sonar.server.platform.db.migration.version.v83.grouproles.MigrateResourceIdToUuidInGroupRoles; -import org.sonar.server.platform.db.migration.version.v83.properties.AddComponentUuidColumnToProperties; -import org.sonar.server.platform.db.migration.version.v83.properties.DropResourceIdFromPropertiesTable; -import org.sonar.server.platform.db.migration.version.v83.properties.MigrateResourceIdToUuidInProperties; -import org.sonar.server.platform.db.migration.version.v83.userroles.AddComponentUuidColumnToUserRoles; -import org.sonar.server.platform.db.migration.version.v83.userroles.DropResourceIdFromUserRolesTable; -import org.sonar.server.platform.db.migration.version.v83.userroles.MigrateResourceIdToUuidInUserRoles; - -public class DbVersion83 implements DbVersion { - @Override - public void addSteps(MigrationStepRegistry registry) { - registry - .add(3300, "Add 'summary_comment_enabled' boolean column to 'project_alm_settings'", AddSummaryEnabledColumnToAlmSettings.class) - .add(3301, "Enable 'summary_comment_enabled' for GitHub based projects", PopulateSummaryCommentEnabledColumnForGitHub.class) - .add(3302, "Add 'component_uuid' column to 'properties'", AddComponentUuidColumnToProperties.class) - .add(3303, "Migrate 'resource_id' to 'component_uuid' in 'properties'", MigrateResourceIdToUuidInProperties.class) - .add(3304, "Remove column 'resource_id' in 'properties'", DropResourceIdFromPropertiesTable.class) - .add(3305, "Add 'component_uuid' column to 'group_roles'", AddComponentUuidColumnToGroupRoles.class) - .add(3306, "Migrate 'resource_id' to 'component_uuid' in 'group_roles'", MigrateResourceIdToUuidInGroupRoles.class) - .add(3307, "Remove column 'resource_id' in 'group_roles'", DropResourceIdFromGroupRolesTable.class) - .add(3308, "Add 'component_uuid' column to 'user_roles'", AddComponentUuidColumnToUserRoles.class) - .add(3309, "Migrate 'resource_id' to 'component_uuid' in 'user_roles'", MigrateResourceIdToUuidInUserRoles.class) - .add(3310, "Remove column 'resource_id' in 'user_roles'", DropResourceIdFromUserRolesTable.class) - .add(3311, "Remove column 'id' in 'components'", DropIdFromComponentsTable.class) - ; - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v83/DropIdFromComponentsTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v83/DropIdFromComponentsTable.java deleted file mode 100644 index adc93ac9486..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v83/DropIdFromComponentsTable.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v83; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.DropColumnsBuilder; -import org.sonar.server.platform.db.migration.sql.DropPrimaryKeySqlGenerator; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class DropIdFromComponentsTable extends DdlChange { - - static final String TABLE_NAME = "components"; - static final String COLUMN_NAME = "id"; - - private final DropPrimaryKeySqlGenerator dropPrimaryKeySqlGenerator; - - public DropIdFromComponentsTable(Database db, DropPrimaryKeySqlGenerator dropPrimaryKeySqlGenerator) { - super(db); - this.dropPrimaryKeySqlGenerator = dropPrimaryKeySqlGenerator; - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(dropPrimaryKeySqlGenerator.generate(TABLE_NAME, COLUMN_NAME, true)); - context.execute(new DropColumnsBuilder(getDialect(), TABLE_NAME, COLUMN_NAME).build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v83/PopulateSummaryCommentEnabledColumnForGitHub.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v83/PopulateSummaryCommentEnabledColumnForGitHub.java deleted file mode 100644 index 64adb04b5cf..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v83/PopulateSummaryCommentEnabledColumnForGitHub.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v83; - -import java.sql.SQLException; -import org.sonar.api.utils.System2; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.step.DataChange; -import org.sonar.server.platform.db.migration.step.MassUpdate; - -public class PopulateSummaryCommentEnabledColumnForGitHub extends DataChange { - - private final System2 system; - - public PopulateSummaryCommentEnabledColumnForGitHub(Database db, System2 system) { - super(db); - this.system = system; - } - - @Override - protected void execute(Context context) throws SQLException { - MassUpdate massUpdate = context.prepareMassUpdate(); - - massUpdate.select("select uuid from alm_settings where alm_id = ? ") - .setString(1, "github"); - massUpdate.update("update project_alm_settings set summary_comment_enabled = ?, updated_at = ? where alm_setting_uuid = ?"); - - massUpdate.execute((row, update) -> { - update.setBoolean(1, true) - .setLong(2, system.now()) - .setString(3, row.getString(1)); - return true; - }); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v83/grouproles/AddComponentUuidColumnToGroupRoles.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v83/grouproles/AddComponentUuidColumnToGroupRoles.java deleted file mode 100644 index a0a404e95e7..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v83/grouproles/AddComponentUuidColumnToGroupRoles.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v83.grouproles; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.def.VarcharColumnDef; -import org.sonar.server.platform.db.migration.sql.AddColumnsBuilder; -import org.sonar.server.platform.db.migration.sql.CreateIndexBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder; - -public class AddComponentUuidColumnToGroupRoles extends DdlChange { - private static final String TABLE = "group_roles"; - private static final String NEW_COLUMN = "component_uuid"; - private static final String INDEX1 = "group_roles_component_uuid"; - - public AddComponentUuidColumnToGroupRoles(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - VarcharColumnDef column = newVarcharColumnDefBuilder() - .setColumnName(NEW_COLUMN) - .setLimit(VarcharColumnDef.UUID_SIZE) - .setIsNullable(true) - .build(); - context.execute(new AddColumnsBuilder(getDialect(), TABLE) - .addColumn(column) - .build()); - - CreateIndexBuilder index1 = new CreateIndexBuilder() - .setTable(TABLE) - .addColumn(column) - .setName(INDEX1) - .setUnique(false); - context.execute(index1.build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v83/grouproles/DropResourceIdFromGroupRolesTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v83/grouproles/DropResourceIdFromGroupRolesTable.java deleted file mode 100644 index 9b3e9d98f32..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v83/grouproles/DropResourceIdFromGroupRolesTable.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v83.grouproles; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.def.VarcharColumnDef; -import org.sonar.server.platform.db.migration.sql.CreateIndexBuilder; -import org.sonar.server.platform.db.migration.sql.DropColumnsBuilder; -import org.sonar.server.platform.db.migration.sql.DropIndexBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.sonar.server.platform.db.migration.def.IntegerColumnDef.newIntegerColumnDefBuilder; -import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder; - -public class DropResourceIdFromGroupRolesTable extends DdlChange { - - static final String TABLE = "group_roles"; - static final String COLUMN = "resource_id"; - static final String INDEX = "uniq_group_roles"; - - - public DropResourceIdFromGroupRolesTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new DropIndexBuilder(getDialect()).setTable(TABLE).setName(INDEX).build()); - context.execute(new DropIndexBuilder(getDialect()).setTable(TABLE).setName("group_roles_resource").build()); - context.execute(new DropColumnsBuilder(getDialect(), TABLE, COLUMN).build()); - - CreateIndexBuilder index = new CreateIndexBuilder() - .setTable(TABLE) - .addColumn(newVarcharColumnDefBuilder().setColumnName("organization_uuid").setLimit(VarcharColumnDef.UUID_SIZE).build()) - .addColumn(newIntegerColumnDefBuilder().setColumnName("group_id").build()) - .addColumn(newVarcharColumnDefBuilder().setColumnName("component_uuid").setLimit(VarcharColumnDef.UUID_SIZE).build()) - .addColumn(newVarcharColumnDefBuilder().setColumnName("role").setLimit(64).build()) - .setName(INDEX) - .setUnique(true); - context.execute(index.build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v83/grouproles/MigrateResourceIdToUuidInGroupRoles.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v83/grouproles/MigrateResourceIdToUuidInGroupRoles.java deleted file mode 100644 index 8c234d71508..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v83/grouproles/MigrateResourceIdToUuidInGroupRoles.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v83.grouproles; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.step.DataChange; -import org.sonar.server.platform.db.migration.step.MassUpdate; - -public class MigrateResourceIdToUuidInGroupRoles extends DataChange { - public MigrateResourceIdToUuidInGroupRoles(Database db) { - super(db); - } - - @Override protected void execute(Context context) throws SQLException { - // remove roles associated with invalid resource - context.prepareUpsert("delete from group_roles " - + "where group_roles.resource_id is not null and not exists (select 1 from components c where group_roles.resource_id = c.id)") - .execute(); - - MassUpdate massUpdate = context.prepareMassUpdate(); - massUpdate.select("select gp.id as gp_id, c.uuid as c_uuid from group_roles gp, components c where gp.resource_id = c.id and gp.component_uuid is null"); - massUpdate.update("update group_roles set component_uuid = ? where id = ?"); - - massUpdate.execute((row, update) -> { - String componentUuid = row.getString(2); - Long propertyId = row.getLong(1); - - update.setString(1, componentUuid) - .setLong(2, propertyId); - return true; - }); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v83/grouproles/package-info.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v83/grouproles/package-info.java deleted file mode 100644 index 9efc7fb4e7f..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v83/grouproles/package-info.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v83.grouproles; - -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v83/package-info.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v83/package-info.java deleted file mode 100644 index 3155e0776d3..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v83/package-info.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v83; - -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v83/properties/AddComponentUuidColumnToProperties.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v83/properties/AddComponentUuidColumnToProperties.java deleted file mode 100644 index 192145a2ba5..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v83/properties/AddComponentUuidColumnToProperties.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v83.properties; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.def.VarcharColumnDef; -import org.sonar.server.platform.db.migration.sql.AddColumnsBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder; - -public class AddComponentUuidColumnToProperties extends DdlChange { - private static final String TABLE = "properties"; - private static final String NEW_COLUMN = "component_uuid"; - - public AddComponentUuidColumnToProperties(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - VarcharColumnDef column = newVarcharColumnDefBuilder() - .setColumnName(NEW_COLUMN) - .setLimit(VarcharColumnDef.UUID_SIZE) - .setIsNullable(true) - .build(); - context.execute(new AddColumnsBuilder(getDialect(), TABLE) - .addColumn(column) - .build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v83/properties/DropResourceIdFromPropertiesTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v83/properties/DropResourceIdFromPropertiesTable.java deleted file mode 100644 index fe5f932399b..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v83/properties/DropResourceIdFromPropertiesTable.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v83.properties; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.DropColumnsBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class DropResourceIdFromPropertiesTable extends DdlChange { - - static final String TABLE = "properties"; - static final String COLUMN = "resource_id"; - - public DropResourceIdFromPropertiesTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new DropColumnsBuilder(getDialect(), TABLE, COLUMN).build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v83/properties/MigrateResourceIdToUuidInProperties.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v83/properties/MigrateResourceIdToUuidInProperties.java deleted file mode 100644 index 93f8559248a..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v83/properties/MigrateResourceIdToUuidInProperties.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v83.properties; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.step.DataChange; -import org.sonar.server.platform.db.migration.step.MassUpdate; - -public class MigrateResourceIdToUuidInProperties extends DataChange { - public MigrateResourceIdToUuidInProperties(Database db) { - super(db); - } - - @Override protected void execute(Context context) throws SQLException { - // remove properties associated with invalid resource - context.prepareUpsert("delete from properties where properties.resource_id is not null and not exists (select 1 from components c where properties.resource_id = c.id)") - .execute(); - - MassUpdate massUpdate = context.prepareMassUpdate(); - - massUpdate.select("select p.id as p_id, c.uuid as c_uuid from properties p, components c where p.resource_id = c.id and p.component_uuid is null"); - massUpdate.update("update properties set component_uuid = ? where id = ?"); - - massUpdate.execute((row, update) -> { - String componentUuid = row.getString(2); - Long propertyId = row.getLong(1); - - update.setString(1, componentUuid) - .setLong(2, propertyId); - return true; - }); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v83/properties/package-info.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v83/properties/package-info.java deleted file mode 100644 index ab461aa5258..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v83/properties/package-info.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v83.properties; - -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v83/userroles/AddComponentUuidColumnToUserRoles.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v83/userroles/AddComponentUuidColumnToUserRoles.java deleted file mode 100644 index d3206237b08..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v83/userroles/AddComponentUuidColumnToUserRoles.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v83.userroles; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.def.VarcharColumnDef; -import org.sonar.server.platform.db.migration.sql.AddColumnsBuilder; -import org.sonar.server.platform.db.migration.sql.CreateIndexBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder; - -public class AddComponentUuidColumnToUserRoles extends DdlChange { - private static final String TABLE = "user_roles"; - private static final String NEW_COLUMN = "component_uuid"; - private static final String INDEX = "user_roles_component_uuid"; - - public AddComponentUuidColumnToUserRoles(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - VarcharColumnDef column = newVarcharColumnDefBuilder() - .setColumnName(NEW_COLUMN) - .setLimit(VarcharColumnDef.UUID_SIZE) - .setIsNullable(true) - .build(); - context.execute(new AddColumnsBuilder(getDialect(), TABLE) - .addColumn(column) - .build()); - - CreateIndexBuilder index = new CreateIndexBuilder() - .setTable(TABLE) - .addColumn(column) - .setName(INDEX) - .setUnique(false); - context.execute(index.build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v83/userroles/DropResourceIdFromUserRolesTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v83/userroles/DropResourceIdFromUserRolesTable.java deleted file mode 100644 index 8e547ad14da..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v83/userroles/DropResourceIdFromUserRolesTable.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v83.userroles; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.DropColumnsBuilder; -import org.sonar.server.platform.db.migration.sql.DropIndexBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class DropResourceIdFromUserRolesTable extends DdlChange { - - static final String TABLE = "user_roles"; - static final String COLUMN = "resource_id"; - - public DropResourceIdFromUserRolesTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new DropIndexBuilder(getDialect()).setTable(TABLE).setName("user_roles_resource").build()); - context.execute(new DropColumnsBuilder(getDialect(), TABLE, COLUMN).build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v83/userroles/MigrateResourceIdToUuidInUserRoles.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v83/userroles/MigrateResourceIdToUuidInUserRoles.java deleted file mode 100644 index 6b5f3321dff..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v83/userroles/MigrateResourceIdToUuidInUserRoles.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v83.userroles; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.step.DataChange; -import org.sonar.server.platform.db.migration.step.MassUpdate; - -public class MigrateResourceIdToUuidInUserRoles extends DataChange { - public MigrateResourceIdToUuidInUserRoles(Database db) { - super(db); - } - - @Override protected void execute(Context context) throws SQLException { - // remove roles associated with invalid resource - context.prepareUpsert( - "delete from user_roles where user_roles.resource_id is not null and not exists (select 1 from components c where user_roles.resource_id = c.id)") - .execute(); - - MassUpdate massUpdate = context.prepareMassUpdate(); - - massUpdate.select("select ur.id as ur_id, c.uuid as c_uuid from user_roles ur, components c where ur.resource_id = c.id and ur.component_uuid is null"); - massUpdate.update("update user_roles set component_uuid = ? where id = ?"); - - massUpdate.execute((row, update) -> { - String componentUuid = row.getString(2); - Long id = row.getLong(1); - - update.setString(1, componentUuid) - .setLong(2, id); - return true; - }); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v83/userroles/package-info.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v83/userroles/package-info.java deleted file mode 100644 index 72a860e74c1..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v83/userroles/package-info.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v83.userroles; - -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/AddProjectBranchesNeedIssueSync.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/AddProjectBranchesNeedIssueSync.java deleted file mode 100644 index ba7eb7ff7dc..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/AddProjectBranchesNeedIssueSync.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.def.BooleanColumnDef; -import org.sonar.server.platform.db.migration.sql.AddColumnsBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class AddProjectBranchesNeedIssueSync extends DdlChange { - public AddProjectBranchesNeedIssueSync(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new AddColumnsBuilder(getDialect(), "project_branches") - .addColumn(BooleanColumnDef.newBooleanColumnDefBuilder() - .setColumnName("need_issue_sync") - .setIsNullable(true) - .setDefaultValue(null) - .build()) - .build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/CreateSamlMessageIdsTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/CreateSamlMessageIdsTable.java deleted file mode 100644 index 94c27282ddc..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/CreateSamlMessageIdsTable.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.def.VarcharColumnDef; -import org.sonar.server.platform.db.migration.sql.CreateIndexBuilder; -import org.sonar.server.platform.db.migration.sql.CreateTableBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.sonar.server.platform.db.migration.def.BigIntegerColumnDef.newBigIntegerColumnDefBuilder; -import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.UUID_SIZE; - -public class CreateSamlMessageIdsTable extends DdlChange { - - private static final String TABLE_NAME = "saml_message_ids"; - private static final VarcharColumnDef MESSAGE_ID_COLUMN = VarcharColumnDef.newVarcharColumnDefBuilder() - .setColumnName("message_id") - .setLimit(255) - .setIsNullable(false) - .build(); - - public CreateSamlMessageIdsTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new CreateTableBuilder(getDialect(), TABLE_NAME) - .addPkColumn(VarcharColumnDef.newVarcharColumnDefBuilder() - .setColumnName("uuid") - .setLimit(UUID_SIZE) - .setIsNullable(false) - .build()) - .addColumn(MESSAGE_ID_COLUMN) - .addColumn(newBigIntegerColumnDefBuilder() - .setColumnName("expiration_date") - .setIsNullable(false) - .build()) - .addColumn(newBigIntegerColumnDefBuilder() - .setColumnName("created_at") - .setIsNullable(false) - .build()) - .build()); - - context.execute(new CreateIndexBuilder() - .setTable(TABLE_NAME) - .setName("saml_message_ids_unique") - .addColumn(MESSAGE_ID_COLUMN) - .setUnique(true) - .build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/CreateSessionTokensTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/CreateSessionTokensTable.java deleted file mode 100644 index c015b04bd63..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/CreateSessionTokensTable.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.def.VarcharColumnDef; -import org.sonar.server.platform.db.migration.sql.CreateIndexBuilder; -import org.sonar.server.platform.db.migration.sql.CreateTableBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.sonar.server.platform.db.migration.def.BigIntegerColumnDef.newBigIntegerColumnDefBuilder; -import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.USER_UUID_SIZE; -import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.UUID_SIZE; - -public class CreateSessionTokensTable extends DdlChange { - - private static final String TABLE_NAME = "session_tokens"; - private static final VarcharColumnDef USER_UUID_COLUMN = VarcharColumnDef.newVarcharColumnDefBuilder() - .setColumnName("user_uuid") - .setLimit(USER_UUID_SIZE) - .setIsNullable(false) - .build(); - - public CreateSessionTokensTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new CreateTableBuilder(getDialect(), TABLE_NAME) - .addPkColumn(VarcharColumnDef.newVarcharColumnDefBuilder() - .setColumnName("uuid") - .setLimit(UUID_SIZE) - .setIsNullable(false) - .build()) - .addColumn(USER_UUID_COLUMN) - .addColumn(newBigIntegerColumnDefBuilder() - .setColumnName("expiration_date") - .setIsNullable(false) - .build()) - .addColumn(newBigIntegerColumnDefBuilder() - .setColumnName("created_at") - .setIsNullable(false) - .build()) - .addColumn(newBigIntegerColumnDefBuilder() - .setColumnName("updated_at") - .setIsNullable(false) - .build()) - .build()); - - context.execute(new CreateIndexBuilder() - .setTable(TABLE_NAME) - .setName("session_tokens_user_uuid") - .addColumn(USER_UUID_COLUMN) - .setUnique(false) - .build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/DbVersion84.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/DbVersion84.java deleted file mode 100644 index d08316d59a9..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/DbVersion84.java +++ /dev/null @@ -1,798 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84; - -import org.sonar.server.platform.db.migration.step.MigrationStepRegistry; -import org.sonar.server.platform.db.migration.version.DbVersion; -import org.sonar.server.platform.db.migration.version.v84.activeruleparameters.AddPrimaryKeyOnUuidColumnOfActiveRuleParametersTable; -import org.sonar.server.platform.db.migration.version.v84.activeruleparameters.AddUuidColumnToActiveRuleParametersTable; -import org.sonar.server.platform.db.migration.version.v84.activeruleparameters.DropIdColumnOfActiveRuleParametersTable; -import org.sonar.server.platform.db.migration.version.v84.activeruleparameters.DropPrimaryKeyOnIdColumnOfActiveRuleParametersTable; -import org.sonar.server.platform.db.migration.version.v84.activeruleparameters.MakeActiveRuleParametersUuidColumnNotNullable; -import org.sonar.server.platform.db.migration.version.v84.activeruleparameters.PopulateActiveRuleParametersUuid; -import org.sonar.server.platform.db.migration.version.v84.activerules.AddActiveRuleUuidColumnToActiveRuleParameters; -import org.sonar.server.platform.db.migration.version.v84.activerules.AddIndexOnActiveRuleUuidOfActiveRuleParametersTable; -import org.sonar.server.platform.db.migration.version.v84.activerules.AddPrimaryKeyOnUuidColumnOfActiveRulesTable; -import org.sonar.server.platform.db.migration.version.v84.activerules.AddUuidColumnToActiveRulesTable; -import org.sonar.server.platform.db.migration.version.v84.activerules.DropActiveRuleIdColumnOfActiveRuleParametersTable; -import org.sonar.server.platform.db.migration.version.v84.activerules.DropIdColumnOfActiveRulesTable; -import org.sonar.server.platform.db.migration.version.v84.activerules.DropIndexOnActiveRuleIdOfActiveRuleParametersTable; -import org.sonar.server.platform.db.migration.version.v84.activerules.DropPrimaryKeyOnIdColumnOfActiveRulesTable; -import org.sonar.server.platform.db.migration.version.v84.activerules.MakeActiveRuleParametersActiveRuleUuidNotNullable; -import org.sonar.server.platform.db.migration.version.v84.activerules.MakeActiveRulesUuidColumnNotNullable; -import org.sonar.server.platform.db.migration.version.v84.activerules.PopulateActiveRuleParametersActiveRuleUuid; -import org.sonar.server.platform.db.migration.version.v84.activerules.PopulateActiveRulesUuid; -import org.sonar.server.platform.db.migration.version.v84.alm.AddClientIdAndClientSecretColumns; -import org.sonar.server.platform.db.migration.version.v84.ceactivity.AddPrimaryKeyOnUuidColumnOfCeActivityTable; -import org.sonar.server.platform.db.migration.version.v84.ceactivity.DropIdColumnOfCeActivityTable; -import org.sonar.server.platform.db.migration.version.v84.ceactivity.DropPrimaryKeyOnIdColumnOfCeActivityTable; -import org.sonar.server.platform.db.migration.version.v84.cequeue.AddPrimaryKeyOnUuidColumnOfCeQueueTable; -import org.sonar.server.platform.db.migration.version.v84.cequeue.DropIdColumnOfCeQueueTable; -import org.sonar.server.platform.db.migration.version.v84.cequeue.DropPrimaryKeyOnIdColumnOfCeQueueTable; -import org.sonar.server.platform.db.migration.version.v84.cequeue.DropUniqueIndexOnUuidColumnOfCeQueueTable; -import org.sonar.server.platform.db.migration.version.v84.duplicationsindex.AddPrimaryKeyOnUuidColumnOfDuplicationsIndexTable; -import org.sonar.server.platform.db.migration.version.v84.duplicationsindex.AddUuidToDuplicationsIndexTable; -import org.sonar.server.platform.db.migration.version.v84.duplicationsindex.DropIdColumnOfDuplicationsIndexTable; -import org.sonar.server.platform.db.migration.version.v84.duplicationsindex.DropPrimaryKeyOnIdColumnOfDuplicationsIndexTable; -import org.sonar.server.platform.db.migration.version.v84.duplicationsindex.MakeDuplicationsIndexUuidColumnNotNullable; -import org.sonar.server.platform.db.migration.version.v84.duplicationsindex.PopulateDuplicationsIndexUuid; -import org.sonar.server.platform.db.migration.version.v84.events.AddPrimaryKeyOnUuidColumnOfEventsTable; -import org.sonar.server.platform.db.migration.version.v84.events.DropIdColumnOfEventsTable; -import org.sonar.server.platform.db.migration.version.v84.events.DropPrimaryKeyOnIdColumnOfEventsTable; -import org.sonar.server.platform.db.migration.version.v84.filesources.AddPrimaryKeyOnUuidColumnOfFileSourcesTable; -import org.sonar.server.platform.db.migration.version.v84.filesources.AddUuidColumnToFileSourcesTable; -import org.sonar.server.platform.db.migration.version.v84.filesources.DropIdColumnOfFileSourcesTable; -import org.sonar.server.platform.db.migration.version.v84.filesources.DropPrimaryKeyOnIdColumnOfFileSourcesTable; -import org.sonar.server.platform.db.migration.version.v84.filesources.MakeFileSourcesUuidColumnNotNullable; -import org.sonar.server.platform.db.migration.version.v84.filesources.PopulateFileSourcesUuid; -import org.sonar.server.platform.db.migration.version.v84.grouproles.AddPrimaryKeyOnUuidColumnOfGroupRolesTable; -import org.sonar.server.platform.db.migration.version.v84.grouproles.AddUuidColumnToGroupRolesTable; -import org.sonar.server.platform.db.migration.version.v84.grouproles.DropIdColumnOfGroupRolesTable; -import org.sonar.server.platform.db.migration.version.v84.grouproles.DropPrimaryKeyOnIdColumnOfGroupRolesTable; -import org.sonar.server.platform.db.migration.version.v84.grouproles.MakeGroupRolesUuidColumnNotNullable; -import org.sonar.server.platform.db.migration.version.v84.grouproles.PopulateGroupRolesUuid; -import org.sonar.server.platform.db.migration.version.v84.groups.AddPrimaryKeyOnUuidColumnOfGroupsTable; -import org.sonar.server.platform.db.migration.version.v84.groups.AddUuidColumnToGroupsTable; -import org.sonar.server.platform.db.migration.version.v84.groups.DropIdColumnOfGroupsTable; -import org.sonar.server.platform.db.migration.version.v84.groups.DropPrimaryKeyOnIdColumnOfGroupsTable; -import org.sonar.server.platform.db.migration.version.v84.groups.MakeGroupsUuidColumnNotNullable; -import org.sonar.server.platform.db.migration.version.v84.groups.PopulateGroupsUuid; -import org.sonar.server.platform.db.migration.version.v84.groups.grouproles.AddGroupUuidColumnToGroupRoles; -import org.sonar.server.platform.db.migration.version.v84.groups.grouproles.AddIndexOnGroupUuidOfGroupRolesTable; -import org.sonar.server.platform.db.migration.version.v84.groups.grouproles.DropGroupIdColumnOfGroupRolesTable; -import org.sonar.server.platform.db.migration.version.v84.groups.grouproles.DropIndexOnGroupIdOfGroupRolesTable; -import org.sonar.server.platform.db.migration.version.v84.groups.grouproles.PopulateGroupRolesGroupUuid; -import org.sonar.server.platform.db.migration.version.v84.groups.groupsusers.AddGroupUuidColumnToGroupsUsers; -import org.sonar.server.platform.db.migration.version.v84.groups.groupsusers.AddIndexOnGroupUuidOfGroupsUsersTable; -import org.sonar.server.platform.db.migration.version.v84.groups.groupsusers.DropGroupIdColumnOfGroupsUsersTable; -import org.sonar.server.platform.db.migration.version.v84.groups.groupsusers.DropIndexOnGroupIdOfGroupsUsersTable; -import org.sonar.server.platform.db.migration.version.v84.groups.groupsusers.MakeGroupsUsersGroupUuidNotNullable; -import org.sonar.server.platform.db.migration.version.v84.groups.groupsusers.PopulateGroupsUsersGroupUuid; -import org.sonar.server.platform.db.migration.version.v84.groups.organizations.AddDefaultGroupUuidColumnToOrganizations; -import org.sonar.server.platform.db.migration.version.v84.groups.organizations.DropDefaultGroupIdColumnOfOrganizationsTable; -import org.sonar.server.platform.db.migration.version.v84.groups.organizations.PopulateOrganizationsDefaultGroupUuid; -import org.sonar.server.platform.db.migration.version.v84.groups.permtemplatesgroups.AddGroupUuidColumnToPermTemplatesGroups; -import org.sonar.server.platform.db.migration.version.v84.groups.permtemplatesgroups.DropGroupIdColumnOfPermTemplatesGroupsTable; -import org.sonar.server.platform.db.migration.version.v84.groups.permtemplatesgroups.PopulatePermTemplatesGroupsGroupUuid; -import org.sonar.server.platform.db.migration.version.v84.groups.qprofileeditgroups.AddGroupUuidColumnToQProfileEditGroups; -import org.sonar.server.platform.db.migration.version.v84.groups.qprofileeditgroups.AddIndexOnGroupUuidOfQProfileEditGroupsTable; -import org.sonar.server.platform.db.migration.version.v84.groups.qprofileeditgroups.DropGroupIdColumnOfQProfileEditGroupsTable; -import org.sonar.server.platform.db.migration.version.v84.groups.qprofileeditgroups.DropIndexOnGroupIdOfQProfileEditGroupsTable; -import org.sonar.server.platform.db.migration.version.v84.groups.qprofileeditgroups.MakeQProfileEditGroupsGroupUuidNotNullable; -import org.sonar.server.platform.db.migration.version.v84.groups.qprofileeditgroups.PopulateQProfileEditGroupsGroupUuid; -import org.sonar.server.platform.db.migration.version.v84.issuechanges.AddIndexOnIssueKeyOfIssueChangesTable; -import org.sonar.server.platform.db.migration.version.v84.issuechanges.AddIndexOnKeeOfIssueChangesTable; -import org.sonar.server.platform.db.migration.version.v84.issuechanges.AddPrimaryKeyOnUuidColumnOfIssueChangesTable; -import org.sonar.server.platform.db.migration.version.v84.issuechanges.CopyIssueChangesTable; -import org.sonar.server.platform.db.migration.version.v84.issuechanges.DropIssueChangesTable; -import org.sonar.server.platform.db.migration.version.v84.issuechanges.RenameIssueChangesCopyToIssueChanges; -import org.sonar.server.platform.db.migration.version.v84.issues.AddPrimaryKeyOnKeeColumnOfIssuesTable; -import org.sonar.server.platform.db.migration.version.v84.manualmeasures.AddPrimaryKeyOnUuidColumnOfManualMeasuresTable; -import org.sonar.server.platform.db.migration.version.v84.manualmeasures.AddUuidColumnToManualMeasures; -import org.sonar.server.platform.db.migration.version.v84.manualmeasures.DropIdColumnOfManualMeasuresTable; -import org.sonar.server.platform.db.migration.version.v84.manualmeasures.DropPrimaryKeyOnIdColumnOfManualMeasuresTable; -import org.sonar.server.platform.db.migration.version.v84.manualmeasures.MakeManualMeasuresUuidColumnNotNullable; -import org.sonar.server.platform.db.migration.version.v84.manualmeasures.PopulateManualMeasureUuid; -import org.sonar.server.platform.db.migration.version.v84.metrics.AddPrimaryKeyOnUuidColumnOfMetricsTable; -import org.sonar.server.platform.db.migration.version.v84.metrics.AddUuidColumnToMetricsTable; -import org.sonar.server.platform.db.migration.version.v84.metrics.DropIdColumnOfMetricsTable; -import org.sonar.server.platform.db.migration.version.v84.metrics.DropPrimaryKeyOnIdColumnOfMetricsTable; -import org.sonar.server.platform.db.migration.version.v84.metrics.MakeMetricsUuidColumnNotNullable; -import org.sonar.server.platform.db.migration.version.v84.metrics.PopulateMetricsUuid; -import org.sonar.server.platform.db.migration.version.v84.metrics.livemeasures.AddIndexOnMetricUuidOfLiveMeasuresTable; -import org.sonar.server.platform.db.migration.version.v84.metrics.livemeasures.AddIndexOnProjectUuidOfLiveMeasuresTable; -import org.sonar.server.platform.db.migration.version.v84.metrics.livemeasures.AddPKeyOnUuidOfLiveMeasuresTable; -import org.sonar.server.platform.db.migration.version.v84.metrics.livemeasures.CopyLiveMeasuresTable; -import org.sonar.server.platform.db.migration.version.v84.metrics.livemeasures.DropLiveMeasuresTable; -import org.sonar.server.platform.db.migration.version.v84.metrics.livemeasures.RenameLiveMeasuresCopyToLiveMeasures; -import org.sonar.server.platform.db.migration.version.v84.metrics.manualmeasures.AddMetricUuidColumnToManualMeasures; -import org.sonar.server.platform.db.migration.version.v84.metrics.manualmeasures.DropMetricIdColumnOfManualMeasuresTable; -import org.sonar.server.platform.db.migration.version.v84.metrics.manualmeasures.MakeManualMeasuresMetricUuidNotNullable; -import org.sonar.server.platform.db.migration.version.v84.metrics.manualmeasures.PopulateManualMeasuresMetricUuid; -import org.sonar.server.platform.db.migration.version.v84.metrics.projectmeasures.AddIndexOnMetricUuidAndAnalysisUuidOfProjectMeasuresTable; -import org.sonar.server.platform.db.migration.version.v84.metrics.projectmeasures.AddIndexOnMetricUuidOfProjectMeasuresTable; -import org.sonar.server.platform.db.migration.version.v84.metrics.projectmeasures.AddMetricUuidColumnToProjectMeasures; -import org.sonar.server.platform.db.migration.version.v84.metrics.projectmeasures.DeleteSecurityReviewRatingProjectMeasures; -import org.sonar.server.platform.db.migration.version.v84.metrics.projectmeasures.DropIndexOnMetricIdOfProjectMeasuresTable; -import org.sonar.server.platform.db.migration.version.v84.metrics.projectmeasures.DropMetricIdColumnOfProjectMeasuresTable; -import org.sonar.server.platform.db.migration.version.v84.metrics.projectmeasures.MakeProjectMeasuresMetricUuidNotNullable; -import org.sonar.server.platform.db.migration.version.v84.metrics.projectmeasures.PopulateProjectMeasuresMetricUuid; -import org.sonar.server.platform.db.migration.version.v84.metrics.qualitygateconditions.AddMetricUuidColumnToQualityGateConditions; -import org.sonar.server.platform.db.migration.version.v84.metrics.qualitygateconditions.DropMetricIdColumnOfQualityGateConditionsTable; -import org.sonar.server.platform.db.migration.version.v84.metrics.qualitygateconditions.MakeQualityGateConditionsMetricUuidNotNullable; -import org.sonar.server.platform.db.migration.version.v84.metrics.qualitygateconditions.PopulateQualityGateConditionsMetricUuid; -import org.sonar.server.platform.db.migration.version.v84.notifications.AddPrimaryKeyOnUuidColumnOfNotificationTable; -import org.sonar.server.platform.db.migration.version.v84.notifications.AddUuidAndCreatedAtColumnsToNotification; -import org.sonar.server.platform.db.migration.version.v84.notifications.DropIdColumnOfNotificationTable; -import org.sonar.server.platform.db.migration.version.v84.notifications.DropPrimaryKeyOnIdColumnOfNotificationTable; -import org.sonar.server.platform.db.migration.version.v84.notifications.MakeNotificationUuidAndCreatedAtColumnsNotNullable; -import org.sonar.server.platform.db.migration.version.v84.notifications.PopulateNotificationUuidAndCreatedAt; -import org.sonar.server.platform.db.migration.version.v84.permissiontemplates.AddPrimaryKeyOnUuidColumnOfPermissionTemplatesTable; -import org.sonar.server.platform.db.migration.version.v84.permissiontemplates.AddUuidColumnToPermissionTemplates; -import org.sonar.server.platform.db.migration.version.v84.permissiontemplates.DropIdColumnOfPermissionTemplatesTable; -import org.sonar.server.platform.db.migration.version.v84.permissiontemplates.DropKeeColumnOfPermissionTemplatesTable; -import org.sonar.server.platform.db.migration.version.v84.permissiontemplates.DropPrimaryKeyOnIdColumnOfPermissionTemplatesTable; -import org.sonar.server.platform.db.migration.version.v84.permissiontemplates.MakePermissionTemplateUuidColumnNotNullable; -import org.sonar.server.platform.db.migration.version.v84.permissiontemplates.PopulatePermissionTemplatesUuid; -import org.sonar.server.platform.db.migration.version.v84.permissiontemplates.fk.permtemplatesgroups.AddTemplateUuidColumnToPermTemplatesGroups; -import org.sonar.server.platform.db.migration.version.v84.permissiontemplates.fk.permtemplatesgroups.DropTemplateIdColumnOfPermTemplatesGroupsTable; -import org.sonar.server.platform.db.migration.version.v84.permissiontemplates.fk.permtemplatesgroups.MakePermTemplatesGroupsTemplateUuidColumnNotNullable; -import org.sonar.server.platform.db.migration.version.v84.permissiontemplates.fk.permtemplatesgroups.PopulatePermTemplatesGroupsTemplateUuidColumn; -import org.sonar.server.platform.db.migration.version.v84.permissiontemplates.fk.permtemplatesusers.AddTemplateUuidColumnToPermTemplatesUsers; -import org.sonar.server.platform.db.migration.version.v84.permissiontemplates.fk.permtemplatesusers.DropTemplateIdColumnOfPermTemplatesUsersTable; -import org.sonar.server.platform.db.migration.version.v84.permissiontemplates.fk.permtemplatesusers.MakePermTemplatesUsersTemplateUuidColumnNotNullable; -import org.sonar.server.platform.db.migration.version.v84.permissiontemplates.fk.permtemplatesusers.PopulatePermTemplatesUsersTemplateUuidColumn; -import org.sonar.server.platform.db.migration.version.v84.permissiontemplates.fk.permtplcharacteristics.AddTemplateUuidColumnToPermTplCharacteristics; -import org.sonar.server.platform.db.migration.version.v84.permissiontemplates.fk.permtplcharacteristics.AddUniqueIndexOnTemplateUuidAndPermissionKeyColumnsOfPermTplCharacteristicsTable; -import org.sonar.server.platform.db.migration.version.v84.permissiontemplates.fk.permtplcharacteristics.DropTemplateIdColumnOfPermTplCharacteristicsTable; -import org.sonar.server.platform.db.migration.version.v84.permissiontemplates.fk.permtplcharacteristics.DropUniqueIndexOnTemplateIdAndPermissionKeyColumnsOfPermTplCharacteristicsTable; -import org.sonar.server.platform.db.migration.version.v84.permissiontemplates.fk.permtplcharacteristics.MakePermTplCharacteristicsTemplateUuidColumnNotNullable; -import org.sonar.server.platform.db.migration.version.v84.permissiontemplates.fk.permtplcharacteristics.PopulatePermTplCharacteristicsTemplateUuidColumn; -import org.sonar.server.platform.db.migration.version.v84.permtemplatesgroups.AddPrimaryKeyOnUuidColumnOfPermTemplatesGroupsTable; -import org.sonar.server.platform.db.migration.version.v84.permtemplatesgroups.AddUuidColumnToPermTemplatesGroupsTable; -import org.sonar.server.platform.db.migration.version.v84.permtemplatesgroups.DropIdColumnOfPermTemplatesGroupsTable; -import org.sonar.server.platform.db.migration.version.v84.permtemplatesgroups.DropPrimaryKeyOnIdColumnOfPermTemplatesGroupsTable; -import org.sonar.server.platform.db.migration.version.v84.permtemplatesgroups.MakePermTemplatesGroupsUuidColumnNotNullable; -import org.sonar.server.platform.db.migration.version.v84.permtemplatesgroups.PopulatePermTemplatesGroupsUuid; -import org.sonar.server.platform.db.migration.version.v84.permtemplatesusers.AddPrimaryKeyOnUuidColumnOfPermTemplatesUsersTable; -import org.sonar.server.platform.db.migration.version.v84.permtemplatesusers.AddUuidColumnToPermTemplatesUsersTable; -import org.sonar.server.platform.db.migration.version.v84.permtemplatesusers.DropIdColumnOfPermTemplatesUsersTable; -import org.sonar.server.platform.db.migration.version.v84.permtemplatesusers.DropPrimaryKeyOnIdColumnOfPermTemplatesUsersTable; -import org.sonar.server.platform.db.migration.version.v84.permtemplatesusers.MakePermTemplatesUsersUuidColumnNotNullable; -import org.sonar.server.platform.db.migration.version.v84.permtemplatesusers.PopulatePermTemplatesUsersUuid; -import org.sonar.server.platform.db.migration.version.v84.permtplcharacteristics.AddPrimaryKeyOnUuidColumnOfPermTplCharacteristicsTable; -import org.sonar.server.platform.db.migration.version.v84.permtplcharacteristics.AddUuidColumnToPermTplCharacteristicsTable; -import org.sonar.server.platform.db.migration.version.v84.permtplcharacteristics.DropIdColumnOfPermTplCharacteristicsTable; -import org.sonar.server.platform.db.migration.version.v84.permtplcharacteristics.DropPrimaryKeyOnIdColumnOfPermTplCharacteristicsTable; -import org.sonar.server.platform.db.migration.version.v84.permtplcharacteristics.MakePermTplCharacteristicsUuidColumnNotNullable; -import org.sonar.server.platform.db.migration.version.v84.permtplcharacteristics.PopulatePermTplCharacteristicsUuid; -import org.sonar.server.platform.db.migration.version.v84.projectmeasures.AddPrimaryKeyOnUuidColumnOfProjectMeasuresTable; -import org.sonar.server.platform.db.migration.version.v84.projectmeasures.AddTechIndexOnUuidOfProjectMeasuresTable; -import org.sonar.server.platform.db.migration.version.v84.projectmeasures.AddUuidColumnToProjectMeasures; -import org.sonar.server.platform.db.migration.version.v84.projectmeasures.DropIdColumnOfProjectMeasuresTable; -import org.sonar.server.platform.db.migration.version.v84.projectmeasures.DropPrimaryKeyOnIdColumnOfProjectMeasuresTable; -import org.sonar.server.platform.db.migration.version.v84.projectmeasures.DropTechIndexOnUuidOfProjectMeasuresTable; -import org.sonar.server.platform.db.migration.version.v84.projectmeasures.MakeProjectMeasuresUuidColumnNotNullable; -import org.sonar.server.platform.db.migration.version.v84.projectmeasures.PopulateProjectMeasureUuid; -import org.sonar.server.platform.db.migration.version.v84.projectqprofiles.AddPrimaryKeyOnUuidColumnOfProjectQProfilesTable; -import org.sonar.server.platform.db.migration.version.v84.projectqprofiles.AddUuidColumnToProjectQProfilesTable; -import org.sonar.server.platform.db.migration.version.v84.projectqprofiles.DropIdColumnOfProjectQProfilesTable; -import org.sonar.server.platform.db.migration.version.v84.projectqprofiles.DropPrimaryKeyOnIdColumnOfProjectQProfilesTable; -import org.sonar.server.platform.db.migration.version.v84.projectqprofiles.MakeProjectQProfilesUuidColumnNotNullable; -import org.sonar.server.platform.db.migration.version.v84.projectqprofiles.PopulateProjectQProfilesUuid; -import org.sonar.server.platform.db.migration.version.v84.properties.AddPrimaryKeyOnUuidColumnOfPropertiesTable; -import org.sonar.server.platform.db.migration.version.v84.properties.AddUuidColumnToProperties; -import org.sonar.server.platform.db.migration.version.v84.properties.DropIdColumnOfPropertiesTable; -import org.sonar.server.platform.db.migration.version.v84.properties.DropPrimaryKeyOnIdColumnOfPropertiesTable; -import org.sonar.server.platform.db.migration.version.v84.properties.MakePropertiesUuidColumnNotNullable; -import org.sonar.server.platform.db.migration.version.v84.properties.PopulatePropertiesUuid; -import org.sonar.server.platform.db.migration.version.v84.qualitygateconditions.AddPrimaryKeyOnUuidColumnOfQualityGateConditionsTable; -import org.sonar.server.platform.db.migration.version.v84.qualitygateconditions.AddUuidColumnToQualityGateConditionsTable; -import org.sonar.server.platform.db.migration.version.v84.qualitygateconditions.DropIdColumnOfQualityGateConditionsTable; -import org.sonar.server.platform.db.migration.version.v84.qualitygateconditions.DropPrimaryKeyOnIdColumnOfQualityGateConditionsTable; -import org.sonar.server.platform.db.migration.version.v84.qualitygateconditions.MakeQualityGateConditionsUuidColumnNotNullable; -import org.sonar.server.platform.db.migration.version.v84.qualitygateconditions.PopulateQualityGateConditionsUuid; -import org.sonar.server.platform.db.migration.version.v84.qualitygates.AddPrimaryKeyOnUuidColumnOfQGatesTable; -import org.sonar.server.platform.db.migration.version.v84.qualitygates.AddQGateUuidColumnForQGateConditions; -import org.sonar.server.platform.db.migration.version.v84.qualitygates.DropIdColumnOfQGateTable; -import org.sonar.server.platform.db.migration.version.v84.qualitygates.DropOrphansQGateConditions; -import org.sonar.server.platform.db.migration.version.v84.qualitygates.DropPrimaryKeyOnIdColumnOfQGatesTable; -import org.sonar.server.platform.db.migration.version.v84.qualitygates.DropQGateIdColumnForQGateConditions; -import org.sonar.server.platform.db.migration.version.v84.qualitygates.DropUniqueIndexOnUuidColumnOfQualityGatesTable; -import org.sonar.server.platform.db.migration.version.v84.qualitygates.MakeQGateUuidColumnNotNullableForQGateConditions; -import org.sonar.server.platform.db.migration.version.v84.qualitygates.PopulateQGateUuidColumnForQGateConditions; -import org.sonar.server.platform.db.migration.version.v84.rules.AddPrimaryKeyOnUuidColumnOfRulesTable; -import org.sonar.server.platform.db.migration.version.v84.rules.AddUuidAndTemplateUuidColumnsToRules; -import org.sonar.server.platform.db.migration.version.v84.rules.DropIdColumnOfRulesTable; -import org.sonar.server.platform.db.migration.version.v84.rules.DropPrimaryKeyOnIdColumnOfRulesTable; -import org.sonar.server.platform.db.migration.version.v84.rules.DropTemplateIdColumnOfRulesTable; -import org.sonar.server.platform.db.migration.version.v84.rules.MakeRulesUuidColumnNotNullable; -import org.sonar.server.platform.db.migration.version.v84.rules.PopulateRulesTemplateUuid; -import org.sonar.server.platform.db.migration.version.v84.rules.PopulateRulesUuid; -import org.sonar.server.platform.db.migration.version.v84.rules.activerules.AddIndexToActiveRulesTable; -import org.sonar.server.platform.db.migration.version.v84.rules.activerules.AddRuleUuidColumnToActiveRulesTable; -import org.sonar.server.platform.db.migration.version.v84.rules.activerules.DropIndexOnRuleIdColumnOfActiveRulesTable; -import org.sonar.server.platform.db.migration.version.v84.rules.activerules.DropRuleIdColumnOfActiveRulesTable; -import org.sonar.server.platform.db.migration.version.v84.rules.activerules.MakeActiveRulesRuleUuidColumnNotNullable; -import org.sonar.server.platform.db.migration.version.v84.rules.activerules.PopulateActiveRulesRuleUuidColumn; -import org.sonar.server.platform.db.migration.version.v84.rules.deprecatedrulekeys.AddIndexToDeprecatedRuleKeysTable; -import org.sonar.server.platform.db.migration.version.v84.rules.deprecatedrulekeys.AddRuleUuidColumnToDeprecatedRuleKeysTable; -import org.sonar.server.platform.db.migration.version.v84.rules.deprecatedrulekeys.DropIndexOnRuleIdColumnOfDeprecatedRuleKeysTable; -import org.sonar.server.platform.db.migration.version.v84.rules.deprecatedrulekeys.DropRuleIdColumnOfDeprecatedRuleKeysTable; -import org.sonar.server.platform.db.migration.version.v84.rules.deprecatedrulekeys.MakeDeprecatedRuleKeysRuleUuidColumnNotNullable; -import org.sonar.server.platform.db.migration.version.v84.rules.deprecatedrulekeys.PopulateDeprecatedRuleKeysRuleUuidColumn; -import org.sonar.server.platform.db.migration.version.v84.rules.issues.AddIndexesToIssuesTable; -import org.sonar.server.platform.db.migration.version.v84.rules.issues.CopyIssuesTable; -import org.sonar.server.platform.db.migration.version.v84.rules.issues.DropIssuesTable; -import org.sonar.server.platform.db.migration.version.v84.rules.issues.RenameIssuesCopyToIssues; -import org.sonar.server.platform.db.migration.version.v84.rules.rulesmetadata.AddPrimaryKeyOnUuidAndOrganizationUuidColumnOfRulesMetadataTable; -import org.sonar.server.platform.db.migration.version.v84.rules.rulesmetadata.AddRuleUuidColumnToRulesMetadataTable; -import org.sonar.server.platform.db.migration.version.v84.rules.rulesmetadata.DropPrimaryKeyOnIdColumnOfRulesMetadataTable; -import org.sonar.server.platform.db.migration.version.v84.rules.rulesmetadata.DropRuleIdColumnOfRulesMetadataTable; -import org.sonar.server.platform.db.migration.version.v84.rules.rulesmetadata.MakeRulesMetadataRuleUuidColumnNotNullable; -import org.sonar.server.platform.db.migration.version.v84.rules.rulesmetadata.PopulateRulesMetadataRuleUuidColumn; -import org.sonar.server.platform.db.migration.version.v84.rules.rulesparameters.AddIndexesToRulesParametersTable; -import org.sonar.server.platform.db.migration.version.v84.rules.rulesparameters.AddRuleUuidColumnToRulesParametersTable; -import org.sonar.server.platform.db.migration.version.v84.rules.rulesparameters.DropIndexesOnRuleIdColumnOfRulesParametersTable; -import org.sonar.server.platform.db.migration.version.v84.rules.rulesparameters.DropRuleIdColumnOfRulesParametersTable; -import org.sonar.server.platform.db.migration.version.v84.rules.rulesparameters.MakeRulesParametersRuleUuidColumnNotNullable; -import org.sonar.server.platform.db.migration.version.v84.rules.rulesparameters.PopulateRulesParametersRuleUuidColumn; -import org.sonar.server.platform.db.migration.version.v84.rulesparameters.AddPrimaryKeyOnUuidColumnOfRulesParametersTable; -import org.sonar.server.platform.db.migration.version.v84.rulesparameters.AddUuidColumnToRulesParameters; -import org.sonar.server.platform.db.migration.version.v84.rulesparameters.DropIdColumnOfRulesParametersTable; -import org.sonar.server.platform.db.migration.version.v84.rulesparameters.DropPrimaryKeyOnIdColumnOfRulesParametersTable; -import org.sonar.server.platform.db.migration.version.v84.rulesparameters.MakeRulesParametersUuidColumnNotNullable; -import org.sonar.server.platform.db.migration.version.v84.rulesparameters.PopulateRulesParametersUuid; -import org.sonar.server.platform.db.migration.version.v84.rulesparameters.fk.AddRulesParameterUuidColumnToActiveRuleParameters; -import org.sonar.server.platform.db.migration.version.v84.rulesparameters.fk.DropRulesParameterIdColumnOfActiveRuleParametersTable; -import org.sonar.server.platform.db.migration.version.v84.rulesparameters.fk.MakeActiveRuleParametersRulesParameterUuidColumnNotNullable; -import org.sonar.server.platform.db.migration.version.v84.rulesparameters.fk.PopulateActiveRuleParametersRulesParameterUuid; -import org.sonar.server.platform.db.migration.version.v84.rulesprofiles.AddPrimaryKeyOnUuidColumnOfRulesProfilesTable; -import org.sonar.server.platform.db.migration.version.v84.rulesprofiles.AddUuidColumnToRulesProfilesTable; -import org.sonar.server.platform.db.migration.version.v84.rulesprofiles.DropIdColumnOfRulesProfilesTable; -import org.sonar.server.platform.db.migration.version.v84.rulesprofiles.DropKeeColumnOfRulesProfilesTable; -import org.sonar.server.platform.db.migration.version.v84.rulesprofiles.DropPrimaryKeyOnIdColumnOfRulesProfilesTable; -import org.sonar.server.platform.db.migration.version.v84.rulesprofiles.DropUniqueIndexOnKeeColumnOfRulesProfilesTable; -import org.sonar.server.platform.db.migration.version.v84.rulesprofiles.MakeRulesProfilesUuidColumnNotNullable; -import org.sonar.server.platform.db.migration.version.v84.rulesprofiles.PopulateRulesProfilesUuid; -import org.sonar.server.platform.db.migration.version.v84.rulesprofiles.fk.activerules.AddProfileUuidColumnToActiveRulesTable; -import org.sonar.server.platform.db.migration.version.v84.rulesprofiles.fk.activerules.AddUniqueIndexOnProfileUuidColumnOfActiveRulesTable; -import org.sonar.server.platform.db.migration.version.v84.rulesprofiles.fk.activerules.DropProfileIdColumnOfActiveRulesTable; -import org.sonar.server.platform.db.migration.version.v84.rulesprofiles.fk.activerules.DropUniqueIndexOnProfileIdColumnOfActiveRulesTable; -import org.sonar.server.platform.db.migration.version.v84.rulesprofiles.fk.activerules.MakeActiveRulesProfileUuidColumnNotNullable; -import org.sonar.server.platform.db.migration.version.v84.rulesprofiles.fk.activerules.PopulateActiveRulesProfileUuid; -import org.sonar.server.platform.db.migration.version.v84.rulesprofiles.fk.orgqprofiles.PopulateOrgQProfilesRulesProfileUuid; -import org.sonar.server.platform.db.migration.version.v84.rulesprofiles.fk.qprofilechanges.PopulateQProfileChangesRulesProfileUuid; -import org.sonar.server.platform.db.migration.version.v84.snapshots.issues.AddPrimaryKeyOnUuidColumnOfSnapshotsTable; -import org.sonar.server.platform.db.migration.version.v84.snapshots.issues.DropIdColumnOfSnapshotsTable; -import org.sonar.server.platform.db.migration.version.v84.snapshots.issues.DropPrimaryKeyOnIdColumnOfSnapshotsTable; -import org.sonar.server.platform.db.migration.version.v84.userroles.AddPrimaryKeyOnUuidColumnOfUserRolesTable; -import org.sonar.server.platform.db.migration.version.v84.userroles.AddUuidColumnToUserRolesTable; -import org.sonar.server.platform.db.migration.version.v84.userroles.DropIdColumnOfUserRolesTable; -import org.sonar.server.platform.db.migration.version.v84.userroles.DropPrimaryKeyOnIdColumnOfUserRolesTable; -import org.sonar.server.platform.db.migration.version.v84.userroles.MakeUserRolesUuidColumnNotNullable; -import org.sonar.server.platform.db.migration.version.v84.userroles.PopulateUserRolesUuid; -import org.sonar.server.platform.db.migration.version.v84.users.AddPrimaryKeyOnUuidColumnOfUsersTable; -import org.sonar.server.platform.db.migration.version.v84.users.DropIdColumnOfUsersTable; -import org.sonar.server.platform.db.migration.version.v84.users.DropPrimaryKeyOnIdColumnOfUsersTable; -import org.sonar.server.platform.db.migration.version.v84.users.DropUniqueIndexOnUuidColumnOfUsersTable; -import org.sonar.server.platform.db.migration.version.v84.users.fk.groupsusers.AddIndexOnUserUuidOfGroupsUsersTable; -import org.sonar.server.platform.db.migration.version.v84.users.fk.groupsusers.AddUniqueIndexOnUserUuidAndGroupIdOfGroupsUsersTable; -import org.sonar.server.platform.db.migration.version.v84.users.fk.groupsusers.AddUserUuidColumnToGroupsUsers; -import org.sonar.server.platform.db.migration.version.v84.users.fk.groupsusers.DropIndexOnUserIdOfGroupsUsersTable; -import org.sonar.server.platform.db.migration.version.v84.users.fk.groupsusers.DropUniqueIndexOnUserIdAndGroupIdOfGroupsUsersTable; -import org.sonar.server.platform.db.migration.version.v84.users.fk.groupsusers.DropUserIdColumnOfGroupsUsersTable; -import org.sonar.server.platform.db.migration.version.v84.users.fk.groupsusers.MakeGroupsUsersUserUuidColumnNotNullable; -import org.sonar.server.platform.db.migration.version.v84.users.fk.groupsusers.PopulateGroupsUsersUserUuid; -import org.sonar.server.platform.db.migration.version.v84.users.fk.organizationmembers.AddIndexOnUserUuidOfOrganizationMembersTable; -import org.sonar.server.platform.db.migration.version.v84.users.fk.organizationmembers.AddPrimaryKeyOnUserUuidAndOrganizationUuidColumnsOfUserRolesTable; -import org.sonar.server.platform.db.migration.version.v84.users.fk.organizationmembers.AddUserUuidColumnToOrganizationMembers; -import org.sonar.server.platform.db.migration.version.v84.users.fk.organizationmembers.DropIndexOnUserIdOfOrganizationMembersTable; -import org.sonar.server.platform.db.migration.version.v84.users.fk.organizationmembers.DropPrimaryKeyOnUserIdAndOrganizationUuidOfOrganizationMembersTable; -import org.sonar.server.platform.db.migration.version.v84.users.fk.organizationmembers.DropUserIdColumnOfOrganizationMembersTable; -import org.sonar.server.platform.db.migration.version.v84.users.fk.organizationmembers.MakeOrganizationMembersUserUuidColumnNotNullable; -import org.sonar.server.platform.db.migration.version.v84.users.fk.organizationmembers.PopulateOrganizationMembersUserUuid; -import org.sonar.server.platform.db.migration.version.v84.users.fk.permtemplatesusers.AddUserUuidColumnToPermTemplatesUsers; -import org.sonar.server.platform.db.migration.version.v84.users.fk.permtemplatesusers.DropUserIdColumnOfPermTemplatesUsersTable; -import org.sonar.server.platform.db.migration.version.v84.users.fk.permtemplatesusers.MakePermTemplatesUsersUserUuidColumnNotNullable; -import org.sonar.server.platform.db.migration.version.v84.users.fk.permtemplatesusers.PopulatePermTemplatesUsersUserUuid; -import org.sonar.server.platform.db.migration.version.v84.users.fk.properties.AddUserUuidColumnToPropertiesUsers; -import org.sonar.server.platform.db.migration.version.v84.users.fk.properties.DropUserIdColumnOfPropertiesTable; -import org.sonar.server.platform.db.migration.version.v84.users.fk.properties.PopulatePropertiesUserUuid; -import org.sonar.server.platform.db.migration.version.v84.users.fk.qprofileeditusers.AddUniqueIndexOnUserUuidAndQProfileUuidOfQProfileEditUsersTable; -import org.sonar.server.platform.db.migration.version.v84.users.fk.qprofileeditusers.AddUserUuidColumnToQProfileEditUsers; -import org.sonar.server.platform.db.migration.version.v84.users.fk.qprofileeditusers.DropUniqueIndexOnUserIdAndQProfileUuidOfQProfileEditUsersTable; -import org.sonar.server.platform.db.migration.version.v84.users.fk.qprofileeditusers.DropUserIdColumnOfQProfileEditUsersTable; -import org.sonar.server.platform.db.migration.version.v84.users.fk.qprofileeditusers.MakeQProfileEditUsersUserUuidColumnNotNullable; -import org.sonar.server.platform.db.migration.version.v84.users.fk.qprofileeditusers.PopulateQProfileEditUsersUserUuid; -import org.sonar.server.platform.db.migration.version.v84.users.fk.userroles.AddIndexOnUserUuidOfUserRolesTable; -import org.sonar.server.platform.db.migration.version.v84.users.fk.userroles.AddUserUuidColumnToUserRoles; -import org.sonar.server.platform.db.migration.version.v84.users.fk.userroles.DropIndexOnUserIdOfUserRolesTable; -import org.sonar.server.platform.db.migration.version.v84.users.fk.userroles.DropUserIdColumnOfUserRolesTable; -import org.sonar.server.platform.db.migration.version.v84.users.fk.userroles.PopulateUserRolesUserUuid; -import org.sonar.server.platform.db.migration.version.v84.usertokens.AddPrimaryKeyOnUuidColumnOfUserTokensTable; -import org.sonar.server.platform.db.migration.version.v84.usertokens.AddUuidColumnToUserTokens; -import org.sonar.server.platform.db.migration.version.v84.usertokens.DropIdColumnOfUserTokensTable; -import org.sonar.server.platform.db.migration.version.v84.usertokens.DropPrimaryKeyOnIdColumnOfUserTokensTable; -import org.sonar.server.platform.db.migration.version.v84.usertokens.MakeUserTokensUuidNotNullable; -import org.sonar.server.platform.db.migration.version.v84.usertokens.PopulateUserTokensUuid; -import org.sonar.server.platform.db.migration.version.v85.AddIndexOnProjectUuidOnIssueChangesTable; - -public class DbVersion84 implements DbVersion { - @Override - public void addSteps(MigrationStepRegistry registry) { - registry - // Migration on EVENTS table - .add(3400, "Drop primary key on 'ID' column of 'EVENTS' table", DropPrimaryKeyOnIdColumnOfEventsTable.class) - .add(3401, "Add primary key on 'UUID' column of 'EVENTS' table", AddPrimaryKeyOnUuidColumnOfEventsTable.class) - .add(3402, "Drop column 'ID' of 'EVENTS' table", DropIdColumnOfEventsTable.class) - - // Migrations of NOTIFICATIONS table - .add(3403, "Add 'uuid' and 'createdAt' columns for notifications", AddUuidAndCreatedAtColumnsToNotification.class) - .add(3404, "Populate 'uuid' and 'createdAt columns for notifications", PopulateNotificationUuidAndCreatedAt.class) - .add(3405, "Make 'uuid' and 'createdAt' column not nullable for notifications", MakeNotificationUuidAndCreatedAtColumnsNotNullable.class) - .add(3406, "Drop primary key on 'ID' column of 'NOTIFICATIONS' table", DropPrimaryKeyOnIdColumnOfNotificationTable.class) - .add(3407, "Add primary key on 'UUID' column of 'NOTIFICATIONS' table", AddPrimaryKeyOnUuidColumnOfNotificationTable.class) - .add(3408, "Drop column 'ID' of 'NOTIFICATIONS' table", DropIdColumnOfNotificationTable.class) - - // Migration on SNAPSHOTS table - .add(3409, "Drop primary key on 'ID' column of 'SNAPSHOTS' table", DropPrimaryKeyOnIdColumnOfSnapshotsTable.class) - .add(3410, "Add primary key on 'UUID' column of 'SNAPSHOTS' table", AddPrimaryKeyOnUuidColumnOfSnapshotsTable.class) - .add(3411, "Drop column 'ID' of 'SNAPSHOTS' table", DropIdColumnOfSnapshotsTable.class) - - // Migration on CE_QUEUE table - .add(3412, "Drop unique index on 'uuid' column of 'CE_QUEUE' table", DropUniqueIndexOnUuidColumnOfCeQueueTable.class) - .add(3413, "Drop primary key on 'ID' column of 'CE_QUEUE' table", DropPrimaryKeyOnIdColumnOfCeQueueTable.class) - .add(3414, "Add primary key on 'UUID' column of 'CE_QUEUE' table", AddPrimaryKeyOnUuidColumnOfCeQueueTable.class) - .add(3415, "Drop column 'ID' of 'CE_QUEUE' table", DropIdColumnOfCeQueueTable.class) - - // Migration on CE_ACTIVITY table - .add(3416, "Drop primary key on 'ID' column of 'CE_ACTIVITY' table", DropPrimaryKeyOnIdColumnOfCeActivityTable.class) - .add(3417, "Add primary key on 'UUID' column of 'CE_ACTIVITY' table", AddPrimaryKeyOnUuidColumnOfCeActivityTable.class) - .add(3418, "Drop column 'ID' of 'CE_ACTIVITY' table", DropIdColumnOfCeActivityTable.class) - - // Migration of DUPLICATIONS_INDEX table - .add(3419, "Add 'uuid' columns for DUPLICATIONS_INDEX", AddUuidToDuplicationsIndexTable.class) - .add(3420, "Populate 'uuid' columns for DUPLICATIONS_INDEX", PopulateDuplicationsIndexUuid.class) - .add(3421, "Make 'uuid' column not nullable for DUPLICATIONS_INDEX", MakeDuplicationsIndexUuidColumnNotNullable.class) - .add(3422, "Drop primary key on 'ID' column of 'DUPLICATIONS_INDEX' table", DropPrimaryKeyOnIdColumnOfDuplicationsIndexTable.class) - .add(3423, "Add primary key on 'UUID' column of 'DUPLICATIONS_INDEX' table", AddPrimaryKeyOnUuidColumnOfDuplicationsIndexTable.class) - .add(3424, "Drop column 'ID' of 'DUPLICATIONS_INDEX' table", DropIdColumnOfDuplicationsIndexTable.class) - - // Migration of ACTIVE_RULE_PARAMS table - .add(3425, "Add 'uuid' column for 'ACTIVE_RULE_PARAMS' table", AddUuidColumnToActiveRuleParametersTable.class) - .add(3426, "Populate 'uuid' column for 'ACTIVE_RULE_PARAMS' table", PopulateActiveRuleParametersUuid.class) - .add(3427, "Make 'uuid' column not nullable for 'ACTIVE_RULE_PARAMS' table", MakeActiveRuleParametersUuidColumnNotNullable.class) - .add(3428, "Drop primary key on 'ID' column of 'ACTIVE_RULE_PARAMS' table", DropPrimaryKeyOnIdColumnOfActiveRuleParametersTable.class) - .add(3429, "Add primary key on 'UUID' column of 'ACTIVE_RULE_PARAMS' table", AddPrimaryKeyOnUuidColumnOfActiveRuleParametersTable.class) - .add(3430, "Drop column 'ID' of 'ACTIVE_RULE_PARAMS' table", DropIdColumnOfActiveRuleParametersTable.class) - - // Migration on PROJECT_MEASURES table - .add(3431, "Add 'uuid' columns for 'PROJECT_MEASURES'", AddUuidColumnToProjectMeasures.class) - .add(3432, "Add tech index on 'group_uuid' column of 'PROJECT_MEASURES' table", AddTechIndexOnUuidOfProjectMeasuresTable.class) - .add(3433, "Populate 'uuid' column for 'PROJECT_MEASURES'", PopulateProjectMeasureUuid.class) - .add(3434, "Drop tech index on 'group_id' column of 'PROJECT_MEASURES' table", DropTechIndexOnUuidOfProjectMeasuresTable.class) - .add(3435, "Make 'uuid' column not nullable for 'PROJECT_MEASURES'", MakeProjectMeasuresUuidColumnNotNullable.class) - .add(3436, "Drop primary key on 'ID' column of 'PROJECT_MEASURES' table", DropPrimaryKeyOnIdColumnOfProjectMeasuresTable.class) - .add(3437, "Add primary key on 'UUID' column of 'PROJECT_MEASURES' table", AddPrimaryKeyOnUuidColumnOfProjectMeasuresTable.class) - .add(3438, "Drop column 'ID' of 'PROJECT_MEASURES' table", DropIdColumnOfProjectMeasuresTable.class) - - // Migration of USER_TOKENS table - .add(3439, "Add 'UUID' column on 'USER_TOKENS' table", AddUuidColumnToUserTokens.class) - .add(3440, "Populate 'uuid' for 'USER_TOKENS'", PopulateUserTokensUuid.class) - .add(3441, "Make 'uuid' column not nullable for user_tokens", MakeUserTokensUuidNotNullable.class) - .add(3442, "Drop primary key on 'ID' column of 'USER_TOKENS' table", DropPrimaryKeyOnIdColumnOfUserTokensTable.class) - .add(3443, "Add primary key on 'UUID' column of 'USER_TOKENS' table", AddPrimaryKeyOnUuidColumnOfUserTokensTable.class) - .add(3444, "Drop column 'ID' of 'USER_TOKENS' table", DropIdColumnOfUserTokensTable.class) - - // Migration on PROJECT_QPROFILES table - .add(3445, "Add 'uuid' column for 'PROJECT_QPROFILES'", AddUuidColumnToProjectQProfilesTable.class) - .add(3446, "Populate 'uuid' column for 'PROJECT_QPROFILES'", PopulateProjectQProfilesUuid.class) - .add(3447, "Make 'uuid' column not nullable for 'PROJECT_QPROFILES'", MakeProjectQProfilesUuidColumnNotNullable.class) - .add(3448, "Drop primary key on 'ID' column of 'PROJECT_QPROFILES' table", DropPrimaryKeyOnIdColumnOfProjectQProfilesTable.class) - .add(3449, "Add primary key on 'UUID' column of 'PROJECT_QPROFILES' table", AddPrimaryKeyOnUuidColumnOfProjectQProfilesTable.class) - .add(3450, "Drop column 'ID' of 'PROJECT_QPROFILES' table", DropIdColumnOfProjectQProfilesTable.class) - - // Migration of MANUAL_MEASURES table - .add(3451, "Add 'uuid' column for 'MANUAL_MEASURES'", AddUuidColumnToManualMeasures.class) - .add(3452, "Populate 'uuid' column for 'MANUAL_MEASURES'", PopulateManualMeasureUuid.class) - .add(3453, "Make 'uuid' column not nullable for 'MANUAL_MEASURES'", MakeManualMeasuresUuidColumnNotNullable.class) - .add(3454, "Drop primary key on 'ID' column of 'MANUAL_MEASURES' table", DropPrimaryKeyOnIdColumnOfManualMeasuresTable.class) - .add(3455, "Add primary key on 'UUID' column of 'MANUAL_MEASURES' table", AddPrimaryKeyOnUuidColumnOfManualMeasuresTable.class) - .add(3456, "Drop column 'ID' of 'MANUAL_MEASURES' table", DropIdColumnOfManualMeasuresTable.class) - - // Migration of GROUP_ROLES table - .add(3457, "Add 'UUID' column on 'GROUP_ROLES' table", AddUuidColumnToGroupRolesTable.class) - .add(3458, "Populate 'uuid' for 'GROUP_ROLES'", PopulateGroupRolesUuid.class) - .add(3459, "Make 'uuid' column not nullable for 'GROUP_ROLES'", MakeGroupRolesUuidColumnNotNullable.class) - .add(3460, "Drop primary key on 'ID' column of 'GROUP_ROLES' table", DropPrimaryKeyOnIdColumnOfGroupRolesTable.class) - .add(3461, "Add primary key on 'UUID' column of 'GROUP_ROLES' table", AddPrimaryKeyOnUuidColumnOfGroupRolesTable.class) - .add(3462, "Drop column 'ID' of 'GROUP_ROLES' table", DropIdColumnOfGroupRolesTable.class) - - // Migration of USER_ROLES table - .add(3463, "Add 'UUID' column on 'USER_ROLES' table", AddUuidColumnToUserRolesTable.class) - .add(3464, "Populate 'uuid' for 'USER_ROLES'", PopulateUserRolesUuid.class) - .add(3465, "Make 'uuid' column not nullable for 'USER_ROLES'", MakeUserRolesUuidColumnNotNullable.class) - .add(3466, "Drop primary key on 'ID' column of 'USER_ROLES' table", DropPrimaryKeyOnIdColumnOfUserRolesTable.class) - .add(3468, "Add primary key on 'UUID' column of 'USER_ROLES' table", AddPrimaryKeyOnUuidColumnOfUserRolesTable.class) - .add(3469, "Drop column 'ID' of 'USER_ROLES' table", DropIdColumnOfUserRolesTable.class) - - // Migration of FILE_SOURCES table - .add(3470, "Add 'UUID' column on 'FILE_SOURCES' table", AddUuidColumnToFileSourcesTable.class) - .add(3471, "Populate 'uuid' for 'FILE_SOURCES'", PopulateFileSourcesUuid.class) - .add(3472, "Make 'uuid' column not nullable for 'FILE_SOURCES'", MakeFileSourcesUuidColumnNotNullable.class) - .add(3473, "Drop primary key on 'ID' column of 'FILE_SOURCES' table", DropPrimaryKeyOnIdColumnOfFileSourcesTable.class) - .add(3474, "Add primary key on 'UUID' column of 'FILE_SOURCES' table", AddPrimaryKeyOnUuidColumnOfFileSourcesTable.class) - .add(3475, "Drop column 'ID' of 'FILE_SOURCES' table", DropIdColumnOfFileSourcesTable.class) - - // Migration of ISSUE_CHANGES table - .add(3476, "Copy 'ISSUE_CHANGES' table to 'ISSUE_CHANGES_COPY'", CopyIssueChangesTable.class) - .add(3477, "Drop 'ISSUE_CHANGES' table", DropIssueChangesTable.class) - .add(3478, "Rename table 'ISSUE_CHANGES_COPY' to 'ISSUE_CHANGES'", RenameIssueChangesCopyToIssueChanges.class) - .add(3479, "Add index on 'ISSUE_KEY' of 'ISSUE_CHANGES' table", AddIndexOnIssueKeyOfIssueChangesTable.class) - .add(3480, "Add index on 'KEE' of 'ISSUE_CHANGES' table", AddIndexOnKeeOfIssueChangesTable.class) - .add(3481, "Add primary key on 'UUID' column of 'ISSUE_CHANGES' table", AddPrimaryKeyOnUuidColumnOfIssueChangesTable.class) - .add(3482, "Add index on 'project_uuid' for table 'ISSUE_CHANGES'", AddIndexOnProjectUuidOnIssueChangesTable.class) - - // Migration of QUALITY_GATE_CONDITIONS table - .add(3483, "Add 'UUID' column on 'QUALITY_GATE_CONDITIONS' table", AddUuidColumnToQualityGateConditionsTable.class) - .add(3484, "Populate 'uuid' for 'QUALITY_GATE_CONDITIONS'", PopulateQualityGateConditionsUuid.class) - .add(3485, "Make 'uuid' column not nullable for 'QUALITY_GATE_CONDITIONS'", MakeQualityGateConditionsUuidColumnNotNullable.class) - .add(3486, "Drop primary key on 'ID' column of 'QUALITY_GATE_CONDITIONS' table", DropPrimaryKeyOnIdColumnOfQualityGateConditionsTable.class) - .add(3487, "Add primary key on 'UUID' column of 'QUALITY_GATE_CONDITIONS' table", AddPrimaryKeyOnUuidColumnOfQualityGateConditionsTable.class) - .add(3488, "Drop column 'ID' of 'QUALITY_GATE_CONDITIONS' table", DropIdColumnOfQualityGateConditionsTable.class) - - // Migration of PERM_TEMPLATES_GROUPS table - .add(3489, "Add 'UUID' column on 'PERM_TEMPLATES_GROUPS' table", AddUuidColumnToPermTemplatesGroupsTable.class) - .add(3490, "Populate 'uuid' for 'PERM_TEMPLATES_GROUPS'", PopulatePermTemplatesGroupsUuid.class) - .add(3491, "Make 'uuid' column not nullable for 'PERM_TEMPLATES_GROUPS'", MakePermTemplatesGroupsUuidColumnNotNullable.class) - .add(3492, "Drop primary key on 'ID' column of 'PERM_TEMPLATES_GROUPS' table", DropPrimaryKeyOnIdColumnOfPermTemplatesGroupsTable.class) - .add(3493, "Add primary key on 'UUID' column of 'PERM_TEMPLATES_GROUPS' table", AddPrimaryKeyOnUuidColumnOfPermTemplatesGroupsTable.class) - .add(3494, "Drop column 'ID' of 'PERM_TEMPLATES_GROUPS' table", DropIdColumnOfPermTemplatesGroupsTable.class) - - // Migration of PERM_TPL_CHARACTERISTICS table - .add(3495, "Add 'UUID' column on 'PERM_TPL_CHARACTERISTICS' table", AddUuidColumnToPermTplCharacteristicsTable.class) - .add(3496, "Populate 'uuid' for 'PERM_TPL_CHARACTERISTICS'", PopulatePermTplCharacteristicsUuid.class) - .add(3497, "Make 'uuid' column not nullable for 'PERM_TPL_CHARACTERISTICS'", MakePermTplCharacteristicsUuidColumnNotNullable.class) - .add(3498, "Drop primary key on 'ID' column of 'PERM_TPL_CHARACTERISTICS' table", DropPrimaryKeyOnIdColumnOfPermTplCharacteristicsTable.class) - .add(3499, "Add primary key on 'UUID' column of 'PERM_TPL_CHARACTERISTICS' table", AddPrimaryKeyOnUuidColumnOfPermTplCharacteristicsTable.class) - .add(3500, "Drop column 'ID' of 'PERM_TPL_CHARACTERISTICS' table", DropIdColumnOfPermTplCharacteristicsTable.class) - - // Migration of PERM_TEMPLATES_USERS table - .add(3501, "Add 'UUID' column on 'PERM_TEMPLATES_USERS' table", AddUuidColumnToPermTemplatesUsersTable.class) - .add(3502, "Populate 'uuid' for 'PERM_TEMPLATES_USERS'", PopulatePermTemplatesUsersUuid.class) - .add(3503, "Make 'uuid' column not nullable for 'PERM_TEMPLATES_USERS'", MakePermTemplatesUsersUuidColumnNotNullable.class) - .add(3504, "Drop primary key on 'ID' column of 'PERM_TEMPLATES_USERS' table", DropPrimaryKeyOnIdColumnOfPermTemplatesUsersTable.class) - .add(3505, "Add primary key on 'UUID' column of 'PERM_TEMPLATES_USERS' table", AddPrimaryKeyOnUuidColumnOfPermTemplatesUsersTable.class) - .add(3506, "Drop column 'ID' of 'PERM_TEMPLATES_USERS' table", DropIdColumnOfPermTemplatesUsersTable.class) - - // Migration of ACTIVE_RULES table - .add(3507, "Add 'UUID' column on 'ACTIVE_RULES' table", AddUuidColumnToActiveRulesTable.class) - .add(3508, "Populate 'uuid' for 'ACTIVE_RULES'", PopulateActiveRulesUuid.class) - .add(3509, "Make 'uuid' column not nullable for 'ACTIVE_RULES'", MakeActiveRulesUuidColumnNotNullable.class) - - // Migration of FK in ACTIVE_RULE_PARAMETERS to ACTIVE_RULES - .add(3510, "Add 'active_rule_uuid' column on 'ACTIVE_RULE_PARAMETERS' table", AddActiveRuleUuidColumnToActiveRuleParameters.class) - .add(3511, "Populate 'active_rule_uuid' for 'ACTIVE_RULE_PARAMETERS'", PopulateActiveRuleParametersActiveRuleUuid.class) - .add(3512, "Make 'active_rule_uuid' column not nullable for 'ACTIVE_RULE_PARAMETERS'", MakeActiveRuleParametersActiveRuleUuidNotNullable.class) - .add(3513, "Drop index on 'active_rule_id' column of 'ACTIVE_RULE_PARAMETERS' table", DropIndexOnActiveRuleIdOfActiveRuleParametersTable.class) - .add(3514, "Add index on 'active_rule_uuid' column of 'ACTIVE_RULE_PARAMETERS' table", AddIndexOnActiveRuleUuidOfActiveRuleParametersTable.class) - - // Finish migration of ACTIVE_RULES - .add(3515, "Drop primary key on 'ID' column of 'ACTIVE_RULES' table", DropPrimaryKeyOnIdColumnOfActiveRulesTable.class) - .add(3516, "Add primary key on 'UUID' column of 'ACTIVE_RULES' table", AddPrimaryKeyOnUuidColumnOfActiveRulesTable.class) - .add(3517, "Drop column 'ID' of 'ACTIVE_RULES' table", DropIdColumnOfActiveRulesTable.class) - .add(3518, "Drop column 'active_rule_id' of 'ACTIVE_RULE_PARAMETERS' table", DropActiveRuleIdColumnOfActiveRuleParametersTable.class) - - // Migration on RULES_PARAMETERS table - populate uuid column - .add(3519, "Add 'uuid' column for 'RULES_PARAMETERS'", AddUuidColumnToRulesParameters.class) - .add(3520, "Populate 'uuid' column for 'RULES_PARAMETERS'", PopulateRulesParametersUuid.class) - .add(3521, "Make 'uuid' column not nullable for 'RULES_PARAMETERS'", MakeRulesParametersUuidColumnNotNullable.class) - - // Migration of ACTIVE_RULE_PARAMS FK to RULES_PARAMETERS, switch from ruleParamId to ruleParamUuid - .add(3522, "Add 'rules_parameter_uuid' column for 'ACTIVE_RULE_PARAMS' table", AddRulesParameterUuidColumnToActiveRuleParameters.class) - .add(3523, "Populate 'rules_parameter_uuid' column for 'ACTIVE_RULE_PARAMS' table", PopulateActiveRuleParametersRulesParameterUuid.class) - .add(3524, "Make 'rules_parameter_uuid' column not nullable for 'ACTIVE_RULE_PARAMS' table", MakeActiveRuleParametersRulesParameterUuidColumnNotNullable.class) - .add(3525, "Drop column 'rules_parameter_id' of 'ACTIVE_RULE_PARAMS' table", DropRulesParameterIdColumnOfActiveRuleParametersTable.class) - - // Migration on RULES_PARAMETERS table change PK - .add(3526, "Drop primary key on 'ID' column of 'RULES_PARAMETERS' table", DropPrimaryKeyOnIdColumnOfRulesParametersTable.class) - .add(3527, "Add primary key on 'UUID' column of 'RULES_PARAMETERS' table", AddPrimaryKeyOnUuidColumnOfRulesParametersTable.class) - .add(3528, "Drop column 'ID' of 'RULES_PARAMETERS' table", DropIdColumnOfRulesParametersTable.class) - - // Migration of METRICS table - .add(3529, "Add 'UUID' column on 'METRICS' table", AddUuidColumnToMetricsTable.class) - .add(3530, "Populate 'uuid' for 'METRICS'", PopulateMetricsUuid.class) - .add(3531, "Make 'uuid' column not nullable for 'METRICS'", MakeMetricsUuidColumnNotNullable.class) - - // Migration of FK in PROJECT_MEASURES to METRICS - .add(3532, "Add 'metric_uuid' column on 'PROJECT_MEASURES' table", AddMetricUuidColumnToProjectMeasures.class) - .add(3533, "Populate 'metric_uuid' for 'PROJECT_MEASURES'", PopulateProjectMeasuresMetricUuid.class) - .add(3534, "Make 'metric_uuid' column not nullable for 'PROJECT_MEASURES'", MakeProjectMeasuresMetricUuidNotNullable.class) - .add(3535, "Drop index on 'metric_id' and 'analysis_uuid' columns of 'PROJECT_MEASURES' table", DropIndexOnMetricIdOfProjectMeasuresTable.class) - .add(3536, "Add index on 'metric_uuid' and 'analysis_uuid' columns of 'PROJECT_MEASURES' table", AddIndexOnMetricUuidAndAnalysisUuidOfProjectMeasuresTable.class) - - // Migration of FK in QUALITY_GATE_CONDITIONS to METRICS - .add(3537, "Add 'metric_uuid' column on 'QUALITY_GATE_CONDITIONS' table", AddMetricUuidColumnToQualityGateConditions.class) - .add(3538, "Populate 'metric_uuid' for 'QUALITY_GATE_CONDITIONS'", PopulateQualityGateConditionsMetricUuid.class) - .add(3539, "Make 'metric_uuid' column not nullable for 'QUALITY_GATE_CONDITIONS'", MakeQualityGateConditionsMetricUuidNotNullable.class) - - // Migration of FK in LIVE_MEASURES to METRICS - .add(3540, "Copy 'LIVE_MEASURES' table to 'LIVE_MEASURES_COPY'", CopyLiveMeasuresTable.class) - .add(3541, "Drop 'LIVE_MEASURES' table", DropLiveMeasuresTable.class) - .add(3542, "Rename table 'LIVE_MEASURES_COPY' to 'LIVE_MEASURES'", RenameLiveMeasuresCopyToLiveMeasures.class) - .add(3543, "Add primary key on 'uuid' column of 'LIVE_MEASURES' table", AddPKeyOnUuidOfLiveMeasuresTable.class) - .add(3544, "Add index on 'project_uuid' column of 'LIVE_MEASURES' table", AddIndexOnProjectUuidOfLiveMeasuresTable.class) - .add(3545, "Add index on 'metric_uuid' column of 'LIVE_MEASURES' table", AddIndexOnMetricUuidOfLiveMeasuresTable.class) - - // Migration of FK in MANUAL_MEASURES to METRICS - .add(3546, "Add 'metric_uuid' column on 'MANUAL_MEASURES' table", AddMetricUuidColumnToManualMeasures.class) - .add(3547, "Populate 'metric_uuid' for 'MANUAL_MEASURES'", PopulateManualMeasuresMetricUuid.class) - .add(3548, "Make 'metric_uuid' column not nullable for 'MANUAL_MEASURES'", MakeManualMeasuresMetricUuidNotNullable.class) - - // Finish migration of METRICS - .add(3549, "Drop primary key on 'ID' column of 'METRICS' table", DropPrimaryKeyOnIdColumnOfMetricsTable.class) - .add(3550, "Add primary key on 'UUID' column of 'METRICS' table", AddPrimaryKeyOnUuidColumnOfMetricsTable.class) - .add(3551, "Drop column 'METRIC_ID' of 'PROJECT_MEASURES' table", DropMetricIdColumnOfProjectMeasuresTable.class) - .add(3552, "Drop column 'METRIC_ID' of 'QUALITY_GATE_CONDITIONS' table", DropMetricIdColumnOfQualityGateConditionsTable.class) - .add(3554, "Drop column 'METRIC_ID' of 'MANUAL_MEASURES' table", DropMetricIdColumnOfManualMeasuresTable.class) - .add(3555, "Drop column 'ID' of 'METRICS' table", DropIdColumnOfMetricsTable.class) - - // Migration of PERMISSION_TEMPLATES table - .add(3556, "Add 'UUID' column on 'PERMISSION_TEMPLATES' table", AddUuidColumnToPermissionTemplates.class) - .add(3557, "Populate 'uuid' for 'PERMISSION_TEMPLATES'", PopulatePermissionTemplatesUuid.class) - .add(3558, "Make 'uuid' column not nullable for user_tokens", MakePermissionTemplateUuidColumnNotNullable.class) - - // Migration of PERM_TEMPLATES_GROUPS FK to PERMISSION_TEMPLATES, switch from templateId to templateUuid - .add(3559, "Add 'template_uuid' column for 'PERM_TEMPLATES_GROUPS' table", AddTemplateUuidColumnToPermTemplatesGroups.class) - .add(3560, "Populate 'template_uuid' column for 'PERM_TEMPLATES_GROUPS' table", PopulatePermTemplatesGroupsTemplateUuidColumn.class) - .add(3561, "Make 'template_uuid' column not nullable for 'PERM_TEMPLATES_GROUPS' table", MakePermTemplatesGroupsTemplateUuidColumnNotNullable.class) - .add(3562, "Drop column 'template_id' of 'PERM_TEMPLATES_GROUPS' table", DropTemplateIdColumnOfPermTemplatesGroupsTable.class) - - // Migration of PERM_TEMPLATES_USERS FK to PERMISSION_TEMPLATES, switch from templateId to templateUuid - .add(3563, "Add 'template_uuid' column for 'PERM_TEMPLATES_USERS' table", AddTemplateUuidColumnToPermTemplatesUsers.class) - .add(3564, "Populate 'template_uuid' column for 'PERM_TEMPLATES_USERS' table", PopulatePermTemplatesUsersTemplateUuidColumn.class) - .add(3565, "Make 'template_uuid' column not nullable for 'PERM_TEMPLATES_USERS' table", MakePermTemplatesUsersTemplateUuidColumnNotNullable.class) - .add(3566, "Drop column 'template_id' of 'PERM_TEMPLATES_USERS' table", DropTemplateIdColumnOfPermTemplatesUsersTable.class) - - // Migration of PERM_TPL_CHARACTERISTICS FK to PERMISSION_TEMPLATES, switch from templateId to templateUuid - .add(3567, "Add 'template_uuid' column for 'PERM_TPL_CHARACTERISTICS' table", AddTemplateUuidColumnToPermTplCharacteristics.class) - .add(3568, "Populate 'template_uuid' column for 'PERM_TPL_CHARACTERISTICS' table", PopulatePermTplCharacteristicsTemplateUuidColumn.class) - .add(3569, "Make 'template_uuid' column not nullable for 'PERM_TPL_CHARACTERISTICS' table", MakePermTplCharacteristicsTemplateUuidColumnNotNullable.class) - .add(3570, "Drop unique constraint on 'template_id', 'permission_key' columns 'PERM_TPL_CHARACTERISTICS' table", - DropUniqueIndexOnTemplateIdAndPermissionKeyColumnsOfPermTplCharacteristicsTable.class) - .add(3571, "Add unique constraint on 'template_uuid', 'permission_key' columns 'PERM_TPL_CHARACTERISTICS' table", - AddUniqueIndexOnTemplateUuidAndPermissionKeyColumnsOfPermTplCharacteristicsTable.class) - - .add(3572, "Drop column 'template_id' of 'PERM_TPL_CHARACTERISTICS' table", DropTemplateIdColumnOfPermTplCharacteristicsTable.class) - - .add(3573, "Drop primary key on 'ID' column of 'PERMISSION_TEMPLATES' table", DropPrimaryKeyOnIdColumnOfPermissionTemplatesTable.class) - .add(3574, "Add primary key on 'UUID' column of 'PERMISSION_TEMPLATES' table", AddPrimaryKeyOnUuidColumnOfPermissionTemplatesTable.class) - - .add(3575, "Drop column 'ID' of 'PERMISSION_TEMPLATES' table", DropIdColumnOfPermissionTemplatesTable.class) - .add(3576, "Drop column 'KEE' of 'PERMISSION_TEMPLATES' table", DropKeeColumnOfPermissionTemplatesTable.class) - - // Migration on RULES_PROFILES table - .add(3577, "Add 'uuid' column for 'RULES_PROFILES'", AddUuidColumnToRulesProfilesTable.class) - .add(3578, "Populate 'uuid' column for 'RULES_PROFILES'", PopulateRulesProfilesUuid.class) - .add(3579, "Make 'uuid' column not nullable for 'RULES_PROFILES'", MakeRulesProfilesUuidColumnNotNullable.class) - - // Migration of ORG_QPROFILES FK to RULES_PROFILES - .add(3580, "Populate 'rules_profile_uuid' column for 'ORG_QPROFILES' table", PopulateOrgQProfilesRulesProfileUuid.class) - - // Migration of QPROFILE_CHANGES FK to RULES_PROFILES - .add(3581, "Populate 'rules_profile_uuid' column for 'QPROFILE_CHANGES' table", PopulateQProfileChangesRulesProfileUuid.class) - - // Migration of ACTIVE_RULES FK to RULES_PROFILES, switch from profile_id to profile_uuid - .add(3582, "Add 'profile_uuid' column for 'ACTIVE_RULES' table", AddProfileUuidColumnToActiveRulesTable.class) - .add(3583, "Populate 'profile_uuid' column for 'ACTIVE_RULES' table", PopulateActiveRulesProfileUuid.class) - .add(3584, "Make 'profile_uuid' column not nullable for 'ACTIVE_RULES' table", MakeActiveRulesProfileUuidColumnNotNullable.class) - - .add(3585, "Drop unique constraint on 'profile_id', 'rule_id' columns 'ACTIVE_RULES' table", DropUniqueIndexOnProfileIdColumnOfActiveRulesTable.class) - .add(3586, "Add unique constraint on 'profile_uuid', 'rule_id' columns 'ACTIVE_RULES' table", AddUniqueIndexOnProfileUuidColumnOfActiveRulesTable.class) - - .add(3587, "Drop column 'profile_id' of 'ACTIVE_RULES' table", DropProfileIdColumnOfActiveRulesTable.class) - - .add(3588, "Drop unique constraint on 'kee' columns 'RULES_PROFILES' table", DropUniqueIndexOnKeeColumnOfRulesProfilesTable.class) - .add(3589, "Drop column 'kee' of 'RULES_PROFILES' table", DropKeeColumnOfRulesProfilesTable.class) - - .add(3590, "Drop primary key on 'ID' column of 'RULES_PROFILES' table", DropPrimaryKeyOnIdColumnOfRulesProfilesTable.class) - .add(3591, "Add primary key on 'UUID' column of 'RULES_PROFILES' table", AddPrimaryKeyOnUuidColumnOfRulesProfilesTable.class) - .add(3592, "Drop column 'ID' of 'RULES_PROFILES' table", DropIdColumnOfRulesProfilesTable.class) - - // Migration of PROPERTIES table - .add(3593, "Add 'uuid' column for 'PROPERTIES'", AddUuidColumnToProperties.class) - .add(3594, "Populate 'uuid' for 'PROPERTIES'", PopulatePropertiesUuid.class) - .add(3595, "Make 'uuid' column not nullable for 'PROPERTIES'", MakePropertiesUuidColumnNotNullable.class) - .add(3596, "Drop primary key on 'ID' column of 'PROPERTIES' table", DropPrimaryKeyOnIdColumnOfPropertiesTable.class) - .add(3597, "Add primary key on 'UUID' column of 'PROPERTIES' table", AddPrimaryKeyOnUuidColumnOfPropertiesTable.class) - .add(3598, "Drop column 'ID' of 'PROPERTIES' table", DropIdColumnOfPropertiesTable.class) - - // Migration of GROUPS table - .add(3599, "Add 'UUID' column on 'GROUPS' table", AddUuidColumnToGroupsTable.class) - .add(3600, "Populate 'uuid' for 'GROUPS'", PopulateGroupsUuid.class) - .add(3601, "Make 'uuid' column not nullable for 'GROUPS'", MakeGroupsUuidColumnNotNullable.class) - - // Migration of FK in GROUP_ROLES to GROUPS - .add(3602, "Add 'group_uuid' column on 'GROUP_ROLES' table", AddGroupUuidColumnToGroupRoles.class) - .add(3603, "Populate 'group_uuid' for 'GROUP_ROLES'", PopulateGroupRolesGroupUuid.class) - .add(3604, "Drop index on 'group_id' column of 'GROUP_ROLES' table", DropIndexOnGroupIdOfGroupRolesTable.class) - .add(3605, "Add index on 'group_uuid' column of 'GROUP_ROLES' table", AddIndexOnGroupUuidOfGroupRolesTable.class) - - // Migration of FK in GROUPS_USERS to GROUPS - .add(3606, "Add 'group_uuid' column on 'GROUPS_USERS' table", AddGroupUuidColumnToGroupsUsers.class) - .add(3607, "Populate 'group_uuid' for 'GROUPS_USERS'", PopulateGroupsUsersGroupUuid.class) - .add(3608, "Make 'group_uuid' column not nullable for 'GROUPS_USERS'", MakeGroupsUsersGroupUuidNotNullable.class) - .add(3609, "Drop index on 'group_id' column of 'GROUPS_USERS' table", DropIndexOnGroupIdOfGroupsUsersTable.class) - .add(3610, "Add index on 'group_uuid' column of 'GROUPS_USERS' table", AddIndexOnGroupUuidOfGroupsUsersTable.class) - - // Migration of FK in ORGANIZATIONS to GROUPS - .add(3611, "Add 'default_group_uuid' column on 'ORGANIZATIONS' table", AddDefaultGroupUuidColumnToOrganizations.class) - .add(3612, "Populate 'default_group_uuid' for 'ORGANIZATIONS'", PopulateOrganizationsDefaultGroupUuid.class) - - // Migration of FK in PERM_TEMPLATES_GROUPS to GROUPS - .add(3613, "Add 'group_uuid' column on 'PERM_TEMPLATES_GROUPS' table", AddGroupUuidColumnToPermTemplatesGroups.class) - .add(3614, "Populate 'group_uuid' for 'PERM_TEMPLATES_GROUPS'", PopulatePermTemplatesGroupsGroupUuid.class) - - // Migration of FK in QPROFILE_EDIT_GROUPS to GROUPS - .add(3615, "Add 'group_uuid' column on 'QPROFILE_EDIT_GROUPS' table", AddGroupUuidColumnToQProfileEditGroups.class) - .add(3616, "Populate 'group_uuid' for 'QPROFILE_EDIT_GROUPS'", PopulateQProfileEditGroupsGroupUuid.class) - .add(3617, "Make 'group_uuid' column not nullable for 'QPROFILE_EDIT_GROUPS'", MakeQProfileEditGroupsGroupUuidNotNullable.class) - .add(3618, "Drop index on 'group_id' column of 'QPROFILE_EDIT_GROUPS' table", DropIndexOnGroupIdOfQProfileEditGroupsTable.class) - .add(3619, "Add index on 'group_uuid' column of 'QPROFILE_EDIT_GROUPS' table", AddIndexOnGroupUuidOfQProfileEditGroupsTable.class) - - // Finish migration of Groups - .add(3620, "Drop primary key on 'ID' column of 'GROUPS' table", DropPrimaryKeyOnIdColumnOfGroupsTable.class) - .add(3621, "Add primary key on 'UUID' column of 'GROUPS' table", AddPrimaryKeyOnUuidColumnOfGroupsTable.class) - - .add(3622, "Drop column 'group_id' of 'GROUP_ROLES' table", DropGroupIdColumnOfGroupRolesTable.class) - .add(3623, "Drop column 'group_id' of 'GROUPS_USERS' table", DropGroupIdColumnOfGroupsUsersTable.class) - .add(3624, "Drop column 'group_id' of 'ORGANIZATIONS' table", DropDefaultGroupIdColumnOfOrganizationsTable.class) - .add(3625, "Drop column 'group_id' of 'PERM_TEMPLATES_GROUPS' table", DropGroupIdColumnOfPermTemplatesGroupsTable.class) - .add(3626, "Drop column 'group_id' of 'QPROFILE_EDIT_GROUPS' table", DropGroupIdColumnOfQProfileEditGroupsTable.class) - .add(3627, "Drop column 'ID' of 'GROUPS' table", DropIdColumnOfGroupsTable.class) - - // Migration of QUALITY_GATES_CONDITIONS FK to QUALITY_GATES, switch from qgate_id to qgate_uuid - .add(3628, "Add 'qgate_uuid' column for quality gates conditions", AddQGateUuidColumnForQGateConditions.class) - .add(3629, "Populate 'qgate_uuid' column for quality gates conditions", PopulateQGateUuidColumnForQGateConditions.class) - .add(3630, "drop orphans quality gates conditions", DropOrphansQGateConditions.class) - .add(3631, "Make 'qgate_uuid' column not nullable for quality gates conditions", MakeQGateUuidColumnNotNullableForQGateConditions.class) - .add(3632, "Drop 'qgate_id' column for quality gates conditions", DropQGateIdColumnForQGateConditions.class) - - // Migrations of QUALITY_GATES table - .add(3633, "Drop primary key on 'ID' column of 'QUALITY_GATES' table", DropPrimaryKeyOnIdColumnOfQGatesTable.class) - .add(3634, "drop unique index on 'UUID' column of 'QUALITY_GATES' table", DropUniqueIndexOnUuidColumnOfQualityGatesTable.class) - .add(3635, "Add primary key on 'UUID' column of 'QUALITY_GATES' table", AddPrimaryKeyOnUuidColumnOfQGatesTable.class) - .add(3636, "Drop column 'ID' of 'QUALITY_GATES' table", DropIdColumnOfQGateTable.class) - - // Migration of FK in GROUPS_USERS to USERS - .add(3637, "Add 'user_uuid' column on 'GROUPS_USERS' table", AddUserUuidColumnToGroupsUsers.class) - .add(3638, "Populate 'user_uuid' for 'GROUPS_USERS'", PopulateGroupsUsersUserUuid.class) - .add(3639, "Make 'user_uuid' column not nullable for 'GROUPS_USERS'", MakeGroupsUsersUserUuidColumnNotNullable.class) - .add(3640, "Drop index on 'user_id' column of 'GROUPS_USERS' table", DropIndexOnUserIdOfGroupsUsersTable.class) - .add(3641, "Add index on 'user_uuid' column of 'GROUPS_USERS' table", AddIndexOnUserUuidOfGroupsUsersTable.class) - .add(3642, "Drop index on 'user_id', 'group_id' columns of 'GROUPS_USERS' table", DropUniqueIndexOnUserIdAndGroupIdOfGroupsUsersTable.class) - .add(3643, "Add unique index on 'user_uuid', 'group_id' columns of 'GROUPS_USERS' table", AddUniqueIndexOnUserUuidAndGroupIdOfGroupsUsersTable.class) - .add(3644, "Drop column on 'user_id' column of 'GROUPS_USERS' table", DropUserIdColumnOfGroupsUsersTable.class) - - // Migration of FK in ORGANIZATION_MEMBERS to USERS - .add(3645, "Add 'user_uuid' column on 'ORGANIZATION_MEMBERS' table", AddUserUuidColumnToOrganizationMembers.class) - .add(3646, "Populate 'user_uuid' for 'ORGANIZATION_MEMBERS'", PopulateOrganizationMembersUserUuid.class) - .add(3647, "Make 'user_uuid' not-null for 'ORGANIZATION_MEMBERS'", MakeOrganizationMembersUserUuidColumnNotNullable.class) - .add(3648, "Drop index on 'user_id' column of 'ORGANIZATION_MEMBERS' table", DropIndexOnUserIdOfOrganizationMembersTable.class) - .add(3649, "Add index on 'user_uuid' column of 'ORGANIZATION_MEMBERS' table", AddIndexOnUserUuidOfOrganizationMembersTable.class) - .add(3650, "Drop primary key on 'user_id' column of 'ORGANIZATION_MEMBERS' table", DropPrimaryKeyOnUserIdAndOrganizationUuidOfOrganizationMembersTable.class) - .add(3651, "Add PK on 'user_uuid', 'organization_uuid' columns of 'ORGANIZATION_MEMBERS' table", AddPrimaryKeyOnUserUuidAndOrganizationUuidColumnsOfUserRolesTable.class) - .add(3652, "Drop column on 'user_id' column of 'ORGANIZATION_MEMBERS' table", DropUserIdColumnOfOrganizationMembersTable.class) - - // Migration of FK in PERM_TEMPLATES_USERS to USERS - .add(3653, "Add 'user_uuid' column on 'PERM_TEMPLATES_USERS' table", AddUserUuidColumnToPermTemplatesUsers.class) - .add(3654, "Populate 'user_uuid' for 'PERM_TEMPLATES_USERS'", PopulatePermTemplatesUsersUserUuid.class) - .add(3655, "Make 'user_uuid' not-null for 'PERM_TEMPLATES_USERS'", MakePermTemplatesUsersUserUuidColumnNotNullable.class) - .add(3656, "Drop column on 'user_id' column of 'PERM_TEMPLATES_USERS' table", DropUserIdColumnOfPermTemplatesUsersTable.class) - - // Migration of FK in PROPERTIES to USERS - .add(3657, "Add 'user_uuid' column on 'PROPERTIES' table", AddUserUuidColumnToPropertiesUsers.class) - .add(3658, "Populate 'user_uuid' for 'PROPERTIES'", PopulatePropertiesUserUuid.class) - .add(3659, "Drop column on 'user_id' column of 'PROPERTIES' table", DropUserIdColumnOfPropertiesTable.class) - - // Migration of FK in QPROFILE_EDIT_USERS to USERS - .add(3660, "Add 'user_uuid' column on 'QPROFILE_EDIT_USERS' table", AddUserUuidColumnToQProfileEditUsers.class) - .add(3661, "Populate 'user_uuid' for 'QPROFILE_EDIT_USERS'", PopulateQProfileEditUsersUserUuid.class) - .add(3662, "Make 'user_uuid' not-null for 'QPROFILE_EDIT_USERS'", MakeQProfileEditUsersUserUuidColumnNotNullable.class) - .add(3663, "Drop unique index on 'user_id','qprofile_uuid' columns of 'QPROFILE_EDIT_USERS' table", DropUniqueIndexOnUserIdAndQProfileUuidOfQProfileEditUsersTable.class) - .add(3664, "Add unique index on 'user_uuid','qprofile_uuid' columns of 'QPROFILE_EDIT_USERS' table", AddUniqueIndexOnUserUuidAndQProfileUuidOfQProfileEditUsersTable.class) - .add(3665, "Drop column on 'user_id' column of 'QPROFILE_EDIT_USERS' table", DropUserIdColumnOfQProfileEditUsersTable.class) - - .add(3666, "Add 'user_uuid' column on 'USER_ROLES' table", AddUserUuidColumnToUserRoles.class) - .add(3667, "Populate 'user_uuid' for 'USER_ROLES'", PopulateUserRolesUserUuid.class) - .add(3668, "Drop unique index on 'user_id' column of 'USER_ROLES' table", DropIndexOnUserIdOfUserRolesTable.class) - .add(3669, "Add unique index on 'user_uuid' columns of 'USER_ROLES' table", AddIndexOnUserUuidOfUserRolesTable.class) - .add(3670, "Drop column on 'user_id' column of 'USER_ROLES' table", DropUserIdColumnOfUserRolesTable.class) - - .add(3671, "Drop unique index on 'user_id' column of 'USERS' table", DropUniqueIndexOnUuidColumnOfUsersTable.class) - .add(3672, "Drop PK index on 'id' column of 'USERS' table", DropPrimaryKeyOnIdColumnOfUsersTable.class) - .add(3673, "Add PK index on 'uuid' column of 'USERS' table", AddPrimaryKeyOnUuidColumnOfUsersTable.class) - .add(3674, "Drop 'id' column of 'USERS' table", DropIdColumnOfUsersTable.class) - - // Migration of RULES table - .add(3675, "Add 'uuid' column for 'RULES'", AddUuidAndTemplateUuidColumnsToRules.class) - .add(3676, "Populate 'uuid' column for 'RULES'", PopulateRulesUuid.class) - .add(3677, "Make 'uuid' column not nullable for 'RULES'", MakeRulesUuidColumnNotNullable.class) - .add(3678, "Populate 'templateUuid' column for 'RULES'", PopulateRulesTemplateUuid.class) - .add(3679, "Drop column 'templateId' column for 'RULES'", DropTemplateIdColumnOfRulesTable.class) - // Migration of RULES_METADATA FK to RULES, switch from rule_id to rule_uuid - .add(3680, "Add 'RULE_UUID' column for 'RULES_METADATA' table", AddRuleUuidColumnToRulesMetadataTable.class) - .add(3681, "Populate 'RULE_UUID' column for 'RULES_METADATA' table", PopulateRulesMetadataRuleUuidColumn.class) - .add(3682, "Make 'RULE_UUID' column not nullable for 'RULES_METADATA' table", MakeRulesMetadataRuleUuidColumnNotNullable.class) - .add(3683, "Drop primary key on 'RULE_ID' column of 'RULES_METADATA' table", DropPrimaryKeyOnIdColumnOfRulesMetadataTable.class) - .add(3684, "Add primary key on 'RULE_UUID' column of 'RULES_METADATA' table", AddPrimaryKeyOnUuidAndOrganizationUuidColumnOfRulesMetadataTable.class) - .add(3685, "Drop column 'RULE_ID' of 'RULES_METADATA' table", DropRuleIdColumnOfRulesMetadataTable.class) - // Migration of RULES_PARAMETERS FK to RULES, switch from rule_id to rule_uuid - .add(3686, "Add 'RULE_UUID' column for 'RULES_PARAMETERS' table", AddRuleUuidColumnToRulesParametersTable.class) - .add(3687, "Populate 'RULE_UUID' column for 'RULES_PARAMETERS' table", PopulateRulesParametersRuleUuidColumn.class) - .add(3688, "Make 'RULE_UUID' column not nullable for 'RULES_PARAMETERS' table", MakeRulesParametersRuleUuidColumnNotNullable.class) - .add(3689, "Drop indexes on 'RULE_ID' of 'RULES_PARAMETERS' table", DropIndexesOnRuleIdColumnOfRulesParametersTable.class) - .add(3690, "Add indexes to 'RULES_PARAMETERS' table", AddIndexesToRulesParametersTable.class) - .add(3691, "Drop column 'RULE_ID' of 'RULES_PARAMETERS' table", DropRuleIdColumnOfRulesParametersTable.class) - // Migration of ACTIVE_RULES FK to RULES, switch from rule_id to rule_uuid - .add(3692, "Add 'RULE_UUID' column for 'ACTIVE_RULES' table", AddRuleUuidColumnToActiveRulesTable.class) - .add(3693, "Populate 'RULE_UUID' column for 'ACTIVE_RULES' table", PopulateActiveRulesRuleUuidColumn.class) - .add(3694, "Make 'RULE_UUID' column not nullable for 'ACTIVE_RULES' table", MakeActiveRulesRuleUuidColumnNotNullable.class) - .add(3695, "Drop indexes on 'RULE_ID' of 'ACTIVE_RULES' table", DropIndexOnRuleIdColumnOfActiveRulesTable.class) - .add(3696, "Add indexes to 'ACTIVE_RULES' table", AddIndexToActiveRulesTable.class) - .add(3697, "Drop column 'RULE_ID' of 'ACTIVE_RULES' table", DropRuleIdColumnOfActiveRulesTable.class) - // Migration of DEPRECATED_RULE_KEYS FK to RULES, switch from rule_id to rule_uuid - .add(3698, "Add 'RULE_UUID' column for 'DEPRECATED_RULE_KEYS' table", AddRuleUuidColumnToDeprecatedRuleKeysTable.class) - .add(3699, "Populate 'RULE_UUID' column for 'DEPRECATED_RULE_KEYS' table", PopulateDeprecatedRuleKeysRuleUuidColumn.class) - .add(3700, "Make 'RULE_UUID' column not nullable for 'DEPRECATED_RULE_KEYS' table", MakeDeprecatedRuleKeysRuleUuidColumnNotNullable.class) - .add(3701, "Drop index on 'RULE_ID' of 'DEPRECATED_RULE_KEYS' table", DropIndexOnRuleIdColumnOfDeprecatedRuleKeysTable.class) - .add(3702, "Add index to 'DEPRECATED_RULE_KEYS' table", AddIndexToDeprecatedRuleKeysTable.class) - .add(3703, "Drop column 'RULE_ID' of 'DEPRECATED_RULE_KEYS' table", DropRuleIdColumnOfDeprecatedRuleKeysTable.class) - // Migration of ISSUE FK to RULES, switch from rule_id to rule_uuid - .add(3704, "Copy 'ISSUES' table to 'ISSUES_COPY", CopyIssuesTable.class) - .add(3705, "Drop 'ISSUES' table", DropIssuesTable.class) - .add(3706, "Rename 'ISSUES_COPY' table to 'ISSUES'", RenameIssuesCopyToIssues.class) - .add(3707, "Add indexes to 'ISSUES' table", AddIndexesToIssuesTable.class) - .add(3708, "Add primary key on 'KEE' column of 'ISSUES' table", AddPrimaryKeyOnKeeColumnOfIssuesTable.class) - - // continue with RULES table cleanup - .add(3709, "Drop primary key on 'ID' column of 'RULES' table", DropPrimaryKeyOnIdColumnOfRulesTable.class) - .add(3710, "Add primary key on 'UUID' column of 'RULES' table", AddPrimaryKeyOnUuidColumnOfRulesTable.class) - .add(3711, "Drop column 'ID' of 'RULES' table", DropIdColumnOfRulesTable.class) - - .add(3800, "Remove favourites for components with qualifiers 'DIR', 'FIL', 'UTS'", RemoveFilesFavouritesFromProperties.class) - .add(3801, "Create 'SESSION_TOKENS' table", CreateSessionTokensTable.class) - .add(3802, "Create 'SAML_MESSAGE_IDS' table", CreateSamlMessageIdsTable.class) - - .add(3803, "Add 'need_issue_sync' column to 'project_branches' table", AddProjectBranchesNeedIssueSync.class) - .add(3804, "Populate 'need_issue_sync' of 'project_branches'", PopulateProjectBranchesNeedIssueSync.class) - .add(3805, "Make 'need_issue_sync' of 'project_branches' not null", MakeProjectBranchesNeedIssueSyncNonNull.class) - - // Migration of ALM_SETTINGS table - .add(3807, "Add columns 'CLIENT_ID' and 'CLIENT_SECRET' to 'ALM_SETTINGS' table", AddClientIdAndClientSecretColumns.class) - - - // Removing old data from project_measures - .add(3808, "Add index on 'metric_uuid' column of 'PROJECT_MEASURES' table", AddIndexOnMetricUuidOfProjectMeasuresTable.class) - .add(3809, "Remove old Security Review Rating ProjectMeasures", DeleteSecurityReviewRatingProjectMeasures.class) - ; - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/MakeProjectBranchesNeedIssueSyncNonNull.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/MakeProjectBranchesNeedIssueSyncNonNull.java deleted file mode 100644 index 098d456e05a..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/MakeProjectBranchesNeedIssueSyncNonNull.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.def.BooleanColumnDef; -import org.sonar.server.platform.db.migration.sql.AlterColumnsBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class MakeProjectBranchesNeedIssueSyncNonNull extends DdlChange { - public MakeProjectBranchesNeedIssueSyncNonNull(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new AlterColumnsBuilder(getDialect(), "project_branches") - .updateColumn(BooleanColumnDef.newBooleanColumnDefBuilder() - .setColumnName("need_issue_sync") - .setIsNullable(false) - .setDefaultValue(null) - .build()) - .build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/PopulateProjectBranchesNeedIssueSync.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/PopulateProjectBranchesNeedIssueSync.java deleted file mode 100644 index 58c06c72c1c..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/PopulateProjectBranchesNeedIssueSync.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.step.DataChange; -import org.sonar.server.platform.db.migration.step.MassUpdate; - -public class PopulateProjectBranchesNeedIssueSync extends DataChange { - public PopulateProjectBranchesNeedIssueSync(Database db) { - super(db); - } - - @Override - protected void execute(Context context) throws SQLException { - MassUpdate massUpdate = context.prepareMassUpdate(); - massUpdate.select("select uuid from project_branches where need_issue_sync is null"); - massUpdate.update("update project_branches set need_issue_sync = ? where uuid = ?"); - massUpdate.execute((row, update) -> { - String uuid = row.getString(1); - update.setBoolean(1, false); - update.setString(2, uuid); - return true; - }); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/RemoveFilesFavouritesFromProperties.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/RemoveFilesFavouritesFromProperties.java deleted file mode 100644 index 4acf4946eb1..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/RemoveFilesFavouritesFromProperties.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.step.DataChange; -import org.sonar.server.platform.db.migration.step.MassUpdate; - -public class RemoveFilesFavouritesFromProperties extends DataChange { - - public RemoveFilesFavouritesFromProperties(Database db) { - super(db); - } - - @Override - protected void execute(Context context) throws SQLException { - MassUpdate massUpdate = context.prepareMassUpdate(); - massUpdate.select("select p.uuid from components c " + - "join properties p on c.uuid = p.component_uuid " + - "where p.prop_key = ? and c.qualifier in ('FIL', 'DIR', 'UTS')") - .setString(1, "favourite"); - massUpdate.update("delete from properties where uuid = ?"); - - massUpdate.execute((row, update) -> { - String propertyUuid = row.getString(1); - update.setString(1, propertyUuid); - return true; - }); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/activeruleparameters/AddPrimaryKeyOnUuidColumnOfActiveRuleParametersTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/activeruleparameters/AddPrimaryKeyOnUuidColumnOfActiveRuleParametersTable.java deleted file mode 100644 index d7b3e44ee31..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/activeruleparameters/AddPrimaryKeyOnUuidColumnOfActiveRuleParametersTable.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.activeruleparameters; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.AddPrimaryKeyBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class AddPrimaryKeyOnUuidColumnOfActiveRuleParametersTable extends DdlChange { - - public AddPrimaryKeyOnUuidColumnOfActiveRuleParametersTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new AddPrimaryKeyBuilder("active_rule_parameters", "uuid").build()); - } - -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/activeruleparameters/AddUuidColumnToActiveRuleParametersTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/activeruleparameters/AddUuidColumnToActiveRuleParametersTable.java deleted file mode 100644 index d40f5da21f3..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/activeruleparameters/AddUuidColumnToActiveRuleParametersTable.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.activeruleparameters; - -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.version.v84.common.AddUuidColumnToTable; - -public class AddUuidColumnToActiveRuleParametersTable extends AddUuidColumnToTable { - private static final String TABLE = "active_rule_parameters"; - - public AddUuidColumnToActiveRuleParametersTable(Database db) { - super(db, TABLE); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/activeruleparameters/DropIdColumnOfActiveRuleParametersTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/activeruleparameters/DropIdColumnOfActiveRuleParametersTable.java deleted file mode 100644 index d83dee78f31..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/activeruleparameters/DropIdColumnOfActiveRuleParametersTable.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.activeruleparameters; - -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.version.v84.common.DropIdColumn; - -public class DropIdColumnOfActiveRuleParametersTable extends DropIdColumn { - private static final String TABLE = "active_rule_parameters"; - - public DropIdColumnOfActiveRuleParametersTable(Database db) { - super(db, TABLE); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/activeruleparameters/DropPrimaryKeyOnIdColumnOfActiveRuleParametersTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/activeruleparameters/DropPrimaryKeyOnIdColumnOfActiveRuleParametersTable.java deleted file mode 100644 index 5f08f125278..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/activeruleparameters/DropPrimaryKeyOnIdColumnOfActiveRuleParametersTable.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.activeruleparameters; - -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.DropPrimaryKeySqlGenerator; -import org.sonar.server.platform.db.migration.version.v84.common.DropPrimaryKeyOnIdColumn; - -public class DropPrimaryKeyOnIdColumnOfActiveRuleParametersTable extends DropPrimaryKeyOnIdColumn { - private static final String TABLE_NAME = "active_rule_parameters"; - - public DropPrimaryKeyOnIdColumnOfActiveRuleParametersTable(Database db, DropPrimaryKeySqlGenerator dropPrimaryKeySqlGenerator) { - super(db, dropPrimaryKeySqlGenerator, TABLE_NAME); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/activeruleparameters/MakeActiveRuleParametersUuidColumnNotNullable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/activeruleparameters/MakeActiveRuleParametersUuidColumnNotNullable.java deleted file mode 100644 index 4a0e26e5bfd..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/activeruleparameters/MakeActiveRuleParametersUuidColumnNotNullable.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.activeruleparameters; - -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.version.v84.common.MakeUuidColumnNotNullable; - -public class MakeActiveRuleParametersUuidColumnNotNullable extends MakeUuidColumnNotNullable { - private static final String TABLE = "active_rule_parameters"; - - public MakeActiveRuleParametersUuidColumnNotNullable(Database db) { - super(db, TABLE); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/activeruleparameters/PopulateActiveRuleParametersUuid.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/activeruleparameters/PopulateActiveRuleParametersUuid.java deleted file mode 100644 index a3bfff1bc31..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/activeruleparameters/PopulateActiveRuleParametersUuid.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.activeruleparameters; - -import java.sql.SQLException; -import org.sonar.core.util.UuidFactory; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.step.DataChange; -import org.sonar.server.platform.db.migration.step.MassUpdate; - -public class PopulateActiveRuleParametersUuid extends DataChange { - - private final UuidFactory uuidFactory; - - public PopulateActiveRuleParametersUuid(Database db, UuidFactory uuidFactory) { - super(db); - this.uuidFactory = uuidFactory; - } - - @Override - protected void execute(Context context) throws SQLException { - MassUpdate massUpdate = context.prepareMassUpdate(); - - massUpdate.select("select id from active_rule_parameters where uuid is null"); - massUpdate.update("update active_rule_parameters set uuid = ? where id = ?"); - - massUpdate.execute((row, update) -> { - update.setString(1, uuidFactory.create()); - update.setLong(2, row.getLong(1)); - return true; - }); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/activeruleparameters/package-info.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/activeruleparameters/package-info.java deleted file mode 100644 index bee0a90fed9..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/activeruleparameters/package-info.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.activeruleparameters; - -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/activerules/AddActiveRuleUuidColumnToActiveRuleParameters.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/activerules/AddActiveRuleUuidColumnToActiveRuleParameters.java deleted file mode 100644 index 50f566dc7c8..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/activerules/AddActiveRuleUuidColumnToActiveRuleParameters.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.activerules; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.def.VarcharColumnDef; -import org.sonar.server.platform.db.migration.sql.AddColumnsBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder; - -public class AddActiveRuleUuidColumnToActiveRuleParameters extends DdlChange { - private static final String TABLE = "active_rule_parameters"; - - private static final VarcharColumnDef uuidColumnDefinition = newVarcharColumnDefBuilder() - .setColumnName("active_rule_uuid") - .setIsNullable(true) - .setDefaultValue(null) - .setLimit(VarcharColumnDef.UUID_SIZE) - .build(); - - public AddActiveRuleUuidColumnToActiveRuleParameters(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new AddColumnsBuilder(getDialect(), TABLE) - .addColumn(uuidColumnDefinition) - .build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/activerules/AddIndexOnActiveRuleUuidOfActiveRuleParametersTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/activerules/AddIndexOnActiveRuleUuidOfActiveRuleParametersTable.java deleted file mode 100644 index b07268a6710..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/activerules/AddIndexOnActiveRuleUuidOfActiveRuleParametersTable.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.activerules; - -import java.sql.Connection; -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.db.DatabaseUtils; -import org.sonar.server.platform.db.migration.def.VarcharColumnDef; -import org.sonar.server.platform.db.migration.sql.CreateIndexBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder; - -public class AddIndexOnActiveRuleUuidOfActiveRuleParametersTable extends DdlChange { - private static final String TABLE_NAME = "active_rule_parameters"; - private static final String INDEX_NAME = "arp_active_rule_uuid"; - - public AddIndexOnActiveRuleUuidOfActiveRuleParametersTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - if (!indexExists()) { - context.execute(new CreateIndexBuilder() - .setUnique(false) - .setTable(TABLE_NAME) - .setName(INDEX_NAME) - .addColumn(newVarcharColumnDefBuilder() - .setColumnName("active_rule_uuid") - .setIsNullable(false) - .setLimit(VarcharColumnDef.UUID_SIZE) - .build()) - .build()); - } - } - - private boolean indexExists() throws SQLException { - try (Connection connection = getDatabase().getDataSource().getConnection()) { - return DatabaseUtils.indexExistsIgnoreCase(TABLE_NAME, INDEX_NAME, connection); - } - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/activerules/AddPrimaryKeyOnUuidColumnOfActiveRulesTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/activerules/AddPrimaryKeyOnUuidColumnOfActiveRulesTable.java deleted file mode 100644 index 84ca9c65b9e..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/activerules/AddPrimaryKeyOnUuidColumnOfActiveRulesTable.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.activerules; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.AddPrimaryKeyBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class AddPrimaryKeyOnUuidColumnOfActiveRulesTable extends DdlChange { - - public AddPrimaryKeyOnUuidColumnOfActiveRulesTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new AddPrimaryKeyBuilder("active_rules", "uuid").build()); - } - -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/activerules/AddUuidColumnToActiveRulesTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/activerules/AddUuidColumnToActiveRulesTable.java deleted file mode 100644 index 040380766c4..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/activerules/AddUuidColumnToActiveRulesTable.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.activerules; - -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.version.v84.common.AddUuidColumnToTable; - -public class AddUuidColumnToActiveRulesTable extends AddUuidColumnToTable { - private static final String TABLE = "active_rules"; - - public AddUuidColumnToActiveRulesTable(Database db) { - super(db, TABLE); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/activerules/DropActiveRuleIdColumnOfActiveRuleParametersTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/activerules/DropActiveRuleIdColumnOfActiveRuleParametersTable.java deleted file mode 100644 index af0bc07738e..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/activerules/DropActiveRuleIdColumnOfActiveRuleParametersTable.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.activerules; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.DropColumnsBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class DropActiveRuleIdColumnOfActiveRuleParametersTable extends DdlChange { - public DropActiveRuleIdColumnOfActiveRuleParametersTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new DropColumnsBuilder(getDialect(), "active_rule_parameters", "active_rule_id").build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/activerules/DropIdColumnOfActiveRulesTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/activerules/DropIdColumnOfActiveRulesTable.java deleted file mode 100644 index dcbaf505ef5..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/activerules/DropIdColumnOfActiveRulesTable.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.activerules; - -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.version.v84.common.DropIdColumn; - -public class DropIdColumnOfActiveRulesTable extends DropIdColumn { - private static final String TABLE = "active_rules"; - - public DropIdColumnOfActiveRulesTable(Database db) { - super(db, TABLE); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/activerules/DropIndexOnActiveRuleIdOfActiveRuleParametersTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/activerules/DropIndexOnActiveRuleIdOfActiveRuleParametersTable.java deleted file mode 100644 index 5df4a1b87d4..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/activerules/DropIndexOnActiveRuleIdOfActiveRuleParametersTable.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.activerules; - -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.step.DropIndexChange; - -public class DropIndexOnActiveRuleIdOfActiveRuleParametersTable extends DropIndexChange { - private static final String TABLE_NAME = "active_rule_parameters"; - private static final String INDEX_NAME = "ix_arp_on_active_rule_id"; - - public DropIndexOnActiveRuleIdOfActiveRuleParametersTable(Database db) { - super(db, INDEX_NAME, TABLE_NAME); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/activerules/DropPrimaryKeyOnIdColumnOfActiveRulesTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/activerules/DropPrimaryKeyOnIdColumnOfActiveRulesTable.java deleted file mode 100644 index 429da6e783c..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/activerules/DropPrimaryKeyOnIdColumnOfActiveRulesTable.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.activerules; - -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.DropPrimaryKeySqlGenerator; -import org.sonar.server.platform.db.migration.version.v84.common.DropPrimaryKeyOnIdColumn; - -public class DropPrimaryKeyOnIdColumnOfActiveRulesTable extends DropPrimaryKeyOnIdColumn { - private static final String TABLE_NAME = "active_rules"; - - public DropPrimaryKeyOnIdColumnOfActiveRulesTable(Database db, DropPrimaryKeySqlGenerator dropPrimaryKeySqlGenerator) { - super(db, dropPrimaryKeySqlGenerator, TABLE_NAME); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/activerules/MakeActiveRuleParametersActiveRuleUuidNotNullable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/activerules/MakeActiveRuleParametersActiveRuleUuidNotNullable.java deleted file mode 100644 index 0085b48c9c4..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/activerules/MakeActiveRuleParametersActiveRuleUuidNotNullable.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.activerules; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.def.VarcharColumnDef; -import org.sonar.server.platform.db.migration.sql.AlterColumnsBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder; - -public class MakeActiveRuleParametersActiveRuleUuidNotNullable extends DdlChange { - private static final String TABLE = "active_rule_parameters"; - - private static final VarcharColumnDef uuidColumnDefinition = newVarcharColumnDefBuilder() - .setColumnName("active_rule_uuid") - .setIsNullable(false) - .setDefaultValue(null) - .setLimit(VarcharColumnDef.UUID_SIZE) - .build(); - - public MakeActiveRuleParametersActiveRuleUuidNotNullable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new AlterColumnsBuilder(getDialect(), TABLE) - .updateColumn(uuidColumnDefinition) - .build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/activerules/MakeActiveRulesUuidColumnNotNullable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/activerules/MakeActiveRulesUuidColumnNotNullable.java deleted file mode 100644 index b133c3c30ba..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/activerules/MakeActiveRulesUuidColumnNotNullable.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.activerules; - -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.version.v84.common.MakeUuidColumnNotNullable; - -public class MakeActiveRulesUuidColumnNotNullable extends MakeUuidColumnNotNullable { - private static final String TABLE = "active_rules"; - - public MakeActiveRulesUuidColumnNotNullable(Database db) { - super(db, TABLE); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/activerules/PopulateActiveRuleParametersActiveRuleUuid.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/activerules/PopulateActiveRuleParametersActiveRuleUuid.java deleted file mode 100644 index 66ec517d3a5..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/activerules/PopulateActiveRuleParametersActiveRuleUuid.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.activerules; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.step.DataChange; -import org.sonar.server.platform.db.migration.step.MassUpdate; -import org.sonar.server.platform.db.migration.version.v84.util.OrphanData; - -public class PopulateActiveRuleParametersActiveRuleUuid extends DataChange { - - public PopulateActiveRuleParametersActiveRuleUuid(Database db) { - super(db); - } - - @Override - protected void execute(Context context) throws SQLException { - MassUpdate massUpdate = context.prepareMassUpdate(); - - massUpdate.select("select arp.uuid, ar.uuid from active_rule_parameters arp " + - "join active_rules ar on arp.active_rule_id = ar.id"); - - massUpdate.update("update active_rule_parameters set active_rule_uuid = ? where uuid = ?"); - - massUpdate.execute((row, update) -> { - update.setString(1, row.getString(2)); - update.setString(2, row.getString(1)); - return true; - }); - - OrphanData.delete(context, "active_rule_parameters", "active_rule_uuid"); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/activerules/PopulateActiveRulesUuid.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/activerules/PopulateActiveRulesUuid.java deleted file mode 100644 index 7fc115dba3b..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/activerules/PopulateActiveRulesUuid.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.activerules; - -import java.sql.SQLException; -import org.sonar.core.util.UuidFactory; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.step.DataChange; -import org.sonar.server.platform.db.migration.step.MassUpdate; - -public class PopulateActiveRulesUuid extends DataChange { - - private final UuidFactory uuidFactory; - - public PopulateActiveRulesUuid(Database db, UuidFactory uuidFactory) { - super(db); - this.uuidFactory = uuidFactory; - } - - @Override - protected void execute(Context context) throws SQLException { - MassUpdate massUpdate = context.prepareMassUpdate(); - - massUpdate.select("select id from active_rules where uuid is null"); - massUpdate.update("update active_rules set uuid = ? where id = ?"); - - massUpdate.execute((row, update) -> { - update.setString(1, uuidFactory.create()); - update.setLong(2, row.getLong(1)); - return true; - }); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/activerules/package-info.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/activerules/package-info.java deleted file mode 100644 index b2f04d731fb..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/activerules/package-info.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.activerules; - -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/alm/AddClientIdAndClientSecretColumns.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/alm/AddClientIdAndClientSecretColumns.java deleted file mode 100644 index eaa47034db1..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/alm/AddClientIdAndClientSecretColumns.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.alm; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.AddColumnsBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder; - -public class AddClientIdAndClientSecretColumns extends DdlChange { - - public AddClientIdAndClientSecretColumns(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new AddColumnsBuilder(getDialect(), "alm_settings") - .addColumn(newVarcharColumnDefBuilder() - .setColumnName("client_id") - .setIsNullable(true) - .setDefaultValue(null) - .setLimit(80) - .build()) - .addColumn(newVarcharColumnDefBuilder() - .setColumnName("client_secret") - .setIsNullable(true) - .setDefaultValue(null) - .setLimit(80) - .build()) - .build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/alm/package-info.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/alm/package-info.java deleted file mode 100644 index d69aad3d7dd..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/alm/package-info.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.alm; - -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/ceactivity/AddPrimaryKeyOnUuidColumnOfCeActivityTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/ceactivity/AddPrimaryKeyOnUuidColumnOfCeActivityTable.java deleted file mode 100644 index e741f96d7ef..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/ceactivity/AddPrimaryKeyOnUuidColumnOfCeActivityTable.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.ceactivity; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.AddPrimaryKeyBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class AddPrimaryKeyOnUuidColumnOfCeActivityTable extends DdlChange { - - public AddPrimaryKeyOnUuidColumnOfCeActivityTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new AddPrimaryKeyBuilder("ce_activity", "uuid").build()); - } - -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/ceactivity/DropIdColumnOfCeActivityTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/ceactivity/DropIdColumnOfCeActivityTable.java deleted file mode 100644 index 05d20e57e1c..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/ceactivity/DropIdColumnOfCeActivityTable.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.ceactivity; - -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.version.v84.common.DropIdColumn; - -public class DropIdColumnOfCeActivityTable extends DropIdColumn { - private static final String TABLE = "ce_activity"; - - public DropIdColumnOfCeActivityTable(Database db) { - super(db, TABLE); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/ceactivity/DropPrimaryKeyOnIdColumnOfCeActivityTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/ceactivity/DropPrimaryKeyOnIdColumnOfCeActivityTable.java deleted file mode 100644 index 430e8753c51..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/ceactivity/DropPrimaryKeyOnIdColumnOfCeActivityTable.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.ceactivity; - -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.DropPrimaryKeySqlGenerator; -import org.sonar.server.platform.db.migration.version.v84.common.DropPrimaryKeyOnIdColumn; - -public class DropPrimaryKeyOnIdColumnOfCeActivityTable extends DropPrimaryKeyOnIdColumn { - private static final String TABLE_NAME = "ce_activity"; - - public DropPrimaryKeyOnIdColumnOfCeActivityTable(Database db, DropPrimaryKeySqlGenerator dropPrimaryKeySqlGenerator) { - super(db, dropPrimaryKeySqlGenerator, TABLE_NAME); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/ceactivity/package-info.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/ceactivity/package-info.java deleted file mode 100644 index d2615d12ad3..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/ceactivity/package-info.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.ceactivity; - -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/cequeue/AddPrimaryKeyOnUuidColumnOfCeQueueTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/cequeue/AddPrimaryKeyOnUuidColumnOfCeQueueTable.java deleted file mode 100644 index c83daed3b5d..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/cequeue/AddPrimaryKeyOnUuidColumnOfCeQueueTable.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.cequeue; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.AddPrimaryKeyBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class AddPrimaryKeyOnUuidColumnOfCeQueueTable extends DdlChange { - - public AddPrimaryKeyOnUuidColumnOfCeQueueTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new AddPrimaryKeyBuilder("ce_queue", "uuid").build()); - } - -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/cequeue/DropIdColumnOfCeQueueTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/cequeue/DropIdColumnOfCeQueueTable.java deleted file mode 100644 index 92a799d6cb9..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/cequeue/DropIdColumnOfCeQueueTable.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.cequeue; - -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.version.v84.common.DropIdColumn; - -public class DropIdColumnOfCeQueueTable extends DropIdColumn { - private static final String TABLE = "ce_queue"; - - public DropIdColumnOfCeQueueTable(Database db) { - super(db, TABLE); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/cequeue/DropPrimaryKeyOnIdColumnOfCeQueueTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/cequeue/DropPrimaryKeyOnIdColumnOfCeQueueTable.java deleted file mode 100644 index 9c4d2317cea..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/cequeue/DropPrimaryKeyOnIdColumnOfCeQueueTable.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.cequeue; - -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.DropPrimaryKeySqlGenerator; -import org.sonar.server.platform.db.migration.version.v84.common.DropPrimaryKeyOnIdColumn; - -public class DropPrimaryKeyOnIdColumnOfCeQueueTable extends DropPrimaryKeyOnIdColumn { - private static final String TABLE_NAME = "ce_queue"; - - public DropPrimaryKeyOnIdColumnOfCeQueueTable(Database db, DropPrimaryKeySqlGenerator dropPrimaryKeySqlGenerator) { - super(db, dropPrimaryKeySqlGenerator, TABLE_NAME); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/cequeue/DropUniqueIndexOnUuidColumnOfCeQueueTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/cequeue/DropUniqueIndexOnUuidColumnOfCeQueueTable.java deleted file mode 100644 index 4f7176f7250..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/cequeue/DropUniqueIndexOnUuidColumnOfCeQueueTable.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.cequeue; - -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.step.DropIndexChange; - -public class DropUniqueIndexOnUuidColumnOfCeQueueTable extends DropIndexChange { - private static final String TABLE_NAME = "ce_queue"; - private static final String INDEX_NAME = "ce_queue_uuid"; - - public DropUniqueIndexOnUuidColumnOfCeQueueTable(Database db) { - super(db, INDEX_NAME, TABLE_NAME); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/cequeue/package-info.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/cequeue/package-info.java deleted file mode 100644 index 7fe531fdc5e..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/cequeue/package-info.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.cequeue; - -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/common/AddUuidColumnToTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/common/AddUuidColumnToTable.java deleted file mode 100644 index 078ae4b74aa..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/common/AddUuidColumnToTable.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.common; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.def.VarcharColumnDef; -import org.sonar.server.platform.db.migration.sql.AddColumnsBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder; - -public abstract class AddUuidColumnToTable extends DdlChange { - - private static final VarcharColumnDef uuidColumnDefinition = newVarcharColumnDefBuilder() - .setColumnName("uuid") - .setIsNullable(true) - .setDefaultValue(null) - .setLimit(VarcharColumnDef.UUID_SIZE) - .build(); - private String tableName; - - protected AddUuidColumnToTable(Database db, String tableName) { - super(db); - this.tableName = tableName; - } - - @Override - public void execute(DdlChange.Context context) throws SQLException { - context.execute(new AddColumnsBuilder(getDialect(), tableName) - .addColumn(uuidColumnDefinition) - .build()); - } - -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/common/DropIdColumn.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/common/DropIdColumn.java deleted file mode 100644 index 6e5fc32a261..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/common/DropIdColumn.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.common; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.DropColumnsBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public abstract class DropIdColumn extends DdlChange { - private Database db; - private String tableName; - - protected DropIdColumn(Database db, String tableName) { - super(db); - this.db = db; - this.tableName = tableName; - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new DropColumnsBuilder(db.getDialect(), tableName, "id").build()); - } - -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/common/DropPrimaryKeyOnIdColumn.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/common/DropPrimaryKeyOnIdColumn.java deleted file mode 100644 index c0f287b915b..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/common/DropPrimaryKeyOnIdColumn.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.common; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.DropPrimaryKeySqlGenerator; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public abstract class DropPrimaryKeyOnIdColumn extends DdlChange { - private final DropPrimaryKeySqlGenerator dropPrimaryKeySqlGenerator; - private final String tableName; - - protected DropPrimaryKeyOnIdColumn(Database db, DropPrimaryKeySqlGenerator dropPrimaryKeySqlGenerator, String tableName) { - super(db); - this.dropPrimaryKeySqlGenerator = dropPrimaryKeySqlGenerator; - this.tableName = tableName; - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(dropPrimaryKeySqlGenerator.generate(tableName, "id", true)); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/common/MakeUuidColumnNotNullable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/common/MakeUuidColumnNotNullable.java deleted file mode 100644 index e249dd61cfb..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/common/MakeUuidColumnNotNullable.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.common; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.def.VarcharColumnDef; -import org.sonar.server.platform.db.migration.sql.AlterColumnsBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder; - -public abstract class MakeUuidColumnNotNullable extends DdlChange { - private static final VarcharColumnDef uuidColumnDefinition = newVarcharColumnDefBuilder() - .setColumnName("uuid") - .setIsNullable(false) - .setDefaultValue(null) - .setLimit(VarcharColumnDef.UUID_SIZE) - .build(); - - private String tableName; - - protected MakeUuidColumnNotNullable(Database db, String tableName) { - super(db); - this.tableName = tableName; - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new AlterColumnsBuilder(getDialect(), tableName) - .updateColumn(uuidColumnDefinition) - .build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/common/package-info.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/common/package-info.java deleted file mode 100644 index 66a583728c4..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/common/package-info.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.common; - -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/duplicationsindex/AddPrimaryKeyOnUuidColumnOfDuplicationsIndexTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/duplicationsindex/AddPrimaryKeyOnUuidColumnOfDuplicationsIndexTable.java deleted file mode 100644 index baedddf995a..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/duplicationsindex/AddPrimaryKeyOnUuidColumnOfDuplicationsIndexTable.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.duplicationsindex; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.AddPrimaryKeyBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class AddPrimaryKeyOnUuidColumnOfDuplicationsIndexTable extends DdlChange { - - public AddPrimaryKeyOnUuidColumnOfDuplicationsIndexTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new AddPrimaryKeyBuilder("duplications_index", "uuid").build()); - } - -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/duplicationsindex/AddUuidToDuplicationsIndexTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/duplicationsindex/AddUuidToDuplicationsIndexTable.java deleted file mode 100644 index 3ca297267b5..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/duplicationsindex/AddUuidToDuplicationsIndexTable.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.duplicationsindex; - -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.version.v84.common.AddUuidColumnToTable; - -public class AddUuidToDuplicationsIndexTable extends AddUuidColumnToTable { - private static final String TABLE = "duplications_index"; - - public AddUuidToDuplicationsIndexTable(Database db) { - super(db, TABLE); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/duplicationsindex/DropIdColumnOfDuplicationsIndexTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/duplicationsindex/DropIdColumnOfDuplicationsIndexTable.java deleted file mode 100644 index bb2b28974fc..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/duplicationsindex/DropIdColumnOfDuplicationsIndexTable.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.duplicationsindex; - -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.version.v84.common.DropIdColumn; - -public class DropIdColumnOfDuplicationsIndexTable extends DropIdColumn { - private static final String TABLE = "duplications_index"; - - public DropIdColumnOfDuplicationsIndexTable(Database db) { - super(db, TABLE); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/duplicationsindex/DropPrimaryKeyOnIdColumnOfDuplicationsIndexTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/duplicationsindex/DropPrimaryKeyOnIdColumnOfDuplicationsIndexTable.java deleted file mode 100644 index 14c06f2396e..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/duplicationsindex/DropPrimaryKeyOnIdColumnOfDuplicationsIndexTable.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.duplicationsindex; - -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.DropPrimaryKeySqlGenerator; -import org.sonar.server.platform.db.migration.version.v84.common.DropPrimaryKeyOnIdColumn; - -public class DropPrimaryKeyOnIdColumnOfDuplicationsIndexTable extends DropPrimaryKeyOnIdColumn { - private static final String TABLE_NAME = "duplications_index"; - - public DropPrimaryKeyOnIdColumnOfDuplicationsIndexTable(Database db, DropPrimaryKeySqlGenerator dropPrimaryKeySqlGenerator) { - super(db, dropPrimaryKeySqlGenerator, TABLE_NAME); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/duplicationsindex/MakeDuplicationsIndexUuidColumnNotNullable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/duplicationsindex/MakeDuplicationsIndexUuidColumnNotNullable.java deleted file mode 100644 index 3e67bc00126..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/duplicationsindex/MakeDuplicationsIndexUuidColumnNotNullable.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.duplicationsindex; - -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.version.v84.common.MakeUuidColumnNotNullable; - -public class MakeDuplicationsIndexUuidColumnNotNullable extends MakeUuidColumnNotNullable { - private static final String TABLE = "duplications_index"; - - public MakeDuplicationsIndexUuidColumnNotNullable(Database db) { - super(db, TABLE); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/duplicationsindex/PopulateDuplicationsIndexUuid.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/duplicationsindex/PopulateDuplicationsIndexUuid.java deleted file mode 100644 index 17d9dbde6e0..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/duplicationsindex/PopulateDuplicationsIndexUuid.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.duplicationsindex; - -import java.sql.SQLException; -import org.sonar.core.util.UuidFactory; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.step.DataChange; -import org.sonar.server.platform.db.migration.step.MassUpdate; - -public class PopulateDuplicationsIndexUuid extends DataChange { - - private final UuidFactory uuidFactory; - - public PopulateDuplicationsIndexUuid(Database db, UuidFactory uuidFactory) { - super(db); - this.uuidFactory = uuidFactory; - } - - @Override - protected void execute(Context context) throws SQLException { - MassUpdate massUpdate = context.prepareMassUpdate(); - - massUpdate.select("select id from duplications_index where uuid is null"); - massUpdate.update("update duplications_index set uuid = ? where id = ?"); - - massUpdate.execute((row, update) -> { - update.setString(1, uuidFactory.create()); - update.setLong(2, row.getLong(1)); - return true; - }); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/duplicationsindex/package-info.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/duplicationsindex/package-info.java deleted file mode 100644 index 2171403433b..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/duplicationsindex/package-info.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.duplicationsindex; - -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/events/AddPrimaryKeyOnUuidColumnOfEventsTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/events/AddPrimaryKeyOnUuidColumnOfEventsTable.java deleted file mode 100644 index 09fe7983a32..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/events/AddPrimaryKeyOnUuidColumnOfEventsTable.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.events; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.AddPrimaryKeyBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class AddPrimaryKeyOnUuidColumnOfEventsTable extends DdlChange { - - public AddPrimaryKeyOnUuidColumnOfEventsTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new AddPrimaryKeyBuilder("events", "uuid").build()); - } - -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/events/DropIdColumnOfEventsTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/events/DropIdColumnOfEventsTable.java deleted file mode 100644 index cfc63a75145..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/events/DropIdColumnOfEventsTable.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.events; - -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.version.v84.common.DropIdColumn; - -public class DropIdColumnOfEventsTable extends DropIdColumn { - private static final String TABLE = "events"; - - public DropIdColumnOfEventsTable(Database db) { - super(db, TABLE); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/events/DropPrimaryKeyOnIdColumnOfEventsTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/events/DropPrimaryKeyOnIdColumnOfEventsTable.java deleted file mode 100644 index 2388fb4d202..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/events/DropPrimaryKeyOnIdColumnOfEventsTable.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.events; - -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.DropPrimaryKeySqlGenerator; -import org.sonar.server.platform.db.migration.version.v84.common.DropPrimaryKeyOnIdColumn; - -public class DropPrimaryKeyOnIdColumnOfEventsTable extends DropPrimaryKeyOnIdColumn { - private static final String TABLE_NAME = "events"; - - public DropPrimaryKeyOnIdColumnOfEventsTable(Database db, DropPrimaryKeySqlGenerator dropPrimaryKeySqlGenerator) { - super(db, dropPrimaryKeySqlGenerator, TABLE_NAME); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/events/package-info.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/events/package-info.java deleted file mode 100644 index 845eb01ab5f..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/events/package-info.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.events; - -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/filesources/AddPrimaryKeyOnUuidColumnOfFileSourcesTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/filesources/AddPrimaryKeyOnUuidColumnOfFileSourcesTable.java deleted file mode 100644 index b7d70ccc355..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/filesources/AddPrimaryKeyOnUuidColumnOfFileSourcesTable.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.filesources; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.AddPrimaryKeyBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class AddPrimaryKeyOnUuidColumnOfFileSourcesTable extends DdlChange { - - public AddPrimaryKeyOnUuidColumnOfFileSourcesTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new AddPrimaryKeyBuilder("file_sources", "uuid").build()); - } - -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/filesources/AddUuidColumnToFileSourcesTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/filesources/AddUuidColumnToFileSourcesTable.java deleted file mode 100644 index 9022e000619..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/filesources/AddUuidColumnToFileSourcesTable.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.filesources; - -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.version.v84.common.AddUuidColumnToTable; - -public class AddUuidColumnToFileSourcesTable extends AddUuidColumnToTable { - private static final String TABLE = "file_sources"; - - public AddUuidColumnToFileSourcesTable(Database db) { - super(db, TABLE); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/filesources/DropIdColumnOfFileSourcesTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/filesources/DropIdColumnOfFileSourcesTable.java deleted file mode 100644 index 6730e70b0ec..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/filesources/DropIdColumnOfFileSourcesTable.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.filesources; - -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.version.v84.common.DropIdColumn; - -public class DropIdColumnOfFileSourcesTable extends DropIdColumn { - private static final String TABLE = "file_sources"; - - public DropIdColumnOfFileSourcesTable(Database db) { - super(db, TABLE); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/filesources/DropPrimaryKeyOnIdColumnOfFileSourcesTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/filesources/DropPrimaryKeyOnIdColumnOfFileSourcesTable.java deleted file mode 100644 index 2bdd375d06c..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/filesources/DropPrimaryKeyOnIdColumnOfFileSourcesTable.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.filesources; - -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.DropPrimaryKeySqlGenerator; -import org.sonar.server.platform.db.migration.version.v84.common.DropPrimaryKeyOnIdColumn; - -public class DropPrimaryKeyOnIdColumnOfFileSourcesTable extends DropPrimaryKeyOnIdColumn { - private static final String TABLE_NAME = "file_sources"; - - public DropPrimaryKeyOnIdColumnOfFileSourcesTable(Database db, DropPrimaryKeySqlGenerator dropPrimaryKeySqlGenerator) { - super(db, dropPrimaryKeySqlGenerator, TABLE_NAME); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/filesources/MakeFileSourcesUuidColumnNotNullable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/filesources/MakeFileSourcesUuidColumnNotNullable.java deleted file mode 100644 index 30e4dace660..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/filesources/MakeFileSourcesUuidColumnNotNullable.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.filesources; - -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.version.v84.common.MakeUuidColumnNotNullable; - -public class MakeFileSourcesUuidColumnNotNullable extends MakeUuidColumnNotNullable { - private static final String TABLE = "file_sources"; - - public MakeFileSourcesUuidColumnNotNullable(Database db) { - super(db, TABLE); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/filesources/PopulateFileSourcesUuid.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/filesources/PopulateFileSourcesUuid.java deleted file mode 100644 index 51e05c3f469..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/filesources/PopulateFileSourcesUuid.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.filesources; - -import java.sql.SQLException; -import org.sonar.core.util.UuidFactory; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.step.DataChange; -import org.sonar.server.platform.db.migration.step.MassUpdate; - -public class PopulateFileSourcesUuid extends DataChange { - - private final UuidFactory uuidFactory; - - public PopulateFileSourcesUuid(Database db, UuidFactory uuidFactory) { - super(db); - this.uuidFactory = uuidFactory; - } - - @Override - protected void execute(Context context) throws SQLException { - MassUpdate massUpdate = context.prepareMassUpdate(); - - massUpdate.select("select id from file_sources where uuid is null"); - massUpdate.update("update file_sources set uuid = ? where id = ?"); - - massUpdate.execute((row, update) -> { - update.setString(1, uuidFactory.create()); - update.setLong(2, row.getLong(1)); - return true; - }); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/filesources/package-info.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/filesources/package-info.java deleted file mode 100644 index 269d8a9bc71..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/filesources/package-info.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.filesources; - -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/grouproles/AddPrimaryKeyOnUuidColumnOfGroupRolesTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/grouproles/AddPrimaryKeyOnUuidColumnOfGroupRolesTable.java deleted file mode 100644 index c58e73b91be..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/grouproles/AddPrimaryKeyOnUuidColumnOfGroupRolesTable.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.grouproles; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.AddPrimaryKeyBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class AddPrimaryKeyOnUuidColumnOfGroupRolesTable extends DdlChange { - - public AddPrimaryKeyOnUuidColumnOfGroupRolesTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new AddPrimaryKeyBuilder("group_roles", "uuid").build()); - } - -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/grouproles/AddUuidColumnToGroupRolesTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/grouproles/AddUuidColumnToGroupRolesTable.java deleted file mode 100644 index d9bdaca0192..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/grouproles/AddUuidColumnToGroupRolesTable.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.grouproles; - -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.version.v84.common.AddUuidColumnToTable; - -public class AddUuidColumnToGroupRolesTable extends AddUuidColumnToTable { - private static final String TABLE = "group_roles"; - - public AddUuidColumnToGroupRolesTable(Database db) { - super(db, TABLE); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/grouproles/DropIdColumnOfGroupRolesTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/grouproles/DropIdColumnOfGroupRolesTable.java deleted file mode 100644 index 46f6350c841..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/grouproles/DropIdColumnOfGroupRolesTable.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.grouproles; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.DropColumnsBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class DropIdColumnOfGroupRolesTable extends DdlChange { - - private Database db; - - public DropIdColumnOfGroupRolesTable(Database db) { - super(db); - this.db = db; - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new DropColumnsBuilder(db.getDialect(), "group_roles", "id").build()); - } - -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/grouproles/DropPrimaryKeyOnIdColumnOfGroupRolesTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/grouproles/DropPrimaryKeyOnIdColumnOfGroupRolesTable.java deleted file mode 100644 index ca9ab5bb23c..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/grouproles/DropPrimaryKeyOnIdColumnOfGroupRolesTable.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.grouproles; - -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.DropPrimaryKeySqlGenerator; -import org.sonar.server.platform.db.migration.version.v84.common.DropPrimaryKeyOnIdColumn; - -public class DropPrimaryKeyOnIdColumnOfGroupRolesTable extends DropPrimaryKeyOnIdColumn { - private static final String TABLE_NAME = "group_roles"; - - public DropPrimaryKeyOnIdColumnOfGroupRolesTable(Database db, DropPrimaryKeySqlGenerator dropPrimaryKeySqlGenerator) { - super(db, dropPrimaryKeySqlGenerator, TABLE_NAME); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/grouproles/MakeGroupRolesUuidColumnNotNullable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/grouproles/MakeGroupRolesUuidColumnNotNullable.java deleted file mode 100644 index 3ee31a0b7eb..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/grouproles/MakeGroupRolesUuidColumnNotNullable.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.grouproles; - -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.version.v84.common.MakeUuidColumnNotNullable; - -public class MakeGroupRolesUuidColumnNotNullable extends MakeUuidColumnNotNullable { - private static final String TABLE = "group_roles"; - - public MakeGroupRolesUuidColumnNotNullable(Database db) { - super(db, TABLE); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/grouproles/PopulateGroupRolesUuid.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/grouproles/PopulateGroupRolesUuid.java deleted file mode 100644 index 64e956f07d8..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/grouproles/PopulateGroupRolesUuid.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.grouproles; - -import java.sql.SQLException; -import org.sonar.core.util.UuidFactory; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.step.DataChange; -import org.sonar.server.platform.db.migration.step.MassUpdate; - -public class PopulateGroupRolesUuid extends DataChange { - - private final UuidFactory uuidFactory; - - public PopulateGroupRolesUuid(Database db, UuidFactory uuidFactory) { - super(db); - this.uuidFactory = uuidFactory; - } - - @Override - protected void execute(Context context) throws SQLException { - MassUpdate massUpdate = context.prepareMassUpdate(); - - massUpdate.select("select id from group_roles where uuid is null"); - massUpdate.update("update group_roles set uuid = ? where id = ?"); - - massUpdate.execute((row, update) -> { - update.setString(1, uuidFactory.create()); - update.setLong(2, row.getLong(1)); - return true; - }); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/grouproles/package-info.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/grouproles/package-info.java deleted file mode 100644 index 2850e36ecc6..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/grouproles/package-info.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.grouproles; - -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/AddPrimaryKeyOnUuidColumnOfGroupsTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/AddPrimaryKeyOnUuidColumnOfGroupsTable.java deleted file mode 100644 index 568275c479b..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/AddPrimaryKeyOnUuidColumnOfGroupsTable.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.groups; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.AddPrimaryKeyBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class AddPrimaryKeyOnUuidColumnOfGroupsTable extends DdlChange { - - public AddPrimaryKeyOnUuidColumnOfGroupsTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new AddPrimaryKeyBuilder("groups", "uuid").build()); - } - -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/AddUuidColumnToGroupsTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/AddUuidColumnToGroupsTable.java deleted file mode 100644 index 5c7b1661ab7..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/AddUuidColumnToGroupsTable.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.groups; - -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.version.v84.common.AddUuidColumnToTable; - -public class AddUuidColumnToGroupsTable extends AddUuidColumnToTable { - private static final String TABLE = "groups"; - - public AddUuidColumnToGroupsTable(Database db) { - super(db, TABLE); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/DropIdColumnOfGroupsTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/DropIdColumnOfGroupsTable.java deleted file mode 100644 index 7ff7f7e7773..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/DropIdColumnOfGroupsTable.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.groups; - -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.version.v84.common.DropIdColumn; - -public class DropIdColumnOfGroupsTable extends DropIdColumn { - private static final String TABLE = "groups"; - - public DropIdColumnOfGroupsTable(Database db) { - super(db, TABLE); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/DropPrimaryKeyOnIdColumnOfGroupsTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/DropPrimaryKeyOnIdColumnOfGroupsTable.java deleted file mode 100644 index 225369a9755..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/DropPrimaryKeyOnIdColumnOfGroupsTable.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.groups; - -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.DropPrimaryKeySqlGenerator; -import org.sonar.server.platform.db.migration.version.v84.common.DropPrimaryKeyOnIdColumn; - -public class DropPrimaryKeyOnIdColumnOfGroupsTable extends DropPrimaryKeyOnIdColumn { - private static final String TABLE_NAME = "groups"; - - public DropPrimaryKeyOnIdColumnOfGroupsTable(Database db, DropPrimaryKeySqlGenerator dropPrimaryKeySqlGenerator) { - super(db, dropPrimaryKeySqlGenerator, TABLE_NAME); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/MakeGroupsUuidColumnNotNullable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/MakeGroupsUuidColumnNotNullable.java deleted file mode 100644 index 98ee04ce97b..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/MakeGroupsUuidColumnNotNullable.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.groups; - -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.version.v84.common.MakeUuidColumnNotNullable; - -public class MakeGroupsUuidColumnNotNullable extends MakeUuidColumnNotNullable { - private static final String TABLE = "groups"; - - public MakeGroupsUuidColumnNotNullable(Database db) { - super(db, TABLE); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/PopulateGroupsUuid.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/PopulateGroupsUuid.java deleted file mode 100644 index 562f5bb0237..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/PopulateGroupsUuid.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.groups; - -import java.sql.SQLException; -import org.sonar.core.util.UuidFactory; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.step.DataChange; -import org.sonar.server.platform.db.migration.step.MassUpdate; - -public class PopulateGroupsUuid extends DataChange { - - private final UuidFactory uuidFactory; - - public PopulateGroupsUuid(Database db, UuidFactory uuidFactory) { - super(db); - this.uuidFactory = uuidFactory; - } - - @Override - protected void execute(Context context) throws SQLException { - MassUpdate massUpdate = context.prepareMassUpdate(); - - massUpdate.select("select id from groups where uuid is null"); - massUpdate.update("update groups set uuid = ? where id = ?"); - - massUpdate.execute((row, update) -> { - update.setString(1, uuidFactory.create()); - update.setLong(2, row.getLong(1)); - return true; - }); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/grouproles/AddGroupUuidColumnToGroupRoles.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/grouproles/AddGroupUuidColumnToGroupRoles.java deleted file mode 100644 index 2e420d586ff..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/grouproles/AddGroupUuidColumnToGroupRoles.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.groups.grouproles; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.def.VarcharColumnDef; -import org.sonar.server.platform.db.migration.sql.AddColumnsBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder; - -public class AddGroupUuidColumnToGroupRoles extends DdlChange { - private static final String TABLE = "group_roles"; - - private static final VarcharColumnDef uuidColumnDefinition = newVarcharColumnDefBuilder() - .setColumnName("group_uuid") - .setIsNullable(true) - .setDefaultValue(null) - .setLimit(VarcharColumnDef.UUID_SIZE) - .build(); - - public AddGroupUuidColumnToGroupRoles(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new AddColumnsBuilder(getDialect(), TABLE) - .addColumn(uuidColumnDefinition) - .build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/grouproles/AddIndexOnGroupUuidOfGroupRolesTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/grouproles/AddIndexOnGroupUuidOfGroupRolesTable.java deleted file mode 100644 index f7f5ff83e53..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/grouproles/AddIndexOnGroupUuidOfGroupRolesTable.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.groups.grouproles; - -import java.sql.Connection; -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.db.DatabaseUtils; -import org.sonar.server.platform.db.migration.def.VarcharColumnDef; -import org.sonar.server.platform.db.migration.sql.CreateIndexBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder; - -public class AddIndexOnGroupUuidOfGroupRolesTable extends DdlChange { - private static final String TABLE_NAME = "group_roles"; - private static final String INDEX_NAME = "uniq_group_roles"; - - public AddIndexOnGroupUuidOfGroupRolesTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - if (!indexExists()) { - context.execute(new CreateIndexBuilder() - .setUnique(true) - .setTable(TABLE_NAME) - .setName(INDEX_NAME) - .addColumn(newVarcharColumnDefBuilder() - .setColumnName("organization_uuid") - .setIsNullable(false) - .setLimit(VarcharColumnDef.UUID_SIZE) - .build()) - .addColumn(newVarcharColumnDefBuilder() - .setColumnName("group_uuid") - .setIsNullable(false) - .setLimit(VarcharColumnDef.UUID_SIZE) - .build()) - .addColumn(newVarcharColumnDefBuilder() - .setColumnName("component_uuid") - .setIsNullable(true) - .setLimit(VarcharColumnDef.UUID_SIZE) - .build()) - .addColumn(newVarcharColumnDefBuilder() - .setColumnName("role") - .setIsNullable(false) - .setLimit(VarcharColumnDef.UUID_SIZE) - .build()) - .build()); - } - } - - private boolean indexExists() throws SQLException { - try (Connection connection = getDatabase().getDataSource().getConnection()) { - return DatabaseUtils.indexExistsIgnoreCase(TABLE_NAME, INDEX_NAME, connection); - } - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/grouproles/DropGroupIdColumnOfGroupRolesTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/grouproles/DropGroupIdColumnOfGroupRolesTable.java deleted file mode 100644 index bf988a93c85..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/grouproles/DropGroupIdColumnOfGroupRolesTable.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.groups.grouproles; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.DropColumnsBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class DropGroupIdColumnOfGroupRolesTable extends DdlChange { - public DropGroupIdColumnOfGroupRolesTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new DropColumnsBuilder(getDialect(), "group_roles", "group_id").build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/grouproles/DropIndexOnGroupIdOfGroupRolesTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/grouproles/DropIndexOnGroupIdOfGroupRolesTable.java deleted file mode 100644 index 9cbb80ecd16..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/grouproles/DropIndexOnGroupIdOfGroupRolesTable.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.groups.grouproles; - -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.step.DropIndexChange; - -public class DropIndexOnGroupIdOfGroupRolesTable extends DropIndexChange { - private static final String TABLE_NAME = "group_roles"; - private static final String INDEX_NAME = "uniq_group_roles"; - - public DropIndexOnGroupIdOfGroupRolesTable(Database db) { - super(db, INDEX_NAME, TABLE_NAME); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/grouproles/PopulateGroupRolesGroupUuid.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/grouproles/PopulateGroupRolesGroupUuid.java deleted file mode 100644 index 5e49d3c1952..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/grouproles/PopulateGroupRolesGroupUuid.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.groups.grouproles; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.step.DataChange; -import org.sonar.server.platform.db.migration.step.MassUpdate; - -public class PopulateGroupRolesGroupUuid extends DataChange { - - public PopulateGroupRolesGroupUuid(Database db) { - super(db); - } - - @Override - protected void execute(Context context) throws SQLException { - MassUpdate massUpdate = context.prepareMassUpdate(); - - massUpdate.select("select gr.uuid, g.uuid " + - "from group_roles gr left outer join groups g on gr.group_id = g.id " + - "where g.id is null and gr.group_id is not null"); - - massUpdate.update("delete from group_roles where uuid = ?"); - - massUpdate.execute((row, update) -> { - update.setString(1, row.getString(1)); - return true; - }); - - massUpdate = context.prepareMassUpdate(); - - massUpdate.select("select gr.uuid, g.uuid from group_roles gr " + - "join groups g on gr.group_id = g.id"); - - massUpdate.update("update group_roles set group_uuid = ? where uuid = ?"); - - massUpdate.execute((row, update) -> { - update.setString(1, row.getString(2)); - update.setString(2, row.getString(1)); - return true; - }); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/grouproles/package-info.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/grouproles/package-info.java deleted file mode 100644 index 77743ac04a7..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/grouproles/package-info.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.groups.grouproles; - -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/groupsusers/AddGroupUuidColumnToGroupsUsers.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/groupsusers/AddGroupUuidColumnToGroupsUsers.java deleted file mode 100644 index 80e80197125..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/groupsusers/AddGroupUuidColumnToGroupsUsers.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.groups.groupsusers; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.def.VarcharColumnDef; -import org.sonar.server.platform.db.migration.sql.AddColumnsBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder; - -public class AddGroupUuidColumnToGroupsUsers extends DdlChange { - private static final String TABLE = "groups_users"; - - private static final VarcharColumnDef uuidColumnDefinition = newVarcharColumnDefBuilder() - .setColumnName("group_uuid") - .setIsNullable(true) - .setDefaultValue(null) - .setLimit(VarcharColumnDef.UUID_SIZE) - .build(); - - public AddGroupUuidColumnToGroupsUsers(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new AddColumnsBuilder(getDialect(), TABLE) - .addColumn(uuidColumnDefinition) - .build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/groupsusers/AddIndexOnGroupUuidOfGroupsUsersTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/groupsusers/AddIndexOnGroupUuidOfGroupsUsersTable.java deleted file mode 100644 index 0c28eaeab93..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/groupsusers/AddIndexOnGroupUuidOfGroupsUsersTable.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.groups.groupsusers; - -import java.sql.Connection; -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.db.DatabaseUtils; -import org.sonar.server.platform.db.migration.def.VarcharColumnDef; -import org.sonar.server.platform.db.migration.sql.CreateIndexBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.sonar.server.platform.db.migration.def.BigIntegerColumnDef.newBigIntegerColumnDefBuilder; -import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder; - -public class AddIndexOnGroupUuidOfGroupsUsersTable extends DdlChange { - private static final String TABLE_NAME = "groups_users"; - private static final String INDEX_NAME1 = "index_groups_users_group_uuid"; - private static final String INDEX_NAME2 = "groups_users_unique"; - - public AddIndexOnGroupUuidOfGroupsUsersTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - VarcharColumnDef groupUuid = newVarcharColumnDefBuilder() - .setColumnName("group_uuid") - .setIsNullable(false) - .setLimit(VarcharColumnDef.UUID_SIZE) - .build(); - if (!indexExists(INDEX_NAME1)) { - context.execute(new CreateIndexBuilder() - .setUnique(false) - .setTable(TABLE_NAME) - .setName(INDEX_NAME1) - .addColumn(groupUuid) - .build()); - } - if (!indexExists(INDEX_NAME2)) { - context.execute(new CreateIndexBuilder() - .setUnique(true) - .setTable(TABLE_NAME) - .setName(INDEX_NAME2) - .addColumn(groupUuid) - .addColumn(newBigIntegerColumnDefBuilder() - .setColumnName("user_id") - .setIsNullable(true) - .build()) - .build()); - } - } - - private boolean indexExists(String name) throws SQLException { - try (Connection connection = getDatabase().getDataSource().getConnection()) { - return DatabaseUtils.indexExistsIgnoreCase(TABLE_NAME, name, connection); - } - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/groupsusers/DropGroupIdColumnOfGroupsUsersTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/groupsusers/DropGroupIdColumnOfGroupsUsersTable.java deleted file mode 100644 index 16fed171bd2..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/groupsusers/DropGroupIdColumnOfGroupsUsersTable.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.groups.groupsusers; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.DropColumnsBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class DropGroupIdColumnOfGroupsUsersTable extends DdlChange { - public DropGroupIdColumnOfGroupsUsersTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new DropColumnsBuilder(getDialect(), "groups_users", "group_id").build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/groupsusers/DropIndexOnGroupIdOfGroupsUsersTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/groupsusers/DropIndexOnGroupIdOfGroupsUsersTable.java deleted file mode 100644 index a33da558967..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/groupsusers/DropIndexOnGroupIdOfGroupsUsersTable.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.groups.groupsusers; - -import java.sql.Connection; -import java.sql.SQLException; -import java.util.Optional; -import java.util.function.Consumer; -import org.sonar.db.Database; -import org.sonar.db.DatabaseUtils; -import org.sonar.server.platform.db.migration.sql.DropIndexBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class DropIndexOnGroupIdOfGroupsUsersTable extends DdlChange { - private static final String TABLE_NAME = "groups_users"; - private static final String INDEX_NAME1 = "index_groups_users_on_group_id"; - private static final String INDEX_NAME2 = "groups_users_unique"; - - public DropIndexOnGroupIdOfGroupsUsersTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - Consumer dropIndex = idx -> context.execute(new DropIndexBuilder(getDialect()) - .setTable(TABLE_NAME) - .setName(idx) - .build()); - - findExistingIndexName(INDEX_NAME1).ifPresent(dropIndex); - findExistingIndexName(INDEX_NAME2).ifPresent(dropIndex); - } - - private Optional findExistingIndexName(String indexName) throws SQLException { - try (Connection connection = getDatabase().getDataSource().getConnection()) { - return DatabaseUtils.findExistingIndex(connection, TABLE_NAME, indexName); - } - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/groupsusers/MakeGroupsUsersGroupUuidNotNullable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/groupsusers/MakeGroupsUsersGroupUuidNotNullable.java deleted file mode 100644 index f5140979a13..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/groupsusers/MakeGroupsUsersGroupUuidNotNullable.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.groups.groupsusers; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.def.VarcharColumnDef; -import org.sonar.server.platform.db.migration.sql.AlterColumnsBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder; - -public class MakeGroupsUsersGroupUuidNotNullable extends DdlChange { - private static final String TABLE = "groups_users"; - - private static final VarcharColumnDef uuidColumnDefinition = newVarcharColumnDefBuilder() - .setColumnName("group_uuid") - .setIsNullable(false) - .setDefaultValue(null) - .setLimit(VarcharColumnDef.UUID_SIZE) - .build(); - - public MakeGroupsUsersGroupUuidNotNullable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new AlterColumnsBuilder(getDialect(), TABLE) - .updateColumn(uuidColumnDefinition) - .build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/groupsusers/PopulateGroupsUsersGroupUuid.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/groupsusers/PopulateGroupsUsersGroupUuid.java deleted file mode 100644 index 8471be2eabb..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/groupsusers/PopulateGroupsUsersGroupUuid.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.groups.groupsusers; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.step.DataChange; -import org.sonar.server.platform.db.migration.step.MassUpdate; - -public class PopulateGroupsUsersGroupUuid extends DataChange { - - public PopulateGroupsUsersGroupUuid(Database db) { - super(db); - } - - @Override - protected void execute(Context context) throws SQLException { - MassUpdate massUpdate = context.prepareMassUpdate(); - - massUpdate.select("select gu.user_id, gu.group_id " + - "from groups_users gu " + - "left outer join groups g on gu.group_id = g.id " + - "where g.id is null and gu.group_id is not null"); - - massUpdate.update("delete from groups_users where user_id = ? and group_id = ?"); - - massUpdate.execute((row, update) -> { - update.setString(1, row.getString(1)); - update.setLong(2, row.getLong(2)); - - return true; - }); - - massUpdate = context.prepareMassUpdate(); - - massUpdate.select("select gu.user_id, gu.group_id, g.uuid " + - "from groups_users gu " + - "join groups g on gu.group_id = g.id"); - - massUpdate.update("update groups_users set group_uuid = ? where user_id = ? and group_id = ?"); - - massUpdate.execute((row, update) -> { - update.setString(1, row.getString(3)); - update.setLong(2, row.getLong(1)); - update.setLong(3, row.getLong(2)); - - return true; - }); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/groupsusers/package-info.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/groupsusers/package-info.java deleted file mode 100644 index 9c5d28896ad..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/groupsusers/package-info.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.groups.groupsusers; - -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/organizations/AddDefaultGroupUuidColumnToOrganizations.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/organizations/AddDefaultGroupUuidColumnToOrganizations.java deleted file mode 100644 index 3cff3e87637..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/organizations/AddDefaultGroupUuidColumnToOrganizations.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.groups.organizations; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.def.VarcharColumnDef; -import org.sonar.server.platform.db.migration.sql.AddColumnsBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder; - -public class AddDefaultGroupUuidColumnToOrganizations extends DdlChange { - private static final String TABLE = "organizations"; - - private static final VarcharColumnDef uuidColumnDefinition = newVarcharColumnDefBuilder() - .setColumnName("default_group_uuid") - .setIsNullable(true) - .setDefaultValue(null) - .setLimit(VarcharColumnDef.UUID_SIZE) - .build(); - - public AddDefaultGroupUuidColumnToOrganizations(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new AddColumnsBuilder(getDialect(), TABLE) - .addColumn(uuidColumnDefinition) - .build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/organizations/DropDefaultGroupIdColumnOfOrganizationsTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/organizations/DropDefaultGroupIdColumnOfOrganizationsTable.java deleted file mode 100644 index efacc52b734..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/organizations/DropDefaultGroupIdColumnOfOrganizationsTable.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.groups.organizations; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.DropColumnsBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class DropDefaultGroupIdColumnOfOrganizationsTable extends DdlChange { - public DropDefaultGroupIdColumnOfOrganizationsTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new DropColumnsBuilder(getDialect(), "organizations", "default_group_id").build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/organizations/PopulateOrganizationsDefaultGroupUuid.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/organizations/PopulateOrganizationsDefaultGroupUuid.java deleted file mode 100644 index 90bee326c65..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/organizations/PopulateOrganizationsDefaultGroupUuid.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.groups.organizations; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.step.DataChange; -import org.sonar.server.platform.db.migration.step.MassUpdate; - -public class PopulateOrganizationsDefaultGroupUuid extends DataChange { - - public PopulateOrganizationsDefaultGroupUuid(Database db) { - super(db); - } - - private static void removeOrphans(Context context) throws SQLException { - MassUpdate massUpdate = context.prepareMassUpdate(); - - massUpdate.select("select o.uuid, g.uuid from organizations o join groups g on o.default_group_id = g.id"); - massUpdate.update("update organizations set default_group_uuid = ? where uuid = ?"); - - massUpdate.execute((row, update) -> { - update.setString(1, row.getString(2)); - update.setString(2, row.getString(1)); - return true; - }); - } - - @Override - protected void execute(Context context) throws SQLException { - MassUpdate massUpdate = context.prepareMassUpdate(); - - massUpdate.select("select o.uuid " + - "from organizations o " + - "left outer join groups g on o.default_group_id = g.id " + - "where g.id is null and o.default_group_id is not null"); - - massUpdate.update("delete from organizations where uuid = ?"); - - massUpdate.execute((row, update) -> { - update.setString(1, row.getString(1)); - return true; - }); - - removeOrphans(context); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/organizations/package-info.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/organizations/package-info.java deleted file mode 100644 index e9c71e31340..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/organizations/package-info.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.groups.organizations; - -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/package-info.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/package-info.java deleted file mode 100644 index e36447e7cc1..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/package-info.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.groups; - -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/permtemplatesgroups/AddGroupUuidColumnToPermTemplatesGroups.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/permtemplatesgroups/AddGroupUuidColumnToPermTemplatesGroups.java deleted file mode 100644 index cc167d9ae82..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/permtemplatesgroups/AddGroupUuidColumnToPermTemplatesGroups.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.groups.permtemplatesgroups; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.def.VarcharColumnDef; -import org.sonar.server.platform.db.migration.sql.AddColumnsBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder; - -public class AddGroupUuidColumnToPermTemplatesGroups extends DdlChange { - private static final String TABLE = "perm_templates_groups"; - - private static final VarcharColumnDef uuidColumnDefinition = newVarcharColumnDefBuilder() - .setColumnName("group_uuid") - .setIsNullable(true) - .setDefaultValue(null) - .setLimit(VarcharColumnDef.UUID_SIZE) - .build(); - - public AddGroupUuidColumnToPermTemplatesGroups(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new AddColumnsBuilder(getDialect(), TABLE) - .addColumn(uuidColumnDefinition) - .build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/permtemplatesgroups/DropGroupIdColumnOfPermTemplatesGroupsTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/permtemplatesgroups/DropGroupIdColumnOfPermTemplatesGroupsTable.java deleted file mode 100644 index 1dc8dac9090..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/permtemplatesgroups/DropGroupIdColumnOfPermTemplatesGroupsTable.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.groups.permtemplatesgroups; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.DropColumnsBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class DropGroupIdColumnOfPermTemplatesGroupsTable extends DdlChange { - public DropGroupIdColumnOfPermTemplatesGroupsTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new DropColumnsBuilder(getDialect(), "perm_templates_groups", "group_id").build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/permtemplatesgroups/PopulatePermTemplatesGroupsGroupUuid.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/permtemplatesgroups/PopulatePermTemplatesGroupsGroupUuid.java deleted file mode 100644 index 5c558b6ceca..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/permtemplatesgroups/PopulatePermTemplatesGroupsGroupUuid.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.groups.permtemplatesgroups; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.step.DataChange; -import org.sonar.server.platform.db.migration.step.MassUpdate; - -public class PopulatePermTemplatesGroupsGroupUuid extends DataChange { - - public PopulatePermTemplatesGroupsGroupUuid(Database db) { - super(db); - } - - @Override - protected void execute(Context context) throws SQLException { - MassUpdate massUpdate = context.prepareMassUpdate(); - - massUpdate.select("select ptg.uuid " + - "from perm_templates_groups ptg " + - "left outer join groups g on ptg.group_id = g.id " + - "where g.id is null and ptg.group_id is not null"); - - massUpdate.update("delete from perm_templates_groups where uuid = ?"); - - massUpdate.execute((row, update) -> { - update.setString(1, row.getString(1)); - return true; - }); - - massUpdate = context.prepareMassUpdate(); - - massUpdate.select("select ptg.uuid, g.uuid " + - "from perm_templates_groups ptg " + - "join groups g on ptg.group_id = g.id"); - - massUpdate.update("update perm_templates_groups set group_uuid = ? where uuid = ?"); - - massUpdate.execute((row, update) -> { - update.setString(1, row.getString(2)); - update.setString(2, row.getString(1)); - return true; - }); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/permtemplatesgroups/package-info.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/permtemplatesgroups/package-info.java deleted file mode 100644 index 52e4d425e6c..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/permtemplatesgroups/package-info.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.groups.permtemplatesgroups; - -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/qprofileeditgroups/AddGroupUuidColumnToQProfileEditGroups.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/qprofileeditgroups/AddGroupUuidColumnToQProfileEditGroups.java deleted file mode 100644 index 0bc91289144..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/qprofileeditgroups/AddGroupUuidColumnToQProfileEditGroups.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.groups.qprofileeditgroups; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.def.VarcharColumnDef; -import org.sonar.server.platform.db.migration.sql.AddColumnsBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder; - -public class AddGroupUuidColumnToQProfileEditGroups extends DdlChange { - private static final String TABLE = "qprofile_edit_groups"; - - private static final VarcharColumnDef uuidColumnDefinition = newVarcharColumnDefBuilder() - .setColumnName("group_uuid") - .setIsNullable(true) - .setDefaultValue(null) - .setLimit(VarcharColumnDef.UUID_SIZE) - .build(); - - public AddGroupUuidColumnToQProfileEditGroups(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new AddColumnsBuilder(getDialect(), TABLE) - .addColumn(uuidColumnDefinition) - .build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/qprofileeditgroups/AddIndexOnGroupUuidOfQProfileEditGroupsTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/qprofileeditgroups/AddIndexOnGroupUuidOfQProfileEditGroupsTable.java deleted file mode 100644 index 8e3f601946b..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/qprofileeditgroups/AddIndexOnGroupUuidOfQProfileEditGroupsTable.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.groups.qprofileeditgroups; - -import java.sql.Connection; -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.db.DatabaseUtils; -import org.sonar.server.platform.db.migration.def.VarcharColumnDef; -import org.sonar.server.platform.db.migration.sql.CreateIndexBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder; - -public class AddIndexOnGroupUuidOfQProfileEditGroupsTable extends DdlChange { - private static final String TABLE_NAME = "qprofile_edit_groups"; - private static final String INDEX_NAME = "qprofile_edit_groups_unique"; - - public AddIndexOnGroupUuidOfQProfileEditGroupsTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - if (!indexExists()) { - context.execute(new CreateIndexBuilder() - .setUnique(true) - .setTable(TABLE_NAME) - .setName(INDEX_NAME) - .addColumn(newVarcharColumnDefBuilder() - .setColumnName("group_uuid") - .setIsNullable(false) - .setLimit(VarcharColumnDef.UUID_SIZE) - .build()) - .addColumn(newVarcharColumnDefBuilder() - .setColumnName("qprofile_uuid") - .setIsNullable(false) - .setLimit(VarcharColumnDef.UUID_SIZE) - .build()) - .build()); - } - } - - private boolean indexExists() throws SQLException { - try (Connection connection = getDatabase().getDataSource().getConnection()) { - return DatabaseUtils.indexExistsIgnoreCase(TABLE_NAME, INDEX_NAME, connection); - } - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/qprofileeditgroups/DropGroupIdColumnOfQProfileEditGroupsTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/qprofileeditgroups/DropGroupIdColumnOfQProfileEditGroupsTable.java deleted file mode 100644 index f3e36517d84..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/qprofileeditgroups/DropGroupIdColumnOfQProfileEditGroupsTable.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.groups.qprofileeditgroups; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.DropColumnsBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class DropGroupIdColumnOfQProfileEditGroupsTable extends DdlChange { - public DropGroupIdColumnOfQProfileEditGroupsTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new DropColumnsBuilder(getDialect(), "qprofile_edit_groups", "group_id").build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/qprofileeditgroups/DropIndexOnGroupIdOfQProfileEditGroupsTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/qprofileeditgroups/DropIndexOnGroupIdOfQProfileEditGroupsTable.java deleted file mode 100644 index 33769fd2aa5..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/qprofileeditgroups/DropIndexOnGroupIdOfQProfileEditGroupsTable.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.groups.qprofileeditgroups; - -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.step.DropIndexChange; - -public class DropIndexOnGroupIdOfQProfileEditGroupsTable extends DropIndexChange { - private static final String TABLE_NAME = "qprofile_edit_groups"; - private static final String INDEX_NAME = "qprofile_edit_groups_unique"; - - public DropIndexOnGroupIdOfQProfileEditGroupsTable(Database db) { - super(db, INDEX_NAME, TABLE_NAME); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/qprofileeditgroups/MakeQProfileEditGroupsGroupUuidNotNullable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/qprofileeditgroups/MakeQProfileEditGroupsGroupUuidNotNullable.java deleted file mode 100644 index 83488737904..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/qprofileeditgroups/MakeQProfileEditGroupsGroupUuidNotNullable.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.groups.qprofileeditgroups; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.def.VarcharColumnDef; -import org.sonar.server.platform.db.migration.sql.AlterColumnsBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder; - -public class MakeQProfileEditGroupsGroupUuidNotNullable extends DdlChange { - private static final String TABLE = "qprofile_edit_groups"; - - private static final VarcharColumnDef uuidColumnDefinition = newVarcharColumnDefBuilder() - .setColumnName("group_uuid") - .setIsNullable(false) - .setDefaultValue(null) - .setLimit(VarcharColumnDef.UUID_SIZE) - .build(); - - public MakeQProfileEditGroupsGroupUuidNotNullable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new AlterColumnsBuilder(getDialect(), TABLE) - .updateColumn(uuidColumnDefinition) - .build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/qprofileeditgroups/PopulateQProfileEditGroupsGroupUuid.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/qprofileeditgroups/PopulateQProfileEditGroupsGroupUuid.java deleted file mode 100644 index 7a871e0726b..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/qprofileeditgroups/PopulateQProfileEditGroupsGroupUuid.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.groups.qprofileeditgroups; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.step.DataChange; -import org.sonar.server.platform.db.migration.step.MassUpdate; -import org.sonar.server.platform.db.migration.version.v84.util.OrphanData; - -public class PopulateQProfileEditGroupsGroupUuid extends DataChange { - - public PopulateQProfileEditGroupsGroupUuid(Database db) { - super(db); - } - - @Override - protected void execute(Context context) throws SQLException { - MassUpdate massUpdate = context.prepareMassUpdate(); - - massUpdate.select("select qeg.uuid, g.uuid " + - "from qprofile_edit_groups qeg " + - "join groups g on qeg.group_id = g.id"); - - massUpdate.update("update qprofile_edit_groups set group_uuid = ? where uuid = ?"); - - massUpdate.execute((row, update) -> { - update.setString(1, row.getString(2)); - update.setString(2, row.getString(1)); - return true; - }); - - OrphanData.delete(context, "qprofile_edit_groups", "group_uuid"); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/qprofileeditgroups/package-info.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/qprofileeditgroups/package-info.java deleted file mode 100644 index 606fbc6d375..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/groups/qprofileeditgroups/package-info.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.groups.qprofileeditgroups; - -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/issuechanges/AddIndexOnIssueKeyOfIssueChangesTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/issuechanges/AddIndexOnIssueKeyOfIssueChangesTable.java deleted file mode 100644 index 5e09b143893..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/issuechanges/AddIndexOnIssueKeyOfIssueChangesTable.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.issuechanges; - -import java.sql.Connection; -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.db.DatabaseUtils; -import org.sonar.server.platform.db.migration.sql.CreateIndexBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder; - -public class AddIndexOnIssueKeyOfIssueChangesTable extends DdlChange { - private static final String TABLE_NAME = "issue_changes"; - private static final String INDEX_NAME = "issue_changes_issue_key"; - - public AddIndexOnIssueKeyOfIssueChangesTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - if (!indexExists()) { - context.execute(new CreateIndexBuilder() - .setUnique(false) - .setTable(TABLE_NAME) - .setName(INDEX_NAME) - .addColumn(newVarcharColumnDefBuilder() - .setColumnName("issue_key") - .setIsNullable(true) - .setLimit(50) - .build()) - .build()); - } - } - - private boolean indexExists() throws SQLException { - try (Connection connection = getDatabase().getDataSource().getConnection()) { - return DatabaseUtils.indexExistsIgnoreCase(TABLE_NAME, INDEX_NAME, connection); - } - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/issuechanges/AddIndexOnKeeOfIssueChangesTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/issuechanges/AddIndexOnKeeOfIssueChangesTable.java deleted file mode 100644 index 308179b95f8..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/issuechanges/AddIndexOnKeeOfIssueChangesTable.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.issuechanges; - -import java.sql.Connection; -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.db.DatabaseUtils; -import org.sonar.server.platform.db.migration.sql.CreateIndexBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder; - -public class AddIndexOnKeeOfIssueChangesTable extends DdlChange { - private static final String TABLE_NAME = "issue_changes"; - private static final String INDEX_NAME = "issue_changes_kee"; - - public AddIndexOnKeeOfIssueChangesTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - if (!indexExists()) { - context.execute(new CreateIndexBuilder() - .setUnique(false) - .setTable(TABLE_NAME) - .setName(INDEX_NAME) - .addColumn(newVarcharColumnDefBuilder() - .setColumnName("kee") - .setIsNullable(true) - .setLimit(50) - .build()) - .build()); - } - } - - private boolean indexExists() throws SQLException { - try (Connection connection = getDatabase().getDataSource().getConnection()) { - return DatabaseUtils.indexExistsIgnoreCase(TABLE_NAME, INDEX_NAME, connection); - } - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/issuechanges/AddPrimaryKeyOnUuidColumnOfIssueChangesTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/issuechanges/AddPrimaryKeyOnUuidColumnOfIssueChangesTable.java deleted file mode 100644 index 61d5411cd82..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/issuechanges/AddPrimaryKeyOnUuidColumnOfIssueChangesTable.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.issuechanges; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.AddPrimaryKeyBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class AddPrimaryKeyOnUuidColumnOfIssueChangesTable extends DdlChange { - - public AddPrimaryKeyOnUuidColumnOfIssueChangesTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new AddPrimaryKeyBuilder("issue_changes", "uuid").build()); - } - -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/issuechanges/CopyIssueChangesTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/issuechanges/CopyIssueChangesTable.java deleted file mode 100644 index 8f09a04aeb2..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/issuechanges/CopyIssueChangesTable.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.issuechanges; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.db.dialect.MsSql; -import org.sonar.server.platform.db.migration.def.VarcharColumnDef; -import org.sonar.server.platform.db.migration.sql.AlterColumnsBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder; - -public class CopyIssueChangesTable extends DdlChange { - private static final String COPY_NAME = "issue_changes_copy"; - - public CopyIssueChangesTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - - String query; - if (getDatabase().getDialect().getId().equals(MsSql.ID)) { - query = "select cast (ic.id AS VARCHAR(40)) AS uuid, ic.kee, ic.issue_key, ic.user_login, ic.change_type, " + - "ic.change_data, ic.created_at, ic.updated_at, ic.issue_change_creation_date, i.project_uuid " + - "INTO issue_changes_copy " + - "FROM issue_changes AS ic inner join issues i on i.kee = ic.issue_key"; - } else { - query = "create table issue_changes_copy " + - "(uuid, kee, issue_key, user_login, change_type, change_data, created_at, updated_at, issue_change_creation_date, project_uuid)" + - "as (" + - "SELECT cast (ic.id AS VARCHAR(40)) AS uuid, ic.kee, ic.issue_key, ic.user_login, ic.change_type, ic.change_data, ic.created_at, ic.updated_at, " - + "ic.issue_change_creation_date, i.project_uuid " + - "FROM issue_changes ic " + - "inner join issues i on i.kee = ic.issue_key " + - ")"; - } - - context.execute(query); - context.execute(new AlterColumnsBuilder(getDialect(), COPY_NAME).updateColumn( - newVarcharColumnDefBuilder() - .setColumnName("project_uuid") - .setIsNullable(false) - .setDefaultValue(null) - .setLimit(VarcharColumnDef.UUID_VARCHAR_SIZE) - .build()).build()); - context.execute(new AlterColumnsBuilder(getDialect(), COPY_NAME).updateColumn( - newVarcharColumnDefBuilder() - .setColumnName("issue_key") - .setIsNullable(false) - .setDefaultValue(null) - .setLimit(VarcharColumnDef.UUID_VARCHAR_SIZE) - .build()).build()); - context.execute(new AlterColumnsBuilder(getDialect(), COPY_NAME).updateColumn( - newVarcharColumnDefBuilder() - .setColumnName("uuid") - .setIsNullable(false) - .setDefaultValue(null) - .setLimit(VarcharColumnDef.UUID_SIZE) - .build()).build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/issuechanges/DropIssueChangesTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/issuechanges/DropIssueChangesTable.java deleted file mode 100644 index 7b6b1420934..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/issuechanges/DropIssueChangesTable.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.issuechanges; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.DropTableBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class DropIssueChangesTable extends DdlChange { - public DropIssueChangesTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new DropTableBuilder(getDialect(), "issue_changes").build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/issuechanges/RenameIssueChangesCopyToIssueChanges.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/issuechanges/RenameIssueChangesCopyToIssueChanges.java deleted file mode 100644 index d2f5bb1766a..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/issuechanges/RenameIssueChangesCopyToIssueChanges.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.issuechanges; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.RenameTableBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class RenameIssueChangesCopyToIssueChanges extends DdlChange { - public RenameIssueChangesCopyToIssueChanges(Database db) { - super(db); - } - - @Override public void execute(Context context) throws SQLException { - context.execute(new RenameTableBuilder(getDialect()) - .setName("issue_changes_copy") - .setNewName("issue_changes") - .setAutoGeneratedId(false) - .build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/issuechanges/package-info.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/issuechanges/package-info.java deleted file mode 100644 index 9be65413188..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/issuechanges/package-info.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.issuechanges; - -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/issues/AddPrimaryKeyOnKeeColumnOfIssuesTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/issues/AddPrimaryKeyOnKeeColumnOfIssuesTable.java deleted file mode 100644 index ab48c555d58..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/issues/AddPrimaryKeyOnKeeColumnOfIssuesTable.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.issues; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.AddPrimaryKeyBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class AddPrimaryKeyOnKeeColumnOfIssuesTable extends DdlChange { - private static final String TABLE_NAME = "issues"; - - public AddPrimaryKeyOnKeeColumnOfIssuesTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new AddPrimaryKeyBuilder(TABLE_NAME, "kee").build()); - } - -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/issues/package-info.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/issues/package-info.java deleted file mode 100644 index 5768a007cf0..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/issues/package-info.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.issues; - -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/manualmeasures/AddPrimaryKeyOnUuidColumnOfManualMeasuresTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/manualmeasures/AddPrimaryKeyOnUuidColumnOfManualMeasuresTable.java deleted file mode 100644 index abcdd62ff10..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/manualmeasures/AddPrimaryKeyOnUuidColumnOfManualMeasuresTable.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.manualmeasures; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.AddPrimaryKeyBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class AddPrimaryKeyOnUuidColumnOfManualMeasuresTable extends DdlChange { - - public AddPrimaryKeyOnUuidColumnOfManualMeasuresTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new AddPrimaryKeyBuilder("manual_measures", "uuid").build()); - } - -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/manualmeasures/AddUuidColumnToManualMeasures.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/manualmeasures/AddUuidColumnToManualMeasures.java deleted file mode 100644 index dcd30d2809e..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/manualmeasures/AddUuidColumnToManualMeasures.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.manualmeasures; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.def.VarcharColumnDef; -import org.sonar.server.platform.db.migration.sql.AddColumnsBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder; - -public class AddUuidColumnToManualMeasures extends DdlChange { - private static final String TABLE = "manual_measures"; - - private static final VarcharColumnDef uuidColumnDefinition = newVarcharColumnDefBuilder() - .setColumnName("uuid") - .setIsNullable(true) - .setDefaultValue(null) - .setLimit(VarcharColumnDef.UUID_SIZE) - .build(); - - public AddUuidColumnToManualMeasures(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new AddColumnsBuilder(getDialect(), TABLE) - .addColumn(uuidColumnDefinition) - .build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/manualmeasures/DropIdColumnOfManualMeasuresTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/manualmeasures/DropIdColumnOfManualMeasuresTable.java deleted file mode 100644 index 6d847d62220..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/manualmeasures/DropIdColumnOfManualMeasuresTable.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.manualmeasures; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.DropColumnsBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class DropIdColumnOfManualMeasuresTable extends DdlChange { - - public DropIdColumnOfManualMeasuresTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new DropColumnsBuilder(getDialect(), "manual_measures", "id").build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/manualmeasures/DropPrimaryKeyOnIdColumnOfManualMeasuresTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/manualmeasures/DropPrimaryKeyOnIdColumnOfManualMeasuresTable.java deleted file mode 100644 index 01d9a702b43..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/manualmeasures/DropPrimaryKeyOnIdColumnOfManualMeasuresTable.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.manualmeasures; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.DropPrimaryKeySqlGenerator; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class DropPrimaryKeyOnIdColumnOfManualMeasuresTable extends DdlChange { - - private final DropPrimaryKeySqlGenerator dropPrimaryKeySqlGenerator; - - public DropPrimaryKeyOnIdColumnOfManualMeasuresTable(Database db, DropPrimaryKeySqlGenerator dropPrimaryKeySqlGenerator) { - super(db); - this.dropPrimaryKeySqlGenerator = dropPrimaryKeySqlGenerator; - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(dropPrimaryKeySqlGenerator.generate("manual_measures", "id", true)); - } - -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/manualmeasures/MakeManualMeasuresUuidColumnNotNullable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/manualmeasures/MakeManualMeasuresUuidColumnNotNullable.java deleted file mode 100644 index 33a606b6d48..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/manualmeasures/MakeManualMeasuresUuidColumnNotNullable.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.manualmeasures; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.def.VarcharColumnDef; -import org.sonar.server.platform.db.migration.sql.AlterColumnsBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder; - -public class MakeManualMeasuresUuidColumnNotNullable extends DdlChange { - private static final String TABLE = "manual_measures"; - - private static final VarcharColumnDef uuidColumnDefinition = newVarcharColumnDefBuilder() - .setColumnName("uuid") - .setIsNullable(false) - .setDefaultValue(null) - .setLimit(VarcharColumnDef.UUID_SIZE) - .build(); - - public MakeManualMeasuresUuidColumnNotNullable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new AlterColumnsBuilder(getDialect(), TABLE) - .updateColumn(uuidColumnDefinition) - .build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/manualmeasures/PopulateManualMeasureUuid.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/manualmeasures/PopulateManualMeasureUuid.java deleted file mode 100644 index f67237a7e3b..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/manualmeasures/PopulateManualMeasureUuid.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.manualmeasures; - -import java.sql.SQLException; -import org.sonar.core.util.UuidFactory; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.step.DataChange; -import org.sonar.server.platform.db.migration.step.MassUpdate; - -public class PopulateManualMeasureUuid extends DataChange { - - private final UuidFactory uuidFactory; - - public PopulateManualMeasureUuid(Database db, UuidFactory uuidFactory) { - super(db); - this.uuidFactory = uuidFactory; - } - - @Override - protected void execute(Context context) throws SQLException { - MassUpdate massUpdate = context.prepareMassUpdate(); - - massUpdate.select("select id from manual_measures where uuid is null"); - massUpdate.update("update manual_measures set uuid = ? where id = ?"); - - massUpdate.execute((row, update) -> { - update.setString(1, uuidFactory.create()); - update.setLong(2, row.getLong(1)); - return true; - }); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/manualmeasures/package-info.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/manualmeasures/package-info.java deleted file mode 100644 index dae0c2b2424..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/manualmeasures/package-info.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.manualmeasures; - -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/AddPrimaryKeyOnUuidColumnOfMetricsTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/AddPrimaryKeyOnUuidColumnOfMetricsTable.java deleted file mode 100644 index 4c98812c6a9..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/AddPrimaryKeyOnUuidColumnOfMetricsTable.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.metrics; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.AddPrimaryKeyBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class AddPrimaryKeyOnUuidColumnOfMetricsTable extends DdlChange { - - public AddPrimaryKeyOnUuidColumnOfMetricsTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new AddPrimaryKeyBuilder("metrics", "uuid").build()); - } - -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/AddUuidColumnToMetricsTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/AddUuidColumnToMetricsTable.java deleted file mode 100644 index 43efea12b68..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/AddUuidColumnToMetricsTable.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.metrics; - -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.version.v84.common.AddUuidColumnToTable; - -public class AddUuidColumnToMetricsTable extends AddUuidColumnToTable { - private static final String TABLE = "metrics"; - - public AddUuidColumnToMetricsTable(Database db) { - super(db, TABLE); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/DropIdColumnOfMetricsTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/DropIdColumnOfMetricsTable.java deleted file mode 100644 index 026c931dd20..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/DropIdColumnOfMetricsTable.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.metrics; - -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.version.v84.common.DropIdColumn; - -public class DropIdColumnOfMetricsTable extends DropIdColumn { - private static final String TABLE = "metrics"; - - public DropIdColumnOfMetricsTable(Database db) { - super(db, TABLE); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/DropPrimaryKeyOnIdColumnOfMetricsTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/DropPrimaryKeyOnIdColumnOfMetricsTable.java deleted file mode 100644 index 50e204ee5b6..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/DropPrimaryKeyOnIdColumnOfMetricsTable.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.metrics; - -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.DropPrimaryKeySqlGenerator; -import org.sonar.server.platform.db.migration.version.v84.common.DropPrimaryKeyOnIdColumn; - -public class DropPrimaryKeyOnIdColumnOfMetricsTable extends DropPrimaryKeyOnIdColumn { - private static final String TABLE_NAME = "metrics"; - - public DropPrimaryKeyOnIdColumnOfMetricsTable(Database db, DropPrimaryKeySqlGenerator dropPrimaryKeySqlGenerator) { - super(db, dropPrimaryKeySqlGenerator, TABLE_NAME); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/MakeMetricsUuidColumnNotNullable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/MakeMetricsUuidColumnNotNullable.java deleted file mode 100644 index c590689ea9d..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/MakeMetricsUuidColumnNotNullable.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.metrics; - -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.version.v84.common.MakeUuidColumnNotNullable; - -public class MakeMetricsUuidColumnNotNullable extends MakeUuidColumnNotNullable { - private static final String TABLE = "metrics"; - - public MakeMetricsUuidColumnNotNullable(Database db) { - super(db, TABLE); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/PopulateMetricsUuid.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/PopulateMetricsUuid.java deleted file mode 100644 index d4d9ea11c7d..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/PopulateMetricsUuid.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.metrics; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.step.DataChange; -import org.sonar.server.platform.db.migration.step.MassUpdate; - -public class PopulateMetricsUuid extends DataChange { - public PopulateMetricsUuid(Database db) { - super(db); - } - - @Override - protected void execute(Context context) throws SQLException { - MassUpdate massUpdate = context.prepareMassUpdate(); - - massUpdate.select("select id from metrics where uuid is null"); - massUpdate.update("update metrics set uuid = ? where id = ?"); - - massUpdate.execute((row, update) -> { - long id = row.getLong(1); - update.setString(1, Long.toString(id)); - update.setLong(2, id); - return true; - }); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/livemeasures/AddIndexOnMetricUuidOfLiveMeasuresTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/livemeasures/AddIndexOnMetricUuidOfLiveMeasuresTable.java deleted file mode 100644 index c05fd4427df..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/livemeasures/AddIndexOnMetricUuidOfLiveMeasuresTable.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.metrics.livemeasures; - -import java.sql.Connection; -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.db.DatabaseUtils; -import org.sonar.server.platform.db.migration.def.VarcharColumnDef; -import org.sonar.server.platform.db.migration.sql.CreateIndexBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder; - -public class AddIndexOnMetricUuidOfLiveMeasuresTable extends DdlChange { - private static final String TABLE_NAME = "live_measures"; - private static final String INDEX_NAME = "live_measures_component"; - - public AddIndexOnMetricUuidOfLiveMeasuresTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - if (!indexExists()) { - context.execute(new CreateIndexBuilder() - .setUnique(true) - .setTable(TABLE_NAME) - .setName(INDEX_NAME) - .addColumn(newVarcharColumnDefBuilder() - .setColumnName("component_uuid") - .setIsNullable(false) - .setLimit(VarcharColumnDef.UUID_SIZE) - .build()) - .addColumn(newVarcharColumnDefBuilder() - .setColumnName("metric_uuid") - .setIsNullable(false) - .setLimit(VarcharColumnDef.UUID_SIZE) - .build()) - .build()); - } - } - - private boolean indexExists() throws SQLException { - try (Connection connection = getDatabase().getDataSource().getConnection()) { - return DatabaseUtils.indexExistsIgnoreCase(TABLE_NAME, INDEX_NAME, connection); - } - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/livemeasures/AddIndexOnProjectUuidOfLiveMeasuresTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/livemeasures/AddIndexOnProjectUuidOfLiveMeasuresTable.java deleted file mode 100644 index 926391ad1c7..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/livemeasures/AddIndexOnProjectUuidOfLiveMeasuresTable.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.metrics.livemeasures; - -import java.sql.Connection; -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.db.DatabaseUtils; -import org.sonar.server.platform.db.migration.def.VarcharColumnDef; -import org.sonar.server.platform.db.migration.sql.CreateIndexBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder; - -public class AddIndexOnProjectUuidOfLiveMeasuresTable extends DdlChange { - private static final String TABLE_NAME = "live_measures"; - private static final String INDEX_NAME = "live_measures_project"; - - public AddIndexOnProjectUuidOfLiveMeasuresTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - if (!indexExists()) { - context.execute(new CreateIndexBuilder() - .setUnique(false) - .setTable(TABLE_NAME) - .setName(INDEX_NAME) - .addColumn(newVarcharColumnDefBuilder() - .setColumnName("project_uuid") - .setIsNullable(false) - .setLimit(VarcharColumnDef.UUID_SIZE) - .build()) - .build()); - } - } - - private boolean indexExists() throws SQLException { - try (Connection connection = getDatabase().getDataSource().getConnection()) { - return DatabaseUtils.indexExistsIgnoreCase(TABLE_NAME, INDEX_NAME, connection); - } - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/livemeasures/AddPKeyOnUuidOfLiveMeasuresTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/livemeasures/AddPKeyOnUuidOfLiveMeasuresTable.java deleted file mode 100644 index 575d834a1b2..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/livemeasures/AddPKeyOnUuidOfLiveMeasuresTable.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.metrics.livemeasures; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.AddPrimaryKeyBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class AddPKeyOnUuidOfLiveMeasuresTable extends DdlChange { - private static final String TABLE_NAME = "live_measures"; - - public AddPKeyOnUuidOfLiveMeasuresTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new AddPrimaryKeyBuilder(TABLE_NAME, "uuid").build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/livemeasures/CopyLiveMeasuresTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/livemeasures/CopyLiveMeasuresTable.java deleted file mode 100644 index 023708dc150..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/livemeasures/CopyLiveMeasuresTable.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.metrics.livemeasures; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.def.VarcharColumnDef; -import org.sonar.server.platform.db.migration.sql.CreateTableAsBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.sonar.server.platform.db.migration.def.BigIntegerColumnDef.newBigIntegerColumnDefBuilder; -import static org.sonar.server.platform.db.migration.def.BlobColumnDef.newBlobColumnDefBuilder; -import static org.sonar.server.platform.db.migration.def.DecimalColumnDef.newDecimalColumnDefBuilder; -import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder; - -public class CopyLiveMeasuresTable extends DdlChange { - public CopyLiveMeasuresTable(Database db) { - super(db); - } - - @Override public void execute(Context context) throws SQLException { - CreateTableAsBuilder builder = new CreateTableAsBuilder(getDialect(), "live_measures_copy", "live_measures") - // this will cause the following changes: - // * Add METRIC_UUID with values in METRIC_ID casted to varchar - .addColumn(newVarcharColumnDefBuilder().setColumnName("uuid").setLimit(VarcharColumnDef.UUID_SIZE).setIsNullable(false).build()) - .addColumn(newVarcharColumnDefBuilder().setColumnName("project_uuid").setLimit(50).setIsNullable(false).build()) - .addColumn(newVarcharColumnDefBuilder().setColumnName("component_uuid").setLimit(50).setIsNullable(false).build()) - .addColumnWithCast(newVarcharColumnDefBuilder().setColumnName("metric_uuid").setLimit(40).setIsNullable(false).build(), "metric_id") - .addColumn(newDecimalColumnDefBuilder().setColumnName("value").build()) - .addColumn(newVarcharColumnDefBuilder().setColumnName("text_value").setLimit(4000).build()) - .addColumn(newDecimalColumnDefBuilder().setColumnName("variation").build()) - .addColumn(newBlobColumnDefBuilder().setColumnName("measure_data").build()) - .addColumn(newVarcharColumnDefBuilder().setColumnName("update_marker").setLimit(VarcharColumnDef.UUID_SIZE).build()) - .addColumn(newBigIntegerColumnDefBuilder().setColumnName("created_at").setIsNullable(false).build()) - .addColumn(newBigIntegerColumnDefBuilder().setColumnName("updated_at").setIsNullable(false).build()); - context.execute(builder.build()); - - /* - * "UUID VARCHAR(40) NOT NULL", - * "PROJECT_UUID VARCHAR(50) NOT NULL", - * "COMPONENT_UUID VARCHAR(50) NOT NULL", - * "METRIC_UUID VARCHAR(40) NOT NULL", - * "VALUE DOUBLE", - * "TEXT_VALUE VARCHAR(4000)", - * "VARIATION DOUBLE", - * "MEASURE_DATA BLOB", - * "UPDATE_MARKER VARCHAR(40)", - * "CREATED_AT BIGINT NOT NULL", - * "UPDATED_AT BIGINT NOT NULL" - */ - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/livemeasures/DropLiveMeasuresTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/livemeasures/DropLiveMeasuresTable.java deleted file mode 100644 index c1a29a3736f..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/livemeasures/DropLiveMeasuresTable.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.metrics.livemeasures; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.DropTableBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class DropLiveMeasuresTable extends DdlChange { - public DropLiveMeasuresTable(Database db) { - super(db); - } - - @Override public void execute(Context context) throws SQLException { - context.execute(new DropTableBuilder(getDialect(), "live_measures").build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/livemeasures/RenameLiveMeasuresCopyToLiveMeasures.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/livemeasures/RenameLiveMeasuresCopyToLiveMeasures.java deleted file mode 100644 index c3cb5f3da11..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/livemeasures/RenameLiveMeasuresCopyToLiveMeasures.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.metrics.livemeasures; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.RenameTableBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class RenameLiveMeasuresCopyToLiveMeasures extends DdlChange { - public RenameLiveMeasuresCopyToLiveMeasures(Database db) { - super(db); - } - - @Override public void execute(Context context) throws SQLException { - context.execute(new RenameTableBuilder(getDialect()) - .setName("live_measures_copy") - .setNewName("live_measures") - .setAutoGeneratedId(false) - .build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/livemeasures/package-info.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/livemeasures/package-info.java deleted file mode 100644 index 7584643acb7..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/livemeasures/package-info.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.metrics.livemeasures; - -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/manualmeasures/AddMetricUuidColumnToManualMeasures.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/manualmeasures/AddMetricUuidColumnToManualMeasures.java deleted file mode 100644 index 95107b6ef02..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/manualmeasures/AddMetricUuidColumnToManualMeasures.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.metrics.manualmeasures; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.def.VarcharColumnDef; -import org.sonar.server.platform.db.migration.sql.AddColumnsBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder; - -public class AddMetricUuidColumnToManualMeasures extends DdlChange { - private static final String TABLE = "manual_measures"; - - private static final VarcharColumnDef uuidColumnDefinition = newVarcharColumnDefBuilder() - .setColumnName("metric_uuid") - .setIsNullable(true) - .setDefaultValue(null) - .setLimit(VarcharColumnDef.UUID_SIZE) - .build(); - - public AddMetricUuidColumnToManualMeasures(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new AddColumnsBuilder(getDialect(), TABLE) - .addColumn(uuidColumnDefinition) - .build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/manualmeasures/DropMetricIdColumnOfManualMeasuresTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/manualmeasures/DropMetricIdColumnOfManualMeasuresTable.java deleted file mode 100644 index b41fd6e429e..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/manualmeasures/DropMetricIdColumnOfManualMeasuresTable.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.metrics.manualmeasures; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.DropColumnsBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class DropMetricIdColumnOfManualMeasuresTable extends DdlChange { - public DropMetricIdColumnOfManualMeasuresTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new DropColumnsBuilder(getDialect(), "manual_measures", "metric_id").build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/manualmeasures/MakeManualMeasuresMetricUuidNotNullable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/manualmeasures/MakeManualMeasuresMetricUuidNotNullable.java deleted file mode 100644 index c3457b5c9bf..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/manualmeasures/MakeManualMeasuresMetricUuidNotNullable.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.metrics.manualmeasures; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.def.VarcharColumnDef; -import org.sonar.server.platform.db.migration.sql.AlterColumnsBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder; - -public class MakeManualMeasuresMetricUuidNotNullable extends DdlChange { - private static final String TABLE = "manual_measures"; - - private static final VarcharColumnDef uuidColumnDefinition = newVarcharColumnDefBuilder() - .setColumnName("metric_uuid") - .setIsNullable(false) - .setDefaultValue(null) - .setLimit(VarcharColumnDef.UUID_SIZE) - .build(); - - public MakeManualMeasuresMetricUuidNotNullable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new AlterColumnsBuilder(getDialect(), TABLE) - .updateColumn(uuidColumnDefinition) - .build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/manualmeasures/PopulateManualMeasuresMetricUuid.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/manualmeasures/PopulateManualMeasuresMetricUuid.java deleted file mode 100644 index f404da74103..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/manualmeasures/PopulateManualMeasuresMetricUuid.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.metrics.manualmeasures; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.step.DataChange; -import org.sonar.server.platform.db.migration.step.MassUpdate; - -public class PopulateManualMeasuresMetricUuid extends DataChange { - - public PopulateManualMeasuresMetricUuid(Database db) { - super(db); - } - - @Override - protected void execute(Context context) throws SQLException { - MassUpdate massUpdate = context.prepareMassUpdate(); - - massUpdate.select("select mm.uuid, m.uuid " + - "from manual_measures mm " + - "join metrics m on mm.metric_id = m.id"); - - massUpdate.update("update manual_measures set metric_uuid = ? where uuid = ?"); - - massUpdate.execute((row, update) -> { - update.setString(1, row.getString(2)); - update.setString(2, row.getString(1)); - return true; - }); - - massUpdate = context.prepareMassUpdate(); - - massUpdate.select("select uuid from manual_measures where metric_uuid is null"); - massUpdate.update("delete from manual_measures where uuid = ?"); - - massUpdate.execute((row, update) -> { - update.setString(1, row.getString(1)); - return true; - }); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/manualmeasures/package-info.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/manualmeasures/package-info.java deleted file mode 100644 index e74fa233db4..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/manualmeasures/package-info.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.metrics.manualmeasures; - -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/package-info.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/package-info.java deleted file mode 100644 index 62fb00a5c81..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/package-info.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.metrics; - -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/projectmeasures/AddIndexOnMetricUuidAndAnalysisUuidOfProjectMeasuresTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/projectmeasures/AddIndexOnMetricUuidAndAnalysisUuidOfProjectMeasuresTable.java deleted file mode 100644 index 347edef0708..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/projectmeasures/AddIndexOnMetricUuidAndAnalysisUuidOfProjectMeasuresTable.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.metrics.projectmeasures; - -import java.sql.Connection; -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.db.DatabaseUtils; -import org.sonar.server.platform.db.migration.def.VarcharColumnDef; -import org.sonar.server.platform.db.migration.sql.CreateIndexBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder; - -public class AddIndexOnMetricUuidAndAnalysisUuidOfProjectMeasuresTable extends DdlChange { - private static final String TABLE_NAME = "project_measures"; - private static final String INDEX_NAME = "measures_analysis_metric"; - - public AddIndexOnMetricUuidAndAnalysisUuidOfProjectMeasuresTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - if (!indexExists()) { - context.execute(new CreateIndexBuilder() - .setUnique(false) - .setTable(TABLE_NAME) - .setName(INDEX_NAME) - .addColumn(newVarcharColumnDefBuilder() - .setColumnName("analysis_uuid") - .setIsNullable(false) - .setLimit(VarcharColumnDef.UUID_SIZE) - .build()) - .addColumn(newVarcharColumnDefBuilder() - .setColumnName("metric_uuid") - .setIsNullable(false) - .setLimit(VarcharColumnDef.UUID_SIZE) - .build()) - .build()); - } - } - - private boolean indexExists() throws SQLException { - try (Connection connection = getDatabase().getDataSource().getConnection()) { - return DatabaseUtils.indexExistsIgnoreCase(TABLE_NAME, INDEX_NAME, connection); - } - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/projectmeasures/AddIndexOnMetricUuidOfProjectMeasuresTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/projectmeasures/AddIndexOnMetricUuidOfProjectMeasuresTable.java deleted file mode 100644 index 8473487e14f..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/projectmeasures/AddIndexOnMetricUuidOfProjectMeasuresTable.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.metrics.projectmeasures; - -import java.sql.Connection; -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.db.DatabaseUtils; -import org.sonar.server.platform.db.migration.def.VarcharColumnDef; -import org.sonar.server.platform.db.migration.sql.CreateIndexBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder; - -public class AddIndexOnMetricUuidOfProjectMeasuresTable extends DdlChange { - private static final String TABLE_NAME = "project_measures"; - private static final String INDEX_NAME = "project_measures_metric"; - - public AddIndexOnMetricUuidOfProjectMeasuresTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - if (!indexExists()) { - context.execute(new CreateIndexBuilder() - .setUnique(false) - .setTable(TABLE_NAME) - .setName(INDEX_NAME) - .addColumn(newVarcharColumnDefBuilder() - .setColumnName("metric_uuid") - .setIsNullable(false) - .setLimit(VarcharColumnDef.UUID_SIZE) - .build()) - .build()); - } - } - - private boolean indexExists() throws SQLException { - try (Connection connection = getDatabase().getDataSource().getConnection()) { - return DatabaseUtils.indexExistsIgnoreCase(TABLE_NAME, INDEX_NAME, connection); - } - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/projectmeasures/AddMetricUuidColumnToProjectMeasures.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/projectmeasures/AddMetricUuidColumnToProjectMeasures.java deleted file mode 100644 index c871abfe5a7..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/projectmeasures/AddMetricUuidColumnToProjectMeasures.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.metrics.projectmeasures; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.def.VarcharColumnDef; -import org.sonar.server.platform.db.migration.sql.AddColumnsBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder; - -public class AddMetricUuidColumnToProjectMeasures extends DdlChange { - private static final String TABLE = "project_measures"; - - private static final VarcharColumnDef uuidColumnDefinition = newVarcharColumnDefBuilder() - .setColumnName("metric_uuid") - .setIsNullable(true) - .setDefaultValue(null) - .setLimit(VarcharColumnDef.UUID_SIZE) - .build(); - - public AddMetricUuidColumnToProjectMeasures(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new AddColumnsBuilder(getDialect(), TABLE) - .addColumn(uuidColumnDefinition) - .build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/projectmeasures/DeleteSecurityReviewRatingProjectMeasures.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/projectmeasures/DeleteSecurityReviewRatingProjectMeasures.java deleted file mode 100644 index d4fc9f53eee..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/projectmeasures/DeleteSecurityReviewRatingProjectMeasures.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.metrics.projectmeasures; - -import java.sql.SQLException; -import javax.annotation.Nullable; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.step.DataChange; -import org.sonar.server.platform.db.migration.step.MassUpdate; - -public class DeleteSecurityReviewRatingProjectMeasures extends DataChange { - - private static final String SECURITY_REVIEW_RATING_METRIC_KEY = "security_review_rating"; - private static final String SECURITY_REVIEW_RATING_EFFORT_METRIC_KEY = "security_review_rating_effort"; - - public DeleteSecurityReviewRatingProjectMeasures(Database db) { - super(db); - } - - @Override - protected void execute(Context context) throws SQLException { - String reviewRatingUuid = getMetricUuid(context, SECURITY_REVIEW_RATING_METRIC_KEY); - String reviewRatingEffortUuid = getMetricUuid(context, SECURITY_REVIEW_RATING_EFFORT_METRIC_KEY); - if (reviewRatingUuid != null) { - deleteFromProjectMeasures(context, reviewRatingUuid, reviewRatingEffortUuid); - } - } - - @Nullable - private static String getMetricUuid(Context context, String metricName) throws SQLException { - return context.prepareSelect("select uuid from metrics where name = ?") - .setString(1, metricName) - .get(row -> row.getNullableString(1)); - } - - private static void deleteFromProjectMeasures(Context context, String reviewRatingUuid, @Nullable String reviewRatingEffortUuid) throws SQLException { - deleteFromProjectMeasures(context, reviewRatingUuid); - - if (reviewRatingEffortUuid != null) { - deleteFromProjectMeasures(context, reviewRatingEffortUuid); - } - } - - private static void deleteFromProjectMeasures(Context context, @Nullable String metricUuid) throws SQLException { - if (metricUuid == null) { - return; - } - MassUpdate massUpdate = context.prepareMassUpdate(); - massUpdate.select("select uuid from project_measures where metric_uuid = ?") - .setString(1, metricUuid); - massUpdate.update("delete from project_measures where uuid = ?"); - massUpdate.execute((row, update) -> { - update.setString(1, row.getString(1)); - return true; - }); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/projectmeasures/DropIndexOnMetricIdOfProjectMeasuresTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/projectmeasures/DropIndexOnMetricIdOfProjectMeasuresTable.java deleted file mode 100644 index 99557ca0faf..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/projectmeasures/DropIndexOnMetricIdOfProjectMeasuresTable.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.metrics.projectmeasures; - -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.step.DropIndexChange; - -public class DropIndexOnMetricIdOfProjectMeasuresTable extends DropIndexChange { - private static final String TABLE_NAME = "project_measures"; - private static final String INDEX_NAME = "measures_analysis_metric"; - - public DropIndexOnMetricIdOfProjectMeasuresTable(Database db) { - super(db, INDEX_NAME, TABLE_NAME); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/projectmeasures/DropMetricIdColumnOfProjectMeasuresTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/projectmeasures/DropMetricIdColumnOfProjectMeasuresTable.java deleted file mode 100644 index b8ee0a59012..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/projectmeasures/DropMetricIdColumnOfProjectMeasuresTable.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.metrics.projectmeasures; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.DropColumnsBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class DropMetricIdColumnOfProjectMeasuresTable extends DdlChange { - public DropMetricIdColumnOfProjectMeasuresTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new DropColumnsBuilder(getDialect(), "project_measures", "metric_id").build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/projectmeasures/MakeProjectMeasuresMetricUuidNotNullable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/projectmeasures/MakeProjectMeasuresMetricUuidNotNullable.java deleted file mode 100644 index f3a06e9ee15..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/projectmeasures/MakeProjectMeasuresMetricUuidNotNullable.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.metrics.projectmeasures; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.def.VarcharColumnDef; -import org.sonar.server.platform.db.migration.sql.AlterColumnsBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder; - -public class MakeProjectMeasuresMetricUuidNotNullable extends DdlChange { - private static final String TABLE = "project_measures"; - - private static final VarcharColumnDef uuidColumnDefinition = newVarcharColumnDefBuilder() - .setColumnName("metric_uuid") - .setIsNullable(false) - .setDefaultValue(null) - .setLimit(VarcharColumnDef.UUID_SIZE) - .build(); - - public MakeProjectMeasuresMetricUuidNotNullable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new AlterColumnsBuilder(getDialect(), TABLE) - .updateColumn(uuidColumnDefinition) - .build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/projectmeasures/PopulateProjectMeasuresMetricUuid.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/projectmeasures/PopulateProjectMeasuresMetricUuid.java deleted file mode 100644 index 2b3054a70de..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/projectmeasures/PopulateProjectMeasuresMetricUuid.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.metrics.projectmeasures; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.step.DataChange; -import org.sonar.server.platform.db.migration.step.MassUpdate; - -public class PopulateProjectMeasuresMetricUuid extends DataChange { - - public PopulateProjectMeasuresMetricUuid(Database db) { - super(db); - } - - @Override - protected void execute(Context context) throws SQLException { - MassUpdate massUpdate = context.prepareMassUpdate(); - massUpdate.select("select pm.uuid, m.uuid " + - "from project_measures pm " + - "join metrics m on pm.metric_id = m.id"); - - massUpdate.update("update project_measures set metric_uuid = ? where uuid = ?"); - - massUpdate.execute((row, update) -> { - update.setString(1, row.getString(2)); - update.setString(2, row.getString(1)); - return true; - }); - - massUpdate = context.prepareMassUpdate(); - - massUpdate.select("select uuid from project_measures where metric_uuid is null"); - massUpdate.update("delete from project_measures where uuid = ?"); - - massUpdate.execute((row, update) -> { - update.setString(1, row.getString(1)); - return true; - }); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/projectmeasures/package-info.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/projectmeasures/package-info.java deleted file mode 100644 index ddc25964396..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/projectmeasures/package-info.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.metrics.projectmeasures; - -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/qualitygateconditions/AddMetricUuidColumnToQualityGateConditions.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/qualitygateconditions/AddMetricUuidColumnToQualityGateConditions.java deleted file mode 100644 index 6c6ac7a0635..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/qualitygateconditions/AddMetricUuidColumnToQualityGateConditions.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.metrics.qualitygateconditions; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.def.VarcharColumnDef; -import org.sonar.server.platform.db.migration.sql.AddColumnsBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder; - -public class AddMetricUuidColumnToQualityGateConditions extends DdlChange { - private static final String TABLE = "quality_gate_conditions"; - - private static final VarcharColumnDef uuidColumnDefinition = newVarcharColumnDefBuilder() - .setColumnName("metric_uuid") - .setIsNullable(true) - .setDefaultValue(null) - .setLimit(VarcharColumnDef.UUID_SIZE) - .build(); - - public AddMetricUuidColumnToQualityGateConditions(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new AddColumnsBuilder(getDialect(), TABLE) - .addColumn(uuidColumnDefinition) - .build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/qualitygateconditions/DropMetricIdColumnOfQualityGateConditionsTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/qualitygateconditions/DropMetricIdColumnOfQualityGateConditionsTable.java deleted file mode 100644 index 48f952d388d..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/qualitygateconditions/DropMetricIdColumnOfQualityGateConditionsTable.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.metrics.qualitygateconditions; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.DropColumnsBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class DropMetricIdColumnOfQualityGateConditionsTable extends DdlChange { - public DropMetricIdColumnOfQualityGateConditionsTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new DropColumnsBuilder(getDialect(), "quality_gate_conditions", "metric_id").build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/qualitygateconditions/MakeQualityGateConditionsMetricUuidNotNullable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/qualitygateconditions/MakeQualityGateConditionsMetricUuidNotNullable.java deleted file mode 100644 index b3c7e8b5aa3..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/qualitygateconditions/MakeQualityGateConditionsMetricUuidNotNullable.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.metrics.qualitygateconditions; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.def.VarcharColumnDef; -import org.sonar.server.platform.db.migration.sql.AlterColumnsBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder; - -public class MakeQualityGateConditionsMetricUuidNotNullable extends DdlChange { - private static final String TABLE = "quality_gate_conditions"; - - private static final VarcharColumnDef uuidColumnDefinition = newVarcharColumnDefBuilder() - .setColumnName("metric_uuid") - .setIsNullable(false) - .setDefaultValue(null) - .setLimit(VarcharColumnDef.UUID_SIZE) - .build(); - - public MakeQualityGateConditionsMetricUuidNotNullable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new AlterColumnsBuilder(getDialect(), TABLE) - .updateColumn(uuidColumnDefinition) - .build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/qualitygateconditions/PopulateQualityGateConditionsMetricUuid.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/qualitygateconditions/PopulateQualityGateConditionsMetricUuid.java deleted file mode 100644 index d0e139c8ffb..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/qualitygateconditions/PopulateQualityGateConditionsMetricUuid.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.metrics.qualitygateconditions; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.step.DataChange; -import org.sonar.server.platform.db.migration.step.MassUpdate; - -public class PopulateQualityGateConditionsMetricUuid extends DataChange { - - public PopulateQualityGateConditionsMetricUuid(Database db) { - super(db); - } - - @Override - protected void execute(Context context) throws SQLException { - MassUpdate massUpdate = context.prepareMassUpdate(); - - massUpdate.select("select qgc.uuid, m.uuid " + - "from quality_gate_conditions qgc " + - "join metrics m on qgc.metric_id = m.id"); - - massUpdate.update("update quality_gate_conditions set metric_uuid = ? where uuid = ?"); - - massUpdate.execute((row, update) -> { - update.setString(1, row.getString(2)); - update.setString(2, row.getString(1)); - return true; - }); - - massUpdate = context.prepareMassUpdate(); - - massUpdate.select("select uuid from quality_gate_conditions where metric_uuid is null"); - massUpdate.update("delete from quality_gate_conditions where uuid = ?"); - - massUpdate.execute((row, update) -> { - update.setString(1, row.getString(1)); - return true; - }); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/qualitygateconditions/package-info.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/qualitygateconditions/package-info.java deleted file mode 100644 index 282da5d425f..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/metrics/qualitygateconditions/package-info.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.metrics.qualitygateconditions; - -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/notifications/AddPrimaryKeyOnUuidColumnOfNotificationTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/notifications/AddPrimaryKeyOnUuidColumnOfNotificationTable.java deleted file mode 100644 index ba70fe2ab16..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/notifications/AddPrimaryKeyOnUuidColumnOfNotificationTable.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.notifications; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.AddPrimaryKeyBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class AddPrimaryKeyOnUuidColumnOfNotificationTable extends DdlChange { - - public AddPrimaryKeyOnUuidColumnOfNotificationTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new AddPrimaryKeyBuilder("notifications", "uuid").build()); - } - -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/notifications/AddUuidAndCreatedAtColumnsToNotification.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/notifications/AddUuidAndCreatedAtColumnsToNotification.java deleted file mode 100644 index 9429663f697..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/notifications/AddUuidAndCreatedAtColumnsToNotification.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.notifications; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.def.BigIntegerColumnDef; -import org.sonar.server.platform.db.migration.def.VarcharColumnDef; -import org.sonar.server.platform.db.migration.sql.AddColumnsBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.sonar.server.platform.db.migration.def.BigIntegerColumnDef.newBigIntegerColumnDefBuilder; -import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder; - -public class AddUuidAndCreatedAtColumnsToNotification extends DdlChange { - private static final String TABLE = "notifications"; - - private static final VarcharColumnDef uuidColumnDefinition = newVarcharColumnDefBuilder() - .setColumnName("uuid") - .setIsNullable(true) - .setDefaultValue(null) - .setLimit(VarcharColumnDef.UUID_SIZE) - .build(); - - private static final BigIntegerColumnDef createdAtColumnDefinition = newBigIntegerColumnDefBuilder() - .setColumnName("created_at") - .setIsNullable(true) - .build(); - - public AddUuidAndCreatedAtColumnsToNotification(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new AddColumnsBuilder(getDialect(), TABLE) - .addColumn(uuidColumnDefinition) - .addColumn(createdAtColumnDefinition) - .build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/notifications/DropIdColumnOfNotificationTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/notifications/DropIdColumnOfNotificationTable.java deleted file mode 100644 index ac1313af502..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/notifications/DropIdColumnOfNotificationTable.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.notifications; - -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.version.v84.common.DropIdColumn; - -public class DropIdColumnOfNotificationTable extends DropIdColumn { - private static final String TABLE = "notifications"; - - public DropIdColumnOfNotificationTable(Database db) { - super(db, TABLE); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/notifications/DropPrimaryKeyOnIdColumnOfNotificationTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/notifications/DropPrimaryKeyOnIdColumnOfNotificationTable.java deleted file mode 100644 index 3b10433260a..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/notifications/DropPrimaryKeyOnIdColumnOfNotificationTable.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.notifications; - -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.DropPrimaryKeySqlGenerator; -import org.sonar.server.platform.db.migration.version.v84.common.DropPrimaryKeyOnIdColumn; - -public class DropPrimaryKeyOnIdColumnOfNotificationTable extends DropPrimaryKeyOnIdColumn { - private static final String TABLE_NAME = "notifications"; - - public DropPrimaryKeyOnIdColumnOfNotificationTable(Database db, DropPrimaryKeySqlGenerator dropPrimaryKeySqlGenerator) { - super(db, dropPrimaryKeySqlGenerator, TABLE_NAME); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/notifications/MakeNotificationUuidAndCreatedAtColumnsNotNullable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/notifications/MakeNotificationUuidAndCreatedAtColumnsNotNullable.java deleted file mode 100644 index 3b62fd589ad..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/notifications/MakeNotificationUuidAndCreatedAtColumnsNotNullable.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.notifications; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.def.BigIntegerColumnDef; -import org.sonar.server.platform.db.migration.def.VarcharColumnDef; -import org.sonar.server.platform.db.migration.sql.AlterColumnsBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.sonar.server.platform.db.migration.def.BigIntegerColumnDef.newBigIntegerColumnDefBuilder; -import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder; - -public class MakeNotificationUuidAndCreatedAtColumnsNotNullable extends DdlChange { - private static final String TABLE = "notifications"; - - private static final VarcharColumnDef uuidColumnDefinition = newVarcharColumnDefBuilder() - .setColumnName("uuid") - .setIsNullable(false) - .setDefaultValue(null) - .setLimit(VarcharColumnDef.UUID_SIZE) - .build(); - - private static final BigIntegerColumnDef createdAtColumnDefinition = newBigIntegerColumnDefBuilder() - .setColumnName("created_at") - .setIsNullable(false) - .build(); - - - public MakeNotificationUuidAndCreatedAtColumnsNotNullable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new AlterColumnsBuilder(getDialect(), TABLE) - .updateColumn(uuidColumnDefinition) - .updateColumn(createdAtColumnDefinition) - .build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/notifications/PopulateNotificationUuidAndCreatedAt.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/notifications/PopulateNotificationUuidAndCreatedAt.java deleted file mode 100644 index 2185cb52ec0..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/notifications/PopulateNotificationUuidAndCreatedAt.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.notifications; - -import java.sql.SQLException; -import java.util.concurrent.atomic.AtomicLong; -import org.sonar.api.utils.System2; -import org.sonar.core.util.UuidFactory; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.step.DataChange; -import org.sonar.server.platform.db.migration.step.MassUpdate; - -public class PopulateNotificationUuidAndCreatedAt extends DataChange { - - private final UuidFactory uuidFactory; - private final System2 system2; - - public PopulateNotificationUuidAndCreatedAt(Database db, UuidFactory uuidFactory, System2 system2) { - super(db); - this.uuidFactory = uuidFactory; - this.system2 = system2; - } - - @Override - protected void execute(Context context) throws SQLException { - MassUpdate massUpdate = context.prepareMassUpdate(); - - massUpdate.select("select id from notifications where uuid is null"); - massUpdate.update("update notifications set uuid = ?, created_at = ? where id = ?"); - - // now - 7 days, to have previous notification in the past - long lastWeek = system2.now() - (1000 * 60 * 60 * 24 * 7); - - AtomicLong cpt = new AtomicLong(0); - massUpdate.execute((row, update) -> { - update.setString(1, uuidFactory.create()); - update.setLong(2, lastWeek + cpt.longValue()); - update.setLong(3, row.getLong(1)); - cpt.addAndGet(1); - return true; - }); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/notifications/package-info.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/notifications/package-info.java deleted file mode 100644 index a54123618e7..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/notifications/package-info.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.notifications; - -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/package-info.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/package-info.java deleted file mode 100644 index 06b4efd9079..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/package-info.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84; - -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/AddPrimaryKeyOnUuidColumnOfPermissionTemplatesTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/AddPrimaryKeyOnUuidColumnOfPermissionTemplatesTable.java deleted file mode 100644 index 59c57ae5568..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/AddPrimaryKeyOnUuidColumnOfPermissionTemplatesTable.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.permissiontemplates; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.AddPrimaryKeyBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class AddPrimaryKeyOnUuidColumnOfPermissionTemplatesTable extends DdlChange { - - public AddPrimaryKeyOnUuidColumnOfPermissionTemplatesTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new AddPrimaryKeyBuilder("permission_templates", "uuid").build()); - } - -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/AddUuidColumnToPermissionTemplates.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/AddUuidColumnToPermissionTemplates.java deleted file mode 100644 index 21914ee8bbc..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/AddUuidColumnToPermissionTemplates.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.permissiontemplates; - -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.version.v84.common.AddUuidColumnToTable; - -public class AddUuidColumnToPermissionTemplates extends AddUuidColumnToTable { - private static final String TABLE_NAME = "permission_templates"; - - public AddUuidColumnToPermissionTemplates(Database db) { - super(db, TABLE_NAME); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/DropIdColumnOfPermissionTemplatesTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/DropIdColumnOfPermissionTemplatesTable.java deleted file mode 100644 index fd9eab90c95..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/DropIdColumnOfPermissionTemplatesTable.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.permissiontemplates; - -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.version.v84.common.DropIdColumn; - -public class DropIdColumnOfPermissionTemplatesTable extends DropIdColumn { - private static final String TABLE_NAME = "permission_templates"; - - public DropIdColumnOfPermissionTemplatesTable(Database db) { - super(db, TABLE_NAME); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/DropKeeColumnOfPermissionTemplatesTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/DropKeeColumnOfPermissionTemplatesTable.java deleted file mode 100644 index caeaf79233b..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/DropKeeColumnOfPermissionTemplatesTable.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.permissiontemplates; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.DropColumnsBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class DropKeeColumnOfPermissionTemplatesTable extends DdlChange { - - public DropKeeColumnOfPermissionTemplatesTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new DropColumnsBuilder(getDialect(), "permission_templates", "kee").build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/DropPrimaryKeyOnIdColumnOfPermissionTemplatesTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/DropPrimaryKeyOnIdColumnOfPermissionTemplatesTable.java deleted file mode 100644 index 7f8987ee03c..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/DropPrimaryKeyOnIdColumnOfPermissionTemplatesTable.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.permissiontemplates; - -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.DropPrimaryKeySqlGenerator; -import org.sonar.server.platform.db.migration.version.v84.common.DropPrimaryKeyOnIdColumn; - -public class DropPrimaryKeyOnIdColumnOfPermissionTemplatesTable extends DropPrimaryKeyOnIdColumn { - private static final String TABLE_NAME = "permission_templates"; - - public DropPrimaryKeyOnIdColumnOfPermissionTemplatesTable(Database db, DropPrimaryKeySqlGenerator dropPrimaryKeySqlGenerator) { - super(db, dropPrimaryKeySqlGenerator, TABLE_NAME); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/MakePermissionTemplateUuidColumnNotNullable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/MakePermissionTemplateUuidColumnNotNullable.java deleted file mode 100644 index 0c7968c8e38..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/MakePermissionTemplateUuidColumnNotNullable.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.permissiontemplates; - -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.version.v84.common.MakeUuidColumnNotNullable; - -public class MakePermissionTemplateUuidColumnNotNullable extends MakeUuidColumnNotNullable { - private static final String TABLE_NAME = "permission_templates"; - - public MakePermissionTemplateUuidColumnNotNullable(Database db) { - super(db, TABLE_NAME); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/PopulatePermissionTemplatesUuid.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/PopulatePermissionTemplatesUuid.java deleted file mode 100644 index f8e38043148..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/PopulatePermissionTemplatesUuid.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.permissiontemplates; - -import java.sql.SQLException; -import org.sonar.core.util.UuidFactory; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.step.DataChange; -import org.sonar.server.platform.db.migration.step.MassUpdate; - -public class PopulatePermissionTemplatesUuid extends DataChange { - - private UuidFactory uuidFactory; - - public PopulatePermissionTemplatesUuid(Database db, UuidFactory uuidFactory) { - super(db); - this.uuidFactory = uuidFactory; - } - - @Override - protected void execute(Context context) throws SQLException { - MassUpdate massUpdate = context.prepareMassUpdate(); - - massUpdate.select("select kee from permission_templates where uuid is null"); - massUpdate.update("update permission_templates set uuid = ? where kee = ?"); - - massUpdate.execute((row, update) -> { - String kee = row.getString(1); - String uuid = kee; - - //kee column was declared with 100 char length, so we regenerate if it happened - if (kee.length() > 40) { - uuid = uuidFactory.create(); - } - - update.setString(1, uuid); - update.setString(2, kee); - return true; - }); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/package-info.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/package-info.java deleted file mode 100644 index 39206bbdcd9..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/package-info.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.permissiontemplates.fk; - -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtemplatesgroups/AddTemplateUuidColumnToPermTemplatesGroups.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtemplatesgroups/AddTemplateUuidColumnToPermTemplatesGroups.java deleted file mode 100644 index 67f87fbf4a5..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtemplatesgroups/AddTemplateUuidColumnToPermTemplatesGroups.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.permissiontemplates.fk.permtemplatesgroups; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.def.VarcharColumnDef; -import org.sonar.server.platform.db.migration.sql.AddColumnsBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder; - -public class AddTemplateUuidColumnToPermTemplatesGroups extends DdlChange { - private static final String TABLE = "perm_templates_groups"; - - private static final VarcharColumnDef uuidColumnDefinition = newVarcharColumnDefBuilder() - .setColumnName("template_uuid") - .setIsNullable(true) - .setDefaultValue(null) - .setLimit(VarcharColumnDef.UUID_SIZE) - .build(); - - public AddTemplateUuidColumnToPermTemplatesGroups(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new AddColumnsBuilder(getDialect(), TABLE) - .addColumn(uuidColumnDefinition) - .build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtemplatesgroups/DropTemplateIdColumnOfPermTemplatesGroupsTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtemplatesgroups/DropTemplateIdColumnOfPermTemplatesGroupsTable.java deleted file mode 100644 index 1e41ee71096..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtemplatesgroups/DropTemplateIdColumnOfPermTemplatesGroupsTable.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.permissiontemplates.fk.permtemplatesgroups; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.DropColumnsBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class DropTemplateIdColumnOfPermTemplatesGroupsTable extends DdlChange { - - public DropTemplateIdColumnOfPermTemplatesGroupsTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new DropColumnsBuilder(getDialect(), "perm_templates_groups", "template_id").build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtemplatesgroups/MakePermTemplatesGroupsTemplateUuidColumnNotNullable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtemplatesgroups/MakePermTemplatesGroupsTemplateUuidColumnNotNullable.java deleted file mode 100644 index 03cd8c28bd1..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtemplatesgroups/MakePermTemplatesGroupsTemplateUuidColumnNotNullable.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.permissiontemplates.fk.permtemplatesgroups; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.def.VarcharColumnDef; -import org.sonar.server.platform.db.migration.sql.AlterColumnsBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder; - -public class MakePermTemplatesGroupsTemplateUuidColumnNotNullable extends DdlChange { - private static final String TABLE = "perm_templates_groups"; - - private static final VarcharColumnDef uuidColumnDefinition = newVarcharColumnDefBuilder() - .setColumnName("template_uuid") - .setIsNullable(false) - .setDefaultValue(null) - .setLimit(VarcharColumnDef.UUID_SIZE) - .build(); - - public MakePermTemplatesGroupsTemplateUuidColumnNotNullable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new AlterColumnsBuilder(getDialect(), TABLE) - .updateColumn(uuidColumnDefinition) - .build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtemplatesgroups/PopulatePermTemplatesGroupsTemplateUuidColumn.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtemplatesgroups/PopulatePermTemplatesGroupsTemplateUuidColumn.java deleted file mode 100644 index 7b38a355be7..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtemplatesgroups/PopulatePermTemplatesGroupsTemplateUuidColumn.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.permissiontemplates.fk.permtemplatesgroups; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.step.DataChange; -import org.sonar.server.platform.db.migration.step.MassUpdate; - -public class PopulatePermTemplatesGroupsTemplateUuidColumn extends DataChange { - - public PopulatePermTemplatesGroupsTemplateUuidColumn(Database db) { - super(db); - } - - @Override - protected void execute(Context context) throws SQLException { - MassUpdate massUpdate = context.prepareMassUpdate(); - - massUpdate.select("select ptg.uuid, pt.uuid " + - "from perm_templates_groups ptg " + - "join permission_templates pt on ptg.template_id = pt.id " + - "where ptg.template_uuid is null"); - massUpdate.update("update perm_templates_groups set template_uuid = ? where uuid = ?"); - - massUpdate.execute((row, update) -> { - update.setString(1, row.getString(2)); - update.setString(2, row.getString(1)); - return true; - }); - - massUpdate = context.prepareMassUpdate(); - - massUpdate.select("select uuid from perm_templates_groups where template_uuid is null"); - massUpdate.update("delete from perm_templates_groups where uuid = ?"); - - massUpdate.execute((row, update) -> { - update.setString(1, row.getString(1)); - return true; - }); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtemplatesgroups/package-info.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtemplatesgroups/package-info.java deleted file mode 100644 index 4c5732b638d..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtemplatesgroups/package-info.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.permissiontemplates.fk.permtemplatesgroups; - -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtemplatesusers/AddTemplateUuidColumnToPermTemplatesUsers.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtemplatesusers/AddTemplateUuidColumnToPermTemplatesUsers.java deleted file mode 100644 index c384639573b..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtemplatesusers/AddTemplateUuidColumnToPermTemplatesUsers.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.permissiontemplates.fk.permtemplatesusers; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.def.VarcharColumnDef; -import org.sonar.server.platform.db.migration.sql.AddColumnsBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder; - -public class AddTemplateUuidColumnToPermTemplatesUsers extends DdlChange { - private static final String TABLE = "perm_templates_users"; - - private static final VarcharColumnDef uuidColumnDefinition = newVarcharColumnDefBuilder() - .setColumnName("template_uuid") - .setIsNullable(true) - .setDefaultValue(null) - .setLimit(VarcharColumnDef.UUID_SIZE) - .build(); - - public AddTemplateUuidColumnToPermTemplatesUsers(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new AddColumnsBuilder(getDialect(), TABLE) - .addColumn(uuidColumnDefinition) - .build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtemplatesusers/DropTemplateIdColumnOfPermTemplatesUsersTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtemplatesusers/DropTemplateIdColumnOfPermTemplatesUsersTable.java deleted file mode 100644 index 7d5be67bff0..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtemplatesusers/DropTemplateIdColumnOfPermTemplatesUsersTable.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.permissiontemplates.fk.permtemplatesusers; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.DropColumnsBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class DropTemplateIdColumnOfPermTemplatesUsersTable extends DdlChange { - - public DropTemplateIdColumnOfPermTemplatesUsersTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new DropColumnsBuilder(getDialect(), "perm_templates_users", "template_id").build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtemplatesusers/MakePermTemplatesUsersTemplateUuidColumnNotNullable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtemplatesusers/MakePermTemplatesUsersTemplateUuidColumnNotNullable.java deleted file mode 100644 index a750dc4cce3..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtemplatesusers/MakePermTemplatesUsersTemplateUuidColumnNotNullable.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.permissiontemplates.fk.permtemplatesusers; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.def.VarcharColumnDef; -import org.sonar.server.platform.db.migration.sql.AlterColumnsBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder; - -public class MakePermTemplatesUsersTemplateUuidColumnNotNullable extends DdlChange { - private static final String TABLE = "perm_templates_users"; - - private static final VarcharColumnDef uuidColumnDefinition = newVarcharColumnDefBuilder() - .setColumnName("template_uuid") - .setIsNullable(false) - .setDefaultValue(null) - .setLimit(VarcharColumnDef.UUID_SIZE) - .build(); - - public MakePermTemplatesUsersTemplateUuidColumnNotNullable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new AlterColumnsBuilder(getDialect(), TABLE) - .updateColumn(uuidColumnDefinition) - .build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtemplatesusers/PopulatePermTemplatesUsersTemplateUuidColumn.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtemplatesusers/PopulatePermTemplatesUsersTemplateUuidColumn.java deleted file mode 100644 index 7440faeb745..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtemplatesusers/PopulatePermTemplatesUsersTemplateUuidColumn.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.permissiontemplates.fk.permtemplatesusers; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.step.DataChange; -import org.sonar.server.platform.db.migration.step.MassUpdate; - -public class PopulatePermTemplatesUsersTemplateUuidColumn extends DataChange { - - public PopulatePermTemplatesUsersTemplateUuidColumn(Database db) { - super(db); - } - - @Override - protected void execute(Context context) throws SQLException { - MassUpdate massUpdate = context.prepareMassUpdate(); - - massUpdate.select("select ptu.uuid, pt.uuid " + - "from perm_templates_users ptu " + - "join permission_templates pt on ptu.template_id = pt.id " + - "where ptu.template_uuid is null"); - massUpdate.update("update perm_templates_users set template_uuid = ? where uuid = ?"); - - massUpdate.execute((row, update) -> { - update.setString(1, row.getString(2)); - update.setString(2, row.getString(1)); - return true; - }); - - massUpdate = context.prepareMassUpdate(); - - massUpdate.select("select uuid from perm_templates_users where template_uuid is null"); - massUpdate.update("delete from perm_templates_users where uuid = ?"); - - massUpdate.execute((row, update) -> { - update.setString(1, row.getString(1)); - return true; - }); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtemplatesusers/package-info.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtemplatesusers/package-info.java deleted file mode 100644 index 6dd2cd3ff8c..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtemplatesusers/package-info.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.permissiontemplates.fk.permtemplatesusers; - -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtplcharacteristics/AddTemplateUuidColumnToPermTplCharacteristics.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtplcharacteristics/AddTemplateUuidColumnToPermTplCharacteristics.java deleted file mode 100644 index 0acc3af3554..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtplcharacteristics/AddTemplateUuidColumnToPermTplCharacteristics.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.permissiontemplates.fk.permtplcharacteristics; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.def.VarcharColumnDef; -import org.sonar.server.platform.db.migration.sql.AddColumnsBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder; - -public class AddTemplateUuidColumnToPermTplCharacteristics extends DdlChange { - private static final String TABLE = "perm_tpl_characteristics"; - - private static final VarcharColumnDef uuidColumnDefinition = newVarcharColumnDefBuilder() - .setColumnName("template_uuid") - .setIsNullable(true) - .setDefaultValue(null) - .setLimit(VarcharColumnDef.UUID_SIZE) - .build(); - - public AddTemplateUuidColumnToPermTplCharacteristics(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new AddColumnsBuilder(getDialect(), TABLE) - .addColumn(uuidColumnDefinition) - .build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtplcharacteristics/AddUniqueIndexOnTemplateUuidAndPermissionKeyColumnsOfPermTplCharacteristicsTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtplcharacteristics/AddUniqueIndexOnTemplateUuidAndPermissionKeyColumnsOfPermTplCharacteristicsTable.java deleted file mode 100644 index 61349a10e4f..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtplcharacteristics/AddUniqueIndexOnTemplateUuidAndPermissionKeyColumnsOfPermTplCharacteristicsTable.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.permissiontemplates.fk.permtplcharacteristics; - -import java.sql.Connection; -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.db.DatabaseUtils; -import org.sonar.server.platform.db.migration.def.VarcharColumnDef; -import org.sonar.server.platform.db.migration.sql.CreateIndexBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder; - -public class AddUniqueIndexOnTemplateUuidAndPermissionKeyColumnsOfPermTplCharacteristicsTable extends DdlChange { - private static final String TABLE_NAME = "perm_tpl_characteristics"; - private static final String INDEX_NAME = "uniq_perm_tpl_charac"; - - public AddUniqueIndexOnTemplateUuidAndPermissionKeyColumnsOfPermTplCharacteristicsTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - if (!indexExists()) { - context.execute(new CreateIndexBuilder() - .setUnique(true) - .setTable(TABLE_NAME) - .setName(INDEX_NAME) - .addColumn(newVarcharColumnDefBuilder() - .setColumnName("template_uuid") - .setIsNullable(false) - .setLimit(VarcharColumnDef.UUID_SIZE) - .build()) - .addColumn(newVarcharColumnDefBuilder() - .setColumnName("permission_key") - .setIsNullable(false) - .setLimit(64) - .build()) - .build()); - } - - } - - private boolean indexExists() throws SQLException { - try (Connection connection = getDatabase().getDataSource().getConnection()) { - return DatabaseUtils.indexExistsIgnoreCase(TABLE_NAME, INDEX_NAME, connection); - } - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtplcharacteristics/DropTemplateIdColumnOfPermTplCharacteristicsTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtplcharacteristics/DropTemplateIdColumnOfPermTplCharacteristicsTable.java deleted file mode 100644 index cfee96347d1..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtplcharacteristics/DropTemplateIdColumnOfPermTplCharacteristicsTable.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.permissiontemplates.fk.permtplcharacteristics; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.DropColumnsBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class DropTemplateIdColumnOfPermTplCharacteristicsTable extends DdlChange { - - public DropTemplateIdColumnOfPermTplCharacteristicsTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new DropColumnsBuilder(getDialect(), "perm_tpl_characteristics", "template_id").build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtplcharacteristics/DropUniqueIndexOnTemplateIdAndPermissionKeyColumnsOfPermTplCharacteristicsTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtplcharacteristics/DropUniqueIndexOnTemplateIdAndPermissionKeyColumnsOfPermTplCharacteristicsTable.java deleted file mode 100644 index 7b8702d8c07..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtplcharacteristics/DropUniqueIndexOnTemplateIdAndPermissionKeyColumnsOfPermTplCharacteristicsTable.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.permissiontemplates.fk.permtplcharacteristics; - -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.step.DropIndexChange; - -public class DropUniqueIndexOnTemplateIdAndPermissionKeyColumnsOfPermTplCharacteristicsTable extends DropIndexChange { - private static final String TABLE_NAME = "perm_tpl_characteristics"; - private static final String INDEX_NAME = "uniq_perm_tpl_charac"; - - public DropUniqueIndexOnTemplateIdAndPermissionKeyColumnsOfPermTplCharacteristicsTable(Database db) { - super(db, INDEX_NAME, TABLE_NAME); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtplcharacteristics/MakePermTplCharacteristicsTemplateUuidColumnNotNullable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtplcharacteristics/MakePermTplCharacteristicsTemplateUuidColumnNotNullable.java deleted file mode 100644 index 5d816a11090..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtplcharacteristics/MakePermTplCharacteristicsTemplateUuidColumnNotNullable.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.permissiontemplates.fk.permtplcharacteristics; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.def.VarcharColumnDef; -import org.sonar.server.platform.db.migration.sql.AlterColumnsBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder; - -public class MakePermTplCharacteristicsTemplateUuidColumnNotNullable extends DdlChange { - private static final String TABLE = "perm_tpl_characteristics"; - - private static final VarcharColumnDef uuidColumnDefinition = newVarcharColumnDefBuilder() - .setColumnName("template_uuid") - .setIsNullable(false) - .setDefaultValue(null) - .setLimit(VarcharColumnDef.UUID_SIZE) - .build(); - - public MakePermTplCharacteristicsTemplateUuidColumnNotNullable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new AlterColumnsBuilder(getDialect(), TABLE) - .updateColumn(uuidColumnDefinition) - .build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtplcharacteristics/PopulatePermTplCharacteristicsTemplateUuidColumn.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtplcharacteristics/PopulatePermTplCharacteristicsTemplateUuidColumn.java deleted file mode 100644 index 3403a82e507..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtplcharacteristics/PopulatePermTplCharacteristicsTemplateUuidColumn.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.permissiontemplates.fk.permtplcharacteristics; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.step.DataChange; -import org.sonar.server.platform.db.migration.step.MassUpdate; - -public class PopulatePermTplCharacteristicsTemplateUuidColumn extends DataChange { - - public PopulatePermTplCharacteristicsTemplateUuidColumn(Database db) { - super(db); - } - - @Override - protected void execute(Context context) throws SQLException { - MassUpdate massUpdate = context.prepareMassUpdate(); - - massUpdate.select("select ptc.uuid, pt.uuid " + - "from perm_tpl_characteristics ptc " + - "join permission_templates pt on ptc.template_id = pt.id " + - "where ptc.template_uuid is null"); - massUpdate.update("update perm_tpl_characteristics set template_uuid = ? where uuid = ?"); - - massUpdate.execute((row, update) -> { - update.setString(1, row.getString(2)); - update.setString(2, row.getString(1)); - return true; - }); - - massUpdate = context.prepareMassUpdate(); - - massUpdate.select("select uuid from perm_tpl_characteristics where template_uuid is null"); - massUpdate.update("delete from perm_tpl_characteristics where uuid = ?"); - - massUpdate.execute((row, update) -> { - update.setString(1, row.getString(1)); - return true; - }); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtplcharacteristics/package-info.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtplcharacteristics/package-info.java deleted file mode 100644 index 23e0dbb9550..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtplcharacteristics/package-info.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.permissiontemplates.fk.permtplcharacteristics; - -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/package-info.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/package-info.java deleted file mode 100644 index 4fb25fe0605..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/package-info.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.permissiontemplates; - -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permtemplatesgroups/AddPrimaryKeyOnUuidColumnOfPermTemplatesGroupsTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permtemplatesgroups/AddPrimaryKeyOnUuidColumnOfPermTemplatesGroupsTable.java deleted file mode 100644 index a55ce12aa74..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permtemplatesgroups/AddPrimaryKeyOnUuidColumnOfPermTemplatesGroupsTable.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.permtemplatesgroups; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.AddPrimaryKeyBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class AddPrimaryKeyOnUuidColumnOfPermTemplatesGroupsTable extends DdlChange { - - public AddPrimaryKeyOnUuidColumnOfPermTemplatesGroupsTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new AddPrimaryKeyBuilder("perm_templates_groups", "uuid").build()); - } - -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permtemplatesgroups/AddUuidColumnToPermTemplatesGroupsTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permtemplatesgroups/AddUuidColumnToPermTemplatesGroupsTable.java deleted file mode 100644 index 0923b2e484c..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permtemplatesgroups/AddUuidColumnToPermTemplatesGroupsTable.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.permtemplatesgroups; - -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.version.v84.common.AddUuidColumnToTable; - -public class AddUuidColumnToPermTemplatesGroupsTable extends AddUuidColumnToTable { - private static final String TABLE = "perm_templates_groups"; - - public AddUuidColumnToPermTemplatesGroupsTable(Database db) { - super(db, TABLE); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permtemplatesgroups/DropIdColumnOfPermTemplatesGroupsTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permtemplatesgroups/DropIdColumnOfPermTemplatesGroupsTable.java deleted file mode 100644 index 0f0b83714b5..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permtemplatesgroups/DropIdColumnOfPermTemplatesGroupsTable.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.permtemplatesgroups; - -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.version.v84.common.DropIdColumn; - -public class DropIdColumnOfPermTemplatesGroupsTable extends DropIdColumn { - private static final String TABLE = "perm_templates_groups"; - - public DropIdColumnOfPermTemplatesGroupsTable(Database db) { - super(db, TABLE); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permtemplatesgroups/DropPrimaryKeyOnIdColumnOfPermTemplatesGroupsTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permtemplatesgroups/DropPrimaryKeyOnIdColumnOfPermTemplatesGroupsTable.java deleted file mode 100644 index 54bc2582d54..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permtemplatesgroups/DropPrimaryKeyOnIdColumnOfPermTemplatesGroupsTable.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.permtemplatesgroups; - -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.DropPrimaryKeySqlGenerator; -import org.sonar.server.platform.db.migration.version.v84.common.DropPrimaryKeyOnIdColumn; - -public class DropPrimaryKeyOnIdColumnOfPermTemplatesGroupsTable extends DropPrimaryKeyOnIdColumn { - private static final String TABLE_NAME = "perm_templates_groups"; - - public DropPrimaryKeyOnIdColumnOfPermTemplatesGroupsTable(Database db, DropPrimaryKeySqlGenerator dropPrimaryKeySqlGenerator) { - super(db, dropPrimaryKeySqlGenerator, TABLE_NAME); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permtemplatesgroups/MakePermTemplatesGroupsUuidColumnNotNullable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permtemplatesgroups/MakePermTemplatesGroupsUuidColumnNotNullable.java deleted file mode 100644 index 79c6c7eee93..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permtemplatesgroups/MakePermTemplatesGroupsUuidColumnNotNullable.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.permtemplatesgroups; - -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.version.v84.common.MakeUuidColumnNotNullable; - -public class MakePermTemplatesGroupsUuidColumnNotNullable extends MakeUuidColumnNotNullable { - private static final String TABLE = "perm_templates_groups"; - - public MakePermTemplatesGroupsUuidColumnNotNullable(Database db) { - super(db, TABLE); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permtemplatesgroups/PopulatePermTemplatesGroupsUuid.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permtemplatesgroups/PopulatePermTemplatesGroupsUuid.java deleted file mode 100644 index 8ecad95df56..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permtemplatesgroups/PopulatePermTemplatesGroupsUuid.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.permtemplatesgroups; - -import java.sql.SQLException; -import org.sonar.core.util.UuidFactory; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.step.DataChange; -import org.sonar.server.platform.db.migration.step.MassUpdate; - -public class PopulatePermTemplatesGroupsUuid extends DataChange { - - private final UuidFactory uuidFactory; - - public PopulatePermTemplatesGroupsUuid(Database db, UuidFactory uuidFactory) { - super(db); - this.uuidFactory = uuidFactory; - } - - @Override - protected void execute(Context context) throws SQLException { - MassUpdate massUpdate = context.prepareMassUpdate(); - - massUpdate.select("select id from perm_templates_groups where uuid is null"); - massUpdate.update("update perm_templates_groups set uuid = ? where id = ?"); - - massUpdate.execute((row, update) -> { - update.setString(1, uuidFactory.create()); - update.setLong(2, row.getLong(1)); - return true; - }); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permtemplatesgroups/package-info.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permtemplatesgroups/package-info.java deleted file mode 100644 index e6cd65843a6..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permtemplatesgroups/package-info.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.permtemplatesgroups; - -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permtemplatesusers/AddPrimaryKeyOnUuidColumnOfPermTemplatesUsersTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permtemplatesusers/AddPrimaryKeyOnUuidColumnOfPermTemplatesUsersTable.java deleted file mode 100644 index b415fac6d6f..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permtemplatesusers/AddPrimaryKeyOnUuidColumnOfPermTemplatesUsersTable.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.permtemplatesusers; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.AddPrimaryKeyBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class AddPrimaryKeyOnUuidColumnOfPermTemplatesUsersTable extends DdlChange { - - public AddPrimaryKeyOnUuidColumnOfPermTemplatesUsersTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new AddPrimaryKeyBuilder("perm_templates_users", "uuid").build()); - } - -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permtemplatesusers/AddUuidColumnToPermTemplatesUsersTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permtemplatesusers/AddUuidColumnToPermTemplatesUsersTable.java deleted file mode 100644 index 25a16d58e7c..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permtemplatesusers/AddUuidColumnToPermTemplatesUsersTable.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.permtemplatesusers; - -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.version.v84.common.AddUuidColumnToTable; - -public class AddUuidColumnToPermTemplatesUsersTable extends AddUuidColumnToTable { - private static final String TABLE = "perm_templates_users"; - - public AddUuidColumnToPermTemplatesUsersTable(Database db) { - super(db, TABLE); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permtemplatesusers/DropIdColumnOfPermTemplatesUsersTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permtemplatesusers/DropIdColumnOfPermTemplatesUsersTable.java deleted file mode 100644 index 934f75dcbaf..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permtemplatesusers/DropIdColumnOfPermTemplatesUsersTable.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.permtemplatesusers; - -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.version.v84.common.DropIdColumn; - -public class DropIdColumnOfPermTemplatesUsersTable extends DropIdColumn { - private static final String TABLE = "perm_templates_users"; - - public DropIdColumnOfPermTemplatesUsersTable(Database db) { - super(db, TABLE); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permtemplatesusers/DropPrimaryKeyOnIdColumnOfPermTemplatesUsersTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permtemplatesusers/DropPrimaryKeyOnIdColumnOfPermTemplatesUsersTable.java deleted file mode 100644 index 91dba020bb8..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permtemplatesusers/DropPrimaryKeyOnIdColumnOfPermTemplatesUsersTable.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.permtemplatesusers; - -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.DropPrimaryKeySqlGenerator; -import org.sonar.server.platform.db.migration.version.v84.common.DropPrimaryKeyOnIdColumn; - -public class DropPrimaryKeyOnIdColumnOfPermTemplatesUsersTable extends DropPrimaryKeyOnIdColumn { - private static final String TABLE_NAME = "perm_templates_users"; - - public DropPrimaryKeyOnIdColumnOfPermTemplatesUsersTable(Database db, DropPrimaryKeySqlGenerator dropPrimaryKeySqlGenerator) { - super(db, dropPrimaryKeySqlGenerator, TABLE_NAME); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permtemplatesusers/MakePermTemplatesUsersUuidColumnNotNullable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permtemplatesusers/MakePermTemplatesUsersUuidColumnNotNullable.java deleted file mode 100644 index b38fb2b229a..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permtemplatesusers/MakePermTemplatesUsersUuidColumnNotNullable.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.permtemplatesusers; - -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.version.v84.common.MakeUuidColumnNotNullable; - -public class MakePermTemplatesUsersUuidColumnNotNullable extends MakeUuidColumnNotNullable { - private static final String TABLE = "perm_templates_users"; - - public MakePermTemplatesUsersUuidColumnNotNullable(Database db) { - super(db, TABLE); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permtemplatesusers/PopulatePermTemplatesUsersUuid.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permtemplatesusers/PopulatePermTemplatesUsersUuid.java deleted file mode 100644 index ed67bc2829e..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permtemplatesusers/PopulatePermTemplatesUsersUuid.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.permtemplatesusers; - -import java.sql.SQLException; -import org.sonar.core.util.UuidFactory; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.step.DataChange; -import org.sonar.server.platform.db.migration.step.MassUpdate; - -public class PopulatePermTemplatesUsersUuid extends DataChange { - - private final UuidFactory uuidFactory; - - public PopulatePermTemplatesUsersUuid(Database db, UuidFactory uuidFactory) { - super(db); - this.uuidFactory = uuidFactory; - } - - @Override - protected void execute(Context context) throws SQLException { - MassUpdate massUpdate = context.prepareMassUpdate(); - - massUpdate.select("select id from perm_templates_users where uuid is null"); - massUpdate.update("update perm_templates_users set uuid = ? where id = ?"); - - massUpdate.execute((row, update) -> { - update.setString(1, uuidFactory.create()); - update.setLong(2, row.getLong(1)); - return true; - }); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permtemplatesusers/package-info.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permtemplatesusers/package-info.java deleted file mode 100644 index fd09d1a820b..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permtemplatesusers/package-info.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.permtemplatesusers; - -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permtplcharacteristics/AddPrimaryKeyOnUuidColumnOfPermTplCharacteristicsTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permtplcharacteristics/AddPrimaryKeyOnUuidColumnOfPermTplCharacteristicsTable.java deleted file mode 100644 index 4cc6c017ae3..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permtplcharacteristics/AddPrimaryKeyOnUuidColumnOfPermTplCharacteristicsTable.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.permtplcharacteristics; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.AddPrimaryKeyBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class AddPrimaryKeyOnUuidColumnOfPermTplCharacteristicsTable extends DdlChange { - - public AddPrimaryKeyOnUuidColumnOfPermTplCharacteristicsTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new AddPrimaryKeyBuilder("perm_tpl_characteristics", "uuid").build()); - } - -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permtplcharacteristics/AddUuidColumnToPermTplCharacteristicsTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permtplcharacteristics/AddUuidColumnToPermTplCharacteristicsTable.java deleted file mode 100644 index 8a020290d7a..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permtplcharacteristics/AddUuidColumnToPermTplCharacteristicsTable.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.permtplcharacteristics; - -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.version.v84.common.AddUuidColumnToTable; - -public class AddUuidColumnToPermTplCharacteristicsTable extends AddUuidColumnToTable { - private static final String TABLE = "perm_tpl_characteristics"; - - public AddUuidColumnToPermTplCharacteristicsTable(Database db) { - super(db, TABLE); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permtplcharacteristics/DropIdColumnOfPermTplCharacteristicsTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permtplcharacteristics/DropIdColumnOfPermTplCharacteristicsTable.java deleted file mode 100644 index f794e0d8b0a..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permtplcharacteristics/DropIdColumnOfPermTplCharacteristicsTable.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.permtplcharacteristics; - -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.version.v84.common.DropIdColumn; - -public class DropIdColumnOfPermTplCharacteristicsTable extends DropIdColumn { - private static final String TABLE = "perm_tpl_characteristics"; - - public DropIdColumnOfPermTplCharacteristicsTable(Database db) { - super(db, TABLE); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permtplcharacteristics/DropPrimaryKeyOnIdColumnOfPermTplCharacteristicsTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permtplcharacteristics/DropPrimaryKeyOnIdColumnOfPermTplCharacteristicsTable.java deleted file mode 100644 index a8892ff8070..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permtplcharacteristics/DropPrimaryKeyOnIdColumnOfPermTplCharacteristicsTable.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.permtplcharacteristics; - -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.DropPrimaryKeySqlGenerator; -import org.sonar.server.platform.db.migration.version.v84.common.DropPrimaryKeyOnIdColumn; - -public class DropPrimaryKeyOnIdColumnOfPermTplCharacteristicsTable extends DropPrimaryKeyOnIdColumn { - private static final String TABLE_NAME = "perm_tpl_characteristics"; - - public DropPrimaryKeyOnIdColumnOfPermTplCharacteristicsTable(Database db, DropPrimaryKeySqlGenerator dropPrimaryKeySqlGenerator) { - super(db, dropPrimaryKeySqlGenerator, TABLE_NAME); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permtplcharacteristics/MakePermTplCharacteristicsUuidColumnNotNullable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permtplcharacteristics/MakePermTplCharacteristicsUuidColumnNotNullable.java deleted file mode 100644 index aadc6b4de8a..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permtplcharacteristics/MakePermTplCharacteristicsUuidColumnNotNullable.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.permtplcharacteristics; - -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.version.v84.common.MakeUuidColumnNotNullable; - -public class MakePermTplCharacteristicsUuidColumnNotNullable extends MakeUuidColumnNotNullable { - private static final String TABLE = "perm_tpl_characteristics"; - - public MakePermTplCharacteristicsUuidColumnNotNullable(Database db) { - super(db, TABLE); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permtplcharacteristics/PopulatePermTplCharacteristicsUuid.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permtplcharacteristics/PopulatePermTplCharacteristicsUuid.java deleted file mode 100644 index 36d85665dd1..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permtplcharacteristics/PopulatePermTplCharacteristicsUuid.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.permtplcharacteristics; - -import java.sql.SQLException; -import org.sonar.core.util.UuidFactory; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.step.DataChange; -import org.sonar.server.platform.db.migration.step.MassUpdate; - -public class PopulatePermTplCharacteristicsUuid extends DataChange { - - private final UuidFactory uuidFactory; - - public PopulatePermTplCharacteristicsUuid(Database db, UuidFactory uuidFactory) { - super(db); - this.uuidFactory = uuidFactory; - } - - @Override - protected void execute(Context context) throws SQLException { - MassUpdate massUpdate = context.prepareMassUpdate(); - - massUpdate.select("select id from perm_tpl_characteristics where uuid is null"); - massUpdate.update("update perm_tpl_characteristics set uuid = ? where id = ?"); - - massUpdate.execute((row, update) -> { - update.setString(1, uuidFactory.create()); - update.setLong(2, row.getLong(1)); - return true; - }); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permtplcharacteristics/package-info.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permtplcharacteristics/package-info.java deleted file mode 100644 index a17bb9edec9..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/permtplcharacteristics/package-info.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.permtplcharacteristics; - -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/projectmeasures/AddPrimaryKeyOnUuidColumnOfProjectMeasuresTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/projectmeasures/AddPrimaryKeyOnUuidColumnOfProjectMeasuresTable.java deleted file mode 100644 index 685ff63e921..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/projectmeasures/AddPrimaryKeyOnUuidColumnOfProjectMeasuresTable.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.projectmeasures; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.AddPrimaryKeyBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class AddPrimaryKeyOnUuidColumnOfProjectMeasuresTable extends DdlChange { - - public AddPrimaryKeyOnUuidColumnOfProjectMeasuresTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new AddPrimaryKeyBuilder("project_measures", "uuid").build()); - } - -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/projectmeasures/AddTechIndexOnUuidOfProjectMeasuresTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/projectmeasures/AddTechIndexOnUuidOfProjectMeasuresTable.java deleted file mode 100644 index f03425d1543..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/projectmeasures/AddTechIndexOnUuidOfProjectMeasuresTable.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.projectmeasures; - -import java.sql.Connection; -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.db.DatabaseUtils; -import org.sonar.server.platform.db.migration.def.VarcharColumnDef; -import org.sonar.server.platform.db.migration.sql.CreateIndexBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder; - -public class AddTechIndexOnUuidOfProjectMeasuresTable extends DdlChange { - private static final String TABLE_NAME = "project_measures"; - private static final String INDEX_NAME = "tech_index_uuid"; - - public AddTechIndexOnUuidOfProjectMeasuresTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - if (!indexExists(INDEX_NAME)) { - context.execute(new CreateIndexBuilder() - .setUnique(false) - .setTable(TABLE_NAME) - .setName(INDEX_NAME) - .addColumn(newVarcharColumnDefBuilder() - .setColumnName("uuid") - .setIsNullable(false) - .setLimit(VarcharColumnDef.UUID_SIZE) - .build()) - .build()); - } - } - - private boolean indexExists(String name) throws SQLException { - try (Connection connection = getDatabase().getDataSource().getConnection()) { - return DatabaseUtils.indexExistsIgnoreCase(TABLE_NAME, name, connection); - } - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/projectmeasures/AddUuidColumnToProjectMeasures.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/projectmeasures/AddUuidColumnToProjectMeasures.java deleted file mode 100644 index 06b72608824..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/projectmeasures/AddUuidColumnToProjectMeasures.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.projectmeasures; - -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.version.v84.common.AddUuidColumnToTable; - -public class AddUuidColumnToProjectMeasures extends AddUuidColumnToTable { - private static final String TABLE = "project_measures"; - - public AddUuidColumnToProjectMeasures(Database db) { - super(db, TABLE); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/projectmeasures/DropIdColumnOfProjectMeasuresTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/projectmeasures/DropIdColumnOfProjectMeasuresTable.java deleted file mode 100644 index 0ad1501e53d..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/projectmeasures/DropIdColumnOfProjectMeasuresTable.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.projectmeasures; - -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.version.v84.common.DropIdColumn; - -public class DropIdColumnOfProjectMeasuresTable extends DropIdColumn { - private static final String TABLE = "project_measures"; - - public DropIdColumnOfProjectMeasuresTable(Database db) { - super(db, TABLE); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/projectmeasures/DropPrimaryKeyOnIdColumnOfProjectMeasuresTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/projectmeasures/DropPrimaryKeyOnIdColumnOfProjectMeasuresTable.java deleted file mode 100644 index 2dd32ab8fd1..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/projectmeasures/DropPrimaryKeyOnIdColumnOfProjectMeasuresTable.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.projectmeasures; - -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.DropPrimaryKeySqlGenerator; -import org.sonar.server.platform.db.migration.version.v84.common.DropPrimaryKeyOnIdColumn; - -public class DropPrimaryKeyOnIdColumnOfProjectMeasuresTable extends DropPrimaryKeyOnIdColumn { - private static final String TABLE_NAME = "project_measures"; - - public DropPrimaryKeyOnIdColumnOfProjectMeasuresTable(Database db, DropPrimaryKeySqlGenerator dropPrimaryKeySqlGenerator) { - super(db, dropPrimaryKeySqlGenerator, TABLE_NAME); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/projectmeasures/DropTechIndexOnUuidOfProjectMeasuresTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/projectmeasures/DropTechIndexOnUuidOfProjectMeasuresTable.java deleted file mode 100644 index e38114d46b6..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/projectmeasures/DropTechIndexOnUuidOfProjectMeasuresTable.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.projectmeasures; - -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.step.DropIndexChange; - -public class DropTechIndexOnUuidOfProjectMeasuresTable extends DropIndexChange { - private static final String TABLE_NAME = "project_measures"; - private static final String INDEX_NAME = "tech_index_uuid"; - - public DropTechIndexOnUuidOfProjectMeasuresTable(Database db) { - super(db, INDEX_NAME, TABLE_NAME); - } - -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/projectmeasures/MakeProjectMeasuresUuidColumnNotNullable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/projectmeasures/MakeProjectMeasuresUuidColumnNotNullable.java deleted file mode 100644 index b78b7d0ac77..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/projectmeasures/MakeProjectMeasuresUuidColumnNotNullable.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.projectmeasures; - -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.version.v84.common.MakeUuidColumnNotNullable; - -public class MakeProjectMeasuresUuidColumnNotNullable extends MakeUuidColumnNotNullable { - private static final String TABLE = "project_measures"; - - public MakeProjectMeasuresUuidColumnNotNullable(Database db) { - super(db, TABLE); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/projectmeasures/PopulateProjectMeasureUuid.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/projectmeasures/PopulateProjectMeasureUuid.java deleted file mode 100644 index 002fe54ca2d..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/projectmeasures/PopulateProjectMeasureUuid.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.projectmeasures; - -import java.sql.SQLException; -import org.sonar.core.util.UuidFactory; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.step.DataChange; -import org.sonar.server.platform.db.migration.step.MassUpdate; - -public class PopulateProjectMeasureUuid extends DataChange { - - private final UuidFactory uuidFactory; - - public PopulateProjectMeasureUuid(Database db, UuidFactory uuidFactory) { - super(db); - this.uuidFactory = uuidFactory; - } - - @Override - protected void execute(Context context) throws SQLException { - MassUpdate massUpdate = context.prepareMassUpdate(); - - massUpdate.select("select id from project_measures where uuid is null"); - massUpdate.update("update project_measures set uuid = ? where id = ?"); - - massUpdate.execute((row, update) -> { - update.setString(1, uuidFactory.create()); - update.setLong(2, row.getLong(1)); - return true; - }); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/projectmeasures/package-info.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/projectmeasures/package-info.java deleted file mode 100644 index bb28fde3a0f..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/projectmeasures/package-info.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.projectmeasures; - -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/projectqprofiles/AddPrimaryKeyOnUuidColumnOfProjectQProfilesTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/projectqprofiles/AddPrimaryKeyOnUuidColumnOfProjectQProfilesTable.java deleted file mode 100644 index 38654bc7cbe..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/projectqprofiles/AddPrimaryKeyOnUuidColumnOfProjectQProfilesTable.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.projectqprofiles; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.AddPrimaryKeyBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class AddPrimaryKeyOnUuidColumnOfProjectQProfilesTable extends DdlChange { - - public AddPrimaryKeyOnUuidColumnOfProjectQProfilesTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new AddPrimaryKeyBuilder("project_qprofiles", "uuid").build()); - } - -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/projectqprofiles/AddUuidColumnToProjectQProfilesTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/projectqprofiles/AddUuidColumnToProjectQProfilesTable.java deleted file mode 100644 index 4ae689064d8..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/projectqprofiles/AddUuidColumnToProjectQProfilesTable.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.projectqprofiles; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.def.VarcharColumnDef; -import org.sonar.server.platform.db.migration.sql.AddColumnsBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder; - -public class AddUuidColumnToProjectQProfilesTable extends DdlChange { - private static final String TABLE = "project_qprofiles"; - - private static final VarcharColumnDef uuidColumnDefinition = newVarcharColumnDefBuilder() - .setColumnName("uuid") - .setIsNullable(true) - .setDefaultValue(null) - .setLimit(VarcharColumnDef.UUID_SIZE) - .build(); - - public AddUuidColumnToProjectQProfilesTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new AddColumnsBuilder(getDialect(), TABLE) - .addColumn(uuidColumnDefinition) - .build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/projectqprofiles/DropIdColumnOfProjectQProfilesTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/projectqprofiles/DropIdColumnOfProjectQProfilesTable.java deleted file mode 100644 index 84857120b64..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/projectqprofiles/DropIdColumnOfProjectQProfilesTable.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.projectqprofiles; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.DropColumnsBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class DropIdColumnOfProjectQProfilesTable extends DdlChange { - - private Database db; - - public DropIdColumnOfProjectQProfilesTable(Database db) { - super(db); - this.db = db; - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new DropColumnsBuilder(db.getDialect(), "project_qprofiles", "id").build()); - } - -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/projectqprofiles/DropPrimaryKeyOnIdColumnOfProjectQProfilesTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/projectqprofiles/DropPrimaryKeyOnIdColumnOfProjectQProfilesTable.java deleted file mode 100644 index 6fc9170dc65..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/projectqprofiles/DropPrimaryKeyOnIdColumnOfProjectQProfilesTable.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.projectqprofiles; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.DropPrimaryKeySqlGenerator; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class DropPrimaryKeyOnIdColumnOfProjectQProfilesTable extends DdlChange { - - private final DropPrimaryKeySqlGenerator dropPrimaryKeySqlGenerator; - - public DropPrimaryKeyOnIdColumnOfProjectQProfilesTable(Database db, DropPrimaryKeySqlGenerator dropPrimaryKeySqlGenerator) { - super(db); - this.dropPrimaryKeySqlGenerator = dropPrimaryKeySqlGenerator; - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(dropPrimaryKeySqlGenerator.generate("project_qprofiles", "id", true)); - } - -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/projectqprofiles/MakeProjectQProfilesUuidColumnNotNullable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/projectqprofiles/MakeProjectQProfilesUuidColumnNotNullable.java deleted file mode 100644 index 7a5a6840021..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/projectqprofiles/MakeProjectQProfilesUuidColumnNotNullable.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.projectqprofiles; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.def.VarcharColumnDef; -import org.sonar.server.platform.db.migration.sql.AlterColumnsBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder; - -public class MakeProjectQProfilesUuidColumnNotNullable extends DdlChange { - private static final String TABLE = "project_qprofiles"; - - private static final VarcharColumnDef uuidColumnDefinition = newVarcharColumnDefBuilder() - .setColumnName("uuid") - .setIsNullable(false) - .setDefaultValue(null) - .setLimit(VarcharColumnDef.UUID_SIZE) - .build(); - - public MakeProjectQProfilesUuidColumnNotNullable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new AlterColumnsBuilder(getDialect(), TABLE) - .updateColumn(uuidColumnDefinition) - .build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/projectqprofiles/PopulateProjectQProfilesUuid.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/projectqprofiles/PopulateProjectQProfilesUuid.java deleted file mode 100644 index 4452a953577..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/projectqprofiles/PopulateProjectQProfilesUuid.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.projectqprofiles; - -import java.sql.SQLException; -import org.sonar.core.util.UuidFactory; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.step.DataChange; -import org.sonar.server.platform.db.migration.step.MassUpdate; - -public class PopulateProjectQProfilesUuid extends DataChange { - - private final UuidFactory uuidFactory; - - public PopulateProjectQProfilesUuid(Database db, UuidFactory uuidFactory) { - super(db); - this.uuidFactory = uuidFactory; - } - - @Override - protected void execute(Context context) throws SQLException { - MassUpdate massUpdate = context.prepareMassUpdate(); - - massUpdate.select("select id from project_qprofiles where uuid is null"); - massUpdate.update("update project_qprofiles set uuid = ? where id = ?"); - - massUpdate.execute((row, update) -> { - update.setString(1, uuidFactory.create()); - update.setLong(2, row.getLong(1)); - return true; - }); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/projectqprofiles/package-info.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/projectqprofiles/package-info.java deleted file mode 100644 index f3ea7bb72b9..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/projectqprofiles/package-info.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.projectqprofiles; - -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/properties/AddPrimaryKeyOnUuidColumnOfPropertiesTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/properties/AddPrimaryKeyOnUuidColumnOfPropertiesTable.java deleted file mode 100644 index 30e6ff1ad19..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/properties/AddPrimaryKeyOnUuidColumnOfPropertiesTable.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.properties; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.AddPrimaryKeyBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class AddPrimaryKeyOnUuidColumnOfPropertiesTable extends DdlChange { - - public AddPrimaryKeyOnUuidColumnOfPropertiesTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new AddPrimaryKeyBuilder("properties", "uuid").build()); - } - -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/properties/AddUuidColumnToProperties.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/properties/AddUuidColumnToProperties.java deleted file mode 100644 index 29629244ad3..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/properties/AddUuidColumnToProperties.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.properties; - -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.version.v84.common.AddUuidColumnToTable; - -public class AddUuidColumnToProperties extends AddUuidColumnToTable { - private static final String TABLE_NAME = "properties"; - - public AddUuidColumnToProperties(Database db) { - super(db, TABLE_NAME); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/properties/DropIdColumnOfPropertiesTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/properties/DropIdColumnOfPropertiesTable.java deleted file mode 100644 index 0111a4345d1..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/properties/DropIdColumnOfPropertiesTable.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.properties; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.DropColumnsBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class DropIdColumnOfPropertiesTable extends DdlChange { - - public DropIdColumnOfPropertiesTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new DropColumnsBuilder(getDialect(), "properties", "id").build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/properties/DropPrimaryKeyOnIdColumnOfPropertiesTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/properties/DropPrimaryKeyOnIdColumnOfPropertiesTable.java deleted file mode 100644 index 5096df04a4c..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/properties/DropPrimaryKeyOnIdColumnOfPropertiesTable.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.properties; - -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.DropPrimaryKeySqlGenerator; -import org.sonar.server.platform.db.migration.version.v84.common.DropPrimaryKeyOnIdColumn; - -public class DropPrimaryKeyOnIdColumnOfPropertiesTable extends DropPrimaryKeyOnIdColumn { - - private static final String TABLE_NAME = "properties"; - - public DropPrimaryKeyOnIdColumnOfPropertiesTable(Database db, DropPrimaryKeySqlGenerator dropPrimaryKeySqlGenerator) { - super(db, dropPrimaryKeySqlGenerator, TABLE_NAME); - } - -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/properties/MakePropertiesUuidColumnNotNullable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/properties/MakePropertiesUuidColumnNotNullable.java deleted file mode 100644 index 5e9e447aee4..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/properties/MakePropertiesUuidColumnNotNullable.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.properties; - -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.version.v84.common.MakeUuidColumnNotNullable; - -public class MakePropertiesUuidColumnNotNullable extends MakeUuidColumnNotNullable { - private static final String TABLE_NAME = "properties"; - - public MakePropertiesUuidColumnNotNullable(Database db) { - super(db, TABLE_NAME); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/properties/PopulatePropertiesUuid.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/properties/PopulatePropertiesUuid.java deleted file mode 100644 index 61cf2061739..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/properties/PopulatePropertiesUuid.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.properties; - -import java.sql.SQLException; -import org.sonar.core.util.UuidFactory; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.step.DataChange; -import org.sonar.server.platform.db.migration.step.MassUpdate; - -public class PopulatePropertiesUuid extends DataChange { - - private final UuidFactory uuidFactory; - - public PopulatePropertiesUuid(Database db, UuidFactory uuidFactory) { - super(db); - this.uuidFactory = uuidFactory; - } - - @Override - protected void execute(Context context) throws SQLException { - MassUpdate massUpdate = context.prepareMassUpdate(); - - massUpdate.select("select id from properties where uuid is null"); - massUpdate.update("update properties set uuid = ? where id = ?"); - - massUpdate.execute((row, update) -> { - update.setString(1, uuidFactory.create()); - update.setLong(2, row.getLong(1)); - return true; - }); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/properties/package-info.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/properties/package-info.java deleted file mode 100644 index 5d881bed586..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/properties/package-info.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.properties; - -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/qualitygateconditions/AddPrimaryKeyOnUuidColumnOfQualityGateConditionsTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/qualitygateconditions/AddPrimaryKeyOnUuidColumnOfQualityGateConditionsTable.java deleted file mode 100644 index ebf6682db90..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/qualitygateconditions/AddPrimaryKeyOnUuidColumnOfQualityGateConditionsTable.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.qualitygateconditions; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.AddPrimaryKeyBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class AddPrimaryKeyOnUuidColumnOfQualityGateConditionsTable extends DdlChange { - - public AddPrimaryKeyOnUuidColumnOfQualityGateConditionsTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new AddPrimaryKeyBuilder("quality_gate_conditions", "uuid").build()); - } - -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/qualitygateconditions/AddUuidColumnToQualityGateConditionsTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/qualitygateconditions/AddUuidColumnToQualityGateConditionsTable.java deleted file mode 100644 index 5b12fb7cde8..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/qualitygateconditions/AddUuidColumnToQualityGateConditionsTable.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.qualitygateconditions; - -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.version.v84.common.AddUuidColumnToTable; - -public class AddUuidColumnToQualityGateConditionsTable extends AddUuidColumnToTable { - private static final String TABLE = "quality_gate_conditions"; - - public AddUuidColumnToQualityGateConditionsTable(Database db) { - super(db, TABLE); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/qualitygateconditions/DropIdColumnOfQualityGateConditionsTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/qualitygateconditions/DropIdColumnOfQualityGateConditionsTable.java deleted file mode 100644 index e464525936f..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/qualitygateconditions/DropIdColumnOfQualityGateConditionsTable.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.qualitygateconditions; - -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.version.v84.common.DropIdColumn; - -public class DropIdColumnOfQualityGateConditionsTable extends DropIdColumn { - private static final String TABLE = "quality_gate_conditions"; - - public DropIdColumnOfQualityGateConditionsTable(Database db) { - super(db, TABLE); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/qualitygateconditions/DropPrimaryKeyOnIdColumnOfQualityGateConditionsTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/qualitygateconditions/DropPrimaryKeyOnIdColumnOfQualityGateConditionsTable.java deleted file mode 100644 index dee71e25669..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/qualitygateconditions/DropPrimaryKeyOnIdColumnOfQualityGateConditionsTable.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.qualitygateconditions; - -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.DropPrimaryKeySqlGenerator; -import org.sonar.server.platform.db.migration.version.v84.common.DropPrimaryKeyOnIdColumn; - -public class DropPrimaryKeyOnIdColumnOfQualityGateConditionsTable extends DropPrimaryKeyOnIdColumn { - private static final String TABLE_NAME = "quality_gate_conditions"; - - public DropPrimaryKeyOnIdColumnOfQualityGateConditionsTable(Database db, DropPrimaryKeySqlGenerator dropPrimaryKeySqlGenerator) { - super(db, dropPrimaryKeySqlGenerator, TABLE_NAME); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/qualitygateconditions/MakeQualityGateConditionsUuidColumnNotNullable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/qualitygateconditions/MakeQualityGateConditionsUuidColumnNotNullable.java deleted file mode 100644 index ce11ddd1060..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/qualitygateconditions/MakeQualityGateConditionsUuidColumnNotNullable.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.qualitygateconditions; - -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.version.v84.common.MakeUuidColumnNotNullable; - -public class MakeQualityGateConditionsUuidColumnNotNullable extends MakeUuidColumnNotNullable { - private static final String TABLE = "quality_gate_conditions"; - - public MakeQualityGateConditionsUuidColumnNotNullable(Database db) { - super(db, TABLE); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/qualitygateconditions/PopulateQualityGateConditionsUuid.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/qualitygateconditions/PopulateQualityGateConditionsUuid.java deleted file mode 100644 index db5d72de35a..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/qualitygateconditions/PopulateQualityGateConditionsUuid.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.qualitygateconditions; - -import java.sql.SQLException; -import org.sonar.core.util.UuidFactory; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.step.DataChange; -import org.sonar.server.platform.db.migration.step.MassUpdate; - -public class PopulateQualityGateConditionsUuid extends DataChange { - - private final UuidFactory uuidFactory; - - public PopulateQualityGateConditionsUuid(Database db, UuidFactory uuidFactory) { - super(db); - this.uuidFactory = uuidFactory; - } - - @Override - protected void execute(Context context) throws SQLException { - MassUpdate massUpdate = context.prepareMassUpdate(); - - massUpdate.select("select id from quality_gate_conditions where uuid is null"); - massUpdate.update("update quality_gate_conditions set uuid = ? where id = ?"); - - massUpdate.execute((row, update) -> { - update.setString(1, uuidFactory.create()); - update.setLong(2, row.getLong(1)); - return true; - }); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/qualitygateconditions/package-info.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/qualitygateconditions/package-info.java deleted file mode 100644 index 80513ced908..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/qualitygateconditions/package-info.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.qualitygateconditions; - -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/qualitygates/AddPrimaryKeyOnUuidColumnOfQGatesTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/qualitygates/AddPrimaryKeyOnUuidColumnOfQGatesTable.java deleted file mode 100644 index 3d222fa045d..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/qualitygates/AddPrimaryKeyOnUuidColumnOfQGatesTable.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.qualitygates; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.AddPrimaryKeyBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class AddPrimaryKeyOnUuidColumnOfQGatesTable extends DdlChange { - - public AddPrimaryKeyOnUuidColumnOfQGatesTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new AddPrimaryKeyBuilder("quality_gates", "uuid").build()); - } - -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/qualitygates/AddQGateUuidColumnForQGateConditions.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/qualitygates/AddQGateUuidColumnForQGateConditions.java deleted file mode 100644 index f1edcfb3132..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/qualitygates/AddQGateUuidColumnForQGateConditions.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.qualitygates; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.def.VarcharColumnDef; -import org.sonar.server.platform.db.migration.sql.AddColumnsBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder; - -public class AddQGateUuidColumnForQGateConditions extends DdlChange { - private static final String TABLE = "quality_gate_conditions"; - - private static final VarcharColumnDef uuidColumnDefinition = newVarcharColumnDefBuilder() - .setColumnName("qgate_uuid") - .setIsNullable(true) - .setDefaultValue(null) - .setLimit(VarcharColumnDef.UUID_SIZE) - .build(); - - public AddQGateUuidColumnForQGateConditions(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new AddColumnsBuilder(getDialect(), TABLE) - .addColumn(uuidColumnDefinition) - .build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/qualitygates/DropIdColumnOfQGateTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/qualitygates/DropIdColumnOfQGateTable.java deleted file mode 100644 index faf335a5009..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/qualitygates/DropIdColumnOfQGateTable.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.qualitygates; - -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.version.v84.common.DropIdColumn; - -public class DropIdColumnOfQGateTable extends DropIdColumn { - private static final String TABLE = "quality_gates"; - - public DropIdColumnOfQGateTable(Database db) { - super(db, TABLE); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/qualitygates/DropOrphansQGateConditions.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/qualitygates/DropOrphansQGateConditions.java deleted file mode 100644 index 7418cf882c2..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/qualitygates/DropOrphansQGateConditions.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.qualitygates; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.step.DataChange; -import org.sonar.server.platform.db.migration.step.MassUpdate; - -public class DropOrphansQGateConditions extends DataChange { - - public DropOrphansQGateConditions(Database db) { - super(db); - } - - @Override - protected void execute(Context context) throws SQLException { - MassUpdate massUpdate = context.prepareMassUpdate(); - - massUpdate.select("select uuid from quality_gate_conditions where qgate_uuid is null"); - massUpdate.update("delete from quality_gate_conditions where uuid = ?"); - - massUpdate.execute((row, update) -> { - update.setString(1, row.getString(1)); - return true; - }); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/qualitygates/DropPrimaryKeyOnIdColumnOfQGatesTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/qualitygates/DropPrimaryKeyOnIdColumnOfQGatesTable.java deleted file mode 100644 index cf362b8603d..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/qualitygates/DropPrimaryKeyOnIdColumnOfQGatesTable.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.qualitygates; - -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.DropPrimaryKeySqlGenerator; -import org.sonar.server.platform.db.migration.version.v84.common.DropPrimaryKeyOnIdColumn; - -public class DropPrimaryKeyOnIdColumnOfQGatesTable extends DropPrimaryKeyOnIdColumn { - - private static final String TABLE_NAME = "quality_gates"; - - public DropPrimaryKeyOnIdColumnOfQGatesTable(Database db, DropPrimaryKeySqlGenerator dropPrimaryKeySqlGenerator) { - super(db, dropPrimaryKeySqlGenerator, TABLE_NAME); - } - -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/qualitygates/DropQGateIdColumnForQGateConditions.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/qualitygates/DropQGateIdColumnForQGateConditions.java deleted file mode 100644 index 7ac2522a5d0..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/qualitygates/DropQGateIdColumnForQGateConditions.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.qualitygates; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.DropColumnsBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class DropQGateIdColumnForQGateConditions extends DdlChange { - - private Database db; - - public DropQGateIdColumnForQGateConditions(Database db) { - super(db); - this.db = db; - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new DropColumnsBuilder(db.getDialect(), "quality_gate_conditions", "qgate_id").build()); - } - -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/qualitygates/DropUniqueIndexOnUuidColumnOfQualityGatesTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/qualitygates/DropUniqueIndexOnUuidColumnOfQualityGatesTable.java deleted file mode 100644 index 6d29940368b..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/qualitygates/DropUniqueIndexOnUuidColumnOfQualityGatesTable.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.qualitygates; - -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.step.DropIndexChange; - -public class DropUniqueIndexOnUuidColumnOfQualityGatesTable extends DropIndexChange { - private static final String INDEX_NAME = "uniq_quality_gates_uuid"; - private static final String TABLE_NAME = "quality_gates"; - - public DropUniqueIndexOnUuidColumnOfQualityGatesTable(Database db) { - super(db, INDEX_NAME, TABLE_NAME); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/qualitygates/MakeQGateUuidColumnNotNullableForQGateConditions.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/qualitygates/MakeQGateUuidColumnNotNullableForQGateConditions.java deleted file mode 100644 index 9c9db09ddeb..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/qualitygates/MakeQGateUuidColumnNotNullableForQGateConditions.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.qualitygates; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.def.VarcharColumnDef; -import org.sonar.server.platform.db.migration.sql.AlterColumnsBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder; - -public class MakeQGateUuidColumnNotNullableForQGateConditions extends DdlChange { - private static final String TABLE = "quality_gate_conditions"; - - private static final VarcharColumnDef uuidColumnDefinition = newVarcharColumnDefBuilder() - .setColumnName("qgate_uuid") - .setIsNullable(false) - .setDefaultValue(null) - .setLimit(VarcharColumnDef.UUID_SIZE) - .build(); - - public MakeQGateUuidColumnNotNullableForQGateConditions(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new AlterColumnsBuilder(getDialect(), TABLE) - .updateColumn(uuidColumnDefinition) - .build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/qualitygates/PopulateQGateUuidColumnForQGateConditions.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/qualitygates/PopulateQGateUuidColumnForQGateConditions.java deleted file mode 100644 index f0a6890ed0a..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/qualitygates/PopulateQGateUuidColumnForQGateConditions.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.qualitygates; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.step.DataChange; -import org.sonar.server.platform.db.migration.step.MassUpdate; - -public class PopulateQGateUuidColumnForQGateConditions extends DataChange { - - public PopulateQGateUuidColumnForQGateConditions(Database db) { - super(db); - } - - @Override - protected void execute(Context context) throws SQLException { - MassUpdate massUpdate = context.prepareMassUpdate(); - - massUpdate.select("select uuid, id from quality_gates"); - massUpdate.update("update quality_gate_conditions set qgate_uuid = ? where qgate_id = ? and qgate_uuid is null"); - - massUpdate.execute((row, update) -> { - update.setString(1, row.getString(1)); - update.setLong(2, row.getLong(2)); - return true; - }); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/qualitygates/package-info.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/qualitygates/package-info.java deleted file mode 100644 index 4b799e052a2..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/qualitygates/package-info.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.qualitygates; - -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/AddPrimaryKeyOnUuidColumnOfRulesTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/AddPrimaryKeyOnUuidColumnOfRulesTable.java deleted file mode 100644 index 8abf06f4130..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/AddPrimaryKeyOnUuidColumnOfRulesTable.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rules; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.AddPrimaryKeyBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class AddPrimaryKeyOnUuidColumnOfRulesTable extends DdlChange { - - public AddPrimaryKeyOnUuidColumnOfRulesTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new AddPrimaryKeyBuilder("rules", "uuid").build()); - } - -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/AddUuidAndTemplateUuidColumnsToRules.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/AddUuidAndTemplateUuidColumnsToRules.java deleted file mode 100644 index 7dcf4b09605..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/AddUuidAndTemplateUuidColumnsToRules.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rules; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.def.VarcharColumnDef; -import org.sonar.server.platform.db.migration.sql.AddColumnsBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder; - -public class AddUuidAndTemplateUuidColumnsToRules extends DdlChange { - private static final String TABLE = "rules"; - - private static final VarcharColumnDef uuidColumnDefinition = newVarcharColumnDefBuilder() - .setColumnName("uuid") - .setIsNullable(true) - .setDefaultValue(null) - .setLimit(VarcharColumnDef.UUID_SIZE) - .build(); - - private static final VarcharColumnDef templateUuidColumnDefinition = newVarcharColumnDefBuilder() - .setColumnName("template_uuid") - .setIsNullable(true) - .setDefaultValue(null) - .setLimit(VarcharColumnDef.UUID_SIZE) - .build(); - - public AddUuidAndTemplateUuidColumnsToRules(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new AddColumnsBuilder(getDialect(), TABLE) - .addColumn(uuidColumnDefinition) - .addColumn(templateUuidColumnDefinition) - .build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/DropIdColumnOfRulesTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/DropIdColumnOfRulesTable.java deleted file mode 100644 index 2a5a72b6050..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/DropIdColumnOfRulesTable.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rules; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.DropColumnsBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class DropIdColumnOfRulesTable extends DdlChange { - - public DropIdColumnOfRulesTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new DropColumnsBuilder(getDialect(), "rules", "id").build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/DropPrimaryKeyOnIdColumnOfRulesTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/DropPrimaryKeyOnIdColumnOfRulesTable.java deleted file mode 100644 index 0ad3ef2dd07..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/DropPrimaryKeyOnIdColumnOfRulesTable.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rules; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.DropPrimaryKeySqlGenerator; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class DropPrimaryKeyOnIdColumnOfRulesTable extends DdlChange { - - private final DropPrimaryKeySqlGenerator dropPrimaryKeySqlGenerator; - - public DropPrimaryKeyOnIdColumnOfRulesTable(Database db, DropPrimaryKeySqlGenerator dropPrimaryKeySqlGenerator) { - super(db); - this.dropPrimaryKeySqlGenerator = dropPrimaryKeySqlGenerator; - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(dropPrimaryKeySqlGenerator.generate("rules", "id", true)); - } - -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/DropTemplateIdColumnOfRulesTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/DropTemplateIdColumnOfRulesTable.java deleted file mode 100644 index 234a404bd85..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/DropTemplateIdColumnOfRulesTable.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rules; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.DropColumnsBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class DropTemplateIdColumnOfRulesTable extends DdlChange { - - public DropTemplateIdColumnOfRulesTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new DropColumnsBuilder(getDialect(), "rules", "template_id").build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/MakeRulesUuidColumnNotNullable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/MakeRulesUuidColumnNotNullable.java deleted file mode 100644 index 14411b40c6e..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/MakeRulesUuidColumnNotNullable.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rules; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.def.VarcharColumnDef; -import org.sonar.server.platform.db.migration.sql.AlterColumnsBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder; - -public class MakeRulesUuidColumnNotNullable extends DdlChange { - private static final String TABLE = "rules"; - - private static final VarcharColumnDef uuidColumnDefinition = newVarcharColumnDefBuilder() - .setColumnName("uuid") - .setIsNullable(false) - .setDefaultValue(null) - .setLimit(VarcharColumnDef.UUID_SIZE) - .build(); - - public MakeRulesUuidColumnNotNullable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new AlterColumnsBuilder(getDialect(), TABLE) - .updateColumn(uuidColumnDefinition) - .build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/PopulateRulesTemplateUuid.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/PopulateRulesTemplateUuid.java deleted file mode 100644 index d73e604c3fe..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/PopulateRulesTemplateUuid.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rules; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.step.DataChange; -import org.sonar.server.platform.db.migration.step.MassUpdate; - -public class PopulateRulesTemplateUuid extends DataChange { - - public PopulateRulesTemplateUuid(Database db) { - super(db); - } - - @Override - protected void execute(Context context) throws SQLException { - MassUpdate massUpdate = context.prepareMassUpdate(); - - massUpdate.select( - "select ru.id, rt.uuid from rules ru " + - "left join rules rt on rt.id = ru.template_id " + - "where ru.template_uuid is null and ru.template_id is not null"); - massUpdate.update("update rules set template_uuid = ? where id = ?"); - - massUpdate.execute((row, update) -> { - update.setString(1, row.getString(2)); - update.setLong(2, row.getLong(1)); - return true; - }); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/PopulateRulesUuid.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/PopulateRulesUuid.java deleted file mode 100644 index bf7a5f3a219..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/PopulateRulesUuid.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rules; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.step.DataChange; -import org.sonar.server.platform.db.migration.step.MassUpdate; - -public class PopulateRulesUuid extends DataChange { - public PopulateRulesUuid(Database db) { - super(db); - } - - @Override - protected void execute(Context context) throws SQLException { - MassUpdate massUpdate = context.prepareMassUpdate(); - - massUpdate.select("select id from rules where uuid is null"); - massUpdate.update("update rules set uuid = ? where id = ?"); - - massUpdate.execute((row, update) -> { - long id = row.getLong(1); - update.setString(1, Long.toString(id)); - update.setLong(2, id); - return true; - }); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/activerules/AddIndexToActiveRulesTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/activerules/AddIndexToActiveRulesTable.java deleted file mode 100644 index f59a20fb73b..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/activerules/AddIndexToActiveRulesTable.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rules.activerules; - -import java.sql.Connection; -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.db.DatabaseUtils; -import org.sonar.server.platform.db.migration.def.VarcharColumnDef; -import org.sonar.server.platform.db.migration.sql.CreateIndexBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder; - -public class AddIndexToActiveRulesTable extends DdlChange { - private static final String TABLE = "active_rules"; - private static final String INDEX_NAME = "uniq_profile_rule_uuids"; - - private static final VarcharColumnDef uuidColumnDefinition = newVarcharColumnDefBuilder() - .setColumnName("rule_uuid") - .setIsNullable(false) - .setLimit(VarcharColumnDef.UUID_SIZE) - .build(); - private static final VarcharColumnDef profileUuidColumnDefinition = newVarcharColumnDefBuilder() - .setColumnName("profile_uuid") - .setIsNullable(false) - .setLimit(VarcharColumnDef.UUID_SIZE) - .build(); - - public AddIndexToActiveRulesTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - if (!indexExists()) { - context.execute(new CreateIndexBuilder() - .setTable(TABLE) - .setName(INDEX_NAME) - .addColumn(profileUuidColumnDefinition) - .addColumn(uuidColumnDefinition) - .setUnique(true) - .build()); - } - } - - private boolean indexExists() throws SQLException { - try (Connection connection = getDatabase().getDataSource().getConnection()) { - return DatabaseUtils.indexExistsIgnoreCase(TABLE, INDEX_NAME, connection); - } - } - -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/activerules/AddRuleUuidColumnToActiveRulesTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/activerules/AddRuleUuidColumnToActiveRulesTable.java deleted file mode 100644 index 29f0cf3de12..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/activerules/AddRuleUuidColumnToActiveRulesTable.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rules.activerules; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.def.VarcharColumnDef; -import org.sonar.server.platform.db.migration.sql.AddColumnsBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder; - -public class AddRuleUuidColumnToActiveRulesTable extends DdlChange { - private static final String TABLE = "active_rules"; - - private static final VarcharColumnDef uuidColumnDefinition = newVarcharColumnDefBuilder() - .setColumnName("rule_uuid") - .setIsNullable(true) - .setDefaultValue(null) - .setLimit(VarcharColumnDef.UUID_SIZE) - .build(); - - public AddRuleUuidColumnToActiveRulesTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new AddColumnsBuilder(getDialect(), TABLE) - .addColumn(uuidColumnDefinition) - .build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/activerules/DropIndexOnRuleIdColumnOfActiveRulesTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/activerules/DropIndexOnRuleIdColumnOfActiveRulesTable.java deleted file mode 100644 index a0cdbf8c64b..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/activerules/DropIndexOnRuleIdColumnOfActiveRulesTable.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rules.activerules; - -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.step.DropIndexChange; - -public class DropIndexOnRuleIdColumnOfActiveRulesTable extends DropIndexChange { - private static final String TABLE_NAME = "active_rules"; - private static final String INDEX_NAME = "uniq_profile_rule_ids"; - - public DropIndexOnRuleIdColumnOfActiveRulesTable(Database db) { - super(db, INDEX_NAME, TABLE_NAME); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/activerules/DropRuleIdColumnOfActiveRulesTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/activerules/DropRuleIdColumnOfActiveRulesTable.java deleted file mode 100644 index ea1cd6a4685..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/activerules/DropRuleIdColumnOfActiveRulesTable.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rules.activerules; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.DropColumnsBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class DropRuleIdColumnOfActiveRulesTable extends DdlChange { - - public DropRuleIdColumnOfActiveRulesTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new DropColumnsBuilder(getDialect(), "active_rules", "rule_id").build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/activerules/MakeActiveRulesRuleUuidColumnNotNullable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/activerules/MakeActiveRulesRuleUuidColumnNotNullable.java deleted file mode 100644 index 575bf196ced..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/activerules/MakeActiveRulesRuleUuidColumnNotNullable.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rules.activerules; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.def.VarcharColumnDef; -import org.sonar.server.platform.db.migration.sql.AlterColumnsBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder; - -public class MakeActiveRulesRuleUuidColumnNotNullable extends DdlChange { - private static final String TABLE = "active_rules"; - - private static final VarcharColumnDef uuidColumnDefinition = newVarcharColumnDefBuilder() - .setColumnName("rule_uuid") - .setIsNullable(false) - .setDefaultValue(null) - .setLimit(VarcharColumnDef.UUID_SIZE) - .build(); - - public MakeActiveRulesRuleUuidColumnNotNullable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new AlterColumnsBuilder(getDialect(), TABLE) - .updateColumn(uuidColumnDefinition) - .build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/activerules/PopulateActiveRulesRuleUuidColumn.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/activerules/PopulateActiveRulesRuleUuidColumn.java deleted file mode 100644 index c3609a2f3a2..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/activerules/PopulateActiveRulesRuleUuidColumn.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rules.activerules; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.step.DataChange; -import org.sonar.server.platform.db.migration.step.MassUpdate; -import org.sonar.server.platform.db.migration.version.v84.util.OrphanData; - -public class PopulateActiveRulesRuleUuidColumn extends DataChange { - - public PopulateActiveRulesRuleUuidColumn(Database db) { - super(db); - } - - @Override - protected void execute(Context context) throws SQLException { - MassUpdate massUpdate = context.prepareMassUpdate(); - - massUpdate.select("select ar.rule_id, ru.uuid " + - "from active_rules ar " + - "join rules ru on ar.rule_id = ru.id " + - "where ar.rule_uuid is null"); - massUpdate.update("update active_rules set rule_uuid = ? where rule_id = ?"); - - massUpdate.execute((row, update) -> { - update.setString(1, row.getString(2)); - update.setLong(2, row.getLong(1)); - return true; - }); - - OrphanData.delete(context, "active_rules", "rule_uuid"); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/activerules/package-info.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/activerules/package-info.java deleted file mode 100644 index 261bc7cb3b5..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/activerules/package-info.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rules.activerules; - -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/deprecatedrulekeys/AddIndexToDeprecatedRuleKeysTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/deprecatedrulekeys/AddIndexToDeprecatedRuleKeysTable.java deleted file mode 100644 index 0dfd1eebedb..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/deprecatedrulekeys/AddIndexToDeprecatedRuleKeysTable.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rules.deprecatedrulekeys; - -import java.sql.Connection; -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.db.DatabaseUtils; -import org.sonar.server.platform.db.migration.def.VarcharColumnDef; -import org.sonar.server.platform.db.migration.sql.CreateIndexBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder; - -public class AddIndexToDeprecatedRuleKeysTable extends DdlChange { - private static final String TABLE = "deprecated_rule_keys"; - private static final String INDEX_NAME = "rule_uuid_deprecated_rule_keys"; - - private static final VarcharColumnDef uuidColumnDefinition = newVarcharColumnDefBuilder() - .setColumnName("rule_uuid") - .setIsNullable(false) - .setLimit(VarcharColumnDef.UUID_SIZE) - .build(); - - public AddIndexToDeprecatedRuleKeysTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - if (!indexExists()) { - context.execute(new CreateIndexBuilder() - .setTable(TABLE) - .setName(INDEX_NAME) - .addColumn(uuidColumnDefinition) - .build()); - } - } - - private boolean indexExists() throws SQLException { - try (Connection connection = getDatabase().getDataSource().getConnection()) { - return DatabaseUtils.indexExistsIgnoreCase(TABLE, INDEX_NAME, connection); - } - } - -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/deprecatedrulekeys/AddRuleUuidColumnToDeprecatedRuleKeysTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/deprecatedrulekeys/AddRuleUuidColumnToDeprecatedRuleKeysTable.java deleted file mode 100644 index c6f8f377673..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/deprecatedrulekeys/AddRuleUuidColumnToDeprecatedRuleKeysTable.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rules.deprecatedrulekeys; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.def.VarcharColumnDef; -import org.sonar.server.platform.db.migration.sql.AddColumnsBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder; - -public class AddRuleUuidColumnToDeprecatedRuleKeysTable extends DdlChange { - private static final String TABLE = "deprecated_rule_keys"; - - private static final VarcharColumnDef uuidColumnDefinition = newVarcharColumnDefBuilder() - .setColumnName("rule_uuid") - .setIsNullable(true) - .setDefaultValue(null) - .setLimit(VarcharColumnDef.UUID_SIZE) - .build(); - - public AddRuleUuidColumnToDeprecatedRuleKeysTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new AddColumnsBuilder(getDialect(), TABLE) - .addColumn(uuidColumnDefinition) - .build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/deprecatedrulekeys/DropIndexOnRuleIdColumnOfDeprecatedRuleKeysTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/deprecatedrulekeys/DropIndexOnRuleIdColumnOfDeprecatedRuleKeysTable.java deleted file mode 100644 index 17d2433839b..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/deprecatedrulekeys/DropIndexOnRuleIdColumnOfDeprecatedRuleKeysTable.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rules.deprecatedrulekeys; - -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.step.DropIndexChange; - -public class DropIndexOnRuleIdColumnOfDeprecatedRuleKeysTable extends DropIndexChange { - private static final String TABLE_NAME = "deprecated_rule_keys"; - private static final String INDEX_NAME = "rule_id_deprecated_rule_keys"; - - public DropIndexOnRuleIdColumnOfDeprecatedRuleKeysTable(Database db) { - super(db, INDEX_NAME, TABLE_NAME); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/deprecatedrulekeys/DropRuleIdColumnOfDeprecatedRuleKeysTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/deprecatedrulekeys/DropRuleIdColumnOfDeprecatedRuleKeysTable.java deleted file mode 100644 index 16ffbf58291..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/deprecatedrulekeys/DropRuleIdColumnOfDeprecatedRuleKeysTable.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rules.deprecatedrulekeys; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.DropColumnsBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class DropRuleIdColumnOfDeprecatedRuleKeysTable extends DdlChange { - - public DropRuleIdColumnOfDeprecatedRuleKeysTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new DropColumnsBuilder(getDialect(), "deprecated_rule_keys", "rule_id").build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/deprecatedrulekeys/MakeDeprecatedRuleKeysRuleUuidColumnNotNullable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/deprecatedrulekeys/MakeDeprecatedRuleKeysRuleUuidColumnNotNullable.java deleted file mode 100644 index cf3e6e9ccca..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/deprecatedrulekeys/MakeDeprecatedRuleKeysRuleUuidColumnNotNullable.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rules.deprecatedrulekeys; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.def.VarcharColumnDef; -import org.sonar.server.platform.db.migration.sql.AlterColumnsBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder; - -public class MakeDeprecatedRuleKeysRuleUuidColumnNotNullable extends DdlChange { - private static final String TABLE = "deprecated_rule_keys"; - - private static final VarcharColumnDef uuidColumnDefinition = newVarcharColumnDefBuilder() - .setColumnName("rule_uuid") - .setIsNullable(false) - .setDefaultValue(null) - .setLimit(VarcharColumnDef.UUID_SIZE) - .build(); - - public MakeDeprecatedRuleKeysRuleUuidColumnNotNullable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new AlterColumnsBuilder(getDialect(), TABLE) - .updateColumn(uuidColumnDefinition) - .build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/deprecatedrulekeys/PopulateDeprecatedRuleKeysRuleUuidColumn.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/deprecatedrulekeys/PopulateDeprecatedRuleKeysRuleUuidColumn.java deleted file mode 100644 index b2e884989d8..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/deprecatedrulekeys/PopulateDeprecatedRuleKeysRuleUuidColumn.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rules.deprecatedrulekeys; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.step.DataChange; -import org.sonar.server.platform.db.migration.step.MassUpdate; -import org.sonar.server.platform.db.migration.version.v84.util.OrphanData; - -public class PopulateDeprecatedRuleKeysRuleUuidColumn extends DataChange { - - public PopulateDeprecatedRuleKeysRuleUuidColumn(Database db) { - super(db); - } - - @Override - protected void execute(Context context) throws SQLException { - MassUpdate massUpdate = context.prepareMassUpdate(); - - massUpdate.select("select drk.rule_id, ru.uuid " + - "from deprecated_rule_keys drk " + - "join rules ru on drk.rule_id = ru.id " + - "where drk.rule_uuid is null"); - massUpdate.update("update deprecated_rule_keys set rule_uuid = ? where rule_id = ?"); - - massUpdate.execute((row, update) -> { - update.setString(1, row.getString(2)); - update.setLong(2, row.getLong(1)); - return true; - }); - - OrphanData.delete(context, "deprecated_rule_keys", "rule_uuid"); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/deprecatedrulekeys/package-info.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/deprecatedrulekeys/package-info.java deleted file mode 100644 index 1d193c90b78..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/deprecatedrulekeys/package-info.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rules.deprecatedrulekeys; - -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/issues/AddIndexesToIssuesTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/issues/AddIndexesToIssuesTable.java deleted file mode 100644 index eb81531f173..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/issues/AddIndexesToIssuesTable.java +++ /dev/null @@ -1,105 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rules.issues; - -import java.sql.Connection; -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.db.DatabaseUtils; -import org.sonar.server.platform.db.migration.sql.CreateIndexBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class AddIndexesToIssuesTable extends DdlChange { - private static final String TABLE = "issues"; - - public AddIndexesToIssuesTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - if (!indexExists("issues_assignee")) { - context.execute(new CreateIndexBuilder() - .setTable(TABLE) - .setName("issues_assignee") - .addColumn("assignee") - .build()); - } - if (!indexExists("issues_component_uuid")) { - - context.execute(new CreateIndexBuilder() - .setTable(TABLE) - .setName("issues_component_uuid") - .addColumn("component_uuid") - .build()); - } - if (!indexExists("issues_creation_date")) { - - context.execute(new CreateIndexBuilder() - .setTable(TABLE) - .setName("issues_creation_date") - .addColumn("issue_creation_date") - .build()); - } - if (!indexExists("issues_kee")) { - - context.execute(new CreateIndexBuilder() - .setTable(TABLE) - .setName("issues_kee") - .setUnique(true) - .addColumn("kee") - .build()); - } - if (!indexExists("issues_project_uuid")) { - context.execute(new CreateIndexBuilder() - .setTable(TABLE) - .setName("issues_project_uuid") - .addColumn("project_uuid") - .build()); - } - if (!indexExists("issues_resolution")) { - context.execute(new CreateIndexBuilder() - .setTable(TABLE) - .setName("issues_resolution") - .addColumn("resolution") - .build()); - } - if (!indexExists("issues_updated_at")) { - context.execute(new CreateIndexBuilder() - .setTable(TABLE) - .setName("issues_updated_at") - .addColumn("updated_at") - .build()); - } - if (!indexExists("issues_rule_uuid")) { - context.execute(new CreateIndexBuilder() - .setTable(TABLE) - .setName("issues_rule_uuid") - .addColumn("rule_uuid") - .build()); - } - } - - private boolean indexExists(String name) throws SQLException { - try (Connection connection = getDatabase().getDataSource().getConnection()) { - return DatabaseUtils.indexExistsIgnoreCase(TABLE, name, connection); - } - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/issues/CopyIssuesTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/issues/CopyIssuesTable.java deleted file mode 100644 index c27256172ee..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/issues/CopyIssuesTable.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rules.issues; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.CreateTableAsBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.sonar.server.platform.db.migration.def.BigIntegerColumnDef.newBigIntegerColumnDefBuilder; -import static org.sonar.server.platform.db.migration.def.BlobColumnDef.newBlobColumnDefBuilder; -import static org.sonar.server.platform.db.migration.def.BooleanColumnDef.newBooleanColumnDefBuilder; -import static org.sonar.server.platform.db.migration.def.DecimalColumnDef.newDecimalColumnDefBuilder; -import static org.sonar.server.platform.db.migration.def.IntegerColumnDef.newIntegerColumnDefBuilder; -import static org.sonar.server.platform.db.migration.def.TinyIntColumnDef.newTinyIntColumnDefBuilder; -import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder; - -public class CopyIssuesTable extends DdlChange { - public CopyIssuesTable(Database db) { - super(db); - } - - @Override public void execute(Context context) throws SQLException { - CreateTableAsBuilder builder = new CreateTableAsBuilder(getDialect(), "issues_copy", "issues") - // this will cause the following changes: - // * Drop ID and RULE_ID - // * Add RULE_UUID with values in RULE_ID casted to varchar - .addColumn(newVarcharColumnDefBuilder().setColumnName("kee").setLimit(50).setIsNullable(false).build()) - .addColumnWithCast(newVarcharColumnDefBuilder().setColumnName("rule_uuid").setLimit(40).build(), "rule_id") - .addColumn(newVarcharColumnDefBuilder().setColumnName("severity").setLimit(10).build()) - .addColumn(newBooleanColumnDefBuilder().setColumnName("manual_severity").setIsNullable(false).build()) - .addColumn(newVarcharColumnDefBuilder().setColumnName("message").setLimit(4000).build()) - .addColumn(newIntegerColumnDefBuilder().setColumnName("line").build()) - .addColumn(newDecimalColumnDefBuilder().setColumnName("gap").build()) - .addColumn(newVarcharColumnDefBuilder().setColumnName("status").setLimit(20).build()) - .addColumn(newVarcharColumnDefBuilder().setColumnName("resolution").setLimit(20).build()) - .addColumn(newVarcharColumnDefBuilder().setColumnName("checksum").setLimit(1000).build()) - .addColumn(newVarcharColumnDefBuilder().setColumnName("reporter").setLimit(255).build()) - .addColumn(newVarcharColumnDefBuilder().setColumnName("assignee").setLimit(255).build()) - .addColumn(newVarcharColumnDefBuilder().setColumnName("author_login").setLimit(255).build()) - .addColumn(newVarcharColumnDefBuilder().setColumnName("action_plan_key").setLimit(50).build()) - .addColumn(newVarcharColumnDefBuilder().setColumnName("issue_attributes").setLimit(4000).build()) - .addColumn(newIntegerColumnDefBuilder().setColumnName("effort").build()) - .addColumn(newBigIntegerColumnDefBuilder().setColumnName("created_at").build()) - .addColumn(newBigIntegerColumnDefBuilder().setColumnName("updated_at").build()) - .addColumn(newBigIntegerColumnDefBuilder().setColumnName("issue_creation_date").build()) - .addColumn(newBigIntegerColumnDefBuilder().setColumnName("issue_update_date").build()) - .addColumn(newBigIntegerColumnDefBuilder().setColumnName("issue_close_date").build()) - .addColumn(newVarcharColumnDefBuilder().setColumnName("tags").setLimit(4000).build()) - .addColumn(newVarcharColumnDefBuilder().setColumnName("component_uuid").setLimit(50).build()) - .addColumn(newVarcharColumnDefBuilder().setColumnName("project_uuid").setLimit(50).build()) - .addColumn(newBlobColumnDefBuilder().setColumnName("locations").build()) - .addColumn(newTinyIntColumnDefBuilder().setColumnName("issue_type").build()) - .addColumn(newBooleanColumnDefBuilder().setColumnName("from_hotspot").build()); - - context.execute(builder.build()); - /* - "KEE VARCHAR(50) NOT NULL", - "RULE_UUID VARCHAR(40)", - "SEVERITY VARCHAR(10)", - "MANUAL_SEVERITY BOOLEAN NOT NULL", - "MESSAGE VARCHAR(4000)", - "LINE INTEGER", - "GAP DOUBLE", - "STATUS VARCHAR(20)", - "RESOLUTION VARCHAR(20)", - "CHECKSUM VARCHAR(1000)", - "REPORTER VARCHAR(255)", - "ASSIGNEE VARCHAR(255)", - "AUTHOR_LOGIN VARCHAR(255)", - "ACTION_PLAN_KEY VARCHAR(50)", - "ISSUE_ATTRIBUTES VARCHAR(4000)", - "EFFORT INTEGER", - "CREATED_AT BIGINT", - "UPDATED_AT BIGINT", - "ISSUE_CREATION_DATE BIGINT", - "ISSUE_UPDATE_DATE BIGINT", - "ISSUE_CLOSE_DATE BIGINT", - "TAGS VARCHAR(4000)", - "COMPONENT_UUID VARCHAR(50)", - "PROJECT_UUID VARCHAR(50)", - "LOCATIONS BLOB", - "ISSUE_TYPE TINYINT", - "FROM_HOTSPOT BOOLEAN" - */ - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/issues/DropIssuesTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/issues/DropIssuesTable.java deleted file mode 100644 index ecfb7ec9897..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/issues/DropIssuesTable.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rules.issues; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.DropTableBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class DropIssuesTable extends DdlChange { - public DropIssuesTable(Database db) { - super(db); - } - - @Override public void execute(Context context) throws SQLException { - context.execute(new DropTableBuilder(getDialect(), "issues").build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/issues/RenameIssuesCopyToIssues.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/issues/RenameIssuesCopyToIssues.java deleted file mode 100644 index b9d18355343..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/issues/RenameIssuesCopyToIssues.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rules.issues; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.RenameTableBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class RenameIssuesCopyToIssues extends DdlChange { - public RenameIssuesCopyToIssues(Database db) { - super(db); - } - - @Override public void execute(Context context) throws SQLException { - context.execute(new RenameTableBuilder(getDialect()) - .setName("issues_copy") - .setNewName("issues") - .setAutoGeneratedId(false) - .build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/issues/package-info.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/issues/package-info.java deleted file mode 100644 index e4a21dc2a13..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/issues/package-info.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rules.issues; - -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/package-info.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/package-info.java deleted file mode 100644 index e3f9ec90363..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/package-info.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rules; - -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/rulesmetadata/AddPrimaryKeyOnUuidAndOrganizationUuidColumnOfRulesMetadataTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/rulesmetadata/AddPrimaryKeyOnUuidAndOrganizationUuidColumnOfRulesMetadataTable.java deleted file mode 100644 index 5116d05cb06..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/rulesmetadata/AddPrimaryKeyOnUuidAndOrganizationUuidColumnOfRulesMetadataTable.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rules.rulesmetadata; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.AddPrimaryKeyBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class AddPrimaryKeyOnUuidAndOrganizationUuidColumnOfRulesMetadataTable extends DdlChange { - - public AddPrimaryKeyOnUuidAndOrganizationUuidColumnOfRulesMetadataTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new AddPrimaryKeyBuilder("rules_metadata", "rule_uuid", "organization_uuid").build()); - } - -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/rulesmetadata/AddRuleUuidColumnToRulesMetadataTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/rulesmetadata/AddRuleUuidColumnToRulesMetadataTable.java deleted file mode 100644 index f173483d117..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/rulesmetadata/AddRuleUuidColumnToRulesMetadataTable.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rules.rulesmetadata; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.def.VarcharColumnDef; -import org.sonar.server.platform.db.migration.sql.AddColumnsBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder; - -public class AddRuleUuidColumnToRulesMetadataTable extends DdlChange { - private static final String TABLE = "rules_metadata"; - - private static final VarcharColumnDef uuidColumnDefinition = newVarcharColumnDefBuilder() - .setColumnName("rule_uuid") - .setIsNullable(true) - .setDefaultValue(null) - .setLimit(VarcharColumnDef.UUID_SIZE) - .build(); - - public AddRuleUuidColumnToRulesMetadataTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new AddColumnsBuilder(getDialect(), TABLE) - .addColumn(uuidColumnDefinition) - .build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/rulesmetadata/DropPrimaryKeyOnIdColumnOfRulesMetadataTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/rulesmetadata/DropPrimaryKeyOnIdColumnOfRulesMetadataTable.java deleted file mode 100644 index 4931a70aeb8..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/rulesmetadata/DropPrimaryKeyOnIdColumnOfRulesMetadataTable.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rules.rulesmetadata; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.DropPrimaryKeySqlGenerator; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class DropPrimaryKeyOnIdColumnOfRulesMetadataTable extends DdlChange { - - private final DropPrimaryKeySqlGenerator dropPrimaryKeySqlGenerator; - - public DropPrimaryKeyOnIdColumnOfRulesMetadataTable(Database db, DropPrimaryKeySqlGenerator dropPrimaryKeySqlGenerator) { - super(db); - this.dropPrimaryKeySqlGenerator = dropPrimaryKeySqlGenerator; - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(dropPrimaryKeySqlGenerator.generate("rules_metadata", "rule_id", false)); - } - -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/rulesmetadata/DropRuleIdColumnOfRulesMetadataTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/rulesmetadata/DropRuleIdColumnOfRulesMetadataTable.java deleted file mode 100644 index 3974d430365..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/rulesmetadata/DropRuleIdColumnOfRulesMetadataTable.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rules.rulesmetadata; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.DropColumnsBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class DropRuleIdColumnOfRulesMetadataTable extends DdlChange { - - public DropRuleIdColumnOfRulesMetadataTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new DropColumnsBuilder(getDialect(), "rules_metadata", "rule_id").build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/rulesmetadata/MakeRulesMetadataRuleUuidColumnNotNullable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/rulesmetadata/MakeRulesMetadataRuleUuidColumnNotNullable.java deleted file mode 100644 index b036030edd8..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/rulesmetadata/MakeRulesMetadataRuleUuidColumnNotNullable.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rules.rulesmetadata; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.def.VarcharColumnDef; -import org.sonar.server.platform.db.migration.sql.AlterColumnsBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder; - -public class MakeRulesMetadataRuleUuidColumnNotNullable extends DdlChange { - private static final String TABLE = "rules_metadata"; - - private static final VarcharColumnDef uuidColumnDefinition = newVarcharColumnDefBuilder() - .setColumnName("rule_uuid") - .setIsNullable(false) - .setDefaultValue(null) - .setLimit(VarcharColumnDef.UUID_SIZE) - .build(); - - public MakeRulesMetadataRuleUuidColumnNotNullable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new AlterColumnsBuilder(getDialect(), TABLE) - .updateColumn(uuidColumnDefinition) - .build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/rulesmetadata/PopulateRulesMetadataRuleUuidColumn.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/rulesmetadata/PopulateRulesMetadataRuleUuidColumn.java deleted file mode 100644 index 3a85c4bff26..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/rulesmetadata/PopulateRulesMetadataRuleUuidColumn.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rules.rulesmetadata; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.step.DataChange; -import org.sonar.server.platform.db.migration.step.MassUpdate; - -public class PopulateRulesMetadataRuleUuidColumn extends DataChange { - - public PopulateRulesMetadataRuleUuidColumn(Database db) { - super(db); - } - - @Override - protected void execute(Context context) throws SQLException { - MassUpdate massUpdate = context.prepareMassUpdate(); - - massUpdate.select("select rm.rule_id, ru.uuid " + - "from rules_metadata rm " + - "join rules ru on rm.rule_id = ru.id " + - "where rm.rule_uuid is null"); - massUpdate.update("update rules_metadata set rule_uuid = ? where rule_id = ?"); - - massUpdate.execute((row, update) -> { - update.setString(1, row.getString(2)); - update.setLong(2, row.getLong(1)); - return true; - }); - - massUpdate = context.prepareMassUpdate(); - - massUpdate.select("select rule_id, organization_uuid from rules_metadata where rule_uuid is null"); - massUpdate.update("delete from rules_metadata where rule_id = ? and organization_uuid = ?"); - - massUpdate.execute((row, update) -> { - update.setLong(1, row.getLong(1)); - update.setString(2, row.getString(2)); - return true; - }); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/rulesmetadata/package-info.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/rulesmetadata/package-info.java deleted file mode 100644 index f60025e1462..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/rulesmetadata/package-info.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rules.rulesmetadata; - -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/rulesparameters/AddIndexesToRulesParametersTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/rulesparameters/AddIndexesToRulesParametersTable.java deleted file mode 100644 index b094469b4fa..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/rulesparameters/AddIndexesToRulesParametersTable.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rules.rulesparameters; - -import java.sql.Connection; -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.db.DatabaseUtils; -import org.sonar.server.platform.db.migration.def.VarcharColumnDef; -import org.sonar.server.platform.db.migration.sql.CreateIndexBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder; - -public class AddIndexesToRulesParametersTable extends DdlChange { - private static final String TABLE = "rules_parameters"; - private static final String RULE_UUID_INDEX = "rules_parameters_rule_uuid"; - private static final String RULE_UUID_NAME_UNIQUE_INDEX = "rules_parameters_unique"; - - private static final VarcharColumnDef uuidColumnDefinition = newVarcharColumnDefBuilder() - .setColumnName("rule_uuid") - .setIsNullable(true) - .setDefaultValue(null) - .setLimit(VarcharColumnDef.UUID_SIZE) - .build(); - - private static final VarcharColumnDef nameColumnDefinition = newVarcharColumnDefBuilder() - .setColumnName("name") - .setLimit(128) - .setIsNullable(false) - .build(); - - public AddIndexesToRulesParametersTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - if (indexDoesNotExist(RULE_UUID_INDEX)) { - context.execute(new CreateIndexBuilder() - .setTable(TABLE) - .setName(RULE_UUID_INDEX) - .addColumn(uuidColumnDefinition) - .build()); - } - - if (indexDoesNotExist(RULE_UUID_NAME_UNIQUE_INDEX)) { - context.execute(new CreateIndexBuilder() - .setTable(TABLE) - .setName(RULE_UUID_NAME_UNIQUE_INDEX) - .addColumn(uuidColumnDefinition) - .addColumn(nameColumnDefinition) - .setUnique(true) - .build()); - } - } - - private boolean indexDoesNotExist(String index) throws SQLException { - try (Connection connection = getDatabase().getDataSource().getConnection()) { - return !DatabaseUtils.indexExistsIgnoreCase(TABLE, index, connection); - } - } - -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/rulesparameters/AddRuleUuidColumnToRulesParametersTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/rulesparameters/AddRuleUuidColumnToRulesParametersTable.java deleted file mode 100644 index ee78d18ab69..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/rulesparameters/AddRuleUuidColumnToRulesParametersTable.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rules.rulesparameters; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.def.VarcharColumnDef; -import org.sonar.server.platform.db.migration.sql.AddColumnsBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder; - -public class AddRuleUuidColumnToRulesParametersTable extends DdlChange { - private static final String TABLE = "rules_parameters"; - - private static final VarcharColumnDef uuidColumnDefinition = newVarcharColumnDefBuilder() - .setColumnName("rule_uuid") - .setIsNullable(true) - .setDefaultValue(null) - .setLimit(VarcharColumnDef.UUID_SIZE) - .build(); - - public AddRuleUuidColumnToRulesParametersTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new AddColumnsBuilder(getDialect(), TABLE) - .addColumn(uuidColumnDefinition) - .build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/rulesparameters/DropIndexesOnRuleIdColumnOfRulesParametersTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/rulesparameters/DropIndexesOnRuleIdColumnOfRulesParametersTable.java deleted file mode 100644 index d2ae614de98..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/rulesparameters/DropIndexesOnRuleIdColumnOfRulesParametersTable.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rules.rulesparameters; - -import java.sql.Connection; -import java.sql.SQLException; -import java.util.Optional; -import java.util.function.Consumer; -import org.sonar.db.Database; -import org.sonar.db.DatabaseUtils; -import org.sonar.server.platform.db.migration.sql.DropIndexBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class DropIndexesOnRuleIdColumnOfRulesParametersTable extends DdlChange { - private static final String TABLE_NAME = "rules_parameters"; - - public DropIndexesOnRuleIdColumnOfRulesParametersTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - Consumer dropIndex = idx -> context.execute(new DropIndexBuilder(getDialect()) - .setTable(TABLE_NAME) - .setName(idx) - .build()); - - findExistingIndexName("rules_parameters_rule_id").ifPresent(dropIndex); - findExistingIndexName("rules_parameters_unique").ifPresent(dropIndex); - } - - private Optional findExistingIndexName(String indexName) throws SQLException { - try (Connection connection = getDatabase().getDataSource().getConnection()) { - return DatabaseUtils.findExistingIndex(connection, TABLE_NAME, indexName); - } - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/rulesparameters/DropRuleIdColumnOfRulesParametersTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/rulesparameters/DropRuleIdColumnOfRulesParametersTable.java deleted file mode 100644 index 2554edfbce6..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/rulesparameters/DropRuleIdColumnOfRulesParametersTable.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rules.rulesparameters; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.DropColumnsBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class DropRuleIdColumnOfRulesParametersTable extends DdlChange { - - public DropRuleIdColumnOfRulesParametersTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new DropColumnsBuilder(getDialect(), "rules_parameters", "rule_id").build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/rulesparameters/MakeRulesParametersRuleUuidColumnNotNullable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/rulesparameters/MakeRulesParametersRuleUuidColumnNotNullable.java deleted file mode 100644 index 61dc356ac88..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/rulesparameters/MakeRulesParametersRuleUuidColumnNotNullable.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rules.rulesparameters; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.def.VarcharColumnDef; -import org.sonar.server.platform.db.migration.sql.AlterColumnsBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder; - -public class MakeRulesParametersRuleUuidColumnNotNullable extends DdlChange { - private static final String TABLE = "rules_parameters"; - - private static final VarcharColumnDef uuidColumnDefinition = newVarcharColumnDefBuilder() - .setColumnName("rule_uuid") - .setIsNullable(false) - .setDefaultValue(null) - .setLimit(VarcharColumnDef.UUID_SIZE) - .build(); - - public MakeRulesParametersRuleUuidColumnNotNullable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new AlterColumnsBuilder(getDialect(), TABLE) - .updateColumn(uuidColumnDefinition) - .build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/rulesparameters/PopulateRulesParametersRuleUuidColumn.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/rulesparameters/PopulateRulesParametersRuleUuidColumn.java deleted file mode 100644 index f2b32a0e519..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/rulesparameters/PopulateRulesParametersRuleUuidColumn.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rules.rulesparameters; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.step.DataChange; -import org.sonar.server.platform.db.migration.step.MassUpdate; - -public class PopulateRulesParametersRuleUuidColumn extends DataChange { - - public PopulateRulesParametersRuleUuidColumn(Database db) { - super(db); - } - - @Override - protected void execute(Context context) throws SQLException { - populateUuids(context); - removeOrphans(context); - } - - private void populateUuids(Context context) throws SQLException { - MassUpdate massUpdate = context.prepareMassUpdate(); - - massUpdate.select("select rp.rule_id, ru.uuid " + - "from rules_parameters rp " + - "join rules ru on rp.rule_id = ru.id " + - "where rp.rule_uuid is null"); - massUpdate.update("update rules_parameters set rule_uuid = ? where rule_id = ?"); - - massUpdate.execute((row, update) -> { - update.setString(1, row.getString(2)); - update.setLong(2, row.getLong(1)); - return true; - }); - } - - private void removeOrphans(DataChange.Context context) throws SQLException { - MassUpdate massUpdate = context.prepareMassUpdate(); - - massUpdate.select("select uuid from rules_parameters where rule_uuid is null"); - massUpdate.update("delete from rules_parameters where uuid = ?"); - - massUpdate.execute((row, update) -> { - update.setString(1, row.getString(1)); - return true; - }); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/rulesparameters/package-info.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/rulesparameters/package-info.java deleted file mode 100644 index 55aa445f612..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rules/rulesparameters/package-info.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rules.rulesparameters; - -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesparameters/AddPrimaryKeyOnUuidColumnOfRulesParametersTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesparameters/AddPrimaryKeyOnUuidColumnOfRulesParametersTable.java deleted file mode 100644 index 531c42bdaa1..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesparameters/AddPrimaryKeyOnUuidColumnOfRulesParametersTable.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rulesparameters; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.AddPrimaryKeyBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class AddPrimaryKeyOnUuidColumnOfRulesParametersTable extends DdlChange { - - public AddPrimaryKeyOnUuidColumnOfRulesParametersTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new AddPrimaryKeyBuilder("rules_parameters", "uuid").build()); - } - -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesparameters/AddUuidColumnToRulesParameters.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesparameters/AddUuidColumnToRulesParameters.java deleted file mode 100644 index 9698987c1aa..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesparameters/AddUuidColumnToRulesParameters.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rulesparameters; - -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.version.v84.common.AddUuidColumnToTable; - -public class AddUuidColumnToRulesParameters extends AddUuidColumnToTable { - private static final String TABLE_NAME = "rules_parameters"; - - public AddUuidColumnToRulesParameters(Database db) { - super(db, TABLE_NAME); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesparameters/DropIdColumnOfRulesParametersTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesparameters/DropIdColumnOfRulesParametersTable.java deleted file mode 100644 index 092ee39430b..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesparameters/DropIdColumnOfRulesParametersTable.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rulesparameters; - -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.version.v84.common.DropIdColumn; - -public class DropIdColumnOfRulesParametersTable extends DropIdColumn { - private static final String TABLE_NAME = "rules_parameters"; - - public DropIdColumnOfRulesParametersTable(Database db) { - super(db, TABLE_NAME); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesparameters/DropPrimaryKeyOnIdColumnOfRulesParametersTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesparameters/DropPrimaryKeyOnIdColumnOfRulesParametersTable.java deleted file mode 100644 index a4e8bcef827..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesparameters/DropPrimaryKeyOnIdColumnOfRulesParametersTable.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rulesparameters; - -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.DropPrimaryKeySqlGenerator; -import org.sonar.server.platform.db.migration.version.v84.common.DropPrimaryKeyOnIdColumn; - -public class DropPrimaryKeyOnIdColumnOfRulesParametersTable extends DropPrimaryKeyOnIdColumn { - private static final String TABLE_NAME = "rules_parameters"; - - public DropPrimaryKeyOnIdColumnOfRulesParametersTable(Database db, DropPrimaryKeySqlGenerator dropPrimaryKeySqlGenerator) { - super(db, dropPrimaryKeySqlGenerator, TABLE_NAME); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesparameters/MakeRulesParametersUuidColumnNotNullable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesparameters/MakeRulesParametersUuidColumnNotNullable.java deleted file mode 100644 index 8cb96ebfb14..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesparameters/MakeRulesParametersUuidColumnNotNullable.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rulesparameters; - -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.version.v84.common.MakeUuidColumnNotNullable; - -public class MakeRulesParametersUuidColumnNotNullable extends MakeUuidColumnNotNullable { - private static final String TABLE_NAME = "rules_parameters"; - - public MakeRulesParametersUuidColumnNotNullable(Database db) { - super(db, TABLE_NAME); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesparameters/PopulateRulesParametersUuid.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesparameters/PopulateRulesParametersUuid.java deleted file mode 100644 index d41e944349d..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesparameters/PopulateRulesParametersUuid.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rulesparameters; - -import java.sql.SQLException; -import org.sonar.core.util.UuidFactory; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.step.DataChange; -import org.sonar.server.platform.db.migration.step.MassUpdate; - -public class PopulateRulesParametersUuid extends DataChange { - - private final UuidFactory uuidFactory; - - public PopulateRulesParametersUuid(Database db, UuidFactory uuidFactory) { - super(db); - this.uuidFactory = uuidFactory; - } - - @Override - protected void execute(Context context) throws SQLException { - MassUpdate massUpdate = context.prepareMassUpdate(); - - massUpdate.select("select id from rules_parameters where uuid is null"); - massUpdate.update("update rules_parameters set uuid = ? where id = ?"); - - massUpdate.execute((row, update) -> { - update.setString(1, uuidFactory.create()); - update.setLong(2, row.getLong(1)); - return true; - }); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesparameters/fk/AddRulesParameterUuidColumnToActiveRuleParameters.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesparameters/fk/AddRulesParameterUuidColumnToActiveRuleParameters.java deleted file mode 100644 index f1c1af814d4..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesparameters/fk/AddRulesParameterUuidColumnToActiveRuleParameters.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rulesparameters.fk; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.def.VarcharColumnDef; -import org.sonar.server.platform.db.migration.sql.AddColumnsBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder; - -public class AddRulesParameterUuidColumnToActiveRuleParameters extends DdlChange { - private static final String TABLE = "active_rule_parameters"; - - private static final VarcharColumnDef uuidColumnDefinition = newVarcharColumnDefBuilder() - .setColumnName("rules_parameter_uuid") - .setIsNullable(true) - .setDefaultValue(null) - .setLimit(VarcharColumnDef.UUID_SIZE) - .build(); - - public AddRulesParameterUuidColumnToActiveRuleParameters(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new AddColumnsBuilder(getDialect(), TABLE) - .addColumn(uuidColumnDefinition) - .build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesparameters/fk/DropRulesParameterIdColumnOfActiveRuleParametersTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesparameters/fk/DropRulesParameterIdColumnOfActiveRuleParametersTable.java deleted file mode 100644 index 7bc26731865..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesparameters/fk/DropRulesParameterIdColumnOfActiveRuleParametersTable.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rulesparameters.fk; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.DropColumnsBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class DropRulesParameterIdColumnOfActiveRuleParametersTable extends DdlChange { - - public DropRulesParameterIdColumnOfActiveRuleParametersTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new DropColumnsBuilder(getDialect(), "active_rule_parameters", "rules_parameter_id").build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesparameters/fk/MakeActiveRuleParametersRulesParameterUuidColumnNotNullable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesparameters/fk/MakeActiveRuleParametersRulesParameterUuidColumnNotNullable.java deleted file mode 100644 index 320169c1893..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesparameters/fk/MakeActiveRuleParametersRulesParameterUuidColumnNotNullable.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rulesparameters.fk; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.def.VarcharColumnDef; -import org.sonar.server.platform.db.migration.sql.AlterColumnsBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder; - -public class MakeActiveRuleParametersRulesParameterUuidColumnNotNullable extends DdlChange { - private static final String TABLE = "active_rule_parameters"; - - private static final VarcharColumnDef uuidColumnDefinition = newVarcharColumnDefBuilder() - .setColumnName("rules_parameter_uuid") - .setIsNullable(false) - .setDefaultValue(null) - .setLimit(VarcharColumnDef.UUID_SIZE) - .build(); - - public MakeActiveRuleParametersRulesParameterUuidColumnNotNullable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new AlterColumnsBuilder(getDialect(), TABLE) - .updateColumn(uuidColumnDefinition) - .build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesparameters/fk/PopulateActiveRuleParametersRulesParameterUuid.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesparameters/fk/PopulateActiveRuleParametersRulesParameterUuid.java deleted file mode 100644 index b3d24475b02..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesparameters/fk/PopulateActiveRuleParametersRulesParameterUuid.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rulesparameters.fk; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.step.DataChange; -import org.sonar.server.platform.db.migration.step.MassUpdate; - -public class PopulateActiveRuleParametersRulesParameterUuid extends DataChange { - - public PopulateActiveRuleParametersRulesParameterUuid(Database db) { - super(db); - } - - @Override - protected void execute(Context context) throws SQLException { - MassUpdate massUpdate = context.prepareMassUpdate(); - - massUpdate.select("select arp.uuid, rp.uuid " + - "from active_rule_parameters arp " + - "join rules_parameters rp on arp.rules_parameter_id = rp.id " + - "where arp.rules_parameter_uuid is null"); - massUpdate.update("update active_rule_parameters set rules_parameter_uuid = ? where uuid = ?"); - - massUpdate.execute((row, update) -> { - update.setString(1, row.getString(2)); - update.setString(2, row.getString(1)); - return true; - }); - - massUpdate = context.prepareMassUpdate(); - - massUpdate.select("select uuid from active_rule_parameters where rules_parameter_uuid is null"); - massUpdate.update("delete from active_rule_parameters where uuid = ?"); - - massUpdate.execute((row, update) -> { - update.setString(1, row.getString(1)); - return true; - }); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesparameters/fk/package-info.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesparameters/fk/package-info.java deleted file mode 100644 index 0233ec0345c..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesparameters/fk/package-info.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rulesparameters.fk; - -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesparameters/package-info.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesparameters/package-info.java deleted file mode 100644 index b4f98fbd6e3..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesparameters/package-info.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rulesparameters; - -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/AddPrimaryKeyOnUuidColumnOfRulesProfilesTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/AddPrimaryKeyOnUuidColumnOfRulesProfilesTable.java deleted file mode 100644 index 4b29b47f02d..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/AddPrimaryKeyOnUuidColumnOfRulesProfilesTable.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rulesprofiles; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.AddPrimaryKeyBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class AddPrimaryKeyOnUuidColumnOfRulesProfilesTable extends DdlChange { - - public AddPrimaryKeyOnUuidColumnOfRulesProfilesTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new AddPrimaryKeyBuilder("rules_profiles", "uuid").build()); - } - -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/AddUuidColumnToRulesProfilesTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/AddUuidColumnToRulesProfilesTable.java deleted file mode 100644 index b13ce1cb8bf..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/AddUuidColumnToRulesProfilesTable.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rulesprofiles; - -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.version.v84.common.AddUuidColumnToTable; - -public class AddUuidColumnToRulesProfilesTable extends AddUuidColumnToTable { - private static final String TABLE = "rules_profiles"; - - public AddUuidColumnToRulesProfilesTable(Database db) { - super(db, TABLE); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/DropIdColumnOfRulesProfilesTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/DropIdColumnOfRulesProfilesTable.java deleted file mode 100644 index ad272197943..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/DropIdColumnOfRulesProfilesTable.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rulesprofiles; - -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.version.v84.common.DropIdColumn; - -public class DropIdColumnOfRulesProfilesTable extends DropIdColumn { - - private static final String TABLE_NAME = "rules_profiles"; - - public DropIdColumnOfRulesProfilesTable(Database db) { - super(db, TABLE_NAME); - } - -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/DropKeeColumnOfRulesProfilesTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/DropKeeColumnOfRulesProfilesTable.java deleted file mode 100644 index e39b12c8b2a..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/DropKeeColumnOfRulesProfilesTable.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rulesprofiles; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.DropColumnsBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class DropKeeColumnOfRulesProfilesTable extends DdlChange { - - private Database db; - - public DropKeeColumnOfRulesProfilesTable(Database db) { - super(db); - this.db = db; - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new DropColumnsBuilder(db.getDialect(), "rules_profiles", "kee").build()); - } - -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/DropPrimaryKeyOnIdColumnOfRulesProfilesTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/DropPrimaryKeyOnIdColumnOfRulesProfilesTable.java deleted file mode 100644 index ae0080af1ec..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/DropPrimaryKeyOnIdColumnOfRulesProfilesTable.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rulesprofiles; - -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.DropPrimaryKeySqlGenerator; -import org.sonar.server.platform.db.migration.version.v84.common.DropPrimaryKeyOnIdColumn; - -public class DropPrimaryKeyOnIdColumnOfRulesProfilesTable extends DropPrimaryKeyOnIdColumn { - private static final String TABLE_NAME = "rules_profiles"; - - public DropPrimaryKeyOnIdColumnOfRulesProfilesTable(Database db, DropPrimaryKeySqlGenerator dropPrimaryKeySqlGenerator) { - super(db, dropPrimaryKeySqlGenerator, TABLE_NAME); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/DropUniqueIndexOnKeeColumnOfRulesProfilesTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/DropUniqueIndexOnKeeColumnOfRulesProfilesTable.java deleted file mode 100644 index 5de1b6bf93e..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/DropUniqueIndexOnKeeColumnOfRulesProfilesTable.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rulesprofiles; - -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.step.DropIndexChange; - -public class DropUniqueIndexOnKeeColumnOfRulesProfilesTable extends DropIndexChange { - private static final String TABLE_NAME = "rules_profiles"; - private static final String INDEX_NAME = "uniq_qprof_key"; - - public DropUniqueIndexOnKeeColumnOfRulesProfilesTable(Database db) { - super(db, INDEX_NAME, TABLE_NAME); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/MakeRulesProfilesUuidColumnNotNullable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/MakeRulesProfilesUuidColumnNotNullable.java deleted file mode 100644 index a9c3edee677..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/MakeRulesProfilesUuidColumnNotNullable.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rulesprofiles; - -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.version.v84.common.MakeUuidColumnNotNullable; - -public class MakeRulesProfilesUuidColumnNotNullable extends MakeUuidColumnNotNullable { - private static final String TABLE_NAME = "rules_profiles"; - - public MakeRulesProfilesUuidColumnNotNullable(Database db) { - super(db, TABLE_NAME); - } - -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/PopulateRulesProfilesUuid.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/PopulateRulesProfilesUuid.java deleted file mode 100644 index c375e55a868..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/PopulateRulesProfilesUuid.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rulesprofiles; - -import java.sql.SQLException; -import org.sonar.core.util.UuidFactory; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.step.DataChange; -import org.sonar.server.platform.db.migration.step.MassUpdate; - -public class PopulateRulesProfilesUuid extends DataChange { - - private final UuidFactory uuidFactory; - - public PopulateRulesProfilesUuid(Database db, UuidFactory uuidFactory) { - super(db); - this.uuidFactory = uuidFactory; - } - - @Override - protected void execute(Context context) throws SQLException { - MassUpdate massUpdate = context.prepareMassUpdate(); - - massUpdate.select("select id from rules_profiles where uuid is null"); - massUpdate.update("update rules_profiles set uuid = ? where id = ?"); - - massUpdate.execute((row, update) -> { - update.setString(1, uuidFactory.create()); - update.setLong(2, row.getLong(1)); - return true; - }); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/fk/activerules/AddProfileUuidColumnToActiveRulesTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/fk/activerules/AddProfileUuidColumnToActiveRulesTable.java deleted file mode 100644 index 6e803cd6b0c..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/fk/activerules/AddProfileUuidColumnToActiveRulesTable.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rulesprofiles.fk.activerules; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.def.VarcharColumnDef; -import org.sonar.server.platform.db.migration.sql.AddColumnsBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder; - -public class AddProfileUuidColumnToActiveRulesTable extends DdlChange { - private static final String TABLE = "active_rules"; - - private static final VarcharColumnDef uuidColumnDefinition = newVarcharColumnDefBuilder() - .setColumnName("profile_uuid") - .setIsNullable(true) - .setDefaultValue(null) - .setLimit(VarcharColumnDef.UUID_SIZE) - .build(); - - public AddProfileUuidColumnToActiveRulesTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new AddColumnsBuilder(getDialect(), TABLE) - .addColumn(uuidColumnDefinition) - .build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/fk/activerules/AddUniqueIndexOnProfileUuidColumnOfActiveRulesTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/fk/activerules/AddUniqueIndexOnProfileUuidColumnOfActiveRulesTable.java deleted file mode 100644 index ec3e23b01c5..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/fk/activerules/AddUniqueIndexOnProfileUuidColumnOfActiveRulesTable.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rulesprofiles.fk.activerules; - -import java.sql.Connection; -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.db.DatabaseUtils; -import org.sonar.server.platform.db.migration.def.IntegerColumnDef; -import org.sonar.server.platform.db.migration.def.VarcharColumnDef; -import org.sonar.server.platform.db.migration.sql.CreateIndexBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder; - -public class AddUniqueIndexOnProfileUuidColumnOfActiveRulesTable extends DdlChange { - private static final String TABLE_NAME = "active_rules"; - private static final String INDEX_NAME = "uniq_profile_rule_ids"; - - public AddUniqueIndexOnProfileUuidColumnOfActiveRulesTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - if (!indexExists()) { - context.execute(new CreateIndexBuilder() - .setUnique(true) - .setTable(TABLE_NAME) - .setName(INDEX_NAME) - .addColumn(newVarcharColumnDefBuilder() - .setColumnName("profile_uuid") - .setIsNullable(false) - .setLimit(VarcharColumnDef.UUID_SIZE) - .build()) - .addColumn(IntegerColumnDef.newIntegerColumnDefBuilder() - .setColumnName("rule_id") - .setIsNullable(false) - .build()) - .build()); - } - - } - - private boolean indexExists() throws SQLException { - try (Connection connection = getDatabase().getDataSource().getConnection()) { - return DatabaseUtils.indexExistsIgnoreCase(TABLE_NAME, INDEX_NAME, connection); - } - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/fk/activerules/DropProfileIdColumnOfActiveRulesTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/fk/activerules/DropProfileIdColumnOfActiveRulesTable.java deleted file mode 100644 index b42054032b1..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/fk/activerules/DropProfileIdColumnOfActiveRulesTable.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rulesprofiles.fk.activerules; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.DropColumnsBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class DropProfileIdColumnOfActiveRulesTable extends DdlChange { - - private Database db; - - public DropProfileIdColumnOfActiveRulesTable(Database db) { - super(db); - this.db = db; - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new DropColumnsBuilder(db.getDialect(), "active_rules", "profile_id").build()); - } - -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/fk/activerules/DropUniqueIndexOnProfileIdColumnOfActiveRulesTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/fk/activerules/DropUniqueIndexOnProfileIdColumnOfActiveRulesTable.java deleted file mode 100644 index 4a773ddab7e..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/fk/activerules/DropUniqueIndexOnProfileIdColumnOfActiveRulesTable.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rulesprofiles.fk.activerules; - -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.step.DropIndexChange; - -public class DropUniqueIndexOnProfileIdColumnOfActiveRulesTable extends DropIndexChange { - private static final String TABLE_NAME = "active_rules"; - private static final String INDEX_NAME = "uniq_profile_rule_ids"; - - public DropUniqueIndexOnProfileIdColumnOfActiveRulesTable(Database db) { - super(db, INDEX_NAME, TABLE_NAME); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/fk/activerules/MakeActiveRulesProfileUuidColumnNotNullable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/fk/activerules/MakeActiveRulesProfileUuidColumnNotNullable.java deleted file mode 100644 index b68b2f5b687..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/fk/activerules/MakeActiveRulesProfileUuidColumnNotNullable.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rulesprofiles.fk.activerules; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.def.VarcharColumnDef; -import org.sonar.server.platform.db.migration.sql.AlterColumnsBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder; - -public class MakeActiveRulesProfileUuidColumnNotNullable extends DdlChange { - private static final String TABLE = "active_rules"; - - private static final VarcharColumnDef uuidColumnDefinition = newVarcharColumnDefBuilder() - .setColumnName("profile_uuid") - .setIsNullable(false) - .setDefaultValue(null) - .setLimit(VarcharColumnDef.UUID_SIZE) - .build(); - - public MakeActiveRulesProfileUuidColumnNotNullable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new AlterColumnsBuilder(getDialect(), TABLE) - .updateColumn(uuidColumnDefinition) - .build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/fk/activerules/PopulateActiveRulesProfileUuid.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/fk/activerules/PopulateActiveRulesProfileUuid.java deleted file mode 100644 index abd49999524..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/fk/activerules/PopulateActiveRulesProfileUuid.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rulesprofiles.fk.activerules; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.step.DataChange; -import org.sonar.server.platform.db.migration.step.MassUpdate; - -public class PopulateActiveRulesProfileUuid extends DataChange { - - public PopulateActiveRulesProfileUuid(Database db) { - super(db); - } - - @Override - protected void execute(Context context) throws SQLException { - MassUpdate massUpdate = context.prepareMassUpdate(); - - massUpdate.select("select ar.uuid, rp.uuid " + - "from active_rules ar " + - "join rules_profiles rp on ar.profile_id = rp.id " + - "where ar.profile_uuid is null"); - massUpdate.update("update active_rules set profile_uuid = ? where uuid = ?"); - - massUpdate.execute((row, update) -> { - update.setString(1, row.getString(2)); - update.setString(2, row.getString(1)); - return true; - }); - - massUpdate = context.prepareMassUpdate(); - - massUpdate.select("select uuid from active_rules where profile_uuid is null"); - massUpdate.update("delete from active_rules where uuid = ?"); - - massUpdate.execute((row, update) -> { - update.setString(1, row.getString(1)); - return true; - }); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/fk/activerules/package-info.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/fk/activerules/package-info.java deleted file mode 100644 index 8c33f055264..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/fk/activerules/package-info.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rulesprofiles.fk.activerules; - -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/fk/orgqprofiles/PopulateOrgQProfilesRulesProfileUuid.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/fk/orgqprofiles/PopulateOrgQProfilesRulesProfileUuid.java deleted file mode 100644 index 509633a74a8..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/fk/orgqprofiles/PopulateOrgQProfilesRulesProfileUuid.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rulesprofiles.fk.orgqprofiles; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.step.DataChange; -import org.sonar.server.platform.db.migration.step.MassUpdate; - -public class PopulateOrgQProfilesRulesProfileUuid extends DataChange { - - public PopulateOrgQProfilesRulesProfileUuid(Database db) { - super(db); - } - - @Override - protected void execute(DataChange.Context context) throws SQLException { - MassUpdate massUpdate = context.prepareMassUpdate(); - - massUpdate.select("select oqp.uuid, rp.uuid " + - "from org_qprofiles oqp " + - "join rules_profiles rp on oqp.rules_profile_uuid = rp.kee"); - massUpdate.update("update org_qprofiles set rules_profile_uuid = ? where uuid = ?"); - - massUpdate.execute((row, update) -> { - update.setString(1, row.getString(2)); - update.setString(2, row.getString(1)); - return true; - }); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/fk/orgqprofiles/package-info.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/fk/orgqprofiles/package-info.java deleted file mode 100644 index e907cf41914..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/fk/orgqprofiles/package-info.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rulesprofiles.fk.orgqprofiles; - -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/fk/package-info.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/fk/package-info.java deleted file mode 100644 index 25480040765..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/fk/package-info.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rulesprofiles.fk; - -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/fk/qprofilechanges/PopulateQProfileChangesRulesProfileUuid.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/fk/qprofilechanges/PopulateQProfileChangesRulesProfileUuid.java deleted file mode 100644 index af1c9d9d5b3..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/fk/qprofilechanges/PopulateQProfileChangesRulesProfileUuid.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rulesprofiles.fk.qprofilechanges; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.step.DataChange; -import org.sonar.server.platform.db.migration.step.MassUpdate; - -public class PopulateQProfileChangesRulesProfileUuid extends DataChange { - - public PopulateQProfileChangesRulesProfileUuid(Database db) { - super(db); - } - - @Override - protected void execute(DataChange.Context context) throws SQLException { - MassUpdate massUpdate = context.prepareMassUpdate(); - - massUpdate.select("select qpc.kee, rp.uuid " + - "from qprofile_changes qpc " + - "join rules_profiles rp on qpc.rules_profile_uuid = rp.kee"); - massUpdate.update("update qprofile_changes set rules_profile_uuid = ? where kee = ?"); - - massUpdate.execute((row, update) -> { - update.setString(1, row.getString(2)); - update.setString(2, row.getString(1)); - return true; - }); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/fk/qprofilechanges/package-info.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/fk/qprofilechanges/package-info.java deleted file mode 100644 index cd0f3d9fd16..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/fk/qprofilechanges/package-info.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rulesprofiles.fk.qprofilechanges; - -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/package-info.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/package-info.java deleted file mode 100644 index 56baf605405..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/package-info.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rulesprofiles; - -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/snapshots/issues/AddPrimaryKeyOnUuidColumnOfSnapshotsTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/snapshots/issues/AddPrimaryKeyOnUuidColumnOfSnapshotsTable.java deleted file mode 100644 index 8782ac9d85e..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/snapshots/issues/AddPrimaryKeyOnUuidColumnOfSnapshotsTable.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.snapshots.issues; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.AddPrimaryKeyBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class AddPrimaryKeyOnUuidColumnOfSnapshotsTable extends DdlChange { - - public AddPrimaryKeyOnUuidColumnOfSnapshotsTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new AddPrimaryKeyBuilder("snapshots", "uuid").build()); - } - -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/snapshots/issues/DropIdColumnOfSnapshotsTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/snapshots/issues/DropIdColumnOfSnapshotsTable.java deleted file mode 100644 index aad5190eed1..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/snapshots/issues/DropIdColumnOfSnapshotsTable.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.snapshots.issues; - -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.version.v84.common.DropIdColumn; - -public class DropIdColumnOfSnapshotsTable extends DropIdColumn { - private static final String TABLE = "snapshots"; - - public DropIdColumnOfSnapshotsTable(Database db) { - super(db, TABLE); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/snapshots/issues/DropPrimaryKeyOnIdColumnOfSnapshotsTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/snapshots/issues/DropPrimaryKeyOnIdColumnOfSnapshotsTable.java deleted file mode 100644 index 7cded5f7ab0..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/snapshots/issues/DropPrimaryKeyOnIdColumnOfSnapshotsTable.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.snapshots.issues; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.DropPrimaryKeySqlGenerator; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class DropPrimaryKeyOnIdColumnOfSnapshotsTable extends DdlChange { - - private final DropPrimaryKeySqlGenerator dropPrimaryKeySqlGenerator; - - public DropPrimaryKeyOnIdColumnOfSnapshotsTable(Database db, DropPrimaryKeySqlGenerator dropPrimaryKeySqlGenerator) { - super(db); - this.dropPrimaryKeySqlGenerator = dropPrimaryKeySqlGenerator; - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(dropPrimaryKeySqlGenerator.generate("snapshots", "id", true)); - } - -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/snapshots/issues/package-info.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/snapshots/issues/package-info.java deleted file mode 100644 index b035563e3eb..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/snapshots/issues/package-info.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.snapshots.issues; - -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/snapshots/package-info.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/snapshots/package-info.java deleted file mode 100644 index 4b336e03ac3..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/snapshots/package-info.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.snapshots; - -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/userroles/AddPrimaryKeyOnUuidColumnOfUserRolesTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/userroles/AddPrimaryKeyOnUuidColumnOfUserRolesTable.java deleted file mode 100644 index f4f5bbdc8f5..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/userroles/AddPrimaryKeyOnUuidColumnOfUserRolesTable.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.userroles; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.AddPrimaryKeyBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class AddPrimaryKeyOnUuidColumnOfUserRolesTable extends DdlChange { - - public AddPrimaryKeyOnUuidColumnOfUserRolesTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new AddPrimaryKeyBuilder("user_roles", "uuid").build()); - } - -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/userroles/AddUuidColumnToUserRolesTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/userroles/AddUuidColumnToUserRolesTable.java deleted file mode 100644 index ffcf055d092..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/userroles/AddUuidColumnToUserRolesTable.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.userroles; - -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.version.v84.common.AddUuidColumnToTable; - -public class AddUuidColumnToUserRolesTable extends AddUuidColumnToTable { - private static final String TABLE = "user_roles"; - - public AddUuidColumnToUserRolesTable(Database db) { - super(db, TABLE); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/userroles/DropIdColumnOfUserRolesTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/userroles/DropIdColumnOfUserRolesTable.java deleted file mode 100644 index f69c611b984..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/userroles/DropIdColumnOfUserRolesTable.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.userroles; - -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.version.v84.common.DropIdColumn; - -public class DropIdColumnOfUserRolesTable extends DropIdColumn { - public DropIdColumnOfUserRolesTable(Database db) { - super(db, "user_roles"); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/userroles/DropPrimaryKeyOnIdColumnOfUserRolesTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/userroles/DropPrimaryKeyOnIdColumnOfUserRolesTable.java deleted file mode 100644 index 3d6958fe761..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/userroles/DropPrimaryKeyOnIdColumnOfUserRolesTable.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.userroles; - -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.DropPrimaryKeySqlGenerator; -import org.sonar.server.platform.db.migration.version.v84.common.DropPrimaryKeyOnIdColumn; - -public class DropPrimaryKeyOnIdColumnOfUserRolesTable extends DropPrimaryKeyOnIdColumn { - private static final String TABLE_NAME = "user_roles"; - - public DropPrimaryKeyOnIdColumnOfUserRolesTable(Database db, DropPrimaryKeySqlGenerator dropPrimaryKeySqlGenerator) { - super(db, dropPrimaryKeySqlGenerator, TABLE_NAME); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/userroles/MakeUserRolesUuidColumnNotNullable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/userroles/MakeUserRolesUuidColumnNotNullable.java deleted file mode 100644 index 4d13bb2530f..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/userroles/MakeUserRolesUuidColumnNotNullable.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.userroles; - -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.version.v84.common.MakeUuidColumnNotNullable; - -public class MakeUserRolesUuidColumnNotNullable extends MakeUuidColumnNotNullable { - private static final String TABLE = "user_roles"; - - public MakeUserRolesUuidColumnNotNullable(Database db) { - super(db, TABLE); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/userroles/PopulateUserRolesUuid.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/userroles/PopulateUserRolesUuid.java deleted file mode 100644 index c851dd7e15d..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/userroles/PopulateUserRolesUuid.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.userroles; - -import java.sql.SQLException; -import org.sonar.core.util.UuidFactory; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.step.DataChange; -import org.sonar.server.platform.db.migration.step.MassUpdate; - -public class PopulateUserRolesUuid extends DataChange { - - private final UuidFactory uuidFactory; - - public PopulateUserRolesUuid(Database db, UuidFactory uuidFactory) { - super(db); - this.uuidFactory = uuidFactory; - } - - @Override - protected void execute(Context context) throws SQLException { - MassUpdate massUpdate = context.prepareMassUpdate(); - - massUpdate.select("select id from user_roles where uuid is null"); - massUpdate.update("update user_roles set uuid = ? where id = ?"); - - massUpdate.execute((row, update) -> { - update.setString(1, uuidFactory.create()); - update.setLong(2, row.getLong(1)); - return true; - }); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/userroles/package-info.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/userroles/package-info.java deleted file mode 100644 index fdbc4784ca4..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/userroles/package-info.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.userroles; - -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/AddPrimaryKeyOnUuidColumnOfUsersTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/AddPrimaryKeyOnUuidColumnOfUsersTable.java deleted file mode 100644 index a3508db6ab7..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/AddPrimaryKeyOnUuidColumnOfUsersTable.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.users; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.AddPrimaryKeyBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class AddPrimaryKeyOnUuidColumnOfUsersTable extends DdlChange { - - public AddPrimaryKeyOnUuidColumnOfUsersTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new AddPrimaryKeyBuilder("users", "uuid").build()); - } - -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/DropIdColumnOfUsersTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/DropIdColumnOfUsersTable.java deleted file mode 100644 index dd8d96f0616..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/DropIdColumnOfUsersTable.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.users; - -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.version.v84.common.DropIdColumn; - -public class DropIdColumnOfUsersTable extends DropIdColumn { - - private static final String TABLE_NAME = "users"; - - public DropIdColumnOfUsersTable(Database db) { - super(db, TABLE_NAME); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/DropPrimaryKeyOnIdColumnOfUsersTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/DropPrimaryKeyOnIdColumnOfUsersTable.java deleted file mode 100644 index 40a3b1576a2..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/DropPrimaryKeyOnIdColumnOfUsersTable.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.users; - -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.DropPrimaryKeySqlGenerator; -import org.sonar.server.platform.db.migration.version.v84.common.DropPrimaryKeyOnIdColumn; - -public class DropPrimaryKeyOnIdColumnOfUsersTable extends DropPrimaryKeyOnIdColumn { - - private static final String TABLE_NAME = "users"; - - public DropPrimaryKeyOnIdColumnOfUsersTable(Database db, DropPrimaryKeySqlGenerator dropPrimaryKeySqlGenerator) { - super(db, dropPrimaryKeySqlGenerator, TABLE_NAME); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/DropUniqueIndexOnUuidColumnOfUsersTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/DropUniqueIndexOnUuidColumnOfUsersTable.java deleted file mode 100644 index fce3d7bf8e9..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/DropUniqueIndexOnUuidColumnOfUsersTable.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.users; - -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.step.DropIndexChange; - -public class DropUniqueIndexOnUuidColumnOfUsersTable extends DropIndexChange { - - private static final String TABLE_NAME = "users"; - private static final String INDEX_NAME = "users_uuid"; - - public DropUniqueIndexOnUuidColumnOfUsersTable(Database db) { - super(db, INDEX_NAME, TABLE_NAME); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/groupsusers/AddIndexOnUserUuidOfGroupsUsersTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/groupsusers/AddIndexOnUserUuidOfGroupsUsersTable.java deleted file mode 100644 index 8e866a2119e..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/groupsusers/AddIndexOnUserUuidOfGroupsUsersTable.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.users.fk.groupsusers; - -import java.sql.Connection; -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.db.DatabaseUtils; -import org.sonar.server.platform.db.migration.sql.CreateIndexBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.USER_UUID_SIZE; -import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder; - -public class AddIndexOnUserUuidOfGroupsUsersTable extends DdlChange { - private static final String TABLE_NAME = "groups_users"; - private static final String INDEX_NAME = "index_groups_users_user_uuid"; - - public AddIndexOnUserUuidOfGroupsUsersTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - if (!indexExists()) { - context.execute(new CreateIndexBuilder() - .setUnique(false) - .setTable(TABLE_NAME) - .setName(INDEX_NAME) - .addColumn(newVarcharColumnDefBuilder() - .setColumnName("user_uuid") - .setLimit(USER_UUID_SIZE) - .build()) - .build()); - } - } - - private boolean indexExists() throws SQLException { - try (Connection connection = getDatabase().getDataSource().getConnection()) { - return DatabaseUtils.indexExistsIgnoreCase(TABLE_NAME, INDEX_NAME, connection); - } - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/groupsusers/AddUniqueIndexOnUserUuidAndGroupIdOfGroupsUsersTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/groupsusers/AddUniqueIndexOnUserUuidAndGroupIdOfGroupsUsersTable.java deleted file mode 100644 index a665f54051a..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/groupsusers/AddUniqueIndexOnUserUuidAndGroupIdOfGroupsUsersTable.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.users.fk.groupsusers; - -import java.sql.Connection; -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.db.DatabaseUtils; -import org.sonar.server.platform.db.migration.sql.CreateIndexBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.UUID_SIZE; -import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder; - -public class AddUniqueIndexOnUserUuidAndGroupIdOfGroupsUsersTable extends DdlChange { - private static final String TABLE_NAME = "groups_users"; - private static final String INDEX_NAME = "groups_users_unique"; - - public AddUniqueIndexOnUserUuidAndGroupIdOfGroupsUsersTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - if (!indexExists()) { - context.execute(new CreateIndexBuilder() - .setTable(TABLE_NAME) - .setName(INDEX_NAME) - .setUnique(true) - .addColumn(newVarcharColumnDefBuilder() - .setColumnName("user_uuid") - .setLimit(UUID_SIZE) - .build()) - .addColumn(newVarcharColumnDefBuilder() - .setColumnName("group_uuid") - .setLimit(UUID_SIZE) - .build()) - .build()); - } - } - - private boolean indexExists() throws SQLException { - try (Connection connection = getDatabase().getDataSource().getConnection()) { - return DatabaseUtils.indexExistsIgnoreCase(TABLE_NAME, INDEX_NAME, connection); - } - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/groupsusers/AddUserUuidColumnToGroupsUsers.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/groupsusers/AddUserUuidColumnToGroupsUsers.java deleted file mode 100644 index c6020f40a2b..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/groupsusers/AddUserUuidColumnToGroupsUsers.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.users.fk.groupsusers; - -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.version.v84.users.fk.util.AddUserUuidColumnToTable; - -public class AddUserUuidColumnToGroupsUsers extends AddUserUuidColumnToTable { - public AddUserUuidColumnToGroupsUsers(Database db) { - super(db, "groups_users"); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/groupsusers/DropIndexOnUserIdOfGroupsUsersTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/groupsusers/DropIndexOnUserIdOfGroupsUsersTable.java deleted file mode 100644 index a6ccfb30df1..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/groupsusers/DropIndexOnUserIdOfGroupsUsersTable.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.users.fk.groupsusers; - -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.step.DropIndexChange; - -public class DropIndexOnUserIdOfGroupsUsersTable extends DropIndexChange { - private static final String TABLE_NAME = "groups_users"; - private static final String INDEX_NAME = "index_groups_users_on_user_id"; - - public DropIndexOnUserIdOfGroupsUsersTable(Database db) { - super(db, INDEX_NAME, TABLE_NAME); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/groupsusers/DropUniqueIndexOnUserIdAndGroupIdOfGroupsUsersTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/groupsusers/DropUniqueIndexOnUserIdAndGroupIdOfGroupsUsersTable.java deleted file mode 100644 index 7002321966c..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/groupsusers/DropUniqueIndexOnUserIdAndGroupIdOfGroupsUsersTable.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.users.fk.groupsusers; - -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.step.DropIndexChange; - -public class DropUniqueIndexOnUserIdAndGroupIdOfGroupsUsersTable extends DropIndexChange { - private static final String TABLE_NAME = "groups_users"; - private static final String INDEX_NAME = "groups_users_unique"; - - public DropUniqueIndexOnUserIdAndGroupIdOfGroupsUsersTable(Database db) { - super(db, INDEX_NAME, TABLE_NAME); - } - -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/groupsusers/DropUserIdColumnOfGroupsUsersTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/groupsusers/DropUserIdColumnOfGroupsUsersTable.java deleted file mode 100644 index d2d36cb7c53..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/groupsusers/DropUserIdColumnOfGroupsUsersTable.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.users.fk.groupsusers; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.DropColumnsBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class DropUserIdColumnOfGroupsUsersTable extends DdlChange { - public DropUserIdColumnOfGroupsUsersTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new DropColumnsBuilder(getDialect(), "groups_users", "user_id").build()); - } -} - diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/groupsusers/MakeGroupsUsersUserUuidColumnNotNullable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/groupsusers/MakeGroupsUsersUserUuidColumnNotNullable.java deleted file mode 100644 index 8b459d911fe..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/groupsusers/MakeGroupsUsersUserUuidColumnNotNullable.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.users.fk.groupsusers; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.def.VarcharColumnDef; -import org.sonar.server.platform.db.migration.sql.AlterColumnsBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.USER_UUID_SIZE; -import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder; - -public class MakeGroupsUsersUserUuidColumnNotNullable extends DdlChange { - private static final String TABLE_NAME = "groups_users"; - - private static final VarcharColumnDef uuidColumnDefinition = newVarcharColumnDefBuilder() - .setColumnName("user_uuid") - .setIsNullable(false) - .setDefaultValue(null) - .setLimit(USER_UUID_SIZE) - .build(); - - public MakeGroupsUsersUserUuidColumnNotNullable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new AlterColumnsBuilder(getDialect(), TABLE_NAME) - .updateColumn(uuidColumnDefinition) - .build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/groupsusers/PopulateGroupsUsersUserUuid.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/groupsusers/PopulateGroupsUsersUserUuid.java deleted file mode 100644 index b773357af72..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/groupsusers/PopulateGroupsUsersUserUuid.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.users.fk.groupsusers; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.step.DataChange; -import org.sonar.server.platform.db.migration.step.MassUpdate; - -public class PopulateGroupsUsersUserUuid extends DataChange { - - public PopulateGroupsUsersUserUuid(Database db) { - super(db); - } - - @Override - protected void execute(Context context) throws SQLException { - MassUpdate massUpdate = context.prepareMassUpdate(); - - massUpdate.select("select gu.group_uuid, gu.user_id, u.uuid " + - "from groups_users gu " + - "join users u on gu.user_id = u.id where gu.user_uuid is null"); - - massUpdate.update("update groups_users set user_uuid = ? where group_uuid = ? and user_id = ?"); - - massUpdate.execute((row, update) -> { - String groupUuid = row.getString(1); - long userId = row.getLong(2); - String userUuid = row.getString(3); - update.setString(1, userUuid); - update.setString(2, groupUuid); - update.setLong(3, userId); - return true; - }); - - remoteOrphanEntries(context); - } - - private static void remoteOrphanEntries(Context context) throws SQLException { - MassUpdate massUpdate = context.prepareMassUpdate(); - - massUpdate.select("select group_uuid, user_id from groups_users where user_uuid is null"); - massUpdate.update("delete from groups_users where group_uuid = ? and user_id = ?"); - - massUpdate.execute((row, update) -> { - update.setString(1, row.getString(1)); - update.setLong(2, row.getLong(2)); - return true; - }); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/groupsusers/package-info.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/groupsusers/package-info.java deleted file mode 100644 index fbf586dcf32..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/groupsusers/package-info.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.users.fk.groupsusers; - -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/organizationmembers/AddIndexOnUserUuidOfOrganizationMembersTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/organizationmembers/AddIndexOnUserUuidOfOrganizationMembersTable.java deleted file mode 100644 index 1d2b4f38912..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/organizationmembers/AddIndexOnUserUuidOfOrganizationMembersTable.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.users.fk.organizationmembers; - -import java.sql.Connection; -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.db.DatabaseUtils; -import org.sonar.server.platform.db.migration.sql.CreateIndexBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.UUID_SIZE; -import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder; - -public class AddIndexOnUserUuidOfOrganizationMembersTable extends DdlChange { - private static final String TABLE_NAME = "organization_members"; - private static final String INDEX_NAME = "org_members_user_uuid"; - - public AddIndexOnUserUuidOfOrganizationMembersTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - if (!indexExists()) { - context.execute(new CreateIndexBuilder() - .setUnique(false) - .setTable(TABLE_NAME) - .setName(INDEX_NAME) - .addColumn(newVarcharColumnDefBuilder() - .setColumnName("user_uuid") - .setLimit(UUID_SIZE) - .build()) - .build()); - } - } - - private boolean indexExists() throws SQLException { - try (Connection connection = getDatabase().getDataSource().getConnection()) { - return DatabaseUtils.indexExistsIgnoreCase(TABLE_NAME, INDEX_NAME, connection); - } - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/organizationmembers/AddPrimaryKeyOnUserUuidAndOrganizationUuidColumnsOfUserRolesTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/organizationmembers/AddPrimaryKeyOnUserUuidAndOrganizationUuidColumnsOfUserRolesTable.java deleted file mode 100644 index 839ee055ded..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/organizationmembers/AddPrimaryKeyOnUserUuidAndOrganizationUuidColumnsOfUserRolesTable.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.users.fk.organizationmembers; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.AddPrimaryKeyBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class AddPrimaryKeyOnUserUuidAndOrganizationUuidColumnsOfUserRolesTable extends DdlChange { - - public AddPrimaryKeyOnUserUuidAndOrganizationUuidColumnsOfUserRolesTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new AddPrimaryKeyBuilder("organization_members", "user_uuid", "organization_uuid").build()); - } - -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/organizationmembers/AddUserUuidColumnToOrganizationMembers.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/organizationmembers/AddUserUuidColumnToOrganizationMembers.java deleted file mode 100644 index 9627f96a89a..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/organizationmembers/AddUserUuidColumnToOrganizationMembers.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.users.fk.organizationmembers; - -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.version.v84.users.fk.util.AddUserUuidColumnToTable; - -public class AddUserUuidColumnToOrganizationMembers extends AddUserUuidColumnToTable { - public AddUserUuidColumnToOrganizationMembers(Database db) { - super(db, "organization_members"); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/organizationmembers/DropIndexOnUserIdOfOrganizationMembersTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/organizationmembers/DropIndexOnUserIdOfOrganizationMembersTable.java deleted file mode 100644 index 451a2d7aef0..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/organizationmembers/DropIndexOnUserIdOfOrganizationMembersTable.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.users.fk.organizationmembers; - -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.step.DropIndexChange; - -public class DropIndexOnUserIdOfOrganizationMembersTable extends DropIndexChange { - private static final String TABLE_NAME = "organization_members"; - private static final String INDEX_NAME = "ix_org_members_on_user_id"; - - public DropIndexOnUserIdOfOrganizationMembersTable(Database db) { - super(db, INDEX_NAME, TABLE_NAME); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/organizationmembers/DropPrimaryKeyOnUserIdAndOrganizationUuidOfOrganizationMembersTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/organizationmembers/DropPrimaryKeyOnUserIdAndOrganizationUuidOfOrganizationMembersTable.java deleted file mode 100644 index e653784ae7b..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/organizationmembers/DropPrimaryKeyOnUserIdAndOrganizationUuidOfOrganizationMembersTable.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.users.fk.organizationmembers; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.DropPrimaryKeySqlGenerator; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class DropPrimaryKeyOnUserIdAndOrganizationUuidOfOrganizationMembersTable extends DdlChange { - private static final String TABLE_NAME = "organization_members"; - - private final DropPrimaryKeySqlGenerator dropPrimaryKeySqlGenerator; - - public DropPrimaryKeyOnUserIdAndOrganizationUuidOfOrganizationMembersTable(Database db, DropPrimaryKeySqlGenerator dropPrimaryKeySqlGenerator) { - super(db); - this.dropPrimaryKeySqlGenerator = dropPrimaryKeySqlGenerator; - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(dropPrimaryKeySqlGenerator.generate(TABLE_NAME, "user_id", false)); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/organizationmembers/DropUserIdColumnOfOrganizationMembersTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/organizationmembers/DropUserIdColumnOfOrganizationMembersTable.java deleted file mode 100644 index 7ff3a545100..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/organizationmembers/DropUserIdColumnOfOrganizationMembersTable.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.users.fk.organizationmembers; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.DropColumnsBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class DropUserIdColumnOfOrganizationMembersTable extends DdlChange { - public DropUserIdColumnOfOrganizationMembersTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new DropColumnsBuilder(getDialect(), "organization_members", "user_id").build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/organizationmembers/MakeOrganizationMembersUserUuidColumnNotNullable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/organizationmembers/MakeOrganizationMembersUserUuidColumnNotNullable.java deleted file mode 100644 index cfc34382daa..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/organizationmembers/MakeOrganizationMembersUserUuidColumnNotNullable.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.users.fk.organizationmembers; - -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.version.v84.users.fk.util.MakeUserUuidColumnNotNullable; - -public class MakeOrganizationMembersUserUuidColumnNotNullable extends MakeUserUuidColumnNotNullable { - private static final String TABLE_NAME = "organization_members"; - - public MakeOrganizationMembersUserUuidColumnNotNullable(Database db) { - super(db, TABLE_NAME); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/organizationmembers/PopulateOrganizationMembersUserUuid.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/organizationmembers/PopulateOrganizationMembersUserUuid.java deleted file mode 100644 index 5de8a55e396..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/organizationmembers/PopulateOrganizationMembersUserUuid.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.users.fk.organizationmembers; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.step.DataChange; -import org.sonar.server.platform.db.migration.step.MassUpdate; - -public class PopulateOrganizationMembersUserUuid extends DataChange { - - public PopulateOrganizationMembersUserUuid(Database db) { - super(db); - } - - @Override - protected void execute(Context context) throws SQLException { - MassUpdate massUpdate = context.prepareMassUpdate(); - - massUpdate.select("select om.user_id, om.organization_uuid, u.uuid " + - "from organization_members om " + - "join users u on om.user_id = u.id where om.user_uuid is null"); - - massUpdate.update("update organization_members set user_uuid = ? where organization_uuid = ? and user_id = ?"); - - massUpdate.execute((row, update, index) -> { - long userId = row.getLong(1); - String organizationUuid = row.getString(2); - String userUuid = row.getString(3); - - update.setString(1, userUuid); - update.setString(2, organizationUuid); - update.setLong(3, userId); - return true; - }); - - MassUpdate.Handler removeOrphanHandler = (row, update) -> { - update.setString(1, row.getString(1)); - update.setLong(2, row.getLong(2)); - - return true; - }; - massUpdate = context.prepareMassUpdate(); - - massUpdate.select("select organization_uuid, user_id from organization_members where user_uuid is null"); - massUpdate.update("delete from organization_members where organization_uuid = ? and user_id = ?"); - - massUpdate.execute(removeOrphanHandler); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/organizationmembers/package-info.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/organizationmembers/package-info.java deleted file mode 100644 index 565f183495e..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/organizationmembers/package-info.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.users.fk.organizationmembers; - -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/package-info.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/package-info.java deleted file mode 100644 index 5f85fc2cb3e..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/package-info.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.users.fk; - -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/permtemplatesusers/AddUserUuidColumnToPermTemplatesUsers.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/permtemplatesusers/AddUserUuidColumnToPermTemplatesUsers.java deleted file mode 100644 index 1571a790642..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/permtemplatesusers/AddUserUuidColumnToPermTemplatesUsers.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.users.fk.permtemplatesusers; - -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.version.v84.users.fk.util.AddUserUuidColumnToTable; - -public class AddUserUuidColumnToPermTemplatesUsers extends AddUserUuidColumnToTable { - - public AddUserUuidColumnToPermTemplatesUsers(Database db) { - super(db, "perm_templates_users"); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/permtemplatesusers/DropUserIdColumnOfPermTemplatesUsersTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/permtemplatesusers/DropUserIdColumnOfPermTemplatesUsersTable.java deleted file mode 100644 index dc32e790d99..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/permtemplatesusers/DropUserIdColumnOfPermTemplatesUsersTable.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.users.fk.permtemplatesusers; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.DropColumnsBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class DropUserIdColumnOfPermTemplatesUsersTable extends DdlChange { - public DropUserIdColumnOfPermTemplatesUsersTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new DropColumnsBuilder(getDialect(), "perm_templates_users", "user_id").build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/permtemplatesusers/MakePermTemplatesUsersUserUuidColumnNotNullable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/permtemplatesusers/MakePermTemplatesUsersUserUuidColumnNotNullable.java deleted file mode 100644 index b6e1639e0d7..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/permtemplatesusers/MakePermTemplatesUsersUserUuidColumnNotNullable.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.users.fk.permtemplatesusers; - -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.version.v84.users.fk.util.MakeUserUuidColumnNotNullable; - -public class MakePermTemplatesUsersUserUuidColumnNotNullable extends MakeUserUuidColumnNotNullable { - private static final String TABLE_NAME = "perm_templates_users"; - - public MakePermTemplatesUsersUserUuidColumnNotNullable(Database db) { - super(db, TABLE_NAME); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/permtemplatesusers/PopulatePermTemplatesUsersUserUuid.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/permtemplatesusers/PopulatePermTemplatesUsersUserUuid.java deleted file mode 100644 index fe835116347..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/permtemplatesusers/PopulatePermTemplatesUsersUserUuid.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.users.fk.permtemplatesusers; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.step.DataChange; -import org.sonar.server.platform.db.migration.step.MassUpdate; - -public class PopulatePermTemplatesUsersUserUuid extends DataChange { - - public PopulatePermTemplatesUsersUserUuid(Database db) { - super(db); - } - - @Override - protected void execute(Context context) throws SQLException { - MassUpdate massUpdate = context.prepareMassUpdate(); - - massUpdate.select("select ptu.uuid, u.uuid " + - "from perm_templates_users ptu " + - "join users u on ptu.user_id = u.id where ptu.user_uuid is null"); - - massUpdate.update("update perm_templates_users set user_uuid = ? where uuid = ?"); - - massUpdate.execute((row, update, index) -> { - String permTemplatesUuid = row.getString(1); - String userUuid = row.getString(2); - - update.setString(1, userUuid); - update.setString(2, permTemplatesUuid); - return true; - }); - - massUpdate = context.prepareMassUpdate(); - - massUpdate.select("select uuid from perm_templates_users where user_uuid is null"); - massUpdate.update("delete from perm_templates_users where uuid = ?"); - - massUpdate.execute((row, update) -> { - update.setString(1, row.getString(1)); - return true; - }); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/permtemplatesusers/package-info.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/permtemplatesusers/package-info.java deleted file mode 100644 index 700fe3c5415..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/permtemplatesusers/package-info.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.users.fk.permtemplatesusers; - -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/properties/AddUserUuidColumnToPropertiesUsers.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/properties/AddUserUuidColumnToPropertiesUsers.java deleted file mode 100644 index fbe5c41889e..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/properties/AddUserUuidColumnToPropertiesUsers.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.users.fk.properties; - -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.version.v84.users.fk.util.AddUserUuidColumnToTable; - -public class AddUserUuidColumnToPropertiesUsers extends AddUserUuidColumnToTable { - - public AddUserUuidColumnToPropertiesUsers(Database db) { - super(db, "properties"); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/properties/DropUserIdColumnOfPropertiesTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/properties/DropUserIdColumnOfPropertiesTable.java deleted file mode 100644 index 824b95634b4..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/properties/DropUserIdColumnOfPropertiesTable.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.users.fk.properties; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.DropColumnsBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class DropUserIdColumnOfPropertiesTable extends DdlChange { - public DropUserIdColumnOfPropertiesTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new DropColumnsBuilder(getDialect(), "properties", "user_id").build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/properties/PopulatePropertiesUserUuid.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/properties/PopulatePropertiesUserUuid.java deleted file mode 100644 index 87d148cb8a3..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/properties/PopulatePropertiesUserUuid.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.users.fk.properties; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.step.DataChange; -import org.sonar.server.platform.db.migration.step.MassUpdate; - -public class PopulatePropertiesUserUuid extends DataChange { - - public PopulatePropertiesUserUuid(Database db) { - super(db); - } - - @Override - protected void execute(Context context) throws SQLException { - populateUserUuid(context); - removeRowWithNonExistentUser(context); - } - - private static void populateUserUuid(Context context) throws SQLException { - MassUpdate massUpdate = context.prepareMassUpdate(); - - massUpdate.select("select p.uuid, u.uuid " + - "from properties p " + - "join users u on p.user_id = u.id where p.user_uuid is null"); - - massUpdate.update("update properties set user_uuid = ? where uuid = ?"); - - massUpdate.execute((row, update, index) -> { - String propertiesUuid = row.getString(1); - String userUuid = row.getString(2); - - update.setString(1, userUuid); - update.setString(2, propertiesUuid); - return true; - }); - } - - private static void removeRowWithNonExistentUser(Context context) throws SQLException { - context.prepareUpsert("delete from properties where user_uuid is null and user_id is not null") - .execute() - .commit(); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/properties/package-info.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/properties/package-info.java deleted file mode 100644 index 4fa499ca67b..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/properties/package-info.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.users.fk.properties; - -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/qprofileeditusers/AddUniqueIndexOnUserUuidAndQProfileUuidOfQProfileEditUsersTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/qprofileeditusers/AddUniqueIndexOnUserUuidAndQProfileUuidOfQProfileEditUsersTable.java deleted file mode 100644 index bc2508834b1..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/qprofileeditusers/AddUniqueIndexOnUserUuidAndQProfileUuidOfQProfileEditUsersTable.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.users.fk.qprofileeditusers; - -import java.sql.Connection; -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.db.DatabaseUtils; -import org.sonar.server.platform.db.migration.sql.CreateIndexBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.UUID_SIZE; -import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder; - -public class AddUniqueIndexOnUserUuidAndQProfileUuidOfQProfileEditUsersTable extends DdlChange { - private static final String TABLE_NAME = "qprofile_edit_users"; - private static final String INDEX_NAME = "qprofile_edit_users_unique"; - - public AddUniqueIndexOnUserUuidAndQProfileUuidOfQProfileEditUsersTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - if (!indexExists()) { - context.execute(new CreateIndexBuilder() - .setUnique(true) - .setTable(TABLE_NAME) - .setName(INDEX_NAME) - .addColumn(newVarcharColumnDefBuilder() - .setColumnName("user_uuid") - .setLimit(UUID_SIZE) - .build()) - .addColumn(newVarcharColumnDefBuilder() - .setColumnName("qprofile_uuid") - .setLimit(UUID_SIZE) - .build()) - .build()); - } - } - - private boolean indexExists() throws SQLException { - try (Connection connection = getDatabase().getDataSource().getConnection()) { - return DatabaseUtils.indexExistsIgnoreCase(TABLE_NAME, INDEX_NAME, connection); - } - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/qprofileeditusers/AddUserUuidColumnToQProfileEditUsers.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/qprofileeditusers/AddUserUuidColumnToQProfileEditUsers.java deleted file mode 100644 index 5f25d812839..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/qprofileeditusers/AddUserUuidColumnToQProfileEditUsers.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.users.fk.qprofileeditusers; - -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.version.v84.users.fk.util.AddUserUuidColumnToTable; - -public class AddUserUuidColumnToQProfileEditUsers extends AddUserUuidColumnToTable { - - public AddUserUuidColumnToQProfileEditUsers(Database db) { - super(db, "qprofile_edit_users"); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/qprofileeditusers/DropUniqueIndexOnUserIdAndQProfileUuidOfQProfileEditUsersTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/qprofileeditusers/DropUniqueIndexOnUserIdAndQProfileUuidOfQProfileEditUsersTable.java deleted file mode 100644 index 7fb8fff8fdf..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/qprofileeditusers/DropUniqueIndexOnUserIdAndQProfileUuidOfQProfileEditUsersTable.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.users.fk.qprofileeditusers; - -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.step.DropIndexChange; - -public class DropUniqueIndexOnUserIdAndQProfileUuidOfQProfileEditUsersTable extends DropIndexChange { - private static final String TABLE_NAME = "qprofile_edit_users"; - private static final String INDEX_NAME = "qprofile_edit_users_unique"; - - public DropUniqueIndexOnUserIdAndQProfileUuidOfQProfileEditUsersTable(Database db) { - super(db, INDEX_NAME, TABLE_NAME); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/qprofileeditusers/DropUserIdColumnOfQProfileEditUsersTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/qprofileeditusers/DropUserIdColumnOfQProfileEditUsersTable.java deleted file mode 100644 index 35828422dbd..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/qprofileeditusers/DropUserIdColumnOfQProfileEditUsersTable.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.users.fk.qprofileeditusers; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.DropColumnsBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class DropUserIdColumnOfQProfileEditUsersTable extends DdlChange { - public DropUserIdColumnOfQProfileEditUsersTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new DropColumnsBuilder(getDialect(), "qprofile_edit_users", "user_id").build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/qprofileeditusers/MakeQProfileEditUsersUserUuidColumnNotNullable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/qprofileeditusers/MakeQProfileEditUsersUserUuidColumnNotNullable.java deleted file mode 100644 index e1c8b10f913..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/qprofileeditusers/MakeQProfileEditUsersUserUuidColumnNotNullable.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.users.fk.qprofileeditusers; - -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.version.v84.users.fk.util.MakeUserUuidColumnNotNullable; - -public class MakeQProfileEditUsersUserUuidColumnNotNullable extends MakeUserUuidColumnNotNullable { - private static final String TABLE_NAME = "qprofile_edit_users"; - - public MakeQProfileEditUsersUserUuidColumnNotNullable(Database db) { - super(db, TABLE_NAME); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/qprofileeditusers/PopulateQProfileEditUsersUserUuid.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/qprofileeditusers/PopulateQProfileEditUsersUserUuid.java deleted file mode 100644 index 59d6daf798f..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/qprofileeditusers/PopulateQProfileEditUsersUserUuid.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.users.fk.qprofileeditusers; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.step.DataChange; -import org.sonar.server.platform.db.migration.step.MassUpdate; -import org.sonar.server.platform.db.migration.version.v84.util.OrphanData; - -public class PopulateQProfileEditUsersUserUuid extends DataChange { - - public PopulateQProfileEditUsersUserUuid(Database db) { - super(db); - } - - @Override - protected void execute(Context context) throws SQLException { - MassUpdate massUpdate = context.prepareMassUpdate(); - - massUpdate.select("select qeu.uuid, u.uuid " + - "from qprofile_edit_users qeu " + - "join users u on qeu.user_id = u.id where qeu.user_uuid is null"); - - massUpdate.update("update qprofile_edit_users set user_uuid = ? where uuid = ?"); - - massUpdate.execute((row, update, index) -> { - String permTemplatesUuid = row.getString(1); - String userUuid = row.getString(2); - - update.setString(1, userUuid); - update.setString(2, permTemplatesUuid); - return true; - }); - - OrphanData.delete(context, "qprofile_edit_users", "user_uuid"); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/qprofileeditusers/package-info.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/qprofileeditusers/package-info.java deleted file mode 100644 index 6a61f34e15a..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/qprofileeditusers/package-info.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.users.fk.qprofileeditusers; - -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/userroles/AddIndexOnUserUuidOfUserRolesTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/userroles/AddIndexOnUserUuidOfUserRolesTable.java deleted file mode 100644 index 41ddf949af4..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/userroles/AddIndexOnUserUuidOfUserRolesTable.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.users.fk.userroles; - -import java.sql.Connection; -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.db.DatabaseUtils; -import org.sonar.server.platform.db.migration.sql.CreateIndexBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.UUID_SIZE; -import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder; - -public class AddIndexOnUserUuidOfUserRolesTable extends DdlChange { - private static final String TABLE_NAME = "user_roles"; - private static final String INDEX_NAME = "user_roles_user"; - - public AddIndexOnUserUuidOfUserRolesTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - if (!indexExists()) { - context.execute(new CreateIndexBuilder() - .setUnique(false) - .setTable(TABLE_NAME) - .setName(INDEX_NAME) - .addColumn(newVarcharColumnDefBuilder() - .setColumnName("user_uuid") - .setLimit(UUID_SIZE) - .build()) - .build()); - } - } - - private boolean indexExists() throws SQLException { - try (Connection connection = getDatabase().getDataSource().getConnection()) { - return DatabaseUtils.indexExistsIgnoreCase(TABLE_NAME, INDEX_NAME, connection); - } - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/userroles/AddUserUuidColumnToUserRoles.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/userroles/AddUserUuidColumnToUserRoles.java deleted file mode 100644 index a41f3b9cbb5..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/userroles/AddUserUuidColumnToUserRoles.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.users.fk.userroles; - -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.version.v84.users.fk.util.AddUserUuidColumnToTable; - -public class AddUserUuidColumnToUserRoles extends AddUserUuidColumnToTable { - - public AddUserUuidColumnToUserRoles(Database db) { - super(db, "user_roles"); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/userroles/DropIndexOnUserIdOfUserRolesTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/userroles/DropIndexOnUserIdOfUserRolesTable.java deleted file mode 100644 index d71fdab7ff0..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/userroles/DropIndexOnUserIdOfUserRolesTable.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.users.fk.userroles; - -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.step.DropIndexChange; - -public class DropIndexOnUserIdOfUserRolesTable extends DropIndexChange { - private static final String TABLE_NAME = "user_roles"; - private static final String INDEX_NAME = "user_roles_user"; - - public DropIndexOnUserIdOfUserRolesTable(Database db) { - super(db, INDEX_NAME, TABLE_NAME); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/userroles/DropUserIdColumnOfUserRolesTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/userroles/DropUserIdColumnOfUserRolesTable.java deleted file mode 100644 index 96680ef921d..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/userroles/DropUserIdColumnOfUserRolesTable.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.users.fk.userroles; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.DropColumnsBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class DropUserIdColumnOfUserRolesTable extends DdlChange { - public DropUserIdColumnOfUserRolesTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new DropColumnsBuilder(getDialect(), "user_roles", "user_id").build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/userroles/PopulateUserRolesUserUuid.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/userroles/PopulateUserRolesUserUuid.java deleted file mode 100644 index 02e8027c8d7..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/userroles/PopulateUserRolesUserUuid.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.users.fk.userroles; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.step.DataChange; -import org.sonar.server.platform.db.migration.step.MassUpdate; - -public class PopulateUserRolesUserUuid extends DataChange { - - public PopulateUserRolesUserUuid(Database db) { - super(db); - } - - @Override - protected void execute(Context context) throws SQLException { - MassUpdate massUpdate = context.prepareMassUpdate(); - - massUpdate.select("select ur.uuid, u.uuid " + - "from user_roles ur " + - "join users u on ur.user_id = u.id where ur.user_uuid is null"); - - massUpdate.update("update user_roles set user_uuid = ? where uuid = ?"); - - massUpdate.execute((row, update, index) -> { - String userRolesUuid = row.getString(1); - String userUuid = row.getString(2); - - update.setString(1, userUuid); - update.setString(2, userRolesUuid); - return true; - }); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/userroles/package-info.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/userroles/package-info.java deleted file mode 100644 index 0f43b1c29fe..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/userroles/package-info.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.users.fk.userroles; - -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/util/AddUserUuidColumnToTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/util/AddUserUuidColumnToTable.java deleted file mode 100644 index 4f10a75cde5..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/util/AddUserUuidColumnToTable.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.users.fk.util; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.def.VarcharColumnDef; -import org.sonar.server.platform.db.migration.sql.AddColumnsBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder; - -public class AddUserUuidColumnToTable extends DdlChange { - private final String tableName; - - private static final VarcharColumnDef uuidColumnDefinition = newVarcharColumnDefBuilder() - .setColumnName("user_uuid") - .setIsNullable(true) - .setDefaultValue(null) - .setLimit(VarcharColumnDef.USER_UUID_SIZE) - .build(); - - public AddUserUuidColumnToTable(Database db, String tableName) { - super(db); - this.tableName = tableName; - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new AddColumnsBuilder(getDialect(), tableName) - .addColumn(uuidColumnDefinition) - .build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/util/MakeUserUuidColumnNotNullable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/util/MakeUserUuidColumnNotNullable.java deleted file mode 100644 index 03319245176..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/util/MakeUserUuidColumnNotNullable.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.users.fk.util; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.def.VarcharColumnDef; -import org.sonar.server.platform.db.migration.sql.AlterColumnsBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder; - -public class MakeUserUuidColumnNotNullable extends DdlChange { - private final String tableName; - - private static final VarcharColumnDef uuidColumnDefinition = newVarcharColumnDefBuilder() - .setColumnName("user_uuid") - .setIsNullable(false) - .setDefaultValue(null) - .setLimit(VarcharColumnDef.USER_UUID_SIZE) - .build(); - - public MakeUserUuidColumnNotNullable(Database db, String tableName) { - super(db); - this.tableName = tableName; - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new AlterColumnsBuilder(getDialect(), tableName) - .updateColumn(uuidColumnDefinition) - .build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/util/package-info.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/util/package-info.java deleted file mode 100644 index b56469fbd25..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/fk/util/package-info.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.users.fk.util; - -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/package-info.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/package-info.java deleted file mode 100644 index e398d3d793b..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/users/package-info.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.users; - -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/usertokens/AddPrimaryKeyOnUuidColumnOfUserTokensTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/usertokens/AddPrimaryKeyOnUuidColumnOfUserTokensTable.java deleted file mode 100644 index 617979d1569..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/usertokens/AddPrimaryKeyOnUuidColumnOfUserTokensTable.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.usertokens; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.AddPrimaryKeyBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class AddPrimaryKeyOnUuidColumnOfUserTokensTable extends DdlChange { - - public AddPrimaryKeyOnUuidColumnOfUserTokensTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new AddPrimaryKeyBuilder("user_tokens", "uuid").build()); - } - -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/usertokens/AddUuidColumnToUserTokens.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/usertokens/AddUuidColumnToUserTokens.java deleted file mode 100644 index 85ab5142a7e..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/usertokens/AddUuidColumnToUserTokens.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.usertokens; - -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.version.v84.common.AddUuidColumnToTable; - -public class AddUuidColumnToUserTokens extends AddUuidColumnToTable { - private static final String TABLE = "user_tokens"; - - public AddUuidColumnToUserTokens(Database db) { - super(db, TABLE); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/usertokens/DropIdColumnOfUserTokensTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/usertokens/DropIdColumnOfUserTokensTable.java deleted file mode 100644 index e9cf5751b47..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/usertokens/DropIdColumnOfUserTokensTable.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.usertokens; - -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.version.v84.common.DropIdColumn; - -public class DropIdColumnOfUserTokensTable extends DropIdColumn { - private static final String TABLE = "user_tokens"; - - public DropIdColumnOfUserTokensTable(Database db) { - super(db, TABLE); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/usertokens/DropPrimaryKeyOnIdColumnOfUserTokensTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/usertokens/DropPrimaryKeyOnIdColumnOfUserTokensTable.java deleted file mode 100644 index 0fd1c80892c..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/usertokens/DropPrimaryKeyOnIdColumnOfUserTokensTable.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.usertokens; - -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.DropPrimaryKeySqlGenerator; -import org.sonar.server.platform.db.migration.version.v84.common.DropPrimaryKeyOnIdColumn; - -public class DropPrimaryKeyOnIdColumnOfUserTokensTable extends DropPrimaryKeyOnIdColumn { - private static final String TABLE_NAME = "user_tokens"; - - public DropPrimaryKeyOnIdColumnOfUserTokensTable(Database db, DropPrimaryKeySqlGenerator dropPrimaryKeySqlGenerator) { - super(db, dropPrimaryKeySqlGenerator, TABLE_NAME); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/usertokens/MakeUserTokensUuidNotNullable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/usertokens/MakeUserTokensUuidNotNullable.java deleted file mode 100644 index 34998b74648..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/usertokens/MakeUserTokensUuidNotNullable.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.usertokens; - -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.version.v84.common.MakeUuidColumnNotNullable; - -public class MakeUserTokensUuidNotNullable extends MakeUuidColumnNotNullable { - private static final String TABLE = "user_tokens"; - - public MakeUserTokensUuidNotNullable(Database db) { - super(db, TABLE); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/usertokens/PopulateUserTokensUuid.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/usertokens/PopulateUserTokensUuid.java deleted file mode 100644 index af25317433c..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/usertokens/PopulateUserTokensUuid.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.usertokens; - -import java.sql.SQLException; -import org.sonar.core.util.UuidFactory; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.step.DataChange; -import org.sonar.server.platform.db.migration.step.MassUpdate; - -public class PopulateUserTokensUuid extends DataChange { - - private final UuidFactory uuidFactory; - - public PopulateUserTokensUuid(Database db, UuidFactory uuidFactory) { - super(db); - this.uuidFactory = uuidFactory; - } - - @Override - protected void execute(Context context) throws SQLException { - MassUpdate massUpdate = context.prepareMassUpdate(); - - massUpdate.select("select id from user_tokens where uuid is null"); - massUpdate.update("update user_tokens set uuid = ? where id = ?"); - - massUpdate.execute((row, update) -> { - update.setString(1, uuidFactory.create()); - update.setLong(2, row.getLong(1)); - return true; - }); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/usertokens/package-info.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/usertokens/package-info.java deleted file mode 100644 index ed22b263aea..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/usertokens/package-info.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.usertokens; - -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/util/OrphanData.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/util/OrphanData.java deleted file mode 100644 index d71611ba25f..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/util/OrphanData.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.util; - -import java.sql.SQLException; -import org.sonar.server.platform.db.migration.step.DataChange; -import org.sonar.server.platform.db.migration.step.MassUpdate; - -public class OrphanData { - private OrphanData() { - // static only - } - /** - * Deletes from a table entries that contain a null foreign key. - * Primary key of the table must be 'uuid' - */ - public static void delete(DataChange.Context context, String table, String foreignKeyColumn) throws SQLException { - MassUpdate massUpdate = context.prepareMassUpdate(); - - massUpdate.select("select uuid from " + table + " where " + foreignKeyColumn + " is null"); - massUpdate.update("delete from " + table + " where " + " uuid = ?"); - - massUpdate.execute((row, update) -> { - update.setString(1, row.getString(1)); - return true; - }); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/util/package-info.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/util/package-info.java deleted file mode 100644 index 4709a5d2f2a..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/util/package-info.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.util; - -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/AddIndexOnIssueKeyForIssueChangesTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/AddIndexOnIssueKeyForIssueChangesTable.java deleted file mode 100644 index 7c506d95616..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/AddIndexOnIssueKeyForIssueChangesTable.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v85; - -import java.sql.Connection; -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.db.DatabaseUtils; -import org.sonar.server.platform.db.migration.sql.CreateIndexBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.UUID_VARCHAR_SIZE; -import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder; - -public class AddIndexOnIssueKeyForIssueChangesTable extends DdlChange { - - private static final String TABLE_NAME = "issue_changes"; - private static final String INDEX_NAME = "issue_changes_issue_key"; - - public AddIndexOnIssueKeyForIssueChangesTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - if (!indexExists()) { - context.execute(new CreateIndexBuilder() - .setUnique(false) - .setTable(TABLE_NAME) - .setName(INDEX_NAME) - .addColumn(newVarcharColumnDefBuilder() - .setColumnName("issue_key") - .setIsNullable(false) - .setLimit(UUID_VARCHAR_SIZE) - .build()) - .build()); - } - } - - private boolean indexExists() throws SQLException { - try (Connection connection = getDatabase().getDataSource().getConnection()) { - return DatabaseUtils.indexExistsIgnoreCase(TABLE_NAME, INDEX_NAME, connection); - } - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/AddIndexOnKeeForIssueChangesTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/AddIndexOnKeeForIssueChangesTable.java deleted file mode 100644 index c025806e1c2..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/AddIndexOnKeeForIssueChangesTable.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v85; - -import java.sql.Connection; -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.db.DatabaseUtils; -import org.sonar.server.platform.db.migration.sql.CreateIndexBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.UUID_VARCHAR_SIZE; -import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder; - -public class AddIndexOnKeeForIssueChangesTable extends DdlChange { - - private static final String TABLE_NAME = "issue_changes"; - private static final String INDEX_NAME = "issue_changes_kee"; - - public AddIndexOnKeeForIssueChangesTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - if (!indexExists()) { - context.execute(new CreateIndexBuilder() - .setUnique(false) - .setTable(TABLE_NAME) - .setName(INDEX_NAME) - .addColumn(newVarcharColumnDefBuilder() - .setColumnName("kee") - .setIsNullable(true) - .setLimit(UUID_VARCHAR_SIZE) - .build()) - .build()); - } - } - - private boolean indexExists() throws SQLException { - try (Connection connection = getDatabase().getDataSource().getConnection()) { - return DatabaseUtils.indexExistsIgnoreCase(TABLE_NAME, INDEX_NAME, connection); - } - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/AddIndexOnMessageTypeColumnOfCeTaskMessageTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/AddIndexOnMessageTypeColumnOfCeTaskMessageTable.java deleted file mode 100644 index ac9762abb35..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/AddIndexOnMessageTypeColumnOfCeTaskMessageTable.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v85; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.CreateIndexBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class AddIndexOnMessageTypeColumnOfCeTaskMessageTable extends DdlChange { - private static final String TABLE = "ce_task_message"; - - public AddIndexOnMessageTypeColumnOfCeTaskMessageTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new CreateIndexBuilder() - .setTable(TABLE) - .setName("ctm_message_type") - .addColumn("message_type") - .build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/AddIndexOnProjectUuidOnIssueChangesTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/AddIndexOnProjectUuidOnIssueChangesTable.java deleted file mode 100644 index 1d58bbc1628..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/AddIndexOnProjectUuidOnIssueChangesTable.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v85; - -import java.sql.Connection; -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.db.DatabaseUtils; -import org.sonar.server.platform.db.migration.sql.CreateIndexBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.UUID_SIZE; -import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder; - -public class AddIndexOnProjectUuidOnIssueChangesTable extends DdlChange { - private static final String TABLE_NAME = "issue_changes"; - private static final String INDEX_NAME = "issue_changes_project_uuid"; - - public AddIndexOnProjectUuidOnIssueChangesTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - if (!indexExists()) { - context.execute(new CreateIndexBuilder() - .setUnique(false) - .setTable(TABLE_NAME) - .setName(INDEX_NAME) - .addColumn(newVarcharColumnDefBuilder() - .setColumnName("project_uuid") - .setIsNullable(true) - .setLimit(UUID_SIZE) - .build()) - .build()); - } - } - - private boolean indexExists() throws SQLException { - try (Connection connection = getDatabase().getDataSource().getConnection()) { - return DatabaseUtils.indexExistsIgnoreCase(TABLE_NAME, INDEX_NAME, connection); - } - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/AddMessageTypeColumnToCeTaskMessageTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/AddMessageTypeColumnToCeTaskMessageTable.java deleted file mode 100644 index f1dcee73469..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/AddMessageTypeColumnToCeTaskMessageTable.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v85; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.def.VarcharColumnDef; -import org.sonar.server.platform.db.migration.sql.AddColumnsBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder; - -public class AddMessageTypeColumnToCeTaskMessageTable extends DdlChange { - private static final String TABLE = "ce_task_message"; - - private static final VarcharColumnDef MESSAGE_TYPE = newVarcharColumnDefBuilder() - .setColumnName("message_type") - .setIsNullable(true) - .setLimit(255) - .build(); - - public AddMessageTypeColumnToCeTaskMessageTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new AddColumnsBuilder(getDialect(), TABLE) - .addColumn(MESSAGE_TYPE) - .build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/AddPrimaryKeyOnUuidForIssueChangesTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/AddPrimaryKeyOnUuidForIssueChangesTable.java deleted file mode 100644 index 37feefda2a8..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/AddPrimaryKeyOnUuidForIssueChangesTable.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v85; - -import java.sql.Connection; -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.AddPrimaryKeyBuilder; -import org.sonar.db.DatabaseUtils; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class AddPrimaryKeyOnUuidForIssueChangesTable extends DdlChange { - - private static final String TABLE = "issue_changes"; - - public AddPrimaryKeyOnUuidForIssueChangesTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - try (Connection connection = getDatabase().getDataSource().getConnection()) { - if (!DatabaseUtils.indexExistsIgnoreCase(TABLE, "issue_changes_project_uuid", connection)) { - context.execute(new AddPrimaryKeyBuilder(TABLE, "uuid").build()); - } - } - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/AddTypeToPlugins.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/AddTypeToPlugins.java deleted file mode 100644 index f1cb6420da8..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/AddTypeToPlugins.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v85; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.def.VarcharColumnDef; -import org.sonar.server.platform.db.migration.sql.AddColumnsBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class AddTypeToPlugins extends DdlChange { - private static final String TABLE_NAME = "plugins"; - private static final String COLUMN_NAME = "type"; - - public AddTypeToPlugins(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new AddColumnsBuilder(getDialect(), TABLE_NAME).addColumn(VarcharColumnDef.newVarcharColumnDefBuilder() - .setLimit(10) - .setIsNullable(true) - .setColumnName(COLUMN_NAME) - .build()).build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/AlterTypeInPluginNotNullable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/AlterTypeInPluginNotNullable.java deleted file mode 100644 index 2f92d596f31..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/AlterTypeInPluginNotNullable.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v85; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.def.VarcharColumnDef; -import org.sonar.server.platform.db.migration.sql.AlterColumnsBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class AlterTypeInPluginNotNullable extends DdlChange { - private static final String TABLE_NAME = "plugins"; - private static final String COLUMN_NAME = "type"; - - public AlterTypeInPluginNotNullable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new AlterColumnsBuilder(getDialect(), TABLE_NAME).updateColumn(VarcharColumnDef.newVarcharColumnDefBuilder() - .setLimit(10) - .setIsNullable(false) - .setColumnName(COLUMN_NAME) - .build()).build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/CreateTmpIssueChangesTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/CreateTmpIssueChangesTable.java deleted file mode 100644 index 6fd09ceaab2..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/CreateTmpIssueChangesTable.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v85; - -import java.sql.Connection; -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.db.DatabaseUtils; -import org.sonar.db.dialect.MsSql; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class CreateTmpIssueChangesTable extends DdlChange { - - public CreateTmpIssueChangesTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - try (Connection connection = getDatabase().getDataSource().getConnection()) { - if (DatabaseUtils.tableColumnExists(connection, "issue_changes", "project_uuid")) { - // This migration might already have been done in v84 (#3476) if using SQ >= 8.7. - return; - } - String query; - if (getDatabase().getDialect().getId().equals(MsSql.ID)) { - query = "SELECT ic.uuid, ic.kee, ic.issue_key, ic.user_login, ic.change_type, " + - "ic.change_data, ic.created_at, ic.updated_at, ic.issue_change_creation_date, i.project_uuid " + - "INTO tmp_issue_changes " + - "FROM issue_changes AS ic inner join issues i on i.kee = ic.issue_key"; - } else { - query = "create table tmp_issue_changes " + - "(uuid, kee, issue_key, user_login, change_type, change_data, created_at, updated_at, issue_change_creation_date, project_uuid)" + - "as (" + - "SELECT ic.uuid, ic.kee, ic.issue_key, ic.user_login, ic.change_type, ic.change_data, ic.created_at, ic.updated_at, ic.issue_change_creation_date, i.project_uuid " + - "FROM issue_changes ic " + - "inner join issues i on i.kee = ic.issue_key " + - ")"; - } - - context.execute(query); - } - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/CreateUserDismissedMessagesTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/CreateUserDismissedMessagesTable.java deleted file mode 100644 index 75fb793403b..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/CreateUserDismissedMessagesTable.java +++ /dev/null @@ -1,102 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v85; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.def.BigIntegerColumnDef; -import org.sonar.server.platform.db.migration.def.VarcharColumnDef; -import org.sonar.server.platform.db.migration.sql.CreateIndexBuilder; -import org.sonar.server.platform.db.migration.sql.CreateTableBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.sonar.server.platform.db.migration.def.BigIntegerColumnDef.newBigIntegerColumnDefBuilder; -import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.UUID_SIZE; -import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder; - -public class CreateUserDismissedMessagesTable extends DdlChange { - - private static final String TABLE_NAME = "user_dismissed_messages"; - - private static final VarcharColumnDef UUID_COLUMN = newVarcharColumnDefBuilder() - .setColumnName("uuid") - .setIsNullable(false) - .setLimit(UUID_SIZE) - .build(); - - private static final VarcharColumnDef USER_UUID_COLUMN = newVarcharColumnDefBuilder() - .setColumnName("user_uuid") - .setIsNullable(false) - .setLimit(VarcharColumnDef.USER_UUID_SIZE) - .build(); - - private static final VarcharColumnDef PROJECT_UUID = newVarcharColumnDefBuilder() - .setColumnName("project_uuid") - .setIsNullable(false) - .setLimit(UUID_SIZE) - .build(); - - private static final VarcharColumnDef MESSAGE_TYPE = newVarcharColumnDefBuilder() - .setColumnName("message_type") - .setIsNullable(false) - .setLimit(255) - .build(); - - private static final BigIntegerColumnDef CREATED_AT = newBigIntegerColumnDefBuilder() - .setColumnName("created_at") - .setIsNullable(false) - .build(); - - public CreateUserDismissedMessagesTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new CreateTableBuilder(getDialect(), TABLE_NAME) - .addPkColumn(UUID_COLUMN) - .addColumn(USER_UUID_COLUMN) - .addColumn(PROJECT_UUID) - .addColumn(MESSAGE_TYPE) - .addColumn(CREATED_AT) - .build()); - - context.execute(new CreateIndexBuilder() - .setTable(TABLE_NAME) - .setName("uniq_user_dismissed_messages") - .setUnique(true) - .addColumn(USER_UUID_COLUMN) - .addColumn(PROJECT_UUID) - .addColumn(MESSAGE_TYPE) - .build()); - - context.execute(new CreateIndexBuilder() - .setTable(TABLE_NAME) - .setName("udm_project_uuid") - .addColumn(PROJECT_UUID) - .build()); - - context.execute(new CreateIndexBuilder() - .setTable(TABLE_NAME) - .setName("udm_message_type") - .addColumn(MESSAGE_TYPE) - .build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/DbVersion85.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/DbVersion85.java deleted file mode 100644 index 01fcb2a77a0..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/DbVersion85.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v85; - -import org.sonar.server.platform.db.migration.step.MigrationStepRegistry; -import org.sonar.server.platform.db.migration.version.DbVersion; - -public class DbVersion85 implements DbVersion { - - @Override - public void addSteps(MigrationStepRegistry registry) { - registry - .add(4000, "Delete 'project_alm_settings' orphans", DeleteProjectAlmSettingsOrphans.class) - .add(4001, "Drop 'period', 'value_warning' columns from 'quality_gates_conditions' table", DropPeriodAndValueWarningColumnsFromQualityGateConditionsTable.class) - .add(4002, "Drop 'project_alm_bindings' table", DropProjectAlmBindings.class) - .add(4003, "Drop unused variation values columns in 'project_measures' table", DropUnusedVariationsInProjectMeasures.class) - .add(4004, "Drop unused periods in 'snapshots' table", DropUnusedPeriodsInSnapshots.class) - .add(4005, "Drop orphan favorites from 'properties' table", DropOrphanFavoritesFromProperties.class) - - .add(4006, "create 'tmp_issue_changes' table", CreateTmpIssueChangesTable.class) - .add(4007, "drop 'issue_changes' table", DropIssueChangesTable.class) - .add(4008, "rename 'tmp_issue_changes' table to 'issue_changes'", RenameTmpIssueChangesToIssueChanges.class) - .add(4009, "Make 'issueKey' not nullable for 'issue_changes' table", MakeIssueKeyNotNullOnIssueChangesTable.class) - .add(4010, "Make 'uuid' not nullable for 'issue_changes' table", MakeUuidNotNullOnIssueChangesTable.class) - .add(4011, "Make 'project_uuid' not nullable for 'issue_changes' table", MakeProjectUuidNotNullOnIssueChangesTable.class) - .add(4012, "add PK table to 'issue_changes'", AddPrimaryKeyOnUuidForIssueChangesTable.class) - .add(4013, "add index on 'issue_key' for table 'issue_changes'", AddIndexOnIssueKeyForIssueChangesTable.class) - .add(4014, "add index on 'kee' for table 'issue_changes'", AddIndexOnKeeForIssueChangesTable.class) - .add(4015, "add index on 'project_uuid' for table 'issue_changes'", AddIndexOnProjectUuidOnIssueChangesTable.class) - - .add(4016, "Add 'type' column to 'plugins' table", AddTypeToPlugins.class) - .add(4017, "Populate 'type' column in 'plugins' table", PopulateTypeInPlugins.class) - .add(4018, "Alter 'type' column in 'plugins' to not nullable", AlterTypeInPluginNotNullable.class) - .add(4019, "Add 'message_type' column to 'ce_task_message' table", AddMessageTypeColumnToCeTaskMessageTable.class) - .add(4020, "Populate 'message_type' column of 'ce_task_message' table", PopulateMessageTypeColumnOfCeTaskMessageTable.class) - .add(4021, "Make 'message_type' column not nullable for `ce_task_message` table", MakeMessageTypeColumnNotNullableOnCeTaskMessageTable.class) - .add(4022, "Add index on 'message_type' column of `ce_task_message` table", AddIndexOnMessageTypeColumnOfCeTaskMessageTable.class) - .add(4023, "Create 'user_dismissed_messages' table", CreateUserDismissedMessagesTable.class) - .add(4024, "Populate 'branch_type' in 'project_branches'", FillProjectBranchesBranchType.class) - .add(4025, "Make 'branch_type' in 'project_branches' not nullable", MakeProjectBranchesBranchTypeNotNullable.class) - .add(4026, "Drop column 'key_type' in table 'project_branches'", DropProjectBranchesKeyType.class) - ; - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/DeleteProjectAlmSettingsOrphans.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/DeleteProjectAlmSettingsOrphans.java deleted file mode 100644 index 2f107ec6c61..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/DeleteProjectAlmSettingsOrphans.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v85; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.step.DataChange; -import org.sonar.server.platform.db.migration.step.MassUpdate; - -public class DeleteProjectAlmSettingsOrphans extends DataChange { - - public DeleteProjectAlmSettingsOrphans(Database db) { - super(db); - } - - @Override - protected void execute(Context context) throws SQLException { - MassUpdate massUpdate = context.prepareMassUpdate(); - massUpdate.select("select pas.uuid from project_alm_settings pas left join " - + "projects p on pas.project_uuid = p.uuid where p.uuid is null"); - massUpdate.update("delete from project_alm_settings where uuid = ?"); - - massUpdate.execute((row, update) -> { - String notExistingProjectUuid = row.getString(1); - update.setString(1, notExistingProjectUuid); - return true; - }); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/DropIssueChangesTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/DropIssueChangesTable.java deleted file mode 100644 index 22aab062fb4..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/DropIssueChangesTable.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v85; - -import java.sql.Connection; -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.db.DatabaseUtils; -import org.sonar.server.platform.db.migration.sql.DropTableBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class DropIssueChangesTable extends DdlChange { - public DropIssueChangesTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - try (Connection connection = getDatabase().getDataSource().getConnection()) { - if (DatabaseUtils.tableExists("tmp_issue_changes", connection)) { - context.execute(new DropTableBuilder(getDialect(), "issue_changes").build()); - } - } - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/DropOrphanFavoritesFromProperties.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/DropOrphanFavoritesFromProperties.java deleted file mode 100644 index d8959db8009..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/DropOrphanFavoritesFromProperties.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v85; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.step.DataChange; -import org.sonar.server.platform.db.migration.step.MassUpdate; - -public class DropOrphanFavoritesFromProperties extends DataChange { - - public DropOrphanFavoritesFromProperties(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - MassUpdate massUpdate = context.prepareMassUpdate(); - massUpdate.select("select uuid from properties where prop_key = ? and component_uuid is null") - .setString(1, "favourite"); - massUpdate.update("delete from properties where uuid = ?"); - - massUpdate.execute((row, update) -> { - String propertyUuid = row.getString(1); - update.setString(1, propertyUuid); - return true; - }); - - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/DropPeriodAndValueWarningColumnsFromQualityGateConditionsTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/DropPeriodAndValueWarningColumnsFromQualityGateConditionsTable.java deleted file mode 100644 index 37a551cf9b1..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/DropPeriodAndValueWarningColumnsFromQualityGateConditionsTable.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v85; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.DropColumnsBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class DropPeriodAndValueWarningColumnsFromQualityGateConditionsTable extends DdlChange { - - public DropPeriodAndValueWarningColumnsFromQualityGateConditionsTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new DropColumnsBuilder(getDialect(), "quality_gate_conditions", "value_warning", "period").build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/DropProjectAlmBindings.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/DropProjectAlmBindings.java deleted file mode 100644 index d6c9a02b76f..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/DropProjectAlmBindings.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v85; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.DropIndexBuilder; -import org.sonar.server.platform.db.migration.sql.DropTableBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class DropProjectAlmBindings extends DdlChange { - private static final String TABLE_NAME = "project_alm_bindings"; - - public DropProjectAlmBindings(Database db) { - super(db); - } - - @Override public void execute(Context context) throws SQLException { - context.execute(new DropIndexBuilder(getDialect()).setTable(TABLE_NAME).setName("project_alm_bindings_alm_repo").build()); - context.execute(new DropIndexBuilder(getDialect()).setTable(TABLE_NAME).setName("project_alm_bindings_project").build()); - context.execute(new DropTableBuilder(getDialect(), TABLE_NAME).build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/DropProjectBranchesKeyType.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/DropProjectBranchesKeyType.java deleted file mode 100644 index 62ed921e284..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/DropProjectBranchesKeyType.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v85; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.CreateIndexBuilder; -import org.sonar.server.platform.db.migration.sql.DropColumnsBuilder; -import org.sonar.server.platform.db.migration.sql.DropIndexBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class DropProjectBranchesKeyType extends DdlChange { - private static final String TABLE_NAME = "project_branches"; - - public DropProjectBranchesKeyType(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new DropIndexBuilder(getDialect()).setTable(TABLE_NAME).setName("project_branches_kee_key_type").build()); - context.execute(new DropColumnsBuilder(getDialect(), TABLE_NAME, "key_type").build()); - context.execute(new CreateIndexBuilder() - .setTable(TABLE_NAME) - .setUnique(true) - .setName("uniq_project_branches") - .addColumn("branch_type") - .addColumn("project_uuid") - .addColumn("kee") - .build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/DropUnusedIndexes.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/DropUnusedIndexes.java deleted file mode 100644 index cb1da7d5de7..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/DropUnusedIndexes.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v85; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.DropIndexBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class DropUnusedIndexes extends DdlChange { - public DropUnusedIndexes(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - // duplicated by its PK - context.execute(new DropIndexBuilder(getDialect()).setTable("events").setName("events_uuid").build()); - // duplicated by its PK - context.execute(new DropIndexBuilder(getDialect()).setTable("ce_activity").setName("ce_activity_uuid").build()); - // no query filtering or ordering by users_updated_at - context.execute(new DropIndexBuilder(getDialect()).setTable("file_sources").setName("file_sources_updated_at").build()); - // no query filtering or ordering by users_updated_at - context.execute(new DropIndexBuilder(getDialect()).setTable("users").setName("users_updated_at").build()); - // not used - context.execute(new DropIndexBuilder(getDialect()).setTable("alm_app_installs").setName("alm_app_installs_external_id").build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/DropUnusedPeriodsInSnapshots.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/DropUnusedPeriodsInSnapshots.java deleted file mode 100644 index 1f6d780374c..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/DropUnusedPeriodsInSnapshots.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v85; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.db.dialect.MsSql; -import org.sonar.server.platform.db.migration.sql.DropColumnsBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; -import org.sonar.server.platform.db.migration.sql.DropMsSQLDefaultConstraintsBuilder; - -public class DropUnusedPeriodsInSnapshots extends DdlChange { - private static final String TABLE_NAME = "snapshots"; - private static final String[] COLUMNS = {"period2_mode", "period2_param", "period2_date", - "period3_mode", "period3_param", "period3_date", "period4_mode", "period4_param", "period4_date", "period5_mode", - "period5_param", "period5_date"}; - private final Database db; - - public DropUnusedPeriodsInSnapshots(Database db) { - super(db); - this.db = db; - } - - @Override - public void execute(Context context) throws SQLException { - if (MsSql.ID.equals(db.getDialect().getId())) { - context.execute(new DropMsSQLDefaultConstraintsBuilder(db).setTable(TABLE_NAME).setColumns(COLUMNS).build()); - } - context.execute(new DropColumnsBuilder(getDialect(), TABLE_NAME, COLUMNS).build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/DropUnusedVariationsInProjectMeasures.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/DropUnusedVariationsInProjectMeasures.java deleted file mode 100644 index 1c42f6f47f1..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/DropUnusedVariationsInProjectMeasures.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v85; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.db.dialect.MsSql; -import org.sonar.server.platform.db.migration.sql.DropColumnsBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; -import org.sonar.server.platform.db.migration.sql.DropMsSQLDefaultConstraintsBuilder; - -public class DropUnusedVariationsInProjectMeasures extends DdlChange { - private static final String TABLE_NAME = "project_measures"; - private static final String[] COLUMNS = {"variation_value_2", "variation_value_3", "variation_value_4", "variation_value_5"}; - private final Database db; - - public DropUnusedVariationsInProjectMeasures(Database db) { - super(db); - this.db = db; - } - - @Override - public void execute(Context context) throws SQLException { - if (MsSql.ID.equals(db.getDialect().getId())) { - context.execute(new DropMsSQLDefaultConstraintsBuilder(db).setTable(TABLE_NAME).setColumns(COLUMNS).build()); - } - context.execute(new DropColumnsBuilder(getDialect(), TABLE_NAME, COLUMNS).build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/FillProjectBranchesBranchType.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/FillProjectBranchesBranchType.java deleted file mode 100644 index 6a4123140ca..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/FillProjectBranchesBranchType.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v85; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.step.DataChange; -import org.sonar.server.platform.db.migration.step.MassUpdate; - -public class FillProjectBranchesBranchType extends DataChange { - public FillProjectBranchesBranchType(Database db) { - super(db); - } - - @Override - protected void execute(Context context) throws SQLException { - MassUpdate massUpdate = context.prepareMassUpdate(); - massUpdate.select("select uuid, key_type from project_branches where branch_type is null"); - massUpdate.update("update project_branches set branch_type = ? where uuid = ?"); - massUpdate.execute((row, update) -> { - String uuid = row.getString(1); - String type = row.getString(2); - - update.setString(1, type); - update.setString(2, uuid); - return true; - }); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/MakeIssueKeyNotNullOnIssueChangesTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/MakeIssueKeyNotNullOnIssueChangesTable.java deleted file mode 100644 index 50c44faae16..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/MakeIssueKeyNotNullOnIssueChangesTable.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v85; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.def.VarcharColumnDef; -import org.sonar.server.platform.db.migration.sql.AlterColumnsBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder; - -public class MakeIssueKeyNotNullOnIssueChangesTable extends DdlChange { - - private static final String TABLE = "issue_changes"; - - private static final VarcharColumnDef columnDefinition = newVarcharColumnDefBuilder() - .setColumnName("issue_key") - .setIsNullable(false) - .setDefaultValue(null) - .setLimit(VarcharColumnDef.UUID_VARCHAR_SIZE) - .build(); - - public MakeIssueKeyNotNullOnIssueChangesTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new AlterColumnsBuilder(getDialect(), TABLE) - .updateColumn(columnDefinition) - .build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/MakeMessageTypeColumnNotNullableOnCeTaskMessageTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/MakeMessageTypeColumnNotNullableOnCeTaskMessageTable.java deleted file mode 100644 index dec4912ae17..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/MakeMessageTypeColumnNotNullableOnCeTaskMessageTable.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v85; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.def.VarcharColumnDef; -import org.sonar.server.platform.db.migration.sql.AlterColumnsBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder; - -public class MakeMessageTypeColumnNotNullableOnCeTaskMessageTable extends DdlChange { - private static final VarcharColumnDef MESSAGE_TYPE = newVarcharColumnDefBuilder() - .setColumnName("message_type") - .setIsNullable(false) - .setLimit(255) - .build(); - - public MakeMessageTypeColumnNotNullableOnCeTaskMessageTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new AlterColumnsBuilder(getDialect(), "ce_task_message") - .updateColumn(MESSAGE_TYPE) - .build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/MakeProjectBranchesBranchTypeNotNullable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/MakeProjectBranchesBranchTypeNotNullable.java deleted file mode 100644 index 354e357ee85..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/MakeProjectBranchesBranchTypeNotNullable.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v85; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.AlterColumnsBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder; - -public class MakeProjectBranchesBranchTypeNotNullable extends DdlChange { - public MakeProjectBranchesBranchTypeNotNullable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new AlterColumnsBuilder(getDialect(), "project_branches") - .updateColumn(newVarcharColumnDefBuilder() - .setLimit(12) - .setIsNullable(false) - .setColumnName("branch_type") - .build()).build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/MakeProjectUuidNotNullOnIssueChangesTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/MakeProjectUuidNotNullOnIssueChangesTable.java deleted file mode 100644 index 74f864c62a7..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/MakeProjectUuidNotNullOnIssueChangesTable.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v85; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.def.VarcharColumnDef; -import org.sonar.server.platform.db.migration.sql.AlterColumnsBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder; - -public class MakeProjectUuidNotNullOnIssueChangesTable extends DdlChange { - - private static final String TABLE = "issue_changes"; - - private static final VarcharColumnDef columnDefinition = newVarcharColumnDefBuilder() - .setColumnName("project_uuid") - .setIsNullable(false) - .setDefaultValue(null) - .setLimit(VarcharColumnDef.UUID_VARCHAR_SIZE) - .build(); - - public MakeProjectUuidNotNullOnIssueChangesTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new AlterColumnsBuilder(getDialect(), TABLE) - .updateColumn(columnDefinition) - .build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/MakeUuidNotNullOnIssueChangesTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/MakeUuidNotNullOnIssueChangesTable.java deleted file mode 100644 index 8abedf9be78..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/MakeUuidNotNullOnIssueChangesTable.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v85; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.def.VarcharColumnDef; -import org.sonar.server.platform.db.migration.sql.AlterColumnsBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder; - -public class MakeUuidNotNullOnIssueChangesTable extends DdlChange { - - private static final String TABLE = "issue_changes"; - - private static final VarcharColumnDef columnDefinition = newVarcharColumnDefBuilder() - .setColumnName("uuid") - .setIsNullable(false) - .setDefaultValue(null) - .setLimit(VarcharColumnDef.UUID_SIZE) - .build(); - - public MakeUuidNotNullOnIssueChangesTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new AlterColumnsBuilder(getDialect(), TABLE) - .updateColumn(columnDefinition) - .build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/PopulateFileSourceLineCount.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/PopulateFileSourceLineCount.java deleted file mode 100644 index 29fe68c39ba..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/PopulateFileSourceLineCount.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v85; - -import java.sql.SQLException; -import org.apache.commons.lang.StringUtils; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.step.DataChange; -import org.sonar.server.platform.db.migration.step.MassUpdate; -import org.sonar.server.platform.db.migration.step.Select; -import org.sonar.server.platform.db.migration.step.SqlStatement; - -public class PopulateFileSourceLineCount extends DataChange { - static final int LINE_COUNT_NOT_POPULATED = -1; - private static final String NEW_LINE = "\n"; - - public PopulateFileSourceLineCount(Database database) { - super(database); - } - - @Override - protected void execute(Context context) throws SQLException { - MassUpdate massUpdate = context.prepareMassUpdate(); - massUpdate.select("select uuid, line_hashes from file_sources where line_count = ?").setInt(1, LINE_COUNT_NOT_POPULATED); - massUpdate.update("update file_sources set line_count = ? where uuid = ?"); - massUpdate.rowPluralName("line counts of file sources"); - massUpdate.execute(PopulateFileSourceLineCount::handle); - } - - private static boolean handle(Select.Row row, SqlStatement update) throws SQLException { - String rowUuid = row.getString(1); - String rawData = row.getNullableString(2); - - int lineCount = rawData == null ? 0 : (StringUtils.countMatches(rawData, NEW_LINE) + 1); - update.setInt(1, lineCount); - update.setString(2, rowUuid); - return true; - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/PopulateMessageTypeColumnOfCeTaskMessageTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/PopulateMessageTypeColumnOfCeTaskMessageTable.java deleted file mode 100644 index 0173404b19b..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/PopulateMessageTypeColumnOfCeTaskMessageTable.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v85; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.step.DataChange; -import org.sonar.server.platform.db.migration.step.MassUpdate; - -public class PopulateMessageTypeColumnOfCeTaskMessageTable extends DataChange { - public PopulateMessageTypeColumnOfCeTaskMessageTable(Database db) { - super(db); - } - - @Override - protected void execute(DataChange.Context context) throws SQLException { - MassUpdate massUpdate = context.prepareMassUpdate(); - massUpdate.select("select ctm.uuid from ce_task_message ctm where ctm.message_type is null"); - massUpdate.update("update ce_task_message set message_type = ? where uuid = ?"); - massUpdate.execute((row, update) -> { - update.setString(1, "GENERIC"); - update.setString(2, row.getString(1)); - return true; - }); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/PopulateTypeInPlugins.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/PopulateTypeInPlugins.java deleted file mode 100644 index 6c8e8918525..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/PopulateTypeInPlugins.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v85; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.step.DataChange; - -public class PopulateTypeInPlugins extends DataChange { - public PopulateTypeInPlugins(Database db) { - super(db); - } - - @Override - protected void execute(Context context) throws SQLException { - context.prepareUpsert("update plugins set type = 'EXTERNAL' where type is null") - .execute() - .commit(); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/RenameTmpIssueChangesToIssueChanges.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/RenameTmpIssueChangesToIssueChanges.java deleted file mode 100644 index 2800416a523..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/RenameTmpIssueChangesToIssueChanges.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v85; - -import java.sql.Connection; -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.db.DatabaseUtils; -import org.sonar.server.platform.db.migration.sql.RenameTableBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class RenameTmpIssueChangesToIssueChanges extends DdlChange { - - public RenameTmpIssueChangesToIssueChanges(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - try (Connection connection = getDatabase().getDataSource().getConnection()) { - if (DatabaseUtils.tableExists("tmp_issue_changes", connection)) { - context.execute(new RenameTableBuilder(getDialect()) - .setName("tmp_issue_changes").setNewName("issue_changes") - .setAutoGeneratedId(false) - .build()); - } - } - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/package-info.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/package-info.java deleted file mode 100644 index 431939eb693..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v85/package-info.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v85; - -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v86/AddIndexToApplicationBranchProjs.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v86/AddIndexToApplicationBranchProjs.java deleted file mode 100644 index 3062e309c46..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v86/AddIndexToApplicationBranchProjs.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v86; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.CreateIndexBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class AddIndexToApplicationBranchProjs extends DdlChange { - private static final String TABLE = "app_branch_project_branch"; - - public AddIndexToApplicationBranchProjs(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new CreateIndexBuilder() - .setTable(TABLE) - .setName("uniq_app_branch_proj") - .addColumn("application_branch_uuid") - .addColumn("project_branch_uuid") - .setUnique(true) - .build()); - - context.execute(new CreateIndexBuilder() - .setTable(TABLE) - .setName("idx_abpb_app_uuid") - .addColumn("application_uuid") - .build()); - - context.execute(new CreateIndexBuilder() - .setTable(TABLE) - .setName("idx_abpb_app_branch_uuid") - .addColumn("application_branch_uuid") - .build()); - - context.execute(new CreateIndexBuilder() - .setTable(TABLE) - .setName("idx_abpb_proj_uuid") - .addColumn("project_uuid") - .build()); - - context.execute(new CreateIndexBuilder() - .setTable(TABLE) - .setName("idx_abpb_proj_branch_uuid") - .addColumn("project_branch_uuid") - .build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v86/AddIndexToApplicationProjects.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v86/AddIndexToApplicationProjects.java deleted file mode 100644 index a75f6a7c27d..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v86/AddIndexToApplicationProjects.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v86; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.CreateIndexBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class AddIndexToApplicationProjects extends DdlChange { - private static final String TABLE = "app_projects"; - - public AddIndexToApplicationProjects(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new CreateIndexBuilder() - .setTable(TABLE) - .setName("uniq_app_projects") - .addColumn("application_uuid") - .addColumn("project_uuid") - .setUnique(true) - .build()); - - context.execute(new CreateIndexBuilder() - .setTable(TABLE) - .setName("idx_app_proj_application_uuid") - .addColumn("application_uuid") - .build()); - - context.execute(new CreateIndexBuilder() - .setTable(TABLE) - .setName("idx_app_proj_project_uuid") - .addColumn("project_uuid") - .build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v86/AddPkToApplicationBranchProjs.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v86/AddPkToApplicationBranchProjs.java deleted file mode 100644 index 334488717da..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v86/AddPkToApplicationBranchProjs.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v86; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.AddPrimaryKeyBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class AddPkToApplicationBranchProjs extends DdlChange { - private static final String TABLE = "app_branch_project_branch"; - - public AddPkToApplicationBranchProjs(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new AddPrimaryKeyBuilder(TABLE, "uuid").build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v86/AddPkToApplicationProjects.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v86/AddPkToApplicationProjects.java deleted file mode 100644 index b3137c8b55f..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v86/AddPkToApplicationProjects.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v86; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.AddPrimaryKeyBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class AddPkToApplicationProjects extends DdlChange { - private static final String TABLE = "app_projects"; - - public AddPkToApplicationProjects(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new AddPrimaryKeyBuilder(TABLE, "uuid").build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v86/AddPrimaryKeyToDefaultQProfiles.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v86/AddPrimaryKeyToDefaultQProfiles.java deleted file mode 100644 index 36bd5f5c39f..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v86/AddPrimaryKeyToDefaultQProfiles.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v86; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.AddPrimaryKeyBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class AddPrimaryKeyToDefaultQProfiles extends DdlChange { - public AddPrimaryKeyToDefaultQProfiles(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new AddPrimaryKeyBuilder("default_qprofiles", "language").build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v86/AddResetPasswordColumnToUsers.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v86/AddResetPasswordColumnToUsers.java deleted file mode 100644 index d5710a3c2b1..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v86/AddResetPasswordColumnToUsers.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v86; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.def.BooleanColumnDef; -import org.sonar.server.platform.db.migration.sql.AddColumnsBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.sonar.server.platform.db.migration.def.BooleanColumnDef.newBooleanColumnDefBuilder; - -public class AddResetPasswordColumnToUsers extends DdlChange { - private static final String TABLE = "users"; - private static final String NEW_COLUMN = "reset_password"; - - public AddResetPasswordColumnToUsers(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - BooleanColumnDef column = newBooleanColumnDefBuilder() - .setColumnName(NEW_COLUMN) - .setIsNullable(true) - .build(); - context.execute(new AddColumnsBuilder(getDialect(), TABLE) - .addColumn(column) - .build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v86/AddUniqueIndexOnNameColumnOfGroupsTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v86/AddUniqueIndexOnNameColumnOfGroupsTable.java deleted file mode 100644 index 2a5c2d0332e..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v86/AddUniqueIndexOnNameColumnOfGroupsTable.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v86; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.def.VarcharColumnDef; -import org.sonar.server.platform.db.migration.sql.CreateIndexBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class AddUniqueIndexOnNameColumnOfGroupsTable extends DdlChange { - private static final String TABLE_NAME = "groups"; - private static final String INDEX_NAME = "uniq_groups_name"; - - public AddUniqueIndexOnNameColumnOfGroupsTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new CreateIndexBuilder() - .setUnique(true) - .setTable(TABLE_NAME) - .setName(INDEX_NAME) - .addColumn(new VarcharColumnDef.Builder() - .setColumnName("name") - .setIgnoreOracleUnit(true) - .setLimit(500) - .setIsNullable(false) - .build()) - .build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v86/CreateApplicationBranchProjs.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v86/CreateApplicationBranchProjs.java deleted file mode 100644 index 25fab321e9a..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v86/CreateApplicationBranchProjs.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v86; - -import java.sql.SQLException; -import org.sonar.core.util.Uuids; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.CreateTableBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.sonar.server.platform.db.migration.def.BigIntegerColumnDef.newBigIntegerColumnDefBuilder; -import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder; - -public class CreateApplicationBranchProjs extends DdlChange { - public CreateApplicationBranchProjs(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new CreateTableBuilder(getDialect(), "app_branch_project_branch") - .addColumn(newVarcharColumnDefBuilder().setColumnName("uuid").setIsNullable(false).setLimit(Uuids.MAX_LENGTH).build()) - .addColumn(newVarcharColumnDefBuilder().setColumnName("application_uuid").setIsNullable(false).setLimit(Uuids.MAX_LENGTH).build()) - .addColumn(newVarcharColumnDefBuilder().setColumnName("application_branch_uuid").setIsNullable(false).setLimit(Uuids.MAX_LENGTH).build()) - .addColumn(newVarcharColumnDefBuilder().setColumnName("project_uuid").setIsNullable(false).setLimit(Uuids.MAX_LENGTH).build()) - .addColumn(newVarcharColumnDefBuilder().setColumnName("project_branch_uuid").setIsNullable(false).setLimit(Uuids.MAX_LENGTH).build()) - .addColumn(newBigIntegerColumnDefBuilder().setColumnName("created_at").setIsNullable(false).build()) - .build()); - } - -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v86/CreateApplicationProjectsTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v86/CreateApplicationProjectsTable.java deleted file mode 100644 index 8caf18cba3a..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v86/CreateApplicationProjectsTable.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v86; - -import java.sql.SQLException; -import org.sonar.core.util.Uuids; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.CreateTableBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.sonar.server.platform.db.migration.def.BigIntegerColumnDef.newBigIntegerColumnDefBuilder; -import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder; - -public class CreateApplicationProjectsTable extends DdlChange { - public CreateApplicationProjectsTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new CreateTableBuilder(getDialect(), "app_projects") - .addColumn(newVarcharColumnDefBuilder().setColumnName("uuid").setIsNullable(false).setLimit(Uuids.MAX_LENGTH).build()) - .addColumn(newVarcharColumnDefBuilder().setColumnName("application_uuid").setIsNullable(false).setLimit(Uuids.MAX_LENGTH).build()) - .addColumn(newVarcharColumnDefBuilder().setColumnName("project_uuid").setIsNullable(false).setLimit(Uuids.MAX_LENGTH).build()) - .addColumn(newBigIntegerColumnDefBuilder().setColumnName("created_at").setIsNullable(false).build()) - .build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v86/DbVersion86.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v86/DbVersion86.java deleted file mode 100644 index 2200f10a57c..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v86/DbVersion86.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v86; - -import org.sonar.server.platform.db.migration.step.MigrationStepRegistry; -import org.sonar.server.platform.db.migration.version.DbVersion; - -public class DbVersion86 implements DbVersion { - - @Override - public void addSteps(MigrationStepRegistry registry) { - registry - .add(4100, "Drop QPROFILES_ORG_UUID index from 'quality_profile' table", DropOrganizationUuidIndexFromQualityProfileTable.class) - .add(4101, "Drop organization_uuid from 'quality_profile' table", DropOrganizationFromQualityProfileTable.class) - .add(4102, "Drop primary key of table 'default_qprofiles'", DropDefaultQProfilesPk.class) - .add(4103, "Drop organization_uuid from 'default_qprofiles' table", DropOrganizationFromDefaultQProfiles.class) - .add(4104, "Add primary key to the table 'default_qprofiles", AddPrimaryKeyToDefaultQProfiles.class) - .add(4105, "Drop 'organization_uuid' in 'rules_metadata'", DropOrganizationInRulesMetadata.class) - .add(4106, "Update 'change_data' column of 'qprofile_changes' table to use ruleUuid", UpdateChangeDataOfQProfileChanges.class) - .add(4107, "Drop 'organization_uuid' in 'users'", DropOrganizationInUsers.class) - .add(4108, "Drop 'organization_uuid' in 'user_roles'", DropOrganizationInUserRoles.class) - .add(4109, "Drop 'organization_uuid' in 'group_roles'", DropOrganizationInGroupRoles.class) - .add(4110, "Drop 'organization_uuid' in 'permission_templates'", DropOrganizationInPermissionTemplates.class) - .add(4111, "Drop 'organization_uuid' in 'groups'", DropOrganizationInGroups.class) - .add(4112, "Make 'name' column in 'groups' table not nullable", MakeNameColumnInGroupsTableNotNullable.class) - .add(4113, "Make 'name' column in 'groups' table unique", AddUniqueIndexOnNameColumnOfGroupsTable.class) - .add(4114, "Move default permission templates to internal properties", MoveDefaultTemplatesToInternalProperties.class) - .add(4115, "Set 'sonar.forceAuthentication' to false for upgraded instances", SetForceAuthenticationSettings.class) - - .add(4116, "Create table 'app_projects'", CreateApplicationProjectsTable.class) - .add(4117, "Create primary key for 'app_projects'", AddPkToApplicationProjects.class) - .add(4118, "Create index for 'app_projects'", AddIndexToApplicationProjects.class) - - .add(4119, "Create table 'app_branch_project_branch'", CreateApplicationBranchProjs.class) - .add(4120, "Create primary key for 'app_branch_project_branch'", AddPkToApplicationBranchProjs.class) - .add(4121, "Create index for 'app_branch_project_branch'", AddIndexToApplicationBranchProjs.class) - - .add(4122, "Migrate view definitions from xml to db", MigrateApplicationDefinitionsFromXmlToDb.class) - - .add(4123, "Add 'reset_password' column to 'users' table", AddResetPasswordColumnToUsers.class) - .add(4124, "Populate 'reset_password' column with default value", PopulateResetPasswordDefaultValue.class) - .add(4125, "Make 'reset_password' column in 'users' table not nullable", MakeResetPasswordColumnNotNull.class) - - .add(4126, "Secure gitlab secret parameters", SecureGitlabSecretParameters.class) - ; - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v86/DropDefaultQProfilesPk.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v86/DropDefaultQProfilesPk.java deleted file mode 100644 index 3e83f7efbf1..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v86/DropDefaultQProfilesPk.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v86; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.DropPrimaryKeySqlGenerator; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class DropDefaultQProfilesPk extends DdlChange { - private final DropPrimaryKeySqlGenerator dropPrimaryKeySqlGenerator; - private static final String TABLE_NAME = "default_qprofiles"; - private static final String COLUMN_NAME = "language"; - - public DropDefaultQProfilesPk(Database db, DropPrimaryKeySqlGenerator dropPrimaryKeySqlGenerator) { - super(db); - this.dropPrimaryKeySqlGenerator = dropPrimaryKeySqlGenerator; - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(dropPrimaryKeySqlGenerator.generate(TABLE_NAME, COLUMN_NAME, false)); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v86/DropOrganizationFromDefaultQProfiles.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v86/DropOrganizationFromDefaultQProfiles.java deleted file mode 100644 index 1f04e18b3df..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v86/DropOrganizationFromDefaultQProfiles.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v86; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.DropColumnsBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class DropOrganizationFromDefaultQProfiles extends DdlChange { - public DropOrganizationFromDefaultQProfiles(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new DropColumnsBuilder(getDialect(), "default_qprofiles", "organization_uuid").build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v86/DropOrganizationFromQualityProfileTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v86/DropOrganizationFromQualityProfileTable.java deleted file mode 100644 index c8c1cefa00f..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v86/DropOrganizationFromQualityProfileTable.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v86; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.DropColumnsBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class DropOrganizationFromQualityProfileTable extends DdlChange { - - public DropOrganizationFromQualityProfileTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new DropColumnsBuilder(getDialect(), "org_qprofiles", "organization_uuid").build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v86/DropOrganizationInGroupRoles.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v86/DropOrganizationInGroupRoles.java deleted file mode 100644 index 4133a64d530..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v86/DropOrganizationInGroupRoles.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v86; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.CreateIndexBuilder; -import org.sonar.server.platform.db.migration.sql.DropColumnsBuilder; -import org.sonar.server.platform.db.migration.sql.DropIndexBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class DropOrganizationInGroupRoles extends DdlChange { - - private static final String TABLE_NAME = "group_roles"; - - public DropOrganizationInGroupRoles(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute( - new DropIndexBuilder(getDialect()) - .setTable(TABLE_NAME) - .setName("uniq_group_roles") - .build()); - context.execute(new DropColumnsBuilder(getDialect(), TABLE_NAME, "organization_uuid").build()); - context.execute(new CreateIndexBuilder() - .setTable(TABLE_NAME) - .setName("uniq_group_roles") - .addColumn("group_uuid") - .addColumn("component_uuid") - .addColumn("role") - .setUnique(true) - .build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v86/DropOrganizationInGroups.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v86/DropOrganizationInGroups.java deleted file mode 100644 index 9c660c425cd..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v86/DropOrganizationInGroups.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v86; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.DropColumnsBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class DropOrganizationInGroups extends DdlChange { - - private static final String TABLE_NAME = "groups"; - - public DropOrganizationInGroups(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new DropColumnsBuilder(getDialect(), TABLE_NAME, "organization_uuid").build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v86/DropOrganizationInPermissionTemplates.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v86/DropOrganizationInPermissionTemplates.java deleted file mode 100644 index 79ee99aab9d..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v86/DropOrganizationInPermissionTemplates.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v86; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.DropColumnsBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class DropOrganizationInPermissionTemplates extends DdlChange { - - private static final String TABLE_NAME = "permission_templates"; - - public DropOrganizationInPermissionTemplates(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new DropColumnsBuilder(getDialect(), TABLE_NAME, "organization_uuid").build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v86/DropOrganizationInRulesMetadata.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v86/DropOrganizationInRulesMetadata.java deleted file mode 100644 index 9aec063466d..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v86/DropOrganizationInRulesMetadata.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v86; - -import java.sql.SQLException; -import java.util.Arrays; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.AddPrimaryKeyBuilder; -import org.sonar.server.platform.db.migration.sql.DropColumnsBuilder; -import org.sonar.server.platform.db.migration.sql.DropPrimaryKeySqlGenerator; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class DropOrganizationInRulesMetadata extends DdlChange { - private static final String TABLE_NAME = "rules_metadata"; - private final DropPrimaryKeySqlGenerator dropPrimaryKeySqlGenerator; - - public DropOrganizationInRulesMetadata(Database db, DropPrimaryKeySqlGenerator dropPrimaryKeySqlGenerator) { - super(db); - this.dropPrimaryKeySqlGenerator = dropPrimaryKeySqlGenerator; - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(dropPrimaryKeySqlGenerator.generate(TABLE_NAME, Arrays.asList("rule_uuid", "organization_uuid"), false)); - context.execute(new DropColumnsBuilder(getDialect(), TABLE_NAME, "organization_uuid").build()); - context.execute(new AddPrimaryKeyBuilder(TABLE_NAME, "rule_uuid").build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v86/DropOrganizationInUserRoles.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v86/DropOrganizationInUserRoles.java deleted file mode 100644 index f40fd2cf28f..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v86/DropOrganizationInUserRoles.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v86; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.DropColumnsBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class DropOrganizationInUserRoles extends DdlChange { - - private static final String TABLE_NAME = "user_roles"; - - public DropOrganizationInUserRoles(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new DropColumnsBuilder(getDialect(), TABLE_NAME, "organization_uuid").build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v86/DropOrganizationInUsers.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v86/DropOrganizationInUsers.java deleted file mode 100644 index 0bd91371188..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v86/DropOrganizationInUsers.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v86; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.DropColumnsBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class DropOrganizationInUsers extends DdlChange { - - private static final String TABLE_NAME = "users"; - - public DropOrganizationInUsers(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new DropColumnsBuilder(getDialect(), TABLE_NAME, "organization_uuid").build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v86/DropOrganizationUuidIndexFromQualityProfileTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v86/DropOrganizationUuidIndexFromQualityProfileTable.java deleted file mode 100644 index e11e9c7ab39..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v86/DropOrganizationUuidIndexFromQualityProfileTable.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v86; - -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.step.DropIndexChange; - -public class DropOrganizationUuidIndexFromQualityProfileTable extends DropIndexChange { - private static final String TABLE_NAME = "org_qprofiles"; - private static final String INDEX_NAME = "qprofiles_org_uuid"; - - public DropOrganizationUuidIndexFromQualityProfileTable(Database db) { - super(db, INDEX_NAME, TABLE_NAME); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v86/MakeNameColumnInGroupsTableNotNullable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v86/MakeNameColumnInGroupsTableNotNullable.java deleted file mode 100644 index 09592caee5d..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v86/MakeNameColumnInGroupsTableNotNullable.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v86; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.def.VarcharColumnDef; -import org.sonar.server.platform.db.migration.sql.AlterColumnsBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder; - -public class MakeNameColumnInGroupsTableNotNullable extends DdlChange { - private static final String TABLE = "groups"; - - private static final VarcharColumnDef columnDefinition = newVarcharColumnDefBuilder() - .setColumnName("name") - .setIsNullable(false) - .setIgnoreOracleUnit(true) - .setLimit(500) - .build(); - - public MakeNameColumnInGroupsTableNotNullable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new AlterColumnsBuilder(getDialect(), TABLE) - .updateColumn(columnDefinition) - .build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v86/MakeResetPasswordColumnNotNull.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v86/MakeResetPasswordColumnNotNull.java deleted file mode 100644 index 744bb1ea349..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v86/MakeResetPasswordColumnNotNull.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v86; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.def.BooleanColumnDef; -import org.sonar.server.platform.db.migration.sql.AlterColumnsBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.sonar.server.platform.db.migration.def.BooleanColumnDef.newBooleanColumnDefBuilder; - -public class MakeResetPasswordColumnNotNull extends DdlChange { - private static final String TABLE = "users"; - private static final String RESET_PASSWORD_COLUMN_NAME = "reset_password"; - - private static final BooleanColumnDef columnDefinition = newBooleanColumnDefBuilder() - .setColumnName(RESET_PASSWORD_COLUMN_NAME) - .setIsNullable(false) - .build(); - - public MakeResetPasswordColumnNotNull(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new AlterColumnsBuilder(getDialect(), TABLE) - .updateColumn(columnDefinition) - .build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v86/MigrateApplicationDefinitionsFromXmlToDb.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v86/MigrateApplicationDefinitionsFromXmlToDb.java deleted file mode 100644 index 2dce4e79808..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v86/MigrateApplicationDefinitionsFromXmlToDb.java +++ /dev/null @@ -1,743 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v86; - -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.StringReader; -import java.io.StringWriter; -import java.io.Writer; -import java.sql.SQLException; -import java.util.AbstractMap; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import java.util.TreeSet; -import java.util.regex.Pattern; -import java.util.stream.Collectors; -import javax.annotation.CheckForNull; -import javax.annotation.Nullable; -import javax.xml.XMLConstants; -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.parsers.SAXParser; -import javax.xml.parsers.SAXParserFactory; -import javax.xml.stream.XMLInputFactory; -import javax.xml.stream.XMLStreamException; -import javax.xml.transform.sax.SAXSource; -import javax.xml.validation.SchemaFactory; -import org.apache.commons.lang.StringUtils; -import org.codehaus.staxmate.SMInputFactory; -import org.codehaus.staxmate.in.SMHierarchicCursor; -import org.codehaus.staxmate.in.SMInputCursor; -import org.sonar.api.resources.Qualifiers; -import org.sonar.api.utils.System2; -import org.sonar.core.util.UuidFactory; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.step.DataChange; -import org.sonar.server.platform.db.migration.step.Select; -import org.sonar.server.platform.db.migration.step.Upsert; -import org.xml.sax.InputSource; -import org.xml.sax.SAXException; -import org.xml.sax.SAXParseException; -import org.xml.sax.helpers.DefaultHandler; - -import static java.lang.String.format; -import static java.nio.charset.StandardCharsets.UTF_8; -import static javax.xml.XMLConstants.FEATURE_SECURE_PROCESSING; -import static org.apache.commons.io.IOUtils.toInputStream; -import static org.apache.commons.lang.StringEscapeUtils.escapeXml; -import static org.apache.commons.lang.StringUtils.trim; - -public class MigrateApplicationDefinitionsFromXmlToDb extends DataChange { - static final int TEXT_VALUE_MAX_LENGTH = 4000; - private static final String SELECT_APPLICATION_UUID_BY_KEY = "select uuid from projects where kee = ? and qualifier = 'APP'"; - private static final String SELECT_PROJECTS_BY_KEYS = "select kee,uuid from projects where kee in (%s) and qualifier = 'TRK'"; - private static final String SELECT_PROJECTS_BY_APP = "select project_uuid from app_projects where application_uuid = ?"; - private static final String UPDATE_INTERNAL_PROP_TEXT_VALUE = "update internal_properties set text_value = ?, clob_value = NULL where kee = ?"; - private static final String UPDATE_INTERNAL_PROP_CLOB_VALUE = "update internal_properties set clob_value = ?, text_value = NULL where kee = ?"; - private static final String VIEWS_DEF_KEY = "views.def"; - - private final UuidFactory uuidFactory; - private final System2 system; - - public MigrateApplicationDefinitionsFromXmlToDb(Database db, UuidFactory uuidFactory, System2 system) { - super(db); - - this.uuidFactory = uuidFactory; - this.system = system; - } - - @Override - protected void execute(Context context) throws SQLException { - String xml = getViewsDefinition(context); - // skip migration if `views.def` does not exist in the db - if (xml == null) { - return; - } - - try { - Map defs = ViewXml.parse(xml); - List applications = defs.values() - .stream() - .filter(v -> Qualifiers.APP.equals(v.getQualifier())) - .collect(Collectors.toList()); - for (ViewXml.ViewDef app : applications) { - insertApplication(context, app); - } - cleanUpViewsDefinitionsXml(context, defs.values()); - } catch (Exception e) { - throw new IllegalStateException("Failed to migrate views definitions property.", e); - } - - } - - private void insertApplication(Context context, ViewXml.ViewDef app) throws SQLException { - long now = system.now(); - String applicationUuid = context.prepareSelect(SELECT_APPLICATION_UUID_BY_KEY) - .setString(1, app.getKey()) - .get(r -> r.getString(1)); - - // skip migration if: - // - application only exists in xml and not in the db. It will be removed from the xml at later stage of the migration. - // - application contains no projects- it's already in a valid db state - Set uniqueProjects = new HashSet<>(app.getProjects()); - if (applicationUuid == null || uniqueProjects.isEmpty()) { - return; - } - - List alreadyAddedProjects = context.prepareSelect(SELECT_PROJECTS_BY_APP).setString(1, applicationUuid) - .list(r -> r.getString(1)); - - String queryParam = uniqueProjects.stream().map(uuid -> "'" + uuid + "'").collect(Collectors.joining(",")); - Map projectUuidsByKeys = context.prepareSelect(format(SELECT_PROJECTS_BY_KEYS, queryParam)) - .list(r -> new AbstractMap.SimpleEntry<>(r.getString(1), r.getString(2))) - .stream() - .filter(project -> !alreadyAddedProjects.contains(project.getValue())) - .collect(Collectors.toMap(AbstractMap.SimpleEntry::getKey, AbstractMap.SimpleEntry::getValue)); - - if (!projectUuidsByKeys.isEmpty()) { - insertApplicationProjects(context, app, applicationUuid, projectUuidsByKeys, uniqueProjects, now); - } - if (!app.getApplicationBranches().isEmpty()) { - insertApplicationBranchesProjects(context, app, applicationUuid, projectUuidsByKeys, now); - } - } - - private void insertApplicationProjects(Context context, ViewXml.ViewDef app, String applicationUuid, - Map projectUuidsByKeys, Set uniqueProjects, long createdTime) throws SQLException { - Upsert insertApplicationProjectsQuery = context.prepareUpsert("insert into " + - "app_projects(uuid, application_uuid, project_uuid, created_at) " + - "values (?, ?, ?, ?)"); - for (String projectKey : uniqueProjects) { - String applicationProjectUuid = uuidFactory.create(); - String projectUuid = projectUuidsByKeys.get(projectKey); - - // ignore project if it does not exist anymore - if (projectUuid == null) { - continue; - } - - insertApplicationProjectsQuery - .setString(1, applicationProjectUuid) - .setString(2, applicationUuid) - .setString(3, projectUuid) - .setLong(4, createdTime) - .addBatch(); - } - - insertApplicationProjectsQuery.execute().commit(); - } - - private void insertApplicationBranchesProjects(Context context, ViewXml.ViewDef app, String applicationUuid, - Map projectUuidsByKeys, long createdTime) throws SQLException { - Map appBranchUuidByKey = context.prepareSelect("select kee,uuid from project_branches where project_uuid = ?") - .setString(1, applicationUuid) - .list(r -> new AbstractMap.SimpleEntry<>(r.getString(1), r.getString(2))) - .stream() - .collect(Collectors.toMap(AbstractMap.SimpleEntry::getKey, AbstractMap.SimpleEntry::getValue)); - - Upsert insertApplicationsBranchProjectsQuery = context.prepareUpsert("insert into " + - "app_branch_project_branch(uuid, application_uuid, application_branch_uuid, project_uuid, project_branch_uuid, created_at) " + - "values (?, ?, ?, ?, ?, ?)"); - boolean insert = false; - for (ViewXml.ApplicationBranchDef branch : app.getApplicationBranches()) { - String applicationBranchUuid = appBranchUuidByKey.get(branch.getKey()); - // ignore application branch if it does not exist in the DB anymore - if (applicationBranchUuid == null) { - continue; - } - - if (insertApplicationBranchProjects(context, branch, applicationUuid, applicationBranchUuid, projectUuidsByKeys, createdTime, - insertApplicationsBranchProjectsQuery)) { - insert = true; - } - } - - if (insert) { - insertApplicationsBranchProjectsQuery.execute().commit(); - } - } - - private boolean insertApplicationBranchProjects(Context context, ViewXml.ApplicationBranchDef branch, String applicationUuid, - String applicationBranchUuid, Map projectUuidsByKeys, long createdTime, - Upsert insertApplicationsBranchProjectsQuery) throws SQLException { - - boolean insert = false; - for (ViewXml.ApplicationProjectDef appProjDef : branch.getProjects()) { - String projectUuid = projectUuidsByKeys.get(appProjDef.getKey()); - - // ignore projects that do not exist in the DB anymore - if (projectUuid != null) { - String projectBranchUuid = context.prepareSelect("select uuid from project_branches where project_uuid = ? and kee = ?") - .setString(1, projectUuid) - .setString(2, appProjDef.getBranch()) - .get(r -> r.getString(1)); - - // ignore project branches that do not exist in the DB anymore - if (projectBranchUuid != null) { - String applicationBranchProjectUuid = uuidFactory.create(); - insertApplicationsBranchProjectsQuery - .setString(1, applicationBranchProjectUuid) - .setString(2, applicationUuid) - .setString(3, applicationBranchUuid) - .setString(4, projectUuid) - .setString(5, projectBranchUuid) - .setLong(6, createdTime) - .addBatch(); - insert = true; - } - } - } - - return insert; - } - - @CheckForNull - private static String getViewsDefinition(DataChange.Context context) throws SQLException { - Select select = context.prepareSelect("select text_value,clob_value from internal_properties where kee=?"); - select.setString(1, VIEWS_DEF_KEY); - return select.get(row -> { - String v = row.getString(1); - if (v != null) { - return v; - } else { - return row.getString(2); - } - }); - } - - private static void cleanUpViewsDefinitionsXml(Context context, Collection definitions) throws SQLException, IOException { - definitions = definitions.stream() - .filter(d -> !"APP".equals(d.getQualifier())) - .collect(Collectors.toList()); - - StringWriter output = new StringWriter(); - new ViewXml.ViewDefinitionsSerializer().write(definitions, output); - String value = output.toString(); - String statement = UPDATE_INTERNAL_PROP_TEXT_VALUE; - if (mustBeStoredInClob(value)) { - statement = UPDATE_INTERNAL_PROP_CLOB_VALUE; - } - - context.prepareUpsert(statement) - .setString(1, output.toString()) - .setString(2, VIEWS_DEF_KEY) - .execute() - .commit(); - } - - private static boolean mustBeStoredInClob(String value) { - return value.length() > TEXT_VALUE_MAX_LENGTH; - } - - private static class ViewXml { - static final String SCHEMA_VIEWS = "/static/views.xsd"; - static final String VIEWS_HEADER_BARE = ""; - static final Pattern VIEWS_HEADER_BARE_PATTERN = Pattern.compile(VIEWS_HEADER_BARE); - static final String VIEWS_HEADER_FQ = "" - + ""; - - private ViewXml() { - // nothing to do here - } - - private static Map parse(String xml) throws ParserConfigurationException, SAXException, IOException, XMLStreamException { - if (StringUtils.isEmpty(xml)) { - return new LinkedHashMap<>(0); - } - - List views; - validate(xml); - SMInputFactory inputFactory = initStax(); - SMHierarchicCursor rootC = inputFactory.rootElementCursor(new StringReader(xml)); - rootC.advance(); // - SMInputCursor cursor = rootC.childElementCursor(); - views = parseViewDefinitions(cursor); - - Map result = new LinkedHashMap<>(views.size()); - for (ViewDef def : views) { - result.put(def.getKey(), def); - } - - return result; - } - - private static void validate(String xml) throws IOException, SAXException, ParserConfigurationException { - // Replace bare, namespace unaware header with fully qualified header (with schema declaration) - String fullyQualifiedXml = VIEWS_HEADER_BARE_PATTERN.matcher(xml).replaceFirst(VIEWS_HEADER_FQ); - try (InputStream xsd = MigrateApplicationDefinitionsFromXmlToDb.class.getResourceAsStream(SCHEMA_VIEWS)) { - InputSource viewsDefinition = new InputSource(new InputStreamReader(toInputStream(fullyQualifiedXml, UTF_8), UTF_8)); - - SchemaFactory saxSchemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); - saxSchemaFactory.setProperty(XMLConstants.ACCESS_EXTERNAL_SCHEMA, ""); - saxSchemaFactory.setProperty(XMLConstants.ACCESS_EXTERNAL_DTD, ""); - - SAXParserFactory parserFactory = SAXParserFactory.newInstance(); - parserFactory.setFeature(FEATURE_SECURE_PROCESSING, true); - parserFactory.setNamespaceAware(true); - parserFactory.setSchema(saxSchemaFactory.newSchema(new SAXSource(new InputSource(xsd)))); - - SAXParser saxParser = parserFactory.newSAXParser(); - saxParser.setProperty(XMLConstants.ACCESS_EXTERNAL_DTD, ""); - saxParser.setProperty(XMLConstants.ACCESS_EXTERNAL_SCHEMA, ""); - saxParser.parse(viewsDefinition, new ViewsValidator()); - } - } - - private static List parseViewDefinitions(SMInputCursor viewsCursor) throws XMLStreamException { - List views = new ArrayList<>(); - while (viewsCursor.getNext() != null) { - ViewDef viewDef = new ViewDef(); - viewDef.setKey(viewsCursor.getAttrValue("key")); - viewDef.setDef(Boolean.parseBoolean(viewsCursor.getAttrValue("def"))); - viewDef.setParent(viewsCursor.getAttrValue("parent")); - viewDef.setRoot(viewsCursor.getAttrValue("root")); - SMInputCursor viewCursor = viewsCursor.childElementCursor(); - while (viewCursor.getNext() != null) { - String nodeName = viewCursor.getLocalName(); - parseChildElement(viewDef, viewCursor, nodeName); - } - views.add(viewDef); - } - return views; - } - - private static void parseChildElement(ViewDef viewDef, SMInputCursor viewCursor, String nodeName) throws XMLStreamException { - if (StringUtils.equals(nodeName, "name")) { - viewDef.setName(trim(viewCursor.collectDescendantText())); - } else if (StringUtils.equals(nodeName, "desc")) { - viewDef.setDesc(trim(viewCursor.collectDescendantText())); - } else if (StringUtils.equals(nodeName, "regexp")) { - viewDef.setRegexp(trim(viewCursor.collectDescendantText())); - } else if (StringUtils.equals(nodeName, "language")) { - viewDef.setLanguage(trim(viewCursor.collectDescendantText())); - } else if (StringUtils.equals(nodeName, "tag_key")) { - viewDef.setTagKey(trim(viewCursor.collectDescendantText())); - } else if (StringUtils.equals(nodeName, "tag_value")) { - viewDef.setTagValue(trim(viewCursor.collectDescendantText())); - } else if (StringUtils.equals(nodeName, "p")) { - viewDef.addProject(trim(viewCursor.collectDescendantText())); - } else if (StringUtils.equals(nodeName, "vw-ref")) { - viewDef.addReference(trim(viewCursor.collectDescendantText())); - } else if (StringUtils.equals(nodeName, "qualifier")) { - viewDef.setQualifier(trim(viewCursor.collectDescendantText())); - } else if (StringUtils.equals(nodeName, "branch")) { - parseBranch(viewDef, viewCursor); - } else if (StringUtils.equals(nodeName, "tagsAssociation")) { - parseTagsAssociation(viewDef, viewCursor); - } - } - - private static void parseBranch(ViewDef def, SMInputCursor viewCursor) throws XMLStreamException { - List projects = new ArrayList<>(); - String key = viewCursor.getAttrValue("key"); - SMInputCursor projectCursor = viewCursor.childElementCursor(); - while (projectCursor.getNext() != null) { - if (Objects.equals(projectCursor.getLocalName(), "p")) { - String branch = projectCursor.getAttrValue("branch"); - String projectKey = trim(projectCursor.collectDescendantText()); - projects.add(new ApplicationProjectDef().setKey(projectKey).setBranch(branch)); - } - } - def.getApplicationBranches().add(new ApplicationBranchDef() - .setKey(key) - .setProjects(projects)); - } - - private static void parseTagsAssociation(ViewDef def, SMInputCursor viewCursor) throws XMLStreamException { - SMInputCursor projectCursor = viewCursor.childElementCursor(); - while (projectCursor.getNext() != null) { - def.addTagAssociation(trim(projectCursor.collectDescendantText())); - } - } - - private static SMInputFactory initStax() { - XMLInputFactory xmlFactory = XMLInputFactory.newInstance(); - xmlFactory.setProperty(XMLInputFactory.IS_COALESCING, Boolean.TRUE); - xmlFactory.setProperty(XMLInputFactory.IS_NAMESPACE_AWARE, Boolean.FALSE); - // just so it won't try to load DTD in if there's DOCTYPE - xmlFactory.setProperty(XMLInputFactory.SUPPORT_DTD, Boolean.FALSE); - xmlFactory.setProperty(XMLInputFactory.IS_VALIDATING, Boolean.FALSE); - return new SMInputFactory(xmlFactory); - } - - private static class ViewDef { - String key = null; - - String parent = null; - - String root = null; - - boolean def = false; - - List p = new ArrayList<>(); - - List vwRef = new ArrayList<>(); - - String name = null; - - String desc = null; - - String regexp = null; - - String language = null; - - String tagKey = null; - - String tagValue = null; - - String qualifier = null; - - List applicationBranches = new ArrayList<>(); - - Set tagsAssociation = new TreeSet<>(); - - public String getKey() { - return key; - } - - public String getParent() { - return parent; - } - - @CheckForNull - public String getRoot() { - return root; - } - - public boolean isDef() { - return def; - } - - public List getProjects() { - return p; - } - - public List getReferences() { - return vwRef; - } - - public String getName() { - return name; - } - - public String getDesc() { - return desc; - } - - @CheckForNull - public String getRegexp() { - return regexp; - } - - @CheckForNull - public String getLanguage() { - return language; - } - - @CheckForNull - public String getTagKey() { - return tagKey; - } - - @CheckForNull - public String getTagValue() { - return tagValue; - } - - @CheckForNull - public String getQualifier() { - return qualifier; - } - - public List getApplicationBranches() { - return applicationBranches; - } - - public Set getTagsAssociation() { - return tagsAssociation; - } - - public ViewDef setKey(String key) { - this.key = key; - return this; - } - - public ViewDef setParent(String parent) { - this.parent = parent; - return this; - } - - public ViewDef setRoot(@Nullable String root) { - this.root = root; - return this; - } - - public ViewDef setDef(boolean def) { - this.def = def; - return this; - } - - public ViewDef setProjects(List projects) { - this.p = projects; - return this; - } - - public ViewDef addProject(String project) { - this.p.add(project); - return this; - } - - public ViewDef removeProject(String project) { - this.p.remove(project); - return this; - } - - public ViewDef setName(String name) { - this.name = name; - return this; - } - - public ViewDef setDesc(@Nullable String desc) { - this.desc = desc; - return this; - } - - public ViewDef setRegexp(@Nullable String regexp) { - this.regexp = regexp; - return this; - } - - public ViewDef setLanguage(@Nullable String language) { - this.language = language; - return this; - } - - public ViewDef setTagKey(@Nullable String tagKey) { - this.tagKey = tagKey; - return this; - } - - public ViewDef setTagValue(@Nullable String tagValue) { - this.tagValue = tagValue; - return this; - } - - public ViewDef addReference(String reference) { - this.vwRef.add(reference); - return this; - } - - public ViewDef removeReference(String reference) { - this.vwRef.remove(reference); - return this; - } - - public ViewDef setReferences(List vwRef) { - this.vwRef = vwRef; - return this; - } - - public ViewDef setQualifier(@Nullable String qualifier) { - this.qualifier = qualifier; - return this; - } - - public ViewDef setApplicationBranches(List branches) { - this.applicationBranches = branches; - return this; - } - - public ViewDef addTagAssociation(String tag) { - this.tagsAssociation.add(tag); - return this; - } - - public ViewDef setTagsAssociation(Set tagsAssociation) { - this.tagsAssociation = tagsAssociation; - return this; - } - } - - private static class ApplicationProjectDef { - private String key = null; - private String branch = null; - - public String getKey() { - return key; - } - - public ApplicationProjectDef setKey(String key) { - this.key = key; - return this; - } - - @CheckForNull - public String getBranch() { - return branch; - } - - public ApplicationProjectDef setBranch(@Nullable String branch) { - this.branch = branch; - return this; - } - } - - private static class ApplicationBranchDef { - - private String key = null; - private List p = new ArrayList<>(); - - public String getKey() { - return key; - } - - public ApplicationBranchDef setKey(String key) { - this.key = key; - return this; - } - - public List getProjects() { - return p; - } - - public ApplicationBranchDef setProjects(List p) { - this.p = p; - return this; - } - } - - private static final class ViewsValidator extends DefaultHandler { - @Override - public void error(SAXParseException exception) throws SAXException { - throw exception; - } - - @Override - public void warning(SAXParseException exception) throws SAXException { - throw exception; - } - - @Override - public void fatalError(SAXParseException exception) throws SAXException { - throw exception; - } - } - - static class ViewDefinitionsSerializer { - - public void write(Collection definitions, Writer writer) throws IOException { - writer.append(VIEWS_HEADER_BARE); - - for (ViewDef def : definitions) { - writer.append(""); - - writer.append(""); - writeOptionalElements(writer, def); - - for (String project : def.getProjects()) { - writer.append("

").append(project).append("

"); - } - for (String ref : def.getReferences()) { - writer.append(""); - } - writeTagsAssociation(writer, def); - writer.append(""); - } - - writer.append("
"); - } - - private static void writeOptionalElements(Writer writer, ViewDef def) throws IOException { - String description = def.getDesc(); - if (description != null) { - writer.append(""); - } - String regexp = def.getRegexp(); - if (regexp != null) { - writer.append(""); - } - String language = def.getLanguage(); - if (language != null) { - writer.append(""); - } - String customMeasureKey = def.getTagKey(); - if (customMeasureKey != null) { - writer.append(""); - } - String customMeasureValue = def.getTagValue(); - if (customMeasureValue != null) { - writer.append(""); - } - String qualifier = def.getQualifier(); - if (qualifier != null) { - writer.append(""); - } - } - - private static void writeTagsAssociation(Writer writer, ViewDef definition) throws IOException { - Set tagsAssociation = definition.getTagsAssociation(); - if (tagsAssociation.isEmpty()) { - return; - } - writer.append(""); - for (String tag : tagsAssociation) { - writer.append("").append(tag).append(""); - } - writer.append(""); - } - - } - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v86/MoveDefaultTemplatesToInternalProperties.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v86/MoveDefaultTemplatesToInternalProperties.java deleted file mode 100644 index 056ffb1b6fb..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v86/MoveDefaultTemplatesToInternalProperties.java +++ /dev/null @@ -1,109 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v86; - -import java.sql.SQLException; -import java.util.Optional; -import org.sonar.api.utils.System2; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.step.DataChange; -import org.sonar.server.platform.db.migration.step.Select; -import org.sonar.server.platform.db.migration.step.Upsert; - -public class MoveDefaultTemplatesToInternalProperties extends DataChange { - - private final System2 system2; - - public MoveDefaultTemplatesToInternalProperties(Database db, System2 system2) { - super(db); - this.system2 = system2; - } - - @Override - protected void execute(Context context) throws SQLException { - OrganizationDefaultTemplates organizationDefaultTemplates = context - .prepareSelect("select org.default_perm_template_project, org.default_perm_template_port, org.default_perm_template_app from organizations org " + - "where org.kee = 'default-organization'") - .get(OrganizationDefaultTemplates::new); - if (organizationDefaultTemplates == null) { - throw new IllegalStateException("Default organization is missing"); - } - Upsert updateInternalProperties = context.prepareUpsert("insert into internal_properties (kee, text_value, is_empty, created_at) values (?, ?, ?, ?)"); - - Optional defaultPermissionTemplateForProject = organizationDefaultTemplates.getDefaultPermissionTemplateForProject(); - if (defaultPermissionTemplateForProject.isPresent()) { - insertInInternalProperties(context, updateInternalProperties, "defaultTemplate.prj", defaultPermissionTemplateForProject.get()); - } else { - // If default permission templates are missing, they will be added during the startup task "RegisterPermissionTemplates" - return; - } - - organizationDefaultTemplates.getDefaultPermissionTemplateForPortfolio() - .ifPresent( - defaultPermissionTemplate -> insertInInternalProperties(context, updateInternalProperties, "defaultTemplate.port", defaultPermissionTemplate)); - organizationDefaultTemplates.getDefaultPermissionTemplateForApplication() - .ifPresent( - defaultPermissionTemplate -> insertInInternalProperties(context, updateInternalProperties, "defaultTemplate.app", defaultPermissionTemplate)); - } - - private void insertInInternalProperties(Context context, Upsert updateInternalProperties, String key, String value) { - try { - Integer isInternalPropertyAlreadyExists = context.prepareSelect("select count(1) from internal_properties ip where ip.kee = ?") - .setString(1, key) - .get(row -> row.getInt(1)); - if (isInternalPropertyAlreadyExists != null && isInternalPropertyAlreadyExists > 0) { - return; - } - updateInternalProperties - .setString(1, key) - .setString(2, value) - .setBoolean(3, false) - .setLong(4, system2.now()) - .execute() - .commit(); - } catch (SQLException throwables) { - throw new IllegalStateException(throwables); - } - } - - private static class OrganizationDefaultTemplates { - private final String defaultPermissionTemplateForProject; - private final String defaultPermissionTemplateForPortfolio; - private final String defaultPermissionTemplateForApplication; - - OrganizationDefaultTemplates(Select.Row row) throws SQLException { - this.defaultPermissionTemplateForProject = row.getNullableString(1); - this.defaultPermissionTemplateForPortfolio = row.getNullableString(2); - this.defaultPermissionTemplateForApplication = row.getNullableString(3); - } - - Optional getDefaultPermissionTemplateForProject() { - return Optional.ofNullable(defaultPermissionTemplateForProject); - } - - Optional getDefaultPermissionTemplateForPortfolio() { - return Optional.ofNullable(defaultPermissionTemplateForPortfolio); - } - - Optional getDefaultPermissionTemplateForApplication() { - return Optional.ofNullable(defaultPermissionTemplateForApplication); - } - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v86/PopulateResetPasswordDefaultValue.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v86/PopulateResetPasswordDefaultValue.java deleted file mode 100644 index d7302b57ad6..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v86/PopulateResetPasswordDefaultValue.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v86; - -import java.sql.SQLException; -import org.sonar.api.utils.System2; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.step.DataChange; -import org.sonar.server.platform.db.migration.step.MassUpdate; - -public class PopulateResetPasswordDefaultValue extends DataChange { - - private final System2 system2; - - public PopulateResetPasswordDefaultValue(Database db, System2 system2) { - super(db); - this.system2 = system2; - } - - @Override - public void execute(Context context) throws SQLException { - MassUpdate massUpdate = context.prepareMassUpdate(); - massUpdate.select("select uuid from users where reset_password is null"); - massUpdate.update("update users set reset_password = ?, updated_at = ? where uuid = ?"); - - massUpdate.execute((row, update) -> { - update.setBoolean(1, false) - .setLong(2, system2.now()) - .setString(3, row.getString(1)); - return true; - }); - - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v86/SecureGitlabSecretParameters.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v86/SecureGitlabSecretParameters.java deleted file mode 100644 index 8e6d6cbd553..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v86/SecureGitlabSecretParameters.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v86; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.step.DataChange; - -public class SecureGitlabSecretParameters extends DataChange { - - public SecureGitlabSecretParameters(Database db) { - super(db); - } - - @Override - protected void execute(Context context) throws SQLException { - updateToSecured(context, "sonar.auth.gitlab.applicationId"); - updateToSecured(context, "sonar.auth.gitlab.secret"); - } - - private static void updateToSecured(Context context, String property) throws SQLException { - context.prepareUpsert("update properties set prop_key = ? where prop_key = ?") - .setString(1, property + ".secured") - .setString(2, property) - .execute() - .commit(); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v86/SetForceAuthenticationSettings.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v86/SetForceAuthenticationSettings.java deleted file mode 100644 index 5624c75a420..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v86/SetForceAuthenticationSettings.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v86; - -import java.sql.SQLException; -import java.util.Optional; -import org.sonar.api.config.internal.Settings; -import org.sonar.api.utils.System2; -import org.sonar.core.util.UuidFactory; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.step.DataChange; -import org.sonar.server.platform.db.migration.step.Select; - -public class SetForceAuthenticationSettings extends DataChange { - private static final String PROPERTY_NAME_FORCE_AUTHENTICATION = "sonar.forceAuthentication"; - private System2 system2; - private UuidFactory uuidFactory; - private Settings settings; - - public SetForceAuthenticationSettings(Database db, System2 system2, UuidFactory uuidFactory, Settings settings) { - super(db); - this.system2 = system2; - this.uuidFactory = uuidFactory; - this.settings = settings; - } - - @Override - protected void execute(Context context) throws SQLException { - Select select = context.prepareSelect("select p.text_value from properties p where p.prop_key = ?") - .setString(1, PROPERTY_NAME_FORCE_AUTHENTICATION); - String value = select.get(row -> row.getString(1)); - - if (value == null) { - Optional forceAuthenticationSettings = settings.getRawString(PROPERTY_NAME_FORCE_AUTHENTICATION); - - context.prepareUpsert("INSERT INTO properties" - + "(prop_key, is_empty, text_value, created_at, uuid) " - + "VALUES(?, ?, ?, ?, ?)") - .setString(1, PROPERTY_NAME_FORCE_AUTHENTICATION) - .setBoolean(2, false) - .setString(3, forceAuthenticationSettings.orElse("false")) - .setLong(4, system2.now()) - .setString(5, uuidFactory.create()) - .execute() - .commit(); - } - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v86/UpdateChangeDataOfQProfileChanges.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v86/UpdateChangeDataOfQProfileChanges.java deleted file mode 100644 index d5c3a69b3dc..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v86/UpdateChangeDataOfQProfileChanges.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v86; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.step.DataChange; -import org.sonar.server.platform.db.migration.step.MassUpdate; - -public class UpdateChangeDataOfQProfileChanges extends DataChange { - - public UpdateChangeDataOfQProfileChanges(Database db) { - super(db); - } - - @Override - protected void execute(Context context) throws SQLException { - MassUpdate massUpdate = context.prepareMassUpdate(); - massUpdate.select("select qpc.kee, qpc.change_data " - + "from qprofile_changes qpc where qpc.change_data like '%ruleId=%'"); - - massUpdate.update("update qprofile_changes " - + "set change_data = replace(change_data, 'ruleId', 'ruleUuid') where kee = ?"); - - massUpdate.execute((row, update) -> { - update.setString(1, row.getString(1)); - return true; - }); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v86/package-info.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v86/package-info.java deleted file mode 100644 index 08a9d010efe..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v86/package-info.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v86; - -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v87/AddMonorepoColumnToProjectAlmSettingsTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v87/AddMonorepoColumnToProjectAlmSettingsTable.java deleted file mode 100644 index 2392273d4df..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v87/AddMonorepoColumnToProjectAlmSettingsTable.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v87; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.def.BooleanColumnDef; -import org.sonar.server.platform.db.migration.sql.AddColumnsBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.sonar.server.platform.db.migration.def.BooleanColumnDef.newBooleanColumnDefBuilder; - -public class AddMonorepoColumnToProjectAlmSettingsTable extends DdlChange { - - private static final String TABLE = "project_alm_settings"; - - private static final BooleanColumnDef MONOREPO = newBooleanColumnDefBuilder() - .setColumnName("monorepo") - .setIsNullable(true) - .build(); - - public AddMonorepoColumnToProjectAlmSettingsTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new AddColumnsBuilder(getDialect(), TABLE) - .addColumn(MONOREPO) - .build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v87/DbVersion87.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v87/DbVersion87.java deleted file mode 100644 index 700e6606dc0..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v87/DbVersion87.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v87; - -import org.sonar.server.platform.db.migration.step.MigrationStepRegistry; -import org.sonar.server.platform.db.migration.version.DbVersion; - -public class DbVersion87 implements DbVersion { - - @Override - public void addSteps(MigrationStepRegistry registry) { - registry - .add(4200, "Move default project visibility to global properties", MoveDefaultProjectVisibilityToGlobalProperties.class) - .add(4201, "Move default quality gate to global properties", MoveDefaultQualityGateToGlobalProperties.class) - - .add(4202, "Drop organization_uuid in table 'components'", DropOrganizationInComponents.class) - .add(4203, "Drop organization_uuid in table 'projects'", DropOrganizationInProjects.class) - .add(4204, "Drop organizations in table 'webhooks'", DropOrganizationInWebhooks.class) - - .add(4205, "Drop table 'org_quality_gates'", DropOrgQualityGatesTable.class) - .add(4206, "Drop table 'organization_alm_bindings'", DropOrganizationAlmBindingsTable.class) - .add(4207, "Drop table 'alm_app_installs'", DropAlmAppInstallsTable.class) - .add(4208, "Drop table 'organizations'", DropOrganizationsTable.class) - .add(4209, "Drop table 'organization_members'", DropOrgMembersTable.class) - - .add(4210, "Add column 'monorepo' to table 'project_alm_settings'", AddMonorepoColumnToProjectAlmSettingsTable.class) - .add(4211, "Populate column 'monorepo' to false in table 'project_alm_settings'", PopulateMonorepoColumnToProjectAlmSettingsTable.class) - .add(4212, "Make column 'monorepo' in table 'project_alm_settings' not Nullable", MakeMonorepoColumnInProjectAlmSettingsTableNotNullable.class) - - .add(4213, "Drop column 'description' in table 'project_measures'", DropDescriptionInProjectMeasures.class) - - ; - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v87/DropAlmAppInstallsTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v87/DropAlmAppInstallsTable.java deleted file mode 100644 index 897ced7fe9e..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v87/DropAlmAppInstallsTable.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v87; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.DropIndexBuilder; -import org.sonar.server.platform.db.migration.sql.DropPrimaryKeySqlGenerator; -import org.sonar.server.platform.db.migration.sql.DropTableBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class DropAlmAppInstallsTable extends DdlChange { - private static final String TABLE_NAME = "alm_app_installs"; - private final DropPrimaryKeySqlGenerator dropPrimaryKeySqlGenerator; - - public DropAlmAppInstallsTable(Database db, DropPrimaryKeySqlGenerator dropPrimaryKeySqlGenerator) { - super(db); - this.dropPrimaryKeySqlGenerator = dropPrimaryKeySqlGenerator; - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(dropPrimaryKeySqlGenerator.generate(TABLE_NAME, "uuid", false)); - context.execute(new DropIndexBuilder(getDialect()).setTable(TABLE_NAME).setName("alm_app_installs_owner").build()); - context.execute(new DropIndexBuilder(getDialect()).setTable(TABLE_NAME).setName("alm_app_installs_install").build()); - context.execute(new DropIndexBuilder(getDialect()).setTable(TABLE_NAME).setName("alm_app_installs_external_id").build()); - context.execute(new DropTableBuilder(getDialect(), TABLE_NAME).build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v87/DropDescriptionInProjectMeasures.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v87/DropDescriptionInProjectMeasures.java deleted file mode 100644 index 898f4132352..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v87/DropDescriptionInProjectMeasures.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v87; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.DropColumnsBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class DropDescriptionInProjectMeasures extends DdlChange { - private static final String TABLE_NAME = "project_measures"; - - public DropDescriptionInProjectMeasures(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new DropColumnsBuilder(getDialect(), TABLE_NAME, "description").build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v87/DropOrgMembersTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v87/DropOrgMembersTable.java deleted file mode 100644 index 64e704b60f3..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v87/DropOrgMembersTable.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v87; - -import java.sql.SQLException; -import java.util.Arrays; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.DropIndexBuilder; -import org.sonar.server.platform.db.migration.sql.DropPrimaryKeySqlGenerator; -import org.sonar.server.platform.db.migration.sql.DropTableBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class DropOrgMembersTable extends DdlChange { - private static final String TABLE_NAME = "organization_members"; - private final DropPrimaryKeySqlGenerator dropPrimaryKeySqlGenerator; - - public DropOrgMembersTable(Database db, DropPrimaryKeySqlGenerator dropPrimaryKeySqlGenerator) { - super(db); - this.dropPrimaryKeySqlGenerator = dropPrimaryKeySqlGenerator; - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(dropPrimaryKeySqlGenerator.generate(TABLE_NAME, Arrays.asList("user_uuid", "organization_uuid"), false)); - context.execute(new DropIndexBuilder(getDialect()).setTable(TABLE_NAME).setName("org_members_user_uuid").build()); - context.execute(new DropTableBuilder(getDialect(), TABLE_NAME).build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v87/DropOrgQualityGatesTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v87/DropOrgQualityGatesTable.java deleted file mode 100644 index a79642ca6d7..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v87/DropOrgQualityGatesTable.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v87; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.DropIndexBuilder; -import org.sonar.server.platform.db.migration.sql.DropPrimaryKeySqlGenerator; -import org.sonar.server.platform.db.migration.sql.DropTableBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class DropOrgQualityGatesTable extends DdlChange { - private static final String TABLE_NAME = "org_quality_gates"; - private final DropPrimaryKeySqlGenerator dropPrimaryKeySqlGenerator; - - public DropOrgQualityGatesTable(Database db, DropPrimaryKeySqlGenerator dropPrimaryKeySqlGenerator) { - super(db); - this.dropPrimaryKeySqlGenerator = dropPrimaryKeySqlGenerator; - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(dropPrimaryKeySqlGenerator.generate(TABLE_NAME, "uuid", false)); - context.execute(new DropIndexBuilder(getDialect()).setTable(TABLE_NAME).setName("uniq_org_quality_gates").build()); - context.execute(new DropTableBuilder(getDialect(), TABLE_NAME).build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v87/DropOrganizationAlmBindingsTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v87/DropOrganizationAlmBindingsTable.java deleted file mode 100644 index 93ae0ed5153..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v87/DropOrganizationAlmBindingsTable.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v87; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.DropIndexBuilder; -import org.sonar.server.platform.db.migration.sql.DropPrimaryKeySqlGenerator; -import org.sonar.server.platform.db.migration.sql.DropTableBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class DropOrganizationAlmBindingsTable extends DdlChange { - private static final String TABLE_NAME = "organization_alm_bindings"; - private final DropPrimaryKeySqlGenerator dropPrimaryKeySqlGenerator; - - public DropOrganizationAlmBindingsTable(Database db, DropPrimaryKeySqlGenerator dropPrimaryKeySqlGenerator) { - super(db); - this.dropPrimaryKeySqlGenerator = dropPrimaryKeySqlGenerator; - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(dropPrimaryKeySqlGenerator.generate(TABLE_NAME, "uuid", false)); - context.execute(new DropIndexBuilder(getDialect()).setTable(TABLE_NAME).setName("org_alm_bindings_org").build()); - context.execute(new DropIndexBuilder(getDialect()).setTable(TABLE_NAME).setName("org_alm_bindings_install").build()); - context.execute(new DropTableBuilder(getDialect(), TABLE_NAME).build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v87/DropOrganizationInComponents.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v87/DropOrganizationInComponents.java deleted file mode 100644 index 13b98529bc0..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v87/DropOrganizationInComponents.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v87; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.DropColumnsBuilder; -import org.sonar.server.platform.db.migration.sql.DropIndexBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class DropOrganizationInComponents extends DdlChange { - private static final String TABLE_NAME = "components"; - - public DropOrganizationInComponents(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new DropIndexBuilder(getDialect()).setTable(TABLE_NAME).setName("projects_organization").build()); - context.execute(new DropColumnsBuilder(getDialect(), TABLE_NAME, "organization_uuid").build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v87/DropOrganizationInProjects.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v87/DropOrganizationInProjects.java deleted file mode 100644 index c4960bca58e..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v87/DropOrganizationInProjects.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v87; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.DropColumnsBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class DropOrganizationInProjects extends DdlChange { - private static final String TABLE_NAME = "projects"; - - public DropOrganizationInProjects(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new DropColumnsBuilder(getDialect(), TABLE_NAME, "organization_uuid").build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v87/DropOrganizationInWebhooks.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v87/DropOrganizationInWebhooks.java deleted file mode 100644 index f310d3a9362..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v87/DropOrganizationInWebhooks.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v87; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.DropColumnsBuilder; -import org.sonar.server.platform.db.migration.sql.DropIndexBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class DropOrganizationInWebhooks extends DdlChange { - private static final String TABLE_NAME = "webhooks"; - - public DropOrganizationInWebhooks(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new DropIndexBuilder(getDialect()).setTable(TABLE_NAME).setName("organization_webhook").build()); - context.execute(new DropIndexBuilder(getDialect()).setTable(TABLE_NAME).setName("project_webhook").build()); - context.execute(new DropColumnsBuilder(getDialect(), TABLE_NAME, "organization_uuid").build()); - - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v87/DropOrganizationsTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v87/DropOrganizationsTable.java deleted file mode 100644 index cb57286c7b9..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v87/DropOrganizationsTable.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v87; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.DropIndexBuilder; -import org.sonar.server.platform.db.migration.sql.DropPrimaryKeySqlGenerator; -import org.sonar.server.platform.db.migration.sql.DropTableBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class DropOrganizationsTable extends DdlChange { - private static final String TABLE_NAME = "organizations"; - private final DropPrimaryKeySqlGenerator dropPrimaryKeySqlGenerator; - - public DropOrganizationsTable(Database db, DropPrimaryKeySqlGenerator dropPrimaryKeySqlGenerator) { - super(db); - this.dropPrimaryKeySqlGenerator = dropPrimaryKeySqlGenerator; - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(dropPrimaryKeySqlGenerator.generate(TABLE_NAME, "uuid", false)); - context.execute(new DropIndexBuilder(getDialect()).setTable(TABLE_NAME).setName("organization_key").build()); - context.execute(new DropTableBuilder(getDialect(), TABLE_NAME).build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v87/MakeMonorepoColumnInProjectAlmSettingsTableNotNullable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v87/MakeMonorepoColumnInProjectAlmSettingsTableNotNullable.java deleted file mode 100644 index 416c467bc58..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v87/MakeMonorepoColumnInProjectAlmSettingsTableNotNullable.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v87; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.def.BooleanColumnDef; -import org.sonar.server.platform.db.migration.sql.AlterColumnsBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.sonar.server.platform.db.migration.def.BooleanColumnDef.newBooleanColumnDefBuilder; - -public class MakeMonorepoColumnInProjectAlmSettingsTableNotNullable extends DdlChange { - private static final String TABLE = "project_alm_settings"; - - private static final BooleanColumnDef MONOREPO = newBooleanColumnDefBuilder() - .setColumnName("monorepo") - .setIsNullable(false) - .build(); - - public MakeMonorepoColumnInProjectAlmSettingsTableNotNullable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new AlterColumnsBuilder(getDialect(), TABLE) - .updateColumn(MONOREPO) - .build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v87/MoveDefaultProjectVisibilityToGlobalProperties.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v87/MoveDefaultProjectVisibilityToGlobalProperties.java deleted file mode 100644 index e3dbc7a7408..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v87/MoveDefaultProjectVisibilityToGlobalProperties.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v87; - -import java.sql.SQLException; -import org.sonar.api.utils.System2; -import org.sonar.core.util.UuidFactory; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.step.DataChange; - -public class MoveDefaultProjectVisibilityToGlobalProperties extends DataChange { - - private final UuidFactory uuidFactory; - private final System2 system2; - - public MoveDefaultProjectVisibilityToGlobalProperties(Database db, UuidFactory uuidFactory, System2 system2) { - super(db); - this.uuidFactory = uuidFactory; - this.system2 = system2; - } - - @Override - public void execute(Context context) throws SQLException { - Boolean newProjectPrivate = context.prepareSelect("select new_project_private from organizations where kee = ?") - .setString(1, "default-organization") - .get(row -> row.getNullableBoolean(1)); - - if (newProjectPrivate == null) { - throw new IllegalStateException("Default organization is missing"); - } else { - context.prepareUpsert("insert into properties (uuid, prop_key, is_empty, text_value, created_at) values (?, ?, ?, ?, ?)") - .setString(1, uuidFactory.create()) - .setString(2, "projects.default.visibility") - .setBoolean(3, false) - .setString(4, Boolean.TRUE.equals(newProjectPrivate) ? "private" : "public") - .setLong(5, system2.now()) - .execute() - .commit(); - } - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v87/MoveDefaultQualityGateToGlobalProperties.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v87/MoveDefaultQualityGateToGlobalProperties.java deleted file mode 100644 index 3d4949cf429..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v87/MoveDefaultQualityGateToGlobalProperties.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v87; - -import java.sql.SQLException; -import org.sonar.api.utils.System2; -import org.sonar.core.util.UuidFactory; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.step.DataChange; - -public class MoveDefaultQualityGateToGlobalProperties extends DataChange { - - private final UuidFactory uuidFactory; - private final System2 system2; - - public MoveDefaultQualityGateToGlobalProperties(Database db, UuidFactory uuidFactory, System2 system2) { - super(db); - this.uuidFactory = uuidFactory; - this.system2 = system2; - } - - @Override - public void execute(Context context) throws SQLException { - String defaultQualityGate = context.prepareSelect("select default_quality_gate_uuid from organizations where kee = ?") - .setString(1, "default-organization") - .get(row -> row.getString(1)); - - if (defaultQualityGate == null) { - throw new IllegalStateException("Default organization is missing"); - } else { - context.prepareUpsert("insert into properties (uuid, prop_key, is_empty, text_value, created_at) values (?, ?, ?, ?, ?)") - .setString(1, uuidFactory.create()) - .setString(2, "qualitygate.default") - .setBoolean(3, false) - .setString(4, defaultQualityGate) - .setLong(5, system2.now()) - .execute() - .commit(); - } - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v87/PopulateMonorepoColumnToProjectAlmSettingsTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v87/PopulateMonorepoColumnToProjectAlmSettingsTable.java deleted file mode 100644 index e7c0b1f5465..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v87/PopulateMonorepoColumnToProjectAlmSettingsTable.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v87; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.step.DataChange; -import org.sonar.server.platform.db.migration.step.MassUpdate; - -public class PopulateMonorepoColumnToProjectAlmSettingsTable extends DataChange { - public PopulateMonorepoColumnToProjectAlmSettingsTable(Database db) { - super(db); - } - - @Override - protected void execute(Context context) throws SQLException { - MassUpdate massUpdate = context.prepareMassUpdate(); - massUpdate.select("select uuid from project_alm_settings where monorepo is null"); - massUpdate.update("update project_alm_settings set monorepo = ? where uuid = ?"); - massUpdate.execute((row, update) -> { - update.setBoolean(1, false); - update.setString(2, row.getString(1)); - return true; - }); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v88/AddLastSonarlintConnectionToUsers.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v88/AddLastSonarlintConnectionToUsers.java deleted file mode 100644 index 773117dfa7d..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v88/AddLastSonarlintConnectionToUsers.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v88; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.def.BigIntegerColumnDef; -import org.sonar.server.platform.db.migration.sql.AddColumnsBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class AddLastSonarlintConnectionToUsers extends DdlChange { - public AddLastSonarlintConnectionToUsers(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new AddColumnsBuilder(getDialect(), "users") - .addColumn(BigIntegerColumnDef.newBigIntegerColumnDefBuilder().setColumnName("last_sonarlint_connection").setIsNullable(true).build()) - .build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v88/DbVersion88.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v88/DbVersion88.java deleted file mode 100644 index 2c19ad08043..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v88/DbVersion88.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v88; - -import org.sonar.server.platform.db.migration.step.MigrationStepRegistry; -import org.sonar.server.platform.db.migration.version.DbVersion; - -public class DbVersion88 implements DbVersion { - - @Override - public void addSteps(MigrationStepRegistry registry) { - registry - .add(4300, "Add 'last_sonarlint_connection' to 'users", AddLastSonarlintConnectionToUsers.class) - ; - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v89/AddIndexOnWebhookUuidInWebhookDeliveriesTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v89/AddIndexOnWebhookUuidInWebhookDeliveriesTable.java deleted file mode 100644 index 835685e6518..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v89/AddIndexOnWebhookUuidInWebhookDeliveriesTable.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v89; - -import java.sql.Connection; -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.db.DatabaseUtils; -import org.sonar.server.platform.db.migration.sql.CreateIndexBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class AddIndexOnWebhookUuidInWebhookDeliveriesTable extends DdlChange { - private static final String TABLE_NAME = "webhook_deliveries"; - private static final String INDEX_NAME = "idx_wbhk_dlvrs_wbhk_uuid"; - - public AddIndexOnWebhookUuidInWebhookDeliveriesTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - if (!indexExists(INDEX_NAME)) { - context.execute(new CreateIndexBuilder() - .setUnique(false) - .setTable(TABLE_NAME) - .setName(INDEX_NAME) - .addColumn("webhook_uuid") - .build()); - } - } - - private boolean indexExists(String index) throws SQLException { - try (Connection connection = getDatabase().getDataSource().getConnection()) { - return DatabaseUtils.indexExistsIgnoreCase(TABLE_NAME, index, connection); - } - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v89/AddIndicesToNewCodePeriodTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v89/AddIndicesToNewCodePeriodTable.java deleted file mode 100644 index 4730a5adda2..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v89/AddIndicesToNewCodePeriodTable.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v89; - -import java.sql.Connection; -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.db.DatabaseUtils; -import org.sonar.server.platform.db.migration.def.VarcharColumnDef; -import org.sonar.server.platform.db.migration.sql.CreateIndexBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder; - -public class AddIndicesToNewCodePeriodTable extends DdlChange { - private static final String TABLE_NAME = "new_code_periods"; - private static final String TYPE_INDEX_NAME = "idx_ncp_type"; - private static final String VALUE_INDEX_NAME = "idx_ncp_value"; - - public AddIndicesToNewCodePeriodTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - if (!indexExists(TYPE_INDEX_NAME)) { - context.execute(new CreateIndexBuilder() - .setUnique(false) - .setTable(TABLE_NAME) - .setName(TYPE_INDEX_NAME) - .addColumn(newVarcharColumnDefBuilder() - .setColumnName("type") - .setIsNullable(false) - .setLimit(30) - .build()) - .build()); - } - - if (!indexExists(VALUE_INDEX_NAME)) { - context.execute(new CreateIndexBuilder() - .setUnique(false) - .setTable(TABLE_NAME) - .setName(VALUE_INDEX_NAME) - .addColumn(newVarcharColumnDefBuilder() - .setColumnName("value") - .setIsNullable(true) - .setLimit(VarcharColumnDef.UUID_SIZE) - .build()) - .build()); - } - } - - private boolean indexExists(String index) throws SQLException { - try (Connection connection = getDatabase().getDataSource().getConnection()) { - return DatabaseUtils.indexExistsIgnoreCase(TABLE_NAME, index, connection); - } - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v89/AddMainBranchProjectUuidIndexToComponentTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v89/AddMainBranchProjectUuidIndexToComponentTable.java deleted file mode 100644 index 69f5bda74fe..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v89/AddMainBranchProjectUuidIndexToComponentTable.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v89; - -import java.sql.Connection; -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.db.DatabaseUtils; -import org.sonar.server.platform.db.migration.sql.CreateIndexBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder; - -public class AddMainBranchProjectUuidIndexToComponentTable extends DdlChange { - - private static final String TABLE_NAME = "components"; - private static final String INDEX_NAME = "idx_main_branch_prj_uuid"; - - public AddMainBranchProjectUuidIndexToComponentTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - if (!indexExists()) { - context.execute(new CreateIndexBuilder() - .setUnique(false) - .setTable(TABLE_NAME) - .setName(INDEX_NAME) - .addColumn(newVarcharColumnDefBuilder() - .setColumnName("main_branch_project_uuid") - .setIsNullable(false) - .setLimit(50) - .build()) - .build()); - } - } - - private boolean indexExists() throws SQLException { - try (Connection connection = getDatabase().getDataSource().getConnection()) { - return DatabaseUtils.indexExistsIgnoreCase(TABLE_NAME, INDEX_NAME, connection); - } - } - -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v89/DbVersion89.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v89/DbVersion89.java deleted file mode 100644 index ee063aa1594..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v89/DbVersion89.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v89; - -import org.sonar.server.platform.db.migration.step.MigrationStepRegistry; -import org.sonar.server.platform.db.migration.version.DbVersion; - -public class DbVersion89 implements DbVersion { - - @Override - public void addSteps(MigrationStepRegistry registry) { - registry - .add(4400, "Add indices on columns 'type' and 'value' to 'new_code_periods' table", AddIndicesToNewCodePeriodTable.class) - .add(4402, "Add Index on column 'main_branch_project_uuid' to 'components' table", AddMainBranchProjectUuidIndexToComponentTable.class) - .add(4403, "Drop Github endpoint on project level setting", DropGithubEndpointOnProjectLevelSetting.class) - .add(4404, "Increase size of 'value' column in 'new_code_periods' table ", IncreaseSizeOfValueColumnInNewCodePeriodsTable.class) - .add(4405, "Add index on column 'webhook_uuid' to 'webhook_deliveries' table", AddIndexOnWebhookUuidInWebhookDeliveriesTable.class); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v89/DropGithubEndpointOnProjectLevelSetting.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v89/DropGithubEndpointOnProjectLevelSetting.java deleted file mode 100644 index a0310d7205c..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v89/DropGithubEndpointOnProjectLevelSetting.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v89; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.step.DataChange; - -public class DropGithubEndpointOnProjectLevelSetting extends DataChange { - - public DropGithubEndpointOnProjectLevelSetting(Database db) { - super(db); - } - - @Override - protected void execute(Context context) throws SQLException { - context.prepareUpsert("delete from properties where prop_key='sonar.pullrequest.github.endpoint' and component_uuid is not null") - .execute() - .commit(); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v89/IncreaseSizeOfValueColumnInNewCodePeriodsTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v89/IncreaseSizeOfValueColumnInNewCodePeriodsTable.java deleted file mode 100644 index 59814056f31..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v89/IncreaseSizeOfValueColumnInNewCodePeriodsTable.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v89; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.sql.AlterColumnsBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder; - -public class IncreaseSizeOfValueColumnInNewCodePeriodsTable extends DdlChange { - private static final String TABLE_NAME = "new_code_periods"; - - public IncreaseSizeOfValueColumnInNewCodePeriodsTable(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - context.execute(new AlterColumnsBuilder(getDialect(), TABLE_NAME) - .updateColumn(newVarcharColumnDefBuilder() - .setColumnName("value") - .setLimit(255) - .build()) - .build()); - } -} diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v89/util/NetworkInterfaceProvider.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v89/util/NetworkInterfaceProvider.java deleted file mode 100644 index e3df6bd68d1..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v89/util/NetworkInterfaceProvider.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v89.util; - -import java.net.InetAddress; -import java.net.NetworkInterface; -import java.net.SocketException; -import java.util.Collections; -import java.util.List; -import java.util.stream.Collectors; - -public class NetworkInterfaceProvider { - - public List getNetworkInterfaceAddresses() throws SocketException { - return Collections.list(NetworkInterface.getNetworkInterfaces()) - .stream() - .flatMap(ni -> Collections.list(ni.getInetAddresses()).stream()) - .collect(Collectors.toList()); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/MigrationConfigurationModuleTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/MigrationConfigurationModuleTest.java index 16680366bfd..dded08044a2 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/MigrationConfigurationModuleTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/MigrationConfigurationModuleTest.java @@ -25,7 +25,7 @@ import org.sonar.core.platform.ComponentContainer; import static org.assertj.core.api.Assertions.assertThat; public class MigrationConfigurationModuleTest { - private MigrationConfigurationModule underTest = new MigrationConfigurationModule(); + private final MigrationConfigurationModule underTest = new MigrationConfigurationModule(); @Test public void verify_component_count() { diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v80/CreateNewCodePeriodTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v80/CreateNewCodePeriodTableTest.java deleted file mode 100644 index f26425e6a7a..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v80/CreateNewCodePeriodTableTest.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v80; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; -import org.sonar.db.CoreDbTester; - -import static java.sql.Types.BIGINT; -import static java.sql.Types.VARCHAR; - -public class CreateNewCodePeriodTableTest { - private static final String TABLE_NAME = "new_code_periods"; - - @Rule - public CoreDbTester dbTester = CoreDbTester.createEmpty(); - - @Rule - public ExpectedException expectedException = ExpectedException.none(); - - private CreateNewCodePeriodTable underTest = new CreateNewCodePeriodTable(dbTester.database()); - - @Test - public void table_has_been_created() throws SQLException { - underTest.execute(); - - dbTester.assertTableExists(TABLE_NAME); - dbTester.assertPrimaryKey(TABLE_NAME, "pk_new_code_periods", "uuid"); - dbTester.assertUniqueIndex(TABLE_NAME, "uniq_new_code_periods", "project_uuid", "branch_uuid"); - - dbTester.assertColumnDefinition(TABLE_NAME, "uuid", VARCHAR, 40, false); - dbTester.assertColumnDefinition(TABLE_NAME, "project_uuid", VARCHAR, 40, true); - dbTester.assertColumnDefinition(TABLE_NAME, "branch_uuid", VARCHAR, 40, true); - dbTester.assertColumnDefinition(TABLE_NAME, "type", VARCHAR, 30, false); - dbTester.assertColumnDefinition(TABLE_NAME, "value", VARCHAR, 40, true); - dbTester.assertColumnDefinition(TABLE_NAME, "updated_at", BIGINT, 20, false); - dbTester.assertColumnDefinition(TABLE_NAME, "created_at", BIGINT, 20, false); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v80/CreateProjectQualityGatesTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v80/CreateProjectQualityGatesTableTest.java deleted file mode 100644 index 870c7dc8fb9..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v80/CreateProjectQualityGatesTableTest.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v80; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; -import org.sonar.db.CoreDbTester; - -import static java.sql.Types.VARCHAR; - -public class CreateProjectQualityGatesTableTest { - private static final String TABLE_NAME = "project_qgates"; - - @Rule - public CoreDbTester dbTester = CoreDbTester.createEmpty(); - - @Rule - public ExpectedException expectedException = ExpectedException.none(); - - private CreateProjectQualityGatesTable underTest = new CreateProjectQualityGatesTable(dbTester.database()); - - @Test - public void table_has_been_created() throws SQLException { - underTest.execute(); - - dbTester.assertTableExists(TABLE_NAME); - dbTester.assertPrimaryKey(TABLE_NAME, "pk_project_qgates", "project_uuid"); - dbTester.assertUniqueIndex(TABLE_NAME, "uniq_project_qgates", "project_uuid", "quality_gate_uuid"); - - dbTester.assertColumnDefinition(TABLE_NAME, "project_uuid", VARCHAR, 40, false); - dbTester.assertColumnDefinition(TABLE_NAME, "quality_gate_uuid", VARCHAR, 40, false); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v80/DbVersion80Test.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v80/DbVersion80Test.java deleted file mode 100644 index ac624c64d2a..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v80/DbVersion80Test.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v80; - -import org.junit.Test; -import org.sonar.server.platform.db.migration.version.DbVersion; - -import static org.sonar.server.platform.db.migration.version.DbVersionTestUtils.verifyMigrationCount; -import static org.sonar.server.platform.db.migration.version.DbVersionTestUtils.verifyMinimumMigrationNumber; - -public class DbVersion80Test { - private DbVersion underTest = new DbVersion80(); - - @Test - public void migrationNumber_starts_at_3000() { - verifyMinimumMigrationNumber(underTest, 3000); - } - - @Test - public void verify_migration_count() { - verifyMigrationCount(underTest, 10); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v80/MakeDeprecatedRuleKeysRuleIdIndexNonUniqueTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v80/MakeDeprecatedRuleKeysRuleIdIndexNonUniqueTest.java deleted file mode 100644 index 498982fd51c..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v80/MakeDeprecatedRuleKeysRuleIdIndexNonUniqueTest.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v80; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; - -public class MakeDeprecatedRuleKeysRuleIdIndexNonUniqueTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(MakeDeprecatedRuleKeysRuleIdIndexNonUniqueTest.class, "deprecated_rule_keys.sql"); - - private MakeDeprecatedRuleKeysRuleIdIndexNonUnique underTest = new MakeDeprecatedRuleKeysRuleIdIndexNonUnique(db.database()); - - @Test - public void execute_makes_index_non_unique() throws SQLException { - db.assertUniqueIndex("deprecated_rule_keys", "rule_id_deprecated_rule_keys", "rule_id"); - - underTest.execute(); - - db.assertIndex("deprecated_rule_keys", "rule_id_deprecated_rule_keys", "rule_id"); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v80/MakeOrganizationsGuardedNullableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v80/MakeOrganizationsGuardedNullableTest.java deleted file mode 100644 index fed7d9dc145..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v80/MakeOrganizationsGuardedNullableTest.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v80; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; -import org.sonar.db.CoreDbTester; - -import static java.sql.Types.BOOLEAN; - -public class MakeOrganizationsGuardedNullableTest { - - private static final String TABLE_NAME = "organizations"; - - @Rule - public CoreDbTester dbTester = CoreDbTester.createForSchema(MakeOrganizationsGuardedNullable.class, "organizations.sql"); - @Rule - public ExpectedException expectedException = ExpectedException.none(); - - private MakeOrganizationsGuardedNullable underTest = new MakeOrganizationsGuardedNullable(dbTester.database()); - - @Test - public void column_is_made_nullable() throws SQLException { - underTest.execute(); - - dbTester.assertColumnDefinition(TABLE_NAME, "guarded", BOOLEAN, null, true); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v80/PopulateNewCodePeriodTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v80/PopulateNewCodePeriodTableTest.java deleted file mode 100644 index d8d7dd2521a..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v80/PopulateNewCodePeriodTableTest.java +++ /dev/null @@ -1,260 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v80; - -import java.sql.SQLException; -import java.time.LocalDate; -import java.time.ZoneId; -import java.util.Map; -import java.util.Optional; -import javax.annotation.Nullable; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; -import org.sonar.api.resources.Scopes; -import org.sonar.api.utils.System2; -import org.sonar.core.util.UuidFactoryImpl; -import org.sonar.db.CoreDbTester; - -import static java.lang.String.valueOf; -import static org.assertj.core.api.Assertions.assertThat; - -public class PopulateNewCodePeriodTableTest { - private static final String NEW_CODE_PERIODS_TABLE_NAME = "new_code_periods"; - private static final String PROJECT_BRANCHES_TABLE_NAME = "project_branches"; - private static final int NUMBER_OF_PROJECT_BRANCHES_TO_INSERT = 10; - - @Rule - public CoreDbTester dbTester = CoreDbTester.createForSchema(PopulateNewCodePeriodTableTest.class, "schema.sql"); - @Rule - public ExpectedException expectedException = ExpectedException.none(); - - private PopulateNewCodePeriodTable underTest = new PopulateNewCodePeriodTable(dbTester.database(), UuidFactoryImpl.INSTANCE, System2.INSTANCE); - - @Test - public void copy_manual_baseline_analysis_to_new_code_period_table() throws SQLException { - for (long i = 0; i < NUMBER_OF_PROJECT_BRANCHES_TO_INSERT; i++) { - insertMainBranch(i, true); - } - - underTest.execute(); - assertThat(dbTester.countRowsOfTable(NEW_CODE_PERIODS_TABLE_NAME)).isEqualTo(10); - - for (int i = 0; i < NUMBER_OF_PROJECT_BRANCHES_TO_INSERT; i++) { - assertNewCodePeriod(i, "pb-uuid-" + i, "pb-uuid-" + i, "SPECIFIC_ANALYSIS", "mba-uuid" + i); - } - - //should not fail if executed twice - underTest.execute(); - } - - @Test - public void do_nothing_if_cant_find_matching_analysis() throws SQLException { - insertMainBranch(0, false); - insertMainBranch(1, false); - - insertProperty(0, "2.0"); - insertProperty(0, "2019-04-05"); - - underTest.execute(); - assertThat(dbTester.countRowsOfTable(NEW_CODE_PERIODS_TABLE_NAME)).isZero(); - } - - @Test - public void do_nothing_if_cant_migrate_global_property() throws SQLException { - insertProperty(null, "2.0"); - - underTest.execute(); - assertThat(dbTester.countRowsOfTable(NEW_CODE_PERIODS_TABLE_NAME)).isZero(); - } - - @Test - public void migrate_project_property_set_to_previous_version() throws SQLException { - insertMainBranch(0, true); - insertMainBranch(1, false); - // no property defined for it - insertMainBranch(2, false); - - // doesn't get copied since there is a manual baseline taking precedence - insertProperty(0, "20"); - insertProperty(1, "previous_version"); - // doesn't exist - insertProperty(3, "previous_version"); - - underTest.execute(); - - assertThat(dbTester.countRowsOfTable(NEW_CODE_PERIODS_TABLE_NAME)).isEqualTo(2); - assertNewCodePeriod(0, "pb-uuid-" + 0, "pb-uuid-" + 0, "SPECIFIC_ANALYSIS", "mba-uuid" + 0); - assertNewCodePeriod(1, "pb-uuid-" + 1, null, "PREVIOUS_VERSION", null); - } - - @Test - public void migrate_project_property_set_to_number_of_days() throws SQLException { - insertMainBranch(0, false); - insertBranch(0, 1, false); - insertProperty(1, "20"); - - underTest.execute(); - - assertThat(dbTester.countRowsOfTable(NEW_CODE_PERIODS_TABLE_NAME)).isEqualTo(1); - assertNewCodePeriod(0, "pb-uuid-" + 0, "pb-uuid-" + 1, "NUMBER_OF_DAYS", "20"); - } - - @Test - public void migrate_branch_property_set_to_number_of_days() throws SQLException { - insertMainBranch(0, false); - insertProperty(0, "20"); - - underTest.execute(); - - assertThat(dbTester.countRowsOfTable(NEW_CODE_PERIODS_TABLE_NAME)).isEqualTo(1); - assertNewCodePeriod(0, "pb-uuid-" + 0, null, "NUMBER_OF_DAYS", "20"); - } - - @Test - public void migrate_global_property_set_to_number_of_days() throws SQLException { - insertProperty(null, "20"); - - underTest.execute(); - - assertThat(dbTester.countRowsOfTable(NEW_CODE_PERIODS_TABLE_NAME)).isEqualTo(1); - assertNewCodePeriod(0, null, null, "NUMBER_OF_DAYS", "20"); - } - - - @Test - public void migrate_project_property_set_to_version() throws SQLException { - insertMainBranch(0, false); - insertProperty(0, "2.0"); - - insertVersionEvent(0, 10L, "1.0"); - insertVersionEvent(0, 20L, "2.0"); - insertVersionEvent(0, 30L, "3.0"); - insertVersionEvent(0, 40L, "2.0"); - insertVersionEvent(0, 50L, "3.0"); - - underTest.execute(); - - assertThat(dbTester.countRowsOfTable(NEW_CODE_PERIODS_TABLE_NAME)).isEqualTo(1); - // we don't support specific analysis for projects, so we set it for the branch - assertNewCodePeriod(0, "pb-uuid-" + 0, "pb-uuid-" + 0, "SPECIFIC_ANALYSIS", "analysis-40"); - } - - @Test - public void migrate_project_property_set_to_date() throws SQLException { - insertMainBranch(0, false); - insertProperty(0, "2019-04-05"); - - long reference = LocalDate.parse("2019-04-05").atStartOfDay(ZoneId.systemDefault()).toInstant().toEpochMilli(); - insertSnapshot(100, 0, reference - 100); - insertSnapshot(200, 0, reference + 100); - insertSnapshot(300, 0, reference + 200); - - underTest.execute(); - - assertThat(dbTester.countRowsOfTable(NEW_CODE_PERIODS_TABLE_NAME)).isEqualTo(1); - // we don't support specific analysis for projects, so we set it for the branch - assertNewCodePeriod(0, "pb-uuid-" + 0, "pb-uuid-" + 0, "SPECIFIC_ANALYSIS", "snapshot-200"); - } - - private void assertNewCodePeriod(int row, @Nullable String projectUuid, @Nullable String branchUuid, String type, @Nullable String value) { - Optional> r = dbTester.select("SELECT PROJECT_UUID, BRANCH_UUID, TYPE, VALUE FROM " + NEW_CODE_PERIODS_TABLE_NAME) - .stream() - .skip(row) - .findFirst(); - - assertThat(r).isPresent(); - - assertThat(r.get().get("PROJECT_UUID")).isEqualTo(projectUuid); - assertThat(r.get().get("BRANCH_UUID")).isEqualTo(branchUuid); - assertThat(r.get().get("TYPE")).isEqualTo(type); - assertThat(r.get().get("VALUE")).isEqualTo(value); - } - - private void insertBranch(long mainBranchUid, long uid, boolean withBaseLine) { - String manualBaseline = withBaseLine ? "mba-uuid" + uid : null; - - String mainBranchProjectUuid = mainBranchUid == uid ? null : "pb-uuid-" + mainBranchUid; - insertComponent(uid, "pb-uuid-" + uid, mainBranchProjectUuid); - - dbTester.executeInsert( - PROJECT_BRANCHES_TABLE_NAME, - "UUID", "pb-uuid-" + uid, - "PROJECT_UUID", "pb-uuid-" + mainBranchUid, - "KEE", "pb-key-" + uid, - "KEY_TYPE", "TSR", - "BRANCH_TYPE", "BRANCH", - "MERGE_BRANCH_UUID", "mb-uuid-" + mainBranchUid, - "MANUAL_BASELINE_ANALYSIS_UUID", manualBaseline, - "CREATED_AT", System2.INSTANCE.now(), - "UPDATED_AT", System2.INSTANCE.now() - ); - } - - private void insertSnapshot(int uid, int branchUid, long creationDate) { - dbTester.executeInsert( - "SNAPSHOTS", - "UUID", "snapshot-" + uid, - "COMPONENT_UUID", "pb-uuid-" + branchUid, - "STATUS", "P", - "CREATED_AT", creationDate - ); - } - - private void insertProperty(@Nullable Integer uid, String value) { - dbTester.executeInsert( - "PROPERTIES", - "PROP_KEY", "sonar.leak.period", - "RESOURCE_ID", uid, - "USER_ID", null, - "IS_EMPTY", false, - "TEXT_VALUE", value, - "CLOB_VALUE", null, - "CREATED_AT", System2.INSTANCE.now() - ); - } - - private void insertComponent(long id, String uuid, @Nullable String mainBranchProjectUuid) { - dbTester.executeInsert( - "projects", - "ID", valueOf(id), - "UUID", uuid, - "ROOT_UUID", uuid, - "PROJECT_UUID", uuid, - "MAIN_BRANCH_PROJECT_UUID", mainBranchProjectUuid, - "SCOPE", Scopes.PROJECT, - "QUALIFIER", "TRK", - "NAME", "name-" + id); - } - - private void insertVersionEvent(long id, long createdAt, String version) { - dbTester.executeInsert( - "events", - "ANALYSIS_UUID", "analysis-" + createdAt, - "NAME", version, - "COMPONENT_UUID", "pb-uuid-" + id, - "CATEGORY", "Version", - "CREATED_AT", createdAt); - } - - private void insertMainBranch(long uid, boolean withBaseLine) { - insertBranch(uid, uid, withBaseLine); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v80/PopulateProjectQualityGatesTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v80/PopulateProjectQualityGatesTableTest.java deleted file mode 100644 index 85f77a1d5b5..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v80/PopulateProjectQualityGatesTableTest.java +++ /dev/null @@ -1,131 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v80; - -import java.sql.SQLException; -import java.time.Instant; -import java.util.List; -import java.util.Random; -import java.util.stream.Collectors; -import org.junit.Assert; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; -import org.sonar.db.CoreDbTester; - -import static java.lang.String.valueOf; - - -public class PopulateProjectQualityGatesTableTest { - private static final String PROJECTS_TABLE_NAME = "projects"; - private static final String QUALITY_GATES_TABLE_NAME = "quality_gates"; - private static final String PROPERTIES_TABLE_NAME = "properties"; - private static final int NUMBER_OF_PROJECTS_TO_INSERT = 5; - - private final Random random = new Random(); - - @Rule - public CoreDbTester dbTester = CoreDbTester.createForSchema(PopulateProjectQualityGatesTableTest.class, "schema.sql"); - - @Rule - public ExpectedException expectedException = ExpectedException.none(); - - private PopulateProjectQualityGatesTable underTest = new PopulateProjectQualityGatesTable(dbTester.database()); - - @Test - public void copy_quality_gates_properties_to_project_qgate_table() throws SQLException { - long firstQualityGateId = insertQualityGate("qg1"); - long secondQualityGateId = insertQualityGate("qg2"); - - for (long i = 1; i <= NUMBER_OF_PROJECTS_TO_INSERT; i++) { - long projectId = insertComponent("p" + i); - long qualityGateId = random.nextBoolean() ? firstQualityGateId : secondQualityGateId; - insertQualityGateProperty(projectId, qualityGateId); - } - - underTest.execute(); - - List qualityGates = getQualityGates(); - Assert.assertEquals(NUMBER_OF_PROJECTS_TO_INSERT, qualityGates.size()); - - //must not delete properties - int propertiesCount = dbTester.countRowsOfTable(PROPERTIES_TABLE_NAME); - Assert.assertEquals(5, propertiesCount); - - //should not fail if executed twice - underTest.execute(); - } - - private long insertQualityGate(String qualityGateUuid) { - dbTester.executeInsert( - QUALITY_GATES_TABLE_NAME, - "UUID", qualityGateUuid, - "NAME", "name_" + qualityGateUuid, - "IS_BUILT_IN", valueOf(true) - ); - return (long) dbTester.selectFirst("select id as \"ID\" from quality_gates where uuid='" + qualityGateUuid + "'").get("ID"); - } - - private long insertComponent(String uuid) { - dbTester.executeInsert( - PROJECTS_TABLE_NAME, - "ORGANIZATION_UUID", "org_" + uuid, - "SCOPE", "PRJ", - "QUALIFIER", "TRK", - "UUID", uuid, - "UUID_PATH", "path_" + uuid, - "ROOT_UUID", "root_" + uuid, - "PROJECT_UUID", uuid, - "PRIVATE", valueOf(false)); - return (long) dbTester.selectFirst("select id as \"ID\" from projects where uuid='" + uuid + "'").get("ID"); - } - - private void insertQualityGateProperty(Long projectId, Long qualityGateId) { - dbTester.executeInsert(PROPERTIES_TABLE_NAME, - "prop_key", "sonar.qualitygate", - "resource_id", projectId, - "is_empty", false, - "text_value", Long.toString(qualityGateId), - "created_at", Instant.now().toEpochMilli()); - } - - private List getQualityGates() { - return dbTester.select("select pqg.project_uuid, pqg.quality_gate_uuid from project_qgates pqg " + - "join projects p on pqg.project_uuid = p.uuid " + - "join quality_gates qg on pqg.quality_gate_uuid = qg.uuid") - .stream() - .map(row -> { - String projectUuid = String.valueOf(row.get("PROJECT_UUID")); - String qualityGateUuid = String.valueOf(row.get("QUALITY_GATE_UUID")); - return new ProjectQualityGate(projectUuid, qualityGateUuid); - }) - .collect(Collectors.toList()); - } - - private static class ProjectQualityGate { - final String projectUuid; - final String qualityGateUuid; - - private ProjectQualityGate(String projectUuid, String qualityGateUuid) { - this.projectUuid = projectUuid; - this.qualityGateUuid = qualityGateUuid; - } - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v80/RemoveDefaultQualityGateFromPropertiesTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v80/RemoveDefaultQualityGateFromPropertiesTableTest.java deleted file mode 100644 index 35fcbc2cc64..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v80/RemoveDefaultQualityGateFromPropertiesTableTest.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v80; - -import java.sql.SQLException; -import java.time.Instant; -import org.junit.Assert; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; -import org.sonar.db.CoreDbTester; - - -public class RemoveDefaultQualityGateFromPropertiesTableTest { - private static final String PROPERTIES_TABLE_NAME = "properties"; - private static final int TOTAL_NUMBER_OF_PROPERTIES = 10; - - @Rule - public CoreDbTester dbTester = CoreDbTester.createForSchema(RemoveDefaultQualityGateFromPropertiesTableTest.class, "schema.sql"); - - @Rule - public ExpectedException expectedException = ExpectedException.none(); - - private final RemoveDefaultQualityGateFromPropertiesTable underTest = new RemoveDefaultQualityGateFromPropertiesTable(dbTester.database()); - - @Test - public void remove_default_quality_gate_property() throws SQLException { - for (long i = 1; i <= TOTAL_NUMBER_OF_PROPERTIES; i++) { - insertQualityGateProperty(i, String.valueOf(i + 100)); - } - - int propertiesCount = dbTester.countRowsOfTable(PROPERTIES_TABLE_NAME); - Assert.assertEquals(TOTAL_NUMBER_OF_PROPERTIES, propertiesCount); - - underTest.execute(); - - //should delete properties - propertiesCount = dbTester.countRowsOfTable(PROPERTIES_TABLE_NAME); - Assert.assertEquals(0, propertiesCount); - - //should not fail if executed twice - underTest.execute(); - } - - private void insertQualityGateProperty(Long projectId, String qualityGateUuid) { - dbTester.executeInsert(PROPERTIES_TABLE_NAME, - "prop_key", "sonar.qualitygate", - "resource_id", projectId, - "is_empty", false, - "text_value", qualityGateUuid, - "created_at", Instant.now().toEpochMilli()); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v80/RemoveGitHubLoginGenerationStrategyPropertyTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v80/RemoveGitHubLoginGenerationStrategyPropertyTest.java deleted file mode 100644 index d26cedce0c4..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v80/RemoveGitHubLoginGenerationStrategyPropertyTest.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v80; - -import java.sql.SQLException; -import java.time.Instant; -import org.junit.Assert; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; -import org.sonar.db.CoreDbTester; - -public class RemoveGitHubLoginGenerationStrategyPropertyTest { - private static final String PROPERTIES_TABLE_NAME = "properties"; - - @Rule - public CoreDbTester dbTester = CoreDbTester.createForSchema(RemoveGitHubLoginGenerationStrategyPropertyTest.class, "schema.sql"); - - @Rule - public ExpectedException expectedException = ExpectedException.none(); - - private RemoveGitHubLoginGenerationStrategyProperty underTest = new RemoveGitHubLoginGenerationStrategyProperty(dbTester.database()); - - @Test - public void remove_github_login_strategy_property() throws SQLException { - insertGitHubLoginStrategy(); - - int propertiesCount = dbTester.countRowsOfTable(PROPERTIES_TABLE_NAME); - Assert.assertEquals(1, propertiesCount); - - underTest.execute(); - - //should delete properties - propertiesCount = dbTester.countRowsOfTable(PROPERTIES_TABLE_NAME); - Assert.assertEquals(0, propertiesCount); - - //should not fail if executed twice - underTest.execute(); - } - - private void insertGitHubLoginStrategy() { - dbTester.executeInsert(PROPERTIES_TABLE_NAME, - "prop_key", "sonar.auth.github.loginStrategy", - "is_empty", false, - "text_value", "Unique", - "created_at", Instant.now().toEpochMilli()); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v80/RemoveLeakPeriodPropertiesTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v80/RemoveLeakPeriodPropertiesTest.java deleted file mode 100644 index cbda87658dd..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v80/RemoveLeakPeriodPropertiesTest.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v80; - -import java.sql.SQLException; -import java.time.Instant; -import org.junit.Assert; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; -import org.sonar.db.CoreDbTester; - -public class RemoveLeakPeriodPropertiesTest { - private static final String PROPERTIES_TABLE_NAME = "properties"; - private static final int TOTAL_NUMBER_OF_PROPERTIES = 10; - - @Rule - public CoreDbTester dbTester = CoreDbTester.createForSchema(RemoveLeakPeriodPropertiesTest.class, "schema.sql"); - - @Rule - public ExpectedException expectedException = ExpectedException.none(); - - private RemoveLeakPeriodProperties underTest = new RemoveLeakPeriodProperties(dbTester.database()); - - @Test - public void remove_default_quality_gate_property() throws SQLException { - for (long i = 1; i <= TOTAL_NUMBER_OF_PROPERTIES; i++) { - insertQualityGateProperty(i, String.valueOf(i + 100)); - } - - int propertiesCount = dbTester.countRowsOfTable(PROPERTIES_TABLE_NAME); - Assert.assertEquals(TOTAL_NUMBER_OF_PROPERTIES, propertiesCount); - - underTest.execute(); - - //should delete properties - propertiesCount = dbTester.countRowsOfTable(PROPERTIES_TABLE_NAME); - Assert.assertEquals(0, propertiesCount); - - //should not fail if executed twice - underTest.execute(); - } - - private void insertQualityGateProperty(Long projectId, String qualityGateUuid) { - dbTester.executeInsert(PROPERTIES_TABLE_NAME, - "prop_key", "sonar.leak.period", - "resource_id", projectId, - "is_empty", false, - "text_value", qualityGateUuid, - "created_at", Instant.now().toEpochMilli()); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v80/RenameAnalysisPropertiesSnapshotUuidTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v80/RenameAnalysisPropertiesSnapshotUuidTest.java deleted file mode 100644 index ccc0eff8ef5..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v80/RenameAnalysisPropertiesSnapshotUuidTest.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v80; - -import java.sql.SQLException; -import java.sql.Types; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; -import org.sonar.db.CoreDbTester; - -public class RenameAnalysisPropertiesSnapshotUuidTest { - - private static final String TABLE_NAME = "analysis_properties"; - - @Rule - public CoreDbTester dbTester = CoreDbTester.createForSchema(RenameAnalysisPropertiesSnapshotUuidTest.class, "analysis_properties.sql"); - @Rule - public ExpectedException expectedException = ExpectedException.none(); - - private RenameAnalysisPropertiesSnapshotUuid underTest = new RenameAnalysisPropertiesSnapshotUuid(dbTester.database()); - - @Test - public void execute_renames_column_snapshot_uuid_and_recreate_index_snapshot_uuid_with_a_new_name() throws SQLException { - underTest.execute(); - - dbTester.assertColumnDefinition(TABLE_NAME, "analysis_uuid", Types.VARCHAR, 40, false); - dbTester.assertIndex(TABLE_NAME, "analysis_properties_analysis", "analysis_uuid"); - } - - @Test - public void execute_is_not_reentrant() throws SQLException { - underTest.execute(); - - expectedException.expect(IllegalStateException.class); - - underTest.execute(); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v81/AddExcludeBranchFromPurgeColumnTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v81/AddExcludeBranchFromPurgeColumnTest.java deleted file mode 100644 index c65849013f5..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v81/AddExcludeBranchFromPurgeColumnTest.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v81; - -import java.sql.SQLException; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; -import org.sonar.api.utils.System2; -import org.sonar.db.CoreDbTester; - -import static org.assertj.core.api.Assertions.assertThat; - -public class AddExcludeBranchFromPurgeColumnTest { - - private static final String TABLE = "project_branches"; - - private static final String PROJECT_1_UUID = "1a724f54-c2a4-4d36-b59c-61026f178613"; - private static final String PROJECT_2_UUID = "cc69ccb8-434a-489b-abd6-6a80371f64ff"; - - private static final String MAIN_BRANCH_1 = "8a9789c8-7aee-4aa6-9cb7-407137935ac3"; - private static final String LONG_BRANCH_1 = "69fdfc19-491c-4ed9-bcac-ef04e0f6cdc6"; - private static final String SHORT_BRANCH_1 = "f7a6d247-1790-40f8-8591-a0cc39d05ecb"; - private static final String PR_1 = "d65466bf-271c-4f9f-ac7a-72add44848c0"; - - private static final String MAIN_BRANCH_2 = "cdadf128-7bdb-4589-982d-62445d46ae1b"; - private static final String LONG_BRANCH_2 = "60bf6fa8-3ecc-4ba6-ad8d-991ea7c7f9cb"; - private static final String SHORT_BRANCH_2 = "ce5632ed-462e-4384-98b6-1773a7bbfe53"; - private static final String PR_2 = "5897f7d0-d34f-4558-b9c5-a7eb7a5c4b69"; - - @Rule - public CoreDbTester dbTester = CoreDbTester.createForSchema(AddExcludeBranchFromPurgeColumnTest.class, "schema.sql"); - - @Rule - public ExpectedException expectedException = ExpectedException.none(); - - private AddExcludeBranchFromPurgeColumn underTest = new AddExcludeBranchFromPurgeColumn(dbTester.database()); - - @Before - public void setup() { - insertBranch(MAIN_BRANCH_1, PROJECT_1_UUID, "master", "BRANCH", "LONG"); - insertBranch(LONG_BRANCH_1, PROJECT_1_UUID, "release-1", "BRANCH", "LONG"); - insertBranch(SHORT_BRANCH_1, PROJECT_1_UUID, "feature/foo", "BRANCH", "SHORT"); - insertBranch(PR_1, PROJECT_1_UUID, "feature/feature-1", "PULL_REQUEST", "PULL_REQUEST"); - - insertBranch(MAIN_BRANCH_2, PROJECT_2_UUID, "trunk", "BRANCH", "LONG"); - insertBranch(LONG_BRANCH_2, PROJECT_2_UUID, "branch-1", "BRANCH", "LONG"); - insertBranch(SHORT_BRANCH_2, PROJECT_2_UUID, "feature/bar", "BRANCH", "SHORT"); - insertBranch(PR_2, PROJECT_2_UUID, "feature/feature-2", "PULL_REQUEST", "PULL_REQUEST"); - } - - @Test - public void execute_migration() throws SQLException { - underTest.execute(); - - verifyMigrationResult(); - } - - private void verifyMigrationResult() { - assertThat(dbTester.countSql("select count(*) from " + TABLE + " where exclude_from_purge = true")).isZero(); - assertThat(dbTester.countSql("select count(*) from " + TABLE + " where exclude_from_purge = false")).isEqualTo(8); - } - - private void insertBranch(String uuid, String projectUuid, String key, String keyType, String branchType) { - dbTester.executeInsert( - TABLE, - "UUID", uuid, - "PROJECT_UUID", projectUuid, - "KEE", key, - "BRANCH_TYPE", branchType, - "KEY_TYPE", keyType, - "MERGE_BRANCH_UUID", null, - "CREATED_AT", System2.INSTANCE.now(), - "UPDATED_AT", System2.INSTANCE.now()); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v81/CreateAlmSettingsTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v81/CreateAlmSettingsTableTest.java deleted file mode 100644 index b3b35119bc6..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v81/CreateAlmSettingsTableTest.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v81; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; -import org.sonar.db.CoreDbTester; - -import static java.sql.Types.BIGINT; -import static java.sql.Types.VARCHAR; - -public class CreateAlmSettingsTableTest { - - private static final String TABLE_NAME = "alm_settings"; - - @Rule - public CoreDbTester dbTester = CoreDbTester.createEmpty(); - - @Rule - public ExpectedException expectedException = ExpectedException.none(); - - private CreateAlmSettingsTable underTest = new CreateAlmSettingsTable(dbTester.database()); - - @Test - public void table_has_been_created() throws SQLException { - underTest.execute(); - - dbTester.assertTableExists(TABLE_NAME); - dbTester.assertPrimaryKey(TABLE_NAME, "pk_alm_settings", "uuid"); - dbTester.assertUniqueIndex(TABLE_NAME, "uniq_alm_settings", "kee"); - - dbTester.assertColumnDefinition(TABLE_NAME, "uuid", VARCHAR, 40, false); - dbTester.assertColumnDefinition(TABLE_NAME, "kee", VARCHAR, 200, false); - dbTester.assertColumnDefinition(TABLE_NAME, "alm_id", VARCHAR, 40, false); - dbTester.assertColumnDefinition(TABLE_NAME, "url", VARCHAR, 2000, true); - dbTester.assertColumnDefinition(TABLE_NAME, "app_id", VARCHAR, 80, true); - dbTester.assertColumnDefinition(TABLE_NAME, "private_key", VARCHAR, 2000, true); - dbTester.assertColumnDefinition(TABLE_NAME, "pat", VARCHAR, 2000, true); - dbTester.assertColumnDefinition(TABLE_NAME, "updated_at", BIGINT, 20, false); - dbTester.assertColumnDefinition(TABLE_NAME, "created_at", BIGINT, 20, false); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v81/CreateProjectAlmSettingsTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v81/CreateProjectAlmSettingsTableTest.java deleted file mode 100644 index 9e0558772a7..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v81/CreateProjectAlmSettingsTableTest.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v81; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; -import org.sonar.db.CoreDbTester; - -import static java.sql.Types.BIGINT; -import static java.sql.Types.VARCHAR; - -public class CreateProjectAlmSettingsTableTest { - private static final String TABLE_NAME = "project_alm_settings"; - - @Rule - public CoreDbTester dbTester = CoreDbTester.createEmpty(); - - @Rule - public ExpectedException expectedException = ExpectedException.none(); - - private CreateProjectAlmSettingsTable underTest = new CreateProjectAlmSettingsTable(dbTester.database()); - - @Test - public void table_has_been_created() throws SQLException { - underTest.execute(); - - dbTester.assertTableExists(TABLE_NAME); - dbTester.assertPrimaryKey(TABLE_NAME, "pk_project_alm_settings", "uuid"); - dbTester.assertUniqueIndex(TABLE_NAME, "uniq_project_alm_settings", "project_uuid"); - dbTester.assertIndex(TABLE_NAME, "project_alm_settings_alm", "alm_setting_uuid"); - - dbTester.assertColumnDefinition(TABLE_NAME, "uuid", VARCHAR, 40, false); - dbTester.assertColumnDefinition(TABLE_NAME, "alm_setting_uuid", VARCHAR, 40, false); - dbTester.assertColumnDefinition(TABLE_NAME, "project_uuid", VARCHAR, 50, false); - dbTester.assertColumnDefinition(TABLE_NAME, "alm_repo", VARCHAR, 256, true); - dbTester.assertColumnDefinition(TABLE_NAME, "alm_slug", VARCHAR, 256, true); - dbTester.assertColumnDefinition(TABLE_NAME, "updated_at", BIGINT, 20, false); - dbTester.assertColumnDefinition(TABLE_NAME, "created_at", BIGINT, 20, false); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v81/DbVersion81Test.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v81/DbVersion81Test.java deleted file mode 100644 index 39e5c9ce3ca..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v81/DbVersion81Test.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v81; - -import org.junit.Test; -import org.sonar.server.platform.db.migration.version.DbVersion; - -import static org.sonar.server.platform.db.migration.version.DbVersionTestUtils.verifyMigrationCount; -import static org.sonar.server.platform.db.migration.version.DbVersionTestUtils.verifyMinimumMigrationNumber; - -public class DbVersion81Test { - - private DbVersion underTest = new DbVersion81(); - - @Test - public void migrationNumber_starts_at_3000() { - verifyMinimumMigrationNumber(underTest, 3100); - } - - @Test - public void verify_migration_count() { - verifyMigrationCount(underTest, 14); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v81/DeleteSonarPullRequestProviderPropertyTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v81/DeleteSonarPullRequestProviderPropertyTest.java deleted file mode 100644 index 85b4e3b9f0c..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v81/DeleteSonarPullRequestProviderPropertyTest.java +++ /dev/null @@ -1,105 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v81; - -import java.sql.SQLException; -import javax.annotation.Nullable; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; -import org.sonar.api.utils.System2; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DataChange; - -import static java.util.stream.Collectors.toSet; -import static org.assertj.core.api.Assertions.assertThat; - -public class DeleteSonarPullRequestProviderPropertyTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DeleteSonarPullRequestProviderPropertyTest.class, "schema.sql"); - @Rule - public ExpectedException expectedException = ExpectedException.none(); - - private DataChange underTest = new DeleteSonarPullRequestProviderProperty(db.database()); - - @Test - public void delete_provider_property() throws SQLException { - insertProperty("sonar.pullrequest.provider", null); - insertProperty("sonar.pullrequest.provider", 1); - insertProperty("sonar.pullrequest.provider", 2); - - underTest.execute(); - - assertNoProperties(); - } - - @Test - public void do_not_delete_other_property() throws SQLException { - insertProperty("sonar.pullrequest.provider", null); - insertProperty("sonar.other.property", null); - - underTest.execute(); - - assertPropertyKeys("sonar.other.property"); - } - - @Test - public void do_nothing_when_no_property() throws SQLException { - underTest.execute(); - - assertNoProperties(); - } - - @Test - public void migration_is_reentrant() throws SQLException { - insertProperty("sonar.pullrequest.provider", null); - - underTest.execute(); - underTest.execute(); - - assertNoProperties(); - } - - private void assertPropertyKeys(String... expectedKeys) { - assertThat(db.select("SELECT prop_key FROM properties") - .stream() - .map(map -> map.get("PROP_KEY")) - .collect(toSet())) - .containsExactlyInAnyOrder(expectedKeys); - } - - private void assertNoProperties() { - assertPropertyKeys(); - } - - private void insertProperty(String key, @Nullable Integer projectId) { - db.executeInsert( - "PROPERTIES", - "PROP_KEY", key, - "RESOURCE_ID", projectId, - "USER_ID", null, - "IS_EMPTY", false, - "TEXT_VALUE", "AnyValue", - "CLOB_VALUE", null, - "CREATED_AT", System2.INSTANCE.now()); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v81/MigrateAzureAlmSettingsTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v81/MigrateAzureAlmSettingsTest.java deleted file mode 100644 index 7286d8b8c8e..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v81/MigrateAzureAlmSettingsTest.java +++ /dev/null @@ -1,375 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v81; - -import java.sql.SQLException; -import javax.annotation.Nullable; -import org.assertj.core.groups.Tuple; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; -import org.sonar.api.impl.utils.TestSystem2; -import org.sonar.api.utils.System2; -import org.sonar.core.util.UuidFactory; -import org.sonar.core.util.UuidFactoryFast; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DataChange; - -import static java.util.stream.Collectors.toList; -import static java.util.stream.Collectors.toSet; -import static org.apache.commons.lang.math.RandomUtils.nextInt; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.tuple; - -public class MigrateAzureAlmSettingsTest { - - private final static long PAST = 10_000_000_000L; - private static final long NOW = 50_000_000_000L; - private System2 system2 = new TestSystem2().setNow(NOW); - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(MigrateAzureAlmSettingsTest.class, "schema.sql"); - @Rule - public ExpectedException expectedException = ExpectedException.none(); - - private UuidFactory uuidFactory = UuidFactoryFast.getInstance(); - - private DataChange underTest = new MigrateAzureAlmSettings(db.database(), uuidFactory, system2); - - @Test - public void migrate_settings_when_project_provider_is_set_to_azure_and_global_provider_is_set_to_something_else() throws SQLException { - insertProperty("sonar.pullrequest.provider", "Bitbucket Server", null); - long projectId1 = insertProject("PROJECT_1"); - insertProperty("sonar.pullrequest.provider", "Azure DevOps", projectId1); - insertProperty("sonar.pullrequest.vsts.token.secured", "12345", projectId1); - long projectId2 = insertProject("PROJECT_2"); - insertProperty("sonar.pullrequest.provider", "Azure DevOps", projectId2); - insertProperty("sonar.pullrequest.vsts.token.secured", "12345", projectId2); - - underTest.execute(); - - assertAlmSettings(tuple("azure_devops", "Azure DevOps", "12345", NOW, NOW)); - String almSettingUuid = selectAlmSettingUuid("Azure DevOps"); - assertProjectAlmSettings( - tuple("PROJECT_1", almSettingUuid, NOW, NOW), - tuple("PROJECT_2", almSettingUuid, NOW, NOW)); - assertProperties( - tuple("sonar.pullrequest.provider", "Bitbucket Server", null), - tuple("sonar.pullrequest.provider", "Azure DevOps", projectId1), - tuple("sonar.pullrequest.provider", "Azure DevOps", projectId2)); - } - - @Test - public void migrate_settings_when_token_is_global_and_provider_is_per_project() throws SQLException { - insertProperty("sonar.pullrequest.vsts.token.secured", "12345", null); - long projectId1 = insertProject("PROJECT_1"); - insertProperty("sonar.pullrequest.provider", "Azure DevOps", projectId1); - long projectId2 = insertProject("PROJECT_2"); - insertProperty("sonar.pullrequest.provider", "Azure DevOps", projectId2); - - underTest.execute(); - - assertAlmSettings(tuple("azure_devops", "Azure DevOps", "12345", NOW, NOW)); - String almSettingUuid = selectAlmSettingUuid("Azure DevOps"); - assertProjectAlmSettings( - tuple("PROJECT_1", almSettingUuid, NOW, NOW), - tuple("PROJECT_2", almSettingUuid, NOW, NOW)); - assertProperties( - tuple("sonar.pullrequest.provider", "Azure DevOps", projectId1), - tuple("sonar.pullrequest.provider", "Azure DevOps", projectId2)); - } - - @Test - public void migrate_settings_when_provider_is_global() throws SQLException { - insertProperty("sonar.pullrequest.provider", "Azure DevOps", null); - long projectId1 = insertProject("PROJECT_1"); - insertProperty("sonar.pullrequest.vsts.token.secured", "12345", projectId1); - long projectId2 = insertProject("PROJECT_2"); - insertProperty("sonar.pullrequest.provider", "Azure DevOps", projectId2); - insertProperty("sonar.pullrequest.vsts.token.secured", "12345", projectId2); - - underTest.execute(); - - assertAlmSettings(tuple("azure_devops", "Azure DevOps", "12345", NOW, NOW)); - String almSettingUuid = selectAlmSettingUuid("Azure DevOps"); - assertProjectAlmSettings( - tuple("PROJECT_1", almSettingUuid, NOW, NOW), - tuple("PROJECT_2", almSettingUuid, NOW, NOW)); - assertProperties( - tuple("sonar.pullrequest.provider", "Azure DevOps", null), - tuple("sonar.pullrequest.provider", "Azure DevOps", projectId2)); - } - - @Test - public void create_one_alm_setting_for_each_token_found() throws SQLException { - insertProperty("sonar.pullrequest.provider", "Azure DevOps", null); - insertProperty("sonar.pullrequest.vsts.token.secured", "100", null); - long projectId1 = insertProject("PROJECT_1"); - // No token defined on project 1 -> use global token - insertProperty("sonar.pullrequest.provider", "Azure DevOps", projectId1); - long projectId2 = insertProject("PROJECT_2"); - insertProperty("sonar.pullrequest.vsts.token.secured", "200", projectId2); - long projectId3 = insertProject("PROJECT_3"); - insertProperty("sonar.pullrequest.provider", "Azure DevOps", projectId3); - insertProperty("sonar.pullrequest.vsts.token.secured", "300", projectId3); - - underTest.execute(); - - assertAlmSettings( - tuple("azure_devops", "Azure DevOps", "100", NOW, NOW), - tuple("azure_devops", "Azure DevOps 1", "200", NOW, NOW), - tuple("azure_devops", "Azure DevOps 2", "300", NOW, NOW)); - assertProjectAlmSettings( - tuple("PROJECT_1", selectAlmSettingUuid("Azure DevOps"), NOW, NOW), - tuple("PROJECT_2", selectAlmSettingUuid("Azure DevOps 1"), NOW, NOW), - tuple("PROJECT_3", selectAlmSettingUuid("Azure DevOps 2"), NOW, NOW)); - assertProperties( - tuple("sonar.pullrequest.provider", "Azure DevOps", null), - tuple("sonar.pullrequest.provider", "Azure DevOps", projectId1), - tuple("sonar.pullrequest.provider", "Azure DevOps", projectId3)); - } - - @Test - public void ignore_when_project_is_missing_token() throws SQLException { - insertProperty("sonar.pullrequest.provider", "Azure DevOps", null); - long projectId1 = insertProject("PROJECT_1"); - // No token in project 1 - insertProperty("sonar.pullrequest.provider", "Azure DevOps", projectId1); - long projectId2 = insertProject("PROJECT_2"); - insertProperty("sonar.pullrequest.provider", "Azure DevOps", projectId2); - insertProperty("sonar.pullrequest.vsts.token.secured", "200", projectId2); - underTest.execute(); - - assertAlmSettings(tuple("azure_devops", "Azure DevOps", "200", NOW, NOW)); - assertProjectAlmSettings( - tuple("PROJECT_2", selectAlmSettingUuid("Azure DevOps"), NOW, NOW)); - assertProperties( - tuple("sonar.pullrequest.provider", "Azure DevOps", null), - tuple("sonar.pullrequest.provider", "Azure DevOps", projectId1), - tuple("sonar.pullrequest.provider", "Azure DevOps", projectId2)); - } - - @Test - public void use_existing_alm_setting() throws SQLException { - db.executeInsert("alm_settings", - "uuid", "ABCD", - "alm_id", "azure_devops", - "kee", "Azure DevOps", - "pat", "12345", - "created_at", PAST, - "updated_at", PAST); - long projectId1 = insertProject("PROJECT_1"); - insertProperty("sonar.pullrequest.provider", "Azure DevOps", projectId1); - insertProperty("sonar.pullrequest.vsts.token.secured", "12345", projectId1); - - underTest.execute(); - - assertProjectAlmSettings(tuple("PROJECT_1", "ABCD", NOW, NOW)); - assertProperties(tuple("sonar.pullrequest.provider", "Azure DevOps", projectId1)); - } - - @Test - public void delete_azure_settings_when_project_provider_is_not_set_to_azure() throws SQLException { - insertProperty("sonar.pullrequest.provider", "Azure DevOps", null); - insertProperty("sonar.pullrequest.vsts.token.secured", "12345", null); - long projectId1 = insertProject("PROJECT_1"); - // Project provider is set to something else - insertProperty("sonar.pullrequest.provider", "Bitbucket Server", projectId1); - insertProperty("sonar.pullrequest.vsts.token.secured", "12345", projectId1); - - underTest.execute(); - - assertAlmSettings(tuple("azure_devops", "Azure DevOps", "12345", NOW, NOW)); - assertNoProjectAlmSettings(); - assertProperties( - tuple("sonar.pullrequest.provider", "Azure DevOps", null), - tuple("sonar.pullrequest.provider", "Bitbucket Server", projectId1)); - } - - @Test - public void ignore_none_azure_project_settings() throws SQLException { - insertProperty("sonar.pullrequest.provider", "Azure DevOps", null); - insertProperty("sonar.pullrequest.vsts.token.secured", "12345", null); - long projectId1 = insertProject("PROJECT_1"); - insertProperty("sonar.pullrequest.provider", "Bitbucket", projectId1); - long projectId2 = insertProject("PROJECT_2"); - insertProperty("sonar.pullrequest.provider", "Bitbucket", projectId2); - - underTest.execute(); - - assertAlmSettings(tuple("azure_devops", "Azure DevOps", "12345", NOW, NOW)); - assertNoProjectAlmSettings(); - assertProperties( - tuple("sonar.pullrequest.provider", "Azure DevOps", null), - tuple("sonar.pullrequest.provider", "Bitbucket", projectId1), - tuple("sonar.pullrequest.provider", "Bitbucket", projectId2)); - } - - @Test - public void ignore_azure_setting_when_project_provider_is_not_azure() throws SQLException { - insertProperty("sonar.pullrequest.provider", "Azure DevOps", null); - insertProperty("sonar.pullrequest.vsts.token.secured", "12345", null); - long projectId1 = insertProject("PROJECT_1"); - insertProperty("sonar.pullrequest.provider", "Bitbucket", projectId1); - insertProperty("sonar.pullrequest.vsts.token.secured", "12345", projectId1); - - underTest.execute(); - - assertAlmSettings(tuple("azure_devops", "Azure DevOps", "12345", NOW, NOW)); - assertNoProjectAlmSettings(); - assertProperties( - tuple("sonar.pullrequest.provider", "Azure DevOps", null), - tuple("sonar.pullrequest.provider", "Bitbucket", projectId1)); - } - - @Test - public void do_not_create_project_settings_when_only_global_provider_is_set() throws SQLException { - insertProperty("sonar.pullrequest.provider", "Azure DevOps", null); - insertProperty("sonar.pullrequest.vsts.token.secured", "12345", null); - insertProject("PROJECT_1"); - insertProject("PROJECT_2"); - - underTest.execute(); - - assertAlmSettings(tuple("azure_devops", "Azure DevOps", "12345", NOW, NOW)); - assertNoProjectAlmSettings(); - assertProperties(tuple("sonar.pullrequest.provider", "Azure DevOps", null)); - } - - @Test - public void do_not_create_project_settings_when_missing_some_properties() throws SQLException { - long projectId1 = insertProject("PROJECT_1"); - // No provider - insertProperty("sonar.pullrequest.vsts.token.secured", "12345", projectId1); - - underTest.execute(); - - assertAlmSettings(tuple("azure_devops", "Azure DevOps", "12345", NOW, NOW)); - assertNoProjectAlmSettings(); - assertNoProperties(); - } - - @Test - public void do_nothing_when_no_alm_properties() throws SQLException { - insertProperty("sonar.other.property", "Something", null); - - underTest.execute(); - - assertNoAlmSettings(); - assertNoProjectAlmSettings(); - assertProperties(tuple("sonar.other.property", "Something", null)); - } - - @Test - public void migration_is_reentrant() throws SQLException { - insertProperty("sonar.pullrequest.provider", "Azure DevOps", null); - long projectId1 = insertProject("PROJECT_1"); - insertProperty("sonar.pullrequest.provider", "Azure DevOps", projectId1); - insertProperty("sonar.pullrequest.vsts.token.secured", "100", projectId1); - underTest.execute(); - - long projectId2 = insertProject("PROJECT_2"); - insertProperty("sonar.pullrequest.provider", "Azure DevOps", projectId2); - insertProperty("sonar.pullrequest.vsts.token.secured", "200", projectId2); - underTest.execute(); - - assertAlmSettings( - tuple("azure_devops", "Azure DevOps", "100", NOW, NOW), - tuple("azure_devops", "Azure DevOps 2", "200", NOW, NOW)); - assertProjectAlmSettings( - tuple("PROJECT_1", selectAlmSettingUuid("Azure DevOps"), NOW, NOW), - tuple("PROJECT_2", selectAlmSettingUuid("Azure DevOps 2"), NOW, NOW)); - assertProperties( - tuple("sonar.pullrequest.provider", "Azure DevOps", null), - tuple("sonar.pullrequest.provider", "Azure DevOps", projectId1), - tuple("sonar.pullrequest.provider", "Azure DevOps", projectId2)); - } - - private void assertAlmSettings(Tuple... expectedTuples) { - assertThat(db.select("SELECT alm_id, kee, pat, created_at, updated_at FROM alm_settings") - .stream() - .map(map -> new Tuple(map.get("ALM_ID"), map.get("KEE"), map.get("PAT"), map.get("CREATED_AT"), - map.get("UPDATED_AT"))) - .collect(toList())) - .containsExactlyInAnyOrder(expectedTuples); - } - - private void assertNoAlmSettings() { - assertAlmSettings(); - } - - private void assertProjectAlmSettings(Tuple... expectedTuples) { - assertThat(db.select("SELECT project_uuid, alm_setting_uuid, created_at, updated_at FROM project_alm_settings") - .stream() - .map(map -> new Tuple(map.get("PROJECT_UUID"), map.get("ALM_SETTING_UUID"), map.get("CREATED_AT"), map.get("UPDATED_AT"))) - .collect(toList())) - .containsExactlyInAnyOrder(expectedTuples); - } - - private void assertNoProjectAlmSettings() { - assertProjectAlmSettings(); - } - - private void assertProperties(Tuple... expectedTuples) { - assertThat(db.select("SELECT prop_key, text_value, resource_id FROM properties") - .stream() - .map(map -> new Tuple(map.get("PROP_KEY"), map.get("TEXT_VALUE"), map.get("RESOURCE_ID"))) - .collect(toSet())) - .containsExactlyInAnyOrder(expectedTuples); - } - - private void assertNoProperties() { - assertProperties(); - } - - private String selectAlmSettingUuid(String almSettingKey) { - return (String) db.selectFirst("select uuid from alm_settings where kee='" + almSettingKey + "'").get("UUID"); - } - - private void insertProperty(String key, String value, @Nullable Long projectId) { - db.executeInsert( - "PROPERTIES", - "PROP_KEY", key, - "RESOURCE_ID", projectId, - "USER_ID", null, - "IS_EMPTY", false, - "TEXT_VALUE", value, - "CLOB_VALUE", null, - "CREATED_AT", System2.INSTANCE.now()); - } - - private long insertProject(String uuid) { - int id = nextInt(); - db.executeInsert("PROJECTS", - "ID", id, - "ORGANIZATION_UUID", "default", - "KEE", uuid + "-key", - "UUID", uuid, - "PROJECT_UUID", uuid, - "MAIN_BRANCH_PROJECT_UUID", null, - "UUID_PATH", ".", - "ROOT_UUID", uuid, - "PRIVATE", Boolean.toString(false), - "SCOPE", "PRJ", - "QUALIFIER", "TRK"); - return id; - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v81/MigrateBitbucketAlmSettingsTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v81/MigrateBitbucketAlmSettingsTest.java deleted file mode 100644 index 5e3dedbfe7b..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v81/MigrateBitbucketAlmSettingsTest.java +++ /dev/null @@ -1,309 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v81; - -import java.sql.SQLException; -import javax.annotation.Nullable; -import org.assertj.core.groups.Tuple; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; -import org.sonar.api.impl.utils.TestSystem2; -import org.sonar.api.utils.System2; -import org.sonar.core.util.UuidFactory; -import org.sonar.core.util.UuidFactoryFast; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DataChange; - -import static java.util.stream.Collectors.toList; -import static java.util.stream.Collectors.toSet; -import static org.apache.commons.lang.math.RandomUtils.nextInt; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.tuple; - -public class MigrateBitbucketAlmSettingsTest { - - private final static long PAST = 10_000_000_000L; - private static final long NOW = 50_000_000_000L; - private System2 system2 = new TestSystem2().setNow(NOW); - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(MigrateBitbucketAlmSettingsTest.class, "schema.sql"); - @Rule - public ExpectedException expectedException = ExpectedException.none(); - - private UuidFactory uuidFactory = UuidFactoryFast.getInstance(); - - private DataChange underTest = new MigrateBitbucketAlmSettings(db.database(), uuidFactory, system2); - - @Test - public void migrate_settings_when_global_provider_is_set_to_bitbucket() throws SQLException { - insertProperty("sonar.pullrequest.provider", "Bitbucket Server", null); - insertProperty("sonar.pullrequest.bitbucketserver.serverUrl", "https://enterprise.com", null); - insertProperty("sonar.pullrequest.bitbucketserver.token.secured", "12345", null); - long projectId1 = insertProject("PROJECT_1"); - insertProperty("sonar.pullrequest.bitbucketserver.project", "Repository1", projectId1); - insertProperty("sonar.pullrequest.bitbucketserver.repository", "Slug1", projectId1); - long projectId2 = insertProject("PROJECT_2"); - insertProperty("sonar.pullrequest.bitbucketserver.project", "Repository2", projectId2); - insertProperty("sonar.pullrequest.bitbucketserver.repository", "Slug2", projectId2); - - underTest.execute(); - - assertAlmSettings(tuple("bitbucket", "Bitbucket Server", "https://enterprise.com", "12345", NOW, NOW)); - String almSettingUuid = selectAlmSettingUuid("Bitbucket Server"); - assertProjectAlmSettings( - tuple("PROJECT_1", almSettingUuid, "Repository1", "Slug1", NOW, NOW), - tuple("PROJECT_2", almSettingUuid, "Repository2", "Slug2", NOW, NOW)); - assertProperties(tuple("sonar.pullrequest.provider", "Bitbucket Server", null)); - } - - @Test - public void migrate_settings_when_project_provider_is_set_to_bitbucket_and_global_provider_is_set_to_something_else() throws SQLException { - insertProperty("sonar.pullrequest.provider", "Azure DevOps", null); - insertProperty("sonar.pullrequest.bitbucketserver.serverUrl", "https://enterprise.com", null); - insertProperty("sonar.pullrequest.bitbucketserver.token.secured", "12345", null); - long projectId1 = insertProject("PROJECT_1"); - insertProperty("sonar.pullrequest.provider", "Bitbucket Server", projectId1); - insertProperty("sonar.pullrequest.bitbucketserver.project", "Repository1", projectId1); - insertProperty("sonar.pullrequest.bitbucketserver.repository", "Slug1", projectId1); - long projectId2 = insertProject("PROJECT_2"); - insertProperty("sonar.pullrequest.provider", "Bitbucket Server", projectId2); - insertProperty("sonar.pullrequest.bitbucketserver.project", "Repository2", projectId2); - insertProperty("sonar.pullrequest.bitbucketserver.repository", "Slug2", projectId2); - - underTest.execute(); - - assertAlmSettings(tuple("bitbucket", "Bitbucket Server", "https://enterprise.com", "12345", NOW, NOW)); - String almSettingUuid = selectAlmSettingUuid("Bitbucket Server"); - assertProjectAlmSettings( - tuple("PROJECT_1", almSettingUuid, "Repository1", "Slug1", NOW, NOW), - tuple("PROJECT_2", almSettingUuid, "Repository2", "Slug2", NOW, NOW)); - assertProperties( - tuple("sonar.pullrequest.provider", "Azure DevOps", null), - tuple("sonar.pullrequest.provider", "Bitbucket Server", projectId1), - tuple("sonar.pullrequest.provider", "Bitbucket Server", projectId2)); - } - - @Test - public void delete_bitbucket_settings_when_project_provider_is_not_set_to_bitbucket() throws SQLException { - insertProperty("sonar.pullrequest.provider", "Bitbucket Server", null); - insertProperty("sonar.pullrequest.bitbucketserver.serverUrl", "https://enterprise.com", null); - insertProperty("sonar.pullrequest.bitbucketserver.token.secured", "12345", null); - long projectId1 = insertProject("PROJECT_1"); - // Project provider is set to something else - insertProperty("sonar.pullrequest.provider", "Azure", projectId1); - insertProperty("sonar.pullrequest.bitbucketserver.project", "Repository1", projectId1); - insertProperty("sonar.pullrequest.bitbucketserver.repository", "Slug1", projectId1); - - underTest.execute(); - - assertNoProjectAlmSettings(); - assertProperties( - tuple("sonar.pullrequest.provider", "Bitbucket Server", null), - tuple("sonar.pullrequest.provider", "Azure", projectId1)); - } - - @Test - public void ignore_none_bitbucket_project_settings() throws SQLException { - insertProperty("sonar.pullrequest.provider", "Bitbucket Server", null); - insertProperty("sonar.pullrequest.bitbucketserver.serverUrl", "https://enterprise.com", null); - insertProperty("sonar.pullrequest.bitbucketserver.token.secured", "12345", null); - long projectId1 = insertProject("PROJECT_1"); - insertProperty("sonar.pullrequest.provider", "Azure", projectId1); - long projectId2 = insertProject("PROJECT_2"); - insertProperty("sonar.pullrequest.provider", "Azure", projectId2); - - underTest.execute(); - - assertAlmSettings(tuple("bitbucket", "Bitbucket Server", "https://enterprise.com", "12345", NOW, NOW)); - assertNoProjectAlmSettings(); - assertProperties( - tuple("sonar.pullrequest.provider", "Bitbucket Server", null), - tuple("sonar.pullrequest.provider", "Azure", projectId1), - tuple("sonar.pullrequest.provider", "Azure", projectId2)); - } - - @Test - public void use_existing_alm_setting() throws SQLException { - db.executeInsert("alm_settings", - "uuid", "ABCD", - "alm_id", "bitbucket", - "kee", "Bitbucket Server", - "url", "https://enterprise.com", - "pat", "12345", - "created_at", PAST, - "updated_at", PAST); - insertProperty("sonar.pullrequest.provider", "Bitbucket Server", null); - insertProperty("sonar.pullrequest.bitbucketserver.serverUrl", "https://enterprise.com", null); - insertProperty("sonar.pullrequest.bitbucketserver.token.secured", "12345", null); - long projectId1 = insertProject("PROJECT_1"); - insertProperty("sonar.pullrequest.bitbucketserver.project", "Repository1", projectId1); - insertProperty("sonar.pullrequest.bitbucketserver.repository", "Slug1", projectId1); - - underTest.execute(); - - assertProjectAlmSettings(tuple("PROJECT_1", "ABCD", "Repository1", "Slug1", NOW, NOW)); - assertProperties(tuple("sonar.pullrequest.provider", "Bitbucket Server", null)); - } - - @Test - public void do_not_create_alm_settings_when_missing_some_global_properties() throws SQLException { - insertProperty("sonar.pullrequest.provider", "Bitbucket Server", null); - insertProperty("sonar.pullrequest.bitbucketserver.serverUrl", "https://enterprise.com", null); - // No token - long projectId1 = insertProject("PROJECT_1"); - insertProperty("sonar.pullrequest.bitbucketserver.project", "Repository1", projectId1); - insertProperty("sonar.pullrequest.bitbucketserver.repository", "Slug1", projectId1); - - underTest.execute(); - - assertNoAlmSettings(); - assertNoProjectAlmSettings(); - assertProperties(tuple("sonar.pullrequest.provider", "Bitbucket Server", null)); - } - - @Test - public void do_not_create_project_alm_settings_when_missing_some_project_properties() throws SQLException { - insertProperty("sonar.pullrequest.provider", "Bitbucket Server", null); - insertProperty("sonar.pullrequest.bitbucketserver.serverUrl", "https://enterprise.com", null); - insertProperty("sonar.pullrequest.bitbucketserver.token.secured", "12345", null); - long projectId1 = insertProject("PROJECT_1"); - // No project - insertProperty("sonar.pullrequest.bitbucketserver.repository", "Slug1", projectId1); - long projectId2 = insertProject("PROJECT_2"); - // No repository - insertProperty("sonar.pullrequest.bitbucketserver.project", "Project1", projectId2); - - underTest.execute(); - - assertAlmSettings(tuple("bitbucket", "Bitbucket Server", "https://enterprise.com", "12345", NOW, NOW)); - assertNoProjectAlmSettings(); - assertProperties(tuple("sonar.pullrequest.provider", "Bitbucket Server", null)); - } - - @Test - public void do_nothing_when_no_alm_properties() throws SQLException { - insertProperty("sonar.other.property", "Something", null); - - underTest.execute(); - - assertNoAlmSettings(); - assertNoProjectAlmSettings(); - assertProperties(tuple("sonar.other.property", "Something", null)); - } - - @Test - public void migration_is_reentrant() throws SQLException { - insertProperty("sonar.pullrequest.provider", "Bitbucket Server", null); - insertProperty("sonar.pullrequest.bitbucketserver.serverUrl", "https://enterprise.com", null); - insertProperty("sonar.pullrequest.bitbucketserver.token.secured", "12345", null); - long projectId1 = insertProject("PROJECT_1"); - insertProperty("sonar.pullrequest.provider", "Bitbucket Server", projectId1); - insertProperty("sonar.pullrequest.bitbucketserver.project", "Repository1", projectId1); - insertProperty("sonar.pullrequest.bitbucketserver.repository", "Slug1", projectId1); - underTest.execute(); - - // Global settings have been removed, let's re-create them - insertProperty("sonar.pullrequest.bitbucketserver.serverUrl", "https://enterprise.com", null); - insertProperty("sonar.pullrequest.bitbucketserver.token.secured", "12345", null); - long projectId2 = insertProject("PROJECT_2"); - insertProperty("sonar.pullrequest.bitbucketserver.project", "Repository2", projectId2); - insertProperty("sonar.pullrequest.bitbucketserver.repository", "Slug2", projectId2); - underTest.execute(); - - assertAlmSettings(tuple("bitbucket", "Bitbucket Server", "https://enterprise.com", "12345", NOW, NOW)); - String almSettingUuid = selectAlmSettingUuid("Bitbucket Server"); - assertProperties( - tuple("sonar.pullrequest.provider", "Bitbucket Server", null), - tuple("sonar.pullrequest.provider", "Bitbucket Server", projectId1)); - } - - private void assertAlmSettings(Tuple... expectedTuples) { - assertThat(db.select("SELECT alm_id, kee, url, pat, created_at, updated_at FROM alm_settings") - .stream() - .map(map -> new Tuple(map.get("ALM_ID"), map.get("KEE"), map.get("URL"), map.get("PAT"), map.get("CREATED_AT"), - map.get("UPDATED_AT"))) - .collect(toList())) - .containsExactlyInAnyOrder(expectedTuples); - } - - private void assertNoAlmSettings() { - assertAlmSettings(); - } - - private void assertProjectAlmSettings(Tuple... expectedTuples) { - assertThat(db.select("SELECT project_uuid, alm_setting_uuid, alm_repo, alm_slug, created_at, updated_at FROM project_alm_settings") - .stream() - .map(map -> new Tuple(map.get("PROJECT_UUID"), map.get("ALM_SETTING_UUID"), map.get("ALM_REPO"), map.get("ALM_SLUG"), map.get("CREATED_AT"), map.get("UPDATED_AT"))) - .collect(toList())) - .containsExactlyInAnyOrder(expectedTuples); - } - - private void assertNoProjectAlmSettings() { - assertProjectAlmSettings(); - } - - private void assertProperties(Tuple... expectedTuples) { - assertThat(db.select("SELECT prop_key, text_value, resource_id FROM properties") - .stream() - .map(map -> new Tuple(map.get("PROP_KEY"), map.get("TEXT_VALUE"), map.get("RESOURCE_ID"))) - .collect(toSet())) - .containsExactlyInAnyOrder(expectedTuples); - } - - private void assertNoProperties() { - assertProperties(); - } - - private String selectAlmSettingUuid(String almSettingKey) { - return (String) db.selectFirst("select uuid from alm_settings where kee='" + almSettingKey + "'").get("UUID"); - } - - private void insertProperty(String key, String value, @Nullable Long projectId) { - db.executeInsert( - "PROPERTIES", - "PROP_KEY", key, - "RESOURCE_ID", projectId, - "USER_ID", null, - "IS_EMPTY", false, - "TEXT_VALUE", value, - "CLOB_VALUE", null, - "CREATED_AT", System2.INSTANCE.now()); - } - - private long insertProject(String uuid) { - int id = nextInt(); - db.executeInsert("PROJECTS", - "ID", id, - "ORGANIZATION_UUID", "default", - "KEE", uuid + "-key", - "UUID", uuid, - "PROJECT_UUID", uuid, - "MAIN_BRANCH_PROJECT_UUID", uuid, - "UUID_PATH", ".", - "ROOT_UUID", uuid, - "PRIVATE", Boolean.toString(false), - "SCOPE", "PRJ", - "QUALIFIER", "PRJ"); - return id; - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v81/MigrateDefaultBranchesToKeepSettingTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v81/MigrateDefaultBranchesToKeepSettingTest.java deleted file mode 100644 index bda17e5abc6..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v81/MigrateDefaultBranchesToKeepSettingTest.java +++ /dev/null @@ -1,165 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v81; - -import java.sql.SQLException; -import java.util.stream.Collectors; -import javax.annotation.Nullable; -import org.assertj.core.groups.Tuple; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; -import org.sonar.api.utils.System2; -import org.sonar.core.util.Uuids; -import org.sonar.db.CoreDbTester; - -import static org.assertj.core.api.Assertions.assertThat; - -public class MigrateDefaultBranchesToKeepSettingTest { - - private static final String PROPS_TABLE = "properties"; - private static final String PATTERN_1 = "(branch|release|llb)-.*"; - private static final String PATTERN_2 = "(branch|llb)-.*"; - private static final String PATTERN_3 = "llb-.*"; - - @Rule - public CoreDbTester dbTester = CoreDbTester.createForSchema(MigrateDefaultBranchesToKeepSettingTest.class, "schema.sql"); - - @Rule - public ExpectedException expectedException = ExpectedException.none(); - - private MigrateDefaultBranchesToKeepSetting underTest = new MigrateDefaultBranchesToKeepSetting(dbTester.database(), System2.INSTANCE); - - @Test - public void migrate_overridden_old_setting() throws SQLException { - setupOverriddenSetting(); - - underTest.execute(); - - verifyMigrationOfOverriddenSetting(); - } - - @Test - public void migration_of_overridden_setting_is_re_entrant() throws SQLException { - setupOverriddenSetting(); - - underTest.execute(); - underTest.execute(); - - verifyMigrationOfOverriddenSetting(); - } - - @Test - public void migrate_default_old_setting_on_fresh_install() throws SQLException { - setupDefaultSetting(); - - underTest.execute(); - - verifyMigrationOfDefaultSetting("master,develop,trunk"); - } - - @Test - public void migrate_default_old_setting_on_existing_install() throws SQLException { - setupDefaultSetting(); - insertProject(); - - underTest.execute(); - - verifyMigrationOfDefaultSetting("master,develop,trunk,branch-.*,release-.*"); - } - - @Test - public void migration_of_default_old_setting_is_re_entrant() throws SQLException { - setupDefaultSetting(); - - underTest.execute(); - underTest.execute(); - - verifyMigrationOfDefaultSetting("master,develop,trunk"); - } - - private void setupOverriddenSetting() { - insertProperty(1, "some.key", "some.value", 1001L); - insertProperty(2, "sonar.branch.longLivedBranches.regex", PATTERN_1, 1001L); - insertProperty(3, "some.other.key", "some.other.value", 1001L); - insertProperty(4, "sonar.branch.longLivedBranches.regex", PATTERN_2, 1002L); - insertProperty(5, "some.other.key", "some.other.value", null); - insertProperty(6, "sonar.branch.longLivedBranches.regex", PATTERN_3, null); - } - - private void setupDefaultSetting() { - insertProperty(1, "some.key", "some.value", 1001L); - insertProperty(3, "some.other.key", "some.other.value", 1001L); - insertProperty(5, "some.other.key", "some.other.value", null); - } - - private void verifyMigrationOfOverriddenSetting() { - assertThat(dbTester.countRowsOfTable(PROPS_TABLE)).isEqualTo(9); - assertThat(dbTester.countSql("select count(*) from " + PROPS_TABLE + " where prop_key = 'sonar.branch.longLivedBranches.regex'")).isEqualTo(3); - assertThat(dbTester.countSql("select count(*) from " + PROPS_TABLE + " where prop_key = 'sonar.dbcleaner.branchesToKeepWhenInactive'")).isEqualTo(3); - assertThat(dbTester.select("select resource_id, text_value from " + PROPS_TABLE + " where prop_key = 'sonar.dbcleaner.branchesToKeepWhenInactive'") - .stream() - .map(e -> new Tuple(e.get("TEXT_VALUE"), e.get("RESOURCE_ID"))) - .collect(Collectors.toList())) - .containsExactlyInAnyOrder( - new Tuple(PATTERN_1, 1001L), - new Tuple(PATTERN_2, 1002L), - new Tuple(PATTERN_3, null)); - } - - private void verifyMigrationOfDefaultSetting(String expectedValue) { - assertThat(dbTester.countRowsOfTable(PROPS_TABLE)).isEqualTo(4); - assertThat(dbTester.countSql("select count(*) from " + PROPS_TABLE + " where prop_key = 'sonar.branch.longLivedBranches.regex'")).isZero(); - assertThat(dbTester.countSql("select count(*) from " + PROPS_TABLE + " where prop_key = 'sonar.dbcleaner.branchesToKeepWhenInactive'")).isEqualTo(1); - assertThat(dbTester.select("select resource_id, text_value from " + PROPS_TABLE + " where prop_key = 'sonar.dbcleaner.branchesToKeepWhenInactive'") - .stream() - .map(e -> new Tuple(e.get("TEXT_VALUE"), e.get("RESOURCE_ID"))) - .collect(Collectors.toList())) - .containsExactly(new Tuple(expectedValue, null)); - } - - private void insertProperty(int id, String key, String value, @Nullable Long resourceId) { - dbTester.executeInsert( - PROPS_TABLE, - "ID", id, - "PROP_KEY", key, - "RESOURCE_ID", resourceId, - "USER_ID", null, - "IS_EMPTY", false, - "TEXT_VALUE", value, - "CLOB_VALUE", null, - "CREATED_AT", System2.INSTANCE.now()); - } - - private void insertProject() { - String uuid = Uuids.createFast(); - dbTester.executeInsert("PROJECTS", - "ORGANIZATION_UUID", "default-org", - "KEE", uuid + "-key", - "UUID", uuid, - "PROJECT_UUID", uuid, - "main_branch_project_uuid", uuid, - "UUID_PATH", ".", - "ROOT_UUID", uuid, - "PRIVATE", "true", - "qualifier", "TRK", - "scope", "PRJ"); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v81/MigrateDeprecatedGithubPrivateKeyToNewKeyTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v81/MigrateDeprecatedGithubPrivateKeyToNewKeyTest.java deleted file mode 100644 index 424e9e35ede..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v81/MigrateDeprecatedGithubPrivateKeyToNewKeyTest.java +++ /dev/null @@ -1,107 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v81; - -import java.sql.SQLException; -import java.util.Base64; -import org.assertj.core.groups.Tuple; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; -import org.sonar.api.utils.System2; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DataChange; - -import static java.util.stream.Collectors.toList; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.tuple; - -public class MigrateDeprecatedGithubPrivateKeyToNewKeyTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(MigrateDeprecatedGithubPrivateKeyToNewKeyTest.class, "schema.sql"); - @Rule - public ExpectedException expectedException = ExpectedException.none(); - - private DataChange underTest = new MigrateDeprecatedGithubPrivateKeyToNewKey(db.database()); - - @Test - public void migrate_and_decode_old_property_to_new_one() throws SQLException { - String privateKey = ""; - insertProperty("sonar.alm.github.app.privateKey.secured", Base64.getEncoder().encodeToString(privateKey.getBytes())); - - underTest.execute(); - - assertProperties(tuple("sonar.alm.github.app.privateKeyContent.secured", privateKey)); - } - - @Test - public void do_nothing_when_only_new_property() throws SQLException { - String privateKey = ""; - insertProperty("sonar.alm.github.app.privateKeyContent.secured", privateKey); - - underTest.execute(); - - assertProperties(tuple("sonar.alm.github.app.privateKeyContent.secured", privateKey)); - } - - @Test - public void remove_old_property_when_both_new_one_and_old_one_exist() throws SQLException { - String privateKey = ""; - insertProperty("sonar.alm.github.app.privateKey.secured", Base64.getEncoder().encodeToString(privateKey.getBytes())); - insertProperty("sonar.alm.github.app.privateKeyContent.secured", privateKey); - - underTest.execute(); - - assertProperties(tuple("sonar.alm.github.app.privateKeyContent.secured", privateKey)); - } - - @Test - public void migration_is_re_entrant() throws SQLException { - String privateKey = ""; - insertProperty("sonar.alm.github.app.privateKey.secured", Base64.getEncoder().encodeToString(privateKey.getBytes())); - - underTest.execute(); - underTest.execute(); - - assertProperties(tuple("sonar.alm.github.app.privateKeyContent.secured", privateKey)); - } - - private void assertProperties(Tuple... tuples) { - assertThat(db.select("SELECT prop_key, text_value FROM properties") - .stream() - .map(map -> new Tuple(map.get("PROP_KEY"), map.get("TEXT_VALUE"))) - .collect(toList())) - .containsExactlyInAnyOrder(tuples); - } - - private void insertProperty(String key, String value) { - db.executeInsert( - "PROPERTIES", - "PROP_KEY", key, - "RESOURCE_ID", null, - "USER_ID", null, - "IS_EMPTY", false, - "TEXT_VALUE", value, - "CLOB_VALUE", null, - "CREATED_AT", System2.INSTANCE.now()); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v81/MigrateGithubAlmSettingsTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v81/MigrateGithubAlmSettingsTest.java deleted file mode 100644 index 309f7312c90..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v81/MigrateGithubAlmSettingsTest.java +++ /dev/null @@ -1,308 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v81; - -import java.sql.SQLException; -import javax.annotation.Nullable; -import org.assertj.core.groups.Tuple; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; -import org.sonar.api.impl.utils.TestSystem2; -import org.sonar.api.utils.System2; -import org.sonar.core.util.UuidFactory; -import org.sonar.core.util.UuidFactoryFast; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DataChange; - -import static java.util.stream.Collectors.toList; -import static java.util.stream.Collectors.toSet; -import static org.apache.commons.lang.math.RandomUtils.nextInt; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.tuple; - -public class MigrateGithubAlmSettingsTest { - - private final static long PAST = 10_000_000_000L; - private static final long NOW = 50_000_000_000L; - private System2 system2 = new TestSystem2().setNow(NOW); - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(MigrateGithubAlmSettingsTest.class, "schema.sql"); - @Rule - public ExpectedException expectedException = ExpectedException.none(); - - private UuidFactory uuidFactory = UuidFactoryFast.getInstance(); - - private DataChange underTest = new MigrateGithubAlmSettings(db.database(), uuidFactory, system2); - - @Test - public void migrate_settings_when_global_provider_is_set_to_github() throws SQLException { - insertProperty("sonar.pullrequest.provider", "GitHub", null); - insertProperty("sonar.pullrequest.github.endpoint", "https://enterprise.github.com", null); - insertProperty("sonar.alm.github.app.id", "12345", null); - insertProperty("sonar.alm.github.app.privateKeyContent.secured", "", null); - long projectId1 = insertProject("PROJECT_1"); - insertProperty("sonar.pullrequest.github.repository", "Repository1", projectId1); - long projectId2 = insertProject("PROJECT_2"); - insertProperty("sonar.pullrequest.github.repository", "Repository2", projectId2); - - underTest.execute(); - - assertAlmSettings(tuple("github", "GitHub", "https://enterprise.github.com", "12345", "", NOW, NOW)); - String gitHubAlmSettingUuid = selectAlmSettingUuid("GitHub"); - assertProjectAlmSettings( - tuple("PROJECT_1", gitHubAlmSettingUuid, "Repository1", NOW, NOW), - tuple("PROJECT_2", gitHubAlmSettingUuid, "Repository2", NOW, NOW)); - assertProperties(tuple("sonar.pullrequest.provider", "GitHub", null)); - } - - @Test - public void migrate_settings_when_project_provider_is_set_to_github_and_global_provider_is_set_to_something_else() throws SQLException { - insertProperty("sonar.pullrequest.provider", "Azure DevOps", null); - insertProperty("sonar.pullrequest.github.endpoint", "https://enterprise.github.com", null); - insertProperty("sonar.alm.github.app.id", "12345", null); - insertProperty("sonar.alm.github.app.privateKeyContent.secured", "", null); - long projectId1 = insertProject("PROJECT_1"); - insertProperty("sonar.pullrequest.provider", "GitHub", projectId1); - insertProperty("sonar.pullrequest.github.repository", "Repository1", projectId1); - long projectId2 = insertProject("PROJECT_2"); - insertProperty("sonar.pullrequest.provider", "GitHub", projectId2); - insertProperty("sonar.pullrequest.github.repository", "Repository2", projectId2); - - underTest.execute(); - - assertAlmSettings(tuple("github", "GitHub", "https://enterprise.github.com", "12345", "", NOW, NOW)); - String gitHubAlmSettingUuid = selectAlmSettingUuid("GitHub"); - assertProjectAlmSettings( - tuple("PROJECT_1", gitHubAlmSettingUuid, "Repository1", NOW, NOW), - tuple("PROJECT_2", gitHubAlmSettingUuid, "Repository2", NOW, NOW)); - assertProperties( - tuple("sonar.pullrequest.provider", "Azure DevOps", null), - tuple("sonar.pullrequest.provider", "GitHub", projectId1), - tuple("sonar.pullrequest.provider", "GitHub", projectId2)); - } - - @Test - public void delete_github_settings_when_project_provider_is_not_set_to_github() throws SQLException { - insertProperty("sonar.pullrequest.provider", "GitHub", null); - insertProperty("sonar.pullrequest.github.endpoint", "https://enterprise.github.com", null); - insertProperty("sonar.alm.github.app.id", "12345", null); - insertProperty("sonar.alm.github.app.privateKeyContent.secured", "", null); - long projectId1 = insertProject("PROJECT_1"); - // Project provider is set to something else - insertProperty("sonar.pullrequest.provider", "Azure", projectId1); - insertProperty("sonar.pullrequest.github.repository", "Repository1", projectId1); - - underTest.execute(); - - assertNoProjectAlmSettings(); - assertProperties( - tuple("sonar.pullrequest.provider", "GitHub", null), - tuple("sonar.pullrequest.provider", "Azure", projectId1)); - } - - @Test - public void use_existing_alm_setting() throws SQLException { - db.executeInsert("alm_settings", - "uuid", "ABCD", - "alm_id", "github", - "kee", "GitHub", - "url", "https://enterprise.github.com", - "app_id", "12345", - "private_key", "", - "created_at", PAST, - "updated_at", PAST); - insertProperty("sonar.pullrequest.provider", "GitHub", null); - insertProperty("sonar.pullrequest.github.endpoint", "https://enterprise.github.com", null); - insertProperty("sonar.alm.github.app.id", "12345", null); - insertProperty("sonar.alm.github.app.privateKeyContent.secured", "", null); - long projectId1 = insertProject("PROJECT_1"); - insertProperty("sonar.pullrequest.github.repository", "Repository1", projectId1); - - underTest.execute(); - - assertProjectAlmSettings(tuple("PROJECT_1", "ABCD", "Repository1", NOW, NOW)); - assertProperties(tuple("sonar.pullrequest.provider", "GitHub", null)); - } - - @Test - public void ignore_none_github_project_settings() throws SQLException { - insertProperty("sonar.pullrequest.provider", "GitHub", null); - insertProperty("sonar.pullrequest.github.endpoint", "https://enterprise.github.com", null); - insertProperty("sonar.alm.github.app.id", "12345", null); - insertProperty("sonar.alm.github.app.privateKeyContent.secured", "", null); - long projectId1 = insertProject("PROJECT_1"); - insertProperty("sonar.pullrequest.provider", "Bitbucket", projectId1); - long projectId2 = insertProject("PROJECT_2"); - insertProperty("sonar.pullrequest.provider", "Bitbucket", projectId2); - - underTest.execute(); - - assertAlmSettings(tuple("github", "GitHub", "https://enterprise.github.com", "12345", "", NOW, NOW)); - assertNoProjectAlmSettings(); - assertProperties( - tuple("sonar.pullrequest.provider", "GitHub", null), - tuple("sonar.pullrequest.provider", "Bitbucket", projectId1), - tuple("sonar.pullrequest.provider", "Bitbucket", projectId2)); - } - - @Test - public void do_not_create_alm_settings_when_missing_some_global_properties() throws SQLException { - insertProperty("sonar.pullrequest.provider", "GitHub", null); - // No endpoint - insertProperty("sonar.alm.github.app.id", "12345", null); - insertProperty("sonar.alm.github.app.privateKeyContent.secured", "", null); - long projectId1 = insertProject("PROJECT_1"); - insertProperty("sonar.pullrequest.github.repository", "Repository1", projectId1); - - underTest.execute(); - - assertNoAlmSettings(); - assertNoProjectAlmSettings(); - assertProperties(tuple("sonar.pullrequest.provider", "GitHub", null)); - } - - @Test - public void do_not_create_project_alm_settings_when_missing_some_project_properties() throws SQLException { - insertProperty("sonar.pullrequest.provider", "GitHub", null); - insertProperty("sonar.pullrequest.github.endpoint", "https://enterprise.github.com", null); - insertProperty("sonar.alm.github.app.id", "12345", null); - insertProperty("sonar.alm.github.app.privateKeyContent.secured", "", null); - long projectId1 = insertProject("PROJECT_1"); - // No repository - insertProperty("sonar.pullrequest.provider", "GitHub", projectId1); - - underTest.execute(); - - assertAlmSettings(tuple("github", "GitHub", "https://enterprise.github.com", "12345", "", NOW, NOW)); - assertNoProjectAlmSettings(); - assertProperties( - tuple("sonar.pullrequest.provider", "GitHub", null), - tuple("sonar.pullrequest.provider", "GitHub", projectId1)); - } - - @Test - public void do_nothing_when_no_alm_properties() throws SQLException { - insertProperty("sonar.other.property", "Something", null); - - underTest.execute(); - - assertNoAlmSettings(); - assertNoProjectAlmSettings(); - assertProperties(tuple("sonar.other.property", "Something", null)); - } - - @Test - public void migration_is_reentrant() throws SQLException { - insertProperty("sonar.pullrequest.provider", "GitHub", null); - insertProperty("sonar.pullrequest.github.endpoint", "https://enterprise.github.com", null); - insertProperty("sonar.alm.github.app.id", "12345", null); - insertProperty("sonar.alm.github.app.privateKeyContent.secured", "", null); - long projectId1 = insertProject("PROJECT_1"); - insertProperty("sonar.pullrequest.provider", "GitHub", projectId1); - insertProperty("sonar.pullrequest.github.repository", "Repository1", projectId1); - underTest.execute(); - - // Global settings have been removed, let's re-create them - insertProperty("sonar.pullrequest.github.endpoint", "https://enterprise.github.com", null); - insertProperty("sonar.alm.github.app.id", "12345", null); - insertProperty("sonar.alm.github.app.privateKeyContent.secured", "", null); - long projectId2 = insertProject("PROJECT_2"); - insertProperty("sonar.pullrequest.github.repository", "Repository2", projectId2); - underTest.execute(); - - assertAlmSettings(tuple("github", "GitHub", "https://enterprise.github.com", "12345", "", NOW, NOW)); - assertProperties( - tuple("sonar.pullrequest.provider", "GitHub", null), - tuple("sonar.pullrequest.provider", "GitHub", projectId1)); - } - - private void assertAlmSettings(Tuple... expectedTuples) { - assertThat(db.select("SELECT alm_id, kee, url, app_id, private_key, created_at, updated_at FROM alm_settings") - .stream() - .map(map -> new Tuple(map.get("ALM_ID"), map.get("KEE"), map.get("URL"), map.get("APP_ID"), map.get("PRIVATE_KEY"), map.get("CREATED_AT"), - map.get("UPDATED_AT"))) - .collect(toList())) - .containsExactlyInAnyOrder(expectedTuples); - } - - private void assertNoAlmSettings() { - assertAlmSettings(); - } - - private void assertProjectAlmSettings(Tuple... expectedTuples) { - assertThat(db.select("SELECT project_uuid, alm_setting_uuid, alm_repo, created_at, updated_at FROM project_alm_settings") - .stream() - .map(map -> new Tuple(map.get("PROJECT_UUID"), map.get("ALM_SETTING_UUID"), map.get("ALM_REPO"), map.get("CREATED_AT"), map.get("UPDATED_AT"))) - .collect(toList())) - .containsExactlyInAnyOrder(expectedTuples); - } - - private void assertNoProjectAlmSettings() { - assertProjectAlmSettings(); - } - - private void assertProperties(Tuple... expectedTuples) { - assertThat(db.select("SELECT prop_key, text_value, resource_id FROM properties") - .stream() - .map(map -> new Tuple(map.get("PROP_KEY"), map.get("TEXT_VALUE"), map.get("RESOURCE_ID"))) - .collect(toSet())) - .containsExactlyInAnyOrder(expectedTuples); - } - - private void assertNoProperties() { - assertProperties(); - } - - private String selectAlmSettingUuid(String almSettingKey) { - return (String) db.selectFirst("select uuid from alm_settings where kee='" + almSettingKey + "'").get("UUID"); - } - - private void insertProperty(String key, String value, @Nullable Long projectId) { - db.executeInsert( - "PROPERTIES", - "PROP_KEY", key, - "RESOURCE_ID", projectId, - "USER_ID", null, - "IS_EMPTY", false, - "TEXT_VALUE", value, - "CLOB_VALUE", null, - "CREATED_AT", System2.INSTANCE.now()); - } - - private long insertProject(String uuid) { - int id = nextInt(); - db.executeInsert("PROJECTS", - "ID", id, - "ORGANIZATION_UUID", "default", - "KEE", uuid + "-key", - "UUID", uuid, - "PROJECT_UUID", uuid, - "MAIN_BRANCH_PROJECT_UUID", uuid, - "UUID_PATH", ".", - "ROOT_UUID", uuid, - "PRIVATE", Boolean.toString(false), - "SCOPE", "PRJ", - "QUALIFIER", "PRJ"); - return id; - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v81/MigrateSlbsAndLlbsToCommonTypeInCeTasksTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v81/MigrateSlbsAndLlbsToCommonTypeInCeTasksTest.java deleted file mode 100644 index 6329d2b2418..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v81/MigrateSlbsAndLlbsToCommonTypeInCeTasksTest.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v81; - -import java.sql.SQLException; -import java.util.stream.Collectors; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; -import org.sonar.db.CoreDbTester; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.sonar.server.platform.db.migration.version.v81.MigrateSlbsAndLlbsToCommonTypeInCeTasks.TABLE; - -public class MigrateSlbsAndLlbsToCommonTypeInCeTasksTest { - - @Rule - public CoreDbTester dbTester = CoreDbTester.createForSchema(MigrateSlbsAndLlbsToCommonTypeInCeTasksTest.class, "schema.sql"); - - @Rule - public ExpectedException expectedException = ExpectedException.none(); - - private MigrateSlbsAndLlbsToCommonTypeInCeTasks underTest = new MigrateSlbsAndLlbsToCommonTypeInCeTasks(dbTester.database()); - - @Before - public void setup() { - insertCeTaskCharacteristic("char-uuid-1", "task-uuid-1", "branchType", "LONG"); - insertCeTaskCharacteristic("char-uuid-2", "task-uuid-1", "branch", "foobar"); - insertCeTaskCharacteristic("char-uuid-3", "task-uuid-1", "someKey", "someValue"); - - insertCeTaskCharacteristic("char-uuid-21", "task-uuid-2", "branchType", "SHORT"); - insertCeTaskCharacteristic("char-uuid-22", "task-uuid-2", "branch", "feature/1"); - insertCeTaskCharacteristic("char-uuid-23", "task-uuid-2", "someKey", "anotherValue"); - - insertCeTaskCharacteristic("char-uuid-31", "task-uuid-3", "pullRequest", "1"); - insertCeTaskCharacteristic("char-uuid-32", "task-uuid-3", "someKey", "yetAnotherValue"); - - assertThat(dbTester.countRowsOfTable(TABLE)).isEqualTo(8); - } - - @Test - public void execute() throws SQLException { - underTest.execute(); - - verifyMigrationResult(); - } - - @Test - public void migration_is_re_entrant() throws SQLException { - underTest.execute(); - underTest.execute(); - - verifyMigrationResult(); - } - - private void verifyMigrationResult() { - assertThat(dbTester.countRowsOfTable(TABLE)).isEqualTo(8); - assertThat(dbTester.countSql("select count(*) from " + TABLE + " where kee = 'branchType' and text_value in ('LONG', 'SHORT')")).isZero(); - assertThat(dbTester.select("select uuid from " + TABLE + " where kee = 'branchType' and text_value = 'BRANCH'") - .stream() - .map(e -> e.get("UUID")) - .collect(Collectors.toSet())).containsExactlyInAnyOrder("char-uuid-1", "char-uuid-21"); - } - - private void insertCeTaskCharacteristic(String uuid, String taskUuid, String key, String value) { - dbTester.executeInsert( - TABLE, - "UUID", uuid, - "TASK_UUID", taskUuid, - "KEE", key, - "TEXT_VALUE", value); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v81/MigrateSlbsAndLlbsToCommonTypeTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v81/MigrateSlbsAndLlbsToCommonTypeTest.java deleted file mode 100644 index ff2a1afceb5..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v81/MigrateSlbsAndLlbsToCommonTypeTest.java +++ /dev/null @@ -1,111 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v81; - -import java.sql.SQLException; -import java.util.stream.Collectors; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; -import org.sonar.api.utils.System2; -import org.sonar.db.CoreDbTester; - -import static org.assertj.core.api.Assertions.assertThat; - -public class MigrateSlbsAndLlbsToCommonTypeTest { - - private static final String BRANCHES_TABLE = "project_branches"; - private static final String MAIN_BRANCH_1 = "825644c3-06b2-44b5-833e-13169a5379ad"; - private static final String MAIN_BRANCH_2 = "47a53ace-0297-4a4e-bcab-07a65e3eeac4"; - private static final String PR_1 = "ad85f2ee-7271-407a-b9f7-b0a80343e001"; - private static final String LLB_1 = "08905714-2bfd-48a6-b19d-7801bc4d1ca4"; - private static final String SLB_1 = "a2020607-4134-45f9-87ea-2cdaa84bf386"; - private static final String PR_2 = "834eba05-e4f7-4214-bfec-c7823e101487"; - private static final String LLB_2 = "fea036fe-e830-4d87-85ee-7aaa21729019"; - private static final String SLB_2 = "20166755-953e-4b8e-8c1d-67d812e42418"; - - @Rule - public CoreDbTester dbTester = CoreDbTester.createForSchema(MigrateSlbsAndLlbsToCommonTypeTest.class, "schema.sql"); - - @Rule - public ExpectedException expectedException = ExpectedException.none(); - - private MigrateSlbsAndLlbsToCommonType underTest = new MigrateSlbsAndLlbsToCommonType(dbTester.database(), System2.INSTANCE); - - @Before - public void setup() { - insertMainBranch(MAIN_BRANCH_1); - insertBranch(MAIN_BRANCH_1, PR_1, "PULL_REQUEST"); - insertBranch(MAIN_BRANCH_1, LLB_1, "LONG"); - insertBranch(MAIN_BRANCH_1, SLB_1, "SHORT"); - - insertMainBranch(MAIN_BRANCH_2); - insertBranch(MAIN_BRANCH_1, PR_2, "PULL_REQUEST"); - insertBranch(MAIN_BRANCH_1, LLB_2, "LONG"); - insertBranch(MAIN_BRANCH_1, SLB_2, "SHORT"); - } - - @Test - public void execute() throws SQLException { - underTest.execute(); - - verifyMigrationResult(); - } - - @Test - public void migration_is_re_entrant() throws SQLException { - underTest.execute(); - underTest.execute(); - - verifyMigrationResult(); - } - - private void verifyMigrationResult() { - assertThat(dbTester.countRowsOfTable(BRANCHES_TABLE)).isEqualTo(8); - assertThat(dbTester.countSql("select count(*) from project_branches where branch_type = 'LONG' or branch_type = 'SHORT'")).isZero(); - assertThat(dbTester.select("select uuid from " + BRANCHES_TABLE + " where branch_type = 'BRANCH'") - .stream() - .map(e -> e.get("UUID")) - .collect(Collectors.toSet())).containsExactlyInAnyOrder(MAIN_BRANCH_1, MAIN_BRANCH_2, SLB_1, SLB_2, LLB_1, LLB_2); - assertThat(dbTester.select("select uuid from " + BRANCHES_TABLE + " where branch_type = 'PULL_REQUEST'") - .stream() - .map(e -> e.get("UUID")) - .collect(Collectors.toSet())).containsExactlyInAnyOrder(PR_1, PR_2); - } - - private void insertBranch(String mainBranchUuid, String uuid, String type) { - dbTester.executeInsert( - BRANCHES_TABLE, - "UUID", uuid, - "PROJECT_UUID", mainBranchUuid, - "KEE", "pb-key-" + uuid, - "KEY_TYPE", "TSR", - "BRANCH_TYPE", type, - "MERGE_BRANCH_UUID", "mb-uuid-" + mainBranchUuid, - "MANUAL_BASELINE_ANALYSIS_UUID", null, - "CREATED_AT", System2.INSTANCE.now(), - "UPDATED_AT", System2.INSTANCE.now()); - } - - private void insertMainBranch(String mainBranchUuid) { - insertBranch(mainBranchUuid, mainBranchUuid, "LONG"); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v81/PopulateExcludeBranchFromPurgeColumnTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v81/PopulateExcludeBranchFromPurgeColumnTest.java deleted file mode 100644 index 5e8cecdda10..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v81/PopulateExcludeBranchFromPurgeColumnTest.java +++ /dev/null @@ -1,109 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v81; - -import java.sql.SQLException; -import java.util.stream.Collectors; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; -import org.sonar.api.utils.System2; -import org.sonar.db.CoreDbTester; - -import static org.assertj.core.api.Assertions.assertThat; - -public class PopulateExcludeBranchFromPurgeColumnTest { - - private static final String TABLE = "PROJECT_BRANCHES"; - - private static final String PROJECT_1_UUID = "1a724f54-c2a4-4d36-b59c-61026f178613"; - private static final String PROJECT_2_UUID = "cc69ccb8-434a-489b-abd6-6a80371f64ff"; - - private static final String MAIN_BRANCH_1 = "8a9789c8-7aee-4aa6-9cb7-407137935ac3"; - private static final String LONG_BRANCH_1 = "69fdfc19-491c-4ed9-bcac-ef04e0f6cdc6"; - private static final String SHORT_BRANCH_1 = "f7a6d247-1790-40f8-8591-a0cc39d05ecb"; - private static final String PR_1 = "d65466bf-271c-4f9f-ac7a-72add44848c0"; - - private static final String MAIN_BRANCH_2 = "cdadf128-7bdb-4589-982d-62445d46ae1b"; - private static final String LONG_BRANCH_2 = "60bf6fa8-3ecc-4ba6-ad8d-991ea7c7f9cb"; - private static final String SHORT_BRANCH_2 = "ce5632ed-462e-4384-98b6-1773a7bbfe53"; - private static final String PR_2 = "5897f7d0-d34f-4558-b9c5-a7eb7a5c4b69"; - - @Rule - public CoreDbTester dbTester = CoreDbTester.createForSchema(PopulateExcludeBranchFromPurgeColumnTest.class, "schema.sql"); - - @Rule - public ExpectedException expectedException = ExpectedException.none(); - - private PopulateExcludeBranchFromPurgeColumn underTest = new PopulateExcludeBranchFromPurgeColumn(dbTester.database(), System2.INSTANCE); - - @Before - public void setup() { - insertBranch(MAIN_BRANCH_1, PROJECT_1_UUID, "master", "BRANCH", "LONG"); - insertBranch(LONG_BRANCH_1, PROJECT_1_UUID, "release-1", "BRANCH", "LONG"); - insertBranch(SHORT_BRANCH_1, PROJECT_1_UUID, "feature/foo", "BRANCH", "SHORT"); - insertBranch(PR_1, PROJECT_1_UUID, "feature/feature-1", "PULL_REQUEST", "PULL_REQUEST"); - - insertBranch(MAIN_BRANCH_2, PROJECT_2_UUID, "trunk", "BRANCH", "LONG"); - insertBranch(LONG_BRANCH_2, PROJECT_2_UUID, "branch-1", "BRANCH", "LONG"); - insertBranch(SHORT_BRANCH_2, PROJECT_2_UUID, "feature/bar", "BRANCH", "SHORT"); - insertBranch(PR_2, PROJECT_2_UUID, "feature/feature-2", "PULL_REQUEST", "PULL_REQUEST"); - } - - @Test - public void execute_migration() throws SQLException { - underTest.execute(); - - verifyMigrationResult(); - } - - @Test - public void migration_is_re_entrant() throws SQLException { - underTest.execute(); - underTest.execute(); - - verifyMigrationResult(); - } - - private void verifyMigrationResult() { - assertThat(dbTester.select("select UUID from " + TABLE + " where EXCLUDE_FROM_PURGE = true") - .stream() - .map(e -> e.get("UUID")) - .collect(Collectors.toList())).containsExactlyInAnyOrder(MAIN_BRANCH_1, LONG_BRANCH_1, MAIN_BRANCH_2, LONG_BRANCH_2); - assertThat(dbTester.select("select UUID from " + TABLE + " where EXCLUDE_FROM_PURGE = false") - .stream() - .map(e -> e.get("UUID")) - .collect(Collectors.toList())).containsExactlyInAnyOrder(SHORT_BRANCH_1, SHORT_BRANCH_2, PR_1, PR_2); - } - - private void insertBranch(String uuid, String projectUuid, String key, String keyType, String branchType) { - dbTester.executeInsert( - TABLE, - "UUID", uuid, - "PROJECT_UUID", projectUuid, - "KEE", key, - "BRANCH_TYPE", branchType, - "KEY_TYPE", keyType, - "MERGE_BRANCH_UUID", null, - "CREATED_AT", System2.INSTANCE.now(), - "UPDATED_AT", System2.INSTANCE.now()); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v81/RemoveLLBRegexSettingTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v81/RemoveLLBRegexSettingTest.java deleted file mode 100644 index 0e0ab5042dd..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v81/RemoveLLBRegexSettingTest.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v81; - -import java.sql.SQLException; -import java.time.Instant; -import javax.annotation.Nullable; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; -import org.sonar.db.CoreDbTester; - -import static java.lang.String.format; -import static org.junit.Assert.assertEquals; - -public class RemoveLLBRegexSettingTest { - - private static final String PROPERTIES_TABLE_NAME = "properties"; - private static final int TOTAL_NUMBER_OF_PROJECT_LEVEL_PROPERTIES = 10; - - @Rule - public CoreDbTester dbTester = CoreDbTester.createForSchema(RemoveLLBRegexSettingTest.class, "schema.sql"); - - @Rule - public ExpectedException expectedException = ExpectedException.none(); - - private RemoveLLBRegexSetting underTest = new RemoveLLBRegexSetting(dbTester.database()); - - @Before - public void setup() { - insertProperty(null, "xyz"); - for (long i = 1; i <= TOTAL_NUMBER_OF_PROJECT_LEVEL_PROPERTIES; i++) { - insertProperty(i, format("xyz-%s", i)); - } - - int propertiesCount = dbTester.countRowsOfTable(PROPERTIES_TABLE_NAME); - assertEquals(TOTAL_NUMBER_OF_PROJECT_LEVEL_PROPERTIES + 1, propertiesCount); - } - - @Test - public void remove_llb_regex_property() throws SQLException { - underTest.execute(); - - verifyResult(); - } - - @Test - public void migration_is_re_entrant() throws SQLException { - underTest.execute(); - underTest.execute(); - - verifyResult(); - } - - private void verifyResult() { - int propertiesCount = dbTester.countRowsOfTable(PROPERTIES_TABLE_NAME); - assertEquals(0, propertiesCount); - } - - private void insertProperty(@Nullable Long projectId, String propertyValue) { - dbTester.executeInsert(PROPERTIES_TABLE_NAME, - "prop_key", "sonar.branch.longLivedBranches.regex", - "resource_id", projectId, - "is_empty", false, - "text_value", propertyValue, - "created_at", Instant.now().toEpochMilli()); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v81/RemoveNewsboxDismissHotspotsPropertyTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v81/RemoveNewsboxDismissHotspotsPropertyTest.java deleted file mode 100644 index ec90307152d..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v81/RemoveNewsboxDismissHotspotsPropertyTest.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v81; - -import java.sql.SQLException; -import java.time.Instant; -import java.util.Random; -import java.util.UUID; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; -import org.sonar.db.CoreDbTester; - -import static java.lang.String.format; -import static org.junit.Assert.assertEquals; - -public class RemoveNewsboxDismissHotspotsPropertyTest { - - private static final String USER_PROPERTIES_TABLE_NAME = "user_properties"; - private static final int TOTAL_NUMBER_OF_HOTSPOTS_DISMISS_USER_PROPERTIES = 10; - - @Rule - public CoreDbTester dbTester = CoreDbTester.createForSchema(RemoveNewsboxDismissHotspotsPropertyTest.class, "schema.sql"); - - @Rule - public ExpectedException expectedException = ExpectedException.none(); - - private Random random = new Random(); - - private RemoveNewsboxDismissHotspotsProperty underTest = new RemoveNewsboxDismissHotspotsProperty(dbTester.database()); - - @Before - public void setup() { - insertUserProperty("some-user-uuid", "some-property", random.nextBoolean()); - - for (int i = 1; i <= TOTAL_NUMBER_OF_HOTSPOTS_DISMISS_USER_PROPERTIES; i++) { - insertUserProperty(format("user-uuid-%s", i), "newsbox.dismiss.hotspots", random.nextBoolean()); - } - - int propertiesCount = dbTester.countRowsOfTable(USER_PROPERTIES_TABLE_NAME); - assertEquals(TOTAL_NUMBER_OF_HOTSPOTS_DISMISS_USER_PROPERTIES + 1, propertiesCount); - } - - @Test - public void remove_newsbox_dismiss_hotspot_property() throws SQLException { - underTest.execute(); - - verifyResult(); - } - - @Test - public void migration_is_re_entrant() throws SQLException { - underTest.execute(); - underTest.execute(); - - verifyResult(); - } - - private void verifyResult() { - int hotspotDismissPropertiesCount = dbTester.countSql("select count(uuid) from user_properties where kee = 'newsbox.dismiss.hotspots'"); - assertEquals(0, hotspotDismissPropertiesCount); - int otherPropertiesCount = dbTester.countSql("select count(uuid) from user_properties where kee != 'newsbox.dismiss.hotspots'"); - assertEquals(1, otherPropertiesCount); - } - - private void insertUserProperty(String userUuid, String key, boolean value) { - dbTester.executeInsert(USER_PROPERTIES_TABLE_NAME, - "uuid", UUID.randomUUID().toString(), - "kee", key, - "user_uuid", userUuid, - "text_value", value, - "created_at", Instant.now().toEpochMilli(), - "updated_at", Instant.now().toEpochMilli()); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v81/RenameDaysBeforeDeletingInactiveSLBSettingTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v81/RenameDaysBeforeDeletingInactiveSLBSettingTest.java deleted file mode 100644 index 1ed2de495fa..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v81/RenameDaysBeforeDeletingInactiveSLBSettingTest.java +++ /dev/null @@ -1,96 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v81; - -import java.sql.SQLException; -import java.time.Instant; -import javax.annotation.Nullable; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; -import org.sonar.db.CoreDbTester; - -import static java.lang.String.format; -import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.Assert.assertEquals; -import static org.sonar.server.platform.db.migration.version.v81.RenameDaysBeforeDeletingInactiveSLBSetting.NEW_PROPERTY_NAME; -import static org.sonar.server.platform.db.migration.version.v81.RenameDaysBeforeDeletingInactiveSLBSetting.OLD_PROPERTY_NAME; -import static org.sonar.server.platform.db.migration.version.v81.RenameDaysBeforeDeletingInactiveSLBSetting.TABLE; - -public class RenameDaysBeforeDeletingInactiveSLBSettingTest { - - private static final int TOTAL_NUMBER_OF_PROJECT_LEVEL_PROPERTIES = 10; - - @Rule - public CoreDbTester dbTester = CoreDbTester.createForSchema(RenameDaysBeforeDeletingInactiveSLBSettingTest.class, "schema.sql"); - - @Rule - public ExpectedException expectedException = ExpectedException.none(); - - private RenameDaysBeforeDeletingInactiveSLBSetting underTest = new RenameDaysBeforeDeletingInactiveSLBSetting(dbTester.database()); - - @Before - public void setup() { - insertProperty(null, OLD_PROPERTY_NAME, "xyz"); - insertProperty(null, "sonar.unrelated.global.property", "xyz"); - for (long i = 1; i <= TOTAL_NUMBER_OF_PROJECT_LEVEL_PROPERTIES; i++) { - insertProperty(i, OLD_PROPERTY_NAME, format("xyz-%s", i)); - insertProperty(i, "sonar.unrelated.project.property", format("xyz-%s", i)); - } - - int propertiesCount = dbTester.countRowsOfTable(TABLE); - assertEquals(2 * TOTAL_NUMBER_OF_PROJECT_LEVEL_PROPERTIES + 2, propertiesCount); - } - - @Test - public void migrates_old_prop_key_to_new_prop_key() throws SQLException { - underTest.execute(); - - verifyResult(); - } - - @Test - public void migration_is_re_entrant() throws SQLException { - underTest.execute(); - underTest.execute(); - - verifyResult(); - } - - private void verifyResult() { - int propertiesCount = dbTester.countRowsOfTable(TABLE); - assertEquals(2 * TOTAL_NUMBER_OF_PROJECT_LEVEL_PROPERTIES + 2, propertiesCount); - - int numberOfPropsWithNewName = dbTester.countSql("select count(*) from " + TABLE + " where prop_key = '" + NEW_PROPERTY_NAME + "'"); - int numberOfPropsWithOldName = dbTester.countSql("select count(*) from " + TABLE + " where prop_key = '" + OLD_PROPERTY_NAME + "'"); - assertThat(numberOfPropsWithNewName).isEqualTo(TOTAL_NUMBER_OF_PROJECT_LEVEL_PROPERTIES + 1); - assertThat(numberOfPropsWithOldName).isZero(); - } - - private void insertProperty(@Nullable Long projectId, String propertyKey, String propertyValue) { - dbTester.executeInsert(TABLE, - "prop_key", propertyKey, - "resource_id", projectId, - "is_empty", false, - "text_value", propertyValue, - "created_at", Instant.now().toEpochMilli()); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v82/AddIndexOnSlugOfProjectAlmSettingsTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v82/AddIndexOnSlugOfProjectAlmSettingsTest.java deleted file mode 100644 index 1c671b3a13f..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v82/AddIndexOnSlugOfProjectAlmSettingsTest.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v82; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; -import org.sonar.db.CoreDbTester; - -public class AddIndexOnSlugOfProjectAlmSettingsTest { - - private static final String TABLE_NAME = "project_alm_settings"; - - @Rule - public CoreDbTester dbTester = CoreDbTester.createForSchema(AddIndexOnSlugOfProjectAlmSettingsTest.class, "schema.sql"); - - @Rule - public ExpectedException expectedException = ExpectedException.none(); - - private AddIndexOnSlugOfProjectAlmSettings underTest = new AddIndexOnSlugOfProjectAlmSettings(dbTester.database()); - - @Test - public void index_has_been_created() throws SQLException { - underTest.execute(); - - dbTester.assertTableExists(TABLE_NAME); - dbTester.assertIndex(TABLE_NAME, "project_alm_settings_slug", "alm_slug"); - - // script should not fail if executed twice - underTest.execute(); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v82/CreateAlmPATsTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v82/CreateAlmPATsTableTest.java deleted file mode 100644 index 57207aea101..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v82/CreateAlmPATsTableTest.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v82; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; -import org.sonar.db.CoreDbTester; - -import static java.sql.Types.BIGINT; -import static java.sql.Types.VARCHAR; - -public class CreateAlmPATsTableTest { - - private static final String TABLE_NAME = "alm_pats"; - - @Rule - public CoreDbTester dbTester = CoreDbTester.createEmpty(); - - @Rule - public ExpectedException expectedException = ExpectedException.none(); - - private CreateAlmPatsTable underTest = new CreateAlmPatsTable(dbTester.database()); - - @Test - public void table_has_been_created() throws SQLException { - underTest.execute(); - - dbTester.assertTableExists(TABLE_NAME); - dbTester.assertPrimaryKey(TABLE_NAME, "pk_alm_pats", "uuid"); - dbTester.assertUniqueIndex(TABLE_NAME, "uniq_alm_pats", "user_uuid", "alm_setting_uuid"); - - dbTester.assertColumnDefinition(TABLE_NAME, "uuid", VARCHAR, 40, false); - dbTester.assertColumnDefinition(TABLE_NAME, "pat", VARCHAR, 2000, false); - dbTester.assertColumnDefinition(TABLE_NAME, "user_uuid", VARCHAR, 256, false); - dbTester.assertColumnDefinition(TABLE_NAME, "alm_setting_uuid", VARCHAR, 40, false); - dbTester.assertColumnDefinition(TABLE_NAME, "updated_at", BIGINT, 20, false); - dbTester.assertColumnDefinition(TABLE_NAME, "created_at", BIGINT, 20, false); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v82/CreateProjectsTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v82/CreateProjectsTableTest.java deleted file mode 100644 index 1c9915dc3d4..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v82/CreateProjectsTableTest.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v82; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; -import org.sonar.db.CoreDbTester; - -import static java.sql.Types.BIGINT; -import static java.sql.Types.BOOLEAN; -import static java.sql.Types.VARCHAR; -import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.UUID_SIZE; - -public class CreateProjectsTableTest { - private static final String TABLE_NAME = "projects"; - - @Rule - public CoreDbTester dbTester = CoreDbTester.createEmpty(); - - @Rule - public ExpectedException expectedException = ExpectedException.none(); - - private CreateProjectsTable underTest = new CreateProjectsTable(dbTester.database()); - - @Test - public void table_has_been_created() throws SQLException { - underTest.execute(); - - dbTester.assertTableExists(TABLE_NAME); - dbTester.assertPrimaryKey(TABLE_NAME, "pk_new_projects", "uuid"); - dbTester.assertUniqueIndex(TABLE_NAME, "uniq_projects_kee", "kee"); - - dbTester.assertColumnDefinition(TABLE_NAME, "uuid", VARCHAR, UUID_SIZE, false); - dbTester.assertColumnDefinition(TABLE_NAME, "kee", VARCHAR, 400, false); - dbTester.assertColumnDefinition(TABLE_NAME, "organization_uuid", VARCHAR, UUID_SIZE, false); - dbTester.assertColumnDefinition(TABLE_NAME, "name", VARCHAR, 2000, true); - dbTester.assertColumnDefinition(TABLE_NAME, "description", VARCHAR, 2000, true); - dbTester.assertColumnDefinition(TABLE_NAME, "private", BOOLEAN, null, false); - dbTester.assertColumnDefinition(TABLE_NAME, "tags", VARCHAR, 500, true); - dbTester.assertColumnDefinition(TABLE_NAME, "created_at", BIGINT, null, true); - dbTester.assertColumnDefinition(TABLE_NAME, "updated_at", BIGINT, null, false); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v82/DbVersion82Test.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v82/DbVersion82Test.java deleted file mode 100644 index 2cd1a41b83e..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v82/DbVersion82Test.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v82; - -import org.junit.Test; -import org.sonar.server.platform.db.migration.version.DbVersion; - -import static org.sonar.server.platform.db.migration.version.DbVersionTestUtils.verifyMigrationCount; -import static org.sonar.server.platform.db.migration.version.DbVersionTestUtils.verifyMinimumMigrationNumber; - -public class DbVersion82Test { - - private DbVersion underTest = new DbVersion82(); - - @Test - public void migrationNumber_starts_at_3200() { - verifyMinimumMigrationNumber(underTest, 3200); - } - - @Test - public void verify_migration_count() { - verifyMigrationCount(underTest, 12); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v82/DeleteQgateConditionsUsingSecurityHotspotMetricsTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v82/DeleteQgateConditionsUsingSecurityHotspotMetricsTest.java deleted file mode 100644 index 391d458f15b..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v82/DeleteQgateConditionsUsingSecurityHotspotMetricsTest.java +++ /dev/null @@ -1,119 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v82; - -import com.google.common.collect.ImmutableMap; -import java.sql.SQLException; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import org.apache.commons.lang.math.RandomUtils; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DataChange; - -import static com.google.common.primitives.Longs.asList; -import static java.lang.String.format; -import static java.util.Collections.singletonList; -import static java.util.stream.Collectors.toList; -import static org.assertj.core.api.Assertions.assertThat; - -public class DeleteQgateConditionsUsingSecurityHotspotMetricsTest { - - private static final String TABLE_QUALITY_GATE_CONDITIONS = "quality_gate_conditions"; - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DeleteQgateConditionsUsingSecurityHotspotMetricsTest.class, "schema.sql"); - - private DataChange underTest = new DeleteQgateConditionsUsingSecurityHotspotMetrics(db.database()); - - @Test - public void remove_conditions_on_security_hotspots() throws SQLException { - long securityHotspotsMetric = insertMetric("security_hotspots"); - insertQualityGateCondition(securityHotspotsMetric); - long newSecurityHotspotsMetric = insertMetric("new_security_hotspots"); - insertQualityGateCondition(newSecurityHotspotsMetric); - long nclocMetric = insertMetric("ncloc"); - long conditionOnNcloc = insertQualityGateCondition(nclocMetric); - - underTest.execute(); - - verifyConditionIds(singletonList(conditionOnNcloc)); - } - - @Test - public void do_not_remove_any_condition_when_no_security_hotspot_metrics() throws SQLException { - long nclocMetric = insertMetric("ncloc"); - long conditionOnNcloc = insertQualityGateCondition(nclocMetric); - long issuesMetric = insertMetric("issues"); - long conditionOnIssues = insertQualityGateCondition(issuesMetric); - - underTest.execute(); - - verifyConditionIds(asList(conditionOnNcloc, conditionOnIssues)); - } - - @Test - public void do_nothing_when_no_condition() throws SQLException { - underTest.execute(); - - assertThat(db.countRowsOfTable(TABLE_QUALITY_GATE_CONDITIONS)).isZero(); - } - - @Test - public void migration_is_reentrant() throws SQLException { - long securityHotspotsMetric = insertMetric("security_hotspots"); - insertQualityGateCondition(securityHotspotsMetric); - long newSecurityHotspotsMetric = insertMetric("new_security_hotspots"); - insertQualityGateCondition(newSecurityHotspotsMetric); - long otherMetric = insertMetric("ncloc"); - long conditionOnOtherMetric = insertQualityGateCondition(otherMetric); - - underTest.execute(); - underTest.execute(); - - verifyConditionIds(asList(conditionOnOtherMetric)); - } - - private void verifyConditionIds(List expectedConditionIds) { - List> results = db.select("select ID from " + TABLE_QUALITY_GATE_CONDITIONS); - assertThat(results.stream() - .map(map -> (long) map.get("ID")) - .collect(toList())) - .containsExactlyInAnyOrderElementsOf(expectedConditionIds); - } - - private long insertQualityGateCondition(long metricId) { - long qualityGateId = RandomUtils.nextInt(); - Map values = new HashMap<>(ImmutableMap.of("QGATE_ID", qualityGateId, "METRIC_ID", metricId, "OPERATOR", "GT")); - values.put("VALUE_ERROR", RandomUtils.nextInt()); - db.executeInsert(TABLE_QUALITY_GATE_CONDITIONS, values); - String sql = format("select id as \"id\" from %s where qgate_id='%s' and metric_id='%s'", TABLE_QUALITY_GATE_CONDITIONS, qualityGateId, metricId); - return (Long) db - .selectFirst(sql) - .get("id"); - } - - private long insertMetric(String key) { - db.executeInsert("metrics", "NAME", key); - return (Long) db.selectFirst(format("select id as \"id\" from metrics where name='%s'", key)).get("id"); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v82/DeleteSecurityReviewRatingLiveMeasuresTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v82/DeleteSecurityReviewRatingLiveMeasuresTest.java deleted file mode 100644 index 3e9e602087d..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v82/DeleteSecurityReviewRatingLiveMeasuresTest.java +++ /dev/null @@ -1,214 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v82; - -import java.sql.SQLException; -import java.util.UUID; -import java.util.stream.Collectors; -import java.util.stream.IntStream; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DataChange; - -import static org.apache.commons.lang.math.RandomUtils.nextInt; -import static org.assertj.core.api.Assertions.assertThat; - -public class DeleteSecurityReviewRatingLiveMeasuresTest { - private static final String LIVE_MEASURES_TABLE_NAME = "LIVE_MEASURES"; - - private static final int SECURITY_REVIEW_RATING_METRIC_ID = 200; - private static final String SECURITY_REVIEW_RATING_METRIC_KEY = "security_review_rating"; - private static final int SECURITY_REVIEW_RATING_EFFORT_METRIC_ID = 201; - private static final String SECURITY_REVIEW_RATING_EFFORT_METRIC_KEY = "security_review_rating_effort"; - - private static final int OTHER_METRIC_ID_1 = 1; - private static final int OTHER_METRIC_ID_2 = 2; - private static final int OTHER_METRIC_MEASURES_COUNT = 20; - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DeleteSecurityReviewRatingLiveMeasuresTest.class, "schema.sql"); - - private final DataChange underTest = new DeleteSecurityReviewRatingLiveMeasures(db.database()); - - @Before - public void before() { - insertMetric(OTHER_METRIC_ID_1, "another metric#1"); - insertMetric(OTHER_METRIC_ID_2, "another metric#2"); - } - - @Test - public void not_fail_if_metrics_not_defined() throws SQLException { - String projectUuid = insertComponent("TRK"); - insertLiveMeasure("uuid-1", SECURITY_REVIEW_RATING_METRIC_ID, projectUuid, projectUuid); - - underTest.execute(); - - assertThat(db.countRowsOfTable(LIVE_MEASURES_TABLE_NAME)).isEqualTo(1); - } - - @Test - public void not_fail_if_security_review_rating_effort_metric_not_found() throws SQLException { - insertMetric(SECURITY_REVIEW_RATING_METRIC_ID, SECURITY_REVIEW_RATING_METRIC_KEY); - - String applicationUuid = insertComponent("TRK"); - - insertLiveMeasure("uuid-1", SECURITY_REVIEW_RATING_METRIC_ID, applicationUuid, applicationUuid); - - generateOtherMetricsLiveMeasures(applicationUuid); - - underTest.execute(); - - assertSecurityReviewRatingLiveMeasuresDeleted(); - - assertThat(db.countRowsOfTable(LIVE_MEASURES_TABLE_NAME)).isEqualTo(OTHER_METRIC_MEASURES_COUNT); - - // should not fail if called twice - underTest.execute(); - } - - @Test - public void remove_security_rating_review_from_live_measures_projects() throws SQLException { - insertMetric(SECURITY_REVIEW_RATING_METRIC_ID, SECURITY_REVIEW_RATING_METRIC_KEY); - insertMetric(SECURITY_REVIEW_RATING_EFFORT_METRIC_ID, SECURITY_REVIEW_RATING_EFFORT_METRIC_KEY); - - String applicationUuid = insertComponent("TRK"); - - insertLiveMeasure("uuid-1", SECURITY_REVIEW_RATING_METRIC_ID, applicationUuid, applicationUuid); - - generateOtherMetricsLiveMeasures(applicationUuid); - - underTest.execute(); - - assertSecurityReviewRatingLiveMeasuresDeleted(); - - assertThat(db.countRowsOfTable(LIVE_MEASURES_TABLE_NAME)).isEqualTo(OTHER_METRIC_MEASURES_COUNT); - - // should not fail if called twice - underTest.execute(); - } - - @Test - public void remove_security_rating_review_from_live_measures_for_portfolios() throws SQLException { - insertMetric(SECURITY_REVIEW_RATING_METRIC_ID, SECURITY_REVIEW_RATING_METRIC_KEY); - insertMetric(SECURITY_REVIEW_RATING_EFFORT_METRIC_ID, SECURITY_REVIEW_RATING_EFFORT_METRIC_KEY); - - String portfolioUuid = insertComponent("VW"); - String subPortfolioUuid = insertComponent("SVW"); - - insertLiveMeasure("uuid-1", SECURITY_REVIEW_RATING_METRIC_ID, portfolioUuid, portfolioUuid); - insertLiveMeasure("uuid-2", SECURITY_REVIEW_RATING_METRIC_ID, subPortfolioUuid, subPortfolioUuid); - - insertLiveMeasure("uuid-3", SECURITY_REVIEW_RATING_EFFORT_METRIC_ID, portfolioUuid, portfolioUuid); - insertLiveMeasure("uuid-4", SECURITY_REVIEW_RATING_EFFORT_METRIC_ID, subPortfolioUuid, subPortfolioUuid); - - generateOtherMetricsLiveMeasures(portfolioUuid); - - underTest.execute(); - - assertSecurityReviewRatingLiveMeasuresDeleted(); - - assertThat(db.countRowsOfTable(LIVE_MEASURES_TABLE_NAME)).isEqualTo(OTHER_METRIC_MEASURES_COUNT); - - // should not fail if called twice - underTest.execute(); - } - - @Test - public void remove_security_rating_review_from_live_measures_applications() throws SQLException { - insertMetric(SECURITY_REVIEW_RATING_METRIC_ID, SECURITY_REVIEW_RATING_METRIC_KEY); - insertMetric(SECURITY_REVIEW_RATING_EFFORT_METRIC_ID, SECURITY_REVIEW_RATING_EFFORT_METRIC_KEY); - - String applicationUuid = insertComponent("APP"); - - insertLiveMeasure("uuid-1", SECURITY_REVIEW_RATING_METRIC_ID, applicationUuid, applicationUuid); - - generateOtherMetricsLiveMeasures(applicationUuid); - - underTest.execute(); - - assertSecurityReviewRatingLiveMeasuresDeleted(); - - assertThat(db.countRowsOfTable(LIVE_MEASURES_TABLE_NAME)).isEqualTo(OTHER_METRIC_MEASURES_COUNT); - - // should not fail if called twice - underTest.execute(); - } - - @Test - public void not_fail_if_empty_tables() throws SQLException { - insertMetric(SECURITY_REVIEW_RATING_METRIC_ID, SECURITY_REVIEW_RATING_METRIC_KEY); - - underTest.execute(); - - assertThat(db.countRowsOfTable(LIVE_MEASURES_TABLE_NAME)).isZero(); - } - - private void generateOtherMetricsLiveMeasures(String componentUuid) { - IntStream.range(0, OTHER_METRIC_MEASURES_COUNT) - .peek(i -> insertLiveMeasure("uuid-other-" + i, i, componentUuid, getRandomUuid())) - .boxed() - .collect(Collectors.toList()); - } - - private void assertSecurityReviewRatingLiveMeasuresDeleted() { - assertThat(db.countSql("select count(uuid) from LIVE_MEASURES where metric_id = " + SECURITY_REVIEW_RATING_METRIC_ID)) - .isZero(); - } - - private String getRandomUuid() { - return UUID.randomUUID().toString(); - } - - private void insertLiveMeasure(String uuid, int metricId, String projectUuid, String componentUuid) { - db.executeInsert("LIVE_MEASURES", - "UUID", uuid, - "PROJECT_UUID", projectUuid, - "COMPONENT_UUID", componentUuid, - "METRIC_ID", metricId, - "CREATED_AT", System.currentTimeMillis(), - "UPDATED_AT", System.currentTimeMillis()); - } - - private void insertMetric(int id, String name) { - db.executeInsert("METRICS", - "ID", id, - "NAME", name, - "DIRECTION", 0, - "QUALITATIVE", true); - } - - private String insertComponent(String qualifier) { - int id = nextInt(); - String uuid = getRandomUuid(); - db.executeInsert("COMPONENTS", - "ID", id, - "UUID", uuid, - "ORGANIZATION_UUID", "default", - "PROJECT_UUID", uuid, - "UUID_PATH", ".", - "ROOT_UUID", uuid, - "PRIVATE", Boolean.toString(false), - "SCOPE", "PRJ", - "QUALIFIER", qualifier); - return uuid; - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v82/DropSecurityHotSpotsInReviewStatusTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v82/DropSecurityHotSpotsInReviewStatusTest.java deleted file mode 100644 index 56367eaf20e..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v82/DropSecurityHotSpotsInReviewStatusTest.java +++ /dev/null @@ -1,116 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v82; - -import java.sql.SQLException; -import java.util.List; -import java.util.Map; -import java.util.function.Function; -import java.util.stream.Collectors; -import java.util.stream.IntStream; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.api.utils.System2; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DataChange; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.sonar.api.issue.Issue.STATUSES; - -public class DropSecurityHotSpotsInReviewStatusTest { - - private final static String ISSUES_TABLE_NAME = "issues"; - private final static int NUMBER_OF_ISSUES_IN_REVIEW = 3; - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DropSecurityHotSpotsInReviewStatusTest.class, "schema.sql"); - - private final System2 system2 = System2.INSTANCE; - - private final DataChange underTest = new DropSecurityHotSpotsInReviewStatus(db.database(), system2); - - @Test - public void should_change_IN_REVIEW_statuses_only() throws SQLException { - - Map statuses = IntStream.range(0, STATUSES.size()) - .boxed() - .collect(Collectors.toMap(Function.identity(), STATUSES::get)); - - statuses.forEach(this::insertIssue); - - int startIndex = STATUSES.size(); - int endIndex = startIndex + NUMBER_OF_ISSUES_IN_REVIEW; - IntStream.range(startIndex, endIndex).forEach(value -> insertIssue(value, "IN_REVIEW")); - - underTest.execute(); - - IntStream.range(startIndex, endIndex).forEach(this::assertIssueChanged); - - statuses.forEach(this::assertIssueNotChanged); - - // should not fail if executed twice - underTest.execute(); - } - - @Test - public void should_not_fail_if_no_issues() throws SQLException { - underTest.execute(); - assertThat(db.countRowsOfTable("issues")).isZero(); - } - - private void assertIssueChanged(int issueId) { - List> row = db.select(String.format("select status from issues where kee = '%s'", "issue-key-" + issueId)); - assertThat(row).hasSize(1); - assertThat(row.get(0)) - .containsEntry("STATUS", "TO_REVIEW"); - - List> changelogRows = db.select(String.format("select change_type, change_data, created_at, updated_at, issue_change_creation_date" + - " from issue_changes where issue_key = '%s'", "issue-key-" + issueId)); - assertThat(changelogRows).hasSize(1); - - Map changelogRow = changelogRows.get(0); - assertThat(changelogRow) - .containsEntry("CHANGE_TYPE", "diff") - .containsEntry("CHANGE_DATA", "status=IN_REVIEW|TO_REVIEW"); - - assertThat(changelogRow.get("CREATED_AT")).isNotNull(); - assertThat(changelogRow.get("UPDATED_AT")).isNotNull(); - assertThat(changelogRow.get("ISSUE_CHANGE_CREATION_DATE")).isNotNull(); - } - - private void assertIssueNotChanged(int issueId, String expectedStatus) { - List> row = db.select(String.format("select status from issues where kee = '%s'", "issue-key-" + issueId)); - assertThat(row).hasSize(1); - assertThat(row.get(0)) - .containsEntry("STATUS", expectedStatus); - - List> changelogRows = db.select(String.format("select change_type, change_data, created_at, updated_at, issue_change_creation_date" + - " from issue_changes where issue_key = '%s'", "issue-key-" + issueId)); - assertThat(changelogRows).isEmpty(); - } - - private void insertIssue(int issueId, String status) { - db.executeInsert(ISSUES_TABLE_NAME, - "kee", "issue-key-" + issueId, - "status", status, - "manual_severity", false); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v82/DropTagsColumnFromComponentsTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v82/DropTagsColumnFromComponentsTableTest.java deleted file mode 100644 index 75be0e05e24..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v82/DropTagsColumnFromComponentsTableTest.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v82; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; -import org.sonar.db.CoreDbTester; - -import static org.sonar.server.platform.db.migration.version.v82.DropTagsColumnFromComponentsTable.COLUMNS_TO_DROP; -import static org.sonar.server.platform.db.migration.version.v82.DropTagsColumnFromComponentsTable.TABLE; - -public class DropTagsColumnFromComponentsTableTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DropTagsColumnFromComponentsTableTest.class, "schema.sql"); - @Rule - public ExpectedException expectedException = ExpectedException.none(); - - private DropTagsColumnFromComponentsTable underTest = new DropTagsColumnFromComponentsTable(db.database()); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - for (String column : COLUMNS_TO_DROP) { - db.assertColumnDoesNotExist(TABLE, column); - } - } - - @Test - public void migration_is_not_re_entrant() throws SQLException { - underTest.execute(); - - for (String column : COLUMNS_TO_DROP) { - db.assertColumnDoesNotExist(TABLE, column); - } - expectedException.expect(IllegalStateException.class); - - underTest.execute(); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v82/EnsureHotspotDefaultStatusIsToReviewTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v82/EnsureHotspotDefaultStatusIsToReviewTest.java deleted file mode 100644 index 7c1de3e3401..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v82/EnsureHotspotDefaultStatusIsToReviewTest.java +++ /dev/null @@ -1,121 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v82; - -import com.tngtech.java.junit.dataprovider.DataProvider; -import com.tngtech.java.junit.dataprovider.DataProviderRunner; -import com.tngtech.java.junit.dataprovider.UseDataProvider; -import java.sql.SQLException; -import java.util.Arrays; -import java.util.Random; -import javax.annotation.Nullable; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; -import org.junit.runner.RunWith; -import org.sonar.api.issue.Issue; -import org.sonar.api.rules.RuleType; -import org.sonar.db.CoreDbTester; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.sonar.api.issue.Issue.STATUS_OPEN; -import static org.sonar.api.issue.Issue.STATUS_TO_REVIEW; -import static org.sonar.api.rules.RuleType.SECURITY_HOTSPOT; - -@RunWith(DataProviderRunner.class) -public class EnsureHotspotDefaultStatusIsToReviewTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(EnsureHotspotDefaultStatusIsToReviewTest.class, "issues.sql"); - @Rule - public ExpectedException expectedException = ExpectedException.none(); - - private Random random = new Random(); - - private EnsureHotspotDefaultStatusIsToReview underTest = new EnsureHotspotDefaultStatusIsToReview(db.database()); - - @Test - public void does_not_fail_if_table_is_empty() throws SQLException { - underTest.execute(); - - assertThat(db.countRowsOfTable("issues")).isZero(); - } - - @Test - public void changes_OPEN_security_hotspot_to_TO_REVIEW_whatever_resolution() throws SQLException { - insertIssue("Kee_none", SECURITY_HOTSPOT, STATUS_OPEN, null); - Issue.RESOLUTIONS.forEach(resolution -> insertIssue("Kee_" + resolution, SECURITY_HOTSPOT, STATUS_OPEN, resolution)); - - underTest.execute(); - - assertThat(db.select("select distinct STATUS from issues").stream().map(t -> t.get("STATUS"))) - .containsExactly(STATUS_TO_REVIEW); - } - - @Test - @UseDataProvider("allStatusesButOpen") - public void changes_non_OPEN_security_hotspot_to_TO_REVIEW_whatever_resolution(String status) throws SQLException { - insertIssue("Kee_none", SECURITY_HOTSPOT, status, null); - Issue.RESOLUTIONS.forEach(resolution -> insertIssue("Kee_" + resolution, SECURITY_HOTSPOT, status, resolution)); - - underTest.execute(); - - assertThat(db.select("select distinct STATUS from issues").stream().map(t -> t.get("STATUS"))) - .containsExactly(status); - } - - @DataProvider - public static Object[][] allStatusesButOpen() { - return Issue.STATUSES.stream() - .filter(t -> !STATUS_OPEN.equals(t)) - .map(t -> new Object[] {t}) - .toArray(Object[][]::new); - } - - @Test - @UseDataProvider("allRuleTypeButHotspot") - public void does_not_change_OPEN_issues_to_TO_REVIEW_whatever_resolution(RuleType ruleType) throws SQLException { - insertIssue("Kee_none", ruleType, STATUS_OPEN, null); - Issue.RESOLUTIONS.forEach(resolution -> insertIssue("Kee_" + resolution, ruleType, STATUS_OPEN, resolution)); - - underTest.execute(); - - assertThat(db.select("select distinct STATUS from issues").stream().map(t -> t.get("STATUS"))) - .containsExactly(STATUS_OPEN); - } - - @DataProvider - public static Object[][] allRuleTypeButHotspot() { - return Arrays.stream(RuleType.values()) - .filter(t -> t != SECURITY_HOTSPOT) - .map(t -> new Object[] {t}) - .toArray(Object[][]::new); - } - - private void insertIssue(String kee, RuleType ruleType, String status, @Nullable String resolution) { - db.executeInsert( - "ISSUES", - "KEE", kee, - "MANUAL_SEVERITY", random.nextBoolean(), - "ISSUE_TYPE", ruleType.getDbConstant(), - "STATUS", status, - "RESOLUTION", resolution); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v82/MigrateManualVulnerabilitiesToSecurityHotSpotsTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v82/MigrateManualVulnerabilitiesToSecurityHotSpotsTest.java deleted file mode 100644 index 678e837ffa6..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v82/MigrateManualVulnerabilitiesToSecurityHotSpotsTest.java +++ /dev/null @@ -1,138 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v82; - -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.Map; -import java.util.Random; -import java.util.stream.Collectors; -import java.util.stream.IntStream; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.api.utils.System2; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DataChange; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.sonar.api.rules.RuleType.BUG; -import static org.sonar.api.rules.RuleType.CODE_SMELL; -import static org.sonar.api.rules.RuleType.SECURITY_HOTSPOT; -import static org.sonar.api.rules.RuleType.VULNERABILITY; - -public class MigrateManualVulnerabilitiesToSecurityHotSpotsTest { - - private final static String ISSUES_TABLE_NAME = "issues"; - private final static int TOTAL_NUMBER_OF_ISSUES = 9; - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(MigrateManualVulnerabilitiesToSecurityHotSpotsTest.class, "schema.sql"); - - private final System2 system2 = System2.INSTANCE; - - private final DataChange underTest = new MigrateManualVulnerabilitiesToSecurityHotSpots(db.database(), system2); - - @Test - public void should_migrate_manual_vulnerabilities_only() throws SQLException { - Random random = new Random(); - List range = IntStream.range(0, TOTAL_NUMBER_OF_ISSUES).boxed() - .collect(Collectors.toCollection(ArrayList::new)); - Collections.shuffle(range); - - insertIssue(range.get(0), CODE_SMELL.getDbConstant(), random.nextBoolean()); - insertIssue(range.get(1), BUG.getDbConstant(), random.nextBoolean()); - insertIssue(range.get(2), VULNERABILITY.getDbConstant(), false); - insertIssue(range.get(3), SECURITY_HOTSPOT.getDbConstant(), random.nextBoolean()); - insertIssue(range.get(4), -1, random.nextBoolean()); - - insertIssue(range.get(5), VULNERABILITY.getDbConstant(), true); - insertIssue(range.get(6), VULNERABILITY.getDbConstant(), true); - insertIssue(range.get(7), VULNERABILITY.getDbConstant(), true); - insertIssue(range.get(8), VULNERABILITY.getDbConstant(), true); - - underTest.execute(); - - assertIssueNotChanged(range.get(0), CODE_SMELL.getDbConstant()); - assertIssueNotChanged(range.get(1), BUG.getDbConstant()); - assertIssueNotChanged(range.get(2), VULNERABILITY.getDbConstant()); - assertIssueNotChanged(range.get(3), SECURITY_HOTSPOT.getDbConstant()); - assertIssueNotChanged(range.get(4), -1); - - assertIssueChanged(range.get(5)); - assertIssueChanged(range.get(6)); - assertIssueChanged(range.get(7)); - assertIssueChanged(range.get(8)); - - // should not fail if executed twice - underTest.execute(); - } - - @Test - public void should_not_fail_if_no_issues() throws SQLException { - underTest.execute(); - assertThat(db.countRowsOfTable("issues")).isZero(); - } - - private void assertIssueChanged(int issueId) { - List> row = db.select(String.format("select status from issues where kee = '%s'", "issue-key-" + issueId)); - assertThat(row).hasSize(1); - assertThat(row.get(0)) - .containsEntry("STATUS", "TO_REVIEW"); - - List> changelogRows = db.select(String.format("select change_type, change_data, created_at, updated_at, issue_change_creation_date" + - " from issue_changes where issue_key = '%s'", "issue-key-" + issueId)); - assertThat(changelogRows).hasSize(1); - - Map changelogRow = changelogRows.get(0); - assertThat(changelogRow) - .containsEntry("CHANGE_TYPE", "diff") - .containsEntry("CHANGE_DATA", "type=VULNERABILITY|SECURITY_HOTSPOT,status=OPEN|TO_REVIEW"); - - assertThat(changelogRow.get("CREATED_AT")).isNotNull(); - assertThat(changelogRow.get("UPDATED_AT")).isNotNull(); - assertThat(changelogRow.get("ISSUE_CHANGE_CREATION_DATE")).isNotNull(); - } - - private void assertIssueNotChanged(int issueId, int expectedType) { - List> row = db.select(String.format("select issue_type, status from issues where kee = '%s'", "issue-key-" + issueId)); - assertThat(row).hasSize(1); - - Map issueData = row.get(0); - assertThat(issueData.get("STATUS")) - .isNull(); - assertThat(issueData) - .containsEntry("ISSUE_TYPE", expectedType); - - List> changelogRows = db.select(String.format("select change_type, change_data, created_at, updated_at, issue_change_creation_date" + - " from issue_changes where issue_key = '%s'", "issue-key-" + issueId)); - assertThat(changelogRows).isEmpty(); - } - - private void insertIssue(int issueId, int issueType, boolean fromHotspot) { - db.executeInsert(ISSUES_TABLE_NAME, - "kee", "issue-key-" + issueId, - "issue_type", issueType, - "from_hotspot", fromHotspot, - "manual_severity", false); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v82/PopulateProjectsTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v82/PopulateProjectsTableTest.java deleted file mode 100644 index 0bdc458992c..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v82/PopulateProjectsTableTest.java +++ /dev/null @@ -1,124 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v82; - -import java.sql.SQLException; -import java.util.Date; -import java.util.stream.Collectors; -import javax.annotation.Nullable; -import org.assertj.core.groups.Tuple; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; -import org.sonar.api.impl.utils.TestSystem2; -import org.sonar.api.utils.System2; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DataChange; - -import static org.apache.commons.lang.math.RandomUtils.nextInt; -import static org.assertj.core.api.Assertions.assertThat; - -public class PopulateProjectsTableTest { - - private static final String TABLE_COMPONENTS = "components"; - private static final String TABLE_PROJECTS = "projects"; - private final static long PAST = 10_000_000_000L; - private static final long NOW = 50_000_000_000L; - private System2 system2 = new TestSystem2().setNow(NOW); - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(PopulateProjectsTableTest.class, "schema.sql"); - @Rule - public ExpectedException expectedException = ExpectedException.none(); - - private DataChange underTest = new PopulateProjectsTable(db.database(), system2); - - @Before - public void setup() { - insertComponent("uuid-1", "PRJ", "TRK", null); - insertComponent("uuid-2", "PRJ", "VW", null); - insertComponent("uuid-3", "PRJ", "SVW", null); - insertComponent("uuid-4", "PRJ", "APP", null); - insertComponent("uuid-5", "PRJ", "TRK", null); - insertComponent("uuid-6", "FIL", "FIL", null); - insertComponent("uuid-5-branch", "PRJ", "TRK", "uuid-5"); - } - - @Test - public void migrate() throws SQLException { - underTest.execute(); - - verifyMigrationResult(); - } - - @Test - public void migration_is_re_entrant() throws SQLException { - underTest.execute(); - underTest.execute(); - - verifyMigrationResult(); - } - - private void verifyMigrationResult() { - assertThat(db.countRowsOfTable(TABLE_COMPONENTS)).isEqualTo(7); - assertThat(db.countRowsOfTable(TABLE_PROJECTS)).isEqualTo(3); - - assertThat(db.select("select UUID, KEE, QUALIFIER, ORGANIZATION_UUID, NAME, DESCRIPTION, PRIVATE, TAGS, CREATED_AT, UPDATED_AT from " + TABLE_PROJECTS) - .stream() - .map(e -> new Tuple( - e.get("UUID"), - e.get("KEE"), - e.get("QUALIFIER"), - e.get("ORGANIZATION_UUID"), - e.get("NAME"), - e.get("DESCRIPTION"), - e.get("PRIVATE"), - e.get("TAGS"), - e.get("CREATED_AT"), - e.get("UPDATED_AT"))) - .collect(Collectors.toList())) - .containsExactlyInAnyOrder( - new Tuple("uuid-1", "uuid-1-key", "TRK", "default", "uuid-1-name", "uuid-1-description", false, "uuid-1-tags", PAST, 50_000_000_000L), - new Tuple("uuid-5", "uuid-5-key", "TRK", "default", "uuid-5-name", "uuid-5-description", false, "uuid-5-tags", PAST, 50_000_000_000L), - new Tuple("uuid-4", "uuid-4-key", "APP", "default", "uuid-4-name", "uuid-4-description", false, "uuid-4-tags", PAST, 50_000_000_000L)); - } - - private void insertComponent(String uuid, String scope, String qualifier, @Nullable String mainBranchProjectUuid) { - int id = nextInt(); - db.executeInsert("COMPONENTS", - "ID", id, - "NAME", uuid + "-name", - "DESCRIPTION", uuid + "-description", - "ORGANIZATION_UUID", "default", - "TAGS", uuid + "-tags", - "CREATED_AT", new Date(PAST), - "KEE", uuid + "-key", - "UUID", uuid, - "PROJECT_UUID", uuid, - "MAIN_BRANCH_PROJECT_UUID", mainBranchProjectUuid, - "UUID_PATH", ".", - "ROOT_UUID", uuid, - "PRIVATE", Boolean.toString(false), - "SCOPE", scope, - "QUALIFIER", qualifier); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v82/RemoveNewsboxDismissHotspotsPropertyTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v82/RemoveNewsboxDismissHotspotsPropertyTest.java deleted file mode 100644 index d952da29c7a..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v82/RemoveNewsboxDismissHotspotsPropertyTest.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v82; - -import java.sql.SQLException; -import java.time.Instant; -import java.util.Random; -import java.util.UUID; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; -import org.sonar.db.CoreDbTester; - -import static java.lang.String.format; -import static org.junit.Assert.assertEquals; - -public class RemoveNewsboxDismissHotspotsPropertyTest { - - private static final String USER_PROPERTIES_TABLE_NAME = "user_properties"; - private static final int TOTAL_NUMBER_OF_HOTSPOTS_DISMISS_USER_PROPERTIES = 10; - - @Rule - public CoreDbTester dbTester = CoreDbTester.createForSchema(RemoveNewsboxDismissHotspotsPropertyTest.class, "schema.sql"); - - @Rule - public ExpectedException expectedException = ExpectedException.none(); - - private Random random = new Random(); - - private RemoveNewsboxDismissHotspotsProperty underTest = new RemoveNewsboxDismissHotspotsProperty(dbTester.database()); - - @Before - public void setup() { - insertUserProperty("some-user-uuid", "some-property", random.nextBoolean()); - - for (int i = 1; i <= TOTAL_NUMBER_OF_HOTSPOTS_DISMISS_USER_PROPERTIES; i++) { - insertUserProperty(format("user-uuid-%s", i), "newsbox.dismiss.hotspots", random.nextBoolean()); - } - - int propertiesCount = dbTester.countRowsOfTable(USER_PROPERTIES_TABLE_NAME); - assertEquals(TOTAL_NUMBER_OF_HOTSPOTS_DISMISS_USER_PROPERTIES + 1, propertiesCount); - } - - @Test - public void remove_newsbox_dismiss_hotspot_property() throws SQLException { - underTest.execute(); - - verifyResult(); - } - - @Test - public void migration_is_re_entrant() throws SQLException { - underTest.execute(); - underTest.execute(); - - verifyResult(); - } - - private void verifyResult() { - int hotspotDismissPropertiesCount = dbTester.countSql("select count(uuid) from user_properties where kee = 'newsbox.dismiss.hotspots'"); - assertEquals(0, hotspotDismissPropertiesCount); - int otherPropertiesCount = dbTester.countSql("select count(uuid) from user_properties where kee != 'newsbox.dismiss.hotspots'"); - assertEquals(1, otherPropertiesCount); - } - - private void insertUserProperty(String userUuid, String key, boolean value) { - dbTester.executeInsert(USER_PROPERTIES_TABLE_NAME, - "uuid", UUID.randomUUID().toString(), - "kee", key, - "user_uuid", userUuid, - "text_value", value, - "created_at", Instant.now().toEpochMilli(), - "updated_at", Instant.now().toEpochMilli()); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v82/RenameProjectsTableToComponentsTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v82/RenameProjectsTableToComponentsTest.java deleted file mode 100644 index 8602186a18b..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v82/RenameProjectsTableToComponentsTest.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v82; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; -import org.sonar.db.CoreDbTester; - -public class RenameProjectsTableToComponentsTest { - private static final String OLD_TABLE_NAME = "projects"; - private static final String NEW_TABLE_NAME = "components"; - - @Rule - public CoreDbTester dbTester = CoreDbTester.createForSchema(RenameProjectsTableToComponentsTest.class, "schema.sql"); - - @Rule - public ExpectedException expectedException = ExpectedException.none(); - - private RenameProjectsTableToComponents underTest = new RenameProjectsTableToComponents(dbTester.database()); - - @Test - public void table_has_been_renamed() throws SQLException { - underTest.execute(); - - dbTester.assertTableDoesNotExist(OLD_TABLE_NAME); - - dbTester.assertTableExists(NEW_TABLE_NAME); - dbTester.assertPrimaryKey(NEW_TABLE_NAME, "pk_projects", "id"); - - dbTester.assertIndex(NEW_TABLE_NAME, "PROJECTS_ORGANIZATION", "organization_uuid"); - dbTester.assertUniqueIndex(NEW_TABLE_NAME, "PROJECTS_KEE", "kee"); - dbTester.assertIndex(NEW_TABLE_NAME, "PROJECTS_ROOT_UUID", "root_uuid"); - dbTester.assertUniqueIndex(NEW_TABLE_NAME, "PROJECTS_UUID", "uuid"); - dbTester.assertIndex(NEW_TABLE_NAME, "PROJECTS_PROJECT_UUID", "project_uuid"); - dbTester.assertIndex(NEW_TABLE_NAME, "PROJECTS_MODULE_UUID", "module_uuid"); - dbTester.assertIndex(NEW_TABLE_NAME, "PROJECTS_QUALIFIER", "qualifier"); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v83/AddSummaryEnabledColumnToAlmSettingsTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v83/AddSummaryEnabledColumnToAlmSettingsTest.java deleted file mode 100644 index 3afab81354c..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v83/AddSummaryEnabledColumnToAlmSettingsTest.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v83; - -import java.sql.SQLException; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.api.utils.System2; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static java.sql.Types.BOOLEAN; -import static org.assertj.core.api.Assertions.assertThat; - -public class AddSummaryEnabledColumnToAlmSettingsTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(AddSummaryEnabledColumnToAlmSettingsTest.class, "schema.sql"); - - private DdlChange underTest = new AddSummaryEnabledColumnToAlmSettings(db.database()); - - @Before - public void setup() { - insertProjectAlmSetting("1"); - insertProjectAlmSetting("2"); - insertProjectAlmSetting("3"); - insertProjectAlmSetting("4"); - insertProjectAlmSetting("5"); - } - - @Test - public void should_add_summary_comment_enabled_column() throws SQLException { - underTest.execute(); - - db.assertColumnDefinition("project_alm_settings", "summary_comment_enabled", BOOLEAN, null, true); - - assertThat(db.countSql("select count(uuid) from project_alm_settings where summary_comment_enabled is null")) - .isEqualTo(5); - } - - private void insertProjectAlmSetting(String uuid) { - db.executeInsert("PROJECT_ALM_SETTINGS", - "UUID", uuid, - "ALM_SETTING_UUID", uuid + "-name", - "PROJECT_UUID", uuid + "-description", - "UPDATED_AT", System2.INSTANCE.now(), - "CREATED_AT", System2.INSTANCE.now()); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v83/DbVersion83Test.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v83/DbVersion83Test.java deleted file mode 100644 index 7305a852b83..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v83/DbVersion83Test.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v83; - -import org.junit.Test; -import org.sonar.server.platform.db.migration.version.DbVersion; - -import static org.sonar.server.platform.db.migration.version.DbVersionTestUtils.verifyMigrationNotEmpty; -import static org.sonar.server.platform.db.migration.version.DbVersionTestUtils.verifyMinimumMigrationNumber; - -public class DbVersion83Test { - - private DbVersion underTest = new DbVersion83(); - - @Test - public void migrationNumber_starts_at_3300() { - verifyMinimumMigrationNumber(underTest, 3300); - } - - @Test - public void verify_migration_count() { - verifyMigrationNotEmpty(underTest); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v83/DropIdFromComponentsTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v83/DropIdFromComponentsTableTest.java deleted file mode 100644 index c34f9cd9986..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v83/DropIdFromComponentsTableTest.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v83; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.sql.DbPrimaryKeyConstraintFinder; -import org.sonar.server.platform.db.migration.sql.DropPrimaryKeySqlGenerator; - -import static java.sql.Types.INTEGER; -import static org.sonar.server.platform.db.migration.version.v83.DropIdFromComponentsTable.COLUMN_NAME; -import static org.sonar.server.platform.db.migration.version.v83.DropIdFromComponentsTable.TABLE_NAME; - -public class DropIdFromComponentsTableTest { - @Rule - public CoreDbTester dbTester = CoreDbTester.createForSchema(DropIdFromComponentsTableTest.class, "schema.sql"); - @Rule - public ExpectedException expectedException = ExpectedException.none(); - - private final DropPrimaryKeySqlGenerator dropPrimaryKeySqlGenerator = new DropPrimaryKeySqlGenerator(dbTester.database(), new DbPrimaryKeyConstraintFinder(dbTester.database())); - private final DropIdFromComponentsTable underTest = new DropIdFromComponentsTable(dbTester.database(), dropPrimaryKeySqlGenerator); - - @Test - public void column_has_been_dropped() throws SQLException { - dbTester.assertColumnDefinition(TABLE_NAME, COLUMN_NAME, INTEGER, null, false); - underTest.execute(); - dbTester.assertColumnDoesNotExist(TABLE_NAME, COLUMN_NAME); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v83/PopulateSummaryCommentEnabledColumnForGitHubTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v83/PopulateSummaryCommentEnabledColumnForGitHubTest.java deleted file mode 100644 index 3d7217bc538..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v83/PopulateSummaryCommentEnabledColumnForGitHubTest.java +++ /dev/null @@ -1,140 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v83; - -import java.sql.SQLException; -import java.util.Objects; -import java.util.stream.Collectors; -import javax.annotation.Nullable; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.api.utils.System2; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DataChange; - -import static org.assertj.core.api.Assertions.assertThat; - -public class PopulateSummaryCommentEnabledColumnForGitHubTest { - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(PopulateSummaryCommentEnabledColumnForGitHubTest.class, "schema.sql"); - - private final System2 system = System2.INSTANCE; - - private final DataChange underTest = new PopulateSummaryCommentEnabledColumnForGitHub(db.database(), system); - - @Test - public void does_not_fail_if_alm_settings_are_empty() throws SQLException { - underTest.execute(); - - assertThat(db.countSql("select count(uuid) from project_alm_settings where summary_comment_enabled is null")) - .isZero(); - - // re-entrant migration - underTest.execute(); - } - - @Test - public void does_not_set_comment_summary_enabled_flag_for_alms_other_than_github() throws SQLException { - insertAlmSetting("alm-bitbucket", "bitbucket"); - insertAlmSetting("alm-azure", "azure"); - insertAlmSetting("alm-gitlab", "gitlab"); - - insertProjectAlmSetting("project-alm-1", "alm-bitbucket"); - insertProjectAlmSetting("project-alm-2", "alm-bitbucket"); - insertProjectAlmSetting("project-alm-3", "alm-azure"); - insertProjectAlmSetting("project-alm-4", "alm-azure"); - insertProjectAlmSetting("project-alm-5", "alm-azure"); - insertProjectAlmSetting("project-alm-6", "alm-gitlab"); - - underTest.execute(); - - verifySummaryColumnForProjectAlmSettings(null, "project-alm-1", "project-alm-2", "project-alm-3", - "project-alm-4", "project-alm-5", "project-alm-6"); - } - - @Test - public void set_comment_summary_enabled_flag_to_true_for_github_alm_only() throws SQLException { - insertAlmSetting("alm-github", "github"); - insertAlmSetting("alm-azure", "azure"); - insertAlmSetting("alm-gitlab", "gitlab"); - - insertProjectAlmSetting("project-alm-1", "alm-bitbucket"); - insertProjectAlmSetting("project-alm-2", "alm-bitbucket"); - insertProjectAlmSetting("project-alm-3", "alm-github"); - insertProjectAlmSetting("project-alm-4", "alm-github"); - insertProjectAlmSetting("project-alm-5", "alm-github"); - insertProjectAlmSetting("project-alm-6", "alm-github"); - insertProjectAlmSetting("project-alm-7", "alm-gitlab"); - - underTest.execute(); - - verifySummaryColumnForProjectAlmSettings(null, "project-alm-1", "project-alm-2", "project-alm-7"); - verifySummaryColumnForProjectAlmSettings(true, "project-alm-3", "project-alm-4", "project-alm-5", "project-alm-6"); - } - - @Test - public void migration_is_reentrant() throws SQLException { - insertAlmSetting("alm-github", "github"); - insertAlmSetting("alm-azure", "azure"); - insertAlmSetting("alm-gitlab", "gitlab"); - - insertProjectAlmSetting("project-alm-1", "alm-bitbucket"); - insertProjectAlmSetting("project-alm-2", "alm-github"); - - underTest.execute(); - // re-entrant - underTest.execute(); - - verifySummaryColumnForProjectAlmSettings(null, "project-alm-1"); - verifySummaryColumnForProjectAlmSettings(true, "project-alm-2"); - } - - private void verifySummaryColumnForProjectAlmSettings(@Nullable Boolean expectedSummarColumnValue, String... projectUuids) { - assertThat(db.select("select uuid, summary_comment_enabled from project_alm_settings") - .stream() - .filter(rowColumns -> Objects.equals(expectedSummarColumnValue, getBooleanValue(rowColumns.get("SUMMARY_COMMENT_ENABLED")))) - .map(row -> row.get("UUID")) - .collect(Collectors.toList())) - .containsExactly(projectUuids); - } - - private Boolean getBooleanValue(@Nullable Object value) { - return value == null ? null : Boolean.parseBoolean(value.toString()); - } - - private void insertProjectAlmSetting(String uuid, String almSettingsUuid) { - db.executeInsert("PROJECT_ALM_SETTINGS", - "UUID", uuid, - "ALM_SETTING_UUID", almSettingsUuid, - "PROJECT_UUID", uuid + "-description", - "UPDATED_AT", system.now(), - "CREATED_AT", system.now()); - } - - private void insertAlmSetting(String uuid, String almId) { - db.executeInsert("ALM_SETTINGS", - "UUID", uuid, - "ALM_ID", almId, - "KEE", uuid + "-key", - "UPDATED_AT", system.now(), - "CREATED_AT", system.now()); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v83/grouproles/AddComponentUuidColumnToGroupRolesTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v83/grouproles/AddComponentUuidColumnToGroupRolesTest.java deleted file mode 100644 index 5343f90048f..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v83/grouproles/AddComponentUuidColumnToGroupRolesTest.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v83.grouproles; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; -import org.sonar.db.CoreDbTester; - -import static java.sql.Types.VARCHAR; - -public class AddComponentUuidColumnToGroupRolesTest { - private static final String TABLE_NAME = "group_roles"; - - @Rule - public CoreDbTester dbTester = CoreDbTester.createForSchema(AddComponentUuidColumnToGroupRolesTest.class, "schema.sql"); - @Rule - public ExpectedException expectedException = ExpectedException.none(); - - private AddComponentUuidColumnToGroupRoles underTest = new AddComponentUuidColumnToGroupRoles(dbTester.database()); - - @Test - public void column_has_been_created() throws SQLException { - underTest.execute(); - dbTester.assertTableExists(TABLE_NAME); - dbTester.assertColumnDefinition(TABLE_NAME, "component_uuid", VARCHAR, 40, true); - dbTester.assertIndex(TABLE_NAME, "group_roles_component_uuid", "component_uuid"); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v83/grouproles/DropResourceIdFromGroupRolesTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v83/grouproles/DropResourceIdFromGroupRolesTableTest.java deleted file mode 100644 index d6ba640f1a1..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v83/grouproles/DropResourceIdFromGroupRolesTableTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v83.grouproles; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; -import org.sonar.db.CoreDbTester; - -import static java.sql.Types.INTEGER; - -public class DropResourceIdFromGroupRolesTableTest { - private static final String TABLE_NAME = "group_roles"; - - @Rule - public CoreDbTester dbTester = CoreDbTester.createForSchema(DropResourceIdFromGroupRolesTableTest.class, "schema.sql"); - @Rule - public ExpectedException expectedException = ExpectedException.none(); - - private DropResourceIdFromGroupRolesTable underTest = new DropResourceIdFromGroupRolesTable(dbTester.database()); - - @Test - public void column_has_been_dropped() throws SQLException { - dbTester.assertColumnDefinition(TABLE_NAME, "resource_id", INTEGER, null, true); - dbTester.assertUniqueIndex(TABLE_NAME, "uniq_group_roles", "organization_uuid", "group_id", "resource_id", "role"); - dbTester.assertIndex(TABLE_NAME, "group_roles_resource", "resource_id"); - - underTest.execute(); - dbTester.assertColumnDoesNotExist(TABLE_NAME, "resource_id"); - dbTester.assertIndexDoesNotExist(TABLE_NAME, "group_roles_resource"); - dbTester.assertUniqueIndex(TABLE_NAME, "uniq_group_roles", "organization_uuid", "group_id", "component_uuid", "role"); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v83/grouproles/MigrateResourceIdToUuidInGroupRolesTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v83/grouproles/MigrateResourceIdToUuidInGroupRolesTest.java deleted file mode 100644 index b0e9037aca2..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v83/grouproles/MigrateResourceIdToUuidInGroupRolesTest.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v83.grouproles; - -import java.sql.SQLException; -import java.util.Date; -import java.util.stream.Collectors; -import javax.annotation.Nullable; -import org.assertj.core.groups.Tuple; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; -import org.sonar.db.CoreDbTester; - -import static org.assertj.core.api.Assertions.assertThat; - -public class MigrateResourceIdToUuidInGroupRolesTest { - private static final String TABLE_NAME = "group_roles"; - - @Rule - public CoreDbTester dbTester = CoreDbTester.createForSchema(MigrateResourceIdToUuidInGroupRolesTest.class, "schema.sql"); - @Rule - public ExpectedException expectedException = ExpectedException.none(); - - private MigrateResourceIdToUuidInGroupRoles underTest = new MigrateResourceIdToUuidInGroupRoles(dbTester.database()); - private int id = 1; - - @Test - public void data_has_been_migrated() throws SQLException { - insertComponent(1, "uuid1"); - insertRole(1); - insertRole(2); - insertRole(null); - - underTest.execute(); - assertThat(dbTester.select("select ID, RESOURCE_ID, COMPONENT_UUID, GROUP_ID from " + TABLE_NAME).stream() - .map(e -> new Tuple(e.get("ID"), e.get("RESOURCE_ID"), e.get("COMPONENT_UUID"), e.get("GROUP_ID"))) - .collect(Collectors.toList())).containsExactlyInAnyOrder( - new Tuple(1L, 1L, "uuid1", 1L), - new Tuple(3L, null, null, 1L)); - - // reentrant - underTest.execute(); - } - - private void insertRole(@Nullable Integer resourceId) { - dbTester.executeInsert(TABLE_NAME, - "id", id++, - "organization_uuid", "org", - "group_id", 1, - "resource_id", resourceId, - "role", "role"); - } - - private void insertComponent(int id, String uuid) { - dbTester.executeInsert("COMPONENTS", - "ID", id, - "NAME", uuid + "-name", - "DESCRIPTION", uuid + "-description", - "ORGANIZATION_UUID", "default", - "CREATED_AT", new Date(1000L), - "KEE", uuid + "-key", - "UUID", uuid, - "PROJECT_UUID", uuid, - "MAIN_BRANCH_PROJECT_UUID", "project_uuid", - "UUID_PATH", ".", - "ROOT_UUID", uuid, - "PRIVATE", Boolean.toString(false), - "SCOPE", "TRK", - "QUALIFIER", "PRJ"); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v83/properties/AddComponentUuidColumnToPropertiesTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v83/properties/AddComponentUuidColumnToPropertiesTest.java deleted file mode 100644 index d8dbfec1107..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v83/properties/AddComponentUuidColumnToPropertiesTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v83.properties; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; -import org.sonar.db.CoreDbTester; - -import static java.sql.Types.VARCHAR; - -public class AddComponentUuidColumnToPropertiesTest { - private static final String TABLE_NAME = "properties"; - - @Rule - public CoreDbTester dbTester = CoreDbTester.createForSchema(AddComponentUuidColumnToPropertiesTest.class, "schema.sql"); - @Rule - public ExpectedException expectedException = ExpectedException.none(); - - private AddComponentUuidColumnToProperties underTest = new AddComponentUuidColumnToProperties(dbTester.database()); - - @Test - public void column_has_been_created() throws SQLException { - underTest.execute(); - dbTester.assertTableExists(TABLE_NAME); - dbTester.assertColumnDefinition(TABLE_NAME, "component_uuid", VARCHAR, 40, true); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v83/properties/DropResourceIdFromPropertiesTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v83/properties/DropResourceIdFromPropertiesTableTest.java deleted file mode 100644 index df6f25a6c23..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v83/properties/DropResourceIdFromPropertiesTableTest.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v83.properties; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; -import org.sonar.db.CoreDbTester; - -import static java.sql.Types.BIGINT; - -public class DropResourceIdFromPropertiesTableTest { - private static final String TABLE_NAME = "properties"; - - @Rule - public CoreDbTester dbTester = CoreDbTester.createForSchema(DropResourceIdFromPropertiesTableTest.class, "schema.sql"); - @Rule - public ExpectedException expectedException = ExpectedException.none(); - - private DropResourceIdFromPropertiesTable underTest = new DropResourceIdFromPropertiesTable(dbTester.database()); - - @Test - public void column_has_been_dropped() throws SQLException { - dbTester.assertColumnDefinition(TABLE_NAME, "resource_id", BIGINT, null, true); - underTest.execute(); - dbTester.assertColumnDoesNotExist(TABLE_NAME, "resource_id"); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v83/properties/MigrateResourceIdToUuidInPropertiesTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v83/properties/MigrateResourceIdToUuidInPropertiesTest.java deleted file mode 100644 index 63216816e25..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v83/properties/MigrateResourceIdToUuidInPropertiesTest.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v83.properties; - -import java.sql.SQLException; -import java.util.Date; -import java.util.stream.Collectors; -import javax.annotation.Nullable; -import org.assertj.core.groups.Tuple; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; -import org.sonar.db.CoreDbTester; - -import static org.assertj.core.api.Assertions.assertThat; - -public class MigrateResourceIdToUuidInPropertiesTest { - private static final String TABLE_NAME = "properties"; - - @Rule - public CoreDbTester dbTester = CoreDbTester.createForSchema(MigrateResourceIdToUuidInPropertiesTest.class, "schema.sql"); - @Rule - public ExpectedException expectedException = ExpectedException.none(); - - private MigrateResourceIdToUuidInProperties underTest = new MigrateResourceIdToUuidInProperties(dbTester.database()); - private int id = 1; - - @Test - public void data_has_been_migrated() throws SQLException { - insertComponent(1, "uuid1"); - insertProperty(1); - insertProperty(2); - insertProperty(null); - - underTest.execute(); - assertThat(dbTester.select("select ID, RESOURCE_ID, COMPONENT_UUID, PROP_KEY, TEXT_VALUE from " + TABLE_NAME).stream() - .map(e -> new Tuple(e.get("ID"), e.get("RESOURCE_ID"), e.get("COMPONENT_UUID"), e.get("PROP_KEY"), e.get("TEXT_VALUE"))) - .collect(Collectors.toList())).containsExactlyInAnyOrder( - new Tuple(1L, 1L, "uuid1", "key", "value"), - new Tuple(3L, null, null, "key", "value")); - - // reentrant - underTest.execute(); - } - - private void insertProperty(@Nullable Integer resourceId) { - dbTester.executeInsert(TABLE_NAME, - "id", id++, - "prop_key", "key", - "resource_id", resourceId, - "is_empty", false, - "text_value", "value", - "created_at", 1000L); - } - - private void insertComponent(int id, String uuid) { - dbTester.executeInsert("COMPONENTS", - "ID", id, - "NAME", uuid + "-name", - "DESCRIPTION", uuid + "-description", - "ORGANIZATION_UUID", "default", - "CREATED_AT", new Date(1000L), - "KEE", uuid + "-key", - "UUID", uuid, - "PROJECT_UUID", uuid, - "MAIN_BRANCH_PROJECT_UUID", "project_uuid", - "UUID_PATH", ".", - "ROOT_UUID", uuid, - "PRIVATE", Boolean.toString(false), - "SCOPE", "TRK", - "QUALIFIER", "PRJ"); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v83/userroles/AddComponentUuidColumnToUserRolesTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v83/userroles/AddComponentUuidColumnToUserRolesTest.java deleted file mode 100644 index 6d0722f0527..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v83/userroles/AddComponentUuidColumnToUserRolesTest.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v83.userroles; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; -import org.sonar.db.CoreDbTester; - -import static java.sql.Types.VARCHAR; - -public class AddComponentUuidColumnToUserRolesTest { - private static final String TABLE_NAME = "user_roles"; - - @Rule - public CoreDbTester dbTester = CoreDbTester.createForSchema(AddComponentUuidColumnToUserRolesTest.class, "schema.sql"); - @Rule - public ExpectedException expectedException = ExpectedException.none(); - - private AddComponentUuidColumnToUserRoles underTest = new AddComponentUuidColumnToUserRoles(dbTester.database()); - - @Test - public void column_has_been_created() throws SQLException { - underTest.execute(); - dbTester.assertTableExists(TABLE_NAME); - dbTester.assertColumnDefinition(TABLE_NAME, "component_uuid", VARCHAR, 40, true); - dbTester.assertIndex(TABLE_NAME, "user_roles_component_uuid", "component_uuid"); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v83/userroles/DropResourceIdFromUserRolesTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v83/userroles/DropResourceIdFromUserRolesTableTest.java deleted file mode 100644 index eff5695ecd1..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v83/userroles/DropResourceIdFromUserRolesTableTest.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v83.userroles; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; -import org.sonar.db.CoreDbTester; - -import static java.sql.Types.INTEGER; - -public class DropResourceIdFromUserRolesTableTest { - private static final String TABLE_NAME = "user_roles"; - - @Rule - public CoreDbTester dbTester = CoreDbTester.createForSchema(DropResourceIdFromUserRolesTableTest.class, "schema.sql"); - @Rule - public ExpectedException expectedException = ExpectedException.none(); - - private DropResourceIdFromUserRolesTable underTest = new DropResourceIdFromUserRolesTable(dbTester.database()); - - @Test - public void column_has_been_dropped() throws SQLException { - dbTester.assertColumnDefinition(TABLE_NAME, "resource_id", INTEGER, null, true); - dbTester.assertIndex(TABLE_NAME, "user_roles_resource", "resource_id"); - - underTest.execute(); - dbTester.assertColumnDoesNotExist(TABLE_NAME, "resource_id"); - dbTester.assertIndexDoesNotExist(TABLE_NAME, "user_roles_resource"); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v83/userroles/MigrateResourceIdToUuidInUserRolesTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v83/userroles/MigrateResourceIdToUuidInUserRolesTest.java deleted file mode 100644 index e2c31bcfee0..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v83/userroles/MigrateResourceIdToUuidInUserRolesTest.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v83.userroles; - -import java.sql.SQLException; -import java.util.Date; -import java.util.stream.Collectors; -import javax.annotation.Nullable; -import org.assertj.core.groups.Tuple; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; -import org.sonar.db.CoreDbTester; - -import static org.assertj.core.api.Assertions.assertThat; - -public class MigrateResourceIdToUuidInUserRolesTest { - private static final String TABLE_NAME = "user_roles"; - - @Rule - public CoreDbTester dbTester = CoreDbTester.createForSchema(MigrateResourceIdToUuidInUserRolesTest.class, "schema.sql"); - @Rule - public ExpectedException expectedException = ExpectedException.none(); - - private MigrateResourceIdToUuidInUserRoles underTest = new MigrateResourceIdToUuidInUserRoles(dbTester.database()); - private int id = 1; - - @Test - public void data_has_been_migrated() throws SQLException { - insertComponent(1, "uuid1"); - insertRole(1); - insertRole(2); - insertRole(null); - - underTest.execute(); - assertThat(dbTester.select("select ID, RESOURCE_ID, COMPONENT_UUID, USER_ID from " + TABLE_NAME).stream() - .map(e -> new Tuple(e.get("ID"), e.get("RESOURCE_ID"), e.get("COMPONENT_UUID"), e.get("USER_ID"))) - .collect(Collectors.toList())).containsExactlyInAnyOrder( - new Tuple(1L, 1L, "uuid1", 1L), - new Tuple(3L, null, null, 1L)); - - // reentrant - underTest.execute(); - } - - private void insertRole(@Nullable Integer resourceId) { - dbTester.executeInsert(TABLE_NAME, - "id", id++, - "organization_uuid", "org", - "user_id", 1, - "resource_id", resourceId, - "role", "role"); - } - - private void insertComponent(int id, String uuid) { - dbTester.executeInsert("COMPONENTS", - "ID", id, - "NAME", uuid + "-name", - "DESCRIPTION", uuid + "-description", - "ORGANIZATION_UUID", "default", - "CREATED_AT", new Date(1000L), - "KEE", uuid + "-key", - "UUID", uuid, - "PROJECT_UUID", uuid, - "MAIN_BRANCH_PROJECT_UUID", "project_uuid", - "UUID_PATH", ".", - "ROOT_UUID", uuid, - "PRIVATE", Boolean.toString(false), - "SCOPE", "TRK", - "QUALIFIER", "PRJ"); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/AddProjectBranchesNeedIssueSyncTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/AddProjectBranchesNeedIssueSyncTest.java deleted file mode 100644 index cc5b451ad25..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/AddProjectBranchesNeedIssueSyncTest.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84; - -import java.sql.SQLException; -import java.sql.Types; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.assertj.core.api.Assertions.assertThat; - -public class AddProjectBranchesNeedIssueSyncTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(AddProjectBranchesNeedIssueSyncTest.class, "schema.sql"); - - private DdlChange underTest = new AddProjectBranchesNeedIssueSync(db.database()); - - @Before - public void setup() { - insertProjectBranches("uuid-1"); - insertProjectBranches("uuid-2"); - insertProjectBranches("uuid-3"); - } - - @Test - public void add_need_issue_sync_column_to_project_branches() throws SQLException { - underTest.execute(); - - db.assertColumnDefinition("project_branches", "need_issue_sync", Types.BOOLEAN, null, true); - - assertThat(db.countSql("select count(uuid) from project_branches")) - .isEqualTo(3); - } - - private void insertProjectBranches(String uuid) { - db.executeInsert("project_branches", - "uuid", uuid, - "project_uuid", "name", - "kee", uuid, - "key_type", "KEY_TYPE", - "created_at", System.currentTimeMillis(), - "updated_at", System.currentTimeMillis(), - "exclude_from_purge", false); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/CreateSamlMessageIdsTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/CreateSamlMessageIdsTableTest.java deleted file mode 100644 index 12f2c4cb616..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/CreateSamlMessageIdsTableTest.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; -import org.sonar.db.CoreDbTester; - -import static java.sql.Types.BIGINT; -import static java.sql.Types.VARCHAR; - -public class CreateSamlMessageIdsTableTest { - - private static final String TABLE_NAME = "saml_message_ids"; - - @Rule - public CoreDbTester dbTester = CoreDbTester.createEmpty(); - - @Rule - public ExpectedException expectedException = ExpectedException.none(); - - private CreateSamlMessageIdsTable underTest = new CreateSamlMessageIdsTable(dbTester.database()); - - @Test - public void table_has_been_created() throws SQLException { - underTest.execute(); - - dbTester.assertTableExists(TABLE_NAME); - dbTester.assertPrimaryKey(TABLE_NAME, "pk_saml_message_ids", "uuid"); - dbTester.assertUniqueIndex(TABLE_NAME, "saml_message_ids_unique", "message_id"); - - dbTester.assertColumnDefinition(TABLE_NAME, "uuid", VARCHAR, 40, false); - dbTester.assertColumnDefinition(TABLE_NAME, "message_id", VARCHAR, 255, false); - dbTester.assertColumnDefinition(TABLE_NAME, "expiration_date", BIGINT, 20, false); - dbTester.assertColumnDefinition(TABLE_NAME, "created_at", BIGINT, 20, false); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/CreateSessionTokensTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/CreateSessionTokensTableTest.java deleted file mode 100644 index db53874c35a..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/CreateSessionTokensTableTest.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; -import org.sonar.db.CoreDbTester; - -import static java.sql.Types.BIGINT; -import static java.sql.Types.VARCHAR; - -public class CreateSessionTokensTableTest { - - private static final String TABLE_NAME = "session_tokens"; - - @Rule - public CoreDbTester dbTester = CoreDbTester.createEmpty(); - - @Rule - public ExpectedException expectedException = ExpectedException.none(); - - private CreateSessionTokensTable underTest = new CreateSessionTokensTable(dbTester.database()); - - @Test - public void table_has_been_created() throws SQLException { - underTest.execute(); - - dbTester.assertTableExists(TABLE_NAME); - dbTester.assertPrimaryKey(TABLE_NAME, "pk_session_tokens", "uuid"); - dbTester.assertIndex(TABLE_NAME, "session_tokens_user_uuid", "user_uuid"); - - dbTester.assertColumnDefinition(TABLE_NAME, "uuid", VARCHAR, 40, false); - dbTester.assertColumnDefinition(TABLE_NAME, "user_uuid", VARCHAR, 255, false); - dbTester.assertColumnDefinition(TABLE_NAME, "expiration_date", BIGINT, 20, false); - dbTester.assertColumnDefinition(TABLE_NAME, "updated_at", BIGINT, 20, false); - dbTester.assertColumnDefinition(TABLE_NAME, "created_at", BIGINT, 20, false); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/DbVersion84Test.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/DbVersion84Test.java deleted file mode 100644 index 45043396fa5..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/DbVersion84Test.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84; - -import org.junit.Test; -import org.sonar.server.platform.db.migration.version.DbVersion; - -import static org.sonar.server.platform.db.migration.version.DbVersionTestUtils.verifyMigrationNotEmpty; -import static org.sonar.server.platform.db.migration.version.DbVersionTestUtils.verifyMinimumMigrationNumber; - -public class DbVersion84Test { - - private DbVersion underTest = new DbVersion84(); - - @Test - public void migrationNumber_starts_at_3400() { - verifyMinimumMigrationNumber(underTest, 3400); - } - - @Test - public void verify_migration_count() { - verifyMigrationNotEmpty(underTest); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/MakeProjectBranchesNeedIssueSyncNonNullTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/MakeProjectBranchesNeedIssueSyncNonNullTest.java deleted file mode 100644 index 9beee77bf20..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/MakeProjectBranchesNeedIssueSyncNonNullTest.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -import static java.sql.Types.BOOLEAN; - -public class MakeProjectBranchesNeedIssueSyncNonNullTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(MakeProjectBranchesNeedIssueSyncNonNullTest.class, "schema.sql"); - - private MigrationStep underTest = new MakeProjectBranchesNeedIssueSyncNonNull(db.database()); - - @Test - public void uuid_column_is_not_null() throws SQLException { - underTest.execute(); - - db.assertColumnDefinition("project_branches", "need_issue_sync", BOOLEAN, null, false); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/PopulateProjectBranchesNeedIssueSyncTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/PopulateProjectBranchesNeedIssueSyncTest.java deleted file mode 100644 index 2b11a02ce91..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/PopulateProjectBranchesNeedIssueSyncTest.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DataChange; - -import static org.assertj.core.api.Assertions.assertThat; - -public class PopulateProjectBranchesNeedIssueSyncTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(PopulateProjectBranchesNeedIssueSyncTest.class, "schema.sql"); - - private DataChange underTest = new PopulateProjectBranchesNeedIssueSync(db.database()); - - @Test - public void populate_need_issue_sync() throws SQLException { - insertProjectBranches("uuid-1"); - insertProjectBranches("uuid-2"); - insertProjectBranches("uuid-3"); - - underTest.execute(); - - verifyNeedIssueSyncIsNotNull(); - } - - @Test - public void migration_is_reentrant() throws SQLException { - insertProjectBranches("uuid-1"); - insertProjectBranches("uuid-2"); - insertProjectBranches("uuid-3"); - - underTest.execute(); - // re-entrant - underTest.execute(); - - verifyNeedIssueSyncIsNotNull(); - } - - private void verifyNeedIssueSyncIsNotNull() { - assertThat(db.select("select need_issue_sync from project_branches where need_issue_sync is null")).isEmpty(); - } - - private void insertProjectBranches(String uuid) { - db.executeInsert("project_branches", - "uuid", uuid, - "project_uuid", "name", - "kee", uuid, - "key_type", "KEY_TYPE", - "created_at", System.currentTimeMillis(), - "updated_at", System.currentTimeMillis(), - "exclude_from_purge", false); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/RemoveFilesFavouritesFromPropertiesTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/RemoveFilesFavouritesFromPropertiesTest.java deleted file mode 100644 index 26074f4ccb3..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/RemoveFilesFavouritesFromPropertiesTest.java +++ /dev/null @@ -1,147 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84; - -import java.sql.SQLException; -import java.time.Instant; -import javax.annotation.Nullable; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.core.util.Uuids; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DataChange; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.sonar.api.resources.Qualifiers.APP; -import static org.sonar.api.resources.Qualifiers.DIRECTORY; -import static org.sonar.api.resources.Qualifiers.FILE; -import static org.sonar.api.resources.Qualifiers.PROJECT; -import static org.sonar.api.resources.Qualifiers.UNIT_TEST_FILE; - -public class RemoveFilesFavouritesFromPropertiesTest { - - private static final String PROPERTIES_TABLE_NAME = "properties"; - - @Rule - public CoreDbTester dbTester = CoreDbTester.createForSchema(RemoveFilesFavouritesFromPropertiesTest.class, "schema.sql"); - - private final DataChange underTest = new RemoveFilesFavouritesFromProperties(dbTester.database()); - - private static final String APPLICATION_UUID_1 = Uuids.createFast(); - private static final String PROJECT_UUID_2 = Uuids.createFast(); - private static final String FILE_UUID_3 = Uuids.createFast(); - private static final String DIRECTORY_UUID_4 = Uuids.createFast(); - private static final String UNIT_TEST_FILE_UUID_5 = Uuids.createFast(); - - private static final String USER_UUID_1 = "1"; - private static final String USER_UUID_2 = "2"; - - @Before - public void setup() { - insertComponent(APPLICATION_UUID_1, APP); - insertComponent(PROJECT_UUID_2, PROJECT); - insertComponent(FILE_UUID_3, FILE); - insertComponent(DIRECTORY_UUID_4, DIRECTORY); - insertComponent(UNIT_TEST_FILE_UUID_5, UNIT_TEST_FILE); - - insertProperty("1", USER_UUID_1, APPLICATION_UUID_1, "test"); - insertProperty("2", USER_UUID_2, PROJECT_UUID_2, "test2"); - insertProperty("3", USER_UUID_2, null, "test3"); - } - - @Test - public void migrate() throws SQLException { - insertProperty("4", USER_UUID_1, APPLICATION_UUID_1, "favourite"); - // properties to remove - insertProperty("5", USER_UUID_1, FILE_UUID_3, "favourite"); - insertProperty("6", USER_UUID_2, FILE_UUID_3, "favourite"); - insertProperty("7", USER_UUID_2, DIRECTORY_UUID_4, "favourite"); - insertProperty("8", USER_UUID_2, UNIT_TEST_FILE_UUID_5, "favourite"); - - underTest.execute(); - - assertThat(dbTester.countRowsOfTable(PROPERTIES_TABLE_NAME)).isEqualTo(4); - assertThat(dbTester.select("select uuid from properties").stream().map(columns -> columns.get("UUID"))) - .containsOnly("1", "2", "3", "4"); - } - - @Test - public void properties_table_empty() throws SQLException { - dbTester.executeUpdateSql("delete from properties"); - - underTest.execute(); - - assertThat(dbTester.countRowsOfTable(PROPERTIES_TABLE_NAME)).isZero(); - } - - @Test - public void does_not_remove_properties_with_key_other_than_favourite() throws SQLException { - underTest.execute(); - - assertThat(dbTester.countRowsOfTable(PROPERTIES_TABLE_NAME)).isEqualTo(3L); - } - - @Test - public void migration_is_re_entrant() throws SQLException { - insertProperty("4", USER_UUID_1, APPLICATION_UUID_1, "favourite"); - // properties to remove - insertProperty("5", USER_UUID_1, FILE_UUID_3, "favourite"); - insertProperty("6", USER_UUID_2, FILE_UUID_3, "favourite"); - - underTest.execute(); - - insertProperty("7", USER_UUID_2, DIRECTORY_UUID_4, "favourite"); - insertProperty("8", USER_UUID_2, UNIT_TEST_FILE_UUID_5, "favourite"); - - // re-entrant - underTest.execute(); - - assertThat(dbTester.countRowsOfTable(PROPERTIES_TABLE_NAME)).isEqualTo(4); - assertThat(dbTester.select("select uuid from properties").stream().map(columns -> columns.get("UUID"))) - .containsOnly("1", "2", "3", "4"); - } - - private void insertComponent(String uuid, String qualifier) { - dbTester.executeInsert("COMPONENTS", - "UUID", uuid, - "NAME", uuid + "-name", - "DESCRIPTION", uuid + "-description", - "ORGANIZATION_UUID", "default", - "KEE", uuid + "-key", - "PROJECT_UUID", uuid, - "MAIN_BRANCH_PROJECT_UUID", "project_uuid", - "UUID_PATH", ".", - "ROOT_UUID", uuid, - "PRIVATE", Boolean.toString(false), - "SCOPE", "TRK", - "QUALIFIER", qualifier); - } - - private void insertProperty(String id, String userUuid, @Nullable String componentUuid, String propKey) { - dbTester.executeInsert(PROPERTIES_TABLE_NAME, - "uuid", id, - "user_uuid", userUuid, - "component_uuid", componentUuid, - "prop_key", propKey, - "is_empty", true, - "created_at", Instant.now().toEpochMilli()); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/activeruleparameters/AddPrimaryKeyOnUuidColumnOfActiveRuleParametersTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/activeruleparameters/AddPrimaryKeyOnUuidColumnOfActiveRuleParametersTableTest.java deleted file mode 100644 index f15270d80ae..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/activeruleparameters/AddPrimaryKeyOnUuidColumnOfActiveRuleParametersTableTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.activeruleparameters; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -import static org.assertj.core.api.Assertions.assertThatThrownBy; - -public class AddPrimaryKeyOnUuidColumnOfActiveRuleParametersTableTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(AddPrimaryKeyOnUuidColumnOfActiveRuleParametersTableTest.class, "schema.sql"); - - private MigrationStep underTest = new AddPrimaryKeyOnUuidColumnOfActiveRuleParametersTable(db.database()); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertPrimaryKey("active_rule_parameters", "pk_active_rule_parameters", "uuid"); - } - - @Test - public void migration_is_not_re_entrant() throws SQLException { - underTest.execute(); - - assertThatThrownBy(() -> underTest.execute()).isInstanceOf(IllegalStateException.class); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/activeruleparameters/AddUuidColumnToActiveRuleParametersTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/activeruleparameters/AddUuidColumnToActiveRuleParametersTest.java deleted file mode 100644 index e6a0c8cc41f..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/activeruleparameters/AddUuidColumnToActiveRuleParametersTest.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.activeruleparameters; - -import java.sql.SQLException; -import java.sql.Types; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.assertj.core.api.Assertions.assertThat; - -public class AddUuidColumnToActiveRuleParametersTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(AddUuidColumnToActiveRuleParametersTest.class, "schema.sql"); - - private DdlChange underTest = new AddUuidColumnToActiveRuleParametersTable(db.database()); - - @Before - public void setup() { - insertActiveRuleParameter(1L); - insertActiveRuleParameter(2L); - insertActiveRuleParameter(3L); - } - - @Test - public void add_uuid_column_to_active_rule_parameters() throws SQLException { - underTest.execute(); - - db.assertColumnDefinition("active_rule_parameters", "uuid", Types.VARCHAR, 40, true); - - assertThat(db.countSql("select count(id) from active_rule_parameters")) - .isEqualTo(3); - } - - private void insertActiveRuleParameter(Long id) { - db.executeInsert("active_rule_parameters", - "id", id, - "active_rule_id", id + 2, - "rules_parameter_id", id + 3); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/activeruleparameters/DropIdColumnOfActiveRuleParametersTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/activeruleparameters/DropIdColumnOfActiveRuleParametersTableTest.java deleted file mode 100644 index 38cd164e08c..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/activeruleparameters/DropIdColumnOfActiveRuleParametersTableTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.activeruleparameters; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -import static org.assertj.core.api.Assertions.assertThatThrownBy; - -public class DropIdColumnOfActiveRuleParametersTableTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DropIdColumnOfActiveRuleParametersTableTest.class, "schema.sql"); - - private MigrationStep underTest = new DropIdColumnOfActiveRuleParametersTable(db.database()); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertColumnDoesNotExist("active_rule_parameters", "id"); - } - - @Test - public void migration_is_not_re_entrant() throws SQLException { - underTest.execute(); - - assertThatThrownBy(() -> underTest.execute()).isInstanceOf(IllegalStateException.class); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/activeruleparameters/DropPrimaryKeyOnIdColumnOfActiveRuleParametersTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/activeruleparameters/DropPrimaryKeyOnIdColumnOfActiveRuleParametersTableTest.java deleted file mode 100644 index c30ebc22584..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/activeruleparameters/DropPrimaryKeyOnIdColumnOfActiveRuleParametersTableTest.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.activeruleparameters; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.sql.DbPrimaryKeyConstraintFinder; -import org.sonar.server.platform.db.migration.sql.DropPrimaryKeySqlGenerator; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -public class DropPrimaryKeyOnIdColumnOfActiveRuleParametersTableTest { - - private static final String TABLE_NAME = "active_rule_parameters"; - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DropPrimaryKeyOnIdColumnOfActiveRuleParametersTableTest.class, "schema.sql"); - - private final DropPrimaryKeySqlGenerator dropPrimaryKeySqlGenerator = new DropPrimaryKeySqlGenerator(db.database(), new DbPrimaryKeyConstraintFinder(db.database())); - - private final MigrationStep underTest = new DropPrimaryKeyOnIdColumnOfActiveRuleParametersTable(db.database(), dropPrimaryKeySqlGenerator); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertNoPrimaryKey(TABLE_NAME); - } - - @Test - public void migration_is_re_entrant_but_fails_silently() throws SQLException { - underTest.execute(); - underTest.execute(); - - db.assertNoPrimaryKey(TABLE_NAME); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/activeruleparameters/MakeActiveRuleParametersUuidColumnNotNullableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/activeruleparameters/MakeActiveRuleParametersUuidColumnNotNullableTest.java deleted file mode 100644 index acb1c4f63c2..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/activeruleparameters/MakeActiveRuleParametersUuidColumnNotNullableTest.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.activeruleparameters; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -import static java.sql.Types.VARCHAR; - -public class MakeActiveRuleParametersUuidColumnNotNullableTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(MakeActiveRuleParametersUuidColumnNotNullableTest.class, "schema.sql"); - - private MigrationStep underTest = new MakeActiveRuleParametersUuidColumnNotNullable(db.database()); - - @Test - public void created_at_and_uuid_columns_are_not_null() throws SQLException { - underTest.execute(); - - db.assertColumnDefinition("active_rule_parameters", "uuid", VARCHAR, null, false); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/activeruleparameters/PopulateActiveRuleParametersUuidTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/activeruleparameters/PopulateActiveRuleParametersUuidTest.java deleted file mode 100644 index 4a8fc8a3897..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/activeruleparameters/PopulateActiveRuleParametersUuidTest.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.activeruleparameters; - -import java.sql.SQLException; -import java.util.Objects; -import java.util.stream.Collectors; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.core.util.UuidFactory; -import org.sonar.core.util.UuidFactoryFast; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DataChange; - -import static org.assertj.core.api.Assertions.assertThat; - -public class PopulateActiveRuleParametersUuidTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(PopulateActiveRuleParametersUuidTest.class, "schema.sql"); - - private UuidFactory uuidFactory = UuidFactoryFast.getInstance(); - private DataChange underTest = new PopulateActiveRuleParametersUuid(db.database(), uuidFactory); - - @Test - public void populate_uuids() throws SQLException { - insertActiveRuleParameter(1L); - insertActiveRuleParameter(2L); - insertActiveRuleParameter(3L); - - underTest.execute(); - - verifyUuidsAreNotNull(); - } - - @Test - public void migration_is_reentrant() throws SQLException { - insertActiveRuleParameter(1L); - insertActiveRuleParameter(2L); - insertActiveRuleParameter(3L); - - underTest.execute(); - // re-entrant - underTest.execute(); - - verifyUuidsAreNotNull(); - } - - private void verifyUuidsAreNotNull() { - assertThat(db.select("select uuid from active_rule_parameters") - .stream() - .map(row -> row.get("UUID")) - .filter(Objects::isNull) - .collect(Collectors.toList())).isEmpty(); - } - - private void insertActiveRuleParameter(Long id) { - db.executeInsert("active_rule_parameters", - "id", id, - "active_rule_id", id + 2, - "rules_parameter_id", id + 3); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/activerules/AddActiveRuleUuidColumnToActiveRuleParametersTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/activerules/AddActiveRuleUuidColumnToActiveRuleParametersTest.java deleted file mode 100644 index de735db7f59..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/activerules/AddActiveRuleUuidColumnToActiveRuleParametersTest.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.activerules; - -import java.sql.SQLException; -import java.sql.Types; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.assertj.core.api.Assertions.assertThat; - -public class AddActiveRuleUuidColumnToActiveRuleParametersTest { - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(AddActiveRuleUuidColumnToActiveRuleParametersTest.class, "schema.sql"); - private DdlChange underTest = new AddActiveRuleUuidColumnToActiveRuleParameters(db.database()); - - @Before - public void setup() { - insertActiveRuleParameter(1L); - insertActiveRuleParameter(2L); - insertActiveRuleParameter(3L); - } - - @Test - public void add_active_rule_uuid_column() throws SQLException { - underTest.execute(); - - db.assertColumnDefinition("active_rule_parameters", "active_rule_uuid", Types.VARCHAR, 40, true); - - assertThat(db.countRowsOfTable("active_rule_parameters")) - .isEqualTo(3); - } - - private void insertActiveRuleParameter(Long id) { - db.executeInsert("active_rule_parameters", - "uuid", "uuid" + id, - "rules_parameter_id", id, - "value", "value" + id, - "active_rule_id", id + 1); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/activerules/AddIndexOnActiveRuleUuidOfActiveRuleParametersTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/activerules/AddIndexOnActiveRuleUuidOfActiveRuleParametersTableTest.java deleted file mode 100644 index 2c2e6df5e7d..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/activerules/AddIndexOnActiveRuleUuidOfActiveRuleParametersTableTest.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.activerules; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -public class AddIndexOnActiveRuleUuidOfActiveRuleParametersTableTest { - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(AddIndexOnActiveRuleUuidOfActiveRuleParametersTableTest.class, "schema.sql"); - - private MigrationStep underTest = new AddIndexOnActiveRuleUuidOfActiveRuleParametersTable(db.database()); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertIndex("active_rule_parameters", "arp_active_rule_uuid", "active_rule_uuid"); - } - - @Test - public void migration_is_re_entrant() throws SQLException { - underTest.execute(); - - // re-entrant - underTest.execute(); - - db.assertIndex("active_rule_parameters", "arp_active_rule_uuid", "active_rule_uuid"); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/activerules/AddPrimaryKeyOnUuidColumnOfActiveRulesTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/activerules/AddPrimaryKeyOnUuidColumnOfActiveRulesTableTest.java deleted file mode 100644 index 9c8c6e8cb04..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/activerules/AddPrimaryKeyOnUuidColumnOfActiveRulesTableTest.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.activerules; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.assertj.core.api.Assertions.assertThatThrownBy; - -public class AddPrimaryKeyOnUuidColumnOfActiveRulesTableTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(AddPrimaryKeyOnUuidColumnOfActiveRulesTableTest.class, "schema.sql"); - - private DdlChange underTest = new AddPrimaryKeyOnUuidColumnOfActiveRulesTable(db.database()); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertPrimaryKey("active_rules", "pk_active_rules", "uuid"); - } - - @Test - public void migration_is_not_re_entrant() throws SQLException { - underTest.execute(); - - assertThatThrownBy(() -> underTest.execute()).isInstanceOf(IllegalStateException.class); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/activerules/AddUuidColumnToActiveRulesTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/activerules/AddUuidColumnToActiveRulesTableTest.java deleted file mode 100644 index 75c7d5ab3a8..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/activerules/AddUuidColumnToActiveRulesTableTest.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.activerules; - -import java.sql.SQLException; -import java.sql.Types; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.assertj.core.api.Assertions.assertThat; - -public class AddUuidColumnToActiveRulesTableTest { - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(AddUuidColumnToActiveRulesTableTest.class, "schema.sql"); - private DdlChange underTest = new AddUuidColumnToActiveRulesTable(db.database()); - - @Before - public void setup() { - insertActiveRule(1L); - insertActiveRule(2L); - insertActiveRule(3L); - } - - @Test - public void add_uuid_column() throws SQLException { - underTest.execute(); - - db.assertColumnDefinition("active_rules", "uuid", Types.VARCHAR, 40, true); - - assertThat(db.countRowsOfTable("active_rules")) - .isEqualTo(3); - } - - private void insertActiveRule(Long id) { - db.executeInsert("active_rules", - "id", id, - "profile_id", id + 1, - "rule_id", id + 2, - "failure_level", id + 3); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/activerules/DropActiveRuleIdColumnOfActiveRuleParametersTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/activerules/DropActiveRuleIdColumnOfActiveRuleParametersTableTest.java deleted file mode 100644 index 8a6cf76a0b6..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/activerules/DropActiveRuleIdColumnOfActiveRuleParametersTableTest.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.activerules; - -import java.sql.SQLException; -import java.sql.Types; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.assertj.core.api.Assertions.assertThatThrownBy; - -public class DropActiveRuleIdColumnOfActiveRuleParametersTableTest { - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DropActiveRuleIdColumnOfActiveRuleParametersTableTest.class, "schema.sql"); - - private DdlChange underTest = new DropActiveRuleIdColumnOfActiveRuleParametersTable(db.database()); - - @Test - public void execute() throws SQLException { - db.assertColumnDefinition("active_rule_parameters", "active_rule_id", Types.INTEGER, null, false); - underTest.execute(); - db.assertColumnDoesNotExist("active_rule_parameters", "active_rule_id"); - } - - @Test - public void migration_is_not_re_entrant() throws SQLException { - underTest.execute(); - - assertThatThrownBy(() -> underTest.execute()).isInstanceOf(IllegalStateException.class); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/activerules/DropIdColumnOfActiveRulesTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/activerules/DropIdColumnOfActiveRulesTableTest.java deleted file mode 100644 index 3f934a41ee9..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/activerules/DropIdColumnOfActiveRulesTableTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.activerules; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.assertj.core.api.Assertions.assertThatThrownBy; - -public class DropIdColumnOfActiveRulesTableTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DropIdColumnOfActiveRulesTableTest.class, "schema.sql"); - - private DdlChange underTest = new DropIdColumnOfActiveRulesTable(db.database()); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertColumnDoesNotExist("active_rules", "id"); - } - - @Test - public void migration_is_not_re_entrant() throws SQLException { - underTest.execute(); - - assertThatThrownBy(() -> underTest.execute()).isInstanceOf(IllegalStateException.class); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/activerules/DropIndexOnActiveRuleIdOfActiveRuleParametersTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/activerules/DropIndexOnActiveRuleIdOfActiveRuleParametersTableTest.java deleted file mode 100644 index 9a41f103ea8..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/activerules/DropIndexOnActiveRuleIdOfActiveRuleParametersTableTest.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.activerules; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -public class DropIndexOnActiveRuleIdOfActiveRuleParametersTableTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DropIndexOnActiveRuleIdOfActiveRuleParametersTableTest.class, "schema.sql"); - - private MigrationStep underTest = new DropIndexOnActiveRuleIdOfActiveRuleParametersTable(db.database()); - - @Test - public void execute() throws SQLException { - db.assertTableExists("active_rule_parameters"); - db.assertIndex("active_rule_parameters", "ix_arp_on_active_rule_id", "active_rule_id"); - - underTest.execute(); - - db.assertIndexDoesNotExist("active_rule_parameters", "ix_arp_on_active_rule_id"); - } - - @Test - public void migration_is_re_entrant() throws SQLException { - underTest.execute(); - - // re-entrant - underTest.execute(); - - db.assertIndexDoesNotExist("active_rule_parameters", "ix_arp_on_active_rule_id"); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/activerules/DropPrimaryKeyOnIdColumnOfActiveRulesTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/activerules/DropPrimaryKeyOnIdColumnOfActiveRulesTableTest.java deleted file mode 100644 index f33d82dd7b5..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/activerules/DropPrimaryKeyOnIdColumnOfActiveRulesTableTest.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.activerules; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.sql.DbPrimaryKeyConstraintFinder; -import org.sonar.server.platform.db.migration.sql.DropPrimaryKeySqlGenerator; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class DropPrimaryKeyOnIdColumnOfActiveRulesTableTest { - - private static final String TABLE_NAME = "active_rules"; - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DropPrimaryKeyOnIdColumnOfActiveRulesTableTest.class, "schema.sql"); - - private final DropPrimaryKeySqlGenerator dropPrimaryKeySqlGenerator = new DropPrimaryKeySqlGenerator(db.database(), new DbPrimaryKeyConstraintFinder(db.database())); - - private final DdlChange underTest = new DropPrimaryKeyOnIdColumnOfActiveRulesTable(db.database(), dropPrimaryKeySqlGenerator); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertNoPrimaryKey(TABLE_NAME); - } - - @Test - public void migration_is_re_entrant_but_fails_silently() throws SQLException { - underTest.execute(); - underTest.execute(); - - db.assertNoPrimaryKey(TABLE_NAME); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/activerules/MakeActiveRuleParametersActiveRuleUuidNotNullableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/activerules/MakeActiveRuleParametersActiveRuleUuidNotNullableTest.java deleted file mode 100644 index 6a8d8bed27b..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/activerules/MakeActiveRuleParametersActiveRuleUuidNotNullableTest.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.activerules; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -import static java.sql.Types.VARCHAR; - -public class MakeActiveRuleParametersActiveRuleUuidNotNullableTest { - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(MakeActiveRuleParametersActiveRuleUuidNotNullableTest.class, "schema.sql"); - - private MigrationStep underTest = new MakeActiveRuleParametersActiveRuleUuidNotNullable(db.database()); - - @Test - public void uuid_column_is_not_null() throws SQLException { - underTest.execute(); - - db.assertColumnDefinition("active_rule_parameters", "active_rule_uuid", VARCHAR, null, false); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/activerules/MakeActiveRulesUuidColumnNotNullableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/activerules/MakeActiveRulesUuidColumnNotNullableTest.java deleted file mode 100644 index 64a58e03e10..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/activerules/MakeActiveRulesUuidColumnNotNullableTest.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.activerules; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -import static java.sql.Types.VARCHAR; - -public class MakeActiveRulesUuidColumnNotNullableTest { - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(MakeActiveRulesUuidColumnNotNullableTest.class, "schema.sql"); - - private MigrationStep underTest = new MakeActiveRulesUuidColumnNotNullable(db.database()); - - @Test - public void uuid_column_is_not_nullable() throws SQLException { - underTest.execute(); - - db.assertColumnDefinition("active_rules", "uuid", VARCHAR, null, false); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/activerules/PopulateActiveRuleParametersActiveRuleUuidTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/activerules/PopulateActiveRuleParametersActiveRuleUuidTest.java deleted file mode 100644 index ace74cd9467..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/activerules/PopulateActiveRuleParametersActiveRuleUuidTest.java +++ /dev/null @@ -1,120 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.activerules; - -import java.sql.SQLException; -import java.util.List; -import java.util.Map; -import org.assertj.core.groups.Tuple; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DataChange; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.tuple; - -public class PopulateActiveRuleParametersActiveRuleUuidTest { - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(PopulateActiveRuleParametersActiveRuleUuidTest.class, "schema.sql"); - - private DataChange underTest = new PopulateActiveRuleParametersActiveRuleUuid(db.database()); - - @Test - public void populate_uuids() throws SQLException { - insertActiveRule(1L); - insertActiveRule(2L); - insertActiveRule(3L); - - insertActiveRuleParameter(4L, 1L); - insertActiveRuleParameter(5L, 2L); - insertActiveRuleParameter(6L, 3L); - - underTest.execute(); - - assertThatTableContains( - tuple("uuid4", 1L, "uuid1", "value4"), - tuple("uuid5", 2L, "uuid2", "value5"), - tuple("uuid6", 3L, "uuid3", "value6") - ); - } - - @Test - public void delete_orphan_rows() throws SQLException { - insertActiveRule(1L); - insertActiveRule(2L); - insertActiveRule(3L); - - insertActiveRuleParameter(4L, 10L); - insertActiveRuleParameter(5L, 2L); - insertActiveRuleParameter(6L, 3L); - - underTest.execute(); - - assertThatTableContains( - tuple("uuid5", 2L, "uuid2", "value5"), - tuple("uuid6", 3L, "uuid3", "value6") - ); - } - - @Test - public void migration_is_reentrant() throws SQLException { - insertActiveRule(1L); - insertActiveRule(2L); - insertActiveRule(3L); - - insertActiveRuleParameter(4L, 1L); - insertActiveRuleParameter(5L, 2L); - insertActiveRuleParameter(6L, 3L); - - underTest.execute(); - // re-entrant - underTest.execute(); - - assertThatTableContains( - tuple("uuid4", 1L, "uuid1", "value4"), - tuple("uuid5", 2L, "uuid2", "value5"), - tuple("uuid6", 3L, "uuid3", "value6") - ); - } - - private void assertThatTableContains(Tuple... tuples) { - List> select = db.select("select uuid, active_rule_id, active_rule_uuid, value from active_rule_parameters"); - assertThat(select).extracting(m -> m.get("UUID"), m -> m.get("ACTIVE_RULE_ID"), m -> m.get("ACTIVE_RULE_UUID"), m -> m.get("VALUE")) - .containsExactlyInAnyOrder(tuples); - } - - private void insertActiveRule(Long id) { - db.executeInsert("active_rules", - "uuid", "uuid" + id, - "id", id, - "profile_id", id + 1, - "rule_id", id + 2, - "failure_level", id + 3); - } - - private void insertActiveRuleParameter(Long id, Long activeRuleId) { - db.executeInsert("active_rule_parameters", - "uuid", "uuid" + id, - "rules_parameter_id", id, - "value", "value" + id, - "active_rule_id", activeRuleId); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/activerules/PopulateActiveRulesUuidTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/activerules/PopulateActiveRulesUuidTest.java deleted file mode 100644 index 0e7dc98b8a9..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/activerules/PopulateActiveRulesUuidTest.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.activerules; - -import java.sql.SQLException; -import java.util.Objects; -import java.util.stream.Collectors; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.core.util.UuidFactory; -import org.sonar.core.util.UuidFactoryFast; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DataChange; - -import static org.assertj.core.api.Assertions.assertThat; - -public class PopulateActiveRulesUuidTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(PopulateActiveRulesUuidTest.class, "schema.sql"); - - private UuidFactory uuidFactory = UuidFactoryFast.getInstance(); - private DataChange underTest = new PopulateActiveRulesUuid(db.database(), uuidFactory); - - @Test - public void populate_uuids() throws SQLException { - insertActiveRule(1L); - insertActiveRule(2L); - insertActiveRule(3L); - - underTest.execute(); - - verifyUuidsAreNotNull(); - } - - @Test - public void migration_is_reentrant() throws SQLException { - insertActiveRule(1L); - insertActiveRule(2L); - insertActiveRule(3L); - - underTest.execute(); - // re-entrant - underTest.execute(); - - verifyUuidsAreNotNull(); - } - - private void verifyUuidsAreNotNull() { - assertThat(db.select("select uuid from active_rules") - .stream() - .map(row -> row.get("UUID")) - .filter(Objects::isNull) - .collect(Collectors.toList())).isEmpty(); - } - - private void insertActiveRule(Long id) { - db.executeInsert("active_rules", - "id", id, - "profile_id", id + 1, - "rule_id", id + 2, - "failure_level", id + 3); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/alm/AddClientIdAndClientSecretColumnsTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/alm/AddClientIdAndClientSecretColumnsTest.java deleted file mode 100644 index 0465b15ecb2..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/alm/AddClientIdAndClientSecretColumnsTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.alm; - -import java.sql.SQLException; -import java.sql.Types; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -import static org.assertj.core.api.Assertions.assertThatThrownBy; - -public class AddClientIdAndClientSecretColumnsTest { - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(AddClientIdAndClientSecretColumnsTest.class, "schema.sql"); - - private MigrationStep underTest = new AddClientIdAndClientSecretColumns(db.database()); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertColumnDefinition("alm_settings", "client_id", Types.VARCHAR, 80, true); - db.assertColumnDefinition("alm_settings", "client_secret", Types.VARCHAR, 80, true); - } - - @Test - public void migration_is_not_re_entrant() throws SQLException { - underTest.execute(); - - assertThatThrownBy(() -> underTest.execute()).isInstanceOf(IllegalStateException.class); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/ceactivity/AddPrimaryKeyOnUuidColumnOfCeActivityTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/ceactivity/AddPrimaryKeyOnUuidColumnOfCeActivityTableTest.java deleted file mode 100644 index 2bafea05270..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/ceactivity/AddPrimaryKeyOnUuidColumnOfCeActivityTableTest.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.ceactivity; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -import static org.assertj.core.api.Assertions.assertThatThrownBy; - -public class AddPrimaryKeyOnUuidColumnOfCeActivityTableTest { - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(AddPrimaryKeyOnUuidColumnOfCeActivityTableTest.class, "schema.sql"); - - private MigrationStep underTest = new AddPrimaryKeyOnUuidColumnOfCeActivityTable(db.database()); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertPrimaryKey("ce_activity", "pk_ce_activity", "uuid"); - } - - @Test - public void migration_is_not_re_entrant() throws SQLException { - underTest.execute(); - - assertThatThrownBy(() -> underTest.execute()).isInstanceOf(IllegalStateException.class); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/ceactivity/DropIdColumnOfCeActivityTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/ceactivity/DropIdColumnOfCeActivityTableTest.java deleted file mode 100644 index 99a18bf168b..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/ceactivity/DropIdColumnOfCeActivityTableTest.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.ceactivity; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -import static org.assertj.core.api.Assertions.assertThatThrownBy; - -public class DropIdColumnOfCeActivityTableTest { - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DropIdColumnOfCeActivityTableTest.class, "schema.sql"); - - private MigrationStep underTest = new DropIdColumnOfCeActivityTable(db.database()); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertColumnDoesNotExist("ce_activity", "id"); - } - - @Test - public void migration_is_not_re_entrant() throws SQLException { - underTest.execute(); - - assertThatThrownBy(() -> underTest.execute()).isInstanceOf(IllegalStateException.class); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/ceactivity/DropPrimaryKeyOnIdColumnOfCeActivityTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/ceactivity/DropPrimaryKeyOnIdColumnOfCeActivityTableTest.java deleted file mode 100644 index 09b11b665d6..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/ceactivity/DropPrimaryKeyOnIdColumnOfCeActivityTableTest.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.ceactivity; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.sql.DbPrimaryKeyConstraintFinder; -import org.sonar.server.platform.db.migration.sql.DropPrimaryKeySqlGenerator; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -public class DropPrimaryKeyOnIdColumnOfCeActivityTableTest { - - private static final String TABLE_NAME = "ce_activity"; - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DropPrimaryKeyOnIdColumnOfCeActivityTableTest.class, "schema.sql"); - - private final DropPrimaryKeySqlGenerator dropPrimaryKeySqlGenerator = new DropPrimaryKeySqlGenerator(db.database(), new DbPrimaryKeyConstraintFinder(db.database())); - - private final MigrationStep underTest = new DropPrimaryKeyOnIdColumnOfCeActivityTable(db.database(), dropPrimaryKeySqlGenerator); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertNoPrimaryKey(TABLE_NAME); - } - - @Test - public void migration_is_re_entrant_but_fails_silently() throws SQLException { - underTest.execute(); - underTest.execute(); - - db.assertNoPrimaryKey(TABLE_NAME); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/cequeue/AddPrimaryKeyOnUuidColumnOfCeQueueTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/cequeue/AddPrimaryKeyOnUuidColumnOfCeQueueTableTest.java deleted file mode 100644 index 4c933d8a3c0..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/cequeue/AddPrimaryKeyOnUuidColumnOfCeQueueTableTest.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.cequeue; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -import static org.assertj.core.api.Assertions.assertThatThrownBy; - -public class AddPrimaryKeyOnUuidColumnOfCeQueueTableTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(AddPrimaryKeyOnUuidColumnOfCeQueueTableTest.class, "schema.sql"); - - private MigrationStep underTest = new AddPrimaryKeyOnUuidColumnOfCeQueueTable(db.database()); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertPrimaryKey("ce_queue", "pk_ce_queue", "uuid"); - } - - @Test - public void migration_is_not_re_entrant() throws SQLException { - underTest.execute(); - - assertThatThrownBy(() -> underTest.execute()).isInstanceOf(IllegalStateException.class); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/cequeue/DropIdColumnOfCeQueueTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/cequeue/DropIdColumnOfCeQueueTableTest.java deleted file mode 100644 index 613859626d3..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/cequeue/DropIdColumnOfCeQueueTableTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.cequeue; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -import static org.assertj.core.api.Assertions.assertThatThrownBy; - -public class DropIdColumnOfCeQueueTableTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DropIdColumnOfCeQueueTableTest.class, "schema.sql"); - - private MigrationStep underTest = new DropIdColumnOfCeQueueTable(db.database()); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertColumnDoesNotExist("ce_queue", "id"); - } - - @Test - public void migration_is_not_re_entrant() throws SQLException { - underTest.execute(); - - assertThatThrownBy(() -> underTest.execute()).isInstanceOf(IllegalStateException.class); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/cequeue/DropPrimaryKeyOnIdColumnOfCeQueueTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/cequeue/DropPrimaryKeyOnIdColumnOfCeQueueTableTest.java deleted file mode 100644 index 4f17918162b..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/cequeue/DropPrimaryKeyOnIdColumnOfCeQueueTableTest.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.cequeue; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.sql.DbPrimaryKeyConstraintFinder; -import org.sonar.server.platform.db.migration.sql.DropPrimaryKeySqlGenerator; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -public class DropPrimaryKeyOnIdColumnOfCeQueueTableTest { - - private static final String TABLE_NAME = "ce_queue"; - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DropPrimaryKeyOnIdColumnOfCeQueueTableTest.class, "schema.sql"); - - private final DropPrimaryKeySqlGenerator dropPrimaryKeySqlGenerator = new DropPrimaryKeySqlGenerator(db.database(), new DbPrimaryKeyConstraintFinder(db.database())); - - private final MigrationStep underTest = new DropPrimaryKeyOnIdColumnOfCeQueueTable(db.database(), dropPrimaryKeySqlGenerator); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertNoPrimaryKey(TABLE_NAME); - } - - @Test - public void migration_is_re_entrant_but_fails_silently() throws SQLException { - underTest.execute(); - underTest.execute(); - - db.assertNoPrimaryKey(TABLE_NAME); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/cequeue/DropUniqueIndexOnUuidColumnOfCeQueueTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/cequeue/DropUniqueIndexOnUuidColumnOfCeQueueTableTest.java deleted file mode 100644 index ea36f81e978..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/cequeue/DropUniqueIndexOnUuidColumnOfCeQueueTableTest.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.cequeue; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -public class DropUniqueIndexOnUuidColumnOfCeQueueTableTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DropUniqueIndexOnUuidColumnOfCeQueueTableTest.class, "schema.sql"); - - private MigrationStep underTest = new DropUniqueIndexOnUuidColumnOfCeQueueTable(db.database()); - - @Test - public void execute_drop_index() throws SQLException { - db.assertUniqueIndex("ce_queue", "ce_queue_uuid", "uuid"); - - underTest.execute(); - - db.assertIndexDoesNotExist("ce_queue", "ce_queue_uuid"); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/duplicationsindex/AddPrimaryKeyOnUuidColumnOfDuplicationsIndexTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/duplicationsindex/AddPrimaryKeyOnUuidColumnOfDuplicationsIndexTableTest.java deleted file mode 100644 index d3b45824e14..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/duplicationsindex/AddPrimaryKeyOnUuidColumnOfDuplicationsIndexTableTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.duplicationsindex; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -import static org.assertj.core.api.Assertions.assertThatThrownBy; - -public class AddPrimaryKeyOnUuidColumnOfDuplicationsIndexTableTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(AddPrimaryKeyOnUuidColumnOfDuplicationsIndexTableTest.class, "schema.sql"); - - private MigrationStep underTest = new AddPrimaryKeyOnUuidColumnOfDuplicationsIndexTable(db.database()); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertPrimaryKey("duplications_index", "pk_duplications_index", "uuid"); - } - - @Test - public void migration_is_not_re_entrant() throws SQLException { - underTest.execute(); - - assertThatThrownBy(() -> underTest.execute()).isInstanceOf(IllegalStateException.class); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/duplicationsindex/AddUuidToDuplicationsIndexTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/duplicationsindex/AddUuidToDuplicationsIndexTableTest.java deleted file mode 100644 index 5cd015260fe..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/duplicationsindex/AddUuidToDuplicationsIndexTableTest.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.duplicationsindex; - -import java.sql.SQLException; -import java.sql.Types; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.core.util.UuidFactoryFast; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.assertj.core.api.Assertions.assertThat; - -public class AddUuidToDuplicationsIndexTableTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(AddUuidToDuplicationsIndexTableTest.class, "schema.sql"); - - private DdlChange underTest = new AddUuidToDuplicationsIndexTable(db.database()); - - private UuidFactoryFast uuidFactory = UuidFactoryFast.getInstance(); - - @Before - public void setup() { - insertDuplicationsIndex(1L); - insertDuplicationsIndex(2L); - insertDuplicationsIndex(3L); - } - - @Test - public void add_uuid_column_to_duplications_index() throws SQLException { - underTest.execute(); - - db.assertColumnDefinition("duplications_index", "uuid", Types.VARCHAR, 40, true); - - assertThat(db.countRowsOfTable("duplications_index")) - .isEqualTo(3); - } - - private void insertDuplicationsIndex(Long id) { - db.executeInsert("duplications_index", - "id", id, - "hash", uuidFactory.create(), - "index_in_file", id + 1, - "start_line", id + 2, - "end_line", id + 3, - "component_uuid", uuidFactory.create(), - "analysis_uuid", uuidFactory.create()); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/duplicationsindex/DropIdColumnOfDuplicationsIndexTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/duplicationsindex/DropIdColumnOfDuplicationsIndexTableTest.java deleted file mode 100644 index a2d6f28b021..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/duplicationsindex/DropIdColumnOfDuplicationsIndexTableTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.duplicationsindex; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -import static org.assertj.core.api.Assertions.assertThatThrownBy; - -public class DropIdColumnOfDuplicationsIndexTableTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DropIdColumnOfDuplicationsIndexTableTest.class, "schema.sql"); - - private MigrationStep underTest = new DropIdColumnOfDuplicationsIndexTable(db.database()); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertColumnDoesNotExist("duplications_index", "id"); - } - - @Test - public void migration_is_not_re_entrant() throws SQLException { - underTest.execute(); - - assertThatThrownBy(() -> underTest.execute()).isInstanceOf(IllegalStateException.class); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/duplicationsindex/DropPrimaryKeyOnIdColumnOfDuplicationsIndexTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/duplicationsindex/DropPrimaryKeyOnIdColumnOfDuplicationsIndexTableTest.java deleted file mode 100644 index aeaf762def7..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/duplicationsindex/DropPrimaryKeyOnIdColumnOfDuplicationsIndexTableTest.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.duplicationsindex; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.sql.DbPrimaryKeyConstraintFinder; -import org.sonar.server.platform.db.migration.sql.DropPrimaryKeySqlGenerator; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -public class DropPrimaryKeyOnIdColumnOfDuplicationsIndexTableTest { - - private static final String TABLE_NAME = "duplications_index"; - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DropPrimaryKeyOnIdColumnOfDuplicationsIndexTableTest.class, "schema.sql"); - - private final DropPrimaryKeySqlGenerator dropPrimaryKeySqlGenerator = new DropPrimaryKeySqlGenerator(db.database(), new DbPrimaryKeyConstraintFinder(db.database())); - - private final MigrationStep underTest = new DropPrimaryKeyOnIdColumnOfDuplicationsIndexTable(db.database(), dropPrimaryKeySqlGenerator); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertNoPrimaryKey(TABLE_NAME); - } - - @Test - public void migration_is_re_entrant_but_fails_silently() throws SQLException { - underTest.execute(); - underTest.execute(); - - db.assertNoPrimaryKey(TABLE_NAME); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/duplicationsindex/MakeDuplicationsIndexUuidColumnNotNullableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/duplicationsindex/MakeDuplicationsIndexUuidColumnNotNullableTest.java deleted file mode 100644 index 6219a7bc66f..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/duplicationsindex/MakeDuplicationsIndexUuidColumnNotNullableTest.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.duplicationsindex; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -import static java.sql.Types.VARCHAR; - -public class MakeDuplicationsIndexUuidColumnNotNullableTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(MakeDuplicationsIndexUuidColumnNotNullableTest.class, "schema.sql"); - - private MigrationStep underTest = new MakeDuplicationsIndexUuidColumnNotNullable(db.database()); - - @Test - public void created_at_and_uuid_columns_are_not_null() throws SQLException { - underTest.execute(); - - db.assertColumnDefinition("duplications_index", "uuid", VARCHAR, null, false); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/duplicationsindex/PopulateDuplicationsIndexUuidTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/duplicationsindex/PopulateDuplicationsIndexUuidTest.java deleted file mode 100644 index e63d1981925..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/duplicationsindex/PopulateDuplicationsIndexUuidTest.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.duplicationsindex; - -import java.sql.SQLException; -import java.util.Objects; -import java.util.stream.Collectors; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.core.util.UuidFactory; -import org.sonar.core.util.UuidFactoryFast; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DataChange; - -import static org.assertj.core.api.Assertions.assertThat; - -public class PopulateDuplicationsIndexUuidTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(PopulateDuplicationsIndexUuidTest.class, "schema.sql"); - - private UuidFactory uuidFactory = UuidFactoryFast.getInstance(); - private DataChange underTest = new PopulateDuplicationsIndexUuid(db.database(), uuidFactory); - - @Test - public void populate_uuids() throws SQLException { - insertDuplicationsIndex(1L); - insertDuplicationsIndex(2L); - insertDuplicationsIndex(3L); - - underTest.execute(); - - verifyUuidsAreNotNull(); - } - - @Test - public void migration_is_reentrant() throws SQLException { - insertDuplicationsIndex(1L); - insertDuplicationsIndex(2L); - insertDuplicationsIndex(3L); - - underTest.execute(); - // re-entrant - underTest.execute(); - - verifyUuidsAreNotNull(); - } - - private void verifyUuidsAreNotNull() { - assertThat(db.select("select uuid from duplications_index") - .stream() - .map(row -> row.get("UUID")) - .filter(Objects::isNull) - .collect(Collectors.toList())).isEmpty(); - } - - private void insertDuplicationsIndex(Long id) { - db.executeInsert("duplications_index", - "id", id, - "hash", uuidFactory.create(), - "index_in_file", id + 1, - "start_line", id + 2, - "end_line", id + 3, - "component_uuid", uuidFactory.create(), - "analysis_uuid", uuidFactory.create()); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/events/AddPrimaryKeyOnUuidColumnOfEventsTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/events/AddPrimaryKeyOnUuidColumnOfEventsTableTest.java deleted file mode 100644 index 8a157c8c673..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/events/AddPrimaryKeyOnUuidColumnOfEventsTableTest.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.events; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; - -import static org.assertj.core.api.Assertions.assertThatThrownBy; - -public class AddPrimaryKeyOnUuidColumnOfEventsTableTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(AddPrimaryKeyOnUuidColumnOfEventsTableTest.class, "schema.sql"); - - private AddPrimaryKeyOnUuidColumnOfEventsTable underTest = new AddPrimaryKeyOnUuidColumnOfEventsTable(db.database()); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertPrimaryKey("events", "pk_events", "uuid"); - } - - @Test - public void migration_is_not_re_entrant() throws SQLException { - underTest.execute(); - - assertThatThrownBy(() -> underTest.execute()).isInstanceOf(IllegalStateException.class); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/events/DropIdColumnOfEventsTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/events/DropIdColumnOfEventsTableTest.java deleted file mode 100644 index c9a2372ec25..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/events/DropIdColumnOfEventsTableTest.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.events; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; - -import static org.assertj.core.api.Assertions.assertThatThrownBy; - -public class DropIdColumnOfEventsTableTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DropIdColumnOfEventsTableTest.class, "schema.sql"); - - private DropIdColumnOfEventsTable underTest = new DropIdColumnOfEventsTable(db.database()); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertColumnDoesNotExist("events", "id"); - } - - @Test - public void migration_is_not_re_entrant() throws SQLException { - underTest.execute(); - - assertThatThrownBy(() -> underTest.execute()).isInstanceOf(IllegalStateException.class); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/events/DropPrimaryKeyOnIdColumnOfEventsTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/events/DropPrimaryKeyOnIdColumnOfEventsTableTest.java deleted file mode 100644 index acd069c82c9..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/events/DropPrimaryKeyOnIdColumnOfEventsTableTest.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.events; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.sql.DbPrimaryKeyConstraintFinder; -import org.sonar.server.platform.db.migration.sql.DropPrimaryKeySqlGenerator; - -public class DropPrimaryKeyOnIdColumnOfEventsTableTest { - - private static final String TABLE_NAME = "events"; - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DropPrimaryKeyOnIdColumnOfEventsTableTest.class, "schema.sql"); - - private final DropPrimaryKeySqlGenerator dropPrimaryKeySqlGenerator = new DropPrimaryKeySqlGenerator(db.database(), new DbPrimaryKeyConstraintFinder(db.database())); - - private final DropPrimaryKeyOnIdColumnOfEventsTable underTest = new DropPrimaryKeyOnIdColumnOfEventsTable(db.database(), dropPrimaryKeySqlGenerator); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertNoPrimaryKey(TABLE_NAME); - } - - @Test - public void migration_is_re_entrant_but_fails_silently() throws SQLException { - underTest.execute(); - underTest.execute(); - - db.assertNoPrimaryKey(TABLE_NAME); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/filesources/AddPrimaryKeyOnUuidColumnOfFileSourcesTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/filesources/AddPrimaryKeyOnUuidColumnOfFileSourcesTableTest.java deleted file mode 100644 index f5adedc96e3..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/filesources/AddPrimaryKeyOnUuidColumnOfFileSourcesTableTest.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.filesources; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.assertj.core.api.Assertions.assertThatThrownBy; - -public class AddPrimaryKeyOnUuidColumnOfFileSourcesTableTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(AddPrimaryKeyOnUuidColumnOfFileSourcesTableTest.class, "schema.sql"); - - private DdlChange underTest = new AddPrimaryKeyOnUuidColumnOfFileSourcesTable(db.database()); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertPrimaryKey("file_sources", "pk_file_sources", "uuid"); - } - - @Test - public void migration_is_not_re_entrant() throws SQLException { - underTest.execute(); - - assertThatThrownBy(() -> underTest.execute()).isInstanceOf(IllegalStateException.class); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/filesources/AddUuidColumnToFileSourcesTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/filesources/AddUuidColumnToFileSourcesTableTest.java deleted file mode 100644 index 224b02bfe4a..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/filesources/AddUuidColumnToFileSourcesTableTest.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.filesources; - -import java.sql.SQLException; -import java.sql.Types; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.core.util.UuidFactoryFast; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.assertj.core.api.Assertions.assertThat; - -public class AddUuidColumnToFileSourcesTableTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(AddUuidColumnToFileSourcesTableTest.class, "schema.sql"); - - private DdlChange underTest = new AddUuidColumnToFileSourcesTable(db.database()); - - private UuidFactoryFast uuidFactory = UuidFactoryFast.getInstance(); - - @Before - public void setup() { - insertFileSources(1L); - insertFileSources(2L); - insertFileSources(3L); - } - - @Test - public void add_uuid_column() throws SQLException { - underTest.execute(); - - db.assertColumnDefinition("file_sources", "uuid", Types.VARCHAR, 40, true); - - assertThat(db.countRowsOfTable("file_sources")) - .isEqualTo(3); - } - - private void insertFileSources(Long id) { - db.executeInsert("file_sources", - "id", id, - "project_uuid", uuidFactory.create(), - "file_uuid", uuidFactory.create(), - "line_count", id + 1, - "created_at", id + 2, - "updated_at", id + 3); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/filesources/DropIdColumnOfFileSourcesTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/filesources/DropIdColumnOfFileSourcesTableTest.java deleted file mode 100644 index 2890a12a815..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/filesources/DropIdColumnOfFileSourcesTableTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.filesources; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.assertj.core.api.Assertions.assertThatThrownBy; - -public class DropIdColumnOfFileSourcesTableTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DropIdColumnOfFileSourcesTableTest.class, "schema.sql"); - - private DdlChange underTest = new DropIdColumnOfFileSourcesTable(db.database()); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertColumnDoesNotExist("file_sources", "id"); - } - - @Test - public void migration_is_not_re_entrant() throws SQLException { - underTest.execute(); - - assertThatThrownBy(() -> underTest.execute()).isInstanceOf(IllegalStateException.class); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/filesources/DropPrimaryKeyOnIdColumnOfFileSourcesTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/filesources/DropPrimaryKeyOnIdColumnOfFileSourcesTableTest.java deleted file mode 100644 index d859424ac43..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/filesources/DropPrimaryKeyOnIdColumnOfFileSourcesTableTest.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.filesources; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.sql.DbPrimaryKeyConstraintFinder; -import org.sonar.server.platform.db.migration.sql.DropPrimaryKeySqlGenerator; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class DropPrimaryKeyOnIdColumnOfFileSourcesTableTest { - - private static final String TABLE_NAME = "file_sources"; - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DropPrimaryKeyOnIdColumnOfFileSourcesTableTest.class, "schema.sql"); - - private final DropPrimaryKeySqlGenerator dropPrimaryKeySqlGenerator = new DropPrimaryKeySqlGenerator(db.database(), new DbPrimaryKeyConstraintFinder(db.database())); - - private final DdlChange underTest = new DropPrimaryKeyOnIdColumnOfFileSourcesTable(db.database(), dropPrimaryKeySqlGenerator); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertNoPrimaryKey(TABLE_NAME); - } - - @Test - public void migration_is_re_entrant_but_fails_silently() throws SQLException { - underTest.execute(); - underTest.execute(); - - db.assertNoPrimaryKey(TABLE_NAME); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/filesources/MakeFileSourcesUuidColumnNotNullableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/filesources/MakeFileSourcesUuidColumnNotNullableTest.java deleted file mode 100644 index 3ff9e98b8f5..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/filesources/MakeFileSourcesUuidColumnNotNullableTest.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.filesources; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -import static java.sql.Types.VARCHAR; - -public class MakeFileSourcesUuidColumnNotNullableTest { - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(MakeFileSourcesUuidColumnNotNullableTest.class, "schema.sql"); - - private MigrationStep underTest = new MakeFileSourcesUuidColumnNotNullable(db.database()); - - @Test - public void uuid_column_is_not_nullable() throws SQLException { - underTest.execute(); - - db.assertColumnDefinition("file_sources", "uuid", VARCHAR, null, false); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/filesources/PopulateFileSourcesUuidTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/filesources/PopulateFileSourcesUuidTest.java deleted file mode 100644 index 858daee347a..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/filesources/PopulateFileSourcesUuidTest.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.filesources; - -import java.sql.SQLException; -import java.util.Objects; -import java.util.stream.Collectors; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.core.util.UuidFactory; -import org.sonar.core.util.UuidFactoryFast; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DataChange; - -import static org.assertj.core.api.Assertions.assertThat; - -public class PopulateFileSourcesUuidTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(PopulateFileSourcesUuidTest.class, "schema.sql"); - - private UuidFactory uuidFactory = UuidFactoryFast.getInstance(); - private DataChange underTest = new PopulateFileSourcesUuid(db.database(), uuidFactory); - - @Test - public void populate_uuids() throws SQLException { - insertFileSources(1L); - insertFileSources(2L); - insertFileSources(3L); - - underTest.execute(); - - verifyUuidsAreNotNull(); - } - - @Test - public void migration_is_reentrant() throws SQLException { - insertFileSources(1L); - insertFileSources(2L); - insertFileSources(3L); - - underTest.execute(); - // re-entrant - underTest.execute(); - - verifyUuidsAreNotNull(); - } - - private void verifyUuidsAreNotNull() { - assertThat(db.select("select uuid from file_sources") - .stream() - .map(row -> row.get("UUID")) - .filter(Objects::isNull) - .collect(Collectors.toList())).isEmpty(); - } - - private void insertFileSources(Long id) { - db.executeInsert("file_sources", - "id", id, - "project_uuid", uuidFactory.create(), - "file_uuid", uuidFactory.create(), - "line_count", id + 1, - "created_at", id + 2, - "updated_at", id + 3); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/grouproles/AddPrimaryKeyOnUuidColumnOfGroupRolesTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/grouproles/AddPrimaryKeyOnUuidColumnOfGroupRolesTableTest.java deleted file mode 100644 index 873381d68eb..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/grouproles/AddPrimaryKeyOnUuidColumnOfGroupRolesTableTest.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.grouproles; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; - -import static org.assertj.core.api.Assertions.assertThatThrownBy; - -public class AddPrimaryKeyOnUuidColumnOfGroupRolesTableTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(AddPrimaryKeyOnUuidColumnOfGroupRolesTableTest.class, "schema.sql"); - - private AddPrimaryKeyOnUuidColumnOfGroupRolesTable underTest = new AddPrimaryKeyOnUuidColumnOfGroupRolesTable(db.database()); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertPrimaryKey("group_roles", "pk_group_roles", "uuid"); - } - - @Test - public void migration_is_not_re_entrant() throws SQLException { - underTest.execute(); - - assertThatThrownBy(() -> underTest.execute()).isInstanceOf(IllegalStateException.class); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/grouproles/AddUuidColumnToGroupRolesTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/grouproles/AddUuidColumnToGroupRolesTableTest.java deleted file mode 100644 index a0bdce7916a..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/grouproles/AddUuidColumnToGroupRolesTableTest.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.grouproles; - -import java.sql.SQLException; -import java.sql.Types; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.core.util.UuidFactoryFast; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.assertj.core.api.Assertions.assertThat; - -public class AddUuidColumnToGroupRolesTableTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(AddUuidColumnToGroupRolesTableTest.class, "schema.sql"); - - private DdlChange underTest = new AddUuidColumnToGroupRolesTable(db.database()); - - private UuidFactoryFast uuidFactory = UuidFactoryFast.getInstance(); - - @Before - public void setup() { - insertGroupRoles(1L); - insertGroupRoles(2L); - insertGroupRoles(3L); - } - - @Test - public void add_uuid_column() throws SQLException { - underTest.execute(); - - db.assertColumnDefinition("group_roles", "uuid", Types.VARCHAR, 40, true); - - assertThat(db.countRowsOfTable("group_roles")) - .isEqualTo(3); - } - - private void insertGroupRoles(Long id) { - db.executeInsert("group_roles", - "id", id, - "organization_uuid", uuidFactory.create(), - "group_id", id + 1, - "role", id + 2, - "component_uuid", uuidFactory.create()); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/grouproles/DropIdColumnOfGroupRolesTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/grouproles/DropIdColumnOfGroupRolesTableTest.java deleted file mode 100644 index 840ba1d80f2..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/grouproles/DropIdColumnOfGroupRolesTableTest.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.grouproles; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; - -import static org.assertj.core.api.Assertions.assertThatThrownBy; - -public class DropIdColumnOfGroupRolesTableTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DropIdColumnOfGroupRolesTableTest.class, "schema.sql"); - - private DropIdColumnOfGroupRolesTable underTest = new DropIdColumnOfGroupRolesTable(db.database()); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertColumnDoesNotExist("group_roles", "id"); - } - - @Test - public void migration_is_not_re_entrant() throws SQLException { - underTest.execute(); - - assertThatThrownBy(() -> underTest.execute()).isInstanceOf(IllegalStateException.class); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/grouproles/DropPrimaryKeyOnIdColumnOfGroupRolesTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/grouproles/DropPrimaryKeyOnIdColumnOfGroupRolesTableTest.java deleted file mode 100644 index 65e279e04c3..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/grouproles/DropPrimaryKeyOnIdColumnOfGroupRolesTableTest.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.grouproles; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.sql.DbPrimaryKeyConstraintFinder; -import org.sonar.server.platform.db.migration.sql.DropPrimaryKeySqlGenerator; - -public class DropPrimaryKeyOnIdColumnOfGroupRolesTableTest { - - private static final String TABLE_NAME = "group_roles"; - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DropPrimaryKeyOnIdColumnOfGroupRolesTableTest.class, "schema.sql"); - - private final DropPrimaryKeySqlGenerator dropPrimaryKeySqlGenerator = new DropPrimaryKeySqlGenerator(db.database(), new DbPrimaryKeyConstraintFinder(db.database())); - - private final DropPrimaryKeyOnIdColumnOfGroupRolesTable underTest = new DropPrimaryKeyOnIdColumnOfGroupRolesTable(db.database(), dropPrimaryKeySqlGenerator); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertNoPrimaryKey(TABLE_NAME); - } - - @Test - public void migration_is_re_entrant_but_fails_silently() throws SQLException { - underTest.execute(); - underTest.execute(); - - db.assertNoPrimaryKey(TABLE_NAME); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/grouproles/MakeGroupRolesUuidColumnNotNullableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/grouproles/MakeGroupRolesUuidColumnNotNullableTest.java deleted file mode 100644 index 7e8641d3d2e..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/grouproles/MakeGroupRolesUuidColumnNotNullableTest.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.grouproles; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -import static java.sql.Types.VARCHAR; - -public class MakeGroupRolesUuidColumnNotNullableTest { - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(MakeGroupRolesUuidColumnNotNullableTest.class, "schema.sql"); - - private MigrationStep underTest = new MakeGroupRolesUuidColumnNotNullable(db.database()); - - @Test - public void uuid_column_is_not_nullable() throws SQLException { - underTest.execute(); - - db.assertColumnDefinition("group_roles", "uuid", VARCHAR, null, false); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/grouproles/PopulateGroupRolesUuidTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/grouproles/PopulateGroupRolesUuidTest.java deleted file mode 100644 index b5317e1a3df..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/grouproles/PopulateGroupRolesUuidTest.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.grouproles; - -import java.sql.SQLException; -import java.util.Objects; -import java.util.stream.Collectors; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.core.util.UuidFactory; -import org.sonar.core.util.UuidFactoryFast; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DataChange; - -import static org.assertj.core.api.Assertions.assertThat; - -public class PopulateGroupRolesUuidTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(PopulateGroupRolesUuidTest.class, "schema.sql"); - - private UuidFactory uuidFactory = UuidFactoryFast.getInstance(); - private DataChange underTest = new PopulateGroupRolesUuid(db.database(), uuidFactory); - - @Test - public void populate_uuids() throws SQLException { - insertGroupRoles(1L); - insertGroupRoles(2L); - insertGroupRoles(3L); - - underTest.execute(); - - verifyUuidsAreNotNull(); - } - - @Test - public void migration_is_reentrant() throws SQLException { - insertGroupRoles(1L); - insertGroupRoles(2L); - insertGroupRoles(3L); - - underTest.execute(); - // re-entrant - underTest.execute(); - - verifyUuidsAreNotNull(); - } - - private void verifyUuidsAreNotNull() { - assertThat(db.select("select uuid from group_roles") - .stream() - .map(row -> row.get("UUID")) - .filter(Objects::isNull) - .collect(Collectors.toList())).isEmpty(); - } - - private void insertGroupRoles(Long id) { - db.executeInsert("group_roles", - "id", id, - "uuid", uuidFactory.create(), - "organization_uuid", uuidFactory.create(), - "group_id", id + 1, - "role", id + 2, - "component_uuid", uuidFactory.create()); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/groups/AddPrimaryKeyOnUuidColumnOfGroupsTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/groups/AddPrimaryKeyOnUuidColumnOfGroupsTableTest.java deleted file mode 100644 index 6bc95930098..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/groups/AddPrimaryKeyOnUuidColumnOfGroupsTableTest.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.groups; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.assertj.core.api.Assertions.assertThatThrownBy; - -public class AddPrimaryKeyOnUuidColumnOfGroupsTableTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(AddPrimaryKeyOnUuidColumnOfGroupsTableTest.class, "schema.sql"); - - private DdlChange underTest = new AddPrimaryKeyOnUuidColumnOfGroupsTable(db.database()); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertPrimaryKey("groups", "pk_groups", "uuid"); - } - - @Test - public void migration_is_not_re_entrant() throws SQLException { - underTest.execute(); - - assertThatThrownBy(() -> underTest.execute()).isInstanceOf(IllegalStateException.class); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/groups/AddUuidColumnToGroupsTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/groups/AddUuidColumnToGroupsTableTest.java deleted file mode 100644 index 1b09889ec3d..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/groups/AddUuidColumnToGroupsTableTest.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.groups; - -import java.sql.SQLException; -import java.sql.Types; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.assertj.core.api.Assertions.assertThat; - -public class AddUuidColumnToGroupsTableTest { - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(AddUuidColumnToGroupsTableTest.class, "schema.sql"); - private DdlChange underTest = new AddUuidColumnToGroupsTable(db.database()); - - @Before - public void setup() { - insertGroups(1L); - insertGroups(2L); - insertGroups(3L); - } - - @Test - public void add_uuid_column() throws SQLException { - underTest.execute(); - - db.assertColumnDefinition("groups", "uuid", Types.VARCHAR, 40, true); - - assertThat(db.countRowsOfTable("groups")) - .isEqualTo(3); - } - - private void insertGroups(Long id) { - db.executeInsert("groups", - "id", id, - "organization_uuid", "org" + id, - "name", "name" + id); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/groups/DropIdColumnOfGroupsTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/groups/DropIdColumnOfGroupsTableTest.java deleted file mode 100644 index ac61ae1def1..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/groups/DropIdColumnOfGroupsTableTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.groups; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.assertj.core.api.Assertions.assertThatThrownBy; - -public class DropIdColumnOfGroupsTableTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DropIdColumnOfGroupsTableTest.class, "schema.sql"); - - private DdlChange underTest = new DropIdColumnOfGroupsTable(db.database()); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertColumnDoesNotExist("groups", "id"); - } - - @Test - public void migration_is_not_re_entrant() throws SQLException { - underTest.execute(); - - assertThatThrownBy(() -> underTest.execute()).isInstanceOf(IllegalStateException.class); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/groups/DropPrimaryKeyOnIdColumnOfGroupsTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/groups/DropPrimaryKeyOnIdColumnOfGroupsTableTest.java deleted file mode 100644 index 99723e8f692..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/groups/DropPrimaryKeyOnIdColumnOfGroupsTableTest.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.groups; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.sql.DbPrimaryKeyConstraintFinder; -import org.sonar.server.platform.db.migration.sql.DropPrimaryKeySqlGenerator; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class DropPrimaryKeyOnIdColumnOfGroupsTableTest { - - private static final String TABLE_NAME = "groups"; - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DropPrimaryKeyOnIdColumnOfGroupsTableTest.class, "schema.sql"); - - private final DropPrimaryKeySqlGenerator dropPrimaryKeySqlGenerator = new DropPrimaryKeySqlGenerator(db.database(), new DbPrimaryKeyConstraintFinder(db.database())); - - private final DdlChange underTest = new DropPrimaryKeyOnIdColumnOfGroupsTable(db.database(), dropPrimaryKeySqlGenerator); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertNoPrimaryKey(TABLE_NAME); - } - - @Test - public void migration_is_re_entrant_but_fails_silently() throws SQLException { - underTest.execute(); - underTest.execute(); - - db.assertNoPrimaryKey(TABLE_NAME); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/groups/MakeGroupsUuidColumnNotNullableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/groups/MakeGroupsUuidColumnNotNullableTest.java deleted file mode 100644 index a61e9da240c..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/groups/MakeGroupsUuidColumnNotNullableTest.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.groups; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -import static java.sql.Types.VARCHAR; - -public class MakeGroupsUuidColumnNotNullableTest { - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(MakeGroupsUuidColumnNotNullableTest.class, "schema.sql"); - - private MigrationStep underTest = new MakeGroupsUuidColumnNotNullable(db.database()); - - @Test - public void uuid_column_is_not_nullable() throws SQLException { - underTest.execute(); - - db.assertColumnDefinition("groups", "uuid", VARCHAR, null, false); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/groups/PopulateGroupsUuidTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/groups/PopulateGroupsUuidTest.java deleted file mode 100644 index f541540434c..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/groups/PopulateGroupsUuidTest.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.groups; - -import java.sql.SQLException; -import java.util.Objects; -import java.util.stream.Collectors; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.core.util.UuidFactory; -import org.sonar.core.util.UuidFactoryFast; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DataChange; - -import static org.assertj.core.api.Assertions.assertThat; - -public class PopulateGroupsUuidTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(PopulateGroupsUuidTest.class, "schema.sql"); - - private UuidFactory uuidFactory = UuidFactoryFast.getInstance(); - private DataChange underTest = new PopulateGroupsUuid(db.database(), uuidFactory); - - @Test - public void populate_uuids() throws SQLException { - insertGroups(1L); - insertGroups(2L); - insertGroups(3L); - - underTest.execute(); - - verifyUuidsAreNotNull(); - } - - @Test - public void migration_is_reentrant() throws SQLException { - insertGroups(1L); - insertGroups(2L); - insertGroups(3L); - - underTest.execute(); - // re-entrant - underTest.execute(); - - verifyUuidsAreNotNull(); - } - - private void verifyUuidsAreNotNull() { - assertThat(db.select("select uuid from groups") - .stream() - .map(row -> row.get("UUID")) - .filter(Objects::isNull) - .collect(Collectors.toList())).isEmpty(); - } - - private void insertGroups(Long id) { - db.executeInsert("groups", - "id", id, - "organization_uuid", "org" + id, - "name", "name" + id); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/groups/grouproles/AddGroupUuidColumnToGroupRolesTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/groups/grouproles/AddGroupUuidColumnToGroupRolesTest.java deleted file mode 100644 index 495c3071073..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/groups/grouproles/AddGroupUuidColumnToGroupRolesTest.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.groups.grouproles; - -import java.sql.SQLException; -import java.sql.Types; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.assertj.core.api.Assertions.assertThat; - -public class AddGroupUuidColumnToGroupRolesTest { - private static final String TABLE_NAME = "group_roles"; - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(AddGroupUuidColumnToGroupRolesTest.class, "schema.sql"); - private DdlChange underTest = new AddGroupUuidColumnToGroupRoles(db.database()); - - @Before - public void setup() { - insertGroupRole(1L); - insertGroupRole(2L); - insertGroupRole(3L); - } - - @Test - public void add_active_rule_uuid_column() throws SQLException { - underTest.execute(); - - db.assertColumnDefinition(TABLE_NAME, "group_uuid", Types.VARCHAR, 40, true); - - assertThat(db.countRowsOfTable(TABLE_NAME)) - .isEqualTo(3); - } - - private void insertGroupRole(Long id) { - db.executeInsert(TABLE_NAME, - "uuid", "uuid" + id, - "group_id", id + 1, - "role", "role" + id, - "organization_uuid", "org" + id - ); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/groups/grouproles/AddIndexOnGroupUuidOfGroupRolesTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/groups/grouproles/AddIndexOnGroupUuidOfGroupRolesTableTest.java deleted file mode 100644 index 5b65cd7a8d4..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/groups/grouproles/AddIndexOnGroupUuidOfGroupRolesTableTest.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.groups.grouproles; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -public class AddIndexOnGroupUuidOfGroupRolesTableTest { - private static final String TABLE_NAME = "group_roles"; - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(AddIndexOnGroupUuidOfGroupRolesTableTest.class, "schema.sql"); - - private MigrationStep underTest = new AddIndexOnGroupUuidOfGroupRolesTable(db.database()); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertUniqueIndex(TABLE_NAME, "uniq_group_roles", "organization_uuid", "group_uuid", - "component_uuid", "role"); - } - - @Test - public void migration_is_re_entrant() throws SQLException { - underTest.execute(); - - // re-entrant - underTest.execute(); - - db.assertUniqueIndex(TABLE_NAME, "uniq_group_roles", "organization_uuid", "group_uuid", - "component_uuid", "role"); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/groups/grouproles/DropGroupIdColumnOfGroupRolesTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/groups/grouproles/DropGroupIdColumnOfGroupRolesTableTest.java deleted file mode 100644 index 009b7bebea0..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/groups/grouproles/DropGroupIdColumnOfGroupRolesTableTest.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.groups.grouproles; - -import java.sql.SQLException; -import java.sql.Types; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.assertj.core.api.Assertions.assertThatThrownBy; - -public class DropGroupIdColumnOfGroupRolesTableTest { - private static final String TABLE_NAME = "group_roles"; - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DropGroupIdColumnOfGroupRolesTableTest.class, "schema.sql"); - - private DdlChange underTest = new DropGroupIdColumnOfGroupRolesTable(db.database()); - - @Test - public void execute() throws SQLException { - db.assertColumnDefinition(TABLE_NAME, "group_id", Types.INTEGER, null, true); - underTest.execute(); - db.assertColumnDoesNotExist(TABLE_NAME, "group_id"); - } - - @Test - public void migration_is_not_re_entrant() throws SQLException { - underTest.execute(); - - assertThatThrownBy(() -> underTest.execute()).isInstanceOf(IllegalStateException.class); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/groups/grouproles/DropIndexOnGroupIdOfGroupRolesTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/groups/grouproles/DropIndexOnGroupIdOfGroupRolesTableTest.java deleted file mode 100644 index 303b6f332f3..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/groups/grouproles/DropIndexOnGroupIdOfGroupRolesTableTest.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.groups.grouproles; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -public class DropIndexOnGroupIdOfGroupRolesTableTest { - private static final String TABLE_NAME = "group_roles"; - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DropIndexOnGroupIdOfGroupRolesTableTest.class, "schema.sql"); - - private MigrationStep underTest = new DropIndexOnGroupIdOfGroupRolesTable(db.database()); - - @Test - public void execute() throws SQLException { - db.assertTableExists(TABLE_NAME); - db.assertUniqueIndex(TABLE_NAME, "uniq_group_roles", "organization_uuid", "group_id", - "component_uuid", "role"); - - underTest.execute(); - - db.assertIndexDoesNotExist(TABLE_NAME, "uniq_group_roles"); - } - - @Test - public void migration_is_re_entrant() throws SQLException { - underTest.execute(); - - // re-entrant - underTest.execute(); - - db.assertIndexDoesNotExist(TABLE_NAME, "uniq_group_roles"); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/groups/grouproles/PopulateGroupRolesGroupUuidTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/groups/grouproles/PopulateGroupRolesGroupUuidTest.java deleted file mode 100644 index 42b29de2537..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/groups/grouproles/PopulateGroupRolesGroupUuidTest.java +++ /dev/null @@ -1,124 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.groups.grouproles; - -import java.sql.SQLException; -import java.util.List; -import java.util.Map; -import org.assertj.core.groups.Tuple; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DataChange; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.tuple; - -public class PopulateGroupRolesGroupUuidTest { - private static final String TABLE_NAME = "group_roles"; - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(PopulateGroupRolesGroupUuidTest.class, "schema.sql"); - - private DataChange underTest = new PopulateGroupRolesGroupUuid(db.database()); - - @Test - public void populate_uuids() throws SQLException { - insertGroup(1L); - insertGroup(2L); - insertGroup(3L); - - insertGroupRole(4L, 1L); - insertGroupRole(5L, 2L); - insertGroupRole(6L, 3L); - - underTest.execute(); - - assertThatTableContains( - tuple("uuid4", 1L, "uuid1"), - tuple("uuid5", 2L, "uuid2"), - tuple("uuid6", 3L, "uuid3") - ); - } - - @Test - public void delete_orphan_rows() throws SQLException { - insertGroup(1L); - insertGroup(2L); - insertGroup(3L); - - insertGroupRole(4L, 1L); - insertGroupRole(5L, 2L); - insertGroupRole(6L, 10L); - insertGroupRole(7L, null); - - underTest.execute(); - - assertThatTableContains( - tuple("uuid4", 1L, "uuid1"), - tuple("uuid5", 2L, "uuid2"), - tuple("uuid7", null, null) - ); - } - - @Test - public void migration_is_reentrant() throws SQLException { - insertGroup(1L); - insertGroup(2L); - insertGroup(3L); - - insertGroupRole(4L, 1L); - insertGroupRole(5L, 2L); - insertGroupRole(6L, 3L); - - underTest.execute(); - // re-entrant - underTest.execute(); - - assertThatTableContains( - tuple("uuid4", 1L, "uuid1"), - tuple("uuid5", 2L, "uuid2"), - tuple("uuid6", 3L, "uuid3") - ); - } - - private void assertThatTableContains(Tuple... tuples) { - List> select = db.select("select uuid, group_id, group_uuid from " + TABLE_NAME); - assertThat(select).extracting(m -> m.get("UUID"), m -> m.get("GROUP_ID"), m -> m.get("GROUP_UUID")) - .containsExactlyInAnyOrder(tuples); - } - - private void insertGroup(Long id) { - db.executeInsert("groups", - "id", id, - "uuid", "uuid" + id, - "organization_uuid", "org" + id, - "name", "name" + id); - } - - private void insertGroupRole(Long id, Long groupId) { - db.executeInsert(TABLE_NAME, - "uuid", "uuid" + id, - "group_id", groupId, - "role", "role" + id, - "organization_uuid", "org" + id - ); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/groups/groupsusers/AddGroupUuidColumnToGroupsUsersTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/groups/groupsusers/AddGroupUuidColumnToGroupsUsersTest.java deleted file mode 100644 index e0be9603b6a..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/groups/groupsusers/AddGroupUuidColumnToGroupsUsersTest.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.groups.groupsusers; - -import java.sql.SQLException; -import java.sql.Types; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.assertj.core.api.Assertions.assertThat; - -public class AddGroupUuidColumnToGroupsUsersTest { - private static final String TABLE_NAME = "groups_users"; - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(AddGroupUuidColumnToGroupsUsersTest.class, "schema.sql"); - private DdlChange underTest = new AddGroupUuidColumnToGroupsUsers(db.database()); - - @Before - public void setup() { - insertGroupsUser(1L); - insertGroupsUser(2L); - insertGroupsUser(3L); - } - - @Test - public void add_active_rule_uuid_column() throws SQLException { - underTest.execute(); - - db.assertColumnDefinition(TABLE_NAME, "group_uuid", Types.VARCHAR, 40, true); - - assertThat(db.countRowsOfTable(TABLE_NAME)) - .isEqualTo(3); - } - - private void insertGroupsUser(Long id) { - db.executeInsert(TABLE_NAME, - "user_id", id, - "group_id", id + 1 - ); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/groups/groupsusers/AddIndexOnGroupUuidOfGroupsUsersTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/groups/groupsusers/AddIndexOnGroupUuidOfGroupsUsersTableTest.java deleted file mode 100644 index a8b86141a54..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/groups/groupsusers/AddIndexOnGroupUuidOfGroupsUsersTableTest.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.groups.groupsusers; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -public class AddIndexOnGroupUuidOfGroupsUsersTableTest { - private static final String TABLE_NAME = "groups_users"; - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(AddIndexOnGroupUuidOfGroupsUsersTableTest.class, "schema.sql"); - - private MigrationStep underTest = new AddIndexOnGroupUuidOfGroupsUsersTable(db.database()); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertIndex(TABLE_NAME, "index_groups_users_group_uuid", "group_uuid"); - db.assertUniqueIndex(TABLE_NAME, "groups_users_unique", "group_uuid", "user_id"); - } - - @Test - public void migration_is_re_entrant() throws SQLException { - underTest.execute(); - - // re-entrant - underTest.execute(); - - db.assertIndex(TABLE_NAME, "index_groups_users_group_uuid", "group_uuid"); - db.assertUniqueIndex(TABLE_NAME, "groups_users_unique", "group_uuid", "user_id"); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/groups/groupsusers/DropGroupIdColumnOfGroupsUsersTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/groups/groupsusers/DropGroupIdColumnOfGroupsUsersTableTest.java deleted file mode 100644 index 2467e0df2c0..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/groups/groupsusers/DropGroupIdColumnOfGroupsUsersTableTest.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.groups.groupsusers; - -import java.sql.SQLException; -import java.sql.Types; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.assertj.core.api.Assertions.assertThatThrownBy; - -public class DropGroupIdColumnOfGroupsUsersTableTest { - private static final String TABLE_NAME = "groups_users"; - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DropGroupIdColumnOfGroupsUsersTableTest.class, "schema.sql"); - - private DdlChange underTest = new DropGroupIdColumnOfGroupsUsersTable(db.database()); - - @Test - public void execute() throws SQLException { - db.assertColumnDefinition(TABLE_NAME, "group_id", Types.BIGINT, null, true); - underTest.execute(); - db.assertColumnDoesNotExist(TABLE_NAME, "group_id"); - } - - @Test - public void migration_is_not_re_entrant() throws SQLException { - underTest.execute(); - - assertThatThrownBy(() -> underTest.execute()).isInstanceOf(IllegalStateException.class); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/groups/groupsusers/DropIndexOnGroupIdOfGroupsUsersTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/groups/groupsusers/DropIndexOnGroupIdOfGroupsUsersTableTest.java deleted file mode 100644 index 0d7f36e5cfd..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/groups/groupsusers/DropIndexOnGroupIdOfGroupsUsersTableTest.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.groups.groupsusers; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -public class DropIndexOnGroupIdOfGroupsUsersTableTest { - private static final String TABLE_NAME = "groups_users"; - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DropIndexOnGroupIdOfGroupsUsersTableTest.class, "schema.sql"); - - private MigrationStep underTest = new DropIndexOnGroupIdOfGroupsUsersTable(db.database()); - - @Test - public void execute() throws SQLException { - db.assertTableExists(TABLE_NAME); - db.assertIndex(TABLE_NAME, "index_groups_users_on_group_id", "group_id"); - db.assertUniqueIndex(TABLE_NAME, "groups_users_unique", "group_id", "user_id"); - - underTest.execute(); - - db.assertIndexDoesNotExist(TABLE_NAME, "index_groups_users_on_group_id"); - db.assertIndexDoesNotExist(TABLE_NAME, "groups_users_unique"); - - } - - @Test - public void migration_is_re_entrant() throws SQLException { - underTest.execute(); - - // re-entrant - underTest.execute(); - - db.assertIndexDoesNotExist(TABLE_NAME, "index_groups_users_on_group_id"); - db.assertIndexDoesNotExist(TABLE_NAME, "groups_users_unique"); - - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/groups/groupsusers/MakeGroupsUsersGroupUuidNotNullableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/groups/groupsusers/MakeGroupsUsersGroupUuidNotNullableTest.java deleted file mode 100644 index 0a9739a87d4..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/groups/groupsusers/MakeGroupsUsersGroupUuidNotNullableTest.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.groups.groupsusers; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -import static java.sql.Types.VARCHAR; - -public class MakeGroupsUsersGroupUuidNotNullableTest { - private static final String TABLE_NAME = "groups_users"; - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(MakeGroupsUsersGroupUuidNotNullableTest.class, "schema.sql"); - - private MigrationStep underTest = new MakeGroupsUsersGroupUuidNotNullable(db.database()); - - @Test - public void uuid_column_is_not_null() throws SQLException { - underTest.execute(); - - db.assertColumnDefinition(TABLE_NAME, "group_uuid", VARCHAR, null, false); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/groups/groupsusers/PopulateGroupsUsersGroupUuidTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/groups/groupsusers/PopulateGroupsUsersGroupUuidTest.java deleted file mode 100644 index 4df6e5a050c..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/groups/groupsusers/PopulateGroupsUsersGroupUuidTest.java +++ /dev/null @@ -1,121 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.groups.groupsusers; - -import java.sql.SQLException; -import java.util.List; -import java.util.Map; -import org.assertj.core.groups.Tuple; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DataChange; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.tuple; - -public class PopulateGroupsUsersGroupUuidTest { - private static final String TABLE_NAME = "groups_users"; - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(PopulateGroupsUsersGroupUuidTest.class, "schema.sql"); - - private DataChange underTest = new PopulateGroupsUsersGroupUuid(db.database()); - - @Test - public void populate_uuids() throws SQLException { - insertGroup(1L); - insertGroup(2L); - insertGroup(3L); - - insertGroupsUser(4L, 1L); - insertGroupsUser(5L, 2L); - insertGroupsUser(6L, 3L); - - underTest.execute(); - - assertThatTableContains( - tuple(1L, "uuid1"), - tuple(2L, "uuid2"), - tuple(3L, "uuid3") - ); - } - - @Test - public void delete_orphan_rows() throws SQLException { - insertGroup(1L); - insertGroup(2L); - insertGroup(3L); - - insertGroupsUser(4L, 1L); - insertGroupsUser(5L, 2L); - insertGroupsUser(6L, 10L); - insertGroupsUser(7L, null); - - underTest.execute(); - - assertThatTableContains( - tuple(1L, "uuid1"), - tuple(2L, "uuid2"), - tuple(null, null) - ); - } - - @Test - public void migration_is_reentrant() throws SQLException { - insertGroup(1L); - insertGroup(2L); - insertGroup(3L); - - insertGroupsUser(4L, 1L); - insertGroupsUser(5L, 2L); - insertGroupsUser(6L, 3L); - - underTest.execute(); - // re-entrant - underTest.execute(); - - assertThatTableContains( - tuple( 1L, "uuid1"), - tuple(2L, "uuid2"), - tuple(3L, "uuid3") - ); - } - - private void assertThatTableContains(Tuple... tuples) { - List> select = db.select("select group_id, group_uuid from " + TABLE_NAME); - assertThat(select).extracting( m -> m.get("GROUP_ID"), m -> m.get("GROUP_UUID")) - .containsExactlyInAnyOrder(tuples); - } - - private void insertGroup(Long id) { - db.executeInsert("groups", - "id", id, - "uuid", "uuid" + id, - "organization_uuid", "org" + id); - } - - private void insertGroupsUser(Long id, Long group) { - db.executeInsert(TABLE_NAME, - "user_id", id, - "group_id", group - ); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/groups/organizations/AddDefaultGroupUuidColumnToOrganizationsTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/groups/organizations/AddDefaultGroupUuidColumnToOrganizationsTest.java deleted file mode 100644 index c044edc3bfd..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/groups/organizations/AddDefaultGroupUuidColumnToOrganizationsTest.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.groups.organizations; - -import java.sql.SQLException; -import java.sql.Types; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.assertj.core.api.Assertions.assertThat; - -public class AddDefaultGroupUuidColumnToOrganizationsTest { - private static final String TABLE_NAME = "organizations"; - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(AddDefaultGroupUuidColumnToOrganizationsTest.class, "schema.sql"); - private DdlChange underTest = new AddDefaultGroupUuidColumnToOrganizations(db.database()); - - @Before - public void setup() { - insertOrganization(1L); - insertOrganization(2L); - insertOrganization(3L); - } - - @Test - public void add_active_rule_uuid_column() throws SQLException { - underTest.execute(); - - db.assertColumnDefinition(TABLE_NAME, "default_group_uuid", Types.VARCHAR, 40, true); - - assertThat(db.countRowsOfTable(TABLE_NAME)) - .isEqualTo(3); - } - - private void insertOrganization(Long id) { - db.executeInsert(TABLE_NAME, - "uuid", "uuid" + id, - "kee", "kee" + id, - "name", "name" + id, - "default_quality_gate_uuid", "default_quality_gate_uuid" + id, - "new_project_private", true, - "subscription", "subscription" + id, - "created_at", id + 1, - "updated_at", id + 2 - ); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/groups/organizations/DropDefaultGroupIdColumnOfOrganizationsTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/groups/organizations/DropDefaultGroupIdColumnOfOrganizationsTableTest.java deleted file mode 100644 index 2fa7598cb47..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/groups/organizations/DropDefaultGroupIdColumnOfOrganizationsTableTest.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.groups.organizations; - -import java.sql.SQLException; -import java.sql.Types; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.assertj.core.api.Assertions.assertThatThrownBy; - -public class DropDefaultGroupIdColumnOfOrganizationsTableTest { - private static final String TABLE_NAME = "organizations"; - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DropDefaultGroupIdColumnOfOrganizationsTableTest.class, "schema.sql"); - - private DdlChange underTest = new DropDefaultGroupIdColumnOfOrganizationsTable(db.database()); - - @Test - public void execute() throws SQLException { - db.assertColumnDefinition(TABLE_NAME, "default_group_id", Types.INTEGER, null, true); - underTest.execute(); - db.assertColumnDoesNotExist(TABLE_NAME, "default_group_id"); - } - - @Test - public void migration_is_not_re_entrant() throws SQLException { - underTest.execute(); - - assertThatThrownBy(() -> underTest.execute()).isInstanceOf(IllegalStateException.class); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/groups/organizations/PopulateOrganizationsDefaultGroupUuidTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/groups/organizations/PopulateOrganizationsDefaultGroupUuidTest.java deleted file mode 100644 index 45b71d18201..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/groups/organizations/PopulateOrganizationsDefaultGroupUuidTest.java +++ /dev/null @@ -1,128 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.groups.organizations; - -import java.sql.SQLException; -import java.util.List; -import java.util.Map; -import org.assertj.core.groups.Tuple; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DataChange; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.tuple; - -public class PopulateOrganizationsDefaultGroupUuidTest { - private static final String TABLE_NAME = "organizations"; - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(PopulateOrganizationsDefaultGroupUuidTest.class, "schema.sql"); - - private DataChange underTest = new PopulateOrganizationsDefaultGroupUuid(db.database()); - - @Test - public void populate_uuids() throws SQLException { - insertGroup(1L); - insertGroup(2L); - insertGroup(3L); - - insertOrganization(4L, 1L); - insertOrganization(5L, 2L); - insertOrganization(6L, 3L); - - underTest.execute(); - - assertThatTableContains( - tuple("uuid4", 1L, "uuid1"), - tuple("uuid5", 2L, "uuid2"), - tuple("uuid6", 3L, "uuid3") - ); - } - - @Test - public void delete_orphan_rows() throws SQLException { - insertGroup(1L); - insertGroup(2L); - insertGroup(3L); - - insertOrganization(4L, 1L); - insertOrganization(5L, 2L); - insertOrganization(6L, 10L); - insertOrganization(7L, null); - - underTest.execute(); - - assertThatTableContains( - tuple("uuid4", 1L, "uuid1"), - tuple("uuid5", 2L, "uuid2"), - tuple("uuid7", null, null) - ); - } - - @Test - public void migration_is_reentrant() throws SQLException { - insertGroup(1L); - insertGroup(2L); - insertGroup(3L); - - insertOrganization(4L, 1L); - insertOrganization(5L, 2L); - insertOrganization(6L, 3L); - - underTest.execute(); - // re-entrant - underTest.execute(); - - assertThatTableContains( - tuple("uuid4", 1L, "uuid1"), - tuple("uuid5", 2L, "uuid2"), - tuple("uuid6", 3L, "uuid3") - ); - } - - private void assertThatTableContains(Tuple... tuples) { - List> select = db.select("select uuid, default_group_id, default_group_uuid from " + TABLE_NAME); - assertThat(select).extracting(m -> m.get("UUID"), m -> m.get("DEFAULT_GROUP_ID"), m -> m.get("DEFAULT_GROUP_UUID")) - .containsExactlyInAnyOrder(tuples); - } - - private void insertGroup(Long id) { - db.executeInsert("groups", - "id", id, - "uuid", "uuid" + id, - "organization_uuid", "org" + id); - } - - private void insertOrganization(Long id, Long groupId) { - db.executeInsert(TABLE_NAME, - "uuid", "uuid" + id, - "kee", "kee" + id, - "name", "name" + id, - "default_group_id", groupId, - "default_quality_gate_uuid", "default_quality_gate_uuid" + id, - "new_project_private", true, - "subscription", "subscription" + id, - "created_at", id + 1, - "updated_at", id + 2 - ); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/groups/permtemplatesgroups/AddGroupUuidColumnToPermTemplatesGroupsTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/groups/permtemplatesgroups/AddGroupUuidColumnToPermTemplatesGroupsTest.java deleted file mode 100644 index c89cb74aa75..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/groups/permtemplatesgroups/AddGroupUuidColumnToPermTemplatesGroupsTest.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.groups.permtemplatesgroups; - -import java.sql.SQLException; -import java.sql.Types; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.assertj.core.api.Assertions.assertThat; - -public class AddGroupUuidColumnToPermTemplatesGroupsTest { - private static final String TABLE_NAME = "perm_templates_groups"; - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(AddGroupUuidColumnToPermTemplatesGroupsTest.class, "schema.sql"); - private DdlChange underTest = new AddGroupUuidColumnToPermTemplatesGroups(db.database()); - - @Before - public void setup() { - insertPermTemplatesGroup(1L); - insertPermTemplatesGroup(2L); - insertPermTemplatesGroup(3L); - } - - @Test - public void add_active_rule_uuid_column() throws SQLException { - underTest.execute(); - - db.assertColumnDefinition(TABLE_NAME, "group_uuid", Types.VARCHAR, 40, true); - - assertThat(db.countRowsOfTable(TABLE_NAME)) - .isEqualTo(3); - } - - private void insertPermTemplatesGroup(Long id) { - db.executeInsert(TABLE_NAME, - "uuid", "uuid" + id, - "group_id", id + 1, - "permission_reference", "permission_reference" + id, - "template_id", id + 2 - ); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/groups/permtemplatesgroups/DropGroupIdColumnOfPermTemplatesGroupsTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/groups/permtemplatesgroups/DropGroupIdColumnOfPermTemplatesGroupsTableTest.java deleted file mode 100644 index 26863c6b892..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/groups/permtemplatesgroups/DropGroupIdColumnOfPermTemplatesGroupsTableTest.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.groups.permtemplatesgroups; - -import java.sql.SQLException; -import java.sql.Types; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.assertj.core.api.Assertions.assertThatThrownBy; - -public class DropGroupIdColumnOfPermTemplatesGroupsTableTest { - private static final String TABLE_NAME = "perm_templates_groups"; - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DropGroupIdColumnOfPermTemplatesGroupsTableTest.class, "schema.sql"); - - private DdlChange underTest = new DropGroupIdColumnOfPermTemplatesGroupsTable(db.database()); - - @Test - public void execute() throws SQLException { - db.assertColumnDefinition(TABLE_NAME, "group_id", Types.INTEGER, null, true); - underTest.execute(); - db.assertColumnDoesNotExist(TABLE_NAME, "group_id"); - } - - @Test - public void migration_is_not_re_entrant() throws SQLException { - underTest.execute(); - - assertThatThrownBy(() -> underTest.execute()).isInstanceOf(IllegalStateException.class); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/groups/permtemplatesgroups/PopulatePermTemplatesGroupsGroupUuidTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/groups/permtemplatesgroups/PopulatePermTemplatesGroupsGroupUuidTest.java deleted file mode 100644 index 0dacab28d33..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/groups/permtemplatesgroups/PopulatePermTemplatesGroupsGroupUuidTest.java +++ /dev/null @@ -1,123 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.groups.permtemplatesgroups; - -import java.sql.SQLException; -import java.util.List; -import java.util.Map; -import org.assertj.core.groups.Tuple; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DataChange; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.tuple; - -public class PopulatePermTemplatesGroupsGroupUuidTest { - private static final String TABLE_NAME = "perm_templates_groups"; - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(PopulatePermTemplatesGroupsGroupUuidTest.class, "schema.sql"); - - private DataChange underTest = new PopulatePermTemplatesGroupsGroupUuid(db.database()); - - @Test - public void populate_uuids() throws SQLException { - insertGroup(1L); - insertGroup(2L); - insertGroup(3L); - - insertPermTemplatesGroup(4L, 1L); - insertPermTemplatesGroup(5L, 2L); - insertPermTemplatesGroup(6L, 3L); - - underTest.execute(); - - assertThatTableContains( - tuple("uuid4", 1L, "uuid1"), - tuple("uuid5", 2L, "uuid2"), - tuple("uuid6", 3L, "uuid3") - ); - } - - @Test - public void delete_orphan_rows() throws SQLException { - insertGroup(1L); - insertGroup(2L); - insertGroup(3L); - - insertPermTemplatesGroup(4L, 1L); - insertPermTemplatesGroup(5L, 2L); - insertPermTemplatesGroup(6L, 10L); - insertPermTemplatesGroup(7L, null); - - underTest.execute(); - - assertThatTableContains( - tuple("uuid4", 1L, "uuid1"), - tuple("uuid5", 2L, "uuid2"), - tuple("uuid7", null, null) - ); - } - - @Test - public void migration_is_reentrant() throws SQLException { - insertGroup(1L); - insertGroup(2L); - insertGroup(3L); - - insertPermTemplatesGroup(4L, 1L); - insertPermTemplatesGroup(5L, 2L); - insertPermTemplatesGroup(6L, 3L); - - underTest.execute(); - // re-entrant - underTest.execute(); - - assertThatTableContains( - tuple("uuid4", 1L, "uuid1"), - tuple("uuid5", 2L, "uuid2"), - tuple("uuid6", 3L, "uuid3") - ); - } - - private void assertThatTableContains(Tuple... tuples) { - List> select = db.select("select uuid, group_id, group_uuid from " + TABLE_NAME); - assertThat(select).extracting(m -> m.get("UUID"), m -> m.get("GROUP_ID"), m -> m.get("GROUP_UUID")) - .containsExactlyInAnyOrder(tuples); - } - - private void insertGroup(Long id) { - db.executeInsert("groups", - "id", id, - "uuid", "uuid" + id, - "organization_uuid", "org" + id); - } - - private void insertPermTemplatesGroup(Long id, Long groupId) { - db.executeInsert(TABLE_NAME, - "uuid", "uuid" + id, - "group_id", groupId, - "permission_reference", "permission_reference" + id, - "template_id", id + 2 - ); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/groups/qprofileeditgroups/AddGroupUuidColumnToQProfileEditGroupsTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/groups/qprofileeditgroups/AddGroupUuidColumnToQProfileEditGroupsTest.java deleted file mode 100644 index 4d18844342c..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/groups/qprofileeditgroups/AddGroupUuidColumnToQProfileEditGroupsTest.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.groups.qprofileeditgroups; - -import java.sql.SQLException; -import java.sql.Types; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.assertj.core.api.Assertions.assertThat; - -public class AddGroupUuidColumnToQProfileEditGroupsTest { - private static final String TABLE_NAME = "qprofile_edit_groups"; - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(AddGroupUuidColumnToQProfileEditGroupsTest.class, "schema.sql"); - private DdlChange underTest = new AddGroupUuidColumnToQProfileEditGroups(db.database()); - - @Before - public void setup() { - insertQProfileEditGroup(1L); - insertQProfileEditGroup(2L); - insertQProfileEditGroup(3L); - } - - @Test - public void add_active_rule_uuid_column() throws SQLException { - underTest.execute(); - - db.assertColumnDefinition(TABLE_NAME, "group_uuid", Types.VARCHAR, 40, true); - - assertThat(db.countRowsOfTable(TABLE_NAME)) - .isEqualTo(3); - } - - private void insertQProfileEditGroup(Long id) { - db.executeInsert(TABLE_NAME, - "uuid", "uuid" + id, - "group_id", id + 1, - "qprofile_uuid", "qprofile_uuid" + id, - "created_at", id + 3); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/groups/qprofileeditgroups/AddIndexOnGroupUuidOfQProfileEditGroupsTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/groups/qprofileeditgroups/AddIndexOnGroupUuidOfQProfileEditGroupsTableTest.java deleted file mode 100644 index 5946abc9696..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/groups/qprofileeditgroups/AddIndexOnGroupUuidOfQProfileEditGroupsTableTest.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.groups.qprofileeditgroups; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -public class AddIndexOnGroupUuidOfQProfileEditGroupsTableTest { - private static final String TABLE_NAME = "qprofile_edit_groups"; - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(AddIndexOnGroupUuidOfQProfileEditGroupsTableTest.class, "schema.sql"); - - private MigrationStep underTest = new AddIndexOnGroupUuidOfQProfileEditGroupsTable(db.database()); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertUniqueIndex(TABLE_NAME, "qprofile_edit_groups_unique", "group_uuid", "qprofile_uuid"); - } - - @Test - public void migration_is_re_entrant() throws SQLException { - underTest.execute(); - - // re-entrant - underTest.execute(); - - db.assertUniqueIndex(TABLE_NAME, "qprofile_edit_groups_unique", "group_uuid", "qprofile_uuid"); - - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/groups/qprofileeditgroups/DropGroupIdColumnOfQProfileEditGroupsTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/groups/qprofileeditgroups/DropGroupIdColumnOfQProfileEditGroupsTableTest.java deleted file mode 100644 index 1f43331afc0..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/groups/qprofileeditgroups/DropGroupIdColumnOfQProfileEditGroupsTableTest.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.groups.qprofileeditgroups; - -import java.sql.SQLException; -import java.sql.Types; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.assertj.core.api.Assertions.assertThatThrownBy; - -public class DropGroupIdColumnOfQProfileEditGroupsTableTest { - private static final String TABLE_NAME = "qprofile_edit_groups"; - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DropGroupIdColumnOfQProfileEditGroupsTableTest.class, "schema.sql"); - - private DdlChange underTest = new DropGroupIdColumnOfQProfileEditGroupsTable(db.database()); - - @Test - public void execute() throws SQLException { - db.assertColumnDefinition(TABLE_NAME, "group_id", Types.INTEGER, null, false); - underTest.execute(); - db.assertColumnDoesNotExist(TABLE_NAME, "group_id"); - } - - @Test - public void migration_is_not_re_entrant() throws SQLException { - underTest.execute(); - - assertThatThrownBy(() -> underTest.execute()).isInstanceOf(IllegalStateException.class); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/groups/qprofileeditgroups/DropIndexOnGroupIdOfQProfileEditGroupsTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/groups/qprofileeditgroups/DropIndexOnGroupIdOfQProfileEditGroupsTableTest.java deleted file mode 100644 index 165ed7d3ae2..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/groups/qprofileeditgroups/DropIndexOnGroupIdOfQProfileEditGroupsTableTest.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.groups.qprofileeditgroups; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -public class DropIndexOnGroupIdOfQProfileEditGroupsTableTest { - private static final String TABLE_NAME = "qprofile_edit_groups"; - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DropIndexOnGroupIdOfQProfileEditGroupsTableTest.class, "schema.sql"); - - private MigrationStep underTest = new DropIndexOnGroupIdOfQProfileEditGroupsTable(db.database()); - - @Test - public void execute() throws SQLException { - db.assertTableExists(TABLE_NAME); - db.assertUniqueIndex(TABLE_NAME, "qprofile_edit_groups_unique", "group_id", "qprofile_uuid"); - - - underTest.execute(); - - db.assertIndexDoesNotExist(TABLE_NAME, "qprofile_edit_groups_unique"); - } - - @Test - public void migration_is_re_entrant() throws SQLException { - underTest.execute(); - - // re-entrant - underTest.execute(); - - db.assertIndexDoesNotExist(TABLE_NAME, "qprofile_edit_groups_unique"); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/groups/qprofileeditgroups/MakeQProfileEditGroupsGroupUuidNotNullableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/groups/qprofileeditgroups/MakeQProfileEditGroupsGroupUuidNotNullableTest.java deleted file mode 100644 index 38723a7d884..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/groups/qprofileeditgroups/MakeQProfileEditGroupsGroupUuidNotNullableTest.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.groups.qprofileeditgroups; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -import static java.sql.Types.VARCHAR; - -public class MakeQProfileEditGroupsGroupUuidNotNullableTest { - private static final String TABLE_NAME = "qprofile_edit_groups"; - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(MakeQProfileEditGroupsGroupUuidNotNullableTest.class, "schema.sql"); - - private MigrationStep underTest = new MakeQProfileEditGroupsGroupUuidNotNullable(db.database()); - - @Test - public void uuid_column_is_not_null() throws SQLException { - underTest.execute(); - - db.assertColumnDefinition(TABLE_NAME, "group_uuid", VARCHAR, null, false); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/groups/qprofileeditgroups/PopulateQProfileEditGroupsGroupUuidTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/groups/qprofileeditgroups/PopulateQProfileEditGroupsGroupUuidTest.java deleted file mode 100644 index 3fdf198d9db..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/groups/qprofileeditgroups/PopulateQProfileEditGroupsGroupUuidTest.java +++ /dev/null @@ -1,120 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.groups.qprofileeditgroups; - -import java.sql.SQLException; -import java.util.List; -import java.util.Map; -import org.assertj.core.groups.Tuple; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DataChange; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.tuple; - -public class PopulateQProfileEditGroupsGroupUuidTest { - private static final String TABLE_NAME = "qprofile_edit_groups"; - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(PopulateQProfileEditGroupsGroupUuidTest.class, "schema.sql"); - - private DataChange underTest = new PopulateQProfileEditGroupsGroupUuid(db.database()); - - @Test - public void populate_uuids() throws SQLException { - insertGroup(1L); - insertGroup(2L); - insertGroup(3L); - - insertQProfileEditGroup(4L, 1L); - insertQProfileEditGroup(5L, 2L); - insertQProfileEditGroup(6L, 3L); - - underTest.execute(); - - assertThatTableContains( - tuple("uuid4", 1L, "uuid1"), - tuple("uuid5", 2L, "uuid2"), - tuple("uuid6", 3L, "uuid3") - ); - } - - @Test - public void delete_orphan_rows() throws SQLException { - insertGroup(1L); - insertGroup(2L); - insertGroup(3L); - - insertQProfileEditGroup(4L, 1L); - insertQProfileEditGroup(5L, 2L); - insertQProfileEditGroup(6L, 10L); - - underTest.execute(); - - assertThatTableContains( - tuple("uuid4", 1L, "uuid1"), - tuple("uuid5", 2L, "uuid2") - ); - } - - @Test - public void migration_is_reentrant() throws SQLException { - insertGroup(1L); - insertGroup(2L); - insertGroup(3L); - - insertQProfileEditGroup(4L, 1L); - insertQProfileEditGroup(5L, 2L); - insertQProfileEditGroup(6L, 3L); - - underTest.execute(); - // re-entrant - underTest.execute(); - - assertThatTableContains( - tuple("uuid4", 1L, "uuid1"), - tuple("uuid5", 2L, "uuid2"), - tuple("uuid6", 3L, "uuid3") - ); - } - - private void assertThatTableContains(Tuple... tuples) { - List> select = db.select("select uuid, group_id, group_uuid from " + TABLE_NAME); - assertThat(select).extracting(m -> m.get("UUID"), m -> m.get("GROUP_ID"), m -> m.get("GROUP_UUID")) - .containsExactlyInAnyOrder(tuples); - } - - private void insertGroup(Long id) { - db.executeInsert("groups", - "id", id, - "uuid", "uuid" + id, - "organization_uuid", "org" + id); - } - - private void insertQProfileEditGroup(Long id, Long groupId) { - db.executeInsert(TABLE_NAME, - "uuid", "uuid" + id, - "group_id", groupId, - "qprofile_uuid", "qprofile_uuid" + id, - "created_at", id + 3); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/issuechanges/AddIndexOnIssueKeyOfIssueChangesTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/issuechanges/AddIndexOnIssueKeyOfIssueChangesTableTest.java deleted file mode 100644 index bd5adae39eb..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/issuechanges/AddIndexOnIssueKeyOfIssueChangesTableTest.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.issuechanges; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -public class AddIndexOnIssueKeyOfIssueChangesTableTest { - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(AddIndexOnIssueKeyOfIssueChangesTableTest.class, "schema.sql"); - - private MigrationStep underTest = new AddIndexOnIssueKeyOfIssueChangesTable(db.database()); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertIndex("issue_changes", "issue_changes_issue_key", "issue_key"); - } - - @Test - public void migration_is_re_entrant() throws SQLException { - underTest.execute(); - - // re-entrant - underTest.execute(); - - db.assertIndex("issue_changes", "issue_changes_issue_key", "issue_key"); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/issuechanges/AddIndexOnKeeOfIssueChangesTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/issuechanges/AddIndexOnKeeOfIssueChangesTableTest.java deleted file mode 100644 index a989dd6db37..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/issuechanges/AddIndexOnKeeOfIssueChangesTableTest.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.issuechanges; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -public class AddIndexOnKeeOfIssueChangesTableTest { - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(AddIndexOnKeeOfIssueChangesTableTest.class, "schema.sql"); - - private MigrationStep underTest = new AddIndexOnKeeOfIssueChangesTable(db.database()); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertIndex("issue_changes", "issue_changes_kee", "kee"); - } - - @Test - public void migration_is_re_entrant() throws SQLException { - underTest.execute(); - - // re-entrant - underTest.execute(); - - db.assertIndex("issue_changes", "issue_changes_kee", "kee"); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/issuechanges/AddPrimaryKeyOnUuidColumnOfIssueChangesTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/issuechanges/AddPrimaryKeyOnUuidColumnOfIssueChangesTableTest.java deleted file mode 100644 index f6f1399c5aa..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/issuechanges/AddPrimaryKeyOnUuidColumnOfIssueChangesTableTest.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.issuechanges; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.assertj.core.api.Assertions.assertThatThrownBy; - -public class AddPrimaryKeyOnUuidColumnOfIssueChangesTableTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(AddPrimaryKeyOnUuidColumnOfIssueChangesTableTest.class, "schema.sql"); - - private DdlChange underTest = new AddPrimaryKeyOnUuidColumnOfIssueChangesTable(db.database()); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertPrimaryKey("issue_changes", "pk_issue_changes", "uuid"); - } - - @Test - public void migration_is_not_re_entrant() throws SQLException { - underTest.execute(); - - assertThatThrownBy(() -> underTest.execute()).isInstanceOf(IllegalStateException.class); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/issuechanges/CopyIssueChangesTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/issuechanges/CopyIssueChangesTableTest.java deleted file mode 100644 index bf5f0a68e24..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/issuechanges/CopyIssueChangesTableTest.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.issuechanges; - -import java.sql.JDBCType; -import java.sql.SQLException; -import java.sql.Types; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -public class CopyIssueChangesTableTest { - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(CopyIssueChangesTableTest.class, "schema.sql"); - - private MigrationStep underTest = new CopyIssueChangesTable(db.database()); - - @Test - public void execute() throws SQLException { - db.assertTableExists("issue_changes"); - db.assertTableDoesNotExist("issue_changes_copy"); - - underTest.execute(); - db.assertTableExists("issue_changes"); - db.assertTableExists("issue_changes_copy"); - db.assertColumnDefinition("issue_changes_copy", "uuid", Types.VARCHAR, 40, false); - db.assertColumnDefinition("issue_changes_copy", "issue_key", Types.VARCHAR, 50, false); - db.assertColumnDefinition("issue_changes_copy", "updated_at", Types.BIGINT, null, true); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/issuechanges/DropIssueChangesTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/issuechanges/DropIssueChangesTableTest.java deleted file mode 100644 index 7f184f25b7b..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/issuechanges/DropIssueChangesTableTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.issuechanges; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -public class DropIssueChangesTableTest { - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DropIssueChangesTableTest.class, "schema.sql"); - - private MigrationStep underTest = new DropIssueChangesTable(db.database()); - - @Test - public void execute() throws SQLException { - db.assertTableExists("issue_changes"); - underTest.execute(); - db.assertTableDoesNotExist("issue_changes"); - } - - @Test - public void migration_is_re_entrant() throws SQLException { - db.assertTableExists("issue_changes"); - - underTest.execute(); - - // re-entrant - underTest.execute(); - db.assertTableDoesNotExist("issue_changes"); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/issuechanges/RenameIssueChangesCopyToIssueChangesTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/issuechanges/RenameIssueChangesCopyToIssueChangesTest.java deleted file mode 100644 index 31d1ca20438..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/issuechanges/RenameIssueChangesCopyToIssueChangesTest.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.issuechanges; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -public class RenameIssueChangesCopyToIssueChangesTest { - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(RenameIssueChangesCopyToIssueChangesTest.class, "schema.sql"); - - private MigrationStep underTest = new RenameIssueChangesCopyToIssueChanges(db.database()); - - @Test - public void execute() throws SQLException { - db.assertTableExists("issue_changes_copy"); - db.assertTableDoesNotExist("issue_changes"); - - underTest.execute(); - db.assertTableExists("issue_changes"); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/issues/AddPrimaryKeyOnKeeColumnOfIssuesTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/issues/AddPrimaryKeyOnKeeColumnOfIssuesTableTest.java deleted file mode 100644 index 3ceb4a9386a..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/issues/AddPrimaryKeyOnKeeColumnOfIssuesTableTest.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.issues; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; - -import static org.assertj.core.api.Assertions.assertThatThrownBy; - -public class AddPrimaryKeyOnKeeColumnOfIssuesTableTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(AddPrimaryKeyOnKeeColumnOfIssuesTableTest.class, "schema.sql"); - - private AddPrimaryKeyOnKeeColumnOfIssuesTable underTest = new AddPrimaryKeyOnKeeColumnOfIssuesTable(db.database()); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertPrimaryKey("issues", "pk_issues", "kee"); - } - - @Test - public void migration_is_not_re_entrant() throws SQLException { - underTest.execute(); - - assertThatThrownBy(() -> underTest.execute()).isInstanceOf(IllegalStateException.class); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/manualmeasures/AddPrimaryKeyOnUuidColumnOfManualMeasureTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/manualmeasures/AddPrimaryKeyOnUuidColumnOfManualMeasureTableTest.java deleted file mode 100644 index 9436d077595..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/manualmeasures/AddPrimaryKeyOnUuidColumnOfManualMeasureTableTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.manualmeasures; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -import static org.assertj.core.api.Assertions.assertThatThrownBy; - -public class AddPrimaryKeyOnUuidColumnOfManualMeasureTableTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(AddPrimaryKeyOnUuidColumnOfManualMeasureTableTest.class, "schema.sql"); - - private MigrationStep underTest = new AddPrimaryKeyOnUuidColumnOfManualMeasuresTable(db.database()); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertPrimaryKey("manual_measures", "pk_manual_measures", "uuid"); - } - - @Test - public void migration_is_not_re_entrant() throws SQLException { - underTest.execute(); - - assertThatThrownBy(() -> underTest.execute()).isInstanceOf(IllegalStateException.class); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/manualmeasures/AddUuidToManualMeasuresTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/manualmeasures/AddUuidToManualMeasuresTest.java deleted file mode 100644 index f2c9f1f658a..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/manualmeasures/AddUuidToManualMeasuresTest.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.manualmeasures; - -import java.sql.SQLException; -import java.sql.Types; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.core.util.UuidFactory; -import org.sonar.core.util.UuidFactoryFast; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.assertj.core.api.Assertions.assertThat; - -public class AddUuidToManualMeasuresTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(AddUuidToManualMeasuresTest.class, "schema.sql"); - - private UuidFactory uuidFactory = UuidFactoryFast.getInstance(); - - private DdlChange underTest = new AddUuidColumnToManualMeasures(db.database()); - - @Before - public void setup() { - insertManualMeasure(1L); - insertManualMeasure(2L); - insertManualMeasure(3L); - } - - @Test - public void add_uuid_column_to_manual_measures() throws SQLException { - underTest.execute(); - - db.assertColumnDefinition("manual_measures", "uuid", Types.VARCHAR, 40, true); - - assertThat(db.countSql("select count(id) from manual_measures")) - .isEqualTo(3); - } - - private void insertManualMeasure(Long id) { - db.executeInsert("manual_measures", - "id", id, - "metric_id", id + 100, - "component_uuid", uuidFactory.create()); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/manualmeasures/DropIdColumnOfManualMeasuresTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/manualmeasures/DropIdColumnOfManualMeasuresTableTest.java deleted file mode 100644 index b61ac018b78..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/manualmeasures/DropIdColumnOfManualMeasuresTableTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.manualmeasures; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -import static org.assertj.core.api.Assertions.assertThatThrownBy; - -public class DropIdColumnOfManualMeasuresTableTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DropIdColumnOfManualMeasuresTableTest.class, "schema.sql"); - - private MigrationStep underTest = new DropIdColumnOfManualMeasuresTable(db.database()); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertColumnDoesNotExist("manual_measures", "id"); - } - - @Test - public void migration_is_not_re_entrant() throws SQLException { - underTest.execute(); - - assertThatThrownBy(() -> underTest.execute()).isInstanceOf(IllegalStateException.class); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/manualmeasures/DropPrimaryKeyOnIdColumnOfManualMeasuresTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/manualmeasures/DropPrimaryKeyOnIdColumnOfManualMeasuresTableTest.java deleted file mode 100644 index c670d997839..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/manualmeasures/DropPrimaryKeyOnIdColumnOfManualMeasuresTableTest.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.manualmeasures; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.sql.DbPrimaryKeyConstraintFinder; -import org.sonar.server.platform.db.migration.sql.DropPrimaryKeySqlGenerator; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -public class DropPrimaryKeyOnIdColumnOfManualMeasuresTableTest { - - private static final String TABLE_NAME = "manual_measures"; - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DropPrimaryKeyOnIdColumnOfManualMeasuresTableTest.class, "schema.sql"); - - private final DropPrimaryKeySqlGenerator dropPrimaryKeySqlGenerator = new DropPrimaryKeySqlGenerator(db.database(), new DbPrimaryKeyConstraintFinder(db.database())); - - private final MigrationStep underTest = new DropPrimaryKeyOnIdColumnOfManualMeasuresTable(db.database(), dropPrimaryKeySqlGenerator); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertNoPrimaryKey(TABLE_NAME); - } - - @Test - public void migration_is_re_entrant_but_fails_silently() throws SQLException { - underTest.execute(); - underTest.execute(); - - db.assertNoPrimaryKey(TABLE_NAME); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/manualmeasures/MakeManualMeasuresUuidColumnNotNullableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/manualmeasures/MakeManualMeasuresUuidColumnNotNullableTest.java deleted file mode 100644 index 1df9d6c99f0..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/manualmeasures/MakeManualMeasuresUuidColumnNotNullableTest.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.manualmeasures; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -import static java.sql.Types.VARCHAR; - -public class MakeManualMeasuresUuidColumnNotNullableTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(MakeManualMeasuresUuidColumnNotNullableTest.class, "schema.sql"); - - private MigrationStep underTest = new MakeManualMeasuresUuidColumnNotNullable(db.database()); - - @Test - public void uuid_column_is_not_null() throws SQLException { - underTest.execute(); - - db.assertColumnDefinition("manual_measures", "uuid", VARCHAR, null, false); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/manualmeasures/PopulateManualMeasuresUuidTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/manualmeasures/PopulateManualMeasuresUuidTest.java deleted file mode 100644 index b0a3b8fa845..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/manualmeasures/PopulateManualMeasuresUuidTest.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.manualmeasures; - -import java.sql.SQLException; -import java.util.Objects; -import java.util.stream.Collectors; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.core.util.UuidFactory; -import org.sonar.core.util.UuidFactoryFast; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DataChange; - -import static org.assertj.core.api.Assertions.assertThat; - -public class PopulateManualMeasuresUuidTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(PopulateManualMeasuresUuidTest.class, "schema.sql"); - - private UuidFactory uuidFactory = UuidFactoryFast.getInstance(); - private DataChange underTest = new PopulateManualMeasureUuid(db.database(), uuidFactory); - - @Test - public void populate_uuids_and_created_at() throws SQLException { - insertManualMeasure(1L); - insertManualMeasure(2L); - insertManualMeasure(3L); - - underTest.execute(); - - verifyUuidsAreNotNull(); - } - - @Test - public void migration_is_reentrant() throws SQLException { - insertManualMeasure(1L); - insertManualMeasure(2L); - insertManualMeasure(3L); - - underTest.execute(); - // re-entrant - underTest.execute(); - - verifyUuidsAreNotNull(); - } - - private void verifyUuidsAreNotNull() { - assertThat(db.select("select uuid from manual_measures") - .stream() - .map(row -> row.get("UUID")) - .filter(Objects::isNull) - .collect(Collectors.toList())).isEmpty(); - } - - private void insertManualMeasure(Long id) { - db.executeInsert("manual_measures", - "id", id, - "metric_id", id + 100, - "component_uuid", uuidFactory.create()); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/metrics/AddPrimaryKeyOnUuidColumnOfMetricsTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/metrics/AddPrimaryKeyOnUuidColumnOfMetricsTableTest.java deleted file mode 100644 index 8d57fc49048..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/metrics/AddPrimaryKeyOnUuidColumnOfMetricsTableTest.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.metrics; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.assertj.core.api.Assertions.assertThatThrownBy; - -public class AddPrimaryKeyOnUuidColumnOfMetricsTableTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(AddPrimaryKeyOnUuidColumnOfMetricsTableTest.class, "schema.sql"); - - private DdlChange underTest = new AddPrimaryKeyOnUuidColumnOfMetricsTable(db.database()); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertPrimaryKey("metrics", "pk_metrics", "uuid"); - } - - @Test - public void migration_is_not_re_entrant() throws SQLException { - underTest.execute(); - - assertThatThrownBy(() -> underTest.execute()).isInstanceOf(IllegalStateException.class); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/metrics/AddUuidColumnToMetricsTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/metrics/AddUuidColumnToMetricsTableTest.java deleted file mode 100644 index 69f44705827..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/metrics/AddUuidColumnToMetricsTableTest.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.metrics; - -import java.sql.SQLException; -import java.sql.Types; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.assertj.core.api.Assertions.assertThat; - -public class AddUuidColumnToMetricsTableTest { - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(AddUuidColumnToMetricsTableTest.class, "schema.sql"); - private DdlChange underTest = new AddUuidColumnToMetricsTable(db.database()); - - @Before - public void setup() { - insertMetric(1L); - insertMetric(2L); - insertMetric(3L); - } - - @Test - public void add_uuid_column() throws SQLException { - underTest.execute(); - - db.assertColumnDefinition("metrics", "uuid", Types.VARCHAR, 40, true); - - assertThat(db.countRowsOfTable("metrics")) - .isEqualTo(3); - } - - private void insertMetric(Long id) { - db.executeInsert("metrics", - "id", id, - "name", "name" + id); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/metrics/DropIdColumnOfMetricsTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/metrics/DropIdColumnOfMetricsTableTest.java deleted file mode 100644 index aa847b3d6e6..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/metrics/DropIdColumnOfMetricsTableTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.metrics; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.assertj.core.api.Assertions.assertThatThrownBy; - -public class DropIdColumnOfMetricsTableTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DropIdColumnOfMetricsTableTest.class, "schema.sql"); - - private DdlChange underTest = new DropIdColumnOfMetricsTable(db.database()); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertColumnDoesNotExist("metrics", "id"); - } - - @Test - public void migration_is_not_re_entrant() throws SQLException { - underTest.execute(); - - assertThatThrownBy(() -> underTest.execute()).isInstanceOf(IllegalStateException.class); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/metrics/DropPrimaryKeyOnIdColumnOfMetricsTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/metrics/DropPrimaryKeyOnIdColumnOfMetricsTableTest.java deleted file mode 100644 index ba2cc6188d2..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/metrics/DropPrimaryKeyOnIdColumnOfMetricsTableTest.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.metrics; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.sql.DbPrimaryKeyConstraintFinder; -import org.sonar.server.platform.db.migration.sql.DropPrimaryKeySqlGenerator; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.assertj.core.api.Assertions.assertThatThrownBy; - -public class DropPrimaryKeyOnIdColumnOfMetricsTableTest { - - private static final String TABLE_NAME = "metrics"; - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DropPrimaryKeyOnIdColumnOfMetricsTableTest.class, "schema.sql"); - - private final DropPrimaryKeySqlGenerator dropPrimaryKeySqlGenerator = new DropPrimaryKeySqlGenerator(db.database(), new DbPrimaryKeyConstraintFinder(db.database())); - - private final DdlChange underTest = new DropPrimaryKeyOnIdColumnOfMetricsTable(db.database(), dropPrimaryKeySqlGenerator); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertNoPrimaryKey(TABLE_NAME); - } - - @Test - public void migration_is_re_entrant_but_fails_silently() throws SQLException { - underTest.execute(); - underTest.execute(); - - db.assertNoPrimaryKey(TABLE_NAME); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/metrics/MakeMetricsUuidColumnNotNullableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/metrics/MakeMetricsUuidColumnNotNullableTest.java deleted file mode 100644 index 509430e3b8d..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/metrics/MakeMetricsUuidColumnNotNullableTest.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.metrics; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -import static java.sql.Types.VARCHAR; - -public class MakeMetricsUuidColumnNotNullableTest { - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(MakeMetricsUuidColumnNotNullableTest.class, "schema.sql"); - - private MigrationStep underTest = new MakeMetricsUuidColumnNotNullable(db.database()); - - @Test - public void uuid_column_is_not_nullable() throws SQLException { - underTest.execute(); - - db.assertColumnDefinition("metrics", "uuid", VARCHAR, null, false); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/metrics/livemeasures/AddIndexOnMetricUuidOfLiveMeasuresTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/metrics/livemeasures/AddIndexOnMetricUuidOfLiveMeasuresTableTest.java deleted file mode 100644 index 0402e044817..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/metrics/livemeasures/AddIndexOnMetricUuidOfLiveMeasuresTableTest.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.metrics.livemeasures; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -public class AddIndexOnMetricUuidOfLiveMeasuresTableTest { - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(AddIndexOnMetricUuidOfLiveMeasuresTableTest.class, "schema.sql"); - - private MigrationStep underTest = new AddIndexOnMetricUuidOfLiveMeasuresTable(db.database()); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertUniqueIndex("live_measures", "live_measures_component", "component_uuid", "metric_uuid"); - } - - @Test - public void migration_is_re_entrant() throws SQLException { - underTest.execute(); - - // re-entrant - underTest.execute(); - - db.assertUniqueIndex("live_measures", "live_measures_component", "component_uuid", "metric_uuid"); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/metrics/livemeasures/AddIndexOnProjectUuidOfLiveMeasuresTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/metrics/livemeasures/AddIndexOnProjectUuidOfLiveMeasuresTableTest.java deleted file mode 100644 index f6a915f30c1..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/metrics/livemeasures/AddIndexOnProjectUuidOfLiveMeasuresTableTest.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.metrics.livemeasures; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -public class AddIndexOnProjectUuidOfLiveMeasuresTableTest { - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(AddIndexOnProjectUuidOfLiveMeasuresTableTest.class, "schema.sql"); - - private MigrationStep underTest = new AddIndexOnProjectUuidOfLiveMeasuresTable(db.database()); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertIndex("live_measures", "live_measures_project", "project_uuid"); - } - - @Test - public void migration_is_re_entrant() throws SQLException { - underTest.execute(); - - // re-entrant - underTest.execute(); - - db.assertIndex("live_measures", "live_measures_project", "project_uuid"); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/metrics/livemeasures/CopyLiveMeasuresTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/metrics/livemeasures/CopyLiveMeasuresTableTest.java deleted file mode 100644 index 9ec7ee11006..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/metrics/livemeasures/CopyLiveMeasuresTableTest.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.metrics.livemeasures; - -import java.sql.SQLException; -import java.sql.Types; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; -import org.sonar.server.platform.db.migration.version.v84.rules.issues.CopyIssuesTable; - -public class CopyLiveMeasuresTableTest { - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(CopyLiveMeasuresTableTest.class, "schema.sql"); - - private MigrationStep underTest = new CopyLiveMeasuresTable(db.database()); - - @Test - public void execute() throws SQLException { - db.assertTableExists("live_measures"); - db.assertTableDoesNotExist("live_measures_copy"); - - underTest.execute(); - db.assertTableExists("live_measures"); - db.assertTableExists("live_measures_copy"); - db.assertColumnDefinition("live_measures_copy", "uuid", Types.VARCHAR, 40, false); - db.assertColumnDefinition("live_measures_copy", "metric_uuid", Types.VARCHAR, 40, false); - db.assertColumnDefinition("live_measures_copy", "measure_data", Types.BLOB, null, true); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/metrics/livemeasures/DropLiveMeasuresTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/metrics/livemeasures/DropLiveMeasuresTableTest.java deleted file mode 100644 index 51badc71971..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/metrics/livemeasures/DropLiveMeasuresTableTest.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.metrics.livemeasures; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; -import org.sonar.server.platform.db.migration.version.v84.rules.issues.DropIssuesTable; - -public class DropLiveMeasuresTableTest { - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DropLiveMeasuresTableTest.class, "schema.sql"); - - private MigrationStep underTest = new DropLiveMeasuresTable(db.database()); - - @Test - public void execute() throws SQLException { - db.assertTableExists("live_measures"); - underTest.execute(); - db.assertTableDoesNotExist("live_measures"); - } - - @Test - public void migration_is_re_entrant() throws SQLException { - db.assertTableExists("live_measures"); - - underTest.execute(); - - // re-entrant - underTest.execute(); - db.assertTableDoesNotExist("live_measures"); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/metrics/livemeasures/RenameLiveMeasuresCopyToLiveMeasuresTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/metrics/livemeasures/RenameLiveMeasuresCopyToLiveMeasuresTest.java deleted file mode 100644 index daf43b89e92..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/metrics/livemeasures/RenameLiveMeasuresCopyToLiveMeasuresTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.metrics.livemeasures; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; -import org.sonar.server.platform.db.migration.version.v84.rules.issues.RenameIssuesCopyToIssues; - -public class RenameLiveMeasuresCopyToLiveMeasuresTest { - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(RenameLiveMeasuresCopyToLiveMeasuresTest.class, "schema.sql"); - - private MigrationStep underTest = new RenameLiveMeasuresCopyToLiveMeasures(db.database()); - - @Test - public void execute() throws SQLException { - db.assertTableExists("live_measures_copy"); - db.assertTableDoesNotExist("live_measures"); - - underTest.execute(); - db.assertTableDoesNotExist("live_measures_copy"); - db.assertTableExists("live_measures"); - - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/metrics/manualmeasures/AddMetricUuidColumnToManualMeasuresTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/metrics/manualmeasures/AddMetricUuidColumnToManualMeasuresTest.java deleted file mode 100644 index d4ee2da552e..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/metrics/manualmeasures/AddMetricUuidColumnToManualMeasuresTest.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.metrics.manualmeasures; - -import java.sql.SQLException; -import java.sql.Types; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.assertj.core.api.Assertions.assertThat; - -public class AddMetricUuidColumnToManualMeasuresTest { - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(AddMetricUuidColumnToManualMeasuresTest.class, "schema.sql"); - private DdlChange underTest = new AddMetricUuidColumnToManualMeasures(db.database()); - - @Before - public void setup() { - insertManualMeasure(1L); - insertManualMeasure(2L); - insertManualMeasure(3L); - } - - @Test - public void add_active_rule_uuid_column() throws SQLException { - underTest.execute(); - - db.assertColumnDefinition("manual_measures", "metric_uuid", Types.VARCHAR, 40, true); - - assertThat(db.countRowsOfTable("manual_measures")) - .isEqualTo(3); - } - - private void insertManualMeasure(Long id) { - db.executeInsert("manual_measures", - "uuid", "uuid" + id, - "metric_id", id + 1, - "component_uuid", "component" + id); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/metrics/manualmeasures/DropMetricIdColumnOfManualMeasuresTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/metrics/manualmeasures/DropMetricIdColumnOfManualMeasuresTableTest.java deleted file mode 100644 index 6af0fac340b..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/metrics/manualmeasures/DropMetricIdColumnOfManualMeasuresTableTest.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.metrics.manualmeasures; - -import java.sql.SQLException; -import java.sql.Types; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.assertj.core.api.Assertions.assertThatThrownBy; - -public class DropMetricIdColumnOfManualMeasuresTableTest { - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DropMetricIdColumnOfManualMeasuresTableTest.class, "schema.sql"); - - private DdlChange underTest = new DropMetricIdColumnOfManualMeasuresTable(db.database()); - - @Test - public void execute() throws SQLException { - db.assertColumnDefinition("manual_measures", "metric_id", Types.INTEGER, null, false); - underTest.execute(); - db.assertColumnDoesNotExist("manual_measures", "metric_id"); - } - - @Test - public void migration_is_not_re_entrant() throws SQLException { - underTest.execute(); - - assertThatThrownBy(() -> underTest.execute()).isInstanceOf(IllegalStateException.class); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/metrics/manualmeasures/MakeManualMeasuresMetricUuidNotNullableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/metrics/manualmeasures/MakeManualMeasuresMetricUuidNotNullableTest.java deleted file mode 100644 index 4a727a9cb5c..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/metrics/manualmeasures/MakeManualMeasuresMetricUuidNotNullableTest.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.metrics.manualmeasures; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -import static java.sql.Types.VARCHAR; - -public class MakeManualMeasuresMetricUuidNotNullableTest { - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(MakeManualMeasuresMetricUuidNotNullableTest.class, "schema.sql"); - - private MigrationStep underTest = new MakeManualMeasuresMetricUuidNotNullable(db.database()); - - @Test - public void uuid_column_is_not_null() throws SQLException { - underTest.execute(); - - db.assertColumnDefinition("manual_measures", "metric_uuid", VARCHAR, null, false); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/metrics/manualmeasures/PopulateManualMeasuresMetricUuidTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/metrics/manualmeasures/PopulateManualMeasuresMetricUuidTest.java deleted file mode 100644 index d97d9ed2ccb..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/metrics/manualmeasures/PopulateManualMeasuresMetricUuidTest.java +++ /dev/null @@ -1,117 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.metrics.manualmeasures; - -import java.sql.SQLException; -import java.util.List; -import java.util.Map; -import org.assertj.core.groups.Tuple; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DataChange; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.tuple; - -public class PopulateManualMeasuresMetricUuidTest { - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(PopulateManualMeasuresMetricUuidTest.class, "schema.sql"); - - private DataChange underTest = new PopulateManualMeasuresMetricUuid(db.database()); - - @Test - public void populate_uuids() throws SQLException { - insertMetric(1L); - insertMetric(2L); - insertMetric(3L); - - insertManualMeasure(4L, 1L); - insertManualMeasure(5L, 2L); - insertManualMeasure(6L, 3L); - - underTest.execute(); - - assertThatTableContains( - tuple("uuid4", 1L, "uuid1"), - tuple("uuid5", 2L, "uuid2"), - tuple("uuid6", 3L, "uuid3") - ); - } - - @Test - public void delete_orphan_rows() throws SQLException { - insertMetric(1L); - insertMetric(2L); - insertMetric(3L); - - insertManualMeasure(4L, 10L); - insertManualMeasure(5L, 2L); - insertManualMeasure(6L, 3L); - - underTest.execute(); - - assertThatTableContains( - tuple("uuid5", 2L, "uuid2"), - tuple("uuid6", 3L, "uuid3") - ); - } - - @Test - public void migration_is_reentrant() throws SQLException { - insertMetric(1L); - insertMetric(2L); - insertMetric(3L); - - insertManualMeasure(4L, 1L); - insertManualMeasure(5L, 2L); - insertManualMeasure(6L, 3L); - - underTest.execute(); - // re-entrant - underTest.execute(); - - assertThatTableContains( - tuple("uuid4", 1L, "uuid1"), - tuple("uuid5", 2L, "uuid2"), - tuple("uuid6", 3L, "uuid3") - ); - } - - private void assertThatTableContains(Tuple... tuples) { - List> select = db.select("select uuid, metric_id, metric_uuid from manual_measures"); - assertThat(select).extracting(m -> m.get("UUID"), m -> m.get("METRIC_ID"), m -> m.get("METRIC_UUID")) - .containsExactlyInAnyOrder(tuples); - } - - private void insertMetric(Long id) { - db.executeInsert("metrics", - "id", id, - "uuid", "uuid" + id, - "name", "name" + id); - } - - private void insertManualMeasure(Long id, Long metricId) { - db.executeInsert("manual_measures", - "uuid", "uuid" + id, - "metric_id", metricId, - "component_uuid", "component" + id); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/metrics/projectmeasures/AddIndexOnMetricUuidAndAnalysisUuidOfProjectMeasuresTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/metrics/projectmeasures/AddIndexOnMetricUuidAndAnalysisUuidOfProjectMeasuresTableTest.java deleted file mode 100644 index 073c6b20a71..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/metrics/projectmeasures/AddIndexOnMetricUuidAndAnalysisUuidOfProjectMeasuresTableTest.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.metrics.projectmeasures; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -public class AddIndexOnMetricUuidAndAnalysisUuidOfProjectMeasuresTableTest { - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(AddIndexOnMetricUuidAndAnalysisUuidOfProjectMeasuresTableTest.class, "schema.sql"); - - private MigrationStep underTest = new AddIndexOnMetricUuidAndAnalysisUuidOfProjectMeasuresTable(db.database()); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertIndex("project_measures", "measures_analysis_metric", "analysis_uuid", "metric_uuid"); - } - - @Test - public void migration_is_re_entrant() throws SQLException { - underTest.execute(); - - // re-entrant - underTest.execute(); - - db.assertIndex("project_measures", "measures_analysis_metric", "analysis_uuid", "metric_uuid"); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/metrics/projectmeasures/AddIndexOnMetricUuidOfProjectMeasuresTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/metrics/projectmeasures/AddIndexOnMetricUuidOfProjectMeasuresTableTest.java deleted file mode 100644 index 47482eabfe4..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/metrics/projectmeasures/AddIndexOnMetricUuidOfProjectMeasuresTableTest.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.metrics.projectmeasures; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -public class AddIndexOnMetricUuidOfProjectMeasuresTableTest { - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(AddIndexOnMetricUuidOfProjectMeasuresTableTest.class, "schema.sql"); - - private MigrationStep underTest = new AddIndexOnMetricUuidOfProjectMeasuresTable(db.database()); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertIndex("project_measures", "project_measures_metric", "metric_uuid"); - } - - @Test - public void migration_is_re_entrant() throws SQLException { - underTest.execute(); - - // re-entrant - underTest.execute(); - - db.assertIndex("project_measures", "project_measures_metric", "metric_uuid"); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/metrics/projectmeasures/AddMetricUuidColumnToProjectMeasuresTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/metrics/projectmeasures/AddMetricUuidColumnToProjectMeasuresTest.java deleted file mode 100644 index 1f177343668..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/metrics/projectmeasures/AddMetricUuidColumnToProjectMeasuresTest.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.metrics.projectmeasures; - -import java.sql.SQLException; -import java.sql.Types; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.assertj.core.api.Assertions.assertThat; - -public class AddMetricUuidColumnToProjectMeasuresTest { - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(AddMetricUuidColumnToProjectMeasuresTest.class, "schema.sql"); - private DdlChange underTest = new AddMetricUuidColumnToProjectMeasures(db.database()); - - @Before - public void setup() { - insertProjectMeasure(1L); - insertProjectMeasure(2L); - insertProjectMeasure(3L); - } - - @Test - public void add_active_rule_uuid_column() throws SQLException { - underTest.execute(); - - db.assertColumnDefinition("project_measures", "metric_uuid", Types.VARCHAR, 40, true); - - assertThat(db.countRowsOfTable("project_measures")) - .isEqualTo(3); - } - - private void insertProjectMeasure(Long id) { - db.executeInsert("project_measures", - "uuid", "uuid" + id, - "metric_id", id + 1, - "component_uuid", "component" + id, - "analysis_uuid", "analysis" + id + 1); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/metrics/projectmeasures/DeleteSecurityReviewRatingProjectMeasuresTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/metrics/projectmeasures/DeleteSecurityReviewRatingProjectMeasuresTest.java deleted file mode 100644 index b332e8b3eb6..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/metrics/projectmeasures/DeleteSecurityReviewRatingProjectMeasuresTest.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.metrics.projectmeasures; - -import com.google.common.collect.ImmutableMap; -import java.sql.SQLException; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import org.apache.commons.lang.math.RandomUtils; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DataChange; - -import static java.lang.String.format; -import static java.util.Collections.singletonList; -import static java.util.stream.Collectors.toList; -import static org.assertj.core.api.Assertions.assertThat; - -public class DeleteSecurityReviewRatingProjectMeasuresTest { - private static final String PROJECT_MEASURES_TABLE = "project_measures"; - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DeleteSecurityReviewRatingProjectMeasuresTest.class, "schema.sql"); - - private DataChange underTest = new DeleteSecurityReviewRatingProjectMeasures(db.database()); - - @Test - public void removes_project_measure_for_review_rating_and_review_rating_effort_metrics() throws SQLException { - String codeSmellMetric = insertMetric(1L, "security_review_rating"); - insertProjectMeasure(codeSmellMetric); - String reviewRatingEffort = insertMetric(2L, "security_review_rating_effort"); - insertProjectMeasure(reviewRatingEffort); - String anotherMetric = insertMetric(3L, "another_metric"); - String anotherMetricProjectMeasure = insertProjectMeasure(anotherMetric); - - underTest.execute(); - verifyProjectMeasureIds(singletonList(anotherMetricProjectMeasure)); - } - - - private String insertMetric(Long id, String key) { - db.executeInsert("metrics", - "id", id, - "uuid", id, - "name", key); - - return (String) db.selectFirst(format("select uuid as \"uuid\" from metrics where name='%s'", key)).get("uuid"); - } - - private String insertProjectMeasure(String metricUuid) { - double projectMeasureUUid = RandomUtils.nextDouble(); - Map values = new HashMap<>(ImmutableMap.of("uuid", projectMeasureUUid, "metric_uuid", metricUuid, - "analysis_uuid", "analysis_uuid", "component_uuid", "component_uuid")); - db.executeInsert(PROJECT_MEASURES_TABLE, values); - String sql = format("select uuid as \"uuid\" from %s where metric_uuid='%s'", PROJECT_MEASURES_TABLE, metricUuid); - return (String) db - .selectFirst(sql) - .get("uuid"); - } - - private void verifyProjectMeasureIds(List expectedProjectMeasureIds) { - List> results = db.select("select uuid from " + PROJECT_MEASURES_TABLE); - assertThat(results.stream() - .map(map -> (String) map.get("UUID")) - .collect(toList())) - .containsExactlyInAnyOrderElementsOf(expectedProjectMeasureIds); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/metrics/projectmeasures/DropIndexOnMetricIdOfProjectMeasuresTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/metrics/projectmeasures/DropIndexOnMetricIdOfProjectMeasuresTableTest.java deleted file mode 100644 index 4dcd074520d..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/metrics/projectmeasures/DropIndexOnMetricIdOfProjectMeasuresTableTest.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.metrics.projectmeasures; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -public class DropIndexOnMetricIdOfProjectMeasuresTableTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DropIndexOnMetricIdOfProjectMeasuresTableTest.class, "schema.sql"); - - private MigrationStep underTest = new DropIndexOnMetricIdOfProjectMeasuresTable(db.database()); - - @Test - public void execute() throws SQLException { - db.assertTableExists("project_measures"); - db.assertIndex("project_measures", "measures_analysis_metric", "analysis_uuid", "metric_id"); - - underTest.execute(); - - db.assertIndexDoesNotExist("project_measures", "measures_analysis_metric"); - } - - @Test - public void migration_is_re_entrant() throws SQLException { - underTest.execute(); - - // re-entrant - underTest.execute(); - - db.assertIndexDoesNotExist("project_measures", "measures_analysis_metric"); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/metrics/projectmeasures/DropMetricIdColumnOfProjectMeasuresTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/metrics/projectmeasures/DropMetricIdColumnOfProjectMeasuresTableTest.java deleted file mode 100644 index a28faf260c5..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/metrics/projectmeasures/DropMetricIdColumnOfProjectMeasuresTableTest.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.metrics.projectmeasures; - -import java.sql.SQLException; -import java.sql.Types; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.assertj.core.api.Assertions.assertThatThrownBy; - -public class DropMetricIdColumnOfProjectMeasuresTableTest { - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DropMetricIdColumnOfProjectMeasuresTableTest.class, "schema.sql"); - - private DdlChange underTest = new DropMetricIdColumnOfProjectMeasuresTable(db.database()); - - @Test - public void execute() throws SQLException { - db.assertColumnDefinition("project_measures", "metric_id", Types.INTEGER, null, false); - underTest.execute(); - db.assertColumnDoesNotExist("project_measures", "metric_id"); - } - - @Test - public void migration_is_not_re_entrant() throws SQLException { - underTest.execute(); - - assertThatThrownBy(() -> underTest.execute()).isInstanceOf(IllegalStateException.class); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/metrics/projectmeasures/MakeProjectMeasuresMetricUuidNotNullableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/metrics/projectmeasures/MakeProjectMeasuresMetricUuidNotNullableTest.java deleted file mode 100644 index c4a7cfca932..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/metrics/projectmeasures/MakeProjectMeasuresMetricUuidNotNullableTest.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.metrics.projectmeasures; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -import static java.sql.Types.VARCHAR; - -public class MakeProjectMeasuresMetricUuidNotNullableTest { - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(MakeProjectMeasuresMetricUuidNotNullableTest.class, "schema.sql"); - - private MigrationStep underTest = new MakeProjectMeasuresMetricUuidNotNullable(db.database()); - - @Test - public void uuid_column_is_not_null() throws SQLException { - underTest.execute(); - - db.assertColumnDefinition("project_measures", "metric_uuid", VARCHAR, null, false); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/metrics/projectmeasures/PopulateProjectMeasuresMetricUuidTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/metrics/projectmeasures/PopulateProjectMeasuresMetricUuidTest.java deleted file mode 100644 index e3839decdcf..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/metrics/projectmeasures/PopulateProjectMeasuresMetricUuidTest.java +++ /dev/null @@ -1,118 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.metrics.projectmeasures; - -import java.sql.SQLException; -import java.util.List; -import java.util.Map; -import org.assertj.core.groups.Tuple; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DataChange; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.tuple; - -public class PopulateProjectMeasuresMetricUuidTest { - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(PopulateProjectMeasuresMetricUuidTest.class, "schema.sql"); - - private DataChange underTest = new PopulateProjectMeasuresMetricUuid(db.database()); - - @Test - public void populate_uuids() throws SQLException { - insertMetric(1L); - insertMetric(2L); - insertMetric(3L); - - insertProjectMeasure(4L, 1L); - insertProjectMeasure(5L, 2L); - insertProjectMeasure(6L, 3L); - - underTest.execute(); - - assertThatTableContains( - tuple("uuid4", 1L, "uuid1"), - tuple("uuid5", 2L, "uuid2"), - tuple("uuid6", 3L, "uuid3") - ); - } - - @Test - public void delete_orphan_entries() throws SQLException { - insertMetric(1L); - insertMetric(2L); - insertMetric(3L); - - insertProjectMeasure(4L, 10L); - insertProjectMeasure(5L, 2L); - insertProjectMeasure(6L, 3L); - - underTest.execute(); - - assertThatTableContains( - tuple("uuid5", 2L, "uuid2"), - tuple("uuid6", 3L, "uuid3") - ); - } - - @Test - public void migration_is_reentrant() throws SQLException { - insertMetric(1L); - insertMetric(2L); - insertMetric(3L); - - insertProjectMeasure(4L, 1L); - insertProjectMeasure(5L, 2L); - insertProjectMeasure(6L, 3L); - - underTest.execute(); - // re-entrant - underTest.execute(); - - assertThatTableContains( - tuple("uuid4", 1L, "uuid1"), - tuple("uuid5", 2L, "uuid2"), - tuple("uuid6", 3L, "uuid3") - ); - } - - private void assertThatTableContains(Tuple... tuples) { - List> select = db.select("select uuid, metric_id, metric_uuid from project_measures"); - assertThat(select).extracting(m -> m.get("UUID"), m -> m.get("METRIC_ID"), m -> m.get("METRIC_UUID")) - .containsExactlyInAnyOrder(tuples); - } - - private void insertMetric(Long id) { - db.executeInsert("metrics", - "id", id, - "uuid", "uuid" + id, - "name", "name" + id); - } - - private void insertProjectMeasure(Long id, Long metricId) { - db.executeInsert("project_measures", - "uuid", "uuid" + id, - "metric_id", metricId, - "component_uuid", "component" + id, - "analysis_uuid", "analysis" + id + 1); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/metrics/qualitygateconditions/AddMetricUuidColumnToQualityGateConditionsTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/metrics/qualitygateconditions/AddMetricUuidColumnToQualityGateConditionsTest.java deleted file mode 100644 index 62bf2b9e229..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/metrics/qualitygateconditions/AddMetricUuidColumnToQualityGateConditionsTest.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.metrics.qualitygateconditions; - -import java.sql.SQLException; -import java.sql.Types; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.assertj.core.api.Assertions.assertThat; - -public class AddMetricUuidColumnToQualityGateConditionsTest { - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(AddMetricUuidColumnToQualityGateConditionsTest.class, "schema.sql"); - private DdlChange underTest = new AddMetricUuidColumnToQualityGateConditions(db.database()); - - @Before - public void setup() { - insertQualityGateConditions(1L); - insertQualityGateConditions(2L); - insertQualityGateConditions(3L); - } - - @Test - public void add_active_rule_uuid_column() throws SQLException { - underTest.execute(); - - db.assertColumnDefinition("quality_gate_conditions", "metric_uuid", Types.VARCHAR, 40, true); - - assertThat(db.countRowsOfTable("quality_gate_conditions")) - .isEqualTo(3); - } - - private void insertQualityGateConditions(Long id) { - db.executeInsert("quality_gate_conditions", - "uuid", "uuid" + id, - "metric_id", id + 1); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/metrics/qualitygateconditions/DropMetricIdColumnOfQualityGateConditionsTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/metrics/qualitygateconditions/DropMetricIdColumnOfQualityGateConditionsTableTest.java deleted file mode 100644 index 2671359c75f..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/metrics/qualitygateconditions/DropMetricIdColumnOfQualityGateConditionsTableTest.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.metrics.qualitygateconditions; - -import java.sql.SQLException; -import java.sql.Types; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.assertj.core.api.Assertions.assertThatThrownBy; - -public class DropMetricIdColumnOfQualityGateConditionsTableTest { - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DropMetricIdColumnOfQualityGateConditionsTableTest.class, "schema.sql"); - - private DdlChange underTest = new DropMetricIdColumnOfQualityGateConditionsTable(db.database()); - - @Test - public void execute() throws SQLException { - db.assertColumnDefinition("quality_gate_conditions", "metric_id", Types.INTEGER, null, true); - underTest.execute(); - db.assertColumnDoesNotExist("quality_gate_conditions", "metric_id"); - } - - @Test - public void migration_is_not_re_entrant() throws SQLException { - underTest.execute(); - - assertThatThrownBy(() -> underTest.execute()).isInstanceOf(IllegalStateException.class); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/metrics/qualitygateconditions/MakeQualityGateConditionsMetricUuidNotNullableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/metrics/qualitygateconditions/MakeQualityGateConditionsMetricUuidNotNullableTest.java deleted file mode 100644 index 566dfaac013..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/metrics/qualitygateconditions/MakeQualityGateConditionsMetricUuidNotNullableTest.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.metrics.qualitygateconditions; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -import static java.sql.Types.VARCHAR; - -public class MakeQualityGateConditionsMetricUuidNotNullableTest { - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(MakeQualityGateConditionsMetricUuidNotNullableTest.class, "schema.sql"); - - private MigrationStep underTest = new MakeQualityGateConditionsMetricUuidNotNullable(db.database()); - - @Test - public void uuid_column_is_not_null() throws SQLException { - underTest.execute(); - - db.assertColumnDefinition("quality_gate_conditions", "metric_uuid", VARCHAR, null, false); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/metrics/qualitygateconditions/PopulateQualityGateConditionsMetricUuidTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/metrics/qualitygateconditions/PopulateQualityGateConditionsMetricUuidTest.java deleted file mode 100644 index 46038327758..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/metrics/qualitygateconditions/PopulateQualityGateConditionsMetricUuidTest.java +++ /dev/null @@ -1,138 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.metrics.qualitygateconditions; - -import java.sql.SQLException; -import java.util.List; -import java.util.Map; -import org.assertj.core.groups.Tuple; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DataChange; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.tuple; - -public class PopulateQualityGateConditionsMetricUuidTest { - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(PopulateQualityGateConditionsMetricUuidTest.class, "schema.sql"); - - private DataChange underTest = new PopulateQualityGateConditionsMetricUuid(db.database()); - - @Test - public void populate_uuids() throws SQLException { - insertMetric(1L); - insertMetric(2L); - insertMetric(3L); - - insertQualityGateConditions(4L, 1L); - insertQualityGateConditions(5L, 2L); - insertQualityGateConditions(6L, 3L); - - underTest.execute(); - - assertThatTableContains( - tuple("uuid4", 1L, "uuid1"), - tuple("uuid5", 2L, "uuid2"), - tuple("uuid6", 3L, "uuid3") - ); - } - - @Test - public void delete_entries_with_null_id() throws SQLException { - insertMetric(1L); - insertMetric(2L); - insertMetric(3L); - - insertQualityGateConditions(4L, null); - insertQualityGateConditions(5L, 2L); - insertQualityGateConditions(6L, 3L); - - underTest.execute(); - // re-entrant - underTest.execute(); - - assertThatTableContains( - tuple("uuid5", 2L, "uuid2"), - tuple("uuid6", 3L, "uuid3") - ); - } - - @Test - public void delete_rows_with_orphan_ids() throws SQLException { - insertMetric(1L); - insertMetric(2L); - insertMetric(3L); - - insertQualityGateConditions(4L, 10L); - insertQualityGateConditions(5L, 2L); - insertQualityGateConditions(6L, 3L); - - underTest.execute(); - // re-entrant - underTest.execute(); - - assertThatTableContains( - tuple("uuid5", 2L, "uuid2"), - tuple("uuid6", 3L, "uuid3") - ); - } - - @Test - public void migration_is_reentrant() throws SQLException { - insertMetric(1L); - insertMetric(2L); - insertMetric(3L); - - insertQualityGateConditions(4L, 1L); - insertQualityGateConditions(5L, 2L); - insertQualityGateConditions(6L, 3L); - - underTest.execute(); - // re-entrant - underTest.execute(); - - assertThatTableContains( - tuple("uuid4", 1L, "uuid1"), - tuple("uuid5", 2L, "uuid2"), - tuple("uuid6", 3L, "uuid3") - ); - } - - private void assertThatTableContains(Tuple... tuples) { - List> select = db.select("select uuid, metric_id, metric_uuid from quality_gate_conditions"); - assertThat(select).extracting(m -> m.get("UUID"), m -> m.get("METRIC_ID"), m -> m.get("METRIC_UUID")) - .containsExactlyInAnyOrder(tuples); - } - - private void insertMetric(Long id) { - db.executeInsert("metrics", - "id", id, - "uuid", "uuid" + id, - "name", "name" + id); - } - - private void insertQualityGateConditions(Long id, Long metricId) { - db.executeInsert("quality_gate_conditions", - "uuid", "uuid" + id, - "metric_id", metricId); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/notifications/AddPrimaryKeyOnUuidColumnOfNotificationTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/notifications/AddPrimaryKeyOnUuidColumnOfNotificationTableTest.java deleted file mode 100644 index 2bd6ce62372..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/notifications/AddPrimaryKeyOnUuidColumnOfNotificationTableTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.notifications; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -import static org.assertj.core.api.Assertions.assertThatThrownBy; - -public class AddPrimaryKeyOnUuidColumnOfNotificationTableTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(AddPrimaryKeyOnUuidColumnOfNotificationTableTest.class, "schema.sql"); - - private MigrationStep underTest = new AddPrimaryKeyOnUuidColumnOfNotificationTable(db.database()); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertPrimaryKey("notifications", "pk_notifications", "uuid"); - } - - @Test - public void migration_is_not_re_entrant() throws SQLException { - underTest.execute(); - - assertThatThrownBy(() -> underTest.execute()).isInstanceOf(IllegalStateException.class); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/notifications/AddUuidAndCreatedAtColumnsToNotificationTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/notifications/AddUuidAndCreatedAtColumnsToNotificationTest.java deleted file mode 100644 index 4c73d29d9c0..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/notifications/AddUuidAndCreatedAtColumnsToNotificationTest.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.notifications; - -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.ObjectOutputStream; -import java.sql.SQLException; -import java.sql.Types; -import org.apache.commons.io.IOUtils; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.api.utils.SonarException; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static java.sql.Types.BIGINT; -import static org.assertj.core.api.Assertions.assertThat; - -public class AddUuidAndCreatedAtColumnsToNotificationTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(AddUuidAndCreatedAtColumnsToNotificationTest.class, "schema.sql"); - - private DdlChange underTest = new AddUuidAndCreatedAtColumnsToNotification(db.database()); - - @Before - public void setup() { - insertNotification(1L, "data1"); - insertNotification(2L, "data2"); - insertNotification(3L, "data3"); - } - - @Test - public void add_uuid_and_created_at_columns_to_notification() throws SQLException { - underTest.execute(); - - db.assertColumnDefinition("notifications", "uuid", Types.VARCHAR, 40, true); - db.assertColumnDefinition("notifications", "created_at", BIGINT, null, true); - - assertThat(db.countSql("select count(id) from notifications")) - .isEqualTo(3); - } - - private void insertNotification(Long id, String data) { - - ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); - try { - ObjectOutputStream objectOutputStream = new ObjectOutputStream(byteArrayOutputStream); - objectOutputStream.writeObject(data); - objectOutputStream.close(); - byte[] byteArray = byteArrayOutputStream.toByteArray(); - - db.executeInsert("notifications", - "id", id, - "data", byteArray); - - } catch (IOException e) { - throw new SonarException("Unable to write notification", e); - - } finally { - IOUtils.closeQuietly(byteArrayOutputStream); - } - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/notifications/DropIdColumnOfNotificationTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/notifications/DropIdColumnOfNotificationTableTest.java deleted file mode 100644 index 50a3afcefdc..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/notifications/DropIdColumnOfNotificationTableTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.notifications; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -import static org.assertj.core.api.Assertions.assertThatThrownBy; - -public class DropIdColumnOfNotificationTableTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DropIdColumnOfNotificationTableTest.class, "schema.sql"); - - private MigrationStep underTest = new DropIdColumnOfNotificationTable(db.database()); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertColumnDoesNotExist("notifications", "id"); - } - - @Test - public void migration_is_not_re_entrant() throws SQLException { - underTest.execute(); - - assertThatThrownBy(() -> underTest.execute()).isInstanceOf(IllegalStateException.class); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/notifications/DropPrimaryKeyOnIdColumnOfNotificationTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/notifications/DropPrimaryKeyOnIdColumnOfNotificationTableTest.java deleted file mode 100644 index aa332a489a5..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/notifications/DropPrimaryKeyOnIdColumnOfNotificationTableTest.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.notifications; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.sql.DbPrimaryKeyConstraintFinder; -import org.sonar.server.platform.db.migration.sql.DropPrimaryKeySqlGenerator; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -public class DropPrimaryKeyOnIdColumnOfNotificationTableTest { - - private static final String TABLE_NAME = "notifications"; - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DropPrimaryKeyOnIdColumnOfNotificationTableTest.class, "schema.sql"); - - private final DropPrimaryKeySqlGenerator dropPrimaryKeySqlGenerator = new DropPrimaryKeySqlGenerator(db.database(), new DbPrimaryKeyConstraintFinder(db.database())); - - private final MigrationStep underTest = new DropPrimaryKeyOnIdColumnOfNotificationTable(db.database(), dropPrimaryKeySqlGenerator); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertNoPrimaryKey(TABLE_NAME); - } - - @Test - public void migration_is_re_entrant_but_fails_silently() throws SQLException { - underTest.execute(); - underTest.execute(); - - db.assertNoPrimaryKey(TABLE_NAME); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/notifications/MakeNotificationUuidAndCreatedAtColumnsNotNullableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/notifications/MakeNotificationUuidAndCreatedAtColumnsNotNullableTest.java deleted file mode 100644 index a7882f951a9..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/notifications/MakeNotificationUuidAndCreatedAtColumnsNotNullableTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.notifications; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -import static java.sql.Types.BIGINT; -import static java.sql.Types.VARCHAR; - -public class MakeNotificationUuidAndCreatedAtColumnsNotNullableTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(MakeNotificationUuidAndCreatedAtColumnsNotNullableTest.class, "schema.sql"); - - private MigrationStep underTest = new MakeNotificationUuidAndCreatedAtColumnsNotNullable(db.database()); - - @Test - public void created_at_and_uuid_columns_are_not_null() throws SQLException { - underTest.execute(); - - db.assertColumnDefinition("notifications", "uuid", VARCHAR, null, false); - db.assertColumnDefinition("notifications", "created_at", BIGINT, null, false); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/notifications/PopulateNotificationUuidAndCreatedAtTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/notifications/PopulateNotificationUuidAndCreatedAtTest.java deleted file mode 100644 index e53dbb59f94..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/notifications/PopulateNotificationUuidAndCreatedAtTest.java +++ /dev/null @@ -1,110 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.notifications; - -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.ObjectOutputStream; -import java.sql.SQLException; -import java.util.Objects; -import java.util.stream.Collectors; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.api.utils.System2; -import org.sonar.core.util.UuidFactory; -import org.sonar.core.util.UuidFactoryFast; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DataChange; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -public class PopulateNotificationUuidAndCreatedAtTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(PopulateNotificationUuidAndCreatedAtTest.class, "schema.sql"); - - private UuidFactory uuidFactory = UuidFactoryFast.getInstance(); - private System2 system2 = mock(System2.class); - private DataChange underTest = new PopulateNotificationUuidAndCreatedAt(db.database(), uuidFactory, system2); - - @Before - public void before() { - // exactly one week before now + 1ms, so that ID are exactly equals to timestamp in the tests - when(system2.now()).thenReturn((1000 * 60 * 60 * 24 * 7) + 1L); - } - - @Test - public void populate_uuids_and_created_at() throws IOException, SQLException { - insertNotification(1L, "data1"); - insertNotification(2L, "data2"); - insertNotification(3L, "data3"); - - underTest.execute(); - - verifyUuidsAreNotNull(); - verifyCreatedAt(); - } - - @Test - public void migration_is_reentrant() throws IOException, SQLException { - insertNotification(1L, "data1"); - insertNotification(2L, "data2"); - insertNotification(3L, "data3"); - - underTest.execute(); - // re-entrant - underTest.execute(); - - verifyUuidsAreNotNull(); - verifyCreatedAt(); - } - - private void verifyUuidsAreNotNull() { - assertThat(db.select("select uuid from notifications") - .stream() - .map(row -> row.get("UUID")) - .filter(Objects::isNull) - .collect(Collectors.toList())).isEmpty(); - } - - private void verifyCreatedAt() { - assertThat(db.select("select id, created_at from notifications") - .stream() - .filter(row -> !row.get("CREATED_AT").equals(row.get("ID"))) - .collect(Collectors.toList())).isEmpty(); - - } - - private void insertNotification(Long id, String data) throws IOException { - ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); - ObjectOutputStream objectOutputStream = new ObjectOutputStream(byteArrayOutputStream); - objectOutputStream.writeObject(data); - objectOutputStream.close(); - byte[] byteArray = byteArrayOutputStream.toByteArray(); - - db.executeInsert("notifications", - "id", id, - "data", byteArray); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/AddPrimaryKeyOnUuidColumnOfPermissionTemplatesTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/AddPrimaryKeyOnUuidColumnOfPermissionTemplatesTableTest.java deleted file mode 100644 index d5eccbc92fc..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/AddPrimaryKeyOnUuidColumnOfPermissionTemplatesTableTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.permissiontemplates; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -import static org.assertj.core.api.Assertions.assertThatThrownBy; - -public class AddPrimaryKeyOnUuidColumnOfPermissionTemplatesTableTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(AddPrimaryKeyOnUuidColumnOfPermissionTemplatesTableTest.class, "schema.sql"); - - private MigrationStep underTest = new AddPrimaryKeyOnUuidColumnOfPermissionTemplatesTable(db.database()); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertPrimaryKey("permission_templates", "pk_permission_templates", "uuid"); - } - - @Test - public void migration_is_not_re_entrant() throws SQLException { - underTest.execute(); - - assertThatThrownBy(() -> underTest.execute()).isInstanceOf(IllegalStateException.class); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/AddUuidColumnToPermissionTemplatesTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/AddUuidColumnToPermissionTemplatesTest.java deleted file mode 100644 index 5ef047320c1..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/AddUuidColumnToPermissionTemplatesTest.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.permissiontemplates; - -import java.sql.SQLException; -import java.sql.Types; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.core.util.UuidFactory; -import org.sonar.core.util.UuidFactoryFast; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.assertj.core.api.Assertions.assertThat; - -public class AddUuidColumnToPermissionTemplatesTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(AddUuidColumnToPermissionTemplatesTest.class, "schema.sql"); - - private UuidFactory uuidFactory = UuidFactoryFast.getInstance(); - - private DdlChange underTest = new AddUuidColumnToPermissionTemplates(db.database()); - - @Before - public void setup() { - insertPermissionTemplate(1L); - insertPermissionTemplate(2L); - insertPermissionTemplate(3L); - } - - @Test - public void add_uuid_column_to_permission_templates() throws SQLException { - underTest.execute(); - - db.assertColumnDefinition("permission_templates", "uuid", Types.VARCHAR, 40, true); - - assertThat(db.countSql("select count(id) from permission_templates")) - .isEqualTo(3); - } - - private void insertPermissionTemplate(Long id) { - db.executeInsert("permission_templates", - "id", id, - "organization_uuid", id + 100, - "name", uuidFactory.create(), - "kee", uuidFactory.create()); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/DropIdColumnOfPermissionTemplatesTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/DropIdColumnOfPermissionTemplatesTableTest.java deleted file mode 100644 index e30b60a1c86..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/DropIdColumnOfPermissionTemplatesTableTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.permissiontemplates; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -import static org.assertj.core.api.Assertions.assertThatThrownBy; - -public class DropIdColumnOfPermissionTemplatesTableTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DropIdColumnOfPermissionTemplatesTableTest.class, "schema.sql"); - - private MigrationStep underTest = new DropIdColumnOfPermissionTemplatesTable(db.database()); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertColumnDoesNotExist("permission_templates", "id"); - } - - @Test - public void migration_is_not_re_entrant() throws SQLException { - underTest.execute(); - - assertThatThrownBy(() -> underTest.execute()).isInstanceOf(IllegalStateException.class); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/DropKeeColumnOfPermissionTemplatesTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/DropKeeColumnOfPermissionTemplatesTableTest.java deleted file mode 100644 index 7aec2ba6cae..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/DropKeeColumnOfPermissionTemplatesTableTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.permissiontemplates; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -import static org.assertj.core.api.Assertions.assertThatThrownBy; - -public class DropKeeColumnOfPermissionTemplatesTableTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DropKeeColumnOfPermissionTemplatesTableTest.class, "schema.sql"); - - private MigrationStep underTest = new DropKeeColumnOfPermissionTemplatesTable(db.database()); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertColumnDoesNotExist("permission_templates", "kee"); - } - - @Test - public void migration_is_not_re_entrant() throws SQLException { - underTest.execute(); - - assertThatThrownBy(() -> underTest.execute()).isInstanceOf(IllegalStateException.class); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/DropPrimaryKeyOnIdColumnOfPermissionTemplatesTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/DropPrimaryKeyOnIdColumnOfPermissionTemplatesTableTest.java deleted file mode 100644 index 66bb2ffb0cc..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/DropPrimaryKeyOnIdColumnOfPermissionTemplatesTableTest.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.permissiontemplates; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.sql.DbPrimaryKeyConstraintFinder; -import org.sonar.server.platform.db.migration.sql.DropPrimaryKeySqlGenerator; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -public class DropPrimaryKeyOnIdColumnOfPermissionTemplatesTableTest { - - private static final String TABLE_NAME = "permission_templates"; - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DropPrimaryKeyOnIdColumnOfPermissionTemplatesTableTest.class, "schema.sql"); - - private final DropPrimaryKeySqlGenerator dropPrimaryKeySqlGenerator = new DropPrimaryKeySqlGenerator(db.database(), new DbPrimaryKeyConstraintFinder(db.database())); - - private final MigrationStep underTest = new DropPrimaryKeyOnIdColumnOfPermissionTemplatesTable(db.database(), dropPrimaryKeySqlGenerator); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertNoPrimaryKey(TABLE_NAME); - } - - @Test - public void migration_is_re_entrant_but_fails_silently() throws SQLException { - underTest.execute(); - underTest.execute(); - - db.assertNoPrimaryKey(TABLE_NAME); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/MakePermissionTemplateUuidColumnNotNullableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/MakePermissionTemplateUuidColumnNotNullableTest.java deleted file mode 100644 index 1b02677d63d..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/MakePermissionTemplateUuidColumnNotNullableTest.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.permissiontemplates; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -import static java.sql.Types.VARCHAR; - -public class MakePermissionTemplateUuidColumnNotNullableTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(MakePermissionTemplateUuidColumnNotNullableTest.class, "schema.sql"); - - private MigrationStep underTest = new MakePermissionTemplateUuidColumnNotNullable(db.database()); - - @Test - public void uuid_column_is_not_null() throws SQLException { - underTest.execute(); - - db.assertColumnDefinition("permission_templates", "uuid", VARCHAR, null, false); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/PopulatePermissionTemplatesUuidTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/PopulatePermissionTemplatesUuidTest.java deleted file mode 100644 index a403cf013ca..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/PopulatePermissionTemplatesUuidTest.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.permissiontemplates; - -import java.sql.SQLException; -import java.util.Objects; -import java.util.stream.Collectors; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.core.util.UuidFactory; -import org.sonar.core.util.UuidFactoryFast; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DataChange; - -import static org.assertj.core.api.Assertions.assertThat; - -public class PopulatePermissionTemplatesUuidTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(PopulatePermissionTemplatesUuidTest.class, "schema.sql"); - - private UuidFactory uuidFactory = UuidFactoryFast.getInstance(); - private DataChange underTest = new PopulatePermissionTemplatesUuid(db.database(), uuidFactory); - - @Test - public void populate_uuids() throws SQLException { - insertPermissionTemplate(1L); - insertPermissionTemplate(2L); - insertPermissionTemplate(3L); - insertPermissionTemplate(4L, "very_very_very_very_very_very_very_very_very_very_very_long_kee"); - - underTest.execute(); - - verifyUuidsAreNotNull(); - } - - @Test - public void migration_is_reentrant() throws SQLException { - insertPermissionTemplate(1L); - insertPermissionTemplate(2L); - insertPermissionTemplate(3L); - - underTest.execute(); - // re-entrant - underTest.execute(); - - verifyUuidsAreNotNull(); - } - - private void verifyUuidsAreNotNull() { - assertThat(db.select("select uuid from permission_templates") - .stream() - .map(row -> row.get("UUID")) - .filter(Objects::isNull) - .collect(Collectors.toList())).isEmpty(); - } - - private void insertPermissionTemplate(Long id) { - insertPermissionTemplate(id, uuidFactory.create()); - } - - private void insertPermissionTemplate(Long id, String kee) { - db.executeInsert("permission_templates", - "id", id, - "organization_uuid", id + 100, - "name", uuidFactory.create(), - "kee", kee); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtemplatesgroups/AddTemplateUuidColumnToPermTemplatesGroupsTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtemplatesgroups/AddTemplateUuidColumnToPermTemplatesGroupsTest.java deleted file mode 100644 index 0aeca477289..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtemplatesgroups/AddTemplateUuidColumnToPermTemplatesGroupsTest.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.permissiontemplates.fk.permtemplatesgroups; - -import java.sql.SQLException; -import java.sql.Types; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.core.util.UuidFactory; -import org.sonar.core.util.UuidFactoryFast; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.assertj.core.api.Assertions.assertThat; - -public class AddTemplateUuidColumnToPermTemplatesGroupsTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(AddTemplateUuidColumnToPermTemplatesGroupsTest.class, "schema.sql"); - - private UuidFactory uuidFactory = UuidFactoryFast.getInstance(); - - private DdlChange underTest = new AddTemplateUuidColumnToPermTemplatesGroups(db.database()); - - @Before - public void setup() { - insertPermissionTemplateGroup("1", 4L); - insertPermissionTemplateGroup("2", 5L); - insertPermissionTemplateGroup("3", 6L); - } - - @Test - public void add_uuid_column_to_permission_templates() throws SQLException { - underTest.execute(); - - db.assertColumnDefinition("perm_templates_groups", "template_uuid", Types.VARCHAR, 40, true); - - assertThat(db.countRowsOfTable("perm_templates_groups")) - .isEqualTo(3); - } - - private void insertPermissionTemplateGroup(String uuid, Long templateId) { - db.executeInsert("perm_templates_groups", - "uuid", uuid, - "template_id", templateId, - "permission_reference", uuidFactory.create()); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtemplatesgroups/DropTemplateIdColumnOfPermTemplatesGroupsTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtemplatesgroups/DropTemplateIdColumnOfPermTemplatesGroupsTableTest.java deleted file mode 100644 index 57014dc1fb8..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtemplatesgroups/DropTemplateIdColumnOfPermTemplatesGroupsTableTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.permissiontemplates.fk.permtemplatesgroups; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -import static org.assertj.core.api.Assertions.assertThatThrownBy; - -public class DropTemplateIdColumnOfPermTemplatesGroupsTableTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DropTemplateIdColumnOfPermTemplatesGroupsTableTest.class, "schema.sql"); - - private MigrationStep underTest = new DropTemplateIdColumnOfPermTemplatesGroupsTable(db.database()); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertColumnDoesNotExist("perm_templates_groups", "template_id"); - } - - @Test - public void migration_is_not_re_entrant() throws SQLException { - underTest.execute(); - - assertThatThrownBy(() -> underTest.execute()).isInstanceOf(IllegalStateException.class); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtemplatesgroups/MakePermTemplatesGroupsTemplateUuidColumnNotNullableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtemplatesgroups/MakePermTemplatesGroupsTemplateUuidColumnNotNullableTest.java deleted file mode 100644 index 412717b7b69..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtemplatesgroups/MakePermTemplatesGroupsTemplateUuidColumnNotNullableTest.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.permissiontemplates.fk.permtemplatesgroups; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -import static java.sql.Types.VARCHAR; - -public class MakePermTemplatesGroupsTemplateUuidColumnNotNullableTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(MakePermTemplatesGroupsTemplateUuidColumnNotNullableTest.class, "schema.sql"); - - private MigrationStep underTest = new MakePermTemplatesGroupsTemplateUuidColumnNotNullable(db.database()); - - @Test - public void uuid_column_is_not_null() throws SQLException { - underTest.execute(); - - db.assertColumnDefinition("perm_templates_groups", "template_uuid", VARCHAR, null, false); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtemplatesgroups/PopulatePermTemplatesGroupsTemplateUuidColumnTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtemplatesgroups/PopulatePermTemplatesGroupsTemplateUuidColumnTest.java deleted file mode 100644 index f431ac663c6..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtemplatesgroups/PopulatePermTemplatesGroupsTemplateUuidColumnTest.java +++ /dev/null @@ -1,138 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.permissiontemplates.fk.permtemplatesgroups; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.core.util.UuidFactory; -import org.sonar.core.util.UuidFactoryFast; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DataChange; - -import static org.assertj.core.api.Assertions.assertThat; - -public class PopulatePermTemplatesGroupsTemplateUuidColumnTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(PopulatePermTemplatesGroupsTemplateUuidColumnTest.class, "schema.sql"); - - private UuidFactory uuidFactory = UuidFactoryFast.getInstance(); - private DataChange underTest = new PopulatePermTemplatesGroupsTemplateUuidColumn(db.database()); - - @Test - public void populate_uuids() throws SQLException { - long permissionTemplateId_1 = 1L; - String permissionTemplateUuid_1 = "uuid-1"; - insertPermissionTemplate(permissionTemplateId_1, permissionTemplateUuid_1); - - long permissionTemplateId_2 = 2L; - String permissionTemplateUuid_2 = "uuid-2"; - insertPermissionTemplate(permissionTemplateId_2, permissionTemplateUuid_2); - - long permissionTemplateId_3 = 3L; - String permissionTemplateUuid_3 = "uuid-3"; - insertPermissionTemplate(permissionTemplateId_3, permissionTemplateUuid_3); - - insertPermissionTemplateGroup("4", permissionTemplateId_1); - insertPermissionTemplateGroup("5", permissionTemplateId_2); - insertPermissionTemplateGroup("6", permissionTemplateId_3); - - underTest.execute(); - - assertThatPermissionTemplateGroupTemplateUuidIsEqualTo("4", permissionTemplateUuid_1); - assertThatPermissionTemplateGroupTemplateUuidIsEqualTo("5", permissionTemplateUuid_2); - assertThatPermissionTemplateGroupTemplateUuidIsEqualTo("6", permissionTemplateUuid_3); - } - - @Test - public void delete_orphan_rows() throws SQLException { - long permissionTemplateId_1 = 1L; - String permissionTemplateUuid_1 = "uuid-1"; - insertPermissionTemplate(permissionTemplateId_1, permissionTemplateUuid_1); - - long permissionTemplateId_2 = 2L; - String permissionTemplateUuid_2 = "uuid-2"; - insertPermissionTemplate(permissionTemplateId_2, permissionTemplateUuid_2); - - long permissionTemplateId_3 = 3L; - String permissionTemplateUuid_3 = "uuid-3"; - insertPermissionTemplate(permissionTemplateId_3, permissionTemplateUuid_3); - - insertPermissionTemplateGroup("4", permissionTemplateId_1); - insertPermissionTemplateGroup("5", permissionTemplateId_2); - insertPermissionTemplateGroup("6", permissionTemplateId_3); - - underTest.execute(); - - assertThatPermissionTemplateGroupTemplateUuidIsEqualTo("4", permissionTemplateUuid_1); - assertThatPermissionTemplateGroupTemplateUuidIsEqualTo("5", permissionTemplateUuid_2); - assertThatPermissionTemplateGroupTemplateUuidIsEqualTo("6", permissionTemplateUuid_3); - } - - @Test - public void migration_is_reentrant() throws SQLException { - long permissionTemplateId_1 = 1L; - String permissionTemplateUuid_1 = "uuid-1"; - insertPermissionTemplate(permissionTemplateId_1, permissionTemplateUuid_1); - - long permissionTemplateId_2 = 2L; - String permissionTemplateUuid_2 = "uuid-2"; - insertPermissionTemplate(permissionTemplateId_2, permissionTemplateUuid_2); - - long permissionTemplateId_3 = 3L; - String permissionTemplateUuid_3 = "uuid-3"; - insertPermissionTemplate(permissionTemplateId_3, permissionTemplateUuid_3); - - insertPermissionTemplateGroup("4", permissionTemplateId_1); - insertPermissionTemplateGroup("5", permissionTemplateId_2); - insertPermissionTemplateGroup("6", 10L); - assertThat(db.countRowsOfTable("perm_templates_groups")).isEqualTo(3); - - underTest.execute(); - - assertThat(db.countRowsOfTable("perm_templates_groups")).isEqualTo(2); - } - - private void assertThatPermissionTemplateGroupTemplateUuidIsEqualTo(String permissionTemplateGroupUuid, String expectedUuid) { - assertThat(db.select("select template_uuid from perm_templates_groups where uuid = '" + permissionTemplateGroupUuid + "'") - .stream() - .map(row -> row.get("TEMPLATE_UUID")) - .findFirst()) - .hasValue(expectedUuid); - } - - private void insertPermissionTemplateGroup(String uuid, Long templateId) { - db.executeInsert("perm_templates_groups", - "uuid", uuid, - "template_id", templateId, - "permission_reference", uuidFactory.create()); - } - - private void insertPermissionTemplate(Long id, String uuid) { - db.executeInsert("permission_templates", - "id", id, - "uuid", uuid, - "organization_uuid", id + 100, - "name", uuidFactory.create(), - "kee", uuidFactory.create()); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtemplatesusers/AddTemplateUuidColumnToPermTemplatesUsersTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtemplatesusers/AddTemplateUuidColumnToPermTemplatesUsersTest.java deleted file mode 100644 index f3eecbc7c32..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtemplatesusers/AddTemplateUuidColumnToPermTemplatesUsersTest.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.permissiontemplates.fk.permtemplatesusers; - -import java.sql.SQLException; -import java.sql.Types; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.core.util.UuidFactory; -import org.sonar.core.util.UuidFactoryFast; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.assertj.core.api.Assertions.assertThat; - -public class AddTemplateUuidColumnToPermTemplatesUsersTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(AddTemplateUuidColumnToPermTemplatesUsersTest.class, "schema.sql"); - - private UuidFactory uuidFactory = UuidFactoryFast.getInstance(); - - private DdlChange underTest = new AddTemplateUuidColumnToPermTemplatesUsers(db.database()); - - @Before - public void setup() { - insertPermTemplatesUsers("1"); - insertPermTemplatesUsers("2"); - insertPermTemplatesUsers("3"); - } - - @Test - public void add_uuid_column_to_permission_templates() throws SQLException { - underTest.execute(); - - db.assertColumnDefinition("perm_templates_users", "template_uuid", Types.VARCHAR, 40, true); - - assertThat(db.countRowsOfTable("perm_templates_users")) - .isEqualTo(3); - } - - private void insertPermTemplatesUsers(String uuid) { - db.executeInsert("perm_templates_users", - "uuid", uuid, - "user_id", 100, - "template_id", 200, - "permission_reference", uuidFactory.create()); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtemplatesusers/DropTemplateIdColumnOfPermTemplatesUsersTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtemplatesusers/DropTemplateIdColumnOfPermTemplatesUsersTableTest.java deleted file mode 100644 index 7b9eebd9eb2..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtemplatesusers/DropTemplateIdColumnOfPermTemplatesUsersTableTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.permissiontemplates.fk.permtemplatesusers; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -import static org.assertj.core.api.Assertions.assertThatThrownBy; - -public class DropTemplateIdColumnOfPermTemplatesUsersTableTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DropTemplateIdColumnOfPermTemplatesUsersTableTest.class, "schema.sql"); - - private MigrationStep underTest = new DropTemplateIdColumnOfPermTemplatesUsersTable(db.database()); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertColumnDoesNotExist("perm_templates_users", "template_id"); - } - - @Test - public void migration_is_not_re_entrant() throws SQLException { - underTest.execute(); - - assertThatThrownBy(() -> underTest.execute()).isInstanceOf(IllegalStateException.class); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtemplatesusers/MakePermTemplatesUsersTemplateUuidColumnNotNullableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtemplatesusers/MakePermTemplatesUsersTemplateUuidColumnNotNullableTest.java deleted file mode 100644 index 7824258f14e..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtemplatesusers/MakePermTemplatesUsersTemplateUuidColumnNotNullableTest.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.permissiontemplates.fk.permtemplatesusers; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -import static java.sql.Types.VARCHAR; - -public class MakePermTemplatesUsersTemplateUuidColumnNotNullableTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(MakePermTemplatesUsersTemplateUuidColumnNotNullableTest.class, "schema.sql"); - - private MigrationStep underTest = new MakePermTemplatesUsersTemplateUuidColumnNotNullable(db.database()); - - @Test - public void uuid_column_is_not_null() throws SQLException { - underTest.execute(); - - db.assertColumnDefinition("perm_templates_users", "template_uuid", VARCHAR, null, false); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtemplatesusers/PopulatePermTemplatesUsersTemplateUuidColumnTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtemplatesusers/PopulatePermTemplatesUsersTemplateUuidColumnTest.java deleted file mode 100644 index 96adb67286b..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtemplatesusers/PopulatePermTemplatesUsersTemplateUuidColumnTest.java +++ /dev/null @@ -1,144 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.permissiontemplates.fk.permtemplatesusers; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.core.util.UuidFactory; -import org.sonar.core.util.UuidFactoryFast; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DataChange; - -import static org.assertj.core.api.Assertions.assertThat; - -public class PopulatePermTemplatesUsersTemplateUuidColumnTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(PopulatePermTemplatesUsersTemplateUuidColumnTest.class, "schema.sql"); - - private UuidFactory uuidFactory = UuidFactoryFast.getInstance(); - private DataChange underTest = new PopulatePermTemplatesUsersTemplateUuidColumn(db.database()); - - @Test - public void populate_uuids() throws SQLException { - long permissionTemplateId_1 = 1L; - String permissionTemplateUuid_1 = "uuid-1"; - insertPermissionTemplate(permissionTemplateId_1, permissionTemplateUuid_1); - - long permissionTemplateId_2 = 2L; - String permissionTemplateUuid_2 = "uuid-2"; - insertPermissionTemplate(permissionTemplateId_2, permissionTemplateUuid_2); - - long permissionTemplateId_3 = 3L; - String permissionTemplateUuid_3 = "uuid-3"; - insertPermissionTemplate(permissionTemplateId_3, permissionTemplateUuid_3); - - insertPermTemplatesUsers("4", permissionTemplateId_1); - insertPermTemplatesUsers("5", permissionTemplateId_2); - insertPermTemplatesUsers("6", permissionTemplateId_3); - - underTest.execute(); - - assertThatPermTemplatesUsersTemplateUuidIsEqualTo("4", permissionTemplateUuid_1); - assertThatPermTemplatesUsersTemplateUuidIsEqualTo("5", permissionTemplateUuid_2); - assertThatPermTemplatesUsersTemplateUuidIsEqualTo("6", permissionTemplateUuid_3); - } - - @Test - public void delete_orphan_rows() throws SQLException { - long permissionTemplateId_1 = 1L; - String permissionTemplateUuid_1 = "uuid-1"; - insertPermissionTemplate(permissionTemplateId_1, permissionTemplateUuid_1); - - long permissionTemplateId_2 = 2L; - String permissionTemplateUuid_2 = "uuid-2"; - insertPermissionTemplate(permissionTemplateId_2, permissionTemplateUuid_2); - - long permissionTemplateId_3 = 3L; - String permissionTemplateUuid_3 = "uuid-3"; - insertPermissionTemplate(permissionTemplateId_3, permissionTemplateUuid_3); - - insertPermTemplatesUsers("4", permissionTemplateId_1); - insertPermTemplatesUsers("5", permissionTemplateId_2); - insertPermTemplatesUsers("6", 10L); - - assertThat(db.countRowsOfTable("perm_templates_users")).isEqualTo(3); - - underTest.execute(); - - assertThatPermTemplatesUsersTemplateUuidIsEqualTo("4", permissionTemplateUuid_1); - assertThatPermTemplatesUsersTemplateUuidIsEqualTo("5", permissionTemplateUuid_2); - assertThat(db.countRowsOfTable("perm_templates_users")).isEqualTo(2); - } - - @Test - public void migration_is_reentrant() throws SQLException { - long permissionTemplateId_1 = 1L; - String permissionTemplateUuid_1 = "uuid-1"; - insertPermissionTemplate(permissionTemplateId_1, permissionTemplateUuid_1); - - long permissionTemplateId_2 = 2L; - String permissionTemplateUuid_2 = "uuid-2"; - insertPermissionTemplate(permissionTemplateId_2, permissionTemplateUuid_2); - - long permissionTemplateId_3 = 3L; - String permissionTemplateUuid_3 = "uuid-3"; - insertPermissionTemplate(permissionTemplateId_3, permissionTemplateUuid_3); - - insertPermTemplatesUsers("4", permissionTemplateId_1); - insertPermTemplatesUsers("5", permissionTemplateId_2); - insertPermTemplatesUsers("6", permissionTemplateId_3); - - underTest.execute(); - // re-entrant - underTest.execute(); - - assertThatPermTemplatesUsersTemplateUuidIsEqualTo("4", permissionTemplateUuid_1); - assertThatPermTemplatesUsersTemplateUuidIsEqualTo("5", permissionTemplateUuid_2); - assertThatPermTemplatesUsersTemplateUuidIsEqualTo("6", permissionTemplateUuid_3); - } - - private void assertThatPermTemplatesUsersTemplateUuidIsEqualTo(String permTemplatesUsersUuid, String expectedUuid) { - assertThat(db.select("select template_uuid from perm_templates_users where uuid = '" + permTemplatesUsersUuid + "'") - .stream() - .map(row -> row.get("TEMPLATE_UUID")) - .findFirst()) - .hasValue(expectedUuid); - } - - private void insertPermTemplatesUsers(String uuid, Long templateId) { - db.executeInsert("perm_templates_users", - "uuid", uuid, - "user_id", 100, - "template_id", templateId, - "permission_reference", uuidFactory.create()); - } - - private void insertPermissionTemplate(Long id, String uuid) { - db.executeInsert("permission_templates", - "id", id, - "uuid", uuid, - "organization_uuid", id + 100, - "name", uuidFactory.create(), - "kee", uuidFactory.create()); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtplcharacteristics/AddTemplateUuidColumnToPermTplCharacteristicsTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtplcharacteristics/AddTemplateUuidColumnToPermTplCharacteristicsTest.java deleted file mode 100644 index 735929bc794..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtplcharacteristics/AddTemplateUuidColumnToPermTplCharacteristicsTest.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.permissiontemplates.fk.permtplcharacteristics; - -import java.sql.SQLException; -import java.sql.Types; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.core.util.UuidFactory; -import org.sonar.core.util.UuidFactoryFast; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.assertj.core.api.Assertions.assertThat; - -public class AddTemplateUuidColumnToPermTplCharacteristicsTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(AddTemplateUuidColumnToPermTplCharacteristicsTest.class, "schema.sql"); - - private UuidFactory uuidFactory = UuidFactoryFast.getInstance(); - - private DdlChange underTest = new AddTemplateUuidColumnToPermTplCharacteristics(db.database()); - - @Before - public void setup() { - insertPermTplCharacteristics("1"); - insertPermTplCharacteristics("2"); - insertPermTplCharacteristics("3"); - } - - @Test - public void add_uuid_column_to_perm_tpl_characteristics() throws SQLException { - underTest.execute(); - - db.assertColumnDefinition("perm_tpl_characteristics", "template_uuid", Types.VARCHAR, 40, true); - - assertThat(db.countRowsOfTable("perm_tpl_characteristics")) - .isEqualTo(3); - } - - private void insertPermTplCharacteristics(String uuid) { - db.executeInsert("perm_tpl_characteristics", - "uuid", uuid, - "template_id", 100, - "permission_key", uuidFactory.create(), - "with_project_creator", false, - "created_at", System.currentTimeMillis(), - "updated_at", System.currentTimeMillis()); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtplcharacteristics/AddUniqueIndexOnTemplateUuidAndPermissionKeyColumnsOfPermTplCharacteristicsTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtplcharacteristics/AddUniqueIndexOnTemplateUuidAndPermissionKeyColumnsOfPermTplCharacteristicsTableTest.java deleted file mode 100644 index a26d62c8a5f..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtplcharacteristics/AddUniqueIndexOnTemplateUuidAndPermissionKeyColumnsOfPermTplCharacteristicsTableTest.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.permissiontemplates.fk.permtplcharacteristics; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -public class AddUniqueIndexOnTemplateUuidAndPermissionKeyColumnsOfPermTplCharacteristicsTableTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DropTemplateIdColumnOfPermTplCharacteristicsTableTest.class, "schema.sql"); - - private MigrationStep underTest = new AddUniqueIndexOnTemplateUuidAndPermissionKeyColumnsOfPermTplCharacteristicsTable(db.database()); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertUniqueIndex("perm_tpl_characteristics", "uniq_perm_tpl_charac", "template_uuid", "permission_key"); - } - - @Test - public void migration_is_re_entrant() throws SQLException { - underTest.execute(); - - // re-entrant - underTest.execute(); - - db.assertUniqueIndex("perm_tpl_characteristics", "uniq_perm_tpl_charac", "template_uuid", "permission_key"); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtplcharacteristics/DropTemplateIdColumnOfPermTplCharacteristicsTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtplcharacteristics/DropTemplateIdColumnOfPermTplCharacteristicsTableTest.java deleted file mode 100644 index d89a60aae96..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtplcharacteristics/DropTemplateIdColumnOfPermTplCharacteristicsTableTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.permissiontemplates.fk.permtplcharacteristics; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -import static org.assertj.core.api.Assertions.assertThatThrownBy; - -public class DropTemplateIdColumnOfPermTplCharacteristicsTableTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DropTemplateIdColumnOfPermTplCharacteristicsTableTest.class, "schema.sql"); - - private MigrationStep underTest = new DropTemplateIdColumnOfPermTplCharacteristicsTable(db.database()); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertColumnDoesNotExist("perm_tpl_characteristics", "template_id"); - } - - @Test - public void migration_is_not_re_entrant() throws SQLException { - underTest.execute(); - - assertThatThrownBy(() -> underTest.execute()).isInstanceOf(IllegalStateException.class); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtplcharacteristics/DropUniqueIndexOnTemplateIdAndPermissionKeyColumnsOfPermTplCharacteristicsTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtplcharacteristics/DropUniqueIndexOnTemplateIdAndPermissionKeyColumnsOfPermTplCharacteristicsTableTest.java deleted file mode 100644 index 2d7f7f9f3c2..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtplcharacteristics/DropUniqueIndexOnTemplateIdAndPermissionKeyColumnsOfPermTplCharacteristicsTableTest.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.permissiontemplates.fk.permtplcharacteristics; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -public class DropUniqueIndexOnTemplateIdAndPermissionKeyColumnsOfPermTplCharacteristicsTableTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DropTemplateIdColumnOfPermTplCharacteristicsTableTest.class, "schema.sql"); - - private MigrationStep underTest = new DropUniqueIndexOnTemplateIdAndPermissionKeyColumnsOfPermTplCharacteristicsTable(db.database()); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertIndexDoesNotExist("perm_tpl_characteristics", "uniq_perm_tpl_charac"); - } - - @Test - public void migration_is_re_entrant() throws SQLException { - underTest.execute(); - - // re-entrant - underTest.execute(); - - db.assertIndexDoesNotExist("perm_tpl_characteristics", "uniq_perm_tpl_charac"); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtplcharacteristics/MakePermTplCharacteristicsTemplateUuidColumnNotNullableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtplcharacteristics/MakePermTplCharacteristicsTemplateUuidColumnNotNullableTest.java deleted file mode 100644 index 0ce9ccdd980..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtplcharacteristics/MakePermTplCharacteristicsTemplateUuidColumnNotNullableTest.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.permissiontemplates.fk.permtplcharacteristics; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -import static java.sql.Types.VARCHAR; - -public class MakePermTplCharacteristicsTemplateUuidColumnNotNullableTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(MakePermTplCharacteristicsTemplateUuidColumnNotNullableTest.class, "schema.sql"); - - private MigrationStep underTest = new MakePermTplCharacteristicsTemplateUuidColumnNotNullable(db.database()); - - @Test - public void uuid_column_is_not_null() throws SQLException { - underTest.execute(); - - db.assertColumnDefinition("perm_tpl_characteristics", "template_uuid", VARCHAR, null, false); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtplcharacteristics/PopulatePermTplCharacteristicsTemplateUuidColumnTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtplcharacteristics/PopulatePermTplCharacteristicsTemplateUuidColumnTest.java deleted file mode 100644 index 2be6b404575..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtplcharacteristics/PopulatePermTplCharacteristicsTemplateUuidColumnTest.java +++ /dev/null @@ -1,146 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.permissiontemplates.fk.permtplcharacteristics; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.core.util.UuidFactory; -import org.sonar.core.util.UuidFactoryFast; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DataChange; - -import static org.assertj.core.api.Assertions.assertThat; - -public class PopulatePermTplCharacteristicsTemplateUuidColumnTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(PopulatePermTplCharacteristicsTemplateUuidColumnTest.class, "schema.sql"); - - private UuidFactory uuidFactory = UuidFactoryFast.getInstance(); - private DataChange underTest = new PopulatePermTplCharacteristicsTemplateUuidColumn(db.database()); - - @Test - public void populate_uuids() throws SQLException { - long permissionTemplateId_1 = 1L; - String permissionTemplateUuid_1 = "uuid-1"; - insertPermissionTemplate(permissionTemplateId_1, permissionTemplateUuid_1); - - long permissionTemplateId_2 = 2L; - String permissionTemplateUuid_2 = "uuid-2"; - insertPermissionTemplate(permissionTemplateId_2, permissionTemplateUuid_2); - - long permissionTemplateId_3 = 3L; - String permissionTemplateUuid_3 = "uuid-3"; - insertPermissionTemplate(permissionTemplateId_3, permissionTemplateUuid_3); - - insertPermTplCharacteristics("4", permissionTemplateId_1); - insertPermTplCharacteristics("5", permissionTemplateId_2); - insertPermTplCharacteristics("6", permissionTemplateId_3); - - underTest.execute(); - - assertThatPermTplCharacteristicsTemplateUuidIsEqualTo("4", permissionTemplateUuid_1); - assertThatPermTplCharacteristicsTemplateUuidIsEqualTo("5", permissionTemplateUuid_2); - assertThatPermTplCharacteristicsTemplateUuidIsEqualTo("6", permissionTemplateUuid_3); - } - - @Test - public void delete_orphan_rows() throws SQLException { - long permissionTemplateId_1 = 1L; - String permissionTemplateUuid_1 = "uuid-1"; - insertPermissionTemplate(permissionTemplateId_1, permissionTemplateUuid_1); - - long permissionTemplateId_2 = 2L; - String permissionTemplateUuid_2 = "uuid-2"; - insertPermissionTemplate(permissionTemplateId_2, permissionTemplateUuid_2); - - long permissionTemplateId_3 = 3L; - String permissionTemplateUuid_3 = "uuid-3"; - insertPermissionTemplate(permissionTemplateId_3, permissionTemplateUuid_3); - - insertPermTplCharacteristics("4", permissionTemplateId_1); - insertPermTplCharacteristics("5", permissionTemplateId_2); - insertPermTplCharacteristics("6", 10L); - - assertThat(db.countRowsOfTable("perm_tpl_characteristics")).isEqualTo(3); - - underTest.execute(); - - assertThatPermTplCharacteristicsTemplateUuidIsEqualTo("4", permissionTemplateUuid_1); - assertThatPermTplCharacteristicsTemplateUuidIsEqualTo("5", permissionTemplateUuid_2); - assertThat(db.countRowsOfTable("perm_tpl_characteristics")).isEqualTo(2); - - } - - @Test - public void migration_is_reentrant() throws SQLException { - long permissionTemplateId_1 = 1L; - String permissionTemplateUuid_1 = "uuid-1"; - insertPermissionTemplate(permissionTemplateId_1, permissionTemplateUuid_1); - - long permissionTemplateId_2 = 2L; - String permissionTemplateUuid_2 = "uuid-2"; - insertPermissionTemplate(permissionTemplateId_2, permissionTemplateUuid_2); - - long permissionTemplateId_3 = 3L; - String permissionTemplateUuid_3 = "uuid-3"; - insertPermissionTemplate(permissionTemplateId_3, permissionTemplateUuid_3); - - insertPermTplCharacteristics("4", permissionTemplateId_1); - insertPermTplCharacteristics("5", permissionTemplateId_2); - insertPermTplCharacteristics("6", permissionTemplateId_3); - - underTest.execute(); - // re-entrant - underTest.execute(); - - assertThatPermTplCharacteristicsTemplateUuidIsEqualTo("4", permissionTemplateUuid_1); - assertThatPermTplCharacteristicsTemplateUuidIsEqualTo("5", permissionTemplateUuid_2); - assertThatPermTplCharacteristicsTemplateUuidIsEqualTo("6", permissionTemplateUuid_3); - } - - private void assertThatPermTplCharacteristicsTemplateUuidIsEqualTo(String permTplCharacteristicsUuid, String expectedUuid) { - assertThat(db.select("select template_uuid from perm_tpl_characteristics where uuid = '" + permTplCharacteristicsUuid + "'") - .stream() - .map(row -> row.get("TEMPLATE_UUID")) - .findFirst()) - .hasValue(expectedUuid); - } - - private void insertPermTplCharacteristics(String uuid, long templateId) { - db.executeInsert("perm_tpl_characteristics", - "uuid", uuid, - "template_id", templateId, - "permission_key", uuidFactory.create(), - "with_project_creator", false, - "created_at", System.currentTimeMillis(), - "updated_at", System.currentTimeMillis()); - } - - private void insertPermissionTemplate(Long id, String uuid) { - db.executeInsert("permission_templates", - "id", id, - "uuid", uuid, - "organization_uuid", id + 100, - "name", uuidFactory.create(), - "kee", uuidFactory.create()); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permtemplatesgroups/AddPrimaryKeyOnUuidColumnOfPermTemplatesGroupsTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permtemplatesgroups/AddPrimaryKeyOnUuidColumnOfPermTemplatesGroupsTableTest.java deleted file mode 100644 index 1b8241f7a23..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permtemplatesgroups/AddPrimaryKeyOnUuidColumnOfPermTemplatesGroupsTableTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.permtemplatesgroups; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.assertj.core.api.Assertions.assertThatThrownBy; - -public class AddPrimaryKeyOnUuidColumnOfPermTemplatesGroupsTableTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema( - AddPrimaryKeyOnUuidColumnOfPermTemplatesGroupsTableTest.class, "schema.sql"); - - private DdlChange underTest = new AddPrimaryKeyOnUuidColumnOfPermTemplatesGroupsTable(db.database()); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertPrimaryKey("perm_templates_groups", "pk_perm_templates_groups", "uuid"); - } - - @Test - public void migration_is_not_re_entrant() throws SQLException { - underTest.execute(); - - assertThatThrownBy(() -> underTest.execute()).isInstanceOf(IllegalStateException.class); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permtemplatesgroups/AddUuidColumnToPermTemplatesGroupsTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permtemplatesgroups/AddUuidColumnToPermTemplatesGroupsTableTest.java deleted file mode 100644 index 3a589c05549..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permtemplatesgroups/AddUuidColumnToPermTemplatesGroupsTableTest.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.permtemplatesgroups; - -import java.sql.SQLException; -import java.sql.Types; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.assertj.core.api.Assertions.assertThat; - -public class AddUuidColumnToPermTemplatesGroupsTableTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(AddUuidColumnToPermTemplatesGroupsTableTest.class, "schema.sql"); - - private DdlChange underTest = new AddUuidColumnToPermTemplatesGroupsTable(db.database()); - - @Before - public void setup() { - insertPermTemplatesGroups(1L); - insertPermTemplatesGroups(2L); - insertPermTemplatesGroups(3L); - } - - @Test - public void add_uuid_column() throws SQLException { - underTest.execute(); - - db.assertColumnDefinition("perm_templates_groups", "uuid", Types.VARCHAR, 40, true); - - assertThat(db.countRowsOfTable("perm_templates_groups")) - .isEqualTo(3); - } - - private void insertPermTemplatesGroups(Long id) { - db.executeInsert("perm_templates_groups", - "id", id, - "group_id", id + 1, - "template_id", id + 2, - "permission_reference", "ref" + id); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permtemplatesgroups/DropIdColumnOfPermTemplatesGroupsTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permtemplatesgroups/DropIdColumnOfPermTemplatesGroupsTableTest.java deleted file mode 100644 index ccb14836cee..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permtemplatesgroups/DropIdColumnOfPermTemplatesGroupsTableTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.permtemplatesgroups; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.assertj.core.api.Assertions.assertThatThrownBy; - -public class DropIdColumnOfPermTemplatesGroupsTableTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DropIdColumnOfPermTemplatesGroupsTableTest.class, "schema.sql"); - - private DdlChange underTest = new DropIdColumnOfPermTemplatesGroupsTable(db.database()); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertColumnDoesNotExist("perm_templates_groups", "id"); - } - - @Test - public void migration_is_not_re_entrant() throws SQLException { - underTest.execute(); - - assertThatThrownBy(() -> underTest.execute()).isInstanceOf(IllegalStateException.class); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permtemplatesgroups/DropPrimaryKeyOnIdColumnOfPermTemplatesGroupsTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permtemplatesgroups/DropPrimaryKeyOnIdColumnOfPermTemplatesGroupsTableTest.java deleted file mode 100644 index b429bf529ee..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permtemplatesgroups/DropPrimaryKeyOnIdColumnOfPermTemplatesGroupsTableTest.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.permtemplatesgroups; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.sql.DbPrimaryKeyConstraintFinder; -import org.sonar.server.platform.db.migration.sql.DropPrimaryKeySqlGenerator; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class DropPrimaryKeyOnIdColumnOfPermTemplatesGroupsTableTest { - - private static final String TABLE_NAME = "perm_templates_groups"; - @Rule - public CoreDbTester db = CoreDbTester.createForSchema( - DropPrimaryKeyOnIdColumnOfPermTemplatesGroupsTableTest.class, "schema.sql"); - - private final DropPrimaryKeySqlGenerator dropPrimaryKeySqlGenerator = new DropPrimaryKeySqlGenerator(db.database(), new DbPrimaryKeyConstraintFinder(db.database())); - - private final DdlChange underTest = new DropPrimaryKeyOnIdColumnOfPermTemplatesGroupsTable(db.database(), dropPrimaryKeySqlGenerator); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertNoPrimaryKey(TABLE_NAME); - } - - @Test - public void migration_is_re_entrant_but_fails_silently() throws SQLException { - underTest.execute(); - underTest.execute(); - - db.assertNoPrimaryKey(TABLE_NAME); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permtemplatesgroups/MakePermTemplatesGroupsUuidColumnNotNullableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permtemplatesgroups/MakePermTemplatesGroupsUuidColumnNotNullableTest.java deleted file mode 100644 index 11e2f1da881..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permtemplatesgroups/MakePermTemplatesGroupsUuidColumnNotNullableTest.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.permtemplatesgroups; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -import static java.sql.Types.VARCHAR; - -public class MakePermTemplatesGroupsUuidColumnNotNullableTest { - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(MakePermTemplatesGroupsUuidColumnNotNullableTest.class, "schema.sql"); - - private MigrationStep underTest = new MakePermTemplatesGroupsUuidColumnNotNullable(db.database()); - - @Test - public void uuid_column_is_not_nullable() throws SQLException { - underTest.execute(); - - db.assertColumnDefinition("perm_templates_groups", "uuid", VARCHAR, null, false); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permtemplatesgroups/PopulatePermTemplatesGroupsUuidTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permtemplatesgroups/PopulatePermTemplatesGroupsUuidTest.java deleted file mode 100644 index 5d352b72d4b..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permtemplatesgroups/PopulatePermTemplatesGroupsUuidTest.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.permtemplatesgroups; - -import java.sql.SQLException; -import java.util.Objects; -import java.util.stream.Collectors; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.core.util.UuidFactory; -import org.sonar.core.util.UuidFactoryFast; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DataChange; - -import static org.assertj.core.api.Assertions.assertThat; - -public class PopulatePermTemplatesGroupsUuidTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(PopulatePermTemplatesGroupsUuidTest.class, "schema.sql"); - - private UuidFactory uuidFactory = UuidFactoryFast.getInstance(); - private DataChange underTest = new PopulatePermTemplatesGroupsUuid(db.database(), uuidFactory); - - @Test - public void populate_uuids() throws SQLException { - insertPermTemplatesGroups(1L); - insertPermTemplatesGroups(2L); - insertPermTemplatesGroups(3L); - - underTest.execute(); - - verifyUuidsAreNotNull(); - } - - @Test - public void migration_is_reentrant() throws SQLException { - insertPermTemplatesGroups(1L); - insertPermTemplatesGroups(2L); - insertPermTemplatesGroups(3L); - - underTest.execute(); - // re-entrant - underTest.execute(); - - verifyUuidsAreNotNull(); - } - - private void verifyUuidsAreNotNull() { - assertThat(db.select("select uuid from perm_templates_groups") - .stream() - .map(row -> row.get("UUID")) - .filter(Objects::isNull) - .collect(Collectors.toList())).isEmpty(); - } - - private void insertPermTemplatesGroups(Long id) { - db.executeInsert("perm_templates_groups", - "id", id, - "group_id", id + 1, - "template_id", id + 2, - "permission_reference", "ref" + id); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permtemplatesusers/AddPrimaryKeyOnUuidColumnOfPermTemplatesUsersTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permtemplatesusers/AddPrimaryKeyOnUuidColumnOfPermTemplatesUsersTableTest.java deleted file mode 100644 index 93197277beb..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permtemplatesusers/AddPrimaryKeyOnUuidColumnOfPermTemplatesUsersTableTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.permtemplatesusers; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.assertj.core.api.Assertions.assertThatThrownBy; - -public class AddPrimaryKeyOnUuidColumnOfPermTemplatesUsersTableTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema( - AddPrimaryKeyOnUuidColumnOfPermTemplatesUsersTableTest.class, "schema.sql"); - - private DdlChange underTest = new AddPrimaryKeyOnUuidColumnOfPermTemplatesUsersTable(db.database()); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertPrimaryKey("perm_templates_users", "pk_perm_templates_users", "uuid"); - } - - @Test - public void migration_is_not_re_entrant() throws SQLException { - underTest.execute(); - - assertThatThrownBy(() -> underTest.execute()).isInstanceOf(IllegalStateException.class); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permtemplatesusers/AddUuidColumnToPermTemplatesUsersTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permtemplatesusers/AddUuidColumnToPermTemplatesUsersTableTest.java deleted file mode 100644 index fd8713eeee6..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permtemplatesusers/AddUuidColumnToPermTemplatesUsersTableTest.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.permtemplatesusers; - -import java.sql.SQLException; -import java.sql.Types; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.assertj.core.api.Assertions.assertThat; - -public class AddUuidColumnToPermTemplatesUsersTableTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(AddUuidColumnToPermTemplatesUsersTableTest.class, "schema.sql"); - - private DdlChange underTest = new AddUuidColumnToPermTemplatesUsersTable(db.database()); - - @Before - public void setup() { - insertPermTemplatesUsers(1L); - insertPermTemplatesUsers(2L); - insertPermTemplatesUsers(3L); - } - - @Test - public void add_uuid_column() throws SQLException { - underTest.execute(); - - db.assertColumnDefinition("perm_templates_users", "uuid", Types.VARCHAR, 40, true); - - assertThat(db.countRowsOfTable("perm_templates_users")) - .isEqualTo(3); - } - - private void insertPermTemplatesUsers(Long id) { - db.executeInsert("perm_templates_users", - "id", id, - "user_id", id + 1, - "template_id", id + 2, - "permission_reference", "ref" + id); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permtemplatesusers/DropIdColumnOfPermTemplatesUsersTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permtemplatesusers/DropIdColumnOfPermTemplatesUsersTableTest.java deleted file mode 100644 index 4c406cda944..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permtemplatesusers/DropIdColumnOfPermTemplatesUsersTableTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.permtemplatesusers; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.assertj.core.api.Assertions.assertThatThrownBy; - -public class DropIdColumnOfPermTemplatesUsersTableTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DropIdColumnOfPermTemplatesUsersTableTest.class, "schema.sql"); - - private DdlChange underTest = new DropIdColumnOfPermTemplatesUsersTable(db.database()); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertColumnDoesNotExist("perm_templates_users", "id"); - } - - @Test - public void migration_is_not_re_entrant() throws SQLException { - underTest.execute(); - - assertThatThrownBy(() -> underTest.execute()).isInstanceOf(IllegalStateException.class); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permtemplatesusers/DropPrimaryKeyOnIdColumnOfPermTemplatesUsersTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permtemplatesusers/DropPrimaryKeyOnIdColumnOfPermTemplatesUsersTableTest.java deleted file mode 100644 index 0754f744af5..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permtemplatesusers/DropPrimaryKeyOnIdColumnOfPermTemplatesUsersTableTest.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.permtemplatesusers; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.sql.DbPrimaryKeyConstraintFinder; -import org.sonar.server.platform.db.migration.sql.DropPrimaryKeySqlGenerator; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class DropPrimaryKeyOnIdColumnOfPermTemplatesUsersTableTest { - - private static final String TABLE_NAME = "perm_templates_users"; - @Rule - public CoreDbTester db = CoreDbTester.createForSchema( - DropPrimaryKeyOnIdColumnOfPermTemplatesUsersTableTest.class, "schema.sql"); - - private final DropPrimaryKeySqlGenerator dropPrimaryKeySqlGenerator = new DropPrimaryKeySqlGenerator(db.database(), new DbPrimaryKeyConstraintFinder(db.database())); - - private final DdlChange underTest = new DropPrimaryKeyOnIdColumnOfPermTemplatesUsersTable(db.database(), dropPrimaryKeySqlGenerator); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertNoPrimaryKey(TABLE_NAME); - } - - @Test - public void migration_is_re_entrant_but_fails_silently() throws SQLException { - underTest.execute(); - underTest.execute(); - - db.assertNoPrimaryKey(TABLE_NAME); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permtemplatesusers/MakePermTemplatesUsersUuidColumnNotNullableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permtemplatesusers/MakePermTemplatesUsersUuidColumnNotNullableTest.java deleted file mode 100644 index 7e74f21cad5..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permtemplatesusers/MakePermTemplatesUsersUuidColumnNotNullableTest.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.permtemplatesusers; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -import static java.sql.Types.VARCHAR; - -public class MakePermTemplatesUsersUuidColumnNotNullableTest { - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(MakePermTemplatesUsersUuidColumnNotNullableTest.class, "schema.sql"); - - private MigrationStep underTest = new MakePermTemplatesUsersUuidColumnNotNullable(db.database()); - - @Test - public void uuid_column_is_not_nullable() throws SQLException { - underTest.execute(); - - db.assertColumnDefinition("perm_templates_users", "uuid", VARCHAR, null, false); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permtemplatesusers/PopulatePermTemplatesUsersUuidTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permtemplatesusers/PopulatePermTemplatesUsersUuidTest.java deleted file mode 100644 index d95e19275f6..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permtemplatesusers/PopulatePermTemplatesUsersUuidTest.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.permtemplatesusers; - -import java.sql.SQLException; -import java.util.Objects; -import java.util.stream.Collectors; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.core.util.UuidFactory; -import org.sonar.core.util.UuidFactoryFast; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DataChange; - -import static org.assertj.core.api.Assertions.assertThat; - -public class PopulatePermTemplatesUsersUuidTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(PopulatePermTemplatesUsersUuidTest.class, "schema.sql"); - - private UuidFactory uuidFactory = UuidFactoryFast.getInstance(); - private DataChange underTest = new PopulatePermTemplatesUsersUuid(db.database(), uuidFactory); - - @Test - public void populate_uuids() throws SQLException { - insertPermTemplatesUsers(1L); - insertPermTemplatesUsers(2L); - insertPermTemplatesUsers(3L); - - underTest.execute(); - - verifyUuidsAreNotNull(); - } - - @Test - public void migration_is_reentrant() throws SQLException { - insertPermTemplatesUsers(1L); - insertPermTemplatesUsers(2L); - insertPermTemplatesUsers(3L); - - underTest.execute(); - // re-entrant - underTest.execute(); - - verifyUuidsAreNotNull(); - } - - private void verifyUuidsAreNotNull() { - assertThat(db.select("select uuid from perm_templates_users") - .stream() - .map(row -> row.get("UUID")) - .filter(Objects::isNull) - .collect(Collectors.toList())).isEmpty(); - } - - private void insertPermTemplatesUsers(Long id) { - db.executeInsert("perm_templates_users", - "id", id, - "user_id", id + 1, - "template_id", id + 2, - "permission_reference", "ref" + id); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permtplcharacteristics/AddPrimaryKeyOnUuidColumnOfPermTplCharacteristicsTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permtplcharacteristics/AddPrimaryKeyOnUuidColumnOfPermTplCharacteristicsTableTest.java deleted file mode 100644 index b4ee75a6189..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permtplcharacteristics/AddPrimaryKeyOnUuidColumnOfPermTplCharacteristicsTableTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.permtplcharacteristics; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.assertj.core.api.Assertions.assertThatThrownBy; - -public class AddPrimaryKeyOnUuidColumnOfPermTplCharacteristicsTableTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema( - AddPrimaryKeyOnUuidColumnOfPermTplCharacteristicsTableTest.class, "schema.sql"); - - private DdlChange underTest = new AddPrimaryKeyOnUuidColumnOfPermTplCharacteristicsTable(db.database()); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertPrimaryKey("perm_tpl_characteristics", "pk_perm_tpl_characteristics", "uuid"); - } - - @Test - public void migration_is_not_re_entrant() throws SQLException { - underTest.execute(); - - assertThatThrownBy(() -> underTest.execute()).isInstanceOf(IllegalStateException.class); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permtplcharacteristics/AddUuidColumnToPermTplCharacteristicsTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permtplcharacteristics/AddUuidColumnToPermTplCharacteristicsTableTest.java deleted file mode 100644 index 28b4a964daf..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permtplcharacteristics/AddUuidColumnToPermTplCharacteristicsTableTest.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.permtplcharacteristics; - -import java.sql.SQLException; -import java.sql.Types; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.assertj.core.api.Assertions.assertThat; - -public class AddUuidColumnToPermTplCharacteristicsTableTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(AddUuidColumnToPermTplCharacteristicsTableTest.class, "schema.sql"); - - private DdlChange underTest = new AddUuidColumnToPermTplCharacteristicsTable(db.database()); - - @Before - public void setup() { - insertPermTplCharacteristics(1L); - insertPermTplCharacteristics(2L); - insertPermTplCharacteristics(3L); - } - - @Test - public void add_uuid_column() throws SQLException { - underTest.execute(); - - db.assertColumnDefinition("perm_tpl_characteristics", "uuid", Types.VARCHAR, 40, true); - - assertThat(db.countRowsOfTable("perm_tpl_characteristics")) - .isEqualTo(3); - } - - private void insertPermTplCharacteristics(Long id) { - db.executeInsert("perm_tpl_characteristics", - "id", id, - "template_id", id + 1, - "permission_key", "key" + id + 2, - "with_project_creator", true, - "created_at", id + 3, - "updated_at", id + 4); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permtplcharacteristics/DropIdColumnOfPermTplCharacteristicsTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permtplcharacteristics/DropIdColumnOfPermTplCharacteristicsTableTest.java deleted file mode 100644 index d3344418b73..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permtplcharacteristics/DropIdColumnOfPermTplCharacteristicsTableTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.permtplcharacteristics; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.assertj.core.api.Assertions.assertThatThrownBy; - -public class DropIdColumnOfPermTplCharacteristicsTableTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DropIdColumnOfPermTplCharacteristicsTableTest.class, "schema.sql"); - - private DdlChange underTest = new DropIdColumnOfPermTplCharacteristicsTable(db.database()); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertColumnDoesNotExist("perm_tpl_characteristics", "id"); - } - - @Test - public void migration_is_not_re_entrant() throws SQLException { - underTest.execute(); - - assertThatThrownBy(() -> underTest.execute()).isInstanceOf(IllegalStateException.class); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permtplcharacteristics/DropPrimaryKeyOnIdColumnOfPermTplCharacteristicsTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permtplcharacteristics/DropPrimaryKeyOnIdColumnOfPermTplCharacteristicsTableTest.java deleted file mode 100644 index 55a39f46937..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permtplcharacteristics/DropPrimaryKeyOnIdColumnOfPermTplCharacteristicsTableTest.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.permtplcharacteristics; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.sql.DbPrimaryKeyConstraintFinder; -import org.sonar.server.platform.db.migration.sql.DropPrimaryKeySqlGenerator; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class DropPrimaryKeyOnIdColumnOfPermTplCharacteristicsTableTest { - - private static final String TABLE_NAME = "perm_tpl_characteristics"; - @Rule - public CoreDbTester db = CoreDbTester.createForSchema( - DropPrimaryKeyOnIdColumnOfPermTplCharacteristicsTableTest.class, "schema.sql"); - - private final DropPrimaryKeySqlGenerator dropPrimaryKeySqlGenerator = new DropPrimaryKeySqlGenerator(db.database(), new DbPrimaryKeyConstraintFinder(db.database())); - - private final DdlChange underTest = new DropPrimaryKeyOnIdColumnOfPermTplCharacteristicsTable(db.database(), dropPrimaryKeySqlGenerator); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertNoPrimaryKey(TABLE_NAME); - } - - @Test - public void migration_is_re_entrant_but_fails_silently() throws SQLException { - underTest.execute(); - underTest.execute(); - - db.assertNoPrimaryKey(TABLE_NAME); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permtplcharacteristics/MakePermTplCharacteristicsUuidColumnNotNullableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permtplcharacteristics/MakePermTplCharacteristicsUuidColumnNotNullableTest.java deleted file mode 100644 index bf321cd18b7..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permtplcharacteristics/MakePermTplCharacteristicsUuidColumnNotNullableTest.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.permtplcharacteristics; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -import static java.sql.Types.VARCHAR; - -public class MakePermTplCharacteristicsUuidColumnNotNullableTest { - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(MakePermTplCharacteristicsUuidColumnNotNullableTest.class, "schema.sql"); - - private MigrationStep underTest = new MakePermTplCharacteristicsUuidColumnNotNullable(db.database()); - - @Test - public void uuid_column_is_not_nullable() throws SQLException { - underTest.execute(); - - db.assertColumnDefinition("perm_tpl_characteristics", "uuid", VARCHAR, null, false); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permtplcharacteristics/PopulatePermTplCharacteristicsUuidTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permtplcharacteristics/PopulatePermTplCharacteristicsUuidTest.java deleted file mode 100644 index fe3c75f8a8f..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/permtplcharacteristics/PopulatePermTplCharacteristicsUuidTest.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.permtplcharacteristics; - -import java.sql.SQLException; -import java.util.Objects; -import java.util.stream.Collectors; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.core.util.UuidFactory; -import org.sonar.core.util.UuidFactoryFast; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DataChange; - -import static org.assertj.core.api.Assertions.assertThat; - -public class PopulatePermTplCharacteristicsUuidTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(PopulatePermTplCharacteristicsUuidTest.class, "schema.sql"); - - private UuidFactory uuidFactory = UuidFactoryFast.getInstance(); - private DataChange underTest = new PopulatePermTplCharacteristicsUuid(db.database(), uuidFactory); - - @Test - public void populate_uuids() throws SQLException { - insertPermTplCharacteristics(1L); - insertPermTplCharacteristics(2L); - insertPermTplCharacteristics(3L); - - underTest.execute(); - - verifyUuidsAreNotNull(); - } - - @Test - public void migration_is_reentrant() throws SQLException { - insertPermTplCharacteristics(1L); - insertPermTplCharacteristics(2L); - insertPermTplCharacteristics(3L); - - underTest.execute(); - // re-entrant - underTest.execute(); - - verifyUuidsAreNotNull(); - } - - private void verifyUuidsAreNotNull() { - assertThat(db.select("select uuid from perm_tpl_characteristics") - .stream() - .map(row -> row.get("UUID")) - .filter(Objects::isNull) - .collect(Collectors.toList())).isEmpty(); - } - - private void insertPermTplCharacteristics(Long id) { - db.executeInsert("perm_tpl_characteristics", - "id", id, - "template_id", id + 1, - "permission_key", "key" + id + 2, - "with_project_creator", true, - "created_at", id + 3, - "updated_at", id + 4); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/projectmeasures/AddPrimaryKeyOnUuidColumnOfProjectMeasureTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/projectmeasures/AddPrimaryKeyOnUuidColumnOfProjectMeasureTableTest.java deleted file mode 100644 index d30a0e3b6f3..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/projectmeasures/AddPrimaryKeyOnUuidColumnOfProjectMeasureTableTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.projectmeasures; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -import static org.assertj.core.api.Assertions.assertThatThrownBy; - -public class AddPrimaryKeyOnUuidColumnOfProjectMeasureTableTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(AddPrimaryKeyOnUuidColumnOfProjectMeasureTableTest.class, "schema.sql"); - - private MigrationStep underTest = new AddPrimaryKeyOnUuidColumnOfProjectMeasuresTable(db.database()); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertPrimaryKey("project_measures", "pk_project_measures", "uuid"); - } - - @Test - public void migration_is_not_re_entrant() throws SQLException { - underTest.execute(); - - assertThatThrownBy(() -> underTest.execute()).isInstanceOf(IllegalStateException.class); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/projectmeasures/AddTechIndexOnUuidOfProjectMeasuresTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/projectmeasures/AddTechIndexOnUuidOfProjectMeasuresTableTest.java deleted file mode 100644 index 8caae1d8cfd..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/projectmeasures/AddTechIndexOnUuidOfProjectMeasuresTableTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.projectmeasures; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -public class AddTechIndexOnUuidOfProjectMeasuresTableTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(AddTechIndexOnUuidOfProjectMeasuresTableTest.class, "schema.sql"); - - private MigrationStep underTest = new AddTechIndexOnUuidOfProjectMeasuresTable(db.database()); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertIndex("project_measures", "tech_index_uuid", "uuid"); - } - - @Test - public void migration_is_re_entrant() throws SQLException { - underTest.execute(); - - // re-entrant - underTest.execute(); - - db.assertIndex("project_measures", "tech_index_uuid", "uuid"); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/projectmeasures/AddUuidToProjectMeasuresTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/projectmeasures/AddUuidToProjectMeasuresTest.java deleted file mode 100644 index 6655b0eac8c..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/projectmeasures/AddUuidToProjectMeasuresTest.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.projectmeasures; - -import java.sql.SQLException; -import java.sql.Types; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.core.util.UuidFactory; -import org.sonar.core.util.UuidFactoryFast; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.assertj.core.api.Assertions.assertThat; - -public class AddUuidToProjectMeasuresTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(AddUuidToProjectMeasuresTest.class, "schema.sql"); - - private UuidFactory uuidFactory = UuidFactoryFast.getInstance(); - - private DdlChange underTest = new AddUuidColumnToProjectMeasures(db.database()); - - @Before - public void setup() { - insertProjectMeasure(1L); - insertProjectMeasure(2L); - insertProjectMeasure(3L); - } - - @Test - public void add_uuid_column_to_project_measures() throws SQLException { - underTest.execute(); - - db.assertColumnDefinition("project_measures", "uuid", Types.VARCHAR, 40, true); - - assertThat(db.countSql("select count(id) from project_measures")) - .isEqualTo(3); - } - - private void insertProjectMeasure(Long id) { - db.executeInsert("project_measures", - "id", id, - "metric_id", id + 100, - "analysis_uuid", uuidFactory.create(), - "component_uuid", uuidFactory.create()); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/projectmeasures/DropIdColumnOfProjectMeasuresTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/projectmeasures/DropIdColumnOfProjectMeasuresTableTest.java deleted file mode 100644 index 41e0d8716d0..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/projectmeasures/DropIdColumnOfProjectMeasuresTableTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.projectmeasures; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -import static org.assertj.core.api.Assertions.assertThatThrownBy; - -public class DropIdColumnOfProjectMeasuresTableTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DropIdColumnOfProjectMeasuresTableTest.class, "schema.sql"); - - private MigrationStep underTest = new DropIdColumnOfProjectMeasuresTable(db.database()); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertColumnDoesNotExist("project_measures", "id"); - } - - @Test - public void migration_is_not_re_entrant() throws SQLException { - underTest.execute(); - - assertThatThrownBy(() -> underTest.execute()).isInstanceOf(IllegalStateException.class); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/projectmeasures/DropPrimaryKeyOnIdColumnOfProjectMeasuresTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/projectmeasures/DropPrimaryKeyOnIdColumnOfProjectMeasuresTableTest.java deleted file mode 100644 index 6dd3642e47c..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/projectmeasures/DropPrimaryKeyOnIdColumnOfProjectMeasuresTableTest.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.projectmeasures; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.sql.DbPrimaryKeyConstraintFinder; -import org.sonar.server.platform.db.migration.sql.DropPrimaryKeySqlGenerator; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -public class DropPrimaryKeyOnIdColumnOfProjectMeasuresTableTest { - - private static final String TABLE_NAME = "project_measures"; - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DropPrimaryKeyOnIdColumnOfProjectMeasuresTableTest.class, "schema.sql"); - - private final DropPrimaryKeySqlGenerator dropPrimaryKeySqlGenerator = new DropPrimaryKeySqlGenerator(db.database(), new DbPrimaryKeyConstraintFinder(db.database())); - - private final MigrationStep underTest = new DropPrimaryKeyOnIdColumnOfProjectMeasuresTable(db.database(), dropPrimaryKeySqlGenerator); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertNoPrimaryKey(TABLE_NAME); - } - - @Test - public void migration_is_re_entrant_but_fails_silently() throws SQLException { - underTest.execute(); - underTest.execute(); - db.assertNoPrimaryKey(TABLE_NAME); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/projectmeasures/DropTechIndexOnUuidOfProjectMeasuresTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/projectmeasures/DropTechIndexOnUuidOfProjectMeasuresTableTest.java deleted file mode 100644 index 4e182eb9bc0..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/projectmeasures/DropTechIndexOnUuidOfProjectMeasuresTableTest.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.projectmeasures; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -public class DropTechIndexOnUuidOfProjectMeasuresTableTest { - - private static final String TABLE_NAME = "project_measures"; - private static final String INDEX_NAME = "tech_index_uuid"; - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DropTechIndexOnUuidOfProjectMeasuresTableTest.class, "schema.sql"); - - private MigrationStep underTest = new DropTechIndexOnUuidOfProjectMeasuresTable(db.database()); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertIndexDoesNotExist(TABLE_NAME, INDEX_NAME); - } - - @Test - public void migration_is_re_entrant() throws SQLException { - underTest.execute(); - // re-entrant - underTest.execute(); - - db.assertIndexDoesNotExist(TABLE_NAME, INDEX_NAME); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/projectmeasures/MakeProjectMeasuresUuidColumnNotNullableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/projectmeasures/MakeProjectMeasuresUuidColumnNotNullableTest.java deleted file mode 100644 index ff116991e2e..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/projectmeasures/MakeProjectMeasuresUuidColumnNotNullableTest.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.projectmeasures; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -import static java.sql.Types.VARCHAR; - -public class MakeProjectMeasuresUuidColumnNotNullableTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(MakeProjectMeasuresUuidColumnNotNullableTest.class, "schema.sql"); - - private MigrationStep underTest = new MakeProjectMeasuresUuidColumnNotNullable(db.database()); - - @Test - public void uuid_column_is_not_null() throws SQLException { - underTest.execute(); - - db.assertColumnDefinition("project_measures", "uuid", VARCHAR, null, false); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/projectmeasures/PopulateProjectMeasuresUuidTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/projectmeasures/PopulateProjectMeasuresUuidTest.java deleted file mode 100644 index 932ed6ade57..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/projectmeasures/PopulateProjectMeasuresUuidTest.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.projectmeasures; - -import java.sql.SQLException; -import java.util.Objects; -import java.util.stream.Collectors; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.core.util.UuidFactory; -import org.sonar.core.util.UuidFactoryFast; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DataChange; - -import static org.assertj.core.api.Assertions.assertThat; - -public class PopulateProjectMeasuresUuidTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(PopulateProjectMeasuresUuidTest.class, "schema.sql"); - - private UuidFactory uuidFactory = UuidFactoryFast.getInstance(); - private DataChange underTest = new PopulateProjectMeasureUuid(db.database(), uuidFactory); - - @Test - public void populate_uuids() throws SQLException { - insertProjectMeasure(1L); - insertProjectMeasure(2L); - insertProjectMeasure(3L); - - underTest.execute(); - - verifyUuidsAreNotNull(); - } - - @Test - public void migration_is_reentrant() throws SQLException { - insertProjectMeasure(1L); - insertProjectMeasure(2L); - insertProjectMeasure(3L); - - underTest.execute(); - // re-entrant - underTest.execute(); - - verifyUuidsAreNotNull(); - } - - private void verifyUuidsAreNotNull() { - assertThat(db.select("select uuid from project_measures") - .stream() - .map(row -> row.get("UUID")) - .filter(Objects::isNull) - .collect(Collectors.toList())).isEmpty(); - } - - private void insertProjectMeasure(Long id) { - db.executeInsert("project_measures", - "id", id, - "metric_id", id + 100, - "analysis_uuid", uuidFactory.create(), - "component_uuid", uuidFactory.create()); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/projectqprofiles/AddPrimaryKeyOnUuidColumnOfProjectQProfilesTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/projectqprofiles/AddPrimaryKeyOnUuidColumnOfProjectQProfilesTableTest.java deleted file mode 100644 index 09d1fd33be2..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/projectqprofiles/AddPrimaryKeyOnUuidColumnOfProjectQProfilesTableTest.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.projectqprofiles; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.assertj.core.api.Assertions.assertThatThrownBy; - -public class AddPrimaryKeyOnUuidColumnOfProjectQProfilesTableTest { - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(AddPrimaryKeyOnUuidColumnOfProjectQProfilesTableTest.class, "schema.sql"); - - private DdlChange underTest = new AddPrimaryKeyOnUuidColumnOfProjectQProfilesTable(db.database()); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertPrimaryKey("project_qprofiles", "pk_project_qprofiles", "uuid"); - } - - @Test - public void migration_is_not_re_entrant() throws SQLException { - underTest.execute(); - - assertThatThrownBy(() -> underTest.execute()).isInstanceOf(IllegalStateException.class); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/projectqprofiles/AddUuidColumnToProjectQProfilesTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/projectqprofiles/AddUuidColumnToProjectQProfilesTableTest.java deleted file mode 100644 index 429dc6d731a..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/projectqprofiles/AddUuidColumnToProjectQProfilesTableTest.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.projectqprofiles; - -import java.sql.SQLException; -import java.sql.Types; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.core.util.UuidFactory; -import org.sonar.core.util.UuidFactoryFast; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.assertj.core.api.Assertions.assertThat; - -public class AddUuidColumnToProjectQProfilesTableTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(AddUuidColumnToProjectQProfilesTableTest.class, "schema.sql"); - - private UuidFactory uuidFactory = UuidFactoryFast.getInstance(); - - private DdlChange underTest = new AddUuidColumnToProjectQProfilesTable(db.database()); - - @Before - public void setup() { - insertProjectQProfile(1L); - insertProjectQProfile(2L); - insertProjectQProfile(3L); - } - - @Test - public void add_uuid_column_to_project_qprofiles() throws SQLException { - underTest.execute(); - - db.assertColumnDefinition("project_qprofiles", "uuid", Types.VARCHAR, 40, true); - - assertThat(db.countSql("select count(id) from project_qprofiles")) - .isEqualTo(3); - } - - private void insertProjectQProfile(Long id) { - db.executeInsert("project_qprofiles", - "id", id, - "project_uuid", uuidFactory.create(), - "profile_key", uuidFactory.create()); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/projectqprofiles/DropIdColumnOfProjectQProfilesTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/projectqprofiles/DropIdColumnOfProjectQProfilesTableTest.java deleted file mode 100644 index 5dad8185484..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/projectqprofiles/DropIdColumnOfProjectQProfilesTableTest.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.projectqprofiles; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.assertj.core.api.Assertions.assertThatThrownBy; - -public class DropIdColumnOfProjectQProfilesTableTest { - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DropIdColumnOfProjectQProfilesTableTest.class, "schema.sql"); - - private DdlChange underTest = new DropIdColumnOfProjectQProfilesTable(db.database()); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertColumnDoesNotExist("project_qprofiles", "id"); - } - - @Test - public void migration_is_not_re_entrant() throws SQLException { - underTest.execute(); - - assertThatThrownBy(() -> underTest.execute()).isInstanceOf(IllegalStateException.class); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/projectqprofiles/DropPrimaryKeyOnIdColumnOfProjectQProfilesTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/projectqprofiles/DropPrimaryKeyOnIdColumnOfProjectQProfilesTableTest.java deleted file mode 100644 index 9f92f2447fc..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/projectqprofiles/DropPrimaryKeyOnIdColumnOfProjectQProfilesTableTest.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.projectqprofiles; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.sql.DbPrimaryKeyConstraintFinder; -import org.sonar.server.platform.db.migration.sql.DropPrimaryKeySqlGenerator; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class DropPrimaryKeyOnIdColumnOfProjectQProfilesTableTest { - private static final String TABLE_NAME = "project_qprofiles"; - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DropPrimaryKeyOnIdColumnOfProjectQProfilesTableTest.class, "schema.sql"); - - private final DropPrimaryKeySqlGenerator dropPrimaryKeySqlGenerator = new DropPrimaryKeySqlGenerator(db.database(), new DbPrimaryKeyConstraintFinder(db.database())); - - private final DdlChange underTest = new DropPrimaryKeyOnIdColumnOfProjectQProfilesTable(db.database(), dropPrimaryKeySqlGenerator); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertNoPrimaryKey(TABLE_NAME); - } - - @Test - public void migration_is_re_entrant_but_fails_silently() throws SQLException { - underTest.execute(); - underTest.execute(); - - db.assertNoPrimaryKey(TABLE_NAME); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/projectqprofiles/MakeProjectQProfilesUuidColumnNotNullableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/projectqprofiles/MakeProjectQProfilesUuidColumnNotNullableTest.java deleted file mode 100644 index e163ae47fe0..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/projectqprofiles/MakeProjectQProfilesUuidColumnNotNullableTest.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.projectqprofiles; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -import static java.sql.Types.VARCHAR; - -public class MakeProjectQProfilesUuidColumnNotNullableTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(MakeProjectQProfilesUuidColumnNotNullableTest.class, "schema.sql"); - - private MigrationStep underTest = new MakeProjectQProfilesUuidColumnNotNullable(db.database()); - - @Test - public void uuid_column_is_not_null() throws SQLException { - underTest.execute(); - - db.assertColumnDefinition("project_qprofiles", "uuid", VARCHAR, null, false); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/projectqprofiles/PopulateProjectQProfilesUuidTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/projectqprofiles/PopulateProjectQProfilesUuidTest.java deleted file mode 100644 index 79071f7cd94..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/projectqprofiles/PopulateProjectQProfilesUuidTest.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.projectqprofiles; - -import java.sql.SQLException; -import java.util.Objects; -import java.util.stream.Collectors; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.core.util.UuidFactory; -import org.sonar.core.util.UuidFactoryFast; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DataChange; - -import static org.assertj.core.api.Assertions.assertThat; - -public class PopulateProjectQProfilesUuidTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(PopulateProjectQProfilesUuidTest.class, "schema.sql"); - - private UuidFactory uuidFactory = UuidFactoryFast.getInstance(); - private DataChange underTest = new PopulateProjectQProfilesUuid(db.database(), uuidFactory); - - @Test - public void populate_uuids() throws SQLException { - insertProjectQProfile(1L); - insertProjectQProfile(2L); - insertProjectQProfile(3L); - - underTest.execute(); - - verifyUuidsAreNotNull(); - } - - @Test - public void migration_is_reentrant() throws SQLException { - insertProjectQProfile(1L); - insertProjectQProfile(2L); - insertProjectQProfile(3L); - - underTest.execute(); - // re-entrant - underTest.execute(); - - verifyUuidsAreNotNull(); - } - - private void verifyUuidsAreNotNull() { - assertThat(db.select("select uuid from project_qprofiles") - .stream() - .map(row -> row.get("UUID")) - .filter(Objects::isNull) - .collect(Collectors.toList())).isEmpty(); - } - - private void insertProjectQProfile(Long id) { - db.executeInsert("project_qprofiles", - "id", id, - "project_uuid", uuidFactory.create(), - "profile_key", uuidFactory.create()); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/properties/AddPrimaryKeyOnUuidColumnOfPropertiesTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/properties/AddPrimaryKeyOnUuidColumnOfPropertiesTableTest.java deleted file mode 100644 index e2b7ae774ec..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/properties/AddPrimaryKeyOnUuidColumnOfPropertiesTableTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.properties; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -import static org.assertj.core.api.Assertions.assertThatThrownBy; - -public class AddPrimaryKeyOnUuidColumnOfPropertiesTableTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(AddPrimaryKeyOnUuidColumnOfPropertiesTableTest.class, "schema.sql"); - - private MigrationStep underTest = new AddPrimaryKeyOnUuidColumnOfPropertiesTable(db.database()); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertPrimaryKey("properties", "pk_properties", "uuid"); - } - - @Test - public void migration_is_not_re_entrant() throws SQLException { - underTest.execute(); - - assertThatThrownBy(() -> underTest.execute()).isInstanceOf(IllegalStateException.class); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/properties/AddUuidColumnToPropertiesTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/properties/AddUuidColumnToPropertiesTest.java deleted file mode 100644 index 40b08965c6c..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/properties/AddUuidColumnToPropertiesTest.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.properties; - -import java.sql.SQLException; -import java.sql.Types; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.assertj.core.api.Assertions.assertThat; - -public class AddUuidColumnToPropertiesTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(AddUuidColumnToPropertiesTest.class, "schema.sql"); - - private DdlChange underTest = new AddUuidColumnToProperties(db.database()); - - @Before - public void setup() { - insertProperties(1L, "uuid1", "key1"); - insertProperties(2L, "uuid2", "key2"); - insertProperties(3L, "uuid3", "key3"); - } - - @Test - public void add_uuid_to_properties() throws SQLException { - underTest.execute(); - - db.assertColumnDefinition("properties", "uuid", Types.VARCHAR, 40, true); - - assertThat(db.countSql("select count(id) from properties")) - .isEqualTo(3); - } - - private void insertProperties(Long id, String uuid, String propKey) { - - db.executeInsert("properties", - "id", id, - "prop_key", propKey, - "is_empty", false, - "created_at", 0); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/properties/DropIdColumnOfPropertiesTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/properties/DropIdColumnOfPropertiesTableTest.java deleted file mode 100644 index 5efe0a4ad11..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/properties/DropIdColumnOfPropertiesTableTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.properties; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -import static org.assertj.core.api.Assertions.assertThatThrownBy; - -public class DropIdColumnOfPropertiesTableTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DropIdColumnOfPropertiesTableTest.class, "schema.sql"); - - private MigrationStep underTest = new DropIdColumnOfPropertiesTable(db.database()); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertColumnDoesNotExist("properties", "id"); - } - - @Test - public void migration_is_not_re_entrant() throws SQLException { - underTest.execute(); - - assertThatThrownBy(() -> underTest.execute()).isInstanceOf(IllegalStateException.class); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/properties/DropPrimaryKeyOnIdColumnOfPropertiesTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/properties/DropPrimaryKeyOnIdColumnOfPropertiesTableTest.java deleted file mode 100644 index 9c748ecdd43..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/properties/DropPrimaryKeyOnIdColumnOfPropertiesTableTest.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.properties; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.sql.DbPrimaryKeyConstraintFinder; -import org.sonar.server.platform.db.migration.sql.DropPrimaryKeySqlGenerator; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -public class DropPrimaryKeyOnIdColumnOfPropertiesTableTest { - - private static final String TABLE_NAME = "properties"; - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DropPrimaryKeyOnIdColumnOfPropertiesTableTest.class, "schema.sql"); - - private final DropPrimaryKeySqlGenerator dropPrimaryKeySqlGenerator = new DropPrimaryKeySqlGenerator(db.database(), new DbPrimaryKeyConstraintFinder(db.database())); - - private final MigrationStep underTest = new DropPrimaryKeyOnIdColumnOfPropertiesTable(db.database(), dropPrimaryKeySqlGenerator); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertNoPrimaryKey(TABLE_NAME); - } - - @Test - public void migration_is_re_entrant_but_fails_silently() throws SQLException { - underTest.execute(); - underTest.execute(); - - db.assertNoPrimaryKey(TABLE_NAME); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/properties/MakeNotificationUuidColumnNotNullableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/properties/MakeNotificationUuidColumnNotNullableTest.java deleted file mode 100644 index 9064ece35dc..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/properties/MakeNotificationUuidColumnNotNullableTest.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.properties; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -import static java.sql.Types.VARCHAR; - -public class MakeNotificationUuidColumnNotNullableTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(MakeNotificationUuidColumnNotNullableTest.class, "schema.sql"); - - private MigrationStep underTest = new MakePropertiesUuidColumnNotNullable(db.database()); - - @Test - public void created_at_and_uuid_columns_are_not_null() throws SQLException { - underTest.execute(); - - db.assertColumnDefinition("properties", "uuid", VARCHAR, null, false); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/properties/PopulatePropertiesUuidAndCreatedAtTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/properties/PopulatePropertiesUuidAndCreatedAtTest.java deleted file mode 100644 index 1d8e724ec45..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/properties/PopulatePropertiesUuidAndCreatedAtTest.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.properties; - -import java.sql.SQLException; -import java.util.Objects; -import java.util.stream.Collectors; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.core.util.UuidFactory; -import org.sonar.core.util.UuidFactoryFast; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DataChange; - -import static org.assertj.core.api.Assertions.assertThat; - -public class PopulatePropertiesUuidAndCreatedAtTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(PopulatePropertiesUuidAndCreatedAtTest.class, "schema.sql"); - - private UuidFactory uuidFactory = UuidFactoryFast.getInstance(); - private DataChange underTest = new PopulatePropertiesUuid(db.database(), uuidFactory); - - @Test - public void populate_uuids() throws SQLException { - insertProperties(1L, "uuid1", "key1"); - insertProperties(2L, "uuid2", "key2"); - insertProperties(3L, "uuid3", "key3"); - - - underTest.execute(); - - verifyUuidsAreNotNull(); - } - - @Test - public void migration_is_reentrant() throws SQLException { - insertProperties(1L, "uuid1", "key1"); - insertProperties(2L, "uuid2", "key2"); - insertProperties(3L, "uuid3", "key3"); - - underTest.execute(); - // re-entrant - underTest.execute(); - - verifyUuidsAreNotNull(); - } - - private void verifyUuidsAreNotNull() { - assertThat(db.select("select uuid from properties") - .stream() - .map(row -> row.get("UUID")) - .filter(Objects::isNull) - .collect(Collectors.toList())).isEmpty(); - } - - private void insertProperties(Long id, String uuid, String propKey) { - - db.executeInsert("properties", - "id", id, - "prop_key", propKey, - "uuid", uuid, - "is_empty", false, - "created_at", 0); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/qualitygateconditions/AddPrimaryKeyOnUuidColumnOfQualityGateConditionsTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/qualitygateconditions/AddPrimaryKeyOnUuidColumnOfQualityGateConditionsTableTest.java deleted file mode 100644 index 2a51a4f2f66..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/qualitygateconditions/AddPrimaryKeyOnUuidColumnOfQualityGateConditionsTableTest.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.qualitygateconditions; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.assertj.core.api.Assertions.assertThatThrownBy; - -public class AddPrimaryKeyOnUuidColumnOfQualityGateConditionsTableTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(AddPrimaryKeyOnUuidColumnOfQualityGateConditionsTableTest.class, "schema.sql"); - - private DdlChange underTest = new AddPrimaryKeyOnUuidColumnOfQualityGateConditionsTable(db.database()); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertPrimaryKey("quality_gate_conditions", "pk_quality_gate_conditions", "uuid"); - } - - @Test - public void migration_is_not_re_entrant() throws SQLException { - underTest.execute(); - - assertThatThrownBy(() -> underTest.execute()).isInstanceOf(IllegalStateException.class); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/qualitygateconditions/AddUuidColumnToQualityGateConditionsTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/qualitygateconditions/AddUuidColumnToQualityGateConditionsTableTest.java deleted file mode 100644 index c50da55188a..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/qualitygateconditions/AddUuidColumnToQualityGateConditionsTableTest.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.qualitygateconditions; - -import java.sql.SQLException; -import java.sql.Types; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.core.util.UuidFactoryFast; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.assertj.core.api.Assertions.assertThat; - -public class AddUuidColumnToQualityGateConditionsTableTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(AddUuidColumnToQualityGateConditionsTableTest.class, "schema.sql"); - - private DdlChange underTest = new AddUuidColumnToQualityGateConditionsTable(db.database()); - - private UuidFactoryFast uuidFactory = UuidFactoryFast.getInstance(); - - @Before - public void setup() { - insertQualityGateCondition(1L); - insertQualityGateCondition(2L); - insertQualityGateCondition(3L); - } - - @Test - public void add_uuid_column() throws SQLException { - underTest.execute(); - - db.assertColumnDefinition("quality_gate_conditions", "uuid", Types.VARCHAR, 40, true); - - assertThat(db.countRowsOfTable("quality_gate_conditions")) - .isEqualTo(3); - } - - private void insertQualityGateCondition(Long id) { - db.executeInsert("quality_gate_conditions", - "id", id, - "qgate_id", id + 1, - "period", id + 2); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/qualitygateconditions/DropIdColumnOfQualityGateConditionsTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/qualitygateconditions/DropIdColumnOfQualityGateConditionsTableTest.java deleted file mode 100644 index 17bab2b35ba..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/qualitygateconditions/DropIdColumnOfQualityGateConditionsTableTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.qualitygateconditions; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.assertj.core.api.Assertions.assertThatThrownBy; - -public class DropIdColumnOfQualityGateConditionsTableTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DropIdColumnOfQualityGateConditionsTableTest.class, "schema.sql"); - - private DdlChange underTest = new DropIdColumnOfQualityGateConditionsTable(db.database()); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertColumnDoesNotExist("quality_gate_conditions", "id"); - } - - @Test - public void migration_is_not_re_entrant() throws SQLException { - underTest.execute(); - - assertThatThrownBy(() -> underTest.execute()).isInstanceOf(IllegalStateException.class); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/qualitygateconditions/DropPrimaryKeyOnIdColumnOfQualityGateConditionsTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/qualitygateconditions/DropPrimaryKeyOnIdColumnOfQualityGateConditionsTableTest.java deleted file mode 100644 index ce1a4861f3e..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/qualitygateconditions/DropPrimaryKeyOnIdColumnOfQualityGateConditionsTableTest.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.qualitygateconditions; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.sql.DbPrimaryKeyConstraintFinder; -import org.sonar.server.platform.db.migration.sql.DropPrimaryKeySqlGenerator; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class DropPrimaryKeyOnIdColumnOfQualityGateConditionsTableTest { - - private static final String TABLE_NAME = "quality_gate_conditions"; - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DropPrimaryKeyOnIdColumnOfQualityGateConditionsTableTest.class, "schema.sql"); - - private final DropPrimaryKeySqlGenerator dropPrimaryKeySqlGenerator = new DropPrimaryKeySqlGenerator(db.database(), new DbPrimaryKeyConstraintFinder(db.database())); - - private final DdlChange underTest = new DropPrimaryKeyOnIdColumnOfQualityGateConditionsTable(db.database(), dropPrimaryKeySqlGenerator); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertNoPrimaryKey(TABLE_NAME); - } - - @Test - public void migration_is_re_entrant_but_fails_silently() throws SQLException { - underTest.execute(); - underTest.execute(); - - db.assertNoPrimaryKey(TABLE_NAME); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/qualitygateconditions/MakeQualityGateConditionsUuidColumnNotNullableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/qualitygateconditions/MakeQualityGateConditionsUuidColumnNotNullableTest.java deleted file mode 100644 index ce7cc523a82..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/qualitygateconditions/MakeQualityGateConditionsUuidColumnNotNullableTest.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.qualitygateconditions; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -import static java.sql.Types.VARCHAR; - -public class MakeQualityGateConditionsUuidColumnNotNullableTest { - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(MakeQualityGateConditionsUuidColumnNotNullableTest.class, "schema.sql"); - - private MigrationStep underTest = new MakeQualityGateConditionsUuidColumnNotNullable(db.database()); - - @Test - public void uuid_column_is_not_nullable() throws SQLException { - underTest.execute(); - - db.assertColumnDefinition("quality_gate_conditions", "uuid", VARCHAR, null, false); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/qualitygateconditions/PopulateQualityGateConditionsUuidTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/qualitygateconditions/PopulateQualityGateConditionsUuidTest.java deleted file mode 100644 index 00bb98afb7f..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/qualitygateconditions/PopulateQualityGateConditionsUuidTest.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.qualitygateconditions; - -import java.sql.SQLException; -import java.util.Objects; -import java.util.stream.Collectors; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.core.util.UuidFactory; -import org.sonar.core.util.UuidFactoryFast; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DataChange; - -import static org.assertj.core.api.Assertions.assertThat; - -public class PopulateQualityGateConditionsUuidTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(PopulateQualityGateConditionsUuidTest.class, "schema.sql"); - - private UuidFactory uuidFactory = UuidFactoryFast.getInstance(); - private DataChange underTest = new PopulateQualityGateConditionsUuid(db.database(), uuidFactory); - - @Test - public void populate_uuids() throws SQLException { - insertQualityGateCondition(1L); - insertQualityGateCondition(2L); - insertQualityGateCondition(3L); - - underTest.execute(); - - verifyUuidsAreNotNull(); - } - - @Test - public void migration_is_reentrant() throws SQLException { - insertQualityGateCondition(1L); - insertQualityGateCondition(2L); - insertQualityGateCondition(3L); - - underTest.execute(); - // re-entrant - underTest.execute(); - - verifyUuidsAreNotNull(); - } - - private void verifyUuidsAreNotNull() { - assertThat(db.select("select uuid from quality_gate_conditions") - .stream() - .map(row -> row.get("UUID")) - .filter(Objects::isNull) - .collect(Collectors.toList())).isEmpty(); - } - - private void insertQualityGateCondition(Long id) { - db.executeInsert("quality_gate_conditions", - "id", id, - "uuid", uuidFactory.create(), - "qgate_id", id + 1, - "period", id + 2); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/qualitygates/AddPrimaryKeyOnUuidColumnOfQGatesTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/qualitygates/AddPrimaryKeyOnUuidColumnOfQGatesTableTest.java deleted file mode 100644 index ea8f96735d1..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/qualitygates/AddPrimaryKeyOnUuidColumnOfQGatesTableTest.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.qualitygates; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -import static org.assertj.core.api.Assertions.assertThatThrownBy; - -public class AddPrimaryKeyOnUuidColumnOfQGatesTableTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(AddPrimaryKeyOnUuidColumnOfQGatesTableTest.class, "schema.sql"); - - private MigrationStep underTest = new AddPrimaryKeyOnUuidColumnOfQGatesTable(db.database()); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertPrimaryKey("quality_gates", "pk_quality_gates", "uuid"); - } - - @Test - public void migration_is_not_re_entrant() throws SQLException { - underTest.execute(); - - assertThatThrownBy(() -> underTest.execute()).isInstanceOf(IllegalStateException.class); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/qualitygates/AddQGateUuidColumnForQGateConditionsTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/qualitygates/AddQGateUuidColumnForQGateConditionsTest.java deleted file mode 100644 index 88ce9731ca3..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/qualitygates/AddQGateUuidColumnForQGateConditionsTest.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.qualitygates; - -import java.sql.SQLException; -import java.sql.Types; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -import static org.assertj.core.api.Assertions.assertThatThrownBy; - -public class AddQGateUuidColumnForQGateConditionsTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(AddQGateUuidColumnForQGateConditionsTest.class, "schema.sql"); - - private MigrationStep underTest = new AddQGateUuidColumnForQGateConditions(db.database()); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertColumnDefinition("quality_gate_conditions", "qgate_uuid", Types.VARCHAR, 40, true); - } - - @Test - public void migration_is_not_re_entrant() throws SQLException { - underTest.execute(); - - assertThatThrownBy(() -> underTest.execute()).isInstanceOf(IllegalStateException.class); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/qualitygates/DropIdColumnOfQGateTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/qualitygates/DropIdColumnOfQGateTableTest.java deleted file mode 100644 index 0ff5a41bfa0..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/qualitygates/DropIdColumnOfQGateTableTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.qualitygates; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -import static org.assertj.core.api.Assertions.assertThatThrownBy; - -public class DropIdColumnOfQGateTableTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DropIdColumnOfQGateTableTest.class, "schema.sql"); - - private MigrationStep underTest = new DropIdColumnOfQGateTable(db.database()); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertColumnDoesNotExist("quality_gates", "id"); - } - - @Test - public void migration_is_not_re_entrant() throws SQLException { - underTest.execute(); - - assertThatThrownBy(() -> underTest.execute()).isInstanceOf(IllegalStateException.class); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/qualitygates/DropOrphansQGateConditionsTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/qualitygates/DropOrphansQGateConditionsTest.java deleted file mode 100644 index f508a36ac86..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/qualitygates/DropOrphansQGateConditionsTest.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.qualitygates; - -import java.sql.SQLException; -import java.util.stream.Collectors; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -import static org.assertj.core.api.Assertions.assertThat; - -public class DropOrphansQGateConditionsTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DropOrphansQGateConditionsTest.class, "schema.sql"); - - private MigrationStep underTest = new DropOrphansQGateConditions(db.database()); - - @Test - public void deleteOrphanQGConditions() throws SQLException { - insertQualityGate(1L, "uuid1", "qualityGate1"); - insertQualityGateCondition("condition_uuid_1", "uuid1"); - insertQualityGateCondition("condition_uuid_2", "uuid1"); - insertQualityGateCondition("condition_uuid_3", null); - - underTest.execute(); - - verifyConditionExist("condition_uuid_1", true); - verifyConditionExist("condition_uuid_2", true); - verifyConditionExist("condition_uuid_3", false); - } - - private void verifyConditionExist(String uuid, boolean exist) { - assertThat(db.select("select count(uuid) as C from quality_gate_conditions where uuid='" + uuid + "'") - .stream() - .map(row -> (Long) row.get("C")) - .collect(Collectors.toList())).containsOnly(exist ? 1L : 0L); - } - - private void insertQualityGate(Long id, String uuid, String name) { - db.executeInsert("quality_gates", - "id", id, - "uuid", uuid, - "name", name, - "is_built_in", true); - } - - private void insertQualityGateCondition(String uuid, String qualityGateUuid) { - db.executeInsert("quality_gate_conditions", - "uuid", uuid, - "qgate_uuid", qualityGateUuid); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/qualitygates/DropPrimaryKeyOnIdColumnOfQGatesTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/qualitygates/DropPrimaryKeyOnIdColumnOfQGatesTableTest.java deleted file mode 100644 index 684e534d2c2..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/qualitygates/DropPrimaryKeyOnIdColumnOfQGatesTableTest.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.qualitygates; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.sql.DbPrimaryKeyConstraintFinder; -import org.sonar.server.platform.db.migration.sql.DropPrimaryKeySqlGenerator; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -public class DropPrimaryKeyOnIdColumnOfQGatesTableTest { - - private static final String TABLE_NAME = "quality_gates"; - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DropPrimaryKeyOnIdColumnOfQGatesTableTest.class, "schema.sql"); - - private final DropPrimaryKeySqlGenerator dropPrimaryKeySqlGenerator = new DropPrimaryKeySqlGenerator(db.database(), new DbPrimaryKeyConstraintFinder(db.database())); - - private final MigrationStep underTest = new DropPrimaryKeyOnIdColumnOfQGatesTable(db.database(), dropPrimaryKeySqlGenerator); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertNoPrimaryKey(TABLE_NAME); - } - - @Test - public void migration_is_re_entrant_but_fails_silently() throws SQLException { - underTest.execute(); - underTest.execute(); - - db.assertNoPrimaryKey(TABLE_NAME); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/qualitygates/DropQGateIdColumnForQGateConditionsTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/qualitygates/DropQGateIdColumnForQGateConditionsTest.java deleted file mode 100644 index 9b596cd7ab4..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/qualitygates/DropQGateIdColumnForQGateConditionsTest.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.qualitygates; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -import static org.assertj.core.api.Assertions.assertThatThrownBy; - -public class DropQGateIdColumnForQGateConditionsTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DropQGateIdColumnForQGateConditionsTest.class, "schema.sql"); - - private MigrationStep underTest = new DropQGateIdColumnForQGateConditions(db.database()); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertColumnDoesNotExist("quality_gate_conditions", "qgate_id"); - } - - @Test - public void migration_is_not_re_entrant() throws SQLException { - underTest.execute(); - - assertThatThrownBy(() -> underTest.execute()).isInstanceOf(IllegalStateException.class); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/qualitygates/DropUniqueIndexOnUuidColumnOfQualityGatesTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/qualitygates/DropUniqueIndexOnUuidColumnOfQualityGatesTableTest.java deleted file mode 100644 index 67a858ebfc3..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/qualitygates/DropUniqueIndexOnUuidColumnOfQualityGatesTableTest.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.qualitygates; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -public class DropUniqueIndexOnUuidColumnOfQualityGatesTableTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DropUniqueIndexOnUuidColumnOfQualityGatesTableTest.class, "schema.sql"); - - private MigrationStep underTest = new DropUniqueIndexOnUuidColumnOfQualityGatesTable(db.database()); - - @Test - public void execute_drop_index() throws SQLException { - db.assertUniqueIndex("quality_gates", "uniq_quality_gates_uuid", "uuid"); - - underTest.execute(); - - db.assertIndexDoesNotExist("quality_gates", "uniq_quality_gates_uuid"); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/qualitygates/MakeQGateUuidColumnNotNullableForQGateConditionsTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/qualitygates/MakeQGateUuidColumnNotNullableForQGateConditionsTest.java deleted file mode 100644 index b71a04e7f87..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/qualitygates/MakeQGateUuidColumnNotNullableForQGateConditionsTest.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.qualitygates; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -import static java.sql.Types.VARCHAR; - -public class MakeQGateUuidColumnNotNullableForQGateConditionsTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(MakeQGateUuidColumnNotNullableForQGateConditionsTest.class, "schema.sql"); - - private MigrationStep underTest = new MakeQGateUuidColumnNotNullableForQGateConditions(db.database()); - - @Test - public void created_at_and_uuid_columns_are_not_null() throws SQLException { - underTest.execute(); - - db.assertColumnDefinition("quality_gate_conditions", "qgate_uuid", VARCHAR, null, false); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/qualitygates/PopulateQGateUuidColumnForQGateConditionsTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/qualitygates/PopulateQGateUuidColumnForQGateConditionsTest.java deleted file mode 100644 index 3053c9d8c38..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/qualitygates/PopulateQGateUuidColumnForQGateConditionsTest.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.qualitygates; - -import java.sql.SQLException; -import java.util.stream.Collectors; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DataChange; - -import static org.assertj.core.api.Assertions.assertThat; - -public class PopulateQGateUuidColumnForQGateConditionsTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(PopulateQGateUuidColumnForQGateConditionsTest.class, "schema.sql"); - - private DataChange underTest = new PopulateQGateUuidColumnForQGateConditions(db.database()); - - @Test - public void populate_qgate_uuids() throws SQLException { - insertQualityGate(1L, "uuid1", "qualityGate1"); - insertQualityGate(2L, "uuid2", "qualityGate2"); - insertQualityGate(3L, "uuid3", "qualityGate3"); - insertQualityGateCondition("condition_uuid_1", "uuid1"); - insertQualityGateCondition("condition_uuid_2", "uuid1"); - insertQualityGateCondition("condition_uuid_3", "uuid2"); - - underTest.execute(); - - verifyUuid("condition_uuid_1", "uuid1"); - verifyUuid("condition_uuid_2", "uuid1"); - verifyUuid("condition_uuid_3", "uuid2"); - } - - @Test - public void migration_is_reentrant() throws SQLException { - insertQualityGate(1L, "uuid1", "qualityGate1"); - insertQualityGate(2L, "uuid2", "qualityGate2"); - insertQualityGate(3L, "uuid3", "qualityGate3"); - insertQualityGateCondition("condition_uuid_1", "uuid1"); - insertQualityGateCondition("condition_uuid_2", "uuid1"); - insertQualityGateCondition("condition_uuid_3", "uuid2"); - - underTest.execute(); - // re-entrant - underTest.execute(); - - verifyUuid("condition_uuid_1", "uuid1"); - verifyUuid("condition_uuid_2", "uuid1"); - verifyUuid("condition_uuid_3", "uuid2"); - } - - private void verifyUuid(String conditionUuid, String expectedUuid) { - assertThat(db.select("select QGATE_UUID from quality_gate_conditions where uuid='" + conditionUuid+"'") - .stream() - .map(row -> row.get("QGATE_UUID")) - .collect(Collectors.toList())).containsOnly(expectedUuid); - } - - private void insertQualityGate(Long id, String uuid, String name) { - db.executeInsert("quality_gates", - "id", id, - "uuid", uuid, - "name", name, - "is_built_in", true); - } - - private void insertQualityGateCondition(String uuid, String qualityGateUuid) { - db.executeInsert("quality_gate_conditions", - "uuid", uuid, - "qgate_uuid", qualityGateUuid); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/AddPrimaryKeyOnUuidColumnOfRulesTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/AddPrimaryKeyOnUuidColumnOfRulesTableTest.java deleted file mode 100644 index 70b508923b3..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/AddPrimaryKeyOnUuidColumnOfRulesTableTest.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rules; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -import static org.assertj.core.api.Assertions.assertThatThrownBy; - -public class AddPrimaryKeyOnUuidColumnOfRulesTableTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(AddPrimaryKeyOnUuidColumnOfRulesTableTest.class, "schema.sql"); - - private MigrationStep underTest = new AddPrimaryKeyOnUuidColumnOfRulesTable(db.database()); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertPrimaryKey("rules", "pk_rules", "uuid"); - } - - @Test - public void migration_is_not_re_entrant() throws SQLException { - underTest.execute(); - - assertThatThrownBy(() -> underTest.execute()).isInstanceOf(IllegalStateException.class); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/AddUuidAndTemplateUuidColumnsToRulesTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/AddUuidAndTemplateUuidColumnsToRulesTest.java deleted file mode 100644 index 3a441735de3..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/AddUuidAndTemplateUuidColumnsToRulesTest.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rules; - -import java.sql.SQLException; -import java.sql.Types; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.assertj.core.api.Assertions.assertThat; - -public class AddUuidAndTemplateUuidColumnsToRulesTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(AddUuidAndTemplateUuidColumnsToRulesTest.class, "schema.sql"); - - private DdlChange underTest = new AddUuidAndTemplateUuidColumnsToRules(db.database()); - - @Before - public void setup() { - insertRule(1L); - insertRule(2L); - insertRule(3L); - insertRule(4L); - } - - @Test - public void add_uuid_column() throws SQLException { - underTest.execute(); - - db.assertColumnDefinition("rules", "uuid", Types.VARCHAR, 40, true); - - assertThat(db.countSql("select count(*) from rules")) - .isEqualTo(4); - } - - private void insertRule(long id) { - db.executeInsert("rules", - "id", id, - "plugin_rule_key", "rk" + id, - "plugin_name", "rn" + id, - "scope", "MAIN", - "is_ad_hoc", false, - "is_external", false); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/DropIdColumnOfRulesTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/DropIdColumnOfRulesTableTest.java deleted file mode 100644 index 93c12af97db..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/DropIdColumnOfRulesTableTest.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rules; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.assertj.core.api.Assertions.assertThatThrownBy; - -public class DropIdColumnOfRulesTableTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DropIdColumnOfRulesTableTest.class, "schema.sql"); - - private DdlChange underTest = new DropIdColumnOfRulesTable(db.database()); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertColumnDoesNotExist("rules", "id"); - } - - @Test - public void migration_is_not_re_entrant() throws SQLException { - underTest.execute(); - - assertThatThrownBy(() -> underTest.execute()).isInstanceOf(IllegalStateException.class); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/DropPrimaryKeyOnIdColumnOfRulesTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/DropPrimaryKeyOnIdColumnOfRulesTableTest.java deleted file mode 100644 index e47a9781f51..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/DropPrimaryKeyOnIdColumnOfRulesTableTest.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rules; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.sql.DbPrimaryKeyConstraintFinder; -import org.sonar.server.platform.db.migration.sql.DropPrimaryKeySqlGenerator; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -import static org.assertj.core.api.Assertions.assertThatThrownBy; - -public class DropPrimaryKeyOnIdColumnOfRulesTableTest { - private static final String TABLE_NAME = "rules"; - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DropPrimaryKeyOnIdColumnOfRulesTableTest.class, "schema.sql"); - - private final MigrationStep underTest = new DropPrimaryKeyOnIdColumnOfRulesTable(db.database(), - new DropPrimaryKeySqlGenerator(db.database(), new DbPrimaryKeyConstraintFinder(db.database()))); - - @Test - public void execute() throws SQLException { - db.assertTableExists(TABLE_NAME); - db.assertPrimaryKey(TABLE_NAME, "pk_rules", "id"); - - underTest.execute(); - - db.assertNoPrimaryKey(TABLE_NAME); - } - - @Test - public void migration_is_re_entrant_but_fails_silently() throws SQLException { - underTest.execute(); - underTest.execute(); - - db.assertNoPrimaryKey(TABLE_NAME); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/DropTemplateIdColumnOfRulesTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/DropTemplateIdColumnOfRulesTableTest.java deleted file mode 100644 index c90e3b58291..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/DropTemplateIdColumnOfRulesTableTest.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rules; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.assertj.core.api.Assertions.assertThatThrownBy; - -public class DropTemplateIdColumnOfRulesTableTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DropTemplateIdColumnOfRulesTableTest.class, "schema.sql"); - - private DdlChange underTest = new DropTemplateIdColumnOfRulesTable(db.database()); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertColumnDoesNotExist("rules", "template_id"); - } - - @Test - public void migration_is_not_re_entrant() throws SQLException { - underTest.execute(); - - assertThatThrownBy(() -> underTest.execute()).isInstanceOf(IllegalStateException.class); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/MakeRulesUuidColumnNotNullableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/MakeRulesUuidColumnNotNullableTest.java deleted file mode 100644 index 6c7dfb50b6a..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/MakeRulesUuidColumnNotNullableTest.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rules; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -import static java.sql.Types.VARCHAR; - -public class MakeRulesUuidColumnNotNullableTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(MakeRulesUuidColumnNotNullableTest.class, "schema.sql"); - - private MigrationStep underTest = new MakeRulesUuidColumnNotNullable(db.database()); - - @Test - public void uuid_column_is_not_null() throws SQLException { - underTest.execute(); - - db.assertColumnDefinition("rules", "uuid", VARCHAR, null, false); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/PopulateRulesTemplateUuidTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/PopulateRulesTemplateUuidTest.java deleted file mode 100644 index acad73135e9..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/PopulateRulesTemplateUuidTest.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rules; - -import java.sql.SQLException; -import javax.annotation.Nullable; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DataChange; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.tuple; - -public class PopulateRulesTemplateUuidTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(PopulateRulesTemplateUuidTest.class, "schema.sql"); - - private DataChange underTest = new PopulateRulesTemplateUuid(db.database()); - - @Before - public void setup() { - insertRule(1L, "uuid-1", 1L); - insertRule(2L, "uuid-2", 1L); - insertRule(3L, "uuid-3", null); - insertRule(4L, "uuid-4", 2L); - } - - @Test - public void add_rule_uuid_column() throws SQLException { - underTest.execute(); - - assertThat(db.countSql("select count(*) from rules")) - .isEqualTo(4); - assertThat(db.select("select uuid, template_id, template_uuid from rules")) - .extracting(m -> m.get("UUID"), m -> m.get("TEMPLATE_ID"), m -> m.get("TEMPLATE_UUID")) - .containsExactlyInAnyOrder( - tuple("uuid-1", 1L, "uuid-1"), - tuple("uuid-2", 1L, "uuid-1"), - tuple("uuid-3", null, null), - tuple("uuid-4", 2L, "uuid-2")); - } - - private void insertRule(long id, String uuid, @Nullable Long templateId) { - db.executeInsert("rules", - "id", id, - "uuid", uuid, - "template_id", templateId, - "plugin_rule_key", "rk" + id, - "plugin_name", "rn" + id, - "scope", "MAIN", - "is_ad_hoc", false, - "is_external", false); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/activerules/AddIndexToActiveRulesTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/activerules/AddIndexToActiveRulesTableTest.java deleted file mode 100644 index ddc1e485abb..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/activerules/AddIndexToActiveRulesTableTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rules.activerules; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -public class AddIndexToActiveRulesTableTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(AddIndexToActiveRulesTableTest.class, "schema.sql"); - - private MigrationStep underTest = new AddIndexToActiveRulesTable(db.database()); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertUniqueIndex("active_rules", "uniq_profile_rule_uuids", "profile_uuid", "rule_uuid"); - } - - @Test - public void migration_is_re_entrant() throws SQLException { - underTest.execute(); - - // re-entrant - underTest.execute(); - - db.assertUniqueIndex("active_rules", "uniq_profile_rule_uuids", "profile_uuid", "rule_uuid"); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/activerules/AddRuleUuidColumnToActiveRulesTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/activerules/AddRuleUuidColumnToActiveRulesTableTest.java deleted file mode 100644 index 1df3853ce50..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/activerules/AddRuleUuidColumnToActiveRulesTableTest.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rules.activerules; - -import java.sql.SQLException; -import java.sql.Types; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.assertj.core.api.Assertions.assertThat; - -public class AddRuleUuidColumnToActiveRulesTableTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(AddRuleUuidColumnToActiveRulesTableTest.class, "schema.sql"); - - private DdlChange underTest = new AddRuleUuidColumnToActiveRulesTable(db.database()); - - @Before - public void setup() { - insertRule(1L, "uuid-rule-1"); - insertRule(2L, "uuid-rule-2"); - insertRule(3L, "uuid-rule-3"); - insertRule(4L, "uuid-rule-4"); - - insertActiveRule("uuid-ar-1", 1L, "uuid-profile-1"); - insertActiveRule("uuid-ar-2", 1L, "uuid-profile-2"); - insertActiveRule("uuid-ar-3", 2L, "uuid-profile-1"); - } - - @Test - public void add_rule_uuid_column() throws SQLException { - underTest.execute(); - - db.assertColumnDefinition("active_rules", "rule_uuid", Types.VARCHAR, 40, true); - assertThat(db.countSql("select count(*) from active_rules")) - .isEqualTo(3); - } - - private void insertRule(long id, String uuid) { - db.executeInsert("rules", - "id", id, - "uuid", uuid, - "plugin_rule_key", "rk" + id, - "plugin_name", "rn" + id, - "scope", "MAIN", - "is_ad_hoc", false, - "is_external", false); - } - - private void insertActiveRule(String uuid, long ruleId, String profileUuid) { - db.executeInsert("active_rules", - "uuid", uuid, - "rule_id", ruleId, - "profile_uuid", profileUuid, - "failure_level", 1); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/activerules/DropIndexOnRuleIdColumnOfActiveRulesTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/activerules/DropIndexOnRuleIdColumnOfActiveRulesTableTest.java deleted file mode 100644 index 6a1a2c661bb..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/activerules/DropIndexOnRuleIdColumnOfActiveRulesTableTest.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rules.activerules; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -public class DropIndexOnRuleIdColumnOfActiveRulesTableTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DropIndexOnRuleIdColumnOfActiveRulesTableTest.class, "schema.sql"); - - private MigrationStep underTest = new DropIndexOnRuleIdColumnOfActiveRulesTable(db.database()); - - @Test - public void execute() throws SQLException { - db.assertTableExists("active_rules"); - db.assertUniqueIndex("active_rules", "uniq_profile_rule_ids", "profile_uuid", "rule_id"); - - underTest.execute(); - - db.assertIndexDoesNotExist("active_rules", "uniq_profile_rule_ids"); - } - - @Test - public void migration_is_re_entrant() throws SQLException { - underTest.execute(); - - // re-entrant - underTest.execute(); - - db.assertIndexDoesNotExist("active_rules", "uniq_profile_rule_ids"); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/activerules/DropRuleIdColumnOfActiveRulesTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/activerules/DropRuleIdColumnOfActiveRulesTableTest.java deleted file mode 100644 index 6a1d054efb4..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/activerules/DropRuleIdColumnOfActiveRulesTableTest.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rules.activerules; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.assertj.core.api.Assertions.assertThatThrownBy; - -public class DropRuleIdColumnOfActiveRulesTableTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DropRuleIdColumnOfActiveRulesTableTest.class, "schema.sql"); - - private DdlChange underTest = new DropRuleIdColumnOfActiveRulesTable(db.database()); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertColumnDoesNotExist("active_rules", "id"); - } - - @Test - public void migration_is_not_re_entrant() throws SQLException { - underTest.execute(); - - assertThatThrownBy(() -> underTest.execute()).isInstanceOf(IllegalStateException.class); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/activerules/MakeActiveRulesRuleUuidColumnNotNullableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/activerules/MakeActiveRulesRuleUuidColumnNotNullableTest.java deleted file mode 100644 index 0cdbbef53ce..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/activerules/MakeActiveRulesRuleUuidColumnNotNullableTest.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rules.activerules; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -import static java.sql.Types.VARCHAR; - -public class MakeActiveRulesRuleUuidColumnNotNullableTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(MakeActiveRulesRuleUuidColumnNotNullableTest.class, "schema.sql"); - - private MigrationStep underTest = new MakeActiveRulesRuleUuidColumnNotNullable(db.database()); - - @Test - public void uuid_column_is_not_null() throws SQLException { - underTest.execute(); - - db.assertColumnDefinition("active_rules", "rule_uuid", VARCHAR, null, false); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/activerules/PopulateActiveRulesRuleUuidColumnTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/activerules/PopulateActiveRulesRuleUuidColumnTest.java deleted file mode 100644 index 85da9ff6a7e..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/activerules/PopulateActiveRulesRuleUuidColumnTest.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rules.activerules; - -import java.sql.SQLException; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DataChange; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.tuple; - -public class PopulateActiveRulesRuleUuidColumnTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(PopulateActiveRulesRuleUuidColumnTest.class, "schema.sql"); - - private DataChange underTest = new PopulateActiveRulesRuleUuidColumn(db.database()); - - @Before - public void setup() { - insertRule(1L, "uuid-rule-1"); - insertRule(2L, "uuid-rule-2"); - insertRule(3L, "uuid-rule-3"); - insertRule(4L, "uuid-rule-4"); - - insertActiveRule("uuid-ar-1", 1L, "uuid-profile-1"); - insertActiveRule("uuid-ar-2", 1L, "uuid-profile-2"); - insertActiveRule("uuid-ar-3", 2L, "uuid-profile-1"); - // orphan FK - insertActiveRule("uuid-ar-4", 10L, "uuid-profile-1"); - } - - @Test - public void add_rule_uuid_column() throws SQLException { - underTest.execute(); - - assertThat(db.countSql("select count(*) from active_rules")) - .isEqualTo(3); - assertThat(db.select("select uuid, rule_id, rule_uuid from active_rules")) - .extracting(m -> m.get("UUID"), m -> m.get("RULE_ID"), m -> m.get("RULE_UUID")) - .containsExactlyInAnyOrder( - tuple("uuid-ar-1", 1L, "uuid-rule-1"), - tuple("uuid-ar-2", 1L, "uuid-rule-1"), - tuple("uuid-ar-3", 2L, "uuid-rule-2")); - } - - private void insertRule(long id, String uuid) { - db.executeInsert("rules", - "id", id, - "uuid", uuid, - "plugin_rule_key", "rk" + id, - "plugin_name", "rn" + id, - "scope", "MAIN", - "is_ad_hoc", false, - "is_external", false); - } - - private void insertActiveRule(String uuid, long ruleId, String profileUuid) { - db.executeInsert("active_rules", - "uuid", uuid, - "rule_id", ruleId, - "profile_uuid", profileUuid, - "failure_level", 1); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/deprecatedrulekeys/AddIndexToDeprecatedRuleKeysTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/deprecatedrulekeys/AddIndexToDeprecatedRuleKeysTableTest.java deleted file mode 100644 index 66ddec37556..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/deprecatedrulekeys/AddIndexToDeprecatedRuleKeysTableTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rules.deprecatedrulekeys; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -public class AddIndexToDeprecatedRuleKeysTableTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(AddIndexToDeprecatedRuleKeysTableTest.class, "schema.sql"); - - private MigrationStep underTest = new AddIndexToDeprecatedRuleKeysTable(db.database()); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertIndex("deprecated_rule_keys", "rule_uuid_deprecated_rule_keys", "rule_uuid"); - } - - @Test - public void migration_is_re_entrant() throws SQLException { - underTest.execute(); - - // re-entrant - underTest.execute(); - - db.assertIndex("deprecated_rule_keys", "rule_uuid_deprecated_rule_keys", "rule_uuid"); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/deprecatedrulekeys/AddRuleUuidColumnToDeprecatedRuleKeysTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/deprecatedrulekeys/AddRuleUuidColumnToDeprecatedRuleKeysTableTest.java deleted file mode 100644 index 9e8d138c70f..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/deprecatedrulekeys/AddRuleUuidColumnToDeprecatedRuleKeysTableTest.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rules.deprecatedrulekeys; - -import java.sql.SQLException; -import java.sql.Types; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.api.utils.System2; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.assertj.core.api.Assertions.assertThat; - -public class AddRuleUuidColumnToDeprecatedRuleKeysTableTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(AddRuleUuidColumnToDeprecatedRuleKeysTableTest.class, "schema.sql"); - - private DdlChange underTest = new AddRuleUuidColumnToDeprecatedRuleKeysTable(db.database()); - - @Before - public void setup() { - insertRule(1L, "uuid-rule-1"); - insertRule(2L, "uuid-rule-2"); - insertRule(3L, "uuid-rule-3"); - - insertDeprecatedRuleKeyRow("uuid-drk-1", 1L); - insertDeprecatedRuleKeyRow("uuid-drk-2", 1L); - insertDeprecatedRuleKeyRow("uuid-drk-3", 2L); - } - - @Test - public void add_rule_uuid_column() throws SQLException { - underTest.execute(); - - db.assertColumnDefinition("deprecated_rule_keys", "rule_uuid", Types.VARCHAR, 40, true); - assertThat(db.countSql("select count(*) from deprecated_rule_keys")) - .isEqualTo(3); - } - - private void insertRule(long id, String uuid) { - db.executeInsert("rules", - "id", id, - "uuid", uuid, - "plugin_rule_key", "rk" + id, - "plugin_name", "rn" + id, - "scope", "MAIN", - "is_ad_hoc", false, - "is_external", false); - } - - private void insertDeprecatedRuleKeyRow(String uuid, long ruleId) { - db.executeInsert("deprecated_rule_keys", - "uuid", uuid, - "rule_id", ruleId, - "old_repository_key", "old-repo-key" + uuid, - "old_rule_key", "old-rule-key" + uuid, - "created_at", System2.INSTANCE.now()); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/deprecatedrulekeys/DropIndexOnRuleIdColumnOfDeprecatedRuleKeysTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/deprecatedrulekeys/DropIndexOnRuleIdColumnOfDeprecatedRuleKeysTableTest.java deleted file mode 100644 index 75be03b559e..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/deprecatedrulekeys/DropIndexOnRuleIdColumnOfDeprecatedRuleKeysTableTest.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rules.deprecatedrulekeys; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -public class DropIndexOnRuleIdColumnOfDeprecatedRuleKeysTableTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DropIndexOnRuleIdColumnOfDeprecatedRuleKeysTableTest.class, "schema.sql"); - - private MigrationStep underTest = new DropIndexOnRuleIdColumnOfDeprecatedRuleKeysTable(db.database()); - - @Test - public void execute() throws SQLException { - db.assertTableExists("deprecated_rule_keys"); - db.assertIndex("deprecated_rule_keys", "rule_id_deprecated_rule_keys", "rule_id"); - - underTest.execute(); - - db.assertIndexDoesNotExist("deprecated_rule_keys", "rule_id_deprecated_rule_keys"); - } - - @Test - public void migration_is_re_entrant() throws SQLException { - underTest.execute(); - - // re-entrant - underTest.execute(); - - db.assertIndexDoesNotExist("deprecated_rule_keys", "rule_id_deprecated_rule_keys"); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/deprecatedrulekeys/DropRuleIdColumnOfDeprecatedRuleKeysTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/deprecatedrulekeys/DropRuleIdColumnOfDeprecatedRuleKeysTableTest.java deleted file mode 100644 index ae08878c285..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/deprecatedrulekeys/DropRuleIdColumnOfDeprecatedRuleKeysTableTest.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rules.deprecatedrulekeys; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.assertj.core.api.Assertions.assertThatThrownBy; - -public class DropRuleIdColumnOfDeprecatedRuleKeysTableTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DropRuleIdColumnOfDeprecatedRuleKeysTableTest.class, "schema.sql"); - - private DdlChange underTest = new DropRuleIdColumnOfDeprecatedRuleKeysTable(db.database()); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertColumnDoesNotExist("deprecated_rule_keys", "id"); - } - - @Test - public void migration_is_not_re_entrant() throws SQLException { - underTest.execute(); - - assertThatThrownBy(() -> underTest.execute()).isInstanceOf(IllegalStateException.class); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/deprecatedrulekeys/MakeDeprecatedRuleKeysRuleUuidColumnNotNullableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/deprecatedrulekeys/MakeDeprecatedRuleKeysRuleUuidColumnNotNullableTest.java deleted file mode 100644 index 7d7b8dfe3d5..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/deprecatedrulekeys/MakeDeprecatedRuleKeysRuleUuidColumnNotNullableTest.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rules.deprecatedrulekeys; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -import static java.sql.Types.VARCHAR; - -public class MakeDeprecatedRuleKeysRuleUuidColumnNotNullableTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(MakeDeprecatedRuleKeysRuleUuidColumnNotNullableTest.class, "schema.sql"); - - private MigrationStep underTest = new MakeDeprecatedRuleKeysRuleUuidColumnNotNullable(db.database()); - - @Test - public void uuid_column_is_not_null() throws SQLException { - underTest.execute(); - - db.assertColumnDefinition("deprecated_rule_keys", "rule_uuid", VARCHAR, null, false); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/deprecatedrulekeys/PopulateDeprecatedRuleKeysRuleUuidColumnTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/deprecatedrulekeys/PopulateDeprecatedRuleKeysRuleUuidColumnTest.java deleted file mode 100644 index 4699f7bc21e..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/deprecatedrulekeys/PopulateDeprecatedRuleKeysRuleUuidColumnTest.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rules.deprecatedrulekeys; - -import java.sql.SQLException; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.api.utils.System2; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DataChange; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.tuple; - -public class PopulateDeprecatedRuleKeysRuleUuidColumnTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(PopulateDeprecatedRuleKeysRuleUuidColumnTest.class, "schema.sql"); - - private DataChange underTest = new PopulateDeprecatedRuleKeysRuleUuidColumn(db.database()); - - @Before - public void setup() { - insertRule(1L, "uuid-rule-1"); - insertRule(2L, "uuid-rule-2"); - insertRule(3L, "uuid-rule-3"); - insertRule(4L, "uuid-rule-4"); - - insertDeprecatedRuleKeyRow("uuid-drk-1", 1L); - insertDeprecatedRuleKeyRow("uuid-drk-2", 1L); - insertDeprecatedRuleKeyRow("uuid-drk-3", 2L); - // orphan FK - insertDeprecatedRuleKeyRow("uuid-drk-4", 10L); - } - - @Test - public void add_rule_uuid_column() throws SQLException { - underTest.execute(); - - assertThat(db.countSql("select count(*) from deprecated_rule_keys")) - .isEqualTo(3); - assertThat(db.select("select uuid, rule_id, rule_uuid from deprecated_rule_keys")) - .extracting(m -> m.get("UUID"), m -> m.get("RULE_ID"), m -> m.get("RULE_UUID")) - .containsExactlyInAnyOrder( - tuple("uuid-drk-1", 1L, "uuid-rule-1"), - tuple("uuid-drk-2", 1L, "uuid-rule-1"), - tuple("uuid-drk-3", 2L, "uuid-rule-2")); - } - - private void insertRule(long id, String uuid) { - db.executeInsert("rules", - "id", id, - "uuid", uuid, - "plugin_rule_key", "rk" + id, - "plugin_name", "rn" + id, - "scope", "MAIN", - "is_ad_hoc", false, - "is_external", false); - } - - private void insertDeprecatedRuleKeyRow(String uuid, long ruleId) { - db.executeInsert("deprecated_rule_keys", - "uuid", uuid, - "rule_id", ruleId, - "old_repository_key", "old-repo-key" + uuid, - "old_rule_key", "old-rule-key" + uuid, - "created_at", System2.INSTANCE.now()); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/issues/AddIndexesToIssuesTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/issues/AddIndexesToIssuesTableTest.java deleted file mode 100644 index fdfb4998dc8..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/issues/AddIndexesToIssuesTableTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rules.issues; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -public class AddIndexesToIssuesTableTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(AddIndexesToIssuesTableTest.class, "schema.sql"); - - private MigrationStep underTest = new AddIndexesToIssuesTable(db.database()); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertIndex("issues", "issues_rule_uuid", "rule_uuid"); - } - - @Test - public void migration_is_re_entrant() throws SQLException { - underTest.execute(); - - // re-entrant - underTest.execute(); - - db.assertIndex("issues", "issues_rule_uuid", "rule_uuid"); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/issues/CopyIssuesTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/issues/CopyIssuesTableTest.java deleted file mode 100644 index 4cff8871b8c..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/issues/CopyIssuesTableTest.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rules.issues; - -import java.sql.SQLException; -import java.sql.Types; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; -import org.sonar.server.platform.db.migration.version.v84.issuechanges.CopyIssueChangesTable; - -public class CopyIssuesTableTest { - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(CopyIssuesTableTest.class, "schema.sql"); - - private MigrationStep underTest = new CopyIssuesTable(db.database()); - - @Test - public void execute() throws SQLException { - db.assertTableExists("issues"); - db.assertTableDoesNotExist("issues_copy"); - - underTest.execute(); - db.assertTableExists("issues"); - db.assertTableExists("issues_copy"); - db.assertColumnDefinition("issues_copy", "kee", Types.VARCHAR, 50, false); - db.assertColumnDefinition("issues_copy", "message", Types.VARCHAR, 4000, true); - db.assertColumnDefinition("issues_copy", "issue_type", Types.TINYINT, null, true); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/issues/DropIssuesTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/issues/DropIssuesTableTest.java deleted file mode 100644 index e49c7c8e0ee..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/issues/DropIssuesTableTest.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rules.issues; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; -import org.sonar.server.platform.db.migration.version.v84.issuechanges.DropIssueChangesTable; - -public class DropIssuesTableTest { - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DropIssuesTableTest.class, "schema.sql"); - - private MigrationStep underTest = new DropIssuesTable(db.database()); - - @Test - public void execute() throws SQLException { - db.assertTableExists("issues"); - underTest.execute(); - db.assertTableDoesNotExist("issues"); - } - - @Test - public void migration_is_re_entrant() throws SQLException { - db.assertTableExists("issues"); - - underTest.execute(); - - // re-entrant - underTest.execute(); - db.assertTableDoesNotExist("issues"); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/issues/RenameIssuesCopyToIssuesTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/issues/RenameIssuesCopyToIssuesTest.java deleted file mode 100644 index 4255c786bc1..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/issues/RenameIssuesCopyToIssuesTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rules.issues; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; -import org.sonar.server.platform.db.migration.version.v84.issuechanges.RenameIssueChangesCopyToIssueChanges; - -public class RenameIssuesCopyToIssuesTest { - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(RenameIssuesCopyToIssuesTest.class, "schema.sql"); - - private MigrationStep underTest = new RenameIssuesCopyToIssues(db.database()); - - @Test - public void execute() throws SQLException { - db.assertTableExists("issues_copy"); - db.assertTableDoesNotExist("issues"); - - underTest.execute(); - db.assertTableDoesNotExist("issues_copy"); - db.assertTableExists("issues"); - - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/rulesmetadata/AddPrimaryKeyOnUuidAndOrganizationUuidColumnOfRulesMetadataTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/rulesmetadata/AddPrimaryKeyOnUuidAndOrganizationUuidColumnOfRulesMetadataTableTest.java deleted file mode 100644 index 84606688d03..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/rulesmetadata/AddPrimaryKeyOnUuidAndOrganizationUuidColumnOfRulesMetadataTableTest.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rules.rulesmetadata; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -import static org.assertj.core.api.Assertions.assertThatThrownBy; - -public class AddPrimaryKeyOnUuidAndOrganizationUuidColumnOfRulesMetadataTableTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(AddPrimaryKeyOnUuidAndOrganizationUuidColumnOfRulesMetadataTableTest.class, "schema.sql"); - - private MigrationStep underTest = new AddPrimaryKeyOnUuidAndOrganizationUuidColumnOfRulesMetadataTable(db.database()); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertPrimaryKey("rules_metadata", "pk_rules_metadata", "rule_uuid", "organization_uuid"); - } - - @Test - public void migration_is_not_re_entrant() throws SQLException { - underTest.execute(); - - assertThatThrownBy(() -> underTest.execute()).isInstanceOf(IllegalStateException.class); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/rulesmetadata/AddRuleUuidColumnToRulesMetadataTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/rulesmetadata/AddRuleUuidColumnToRulesMetadataTableTest.java deleted file mode 100644 index 0197f180185..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/rulesmetadata/AddRuleUuidColumnToRulesMetadataTableTest.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rules.rulesmetadata; - -import java.sql.SQLException; -import java.sql.Types; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.api.utils.System2; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.assertj.core.api.Assertions.assertThat; - -public class AddRuleUuidColumnToRulesMetadataTableTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(AddRuleUuidColumnToRulesMetadataTableTest.class, "schema.sql"); - - private DdlChange underTest = new AddRuleUuidColumnToRulesMetadataTable(db.database()); - - @Before - public void setup() { - insertRule(1L, "uuid-rule-1"); - insertRule(2L, "uuid-rule-2"); - insertRule(3L, "uuid-rule-3"); - insertRule(4L, "uuid-rule-4"); - - insertRuleMetadata(1L, "org-1"); - insertRuleMetadata(1L, "org-2"); - insertRuleMetadata(2L, "org-1"); - } - - @Test - public void add_rule_uuid_column() throws SQLException { - underTest.execute(); - - db.assertColumnDefinition("rules_metadata", "rule_uuid", Types.VARCHAR, 40, true); - assertThat(db.countSql("select count(*) from rules_metadata")) - .isEqualTo(3); - } - - private void insertRule(long id, String uuid) { - db.executeInsert("rules", - "id", id, - "uuid", uuid, - "plugin_rule_key", "rk" + id, - "plugin_name", "rn" + id, - "scope", "MAIN", - "is_ad_hoc", false, - "is_external", false); - } - - private void insertRuleMetadata(long ruleId, String organizationUuid) { - db.executeInsert("rules_metadata", - "rule_id", ruleId, - "organization_uuid", organizationUuid, - "created_at", System2.INSTANCE.now(), - "updated_at", System2.INSTANCE.now()); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/rulesmetadata/DropPrimaryKeyOnIdColumnOfRulesMetadataTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/rulesmetadata/DropPrimaryKeyOnIdColumnOfRulesMetadataTableTest.java deleted file mode 100644 index 351dcd1c21c..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/rulesmetadata/DropPrimaryKeyOnIdColumnOfRulesMetadataTableTest.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rules.rulesmetadata; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.sql.DbPrimaryKeyConstraintFinder; -import org.sonar.server.platform.db.migration.sql.DropPrimaryKeySqlGenerator; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -public class DropPrimaryKeyOnIdColumnOfRulesMetadataTableTest { - private static final String TABLE_NAME = "rules_metadata"; - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DropPrimaryKeyOnIdColumnOfRulesMetadataTableTest.class, "schema.sql"); - - private final MigrationStep underTest = new DropPrimaryKeyOnIdColumnOfRulesMetadataTable(db.database(), - new DropPrimaryKeySqlGenerator(db.database(), new DbPrimaryKeyConstraintFinder(db.database()))); - - @Test - public void execute() throws SQLException { - db.assertTableExists(TABLE_NAME); - db.assertPrimaryKey(TABLE_NAME, "pk_rules_metadata", "rule_id", "organization_uuid"); - - underTest.execute(); - - db.assertNoPrimaryKey(TABLE_NAME); - } - - @Test - public void migration_is_re_entrant_but_fails_silently() throws SQLException { - underTest.execute(); - underTest.execute(); - - db.assertNoPrimaryKey(TABLE_NAME); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/rulesmetadata/DropRuleIdColumnOfRulesMetadataTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/rulesmetadata/DropRuleIdColumnOfRulesMetadataTableTest.java deleted file mode 100644 index 48744abe908..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/rulesmetadata/DropRuleIdColumnOfRulesMetadataTableTest.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rules.rulesmetadata; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.assertj.core.api.Assertions.assertThatThrownBy; - -public class DropRuleIdColumnOfRulesMetadataTableTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DropRuleIdColumnOfRulesMetadataTableTest.class, "schema.sql"); - - private DdlChange underTest = new DropRuleIdColumnOfRulesMetadataTable(db.database()); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertColumnDoesNotExist("rules_metadata", "id"); - } - - @Test - public void migration_is_not_re_entrant() throws SQLException { - underTest.execute(); - - assertThatThrownBy(() -> underTest.execute()).isInstanceOf(IllegalStateException.class); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/rulesmetadata/MakeRulesMetadataRuleUuidColumnNotNullableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/rulesmetadata/MakeRulesMetadataRuleUuidColumnNotNullableTest.java deleted file mode 100644 index 86030159b1f..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/rulesmetadata/MakeRulesMetadataRuleUuidColumnNotNullableTest.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rules.rulesmetadata; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -import static java.sql.Types.VARCHAR; - -public class MakeRulesMetadataRuleUuidColumnNotNullableTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(MakeRulesMetadataRuleUuidColumnNotNullableTest.class, "schema.sql"); - - private MigrationStep underTest = new MakeRulesMetadataRuleUuidColumnNotNullable(db.database()); - - @Test - public void uuid_column_is_not_null() throws SQLException { - underTest.execute(); - - db.assertColumnDefinition("rules_metadata", "rule_uuid", VARCHAR, null, false); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/rulesmetadata/PopulateRulesMetadataRuleUuidColumnTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/rulesmetadata/PopulateRulesMetadataRuleUuidColumnTest.java deleted file mode 100644 index 3dec490c939..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/rulesmetadata/PopulateRulesMetadataRuleUuidColumnTest.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rules.rulesmetadata; - -import java.sql.SQLException; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.api.utils.System2; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DataChange; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.tuple; - -public class PopulateRulesMetadataRuleUuidColumnTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(PopulateRulesMetadataRuleUuidColumnTest.class, "schema.sql"); - - private DataChange underTest = new PopulateRulesMetadataRuleUuidColumn(db.database()); - - @Before - public void setup() { - insertRule(1L, "uuid-rule-1"); - insertRule(2L, "uuid-rule-2"); - insertRule(3L, "uuid-rule-3"); - insertRule(4L, "uuid-rule-4"); - - insertRuleMetadata(1L, "org-1"); - insertRuleMetadata(1L, "org-2"); - insertRuleMetadata(2L, "org-1"); - // orphan FK - insertRuleMetadata(10L, "org-1"); - } - - @Test - public void add_rule_uuid_column() throws SQLException { - underTest.execute(); - - assertThat(db.countSql("select count(*) from rules_metadata")) - .isEqualTo(3); - assertThat(db.select("select rule_id, organization_uuid, rule_uuid from rules_metadata")) - .extracting(m -> m.get("RULE_ID"), m -> m.get("ORGANIZATION_UUID"), m -> m.get("RULE_UUID")) - .containsExactlyInAnyOrder( - tuple(1L, "org-1", "uuid-rule-1"), - tuple(1L, "org-2", "uuid-rule-1"), - tuple(2L, "org-1", "uuid-rule-2")); - } - - private void insertRule(long id, String uuid) { - db.executeInsert("rules", - "id", id, - "uuid", uuid, - "plugin_rule_key", "rk" + id, - "plugin_name", "rn" + id, - "scope", "MAIN", - "is_ad_hoc", false, - "is_external", false); - } - - private void insertRuleMetadata(long ruleId, String organizationUuid) { - db.executeInsert("rules_metadata", - "rule_id", ruleId, - "organization_uuid", organizationUuid, - "created_at", System2.INSTANCE.now(), - "updated_at", System2.INSTANCE.now()); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/rulesparameters/AddIndexesToRulesParametersTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/rulesparameters/AddIndexesToRulesParametersTableTest.java deleted file mode 100644 index 84c6d588d87..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/rulesparameters/AddIndexesToRulesParametersTableTest.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rules.rulesparameters; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -public class AddIndexesToRulesParametersTableTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(AddIndexesToRulesParametersTableTest.class, "schema.sql"); - - private MigrationStep underTest = new AddIndexesToRulesParametersTable(db.database()); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertIndex("rules_parameters", "rules_parameters_rule_uuid", "rule_uuid"); - db.assertUniqueIndex("rules_parameters", "rules_parameters_unique", "rule_uuid", "name"); - } - - @Test - public void migration_is_re_entrant() throws SQLException { - underTest.execute(); - - // re-entrant - underTest.execute(); - - db.assertIndex("rules_parameters", "rules_parameters_rule_uuid", "rule_uuid"); - db.assertUniqueIndex("rules_parameters", "rules_parameters_unique", "rule_uuid", "name"); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/rulesparameters/AddRuleUuidColumnToRulesParametersTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/rulesparameters/AddRuleUuidColumnToRulesParametersTableTest.java deleted file mode 100644 index 736a1c532f7..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/rulesparameters/AddRuleUuidColumnToRulesParametersTableTest.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rules.rulesparameters; - -import java.sql.SQLException; -import java.sql.Types; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.assertj.core.api.Assertions.assertThat; - -public class AddRuleUuidColumnToRulesParametersTableTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(AddRuleUuidColumnToRulesParametersTableTest.class, "schema.sql"); - - private DdlChange underTest = new AddRuleUuidColumnToRulesParametersTable(db.database()); - - @Before - public void setup() { - insertRule(1L, "uuid-rule-1"); - insertRule(2L, "uuid-rule-2"); - insertRule(3L, "uuid-rule-3"); - - insertRulesParametersEntry("uuid-rp-1", 1L); - insertRulesParametersEntry("uuid-rp-2", 1L); - insertRulesParametersEntry("uuid-rp-3", 2L); - } - - @Test - public void add_rule_uuid_column() throws SQLException { - underTest.execute(); - - db.assertColumnDefinition("rules_parameters", "rule_uuid", Types.VARCHAR, 40, true); - assertThat(db.countSql("select count(*) from rules_parameters")) - .isEqualTo(3); - } - - private void insertRule(long id, String uuid) { - db.executeInsert("rules", - "id", id, - "uuid", uuid, - "plugin_rule_key", "rk" + id, - "plugin_name", "rn" + id, - "scope", "MAIN", - "is_ad_hoc", false, - "is_external", false); - } - - private void insertRulesParametersEntry(String uuid, long ruleId) { - db.executeInsert("rules_parameters", - "uuid", uuid, - "rule_id", ruleId, - "name", "name-" + uuid, - "param_type", "STRING"); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/rulesparameters/DropIndexesOnRuleIdColumnOfRulesParametersTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/rulesparameters/DropIndexesOnRuleIdColumnOfRulesParametersTableTest.java deleted file mode 100644 index 4522d8fff6e..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/rulesparameters/DropIndexesOnRuleIdColumnOfRulesParametersTableTest.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rules.rulesparameters; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -public class DropIndexesOnRuleIdColumnOfRulesParametersTableTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DropIndexesOnRuleIdColumnOfRulesParametersTableTest.class, "schema.sql"); - - private MigrationStep underTest = new DropIndexesOnRuleIdColumnOfRulesParametersTable(db.database()); - - @Test - public void execute() throws SQLException { - db.assertTableExists("rules_parameters"); - db.assertIndex("rules_parameters", "rules_parameters_rule_id", "rule_id"); - db.assertUniqueIndex("rules_parameters", "rules_parameters_unique", "rule_id", "name"); - - underTest.execute(); - - db.assertIndexDoesNotExist("rules_parameters", "rules_parameters_rule_id"); - db.assertIndexDoesNotExist("rules_parameters", "rules_parameters_unique"); - } - - @Test - public void migration_is_re_entrant() throws SQLException { - underTest.execute(); - - // re-entrant - underTest.execute(); - - db.assertIndexDoesNotExist("rules_parameters", "rules_parameters_rule_id"); - db.assertIndexDoesNotExist("rules_parameters", "rules_parameters_unique"); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/rulesparameters/DropRuleIdColumnOfRulesParametersTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/rulesparameters/DropRuleIdColumnOfRulesParametersTableTest.java deleted file mode 100644 index 6a5ec981b4a..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/rulesparameters/DropRuleIdColumnOfRulesParametersTableTest.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rules.rulesparameters; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.assertj.core.api.Assertions.assertThatThrownBy; - -public class DropRuleIdColumnOfRulesParametersTableTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DropRuleIdColumnOfRulesParametersTableTest.class, "schema.sql"); - - private DdlChange underTest = new DropRuleIdColumnOfRulesParametersTable(db.database()); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertColumnDoesNotExist("rules_parameters", "id"); - } - - @Test - public void migration_is_not_re_entrant() throws SQLException { - underTest.execute(); - - assertThatThrownBy(() -> underTest.execute()).isInstanceOf(IllegalStateException.class); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/rulesparameters/MakeRulesParametersRuleUuidColumnNotNullableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/rulesparameters/MakeRulesParametersRuleUuidColumnNotNullableTest.java deleted file mode 100644 index fb059f32b8c..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/rulesparameters/MakeRulesParametersRuleUuidColumnNotNullableTest.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rules.rulesparameters; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -import static java.sql.Types.VARCHAR; - -public class MakeRulesParametersRuleUuidColumnNotNullableTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(MakeRulesParametersRuleUuidColumnNotNullableTest.class, "schema.sql"); - - private MigrationStep underTest = new MakeRulesParametersRuleUuidColumnNotNullable(db.database()); - - @Test - public void uuid_column_is_not_null() throws SQLException { - underTest.execute(); - - db.assertColumnDefinition("rules_parameters", "rule_uuid", VARCHAR, null, false); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/rulesparameters/PopulateRulesParametersRuleUuidColumnTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/rulesparameters/PopulateRulesParametersRuleUuidColumnTest.java deleted file mode 100644 index 9f7933c325a..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rules/rulesparameters/PopulateRulesParametersRuleUuidColumnTest.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rules.rulesparameters; - -import java.sql.SQLException; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DataChange; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.tuple; - -public class PopulateRulesParametersRuleUuidColumnTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(PopulateRulesParametersRuleUuidColumnTest.class, "schema.sql"); - - private DataChange underTest = new PopulateRulesParametersRuleUuidColumn(db.database()); - - @Before - public void setup() { - insertRule(1L, "uuid-rule-1"); - insertRule(2L, "uuid-rule-2"); - insertRule(3L, "uuid-rule-3"); - - insertRulesParametersEntry("uuid-rp-1", 1L); - insertRulesParametersEntry("uuid-rp-2", 1L); - insertRulesParametersEntry("uuid-rp-3", 2L); - } - - @Test - public void add_rule_uuid_column() throws SQLException { - underTest.execute(); - - assertThat(db.countSql("select count(*) from rules_parameters")) - .isEqualTo(3); - assertThat(db.select("select uuid, rule_id, rule_uuid from rules_parameters")) - .extracting(m -> m.get("UUID"), m -> m.get("RULE_ID"), m -> m.get("RULE_UUID")) - .containsExactlyInAnyOrder( - tuple("uuid-rp-1", 1L, "uuid-rule-1"), - tuple("uuid-rp-2", 1L, "uuid-rule-1"), - tuple("uuid-rp-3", 2L, "uuid-rule-2")); - } - - @Test - public void remove_orphans() throws SQLException { - insertRulesParametersEntry("uuid-rp-4", 666L); - - underTest.execute(); - - assertThat(db.countSql("select count(*) from rules_parameters")) - .isEqualTo(3); - assertThat(db.select("select uuid, rule_id, rule_uuid from rules_parameters")) - .extracting(m -> m.get("UUID"), m -> m.get("RULE_ID"), m -> m.get("RULE_UUID")) - .containsExactlyInAnyOrder( - tuple("uuid-rp-1", 1L, "uuid-rule-1"), - tuple("uuid-rp-2", 1L, "uuid-rule-1"), - tuple("uuid-rp-3", 2L, "uuid-rule-2")); - } - - private void insertRule(long id, String uuid) { - db.executeInsert("rules", - "id", id, - "uuid", uuid, - "plugin_rule_key", "rk" + id, - "plugin_name", "rn" + id, - "scope", "MAIN", - "is_ad_hoc", false, - "is_external", false); - } - - private void insertRulesParametersEntry(String uuid, long ruleId) { - db.executeInsert("rules_parameters", - "uuid", uuid, - "rule_id", ruleId, - "name", "name-" + uuid, - "param_type", "STRING"); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rulesparameters/AddPrimaryKeyOnUuidColumnOfRulesParametersTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rulesparameters/AddPrimaryKeyOnUuidColumnOfRulesParametersTableTest.java deleted file mode 100644 index 54c62922f19..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rulesparameters/AddPrimaryKeyOnUuidColumnOfRulesParametersTableTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rulesparameters; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -import static org.assertj.core.api.Assertions.assertThatThrownBy; - -public class AddPrimaryKeyOnUuidColumnOfRulesParametersTableTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(AddPrimaryKeyOnUuidColumnOfRulesParametersTableTest.class, "schema.sql"); - - private MigrationStep underTest = new AddPrimaryKeyOnUuidColumnOfRulesParametersTable(db.database()); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertPrimaryKey("rules_parameters", "pk_rules_parameters", "uuid"); - } - - @Test - public void migration_is_not_re_entrant() throws SQLException { - underTest.execute(); - - assertThatThrownBy(() -> underTest.execute()).isInstanceOf(IllegalStateException.class); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rulesparameters/AddUuidColumnToRulesParametersTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rulesparameters/AddUuidColumnToRulesParametersTest.java deleted file mode 100644 index d9e1b169644..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rulesparameters/AddUuidColumnToRulesParametersTest.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rulesparameters; - -import java.sql.SQLException; -import java.sql.Types; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.core.util.UuidFactory; -import org.sonar.core.util.UuidFactoryFast; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.assertj.core.api.Assertions.assertThat; - -public class AddUuidColumnToRulesParametersTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(AddUuidColumnToRulesParametersTest.class, "schema.sql"); - - private UuidFactory uuidFactory = UuidFactoryFast.getInstance(); - - private DdlChange underTest = new AddUuidColumnToRulesParameters(db.database()); - - @Before - public void setup() { - insertRuleParameter(1L); - insertRuleParameter(2L); - insertRuleParameter(3L); - } - - @Test - public void add_uuid_column_to_project_measures() throws SQLException { - underTest.execute(); - - db.assertColumnDefinition("rules_parameters", "uuid", Types.VARCHAR, 40, true); - - assertThat(db.countSql("select count(id) from rules_parameters")) - .isEqualTo(3); - } - - private void insertRuleParameter(Long id) { - db.executeInsert("rules_parameters", - "id", id, - "rule_id", id + 100, - "name", uuidFactory.create(), - "param_type", uuidFactory.create()); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rulesparameters/DropIdColumnOfRulesParametersTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rulesparameters/DropIdColumnOfRulesParametersTableTest.java deleted file mode 100644 index a7115de314f..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rulesparameters/DropIdColumnOfRulesParametersTableTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rulesparameters; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -import static org.assertj.core.api.Assertions.assertThatThrownBy; - -public class DropIdColumnOfRulesParametersTableTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DropIdColumnOfRulesParametersTableTest.class, "schema.sql"); - - private MigrationStep underTest = new DropIdColumnOfRulesParametersTable(db.database()); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertColumnDoesNotExist("rules_parameters", "id"); - } - - @Test - public void migration_is_not_re_entrant() throws SQLException { - underTest.execute(); - - assertThatThrownBy(() -> underTest.execute()).isInstanceOf(IllegalStateException.class); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rulesparameters/DropPrimaryKeyOnIdColumnOfRulesParametersTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rulesparameters/DropPrimaryKeyOnIdColumnOfRulesParametersTableTest.java deleted file mode 100644 index 44715d55692..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rulesparameters/DropPrimaryKeyOnIdColumnOfRulesParametersTableTest.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rulesparameters; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.sql.DbPrimaryKeyConstraintFinder; -import org.sonar.server.platform.db.migration.sql.DropPrimaryKeySqlGenerator; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -public class DropPrimaryKeyOnIdColumnOfRulesParametersTableTest { - - private static final String TABLE_NAME = "rules_parameters"; - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DropPrimaryKeyOnIdColumnOfRulesParametersTableTest.class, "schema.sql"); - - private final DropPrimaryKeySqlGenerator dropPrimaryKeySqlGenerator = new DropPrimaryKeySqlGenerator(db.database(), new DbPrimaryKeyConstraintFinder(db.database())); - - private final MigrationStep underTest = new DropPrimaryKeyOnIdColumnOfRulesParametersTable(db.database(), dropPrimaryKeySqlGenerator); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertNoPrimaryKey(TABLE_NAME); - } - - @Test - public void migration_is_re_entrant_but_fails_silently() throws SQLException { - underTest.execute(); - underTest.execute(); - - db.assertNoPrimaryKey(TABLE_NAME); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rulesparameters/MakeRulesParametersUuidColumnNotNullableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rulesparameters/MakeRulesParametersUuidColumnNotNullableTest.java deleted file mode 100644 index aa21df4f155..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rulesparameters/MakeRulesParametersUuidColumnNotNullableTest.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rulesparameters; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -import static java.sql.Types.VARCHAR; - -public class MakeRulesParametersUuidColumnNotNullableTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(MakeRulesParametersUuidColumnNotNullableTest.class, "schema.sql"); - - private MigrationStep underTest = new MakeRulesParametersUuidColumnNotNullable(db.database()); - - @Test - public void uuid_column_is_not_null() throws SQLException { - underTest.execute(); - - db.assertColumnDefinition("rules_parameters", "uuid", VARCHAR, null, false); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rulesparameters/PopulateRulesParametersUuidTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rulesparameters/PopulateRulesParametersUuidTest.java deleted file mode 100644 index a55ecec1c17..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rulesparameters/PopulateRulesParametersUuidTest.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rulesparameters; - -import java.sql.SQLException; -import java.util.Objects; -import java.util.stream.Collectors; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.core.util.UuidFactory; -import org.sonar.core.util.UuidFactoryFast; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DataChange; - -import static org.assertj.core.api.Assertions.assertThat; - -public class PopulateRulesParametersUuidTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(PopulateRulesParametersUuidTest.class, "schema.sql"); - - private UuidFactory uuidFactory = UuidFactoryFast.getInstance(); - private DataChange underTest = new PopulateRulesParametersUuid(db.database(), uuidFactory); - - @Test - public void populate_uuids_and_created_at() throws SQLException { - insertRuleParameter(1L); - insertRuleParameter(2L); - insertRuleParameter(3L); - - underTest.execute(); - - verifyUuidsAreNotNull(); - } - - @Test - public void migration_is_reentrant() throws SQLException { - insertRuleParameter(1L); - insertRuleParameter(2L); - insertRuleParameter(3L); - - underTest.execute(); - // re-entrant - underTest.execute(); - - verifyUuidsAreNotNull(); - } - - private void verifyUuidsAreNotNull() { - assertThat(db.select("select uuid from rules_parameters") - .stream() - .map(row -> row.get("UUID")) - .filter(Objects::isNull) - .collect(Collectors.toList())).isEmpty(); - } - - private void insertRuleParameter(Long id) { - db.executeInsert("rules_parameters", - "id", id, - "rule_id", id + 100, - "name", uuidFactory.create(), - "param_type", uuidFactory.create()); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rulesparameters/fk/AddRulesParameterUuidColumnToActiveRuleParametersTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rulesparameters/fk/AddRulesParameterUuidColumnToActiveRuleParametersTest.java deleted file mode 100644 index 22d5a2430c3..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rulesparameters/fk/AddRulesParameterUuidColumnToActiveRuleParametersTest.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rulesparameters.fk; - -import java.sql.SQLException; -import java.sql.Types; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.core.util.UuidFactory; -import org.sonar.core.util.UuidFactoryFast; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.assertj.core.api.Assertions.assertThat; - -public class AddRulesParameterUuidColumnToActiveRuleParametersTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(AddRulesParameterUuidColumnToActiveRuleParametersTest.class, "schema.sql"); - - private UuidFactory uuidFactory = UuidFactoryFast.getInstance(); - - private DdlChange underTest = new AddRulesParameterUuidColumnToActiveRuleParameters(db.database()); - - @Before - public void setup() { - insertActiveRuleParameter(uuidFactory.create(), 1L, 4L); - insertActiveRuleParameter(uuidFactory.create(), 2L, 5L); - insertActiveRuleParameter(uuidFactory.create(), 3L, 6L); - } - - @Test - public void add_rules_parameter_uuid_column_to_active_rule_parameters() throws SQLException { - underTest.execute(); - - db.assertColumnDefinition("active_rule_parameters", "rules_parameter_uuid", Types.VARCHAR, 40, true); - - assertThat(db.countRowsOfTable("active_rule_parameters")) - .isEqualTo(3); - } - - private void insertActiveRuleParameter(String uuid, Long ruleId, Long rulesParameterId) { - db.executeInsert("active_rule_parameters", - "uuid", uuid, - "active_rule_id", ruleId, - "rules_parameter_id", rulesParameterId); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rulesparameters/fk/DropRulesParameterIdColumnOfActiveRuleParametersTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rulesparameters/fk/DropRulesParameterIdColumnOfActiveRuleParametersTableTest.java deleted file mode 100644 index dd97b9305cf..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rulesparameters/fk/DropRulesParameterIdColumnOfActiveRuleParametersTableTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rulesparameters.fk; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -import static org.assertj.core.api.Assertions.assertThatThrownBy; - -public class DropRulesParameterIdColumnOfActiveRuleParametersTableTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DropRulesParameterIdColumnOfActiveRuleParametersTableTest.class, "schema.sql"); - - private MigrationStep underTest = new DropRulesParameterIdColumnOfActiveRuleParametersTable(db.database()); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertColumnDoesNotExist("active_rule_parameters", "rules_parameter_id"); - } - - @Test - public void migration_is_not_re_entrant() throws SQLException { - underTest.execute(); - - assertThatThrownBy(() -> underTest.execute()).isInstanceOf(IllegalStateException.class); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rulesparameters/fk/MakeActiveRuleParametersRulesParameterUuidColumnNotNullableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rulesparameters/fk/MakeActiveRuleParametersRulesParameterUuidColumnNotNullableTest.java deleted file mode 100644 index ed9bac5e90a..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rulesparameters/fk/MakeActiveRuleParametersRulesParameterUuidColumnNotNullableTest.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rulesparameters.fk; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -import static java.sql.Types.VARCHAR; - -public class MakeActiveRuleParametersRulesParameterUuidColumnNotNullableTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(MakeActiveRuleParametersRulesParameterUuidColumnNotNullableTest.class, "schema.sql"); - - private MigrationStep underTest = new MakeActiveRuleParametersRulesParameterUuidColumnNotNullable(db.database()); - - @Test - public void uuid_column_is_not_null() throws SQLException { - underTest.execute(); - - db.assertColumnDefinition("active_rule_parameters", "rules_parameter_uuid", VARCHAR, null, false); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rulesparameters/fk/PopulateActiveRuleParametersRulesParameterUuidTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rulesparameters/fk/PopulateActiveRuleParametersRulesParameterUuidTest.java deleted file mode 100644 index 967402a9a8d..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rulesparameters/fk/PopulateActiveRuleParametersRulesParameterUuidTest.java +++ /dev/null @@ -1,142 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rulesparameters.fk; - -import java.sql.SQLException; -import java.util.Objects; -import java.util.stream.Collectors; -import java.util.stream.Stream; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.core.util.UuidFactory; -import org.sonar.core.util.UuidFactoryFast; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DataChange; - -import static java.lang.String.format; -import static org.assertj.core.api.Assertions.assertThat; - -public class PopulateActiveRuleParametersRulesParameterUuidTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(PopulateActiveRuleParametersRulesParameterUuidTest.class, "schema.sql"); - - private UuidFactory uuidFactory = UuidFactoryFast.getInstance(); - private DataChange underTest = new PopulateActiveRuleParametersRulesParameterUuid(db.database()); - - @Test - public void populate_rules_parameter_uuids() throws SQLException { - String ruleParamUuid1 = uuidFactory.create(); - long ruleParamId1 = 1L; - insertRuleParameter(ruleParamId1, ruleParamUuid1, 101L); - String activeRuleParameter11 = insertActiveRuleParameter(101L, ruleParamId1); - String activeRuleParameter12 = insertActiveRuleParameter(101L, ruleParamId1); - String activeRuleParameter13 = insertActiveRuleParameter(101L, ruleParamId1); - - String ruleParamUuid2 = uuidFactory.create(); - long ruleParamId2 = 2L; - insertRuleParameter(ruleParamId2, ruleParamUuid2, 101L); - String activeRuleParameter21 = insertActiveRuleParameter(101L, ruleParamId2); - String activeRuleParameter22 = insertActiveRuleParameter(101L, ruleParamId2); - - insertRuleParameter(3L, uuidFactory.create(), 101L); - - underTest.execute(); - - assertRulesParameterUuidsAreNotNull(); - assertThatRulesParametersUuidAreSet(ruleParamUuid1, activeRuleParameter11, activeRuleParameter12, activeRuleParameter13); - assertThatRulesParametersUuidAreSet(ruleParamUuid2, activeRuleParameter21, activeRuleParameter22); - } - - @Test - public void delete_orphan_rows() throws SQLException { - String ruleParamUuid1 = uuidFactory.create(); - long ruleParamId1 = 1L; - insertRuleParameter(ruleParamId1, ruleParamUuid1, 101L); - String activeRuleParameter11 = insertActiveRuleParameter(101L, ruleParamId1); - String activeRuleParameter12 = insertActiveRuleParameter(101L, ruleParamId1); - String activeRuleParameter13 = insertActiveRuleParameter(101L, 2L); - - underTest.execute(); - - assertRulesParameterUuidsAreNotNull(); - assertThatRulesParametersUuidAreSet(ruleParamUuid1, activeRuleParameter11, activeRuleParameter12); - } - - @Test - public void migration_is_reentrant() throws SQLException { - String ruleParamUuid1 = uuidFactory.create(); - long ruleParamId1 = 1L; - insertRuleParameter(ruleParamId1, ruleParamUuid1, 101L); - String activeRuleParameter11 = insertActiveRuleParameter(101L, ruleParamId1); - String activeRuleParameter12 = insertActiveRuleParameter(101L, ruleParamId1); - String activeRuleParameter13 = insertActiveRuleParameter(101L, ruleParamId1); - - underTest.execute(); - - String ruleParamUuid2 = uuidFactory.create(); - long ruleParamId2 = 2L; - insertRuleParameter(ruleParamId2, ruleParamUuid2, 101L); - String activeRuleParameter21 = insertActiveRuleParameter(101L, ruleParamId2); - String activeRuleParameter22 = insertActiveRuleParameter(101L, ruleParamId2); - // re-entrant - underTest.execute(); - - assertRulesParameterUuidsAreNotNull(); - assertThatRulesParametersUuidAreSet(ruleParamUuid1, activeRuleParameter11, activeRuleParameter12, activeRuleParameter13); - assertThatRulesParametersUuidAreSet(ruleParamUuid2, activeRuleParameter21, activeRuleParameter22); - } - - private void assertThatRulesParametersUuidAreSet(String ruleParameterUuid, String... activeRuleParameters) { - assertThat(db.select("select rules_parameter_uuid from active_rule_parameters where uuid in (" - + Stream.of(activeRuleParameters).map(s -> format("'%s'", s)).collect(Collectors.joining(",")) + ")") - .stream() - .map(row -> row.get("RULES_PARAMETER_UUID")) - .filter(o -> !Objects.equals(o, ruleParameterUuid)) - .collect(Collectors.toList())).isEmpty(); - } - - private void assertRulesParameterUuidsAreNotNull() { - assertThat(db.select("select rules_parameter_uuid from active_rule_parameters") - .stream() - .map(row -> row.get("RULES_PARAMETER_UUID")) - .filter(Objects::isNull) - .collect(Collectors.toList())).isEmpty(); - } - - private void insertRuleParameter(Long id, String uuid, Long ruleId) { - db.executeInsert("rules_parameters", - "id", id, - "uuid", uuid, - "rule_id", ruleId, - "name", uuidFactory.create(), - "param_type", uuidFactory.create()); - } - - private String insertActiveRuleParameter(Long ruleId, Long rulesParameterId) { - String uuid = uuidFactory.create(); - db.executeInsert("active_rule_parameters", - "uuid", uuid, - "active_rule_id", ruleId, - "rules_parameter_id", rulesParameterId); - return uuid; - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/AddPrimaryKeyOnUuidColumnOfRulesProfilesTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/AddPrimaryKeyOnUuidColumnOfRulesProfilesTableTest.java deleted file mode 100644 index 4ffa67b2008..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/AddPrimaryKeyOnUuidColumnOfRulesProfilesTableTest.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rulesprofiles; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.assertj.core.api.Assertions.assertThatThrownBy; - -public class AddPrimaryKeyOnUuidColumnOfRulesProfilesTableTest { - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(AddPrimaryKeyOnUuidColumnOfRulesProfilesTableTest.class, "schema.sql"); - - private DdlChange underTest = new AddPrimaryKeyOnUuidColumnOfRulesProfilesTable(db.database()); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertPrimaryKey("rules_profiles", "pk_rules_profiles", "uuid"); - } - - @Test - public void migration_is_not_re_entrant() throws SQLException { - underTest.execute(); - - assertThatThrownBy(() -> underTest.execute()).isInstanceOf(IllegalStateException.class); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/AddUuidColumnToRulesProfilesTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/AddUuidColumnToRulesProfilesTableTest.java deleted file mode 100644 index b9a1800f1e3..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/AddUuidColumnToRulesProfilesTableTest.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rulesprofiles; - -import java.sql.SQLException; -import java.sql.Types; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.core.util.UuidFactory; -import org.sonar.core.util.UuidFactoryFast; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.assertj.core.api.Assertions.assertThat; - -public class AddUuidColumnToRulesProfilesTableTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(AddUuidColumnToRulesProfilesTableTest.class, "schema.sql"); - - private UuidFactory uuidFactory = UuidFactoryFast.getInstance(); - - private DdlChange underTest = new AddUuidColumnToRulesProfilesTable(db.database()); - - @Before - public void setup() { - insertRuleProfile(1L); - insertRuleProfile(2L); - insertRuleProfile(3L); - } - - @Test - public void add_uuid_column_to_rules_profiles() throws SQLException { - underTest.execute(); - - db.assertColumnDefinition("rules_profiles", "uuid", Types.VARCHAR, 40, true); - - assertThat(db.countSql("select count(id) from rules_profiles")) - .isEqualTo(3); - } - - private void insertRuleProfile(Long id) { - db.executeInsert("rules_profiles", - "id", id, - "name", "name" + id, - "kee", "kee" + id, - "is_built_in", false); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/DropIdColumnOfRulesProfilesTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/DropIdColumnOfRulesProfilesTableTest.java deleted file mode 100644 index 045469630f6..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/DropIdColumnOfRulesProfilesTableTest.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rulesprofiles; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.assertj.core.api.Assertions.assertThatThrownBy; - -public class DropIdColumnOfRulesProfilesTableTest { - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DropIdColumnOfRulesProfilesTableTest.class, "schema.sql"); - - private DdlChange underTest = new DropIdColumnOfRulesProfilesTable(db.database()); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertColumnDoesNotExist("rules_profiles", "id"); - } - - @Test - public void migration_is_not_re_entrant() throws SQLException { - underTest.execute(); - - assertThatThrownBy(() -> underTest.execute()).isInstanceOf(IllegalStateException.class); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/DropKeeColumnOfRulesProfilesTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/DropKeeColumnOfRulesProfilesTableTest.java deleted file mode 100644 index 55113b1433d..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/DropKeeColumnOfRulesProfilesTableTest.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rulesprofiles; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.assertj.core.api.Assertions.assertThatThrownBy; - -public class DropKeeColumnOfRulesProfilesTableTest { - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DropKeeColumnOfRulesProfilesTableTest.class, "schema.sql"); - - private DdlChange underTest = new DropKeeColumnOfRulesProfilesTable(db.database()); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertColumnDoesNotExist("rules_profiles", "kee"); - } - - @Test - public void migration_is_not_re_entrant() throws SQLException { - underTest.execute(); - - assertThatThrownBy(() -> underTest.execute()).isInstanceOf(IllegalStateException.class); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/DropPrimaryKeyOnIdColumnOfRulesProfilesTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/DropPrimaryKeyOnIdColumnOfRulesProfilesTableTest.java deleted file mode 100644 index 1062c2c04eb..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/DropPrimaryKeyOnIdColumnOfRulesProfilesTableTest.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rulesprofiles; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.sql.DbPrimaryKeyConstraintFinder; -import org.sonar.server.platform.db.migration.sql.DropPrimaryKeySqlGenerator; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class DropPrimaryKeyOnIdColumnOfRulesProfilesTableTest { - private static final String TABLE_NAME = "rules_profiles"; - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DropPrimaryKeyOnIdColumnOfRulesProfilesTableTest.class, "schema.sql"); - - private final DropPrimaryKeySqlGenerator dropPrimaryKeySqlGenerator = new DropPrimaryKeySqlGenerator(db.database(), new DbPrimaryKeyConstraintFinder(db.database())); - - private final DdlChange underTest = new DropPrimaryKeyOnIdColumnOfRulesProfilesTable(db.database(), dropPrimaryKeySqlGenerator); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertNoPrimaryKey(TABLE_NAME); - } - - @Test - public void migration_is_re_entrant_but_fails_silently() throws SQLException { - underTest.execute(); - underTest.execute(); - - db.assertNoPrimaryKey(TABLE_NAME); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/DropUniqueIndexOnKeeColumnOfRulesProfilesTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/DropUniqueIndexOnKeeColumnOfRulesProfilesTableTest.java deleted file mode 100644 index 200bc040d30..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/DropUniqueIndexOnKeeColumnOfRulesProfilesTableTest.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rulesprofiles; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class DropUniqueIndexOnKeeColumnOfRulesProfilesTableTest { - - private static final String TABLE_NAME = "rules_profiles"; - private static final String INDEX_NAME = "uniq_qprof_key"; - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DropUniqueIndexOnKeeColumnOfRulesProfilesTableTest.class, "schema.sql"); - - private DdlChange underTest = new DropUniqueIndexOnKeeColumnOfRulesProfilesTable(db.database()); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertIndexDoesNotExist(TABLE_NAME, INDEX_NAME); - } - - @Test - public void migration_is_re_entrant() throws SQLException { - underTest.execute(); - // migration is re-entrant - underTest.execute(); - - db.assertIndexDoesNotExist(TABLE_NAME, INDEX_NAME); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/MakeRulesProfilesUuidColumnNotNullableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/MakeRulesProfilesUuidColumnNotNullableTest.java deleted file mode 100644 index ccb2e006a77..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/MakeRulesProfilesUuidColumnNotNullableTest.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rulesprofiles; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -import static java.sql.Types.VARCHAR; - -public class MakeRulesProfilesUuidColumnNotNullableTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(MakeRulesProfilesUuidColumnNotNullableTest.class, "schema.sql"); - - private MigrationStep underTest = new MakeRulesProfilesUuidColumnNotNullable(db.database()); - - @Test - public void uuid_column_is_not_null() throws SQLException { - underTest.execute(); - - db.assertColumnDefinition("rules_profiles", "uuid", VARCHAR, null, false); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/PopulateRulesProfilesUuidTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/PopulateRulesProfilesUuidTest.java deleted file mode 100644 index 01c014b374c..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/PopulateRulesProfilesUuidTest.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rulesprofiles; - -import java.sql.SQLException; -import java.util.Objects; -import java.util.stream.Collectors; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.core.util.UuidFactory; -import org.sonar.core.util.UuidFactoryFast; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DataChange; - -import static org.assertj.core.api.Assertions.assertThat; - -public class PopulateRulesProfilesUuidTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(PopulateRulesProfilesUuidTest.class, "schema.sql"); - - private UuidFactory uuidFactory = UuidFactoryFast.getInstance(); - private DataChange underTest = new PopulateRulesProfilesUuid(db.database(), uuidFactory); - - @Test - public void populate_uuids() throws SQLException { - insertRuleProfile(1L); - insertRuleProfile(2L); - insertRuleProfile(3L); - - underTest.execute(); - - verifyUuidsAreNotNull(); - } - - @Test - public void migration_is_reentrant() throws SQLException { - insertRuleProfile(1L); - insertRuleProfile(2L); - insertRuleProfile(3L); - - underTest.execute(); - // re-entrant - underTest.execute(); - - verifyUuidsAreNotNull(); - } - - private void verifyUuidsAreNotNull() { - assertThat(db.select("select uuid from rules_profiles") - .stream() - .map(row -> row.get("UUID")) - .filter(Objects::isNull) - .collect(Collectors.toList())).isEmpty(); - } - - private void insertRuleProfile(Long id) { - db.executeInsert("rules_profiles", - "id", id, - "name", "name" + id, - "kee", "kee" + id, - "is_built_in", false); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/fk/activerules/AddProfileUuidColumnToActiveRulesTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/fk/activerules/AddProfileUuidColumnToActiveRulesTableTest.java deleted file mode 100644 index 4f55577f86f..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/fk/activerules/AddProfileUuidColumnToActiveRulesTableTest.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rulesprofiles.fk.activerules; - -import java.sql.SQLException; -import java.sql.Types; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.assertj.core.api.Assertions.assertThat; - -public class AddProfileUuidColumnToActiveRulesTableTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(AddProfileUuidColumnToActiveRulesTableTest.class, "schema.sql"); - - private DdlChange underTest = new AddProfileUuidColumnToActiveRulesTable(db.database()); - - @Before - public void setup() { - insertActiveRule("1", 1L, 2L); - insertActiveRule("2", 3L, 4L); - insertActiveRule("3", 5L, 6L); - } - - @Test - public void add_uuid_column_to_rules_profiles() throws SQLException { - underTest.execute(); - - db.assertColumnDefinition("active_rules", "profile_uuid", Types.VARCHAR, 40, true); - - assertThat(db.countRowsOfTable("active_rules")) - .isEqualTo(3); - } - - private void insertActiveRule(String uuid, long profileId, long rule_id) { - db.executeInsert("active_rules", - "uuid", uuid, - "profile_id", profileId, - "rule_id", rule_id, - "failure_level", 3); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/fk/activerules/AddUniqueIndexOnProfileUuidColumnOfActiveRulesTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/fk/activerules/AddUniqueIndexOnProfileUuidColumnOfActiveRulesTableTest.java deleted file mode 100644 index 2068c133aeb..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/fk/activerules/AddUniqueIndexOnProfileUuidColumnOfActiveRulesTableTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rulesprofiles.fk.activerules; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -public class AddUniqueIndexOnProfileUuidColumnOfActiveRulesTableTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(AddUniqueIndexOnProfileUuidColumnOfActiveRulesTableTest.class, "schema.sql"); - - private MigrationStep underTest = new AddUniqueIndexOnProfileUuidColumnOfActiveRulesTable(db.database()); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertUniqueIndex("active_rules", "uniq_profile_rule_ids", "profile_uuid", "rule_id"); - } - - @Test - public void migration_is_re_entrant() throws SQLException { - underTest.execute(); - // re-entrant - underTest.execute(); - - db.assertUniqueIndex("active_rules", "uniq_profile_rule_ids", "profile_uuid", "rule_id"); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/fk/activerules/DropProfileIdColumnOfActiveRulesTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/fk/activerules/DropProfileIdColumnOfActiveRulesTableTest.java deleted file mode 100644 index 1ff938ab795..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/fk/activerules/DropProfileIdColumnOfActiveRulesTableTest.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rulesprofiles.fk.activerules; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.assertj.core.api.Assertions.assertThatThrownBy; - -public class DropProfileIdColumnOfActiveRulesTableTest { - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DropProfileIdColumnOfActiveRulesTableTest.class, "schema.sql"); - - private DdlChange underTest = new DropProfileIdColumnOfActiveRulesTable(db.database()); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertColumnDoesNotExist("active_rules", "profile_id"); - } - - @Test - public void migration_is_not_re_entrant() throws SQLException { - underTest.execute(); - - assertThatThrownBy(() -> underTest.execute()).isInstanceOf(IllegalStateException.class); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/fk/activerules/DropUniqueIndexOnProfileIdColumnOfActiveRulesTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/fk/activerules/DropUniqueIndexOnProfileIdColumnOfActiveRulesTableTest.java deleted file mode 100644 index 759cbac1df1..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/fk/activerules/DropUniqueIndexOnProfileIdColumnOfActiveRulesTableTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rulesprofiles.fk.activerules; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -public class DropUniqueIndexOnProfileIdColumnOfActiveRulesTableTest { - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DropUniqueIndexOnProfileIdColumnOfActiveRulesTableTest.class, "schema.sql"); - - private MigrationStep underTest = new DropUniqueIndexOnProfileIdColumnOfActiveRulesTable(db.database()); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertIndexDoesNotExist("perm_tpl_characteristics", "uniq_perm_tpl_charac"); - } - - @Test - public void migration_is_re_entrant() throws SQLException { - underTest.execute(); - - // re-entrant - underTest.execute(); - - db.assertIndexDoesNotExist("perm_tpl_characteristics", "uniq_perm_tpl_charac"); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/fk/activerules/MakeActiveRulesProfileUuidColumnNotNullableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/fk/activerules/MakeActiveRulesProfileUuidColumnNotNullableTest.java deleted file mode 100644 index fdd714e0d92..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/fk/activerules/MakeActiveRulesProfileUuidColumnNotNullableTest.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rulesprofiles.fk.activerules; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -import static java.sql.Types.VARCHAR; - -public class MakeActiveRulesProfileUuidColumnNotNullableTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(MakeActiveRulesProfileUuidColumnNotNullableTest.class, "schema.sql"); - - private MigrationStep underTest = new MakeActiveRulesProfileUuidColumnNotNullable(db.database()); - - @Test - public void uuid_column_is_not_null() throws SQLException { - underTest.execute(); - - db.assertColumnDefinition("active_rules", "profile_uuid", VARCHAR, null, false); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/fk/activerules/PopulateActiveRulesProfileUuidTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/fk/activerules/PopulateActiveRulesProfileUuidTest.java deleted file mode 100644 index e1583a84fbb..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/fk/activerules/PopulateActiveRulesProfileUuidTest.java +++ /dev/null @@ -1,140 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rulesprofiles.fk.activerules; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DataChange; - -import static org.assertj.core.api.Assertions.assertThat; - -public class PopulateActiveRulesProfileUuidTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(PopulateActiveRulesProfileUuidTest.class, "schema.sql"); - - private DataChange underTest = new PopulateActiveRulesProfileUuid(db.database()); - - @Test - public void populate_uuids() throws SQLException { - long ruleProfileId_1 = 1L; - String ruleProfileUuid_1 = "uuid-1"; - insertRuleProfile(ruleProfileId_1, ruleProfileUuid_1); - - long ruleProfileId_2 = 2L; - String ruleProfileUuid_2 = "uuid-2"; - insertRuleProfile(ruleProfileId_2, ruleProfileUuid_2); - - long ruleProfileId_3 = 3L; - String ruleProfileUuid_3 = "uuid-3"; - insertRuleProfile(ruleProfileId_3, ruleProfileUuid_3); - - insertActiveRule("4", ruleProfileId_1); - insertActiveRule("5", ruleProfileId_2); - insertActiveRule("6", ruleProfileId_3); - - underTest.execute(); - - assertThatActiveRulesProfileUuidIsEqualTo("4", ruleProfileUuid_1); - assertThatActiveRulesProfileUuidIsEqualTo("5", ruleProfileUuid_2); - assertThatActiveRulesProfileUuidIsEqualTo("6", ruleProfileUuid_3); - } - - @Test - public void delete_orphan_rows() throws SQLException { - long ruleProfileId_1 = 1L; - String ruleProfileUuid_1 = "uuid-1"; - insertRuleProfile(ruleProfileId_1, ruleProfileUuid_1); - - long ruleProfileId_2 = 2L; - String ruleProfileUuid_2 = "uuid-2"; - insertRuleProfile(ruleProfileId_2, ruleProfileUuid_2); - - long ruleProfileId_3 = 3L; - String ruleProfileUuid_3 = "uuid-3"; - insertRuleProfile(ruleProfileId_3, ruleProfileUuid_3); - - insertActiveRule("4", ruleProfileId_1); - insertActiveRule("5", ruleProfileId_2); - insertActiveRule("6", 10L); - - assertThat(db.countRowsOfTable("active_rules")).isEqualTo(3); - - underTest.execute(); - - assertThatActiveRulesProfileUuidIsEqualTo("4", ruleProfileUuid_1); - assertThatActiveRulesProfileUuidIsEqualTo("5", ruleProfileUuid_2); - assertThat(db.countRowsOfTable("active_rules")).isEqualTo(2); - } - - @Test - public void migration_is_reentrant() throws SQLException { - long ruleProfileId_1 = 1L; - String ruleProfileUuid_1 = "uuid-1"; - insertRuleProfile(ruleProfileId_1, ruleProfileUuid_1); - - long ruleProfileId_2 = 2L; - String ruleProfileUuid_2 = "uuid-2"; - insertRuleProfile(ruleProfileId_2, ruleProfileUuid_2); - - long ruleProfileId_3 = 3L; - String ruleProfileUuid_3 = "uuid-3"; - insertRuleProfile(ruleProfileId_3, ruleProfileUuid_3); - - insertActiveRule("4", ruleProfileId_1); - insertActiveRule("5", ruleProfileId_2); - insertActiveRule("6", ruleProfileId_3); - - underTest.execute(); - // re-entrant - underTest.execute(); - - assertThatActiveRulesProfileUuidIsEqualTo("4", ruleProfileUuid_1); - assertThatActiveRulesProfileUuidIsEqualTo("5", ruleProfileUuid_2); - assertThatActiveRulesProfileUuidIsEqualTo("6", ruleProfileUuid_3); - } - - private void assertThatActiveRulesProfileUuidIsEqualTo(String uuid, String expectedUuid) { - assertThat(db.select("select profile_uuid from active_rules where uuid = '" + uuid + "'") - .stream() - .map(row -> row.get("PROFILE_UUID")) - .findFirst()) - .hasValue(expectedUuid); - } - - private void insertActiveRule(String uuid, Long profileId) { - db.executeInsert("active_rules", - "uuid", uuid, - "profile_id", profileId, - "rule_id", 1, - "failure_level", 2); - } - - private void insertRuleProfile(Long id, String uuid) { - db.executeInsert("rules_profiles", - "id", id, - "uuid", uuid, - "name", "name" + id, - "kee", "kee" + id, - "is_built_in", false); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/fk/orgqprofiles/PopulateOrgQProfilesRulesProfileUuidTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/fk/orgqprofiles/PopulateOrgQProfilesRulesProfileUuidTest.java deleted file mode 100644 index fd1d79e61f2..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/fk/orgqprofiles/PopulateOrgQProfilesRulesProfileUuidTest.java +++ /dev/null @@ -1,137 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rulesprofiles.fk.orgqprofiles; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.core.util.Uuids; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DataChange; - -import static org.assertj.core.api.Assertions.assertThat; - -public class PopulateOrgQProfilesRulesProfileUuidTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(PopulateOrgQProfilesRulesProfileUuidTest.class, "schema.sql"); - - private DataChange underTest = new PopulateOrgQProfilesRulesProfileUuid(db.database()); - - @Test - public void populate_uuids() throws SQLException { - long ruleProfileId_1 = 1L; - String ruleProfileUuid_1 = "uuid-1"; - String ruleProfileKee_1 = "kee-1"; - insertRuleProfile(ruleProfileId_1, ruleProfileUuid_1, ruleProfileKee_1); - - long ruleProfileId_2 = 2L; - String ruleProfileUuid_2 = "uuid-2"; - String ruleProfileKee_2 = "kee-2"; - insertRuleProfile(ruleProfileId_2, ruleProfileUuid_2, ruleProfileKee_2); - - long ruleProfileId_3 = 3L; - String ruleProfileUuid_3 = "uuid-3"; - String ruleProfileKee_3 = "kee-3"; - insertRuleProfile(ruleProfileId_3, ruleProfileUuid_3, ruleProfileKee_3); - - String orgQProfileUuid_1 = "orgQProfileUuid_1"; - insertOrgQProfiles(orgQProfileUuid_1, ruleProfileKee_1); - String orgQProfileUuid_2 = "orgQProfileUuid_2"; - insertOrgQProfiles(orgQProfileUuid_2, ruleProfileKee_2); - String orgQProfileUuid_3 = "orgQProfileUuid_3"; - insertOrgQProfiles(orgQProfileUuid_3, ruleProfileKee_3); - - underTest.execute(); - - assertThatOrgQprofileRulesProfileUuidIsEqualTo(orgQProfileUuid_1, ruleProfileUuid_1); - assertThatOrgQprofileRulesProfileUuidIsEqualTo(orgQProfileUuid_2, ruleProfileUuid_2); - assertThatOrgQprofileRulesProfileUuidIsEqualTo(orgQProfileUuid_3, ruleProfileUuid_3); - } - - @Test - public void migration_is_reentrant() throws SQLException { - long ruleProfileId_1 = 1L; - String ruleProfileUuid_1 = "uuid-1"; - String ruleProfileKee_1 = "kee-1"; - insertRuleProfile(ruleProfileId_1, ruleProfileUuid_1, ruleProfileKee_1); - - long ruleProfileId_2 = 2L; - String ruleProfileUuid_2 = "uuid-2"; - String ruleProfileKee_2 = "kee-2"; - insertRuleProfile(ruleProfileId_2, ruleProfileUuid_2, ruleProfileKee_2); - - long ruleProfileId_3 = 3L; - String ruleProfileUuid_3 = "uuid-3"; - String ruleProfileKee_3 = "kee-3"; - insertRuleProfile(ruleProfileId_3, ruleProfileUuid_3, ruleProfileKee_3); - - String orgQProfileUuid_1 = "orgQProfileUuid_1"; - insertOrgQProfiles(orgQProfileUuid_1, ruleProfileKee_1); - String orgQProfileUuid_2 = "orgQProfileUuid_2"; - insertOrgQProfiles(orgQProfileUuid_2, ruleProfileKee_2); - String orgQProfileUuid_3 = "orgQProfileUuid_3"; - insertOrgQProfiles(orgQProfileUuid_3, ruleProfileKee_3); - - underTest.execute(); - - long ruleProfileId_4 = 4L; - String ruleProfileUuid_4 = "uuid-4"; - String ruleProfileKee_4 = "kee-4"; - insertRuleProfile(ruleProfileId_4, ruleProfileUuid_4, ruleProfileKee_4); - - String orgQProfileUuid_4 = "orgQProfileUuid_4"; - insertOrgQProfiles(orgQProfileUuid_4, ruleProfileKee_4); - - // re-entrant - underTest.execute(); - - assertThatOrgQprofileRulesProfileUuidIsEqualTo(orgQProfileUuid_1, ruleProfileUuid_1); - assertThatOrgQprofileRulesProfileUuidIsEqualTo(orgQProfileUuid_2, ruleProfileUuid_2); - assertThatOrgQprofileRulesProfileUuidIsEqualTo(orgQProfileUuid_3, ruleProfileUuid_3); - assertThatOrgQprofileRulesProfileUuidIsEqualTo(orgQProfileUuid_4, ruleProfileUuid_4); - } - - private void assertThatOrgQprofileRulesProfileUuidIsEqualTo(String orgQprofileUuid, String expectedUuid) { - assertThat(db.select("select rules_profile_uuid from org_qprofiles where uuid = '" + orgQprofileUuid + "'") - .stream() - .map(row -> row.get("RULES_PROFILE_UUID")) - .findFirst()) - .hasValue(expectedUuid); - } - - private void insertOrgQProfiles(String uuid, String rulesProfileUuid) { - db.executeInsert("org_qprofiles", - "uuid", uuid, - "organization_uuid", Uuids.createFast(), - "rules_profile_uuid", rulesProfileUuid, - "created_at", System.currentTimeMillis(), - "updated_at", System.currentTimeMillis()); - } - - private void insertRuleProfile(Long id, String uuid, String kee) { - db.executeInsert("rules_profiles", - "id", id, - "uuid", uuid, - "name", "name" + id, - "kee", kee, - "is_built_in", false); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/fk/qprofilechanges/PopulateQProfileChangesRulesProfileUuidTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/fk/qprofilechanges/PopulateQProfileChangesRulesProfileUuidTest.java deleted file mode 100644 index a3ea54d70ff..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/fk/qprofilechanges/PopulateQProfileChangesRulesProfileUuidTest.java +++ /dev/null @@ -1,136 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.rulesprofiles.fk.qprofilechanges; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.core.util.Uuids; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DataChange; - -import static org.assertj.core.api.Assertions.assertThat; - -public class PopulateQProfileChangesRulesProfileUuidTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(PopulateQProfileChangesRulesProfileUuidTest.class, "schema.sql"); - - private DataChange underTest = new PopulateQProfileChangesRulesProfileUuid(db.database()); - - @Test - public void populate_uuids() throws SQLException { - long ruleProfileId_1 = 1L; - String ruleProfileUuid_1 = "uuid-1"; - String ruleProfileKee_1 = "kee-1"; - insertRuleProfile(ruleProfileId_1, ruleProfileUuid_1, ruleProfileKee_1); - - long ruleProfileId_2 = 2L; - String ruleProfileUuid_2 = "uuid-2"; - String ruleProfileKee_2 = "kee-2"; - insertRuleProfile(ruleProfileId_2, ruleProfileUuid_2, ruleProfileKee_2); - - long ruleProfileId_3 = 3L; - String ruleProfileUuid_3 = "uuid-3"; - String ruleProfileKee_3 = "kee-3"; - insertRuleProfile(ruleProfileId_3, ruleProfileUuid_3, ruleProfileKee_3); - - String qProfileChangeUuid_1 = "qProfileChangeUuid_1"; - insertQProfileChange(qProfileChangeUuid_1, ruleProfileKee_1); - String qProfileChangeUuid_2 = "qProfileChangeUuid_2"; - insertQProfileChange(qProfileChangeUuid_2, ruleProfileKee_2); - String qProfileChangeUuid_3 = "qProfileChangeUuid_3"; - insertQProfileChange(qProfileChangeUuid_3, ruleProfileKee_3); - - underTest.execute(); - - assertThatQProfileChangeRulesProfileUuidIsEqualTo(qProfileChangeUuid_1, ruleProfileUuid_1); - assertThatQProfileChangeRulesProfileUuidIsEqualTo(qProfileChangeUuid_2, ruleProfileUuid_2); - assertThatQProfileChangeRulesProfileUuidIsEqualTo(qProfileChangeUuid_3, ruleProfileUuid_3); - } - - @Test - public void migration_is_reentrant() throws SQLException { - long ruleProfileId_1 = 1L; - String ruleProfileUuid_1 = "uuid-1"; - String ruleProfileKee_1 = "kee-1"; - insertRuleProfile(ruleProfileId_1, ruleProfileUuid_1, ruleProfileKee_1); - - long ruleProfileId_2 = 2L; - String ruleProfileUuid_2 = "uuid-2"; - String ruleProfileKee_2 = "kee-2"; - insertRuleProfile(ruleProfileId_2, ruleProfileUuid_2, ruleProfileKee_2); - - long ruleProfileId_3 = 3L; - String ruleProfileUuid_3 = "uuid-3"; - String ruleProfileKee_3 = "kee-3"; - insertRuleProfile(ruleProfileId_3, ruleProfileUuid_3, ruleProfileKee_3); - - String qProfileChangeUuid_1 = "qProfileChangeUuid_1"; - insertQProfileChange(qProfileChangeUuid_1, ruleProfileKee_1); - String qProfileChangeUuid_2 = "qProfileChangeUuid_2"; - insertQProfileChange(qProfileChangeUuid_2, ruleProfileKee_2); - String qProfileChangeUuid_3 = "qProfileChangeUuid_3"; - insertQProfileChange(qProfileChangeUuid_3, ruleProfileKee_3); - - underTest.execute(); - - long ruleProfileId_4 = 4L; - String ruleProfileUuid_4 = "uuid-4"; - String ruleProfileKee_4 = "kee-4"; - insertRuleProfile(ruleProfileId_4, ruleProfileUuid_4, ruleProfileKee_4); - - String qProfileChangeUuid_4 = "qProfileChangeUuid_4"; - insertQProfileChange(qProfileChangeUuid_4, ruleProfileKee_4); - - // re-entrant - underTest.execute(); - - assertThatQProfileChangeRulesProfileUuidIsEqualTo(qProfileChangeUuid_1, ruleProfileUuid_1); - assertThatQProfileChangeRulesProfileUuidIsEqualTo(qProfileChangeUuid_2, ruleProfileUuid_2); - assertThatQProfileChangeRulesProfileUuidIsEqualTo(qProfileChangeUuid_3, ruleProfileUuid_3); - assertThatQProfileChangeRulesProfileUuidIsEqualTo(qProfileChangeUuid_4, ruleProfileUuid_4); - } - - private void assertThatQProfileChangeRulesProfileUuidIsEqualTo(String qProfileChangeKee, String expectedUuid) { - assertThat(db.select("select rules_profile_uuid from qprofile_changes where kee = '" + qProfileChangeKee + "'") - .stream() - .map(row -> row.get("RULES_PROFILE_UUID")) - .findFirst()) - .hasValue(expectedUuid); - } - - private void insertQProfileChange(String kee, String rulesProfileUuid) { - db.executeInsert("qprofile_changes", - "kee", kee, - "change_type", Uuids.createFast(), - "rules_profile_uuid", rulesProfileUuid, - "created_at", System.currentTimeMillis()); - } - - private void insertRuleProfile(Long id, String uuid, String kee) { - db.executeInsert("rules_profiles", - "id", id, - "uuid", uuid, - "name", "name" + id, - "kee", kee, - "is_built_in", false); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/snapshots/AddPrimaryKeyOnUuidColumnOfSnapshotsTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/snapshots/AddPrimaryKeyOnUuidColumnOfSnapshotsTableTest.java deleted file mode 100644 index fdf6723086c..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/snapshots/AddPrimaryKeyOnUuidColumnOfSnapshotsTableTest.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.snapshots; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.version.v84.snapshots.issues.AddPrimaryKeyOnUuidColumnOfSnapshotsTable; - -import static org.assertj.core.api.Assertions.assertThatThrownBy; - -public class AddPrimaryKeyOnUuidColumnOfSnapshotsTableTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(AddPrimaryKeyOnUuidColumnOfSnapshotsTableTest.class, "schema.sql"); - - private AddPrimaryKeyOnUuidColumnOfSnapshotsTable underTest = new AddPrimaryKeyOnUuidColumnOfSnapshotsTable(db.database()); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertPrimaryKey("snapshots", "pk_snapshots", "uuid"); - } - - @Test - public void migration_is_not_re_entrant() throws SQLException { - underTest.execute(); - - assertThatThrownBy(() -> underTest.execute()).isInstanceOf(IllegalStateException.class); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/snapshots/DropIdColumnOfSnapshotsTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/snapshots/DropIdColumnOfSnapshotsTableTest.java deleted file mode 100644 index ab000923e97..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/snapshots/DropIdColumnOfSnapshotsTableTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.snapshots; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.version.v84.snapshots.issues.DropIdColumnOfSnapshotsTable; - -import static org.assertj.core.api.Assertions.assertThatThrownBy; - -public class DropIdColumnOfSnapshotsTableTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DropIdColumnOfSnapshotsTableTest.class, "schema.sql"); - - private DropIdColumnOfSnapshotsTable underTest = new DropIdColumnOfSnapshotsTable(db.database()); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertColumnDoesNotExist("snapshots", "id"); - } - - @Test - public void migration_is_not_re_entrant() throws SQLException { - underTest.execute(); - - assertThatThrownBy(() -> underTest.execute()).isInstanceOf(IllegalStateException.class); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/snapshots/DropPrimaryKeyOnIdColumnOfSnapshotsTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/snapshots/DropPrimaryKeyOnIdColumnOfSnapshotsTableTest.java deleted file mode 100644 index f55068b7a4f..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/snapshots/DropPrimaryKeyOnIdColumnOfSnapshotsTableTest.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.snapshots; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.sql.DbPrimaryKeyConstraintFinder; -import org.sonar.server.platform.db.migration.sql.DropPrimaryKeySqlGenerator; -import org.sonar.server.platform.db.migration.version.v84.snapshots.issues.DropPrimaryKeyOnIdColumnOfSnapshotsTable; - -public class DropPrimaryKeyOnIdColumnOfSnapshotsTableTest { - - private static final String TABLE_NAME = "snapshots"; - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DropPrimaryKeyOnIdColumnOfSnapshotsTableTest.class, "schema.sql"); - - private final DropPrimaryKeySqlGenerator dropPrimaryKeySqlGenerator = new DropPrimaryKeySqlGenerator(db.database(), new DbPrimaryKeyConstraintFinder(db.database())); - - private final DropPrimaryKeyOnIdColumnOfSnapshotsTable underTest = new DropPrimaryKeyOnIdColumnOfSnapshotsTable(db.database(), dropPrimaryKeySqlGenerator); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertNoPrimaryKey(TABLE_NAME); - } - - @Test - public void migration_is_re_entrant_but_fails_silently() throws SQLException { - underTest.execute(); - underTest.execute(); - - db.assertNoPrimaryKey(TABLE_NAME); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/AddPrimaryKeyOnUuidColumnOfUsersTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/AddPrimaryKeyOnUuidColumnOfUsersTableTest.java deleted file mode 100644 index 6946ae61470..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/AddPrimaryKeyOnUuidColumnOfUsersTableTest.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.users; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.assertj.core.api.Assertions.assertThatThrownBy; - -public class AddPrimaryKeyOnUuidColumnOfUsersTableTest { - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(AddPrimaryKeyOnUuidColumnOfUsersTableTest.class, "schema.sql"); - - private DdlChange underTest = new AddPrimaryKeyOnUuidColumnOfUsersTable(db.database()); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertPrimaryKey("users", "pk_users", "uuid"); - } - - @Test - public void migration_is_not_re_entrant() throws SQLException { - underTest.execute(); - - assertThatThrownBy(() -> underTest.execute()).isInstanceOf(IllegalStateException.class); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/DropIdColumnOfUsersTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/DropIdColumnOfUsersTableTest.java deleted file mode 100644 index 285c9307328..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/DropIdColumnOfUsersTableTest.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.users; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.assertj.core.api.Assertions.assertThatThrownBy; - -public class DropIdColumnOfUsersTableTest { - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DropIdColumnOfUsersTableTest.class, "schema.sql"); - - private DdlChange underTest = new DropIdColumnOfUsersTable(db.database()); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertColumnDoesNotExist("users", "id"); - } - - @Test - public void migration_is_not_re_entrant() throws SQLException { - underTest.execute(); - - assertThatThrownBy(() -> underTest.execute()).isInstanceOf(IllegalStateException.class); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/DropPrimaryKeyOnIdColumnOfUsersTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/DropPrimaryKeyOnIdColumnOfUsersTableTest.java deleted file mode 100644 index 677b97c8f36..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/DropPrimaryKeyOnIdColumnOfUsersTableTest.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.users; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.sql.DbPrimaryKeyConstraintFinder; -import org.sonar.server.platform.db.migration.sql.DropPrimaryKeySqlGenerator; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class DropPrimaryKeyOnIdColumnOfUsersTableTest { - private static final String TABLE_NAME = "users"; - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DropPrimaryKeyOnIdColumnOfUsersTableTest.class, "schema.sql"); - - private final DropPrimaryKeySqlGenerator dropPrimaryKeySqlGenerator = new DropPrimaryKeySqlGenerator(db.database(), new DbPrimaryKeyConstraintFinder(db.database())); - - private final DdlChange underTest = new DropPrimaryKeyOnIdColumnOfUsersTable(db.database(), dropPrimaryKeySqlGenerator); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertNoPrimaryKey(TABLE_NAME); - } - - @Test - public void migration_is_re_entrant_but_fails_silently() throws SQLException { - underTest.execute(); - underTest.execute(); - - db.assertNoPrimaryKey(TABLE_NAME); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/DropUniqueIndexOnUuidColumnOfUsersTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/DropUniqueIndexOnUuidColumnOfUsersTableTest.java deleted file mode 100644 index 8064954ee2e..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/DropUniqueIndexOnUuidColumnOfUsersTableTest.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.users; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class DropUniqueIndexOnUuidColumnOfUsersTableTest { - private static final String TABLE_NAME = "users"; - private static final String INDEX_NAME = "users_uuid"; - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DropUniqueIndexOnUuidColumnOfUsersTableTest.class, "schema.sql"); - - private DdlChange underTest = new DropUniqueIndexOnUuidColumnOfUsersTable(db.database()); - - @Test - public void remove_index_if_exists() throws SQLException { - underTest.execute(); - db.assertIndexDoesNotExist(TABLE_NAME, INDEX_NAME); - } - - @Test - public void migration_is_reentrant() throws SQLException { - underTest.execute(); - // re-entrant - underTest.execute(); - db.assertIndexDoesNotExist(TABLE_NAME, INDEX_NAME); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/groupsusers/AddIndexOnUserUuidOfGroupsUsersTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/groupsusers/AddIndexOnUserUuidOfGroupsUsersTableTest.java deleted file mode 100644 index 7f2d0f32d15..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/groupsusers/AddIndexOnUserUuidOfGroupsUsersTableTest.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.users.fk.groupsusers; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class AddIndexOnUserUuidOfGroupsUsersTableTest { - - private static final String TABLE_NAME = "groups_users"; - private static final String INDEX_NAME = "index_groups_users_user_uuid"; - - @Rule - public CoreDbTester dbTester = CoreDbTester.createForSchema(AddIndexOnUserUuidOfGroupsUsersTableTest.class, "schema.sql"); - - DdlChange underTest = new AddIndexOnUserUuidOfGroupsUsersTable(dbTester.database()); - - @Test - public void add_index() throws SQLException { - underTest.execute(); - dbTester.assertIndex(TABLE_NAME, INDEX_NAME, "user_uuid"); - } - - @Test - public void migration_is_reentrant() throws SQLException { - underTest.execute(); - dbTester.assertIndex(TABLE_NAME, INDEX_NAME, "user_uuid"); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/groupsusers/AddUniqueIndexOnUserUuidAndGroupIdOfGroupsUsersTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/groupsusers/AddUniqueIndexOnUserUuidAndGroupIdOfGroupsUsersTableTest.java deleted file mode 100644 index f30e59db094..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/groupsusers/AddUniqueIndexOnUserUuidAndGroupIdOfGroupsUsersTableTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.users.fk.groupsusers; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class AddUniqueIndexOnUserUuidAndGroupIdOfGroupsUsersTableTest { - - private static final String TABLE_NAME = "groups_users"; - private static final String INDEX_NAME = "groups_users_unique"; - - @Rule - public CoreDbTester dbTester = CoreDbTester.createForSchema(AddUniqueIndexOnUserUuidAndGroupIdOfGroupsUsersTableTest.class, "schema.sql"); - - DdlChange underTest = new AddUniqueIndexOnUserUuidAndGroupIdOfGroupsUsersTable(dbTester.database()); - - @Test - public void add_index() throws SQLException { - underTest.execute(); - dbTester.assertUniqueIndex(TABLE_NAME, INDEX_NAME, "user_uuid", "group_uuid"); - } - - @Test - public void migration_is_reentrant() throws SQLException { - underTest.execute(); - // re-entrant - underTest.execute(); - dbTester.assertUniqueIndex(TABLE_NAME, INDEX_NAME, "user_uuid", "group_uuid"); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/groupsusers/AddUserUuidColumnToGroupsUsersTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/groupsusers/AddUserUuidColumnToGroupsUsersTest.java deleted file mode 100644 index 3d8f3800f8a..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/groupsusers/AddUserUuidColumnToGroupsUsersTest.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.users.fk.groupsusers; - -import java.sql.SQLException; -import java.sql.Types; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.core.util.Uuids; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.assertj.core.api.Assertions.assertThat; - -public class AddUserUuidColumnToGroupsUsersTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(AddUserUuidColumnToGroupsUsersTest.class, "schema.sql"); - - private DdlChange underTest = new AddUserUuidColumnToGroupsUsers(db.database()); - - @Before - public void setup() { - insertGroupUser(Uuids.createFast(), 1L); - insertGroupUser(Uuids.createFast(), 2L); - insertGroupUser(Uuids.createFast(), 3L); - } - - @Test - public void add_uuid_column() throws SQLException { - underTest.execute(); - - db.assertColumnDefinition("groups_users", "user_uuid", Types.VARCHAR, 255, true); - - assertThat(db.countSql("select count(*) from groups_users")) - .isEqualTo(3); - } - - private void insertGroupUser(String uuid, Long userId) { - db.executeInsert("groups_users", - "group_uuid", uuid, - "user_id", userId + 1); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/groupsusers/DropIndexOnUserIdOfGroupsUsersTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/groupsusers/DropIndexOnUserIdOfGroupsUsersTableTest.java deleted file mode 100644 index bc3acc4cbe3..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/groupsusers/DropIndexOnUserIdOfGroupsUsersTableTest.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.users.fk.groupsusers; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class DropIndexOnUserIdOfGroupsUsersTableTest { - - private static final String TABLE_NAME = "users_groups"; - private static final String INDEX_NAME = "index_groups_users_on_user_id"; - - @Rule - public CoreDbTester dbTester = CoreDbTester.createForSchema(DropIndexOnUserIdOfGroupsUsersTableTest.class, "schema.sql"); - - DdlChange underTest = new DropIndexOnUserIdOfGroupsUsersTable(dbTester.database()); - - @Test - public void add_index() throws SQLException { - underTest.execute(); - dbTester.assertIndexDoesNotExist(TABLE_NAME, INDEX_NAME); - } - - @Test - public void migration_is_reentrant() throws SQLException { - underTest.execute(); - dbTester.assertIndexDoesNotExist(TABLE_NAME, INDEX_NAME); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/groupsusers/DropUniqueIndexOnUserIdAndGroupIdOfGroupsUsersTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/groupsusers/DropUniqueIndexOnUserIdAndGroupIdOfGroupsUsersTableTest.java deleted file mode 100644 index b4d82b0c4e5..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/groupsusers/DropUniqueIndexOnUserIdAndGroupIdOfGroupsUsersTableTest.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.users.fk.groupsusers; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class DropUniqueIndexOnUserIdAndGroupIdOfGroupsUsersTableTest { - - private static final String TABLE_NAME = "groups_users"; - private static final String INDEX_NAME = "groups_users_unique"; - - @Rule - public CoreDbTester dbTester = CoreDbTester.createForSchema(DropUniqueIndexOnUserIdAndGroupIdOfGroupsUsersTableTest.class, "schema.sql"); - - DdlChange underTest = new DropUniqueIndexOnUserIdAndGroupIdOfGroupsUsersTable(dbTester.database()); - - @Test - public void add_index() throws SQLException { - underTest.execute(); - dbTester.assertIndexDoesNotExist(TABLE_NAME, INDEX_NAME); - } - - @Test - public void migration_is_reentrant() throws SQLException { - underTest.execute(); - dbTester.assertIndexDoesNotExist(TABLE_NAME, INDEX_NAME); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/groupsusers/DropUserIdColumnOfGroupsUsersTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/groupsusers/DropUserIdColumnOfGroupsUsersTableTest.java deleted file mode 100644 index 97d77353eaf..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/groupsusers/DropUserIdColumnOfGroupsUsersTableTest.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.users.fk.groupsusers; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.assertj.core.api.Assertions.assertThatThrownBy; - -public class DropUserIdColumnOfGroupsUsersTableTest { - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DropUserIdColumnOfGroupsUsersTableTest.class, "schema.sql"); - - private DdlChange underTest = new DropUserIdColumnOfGroupsUsersTable(db.database()); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertColumnDoesNotExist("groups_users", "user_id"); - } - - @Test - public void migration_is_not_re_entrant() throws SQLException { - underTest.execute(); - - assertThatThrownBy(() -> underTest.execute()).isInstanceOf(IllegalStateException.class); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/groupsusers/MakeGroupsUsersUserUuidColumnNotNullableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/groupsusers/MakeGroupsUsersUserUuidColumnNotNullableTest.java deleted file mode 100644 index cac9667cb98..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/groupsusers/MakeGroupsUsersUserUuidColumnNotNullableTest.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.users.fk.groupsusers; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -import static java.sql.Types.VARCHAR; - -public class MakeGroupsUsersUserUuidColumnNotNullableTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(MakeGroupsUsersUserUuidColumnNotNullableTest.class, "schema.sql"); - - private MigrationStep underTest = new MakeGroupsUsersUserUuidColumnNotNullable(db.database()); - - @Test - public void uuid_column_is_not_null() throws SQLException { - underTest.execute(); - - db.assertColumnDefinition("groups_users", "user_uuid", VARCHAR, null, false); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/groupsusers/PopulateGroupsUsersUserUuidTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/groupsusers/PopulateGroupsUsersUserUuidTest.java deleted file mode 100644 index 49f120d2ff0..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/groupsusers/PopulateGroupsUsersUserUuidTest.java +++ /dev/null @@ -1,143 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.users.fk.groupsusers; - -import java.sql.SQLException; -import java.util.Objects; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.core.util.Uuids; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DataChange; - -import static org.assertj.core.api.Assertions.assertThat; - -public class PopulateGroupsUsersUserUuidTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(PopulateGroupsUsersUserUuidTest.class, "schema.sql"); - - private DataChange underTest = new PopulateGroupsUsersUserUuid(db.database()); - - @Test - public void populate_uuids() throws SQLException { - long userId_1 = 1L; - String userUuid_1 = "uuid-1"; - insertUser(userId_1, userUuid_1); - - long userId_2 = 2L; - String userUuid_2 = "uuid-2"; - insertUser(userId_2, userUuid_2); - - long userId_3 = 3L; - String userUuid_3 = "uuid-3"; - insertUser(userId_3, userUuid_3); - - long userId_4 = 4L; - String userUuid_4 = "uuid-4"; - insertUser(userId_4, userUuid_4); - - String groupUuid_1 = Uuids.createFast(); - insertGroupUser(userId_1, groupUuid_1); - String groupUuid_2 = Uuids.createFast(); - insertGroupUser(userId_2, groupUuid_2); - String groupUuid_3 = Uuids.createFast(); - insertGroupUser(userId_3, groupUuid_3); - String groupUuid_4 = Uuids.createFast(); - insertGroupUser(userId_1, groupUuid_4); - // orphan FK - String groupUuid_5 = Uuids.createFast(); - insertGroupUser(100L, groupUuid_5); - - underTest.execute(); - - assertThat(db.countRowsOfTable("groups_users")).isEqualTo(4); - assertThatGroupsUserUserUuidIsEqualTo(userId_1, groupUuid_1, userUuid_1); - assertThatGroupsUserUserUuidIsEqualTo(userId_2, groupUuid_2, userUuid_2); - assertThatGroupsUserUserUuidIsEqualTo(userId_3, groupUuid_3, userUuid_3); - assertThatGroupsUserUserUuidIsEqualTo(userId_1, groupUuid_4, userUuid_1); - } - - @Test - public void migration_is_reentrant() throws SQLException { - long userId_1 = 1L; - String userUuid_1 = "uuid-1"; - insertUser(userId_1, userUuid_1); - - long userId_2 = 2L; - String userUuid_2 = "uuid-2"; - insertUser(userId_2, userUuid_2); - - long userId_3 = 3L; - String userUuid_3 = "uuid-3"; - insertUser(userId_3, userUuid_3); - - long userId_4 = 4L; - String userUuid_4 = "uuid-4"; - insertUser(userId_4, userUuid_4); - - String groupUuid_1 = Uuids.createFast(); - insertGroupUser(userId_1, groupUuid_1); - String groupUuid_2 = Uuids.createFast(); - insertGroupUser(userId_2, groupUuid_2); - String groupUuid_3 = Uuids.createFast(); - insertGroupUser(userId_3, groupUuid_3); - - underTest.execute(); - - String groupUuid_4 = Uuids.createFast(); - insertGroupUser(userId_1, groupUuid_4); - - // re-entrant - underTest.execute(); - - assertThatGroupsUserUserUuidIsEqualTo(userId_1, groupUuid_1, userUuid_1); - assertThatGroupsUserUserUuidIsEqualTo(userId_2, groupUuid_2, userUuid_2); - assertThatGroupsUserUserUuidIsEqualTo(userId_3, groupUuid_3, userUuid_3); - assertThatGroupsUserUserUuidIsEqualTo(userId_1, groupUuid_4, userUuid_1); - } - - private void assertThatGroupsUserUserUuidIsEqualTo(Long userId, String groupUuid, String expectedUuid) { - assertThat(db.select(String.format("select user_uuid from groups_users where user_id = %d and group_uuid = '%s'", userId, groupUuid)) - .stream() - .map(row -> row.get("USER_UUID")) - .filter(Objects::nonNull) - .findFirst()) - .hasValue(expectedUuid); - } - - private void insertGroupUser(Long userId, String groupUuid) { - db.executeInsert("groups_users", - "user_id", userId, - "group_uuid", groupUuid); - } - - private void insertUser(Long id, String uuid) { - db.executeInsert("users", - "id", id, - "uuid", uuid, - "login", "login" + id, - "external_login", "ex-login" + id, - "external_identity_provider", "ex-provider" + id, - "external_id", id + 1, - "is_root", false, - "onboarded", false); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/organizationmembers/AddIndexOnUserUuidOfOrganizationMembersTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/organizationmembers/AddIndexOnUserUuidOfOrganizationMembersTableTest.java deleted file mode 100644 index d6a882022a9..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/organizationmembers/AddIndexOnUserUuidOfOrganizationMembersTableTest.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.users.fk.organizationmembers; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class AddIndexOnUserUuidOfOrganizationMembersTableTest { - - private static final String TABLE_NAME = "organization_members"; - private static final String INDEX_NAME = "org_members_user_uuid"; - - @Rule - public CoreDbTester dbTester = CoreDbTester.createForSchema(AddIndexOnUserUuidOfOrganizationMembersTableTest.class, "schema.sql"); - - DdlChange underTest = new AddIndexOnUserUuidOfOrganizationMembersTable(dbTester.database()); - - @Test - public void add_index() throws SQLException { - underTest.execute(); - dbTester.assertIndex(TABLE_NAME, INDEX_NAME, "user_uuid"); - } - - @Test - public void migration_is_reentrant() throws SQLException { - underTest.execute(); - dbTester.assertIndex(TABLE_NAME, INDEX_NAME, "user_uuid"); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/organizationmembers/AddPrimaryKeyOnUserUuidAndOrganizationUuidColumnsOfUserRolesTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/organizationmembers/AddPrimaryKeyOnUserUuidAndOrganizationUuidColumnsOfUserRolesTableTest.java deleted file mode 100644 index f22d41228e8..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/organizationmembers/AddPrimaryKeyOnUserUuidAndOrganizationUuidColumnsOfUserRolesTableTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.users.fk.organizationmembers; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.assertj.core.api.Assertions.assertThatThrownBy; - -public class AddPrimaryKeyOnUserUuidAndOrganizationUuidColumnsOfUserRolesTableTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(AddPrimaryKeyOnUserUuidAndOrganizationUuidColumnsOfUserRolesTableTest.class, "schema.sql"); - - private DdlChange underTest = new AddPrimaryKeyOnUserUuidAndOrganizationUuidColumnsOfUserRolesTable(db.database()); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertPrimaryKey("organization_members", "pk_organization_members", "user_uuid", "organization_uuid"); - } - - @Test - public void migration_is_not_re_entrant() throws SQLException { - underTest.execute(); - - assertThatThrownBy(() -> underTest.execute()).isInstanceOf(IllegalStateException.class); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/organizationmembers/AddUserUuidColumnToOrganizationMembersTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/organizationmembers/AddUserUuidColumnToOrganizationMembersTest.java deleted file mode 100644 index 23f142d4cb8..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/organizationmembers/AddUserUuidColumnToOrganizationMembersTest.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.users.fk.organizationmembers; - -import java.sql.SQLException; -import java.sql.Types; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.assertj.core.api.Assertions.assertThat; - -public class AddUserUuidColumnToOrganizationMembersTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(AddUserUuidColumnToOrganizationMembersTest.class, "schema.sql"); - - private DdlChange underTest = new AddUserUuidColumnToOrganizationMembers(db.database()); - - @Before - public void setup() { - insertGroupUser(1L); - insertGroupUser(2L); - insertGroupUser(3L); - } - - @Test - public void add_uuid_column() throws SQLException { - underTest.execute(); - - db.assertColumnDefinition("organization_members", "user_uuid", Types.VARCHAR, 255, true); - - assertThat(db.countSql("select count(*) from organization_members")) - .isEqualTo(3); - } - - private void insertGroupUser(Long id) { - db.executeInsert("organization_members", - "user_id", id, - "organization_uuid", "uuid-" + id); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/organizationmembers/DropIndexOnUserIdOfOrganizationMembersTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/organizationmembers/DropIndexOnUserIdOfOrganizationMembersTableTest.java deleted file mode 100644 index a5855e58af2..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/organizationmembers/DropIndexOnUserIdOfOrganizationMembersTableTest.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.users.fk.organizationmembers; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class DropIndexOnUserIdOfOrganizationMembersTableTest { - - private static final String TABLE_NAME = "organization_members"; - private static final String INDEX_NAME = "ix_org_members_on_user_id"; - - @Rule - public CoreDbTester dbTester = CoreDbTester.createForSchema(DropIndexOnUserIdOfOrganizationMembersTableTest.class, "schema.sql"); - - DdlChange underTest = new DropIndexOnUserIdOfOrganizationMembersTable(dbTester.database()); - - @Test - public void add_index() throws SQLException { - underTest.execute(); - dbTester.assertIndexDoesNotExist(TABLE_NAME, INDEX_NAME); - } - - @Test - public void migration_is_reentrant() throws SQLException { - underTest.execute(); - dbTester.assertIndexDoesNotExist(TABLE_NAME, INDEX_NAME); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/organizationmembers/DropPrimaryKeyOnUserIdAndOrganizationUuidOfOrganizationMembersTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/organizationmembers/DropPrimaryKeyOnUserIdAndOrganizationUuidOfOrganizationMembersTableTest.java deleted file mode 100644 index cbc0310e1f5..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/organizationmembers/DropPrimaryKeyOnUserIdAndOrganizationUuidOfOrganizationMembersTableTest.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.users.fk.organizationmembers; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.sql.DbPrimaryKeyConstraintFinder; -import org.sonar.server.platform.db.migration.sql.DropPrimaryKeySqlGenerator; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class DropPrimaryKeyOnUserIdAndOrganizationUuidOfOrganizationMembersTableTest { - private static final String TABLE_NAME = "organization_members"; - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DropPrimaryKeyOnUserIdAndOrganizationUuidOfOrganizationMembersTableTest.class, "schema.sql"); - - private final DropPrimaryKeySqlGenerator dropPrimaryKeySqlGenerator = new DropPrimaryKeySqlGenerator(db.database(), new DbPrimaryKeyConstraintFinder(db.database())); - - private final DdlChange underTest = new DropPrimaryKeyOnUserIdAndOrganizationUuidOfOrganizationMembersTable(db.database(), dropPrimaryKeySqlGenerator); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertNoPrimaryKey(TABLE_NAME); - } - - @Test - public void migration_is_re_entrant_but_fails_silently() throws SQLException { - underTest.execute(); - underTest.execute(); - - db.assertNoPrimaryKey(TABLE_NAME); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/organizationmembers/DropUserIdColumnOfOrganizationMembersTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/organizationmembers/DropUserIdColumnOfOrganizationMembersTableTest.java deleted file mode 100644 index 6f53c7f19a1..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/organizationmembers/DropUserIdColumnOfOrganizationMembersTableTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.users.fk.organizationmembers; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.assertj.core.api.Assertions.assertThatThrownBy; - -public class DropUserIdColumnOfOrganizationMembersTableTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DropUserIdColumnOfOrganizationMembersTableTest.class, "schema.sql"); - - private DdlChange underTest = new DropUserIdColumnOfOrganizationMembersTable(db.database()); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertColumnDoesNotExist("organization_members", "user_id"); - } - - @Test - public void migration_is_not_re_entrant() throws SQLException { - underTest.execute(); - - assertThatThrownBy(() -> underTest.execute()).isInstanceOf(IllegalStateException.class); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/organizationmembers/MakeOrganizationMembersUserUuidColumnNotNullableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/organizationmembers/MakeOrganizationMembersUserUuidColumnNotNullableTest.java deleted file mode 100644 index 0c7f8ec3c59..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/organizationmembers/MakeOrganizationMembersUserUuidColumnNotNullableTest.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.users.fk.organizationmembers; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -import static java.sql.Types.VARCHAR; - -public class MakeOrganizationMembersUserUuidColumnNotNullableTest { - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(MakeOrganizationMembersUserUuidColumnNotNullableTest.class, "schema.sql"); - - private MigrationStep underTest = new MakeOrganizationMembersUserUuidColumnNotNullable(db.database()); - - @Test - public void uuid_column_is_not_null() throws SQLException { - underTest.execute(); - - db.assertColumnDefinition("organization_members", "user_uuid", VARCHAR, 255, false); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/organizationmembers/PopulateOrganizationMembersUserUuidTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/organizationmembers/PopulateOrganizationMembersUserUuidTest.java deleted file mode 100644 index 516dd9e0e0b..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/organizationmembers/PopulateOrganizationMembersUserUuidTest.java +++ /dev/null @@ -1,145 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.users.fk.organizationmembers; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.core.util.Uuids; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DataChange; - -import static org.assertj.core.api.Assertions.assertThat; - -public class PopulateOrganizationMembersUserUuidTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(PopulateOrganizationMembersUserUuidTest.class, "schema.sql"); - - private DataChange underTest = new PopulateOrganizationMembersUserUuid(db.database()); - - @Test - public void populate_uuids() throws SQLException { - long userId_1 = 1L; - String userUuid_1 = "uuid-1"; - insertUser(userId_1, userUuid_1); - - long userId_2 = 2L; - String userUuid_2 = "uuid-2"; - insertUser(userId_2, userUuid_2); - - long userId_3 = 3L; - String userUuid_3 = "uuid-3"; - insertUser(userId_3, userUuid_3); - - long userId_4 = 4L; - String userUuid_4 = "uuid-4"; - insertUser(userId_4, userUuid_4); - - String organizationUuid_1 = Uuids.createFast(); - insertOrganizationMember(userId_1, organizationUuid_1); - String organizationUuid_2 = Uuids.createFast(); - insertOrganizationMember(userId_2, organizationUuid_2); - String organizationUuid_3 = Uuids.createFast(); - insertOrganizationMember(userId_3, organizationUuid_3); - String organizationUuid_4 = Uuids.createFast(); - insertOrganizationMember(userId_4, organizationUuid_4); - String organizationUuid_5 = Uuids.createFast(); - insertOrganizationMember(userId_1, organizationUuid_5); - - // orphan FK - String organizationUuid_6 = Uuids.createFast(); - insertOrganizationMember(100L, organizationUuid_6); - - underTest.execute(); - - assertThat(db.countRowsOfTable("organization_members")).isEqualTo(5); - assertThatQProfileChangeRulesProfileUuidIsEqualTo(userId_1, organizationUuid_1, userUuid_1); - assertThatQProfileChangeRulesProfileUuidIsEqualTo(userId_2, organizationUuid_2, userUuid_2); - assertThatQProfileChangeRulesProfileUuidIsEqualTo(userId_3, organizationUuid_3, userUuid_3); - assertThatQProfileChangeRulesProfileUuidIsEqualTo(userId_4, organizationUuid_4, userUuid_4); - assertThatQProfileChangeRulesProfileUuidIsEqualTo(userId_1, organizationUuid_5, userUuid_1); - } - - @Test - public void migration_is_reentrant() throws SQLException { - long userId_1 = 1L; - String userUuid_1 = "uuid-1"; - insertUser(userId_1, userUuid_1); - - long userId_2 = 2L; - String userUuid_2 = "uuid-2"; - insertUser(userId_2, userUuid_2); - - long userId_3 = 3L; - String userUuid_3 = "uuid-3"; - insertUser(userId_3, userUuid_3); - - long userId_4 = 4L; - String userUuid_4 = "uuid-4"; - insertUser(userId_4, userUuid_4); - - String organizationUuid_1 = Uuids.createFast(); - insertOrganizationMember(userId_1, organizationUuid_1); - String organizationUuid_2 = Uuids.createFast(); - insertOrganizationMember(userId_2, organizationUuid_2); - String organizationUuid_3 = Uuids.createFast(); - insertOrganizationMember(userId_3, organizationUuid_3); - - underTest.execute(); - - String organizationUuid_4 = Uuids.createFast(); - insertOrganizationMember(userId_3, organizationUuid_4); - - // re-entrant - underTest.execute(); - - assertThatQProfileChangeRulesProfileUuidIsEqualTo(userId_1, organizationUuid_1, userUuid_1); - assertThatQProfileChangeRulesProfileUuidIsEqualTo(userId_2, organizationUuid_2, userUuid_2); - assertThatQProfileChangeRulesProfileUuidIsEqualTo(userId_3, organizationUuid_3, userUuid_3); - assertThatQProfileChangeRulesProfileUuidIsEqualTo(userId_3, organizationUuid_4, userUuid_3); - } - - private void assertThatQProfileChangeRulesProfileUuidIsEqualTo(Long userId, String organizationUuid, String expectedUuid) { - assertThat(db.select(String.format("select user_uuid from organization_members where user_id = %d and organization_uuid = '%s'", userId, organizationUuid)) - .stream() - .map(row -> row.get("USER_UUID")) - .findFirst()) - .hasValue(expectedUuid); - } - - private void insertOrganizationMember(Long userId, String organizationUuid) { - db.executeInsert("organization_members", - "user_id", userId, - "organization_uuid", organizationUuid); - } - - private void insertUser(Long id, String uuid) { - db.executeInsert("users", - "id", id, - "uuid", uuid, - "login", "login" + id, - "external_login", "ex-login" + id, - "external_identity_provider", "ex-provider" + id, - "external_id", id + 1, - "is_root", false, - "onboarded", false); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/permtemplatesusers/AddUserUuidColumnToPermTemplatesUsersTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/permtemplatesusers/AddUserUuidColumnToPermTemplatesUsersTest.java deleted file mode 100644 index 1e58a237c36..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/permtemplatesusers/AddUserUuidColumnToPermTemplatesUsersTest.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.users.fk.permtemplatesusers; - -import java.sql.SQLException; -import java.sql.Types; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.core.util.Uuids; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.assertj.core.api.Assertions.assertThat; - -public class AddUserUuidColumnToPermTemplatesUsersTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(AddUserUuidColumnToPermTemplatesUsersTest.class, "schema.sql"); - - private DdlChange underTest = new AddUserUuidColumnToPermTemplatesUsers(db.database()); - - @Before - public void setup() { - insertPermTemplatesUser(Uuids.createFast(), 1L); - insertPermTemplatesUser(Uuids.createFast(), 2L); - insertPermTemplatesUser(Uuids.createFast(), 3L); - } - - @Test - public void add_uuid_column() throws SQLException { - underTest.execute(); - - db.assertColumnDefinition("perm_templates_users", "user_uuid", Types.VARCHAR, 255, true); - - assertThat(db.countSql("select count(*) from perm_templates_users")) - .isEqualTo(3); - } - - private void insertPermTemplatesUser(String uuid, long userId) { - db.executeInsert("perm_templates_users", - "uuid", uuid, - "user_id", userId, - "template_id", userId + 100, - "permission_reference", Uuids.createFast()); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/permtemplatesusers/DropUserIdColumnOfPermTemplatesUsersTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/permtemplatesusers/DropUserIdColumnOfPermTemplatesUsersTableTest.java deleted file mode 100644 index 4fcdcb69d69..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/permtemplatesusers/DropUserIdColumnOfPermTemplatesUsersTableTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.users.fk.permtemplatesusers; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.assertj.core.api.Assertions.assertThatThrownBy; - -public class DropUserIdColumnOfPermTemplatesUsersTableTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DropUserIdColumnOfPermTemplatesUsersTableTest.class, "schema.sql"); - - private DdlChange underTest = new DropUserIdColumnOfPermTemplatesUsersTable(db.database()); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertColumnDoesNotExist("perm_templates_users", "user_id"); - } - - @Test - public void migration_is_not_re_entrant() throws SQLException { - underTest.execute(); - - assertThatThrownBy(() -> underTest.execute()).isInstanceOf(IllegalStateException.class); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/permtemplatesusers/MakePermTemplatesUsersUserUuidColumnNotNullableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/permtemplatesusers/MakePermTemplatesUsersUserUuidColumnNotNullableTest.java deleted file mode 100644 index 8c6b7319d35..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/permtemplatesusers/MakePermTemplatesUsersUserUuidColumnNotNullableTest.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.users.fk.permtemplatesusers; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -import static java.sql.Types.VARCHAR; - -public class MakePermTemplatesUsersUserUuidColumnNotNullableTest { - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(MakePermTemplatesUsersUserUuidColumnNotNullableTest.class, "schema.sql"); - - private MigrationStep underTest = new MakePermTemplatesUsersUserUuidColumnNotNullable(db.database()); - - @Test - public void uuid_column_is_not_null() throws SQLException { - underTest.execute(); - - db.assertColumnDefinition("perm_templates_users", "user_uuid", VARCHAR, 255, false); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/permtemplatesusers/PopulatePermTemplatesUsersUserUuidTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/permtemplatesusers/PopulatePermTemplatesUsersUserUuidTest.java deleted file mode 100644 index ec7a482bd22..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/permtemplatesusers/PopulatePermTemplatesUsersUserUuidTest.java +++ /dev/null @@ -1,150 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.users.fk.permtemplatesusers; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.core.util.Uuids; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DataChange; - -import static org.assertj.core.api.Assertions.assertThat; - -public class PopulatePermTemplatesUsersUserUuidTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(PopulatePermTemplatesUsersUserUuidTest.class, "schema.sql"); - - private DataChange underTest = new PopulatePermTemplatesUsersUserUuid(db.database()); - - @Test - public void populate_uuids() throws SQLException { - long userId_1 = 1L; - String userUuid_1 = "uuid-1"; - insertUser(userId_1, userUuid_1); - - long userId_2 = 2L; - String userUuid_2 = "uuid-2"; - insertUser(userId_2, userUuid_2); - - long userId_3 = 3L; - String userUuid_3 = "uuid-3"; - insertUser(userId_3, userUuid_3); - - long userId_4 = 4L; - String userUuid_4 = "uuid-4"; - insertUser(userId_4, userUuid_4); - - String permTemplatesUserUuid_1 = Uuids.createFast(); - insertPermTemplatesUser(permTemplatesUserUuid_1, userId_1); - String permTemplatesUserUuid_2 = Uuids.createFast(); - insertPermTemplatesUser(permTemplatesUserUuid_2, userId_2); - String permTemplatesUserUuid_3 = Uuids.createFast(); - insertPermTemplatesUser(permTemplatesUserUuid_3, userId_3); - String permTemplatesUserUuid_4 = Uuids.createFast(); - insertPermTemplatesUser(permTemplatesUserUuid_4, userId_4); - String permTemplatesUserUuid_5 = Uuids.createFast(); - insertPermTemplatesUser(permTemplatesUserUuid_5, userId_1); - - // orphan FK - String permTemplatesUserUuid_6 = Uuids.createFast(); - insertPermTemplatesUser(permTemplatesUserUuid_6, 100L); - - underTest.execute(); - - assertThat(db.countRowsOfTable("perm_templates_users")).isEqualTo(5); - assertThatPermTemplatesUsersUserUuidIsEqualTo(permTemplatesUserUuid_1, userUuid_1); - assertThatPermTemplatesUsersUserUuidIsEqualTo(permTemplatesUserUuid_2, userUuid_2); - assertThatPermTemplatesUsersUserUuidIsEqualTo(permTemplatesUserUuid_3, userUuid_3); - assertThatPermTemplatesUsersUserUuidIsEqualTo(permTemplatesUserUuid_4, userUuid_4); - assertThatPermTemplatesUsersUserUuidIsEqualTo(permTemplatesUserUuid_5, userUuid_1); - } - - @Test - public void migration_is_reentrant() throws SQLException { - long userId_1 = 1L; - String userUuid_1 = "uuid-1"; - insertUser(userId_1, userUuid_1); - - long userId_2 = 2L; - String userUuid_2 = "uuid-2"; - insertUser(userId_2, userUuid_2); - - long userId_3 = 3L; - String userUuid_3 = "uuid-3"; - insertUser(userId_3, userUuid_3); - - long userId_4 = 4L; - String userUuid_4 = "uuid-4"; - insertUser(userId_4, userUuid_4); - - String permTemplatesUserUuid_1 = Uuids.createFast(); - insertPermTemplatesUser(permTemplatesUserUuid_1, userId_1); - String permTemplatesUserUuid_2 = Uuids.createFast(); - insertPermTemplatesUser(permTemplatesUserUuid_2, userId_2); - String permTemplatesUserUuid_3 = Uuids.createFast(); - insertPermTemplatesUser(permTemplatesUserUuid_3, userId_3); - - underTest.execute(); - - String permTemplatesUserUuid_4 = Uuids.createFast(); - insertPermTemplatesUser(permTemplatesUserUuid_4, userId_4); - String permTemplatesUserUuid_5 = Uuids.createFast(); - insertPermTemplatesUser(permTemplatesUserUuid_5, userId_1); - - // re-entrant - underTest.execute(); - - assertThatPermTemplatesUsersUserUuidIsEqualTo(permTemplatesUserUuid_1, userUuid_1); - assertThatPermTemplatesUsersUserUuidIsEqualTo(permTemplatesUserUuid_2, userUuid_2); - assertThatPermTemplatesUsersUserUuidIsEqualTo(permTemplatesUserUuid_3, userUuid_3); - assertThatPermTemplatesUsersUserUuidIsEqualTo(permTemplatesUserUuid_4, userUuid_4); - assertThatPermTemplatesUsersUserUuidIsEqualTo(permTemplatesUserUuid_5, userUuid_1); - } - - private void assertThatPermTemplatesUsersUserUuidIsEqualTo(String permTemplatesUserUuid, String expectedUuid) { - assertThat(db.select(String.format("select user_uuid from perm_templates_users where uuid = '%s'", permTemplatesUserUuid)) - .stream() - .map(row -> row.get("USER_UUID")) - .findFirst()) - .hasValue(expectedUuid); - } - - private void insertPermTemplatesUser(String uuid, long userId) { - db.executeInsert("perm_templates_users", - "uuid", uuid, - "user_id", userId, - "template_id", userId + 100, - "permission_reference", Uuids.createFast()); - } - - private void insertUser(Long id, String uuid) { - db.executeInsert("users", - "id", id, - "uuid", uuid, - "login", "login" + id, - "external_login", "ex-login" + id, - "external_identity_provider", "ex-provider" + id, - "external_id", id + 1, - "is_root", false, - "onboarded", false); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/properties/AddUserUuidColumnToPropertiesUsersTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/properties/AddUserUuidColumnToPropertiesUsersTest.java deleted file mode 100644 index 02330be1f4d..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/properties/AddUserUuidColumnToPropertiesUsersTest.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.users.fk.properties; - -import java.sql.SQLException; -import java.sql.Types; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.core.util.Uuids; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.assertj.core.api.Assertions.assertThat; - -public class AddUserUuidColumnToPropertiesUsersTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(AddUserUuidColumnToPropertiesUsersTest.class, "schema.sql"); - - private DdlChange underTest = new AddUserUuidColumnToPropertiesUsers(db.database()); - - @Before - public void setup() { - insertProperty(Uuids.createFast()); - insertProperty(Uuids.createFast()); - insertProperty(Uuids.createFast()); - } - - @Test - public void add_uuid_column() throws SQLException { - underTest.execute(); - - db.assertColumnDefinition("properties", "user_uuid", Types.VARCHAR, 255, true); - - assertThat(db.countSql("select count(*) from properties")) - .isEqualTo(3); - } - - private void insertProperty(String uuid) { - db.executeInsert("properties", - "uuid", uuid, - "prop_key", "kee-" + uuid, - "is_empty", false, - "created_at", System.currentTimeMillis()); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/properties/DropUserIdColumnOfPropertiesTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/properties/DropUserIdColumnOfPropertiesTableTest.java deleted file mode 100644 index 01fc0f79fa8..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/properties/DropUserIdColumnOfPropertiesTableTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.users.fk.properties; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.assertj.core.api.Assertions.assertThatThrownBy; - -public class DropUserIdColumnOfPropertiesTableTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DropUserIdColumnOfPropertiesTableTest.class, "schema.sql"); - - private DdlChange underTest = new DropUserIdColumnOfPropertiesTable(db.database()); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertColumnDoesNotExist("properties", "user_id"); - } - - @Test - public void migration_is_not_re_entrant() throws SQLException { - underTest.execute(); - - assertThatThrownBy(() -> underTest.execute()).isInstanceOf(IllegalStateException.class); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/properties/PopulatePropertiesUserUuidTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/properties/PopulatePropertiesUserUuidTest.java deleted file mode 100644 index 2550fec05ce..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/properties/PopulatePropertiesUserUuidTest.java +++ /dev/null @@ -1,182 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.users.fk.properties; - -import java.sql.SQLException; -import java.util.Objects; -import java.util.Optional; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.core.util.Uuids; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DataChange; - -import static org.assertj.core.api.Assertions.assertThat; - -public class PopulatePropertiesUserUuidTest { - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(PopulatePropertiesUserUuidTest.class, "schema.sql"); - - private DataChange underTest = new PopulatePropertiesUserUuid(db.database()); - - @Test - public void populate_uuids() throws SQLException { - long userId_1 = 1L; - String userUuid_1 = "uuid-1"; - insertUser(userId_1, userUuid_1); - - long userId_2 = 2L; - String userUuid_2 = "uuid-2"; - insertUser(userId_2, userUuid_2); - - long userId_3 = 3L; - String userUuid_3 = "uuid-3"; - insertUser(userId_3, userUuid_3); - - long userId_4 = 4L; - String userUuid_4 = "uuid-4"; - insertUser(userId_4, userUuid_4); - - String propertyUuid_1 = Uuids.createFast(); - insertProperty(propertyUuid_1, userId_1); - String propertyUuid_2 = Uuids.createFast(); - insertProperty(propertyUuid_2, userId_2); - String propertyUuid_3 = Uuids.createFast(); - insertProperty(propertyUuid_3, userId_3); - String propertyUuid_4 = Uuids.createFast(); - insertProperty(propertyUuid_4, userId_4); - String propertyUuid_5 = Uuids.createFast(); - insertProperty(propertyUuid_5, null); - - underTest.execute(); - - assertThatPropertyUserUuidIsEqualTo(propertyUuid_1, userUuid_1); - assertThatPropertyUserUuidIsEqualTo(propertyUuid_2, userUuid_2); - assertThatPropertyUserUuidIsEqualTo(propertyUuid_3, userUuid_3); - assertThatPropertyUserUuidIsEqualTo(propertyUuid_4, userUuid_4); - assertThatPropertyUserUuidIsEqualTo(propertyUuid_5, null); - } - - @Test - public void should_remove_property_for_non_existent_user() throws SQLException { - long userId_1 = 1L; - String userUuid_1 = "uuid-1"; - insertUser(userId_1, userUuid_1); - - long userId_2 = 2L; - - long userId_3 = 3L; - - String propertyUuid_1 = Uuids.createFast(); - insertProperty(propertyUuid_1, userId_1); - String propertyUuid_2 = Uuids.createFast(); - insertProperty(propertyUuid_2, userId_2); - String propertyUuid_3 = Uuids.createFast(); - insertProperty(propertyUuid_3, userId_3); - - underTest.execute(); - - assertThatPropertyUserUuidIsEqualTo(propertyUuid_1, userUuid_1); - assertPropertyIsRemoved(propertyUuid_2); - assertPropertyIsRemoved(propertyUuid_3); - } - - @Test - public void migration_is_reentrant() throws SQLException { - long userId_1 = 1L; - String userUuid_1 = "uuid-1"; - insertUser(userId_1, userUuid_1); - - long userId_2 = 2L; - String userUuid_2 = "uuid-2"; - insertUser(userId_2, userUuid_2); - - long userId_3 = 3L; - String userUuid_3 = "uuid-3"; - insertUser(userId_3, userUuid_3); - - long userId_4 = 4L; - String userUuid_4 = "uuid-4"; - insertUser(userId_4, userUuid_4); - - String propertyUuid_1 = Uuids.createFast(); - insertProperty(propertyUuid_1, userId_1); - String propertyUuid_2 = Uuids.createFast(); - insertProperty(propertyUuid_2, userId_2); - String propertyUuid_3 = Uuids.createFast(); - insertProperty(propertyUuid_3, userId_3); - - underTest.execute(); - - String propertyUuid_4 = Uuids.createFast(); - insertProperty(propertyUuid_4, userId_4); - String propertyUuid_5 = Uuids.createFast(); - insertProperty(propertyUuid_5, null); - - // re-entrant - underTest.execute(); - - assertThatPropertyUserUuidIsEqualTo(propertyUuid_1, userUuid_1); - assertThatPropertyUserUuidIsEqualTo(propertyUuid_2, userUuid_2); - assertThatPropertyUserUuidIsEqualTo(propertyUuid_3, userUuid_3); - assertThatPropertyUserUuidIsEqualTo(propertyUuid_4, userUuid_4); - assertThatPropertyUserUuidIsEqualTo(propertyUuid_5, null); - } - - private void assertThatPropertyUserUuidIsEqualTo(String propertyUuid, String expectedUuid) { - Optional optional = db.select(String.format("select user_uuid from properties where uuid = '%s'", propertyUuid)) - .stream() - .map(row -> row.get("USER_UUID")) - .filter(Objects::nonNull) - .findFirst(); - - if (expectedUuid != null) { - assertThat(optional).hasValue(expectedUuid); - } else { - assertThat(optional).isEmpty(); - } - - } - - private void assertPropertyIsRemoved(String propertyUuid){ - assertThat(db.select(String.format("select 1 from properties where uuid = '%s'", propertyUuid))).isEmpty(); - } - - private void insertProperty(String uuid, Long userId) { - db.executeInsert("properties", - "uuid", uuid, - "user_id", userId, - "prop_key", "kee-" + uuid, - "is_empty", false, - "created_at", System.currentTimeMillis()); - } - - private void insertUser(Long id, String uuid) { - db.executeInsert("users", - "id", id, - "uuid", uuid, - "login", "login" + id, - "external_login", "ex-login" + id, - "external_identity_provider", "ex-provider" + id, - "external_id", id + 1, - "is_root", false, - "onboarded", false); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/qprofileeditusers/AddUniqueIndexOnUserUuidAndQProfileUuidOfQProfileEditUsersTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/qprofileeditusers/AddUniqueIndexOnUserUuidAndQProfileUuidOfQProfileEditUsersTableTest.java deleted file mode 100644 index 34379d1fe31..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/qprofileeditusers/AddUniqueIndexOnUserUuidAndQProfileUuidOfQProfileEditUsersTableTest.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.users.fk.qprofileeditusers; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class AddUniqueIndexOnUserUuidAndQProfileUuidOfQProfileEditUsersTableTest { - - private static final String TABLE_NAME = "qprofile_edit_users"; - private static final String INDEX_NAME = "qprofile_edit_users_unique"; - - @Rule - public CoreDbTester dbTester = CoreDbTester.createForSchema(AddUniqueIndexOnUserUuidAndQProfileUuidOfQProfileEditUsersTableTest.class, "schema.sql"); - - DdlChange underTest = new AddUniqueIndexOnUserUuidAndQProfileUuidOfQProfileEditUsersTable(dbTester.database()); - - @Test - public void add_index() throws SQLException { - underTest.execute(); - dbTester.assertUniqueIndex(TABLE_NAME, INDEX_NAME, "user_uuid", "qprofile_uuid"); - } - - @Test - public void migration_is_reentrant() throws SQLException { - underTest.execute(); - dbTester.assertUniqueIndex(TABLE_NAME, INDEX_NAME, "user_uuid", "qprofile_uuid"); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/qprofileeditusers/AddUserUuidColumnToQProfileEditUsersTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/qprofileeditusers/AddUserUuidColumnToQProfileEditUsersTest.java deleted file mode 100644 index 9bd2ffcdc92..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/qprofileeditusers/AddUserUuidColumnToQProfileEditUsersTest.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.users.fk.qprofileeditusers; - -import java.sql.SQLException; -import java.sql.Types; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.core.util.Uuids; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.assertj.core.api.Assertions.assertThat; - -public class AddUserUuidColumnToQProfileEditUsersTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(AddUserUuidColumnToQProfileEditUsersTest.class, "schema.sql"); - - private DdlChange underTest = new AddUserUuidColumnToQProfileEditUsers(db.database()); - - @Before - public void setup() { - insertQProfileEditUser(Uuids.createFast(), 1L); - insertQProfileEditUser(Uuids.createFast(), 2L); - insertQProfileEditUser(Uuids.createFast(), 3L); - } - - @Test - public void add_uuid_column() throws SQLException { - underTest.execute(); - - db.assertColumnDefinition("qprofile_edit_users", "user_uuid", Types.VARCHAR, 255, true); - - assertThat(db.countSql("select count(*) from qprofile_edit_users")) - .isEqualTo(3); - } - - private void insertQProfileEditUser(String uuid, long userId) { - db.executeInsert("qprofile_edit_users", - "uuid", uuid, - "user_id", userId, - "qprofile_uuid", Uuids.createFast(), - "created_at", System.currentTimeMillis()); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/qprofileeditusers/DropUniqueIndexOnUserIdAndQProfileUuidOfQProfileEditUsersTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/qprofileeditusers/DropUniqueIndexOnUserIdAndQProfileUuidOfQProfileEditUsersTableTest.java deleted file mode 100644 index 12d46452375..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/qprofileeditusers/DropUniqueIndexOnUserIdAndQProfileUuidOfQProfileEditUsersTableTest.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.users.fk.qprofileeditusers; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class DropUniqueIndexOnUserIdAndQProfileUuidOfQProfileEditUsersTableTest { - - private static final String TABLE_NAME = "qprofile_edit_users"; - private static final String INDEX_NAME = "qprofile_edit_users_unique"; - - @Rule - public CoreDbTester dbTester = CoreDbTester.createForSchema(DropUniqueIndexOnUserIdAndQProfileUuidOfQProfileEditUsersTableTest.class, "schema.sql"); - - DdlChange underTest = new DropUniqueIndexOnUserIdAndQProfileUuidOfQProfileEditUsersTable(dbTester.database()); - - @Test - public void add_index() throws SQLException { - underTest.execute(); - dbTester.assertIndexDoesNotExist(TABLE_NAME, INDEX_NAME); - } - - @Test - public void migration_is_reentrant() throws SQLException { - underTest.execute(); - dbTester.assertIndexDoesNotExist(TABLE_NAME, INDEX_NAME); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/qprofileeditusers/DropUserIdColumnOfQProfileEditUsersTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/qprofileeditusers/DropUserIdColumnOfQProfileEditUsersTableTest.java deleted file mode 100644 index 59d0093a75b..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/qprofileeditusers/DropUserIdColumnOfQProfileEditUsersTableTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.users.fk.qprofileeditusers; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.assertj.core.api.Assertions.assertThatThrownBy; - -public class DropUserIdColumnOfQProfileEditUsersTableTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DropUserIdColumnOfQProfileEditUsersTableTest.class, "schema.sql"); - - private DdlChange underTest = new DropUserIdColumnOfQProfileEditUsersTable(db.database()); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertColumnDoesNotExist("qprofile_edit_users", "user_id"); - } - - @Test - public void migration_is_not_re_entrant() throws SQLException { - underTest.execute(); - - assertThatThrownBy(() -> underTest.execute()).isInstanceOf(IllegalStateException.class); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/qprofileeditusers/MakeQProfileEditUsersUserUuidColumnNotNullableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/qprofileeditusers/MakeQProfileEditUsersUserUuidColumnNotNullableTest.java deleted file mode 100644 index 0a92dd95c61..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/qprofileeditusers/MakeQProfileEditUsersUserUuidColumnNotNullableTest.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.users.fk.qprofileeditusers; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -import static java.sql.Types.VARCHAR; - -public class MakeQProfileEditUsersUserUuidColumnNotNullableTest { - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(MakeQProfileEditUsersUserUuidColumnNotNullableTest.class, "schema.sql"); - - private MigrationStep underTest = new MakeQProfileEditUsersUserUuidColumnNotNullable(db.database()); - - @Test - public void uuid_column_is_not_null() throws SQLException { - underTest.execute(); - - db.assertColumnDefinition("qprofile_edit_users", "user_uuid", VARCHAR, 255, false); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/qprofileeditusers/PopulateQProfileEditUsersUserUuidTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/qprofileeditusers/PopulateQProfileEditUsersUserUuidTest.java deleted file mode 100644 index 356c4a3c796..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/qprofileeditusers/PopulateQProfileEditUsersUserUuidTest.java +++ /dev/null @@ -1,150 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.users.fk.qprofileeditusers; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.core.util.Uuids; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DataChange; - -import static org.assertj.core.api.Assertions.assertThat; - -public class PopulateQProfileEditUsersUserUuidTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(PopulateQProfileEditUsersUserUuidTest.class, "schema.sql"); - - private DataChange underTest = new PopulateQProfileEditUsersUserUuid(db.database()); - - @Test - public void populate_uuids() throws SQLException { - long userId_1 = 1L; - String userUuid_1 = "uuid-1"; - insertUser(userId_1, userUuid_1); - - long userId_2 = 2L; - String userUuid_2 = "uuid-2"; - insertUser(userId_2, userUuid_2); - - long userId_3 = 3L; - String userUuid_3 = "uuid-3"; - insertUser(userId_3, userUuid_3); - - long userId_4 = 4L; - String userUuid_4 = "uuid-4"; - insertUser(userId_4, userUuid_4); - - String qprofileEditUserUuid_1 = Uuids.createFast(); - insertQProfileEditUser(qprofileEditUserUuid_1, userId_1); - String qprofileEditUserUuid_2 = Uuids.createFast(); - insertQProfileEditUser(qprofileEditUserUuid_2, userId_2); - String qprofileEditUserUuid_3 = Uuids.createFast(); - insertQProfileEditUser(qprofileEditUserUuid_3, userId_3); - String qprofileEditUserUuid_4 = Uuids.createFast(); - insertQProfileEditUser(qprofileEditUserUuid_4, userId_4); - String qprofileEditUserUuid_5 = Uuids.createFast(); - insertQProfileEditUser(qprofileEditUserUuid_5, userId_1); - - // orphan FK - String qprofileEditUserUuid_6 = Uuids.createFast(); - insertQProfileEditUser(qprofileEditUserUuid_6, 100L); - - underTest.execute(); - - assertThat(db.countRowsOfTable("qprofile_edit_users")).isEqualTo(5); - assertThatQProfileEditUserUserUuidIsEqualTo(qprofileEditUserUuid_1, userUuid_1); - assertThatQProfileEditUserUserUuidIsEqualTo(qprofileEditUserUuid_2, userUuid_2); - assertThatQProfileEditUserUserUuidIsEqualTo(qprofileEditUserUuid_3, userUuid_3); - assertThatQProfileEditUserUserUuidIsEqualTo(qprofileEditUserUuid_4, userUuid_4); - assertThatQProfileEditUserUserUuidIsEqualTo(qprofileEditUserUuid_5, userUuid_1); - } - - @Test - public void migration_is_reentrant() throws SQLException { - long userId_1 = 1L; - String userUuid_1 = "uuid-1"; - insertUser(userId_1, userUuid_1); - - long userId_2 = 2L; - String userUuid_2 = "uuid-2"; - insertUser(userId_2, userUuid_2); - - long userId_3 = 3L; - String userUuid_3 = "uuid-3"; - insertUser(userId_3, userUuid_3); - - long userId_4 = 4L; - String userUuid_4 = "uuid-4"; - insertUser(userId_4, userUuid_4); - - String qprofileEditUserUuid_1 = Uuids.createFast(); - insertQProfileEditUser(qprofileEditUserUuid_1, userId_1); - String qprofileEditUserUuid_2 = Uuids.createFast(); - insertQProfileEditUser(qprofileEditUserUuid_2, userId_2); - String qprofileEditUserUuid_3 = Uuids.createFast(); - insertQProfileEditUser(qprofileEditUserUuid_3, userId_3); - - underTest.execute(); - - String qprofileEditUserUuid_4 = Uuids.createFast(); - insertQProfileEditUser(qprofileEditUserUuid_4, userId_4); - String qprofileEditUserUuid_5 = Uuids.createFast(); - insertQProfileEditUser(qprofileEditUserUuid_5, userId_1); - - // re-entrant - underTest.execute(); - - assertThatQProfileEditUserUserUuidIsEqualTo(qprofileEditUserUuid_1, userUuid_1); - assertThatQProfileEditUserUserUuidIsEqualTo(qprofileEditUserUuid_2, userUuid_2); - assertThatQProfileEditUserUserUuidIsEqualTo(qprofileEditUserUuid_3, userUuid_3); - assertThatQProfileEditUserUserUuidIsEqualTo(qprofileEditUserUuid_4, userUuid_4); - assertThatQProfileEditUserUserUuidIsEqualTo(qprofileEditUserUuid_5, userUuid_1); - } - - private void assertThatQProfileEditUserUserUuidIsEqualTo(String qprofileEditUserUuid, String expectedUuid) { - assertThat(db.select(String.format("select user_uuid from qprofile_edit_users where uuid = '%s'", qprofileEditUserUuid)) - .stream() - .map(row -> row.get("USER_UUID")) - .findFirst()) - .hasValue(expectedUuid); - } - - private void insertQProfileEditUser(String uuid, long userId) { - db.executeInsert("qprofile_edit_users", - "uuid", uuid, - "user_id", userId, - "qprofile_uuid", Uuids.createFast(), - "created_at", System.currentTimeMillis()); - } - - private void insertUser(Long id, String uuid) { - db.executeInsert("users", - "id", id, - "uuid", uuid, - "login", "login" + id, - "external_login", "ex-login" + id, - "external_identity_provider", "ex-provider" + id, - "external_id", id + 1, - "is_root", false, - "onboarded", false); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/userroles/AddIndexOnUserUuidOfUserRolesTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/userroles/AddIndexOnUserUuidOfUserRolesTableTest.java deleted file mode 100644 index cada9f51134..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/userroles/AddIndexOnUserUuidOfUserRolesTableTest.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.users.fk.userroles; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class AddIndexOnUserUuidOfUserRolesTableTest { - - private static final String TABLE_NAME = "user_roles"; - private static final String INDEX_NAME = "user_roles_user"; - - @Rule - public CoreDbTester dbTester = CoreDbTester.createForSchema(AddIndexOnUserUuidOfUserRolesTableTest.class, "schema.sql"); - - DdlChange underTest = new AddIndexOnUserUuidOfUserRolesTable(dbTester.database()); - - @Test - public void add_index() throws SQLException { - underTest.execute(); - dbTester.assertIndex(TABLE_NAME, INDEX_NAME, "user_uuid"); - } - - @Test - public void migration_is_reentrant() throws SQLException { - underTest.execute(); - dbTester.assertIndex(TABLE_NAME, INDEX_NAME, "user_uuid"); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/userroles/AddUserUuidColumnToUserRolesTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/userroles/AddUserUuidColumnToUserRolesTest.java deleted file mode 100644 index a8dc62b9c93..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/userroles/AddUserUuidColumnToUserRolesTest.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.users.fk.userroles; - -import java.sql.SQLException; -import java.sql.Types; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.core.util.Uuids; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.assertj.core.api.Assertions.assertThat; - -public class AddUserUuidColumnToUserRolesTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(AddUserUuidColumnToUserRolesTest.class, "schema.sql"); - - private DdlChange underTest = new AddUserUuidColumnToUserRoles(db.database()); - - @Before - public void setup() { - insertUserRole(Uuids.createFast(), 1L); - insertUserRole(Uuids.createFast(), 2L); - insertUserRole(Uuids.createFast(), 3L); - } - - @Test - public void add_uuid_column() throws SQLException { - underTest.execute(); - - db.assertColumnDefinition("user_roles", "user_uuid", Types.VARCHAR, 255, true); - - assertThat(db.countSql("select count(*) from user_roles")) - .isEqualTo(3); - } - - private void insertUserRole(String uuid, Long userId) { - db.executeInsert("user_roles", - "uuid", uuid, - "organization_uuid", Uuids.createFast(), - "user_id", userId, - "role", Uuids.createFast()); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/userroles/DropIndexOnUserIdOfUserRolesTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/userroles/DropIndexOnUserIdOfUserRolesTableTest.java deleted file mode 100644 index f1f9c717e02..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/userroles/DropIndexOnUserIdOfUserRolesTableTest.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.users.fk.userroles; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class DropIndexOnUserIdOfUserRolesTableTest { - - private static final String TABLE_NAME = "user_roles"; - private static final String INDEX_NAME = "user_roles_user"; - - @Rule - public CoreDbTester dbTester = CoreDbTester.createForSchema(DropIndexOnUserIdOfUserRolesTableTest.class, "schema.sql"); - - DdlChange underTest = new DropIndexOnUserIdOfUserRolesTable(dbTester.database()); - - @Test - public void add_index() throws SQLException { - underTest.execute(); - dbTester.assertIndexDoesNotExist(TABLE_NAME, INDEX_NAME); - } - - @Test - public void migration_is_reentrant() throws SQLException { - underTest.execute(); - // re-entrant - underTest.execute(); - dbTester.assertIndexDoesNotExist(TABLE_NAME, INDEX_NAME); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/userroles/DropUserIdColumnOfUserRolesTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/userroles/DropUserIdColumnOfUserRolesTableTest.java deleted file mode 100644 index 95e2ab7f910..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/userroles/DropUserIdColumnOfUserRolesTableTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.users.fk.userroles; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.assertj.core.api.Assertions.assertThatThrownBy; - -public class DropUserIdColumnOfUserRolesTableTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DropUserIdColumnOfUserRolesTableTest.class, "schema.sql"); - - private DdlChange underTest = new DropUserIdColumnOfUserRolesTable(db.database()); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertColumnDoesNotExist("user_roles", "user_id"); - } - - @Test - public void migration_is_not_re_entrant() throws SQLException { - underTest.execute(); - - assertThatThrownBy(() -> underTest.execute()).isInstanceOf(IllegalStateException.class); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/userroles/PopulateUserRolesUserUuidTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/userroles/PopulateUserRolesUserUuidTest.java deleted file mode 100644 index cbbb4107c9d..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/users/fk/userroles/PopulateUserRolesUserUuidTest.java +++ /dev/null @@ -1,145 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.users.fk.userroles; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.core.util.Uuids; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DataChange; - -import static org.assertj.core.api.Assertions.assertThat; - -public class PopulateUserRolesUserUuidTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(PopulateUserRolesUserUuidTest.class, "schema.sql"); - - private DataChange underTest = new PopulateUserRolesUserUuid(db.database()); - - @Test - public void populate_uuids() throws SQLException { - long userId_1 = 1L; - String userUuid_1 = "uuid-1"; - insertUser(userId_1, userUuid_1); - - long userId_2 = 2L; - String userUuid_2 = "uuid-2"; - insertUser(userId_2, userUuid_2); - - long userId_3 = 3L; - String userUuid_3 = "uuid-3"; - insertUser(userId_3, userUuid_3); - - long userId_4 = 4L; - String userUuid_4 = "uuid-4"; - insertUser(userId_4, userUuid_4); - - String userRoleUuid_1 = Uuids.createFast(); - insertUserRole(userRoleUuid_1, userId_1); - String userRoleUuid_2 = Uuids.createFast(); - insertUserRole(userRoleUuid_2, userId_2); - String userRoleUuid_3 = Uuids.createFast(); - insertUserRole(userRoleUuid_3, userId_3); - String userRoleUuid_4 = Uuids.createFast(); - insertUserRole(userRoleUuid_4, userId_4); - String userRoleUuid_5 = Uuids.createFast(); - insertUserRole(userRoleUuid_5, userId_1); - - underTest.execute(); - - assertThatUserRoleUserUuidIsEqualTo(userRoleUuid_1, userUuid_1); - assertThatUserRoleUserUuidIsEqualTo(userRoleUuid_2, userUuid_2); - assertThatUserRoleUserUuidIsEqualTo(userRoleUuid_3, userUuid_3); - assertThatUserRoleUserUuidIsEqualTo(userRoleUuid_4, userUuid_4); - assertThatUserRoleUserUuidIsEqualTo(userRoleUuid_5, userUuid_1); - } - - @Test - public void migration_is_reentrant() throws SQLException { - long userId_1 = 1L; - String userUuid_1 = "uuid-1"; - insertUser(userId_1, userUuid_1); - - long userId_2 = 2L; - String userUuid_2 = "uuid-2"; - insertUser(userId_2, userUuid_2); - - long userId_3 = 3L; - String userUuid_3 = "uuid-3"; - insertUser(userId_3, userUuid_3); - - long userId_4 = 4L; - String userUuid_4 = "uuid-4"; - insertUser(userId_4, userUuid_4); - - String userRoleUuid_1 = Uuids.createFast(); - insertUserRole(userRoleUuid_1, userId_1); - String userRoleUuid_2 = Uuids.createFast(); - insertUserRole(userRoleUuid_2, userId_2); - String userRoleUuid_3 = Uuids.createFast(); - insertUserRole(userRoleUuid_3, userId_3); - - underTest.execute(); - - String userRoleUuid_4 = Uuids.createFast(); - insertUserRole(userRoleUuid_4, userId_4); - String userRoleUuid_5 = Uuids.createFast(); - insertUserRole(userRoleUuid_5, userId_1); - - // re-entrant - underTest.execute(); - - assertThatUserRoleUserUuidIsEqualTo(userRoleUuid_1, userUuid_1); - assertThatUserRoleUserUuidIsEqualTo(userRoleUuid_2, userUuid_2); - assertThatUserRoleUserUuidIsEqualTo(userRoleUuid_3, userUuid_3); - assertThatUserRoleUserUuidIsEqualTo(userRoleUuid_4, userUuid_4); - assertThatUserRoleUserUuidIsEqualTo(userRoleUuid_5, userUuid_1); - } - - private void assertThatUserRoleUserUuidIsEqualTo(String userRoleUuid, String expectedUuid) { - assertThat(db.select(String.format("select user_uuid from user_roles where uuid = '%s'", userRoleUuid)) - .stream() - .map(row -> row.get("USER_UUID")) - .findFirst()) - .hasValue(expectedUuid); - } - - private void insertUserRole(String uuid, Long userId) { - db.executeInsert("user_roles", - "uuid", uuid, - "organization_uuid", Uuids.createFast(), - "user_id", userId, - "role", Uuids.createFast()); - } - - private void insertUser(Long id, String uuid) { - db.executeInsert("users", - "id", id, - "uuid", uuid, - "login", "login" + id, - "external_login", "ex-login" + id, - "external_identity_provider", "ex-provider" + id, - "external_id", id + 1, - "is_root", false, - "onboarded", false); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/usertokens/AddPrimaryKeyOnUuidColumnOfUserTokensTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/usertokens/AddPrimaryKeyOnUuidColumnOfUserTokensTableTest.java deleted file mode 100644 index 6812e5d9d91..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/usertokens/AddPrimaryKeyOnUuidColumnOfUserTokensTableTest.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.usertokens; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -import static org.assertj.core.api.Assertions.assertThatThrownBy; - -public class AddPrimaryKeyOnUuidColumnOfUserTokensTableTest { - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(AddPrimaryKeyOnUuidColumnOfUserTokensTableTest.class, "schema.sql"); - - private MigrationStep underTest = new AddPrimaryKeyOnUuidColumnOfUserTokensTable(db.database()); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertPrimaryKey("user_tokens", "pk_user_tokens", "uuid"); - } - - @Test - public void migration_is_not_re_entrant() throws SQLException { - underTest.execute(); - - assertThatThrownBy(() -> underTest.execute()).isInstanceOf(IllegalStateException.class); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/usertokens/AddUuidColumnToUserTokensTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/usertokens/AddUuidColumnToUserTokensTest.java deleted file mode 100644 index f68e164a1b8..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/usertokens/AddUuidColumnToUserTokensTest.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.usertokens; - -import java.sql.SQLException; -import java.sql.Types; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.assertj.core.api.Assertions.assertThat; - -public class AddUuidColumnToUserTokensTest { - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(AddUuidColumnToUserTokensTest.class, "schema.sql"); - - private DdlChange underTest = new AddUuidColumnToUserTokens(db.database()); - - @Before - public void setup() { - insertUserToken(1L, "user1", "name1", "token1"); - insertUserToken(2L, "user2", "name2", "token2"); - insertUserToken(3L, "user3", "name3", "token3"); - } - - @Test - public void add_uuid_column_to_user_tokens() throws SQLException { - underTest.execute(); - - db.assertColumnDefinition("user_tokens", "uuid", Types.VARCHAR, 40, true); - - assertThat(db.countSql("select count(id) from user_tokens")) - .isEqualTo(3); - } - - private void insertUserToken(Long id, String userUuid, String name, String tokenHash) { - db.executeInsert("user_tokens", - "id", id, - "USER_UUID", userUuid, - "NAME", name, - "TOKEN_HASH", tokenHash, - "CREATED_AT", 0L); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/usertokens/DropIdColumnOfUserTokensTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/usertokens/DropIdColumnOfUserTokensTableTest.java deleted file mode 100644 index 88f3dfa305f..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/usertokens/DropIdColumnOfUserTokensTableTest.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.usertokens; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -import static org.assertj.core.api.Assertions.assertThatThrownBy; - -public class DropIdColumnOfUserTokensTableTest { - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DropIdColumnOfUserTokensTableTest.class, "schema.sql"); - - private MigrationStep underTest = new DropIdColumnOfUserTokensTable(db.database()); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertColumnDoesNotExist("user_tokens", "id"); - } - - @Test - public void migration_is_not_re_entrant() throws SQLException { - underTest.execute(); - - assertThatThrownBy(() -> underTest.execute()).isInstanceOf(IllegalStateException.class); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/usertokens/DropPrimaryKeyOnIdColumnOfUserTokensTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/usertokens/DropPrimaryKeyOnIdColumnOfUserTokensTableTest.java deleted file mode 100644 index 48b4fd82831..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/usertokens/DropPrimaryKeyOnIdColumnOfUserTokensTableTest.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.usertokens; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.sql.DbPrimaryKeyConstraintFinder; -import org.sonar.server.platform.db.migration.sql.DropPrimaryKeySqlGenerator; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -public class DropPrimaryKeyOnIdColumnOfUserTokensTableTest { - - private static final String TABLE_NAME = "user_tokens"; - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DropPrimaryKeyOnIdColumnOfUserTokensTableTest.class, "schema.sql"); - - private final DropPrimaryKeySqlGenerator dropPrimaryKeySqlGenerator = new DropPrimaryKeySqlGenerator(db.database(), new DbPrimaryKeyConstraintFinder(db.database())); - - private final MigrationStep underTest = new DropPrimaryKeyOnIdColumnOfUserTokensTable(db.database(), dropPrimaryKeySqlGenerator); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertNoPrimaryKey(TABLE_NAME); - } - - @Test - public void migration_is_re_entrant_but_fails_silently() throws SQLException { - underTest.execute(); - underTest.execute(); - - db.assertNoPrimaryKey(TABLE_NAME); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/usertokens/MakeUserTokensUuidNotNullableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/usertokens/MakeUserTokensUuidNotNullableTest.java deleted file mode 100644 index ed7d21671a5..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/usertokens/MakeUserTokensUuidNotNullableTest.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.usertokens; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -import static java.sql.Types.VARCHAR; - -public class MakeUserTokensUuidNotNullableTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(MakeUserTokensUuidNotNullableTest.class, "schema.sql"); - - private MigrationStep underTest = new MakeUserTokensUuidNotNullable(db.database()); - - @Test - public void created_at_and_uuid_columns_are_not_null() throws SQLException { - underTest.execute(); - - db.assertColumnDefinition("user_tokens", "uuid", VARCHAR, null, false); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/usertokens/PopulateUserTokensUuidTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/usertokens/PopulateUserTokensUuidTest.java deleted file mode 100644 index 307ae8e6ffc..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/usertokens/PopulateUserTokensUuidTest.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v84.usertokens; - -import java.sql.SQLException; -import java.util.List; -import java.util.Objects; -import java.util.stream.Collectors; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.core.util.UuidFactory; -import org.sonar.core.util.UuidFactoryFast; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DataChange; - -import static org.assertj.core.api.Assertions.assertThat; - -public class PopulateUserTokensUuidTest { - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(PopulateUserTokensUuidTest.class, "schema.sql"); - - private UuidFactory uuidFactory = UuidFactoryFast.getInstance(); - private DataChange underTest = new PopulateUserTokensUuid(db.database(), uuidFactory); - - @Test - public void populate_uuids() throws SQLException { - insertUserToken(1L, "user1", "name1", "token1"); - insertUserToken(2L, "user2", "name2", "token2"); - insertUserToken(3L, "user3", "name3", "token3"); - - underTest.execute(); - - verifyUuidsAreNotNull(); - } - - @Test - public void migration_is_reentrant() throws SQLException { - insertUserToken(1L, "user1", "name1", "token1"); - insertUserToken(2L, "user2", "name2", "token2"); - insertUserToken(3L, "user3", "name3", "token3"); - - underTest.execute(); - verifyUuidsAreNotNull(); - insertUserToken(4L, "user4", "name4", "token4"); - insertUserToken(5L, "user5", "name5", "token5"); - - List uuids = db.select("select uuid from user_tokens where id = 1 or id = 2 or id = 3") - .stream() - .map(row -> (String) row.get("UUID")) - .collect(Collectors.toList()); - - // re-entrant - underTest.execute(); - verifyUuidsAreNotNull(); - - // verify that uuid set during the first migration have not been updated during the second migration - assertThat(db.select("select uuid from user_tokens") - .stream() - .map(row -> (String) row.get("UUID")) - .collect(Collectors.toList())) - .containsAll(uuids); - } - - private void verifyUuidsAreNotNull() { - assertThat(db.select("select uuid from user_tokens") - .stream() - .map(row -> row.get("UUID")) - .filter(Objects::isNull) - .collect(Collectors.toList())).isEmpty(); - } - - private void insertUserToken(Long id, String userUuid, String name, String tokenHash) { - db.executeInsert("user_tokens", - "id", id, - "USER_UUID", userUuid, - "NAME", name, - "TOKEN_HASH", tokenHash, - "CREATED_AT", 0L); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v85/AddIndexOnIssueKeyForIssueChangesTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v85/AddIndexOnIssueKeyForIssueChangesTableTest.java deleted file mode 100644 index 7337bb06dd6..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v85/AddIndexOnIssueKeyForIssueChangesTableTest.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v85; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class AddIndexOnIssueKeyForIssueChangesTableTest { - private static final String TABLE_NAME = "issue_changes"; - private static final String INDEX_NAME = "issue_changes_issue_key"; - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(AddIndexOnIssueKeyForIssueChangesTableTest.class, "schema.sql"); - - DdlChange underTest = new AddIndexOnIssueKeyForIssueChangesTable(db.database()); - - @Test - public void add_index() throws SQLException { - underTest.execute(); - db.assertIndex(TABLE_NAME, INDEX_NAME, "issue_key"); - } - - @Test - public void migration_is_reentrant() throws SQLException { - underTest.execute(); - underTest.execute(); - db.assertIndex(TABLE_NAME, INDEX_NAME, "issue_key"); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v85/AddIndexOnKeeForIssueChangesTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v85/AddIndexOnKeeForIssueChangesTableTest.java deleted file mode 100644 index f4ebe62acbe..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v85/AddIndexOnKeeForIssueChangesTableTest.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v85; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class AddIndexOnKeeForIssueChangesTableTest { - private static final String TABLE_NAME = "issue_changes"; - private static final String INDEX_NAME = "issue_changes_kee"; - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(AddIndexOnKeeForIssueChangesTableTest.class, "schema.sql"); - - DdlChange underTest = new AddIndexOnKeeForIssueChangesTable(db.database()); - - @Test - public void add_index() throws SQLException { - underTest.execute(); - db.assertIndex(TABLE_NAME, INDEX_NAME, "kee"); - } - - @Test - public void migration_is_reentrant() throws SQLException { - underTest.execute(); - underTest.execute(); - db.assertIndex(TABLE_NAME, INDEX_NAME, "kee"); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v85/AddIndexOnMessageTypeColumnOfCeTaskMessageTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v85/AddIndexOnMessageTypeColumnOfCeTaskMessageTableTest.java deleted file mode 100644 index 37d6f8d4e7d..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v85/AddIndexOnMessageTypeColumnOfCeTaskMessageTableTest.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v85; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class AddIndexOnMessageTypeColumnOfCeTaskMessageTableTest { - private static final String TABLE_NAME = "ce_task_message"; - private static final String INDEX_NAME = "ctm_message_type"; - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(AddIndexOnMessageTypeColumnOfCeTaskMessageTableTest.class, "schema.sql"); - - DdlChange underTest = new AddIndexOnMessageTypeColumnOfCeTaskMessageTable(db.database()); - - @Test - public void add_index() throws SQLException { - underTest.execute(); - - db.assertIndex(TABLE_NAME, INDEX_NAME, "message_type"); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v85/AddIndexOnProjectUuidOnIssueChangesTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v85/AddIndexOnProjectUuidOnIssueChangesTableTest.java deleted file mode 100644 index e47019251dc..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v85/AddIndexOnProjectUuidOnIssueChangesTableTest.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v85; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class AddIndexOnProjectUuidOnIssueChangesTableTest { - private static final String TABLE_NAME = "issue_changes"; - private static final String INDEX_NAME = "issue_changes_project_uuid"; - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(AddIndexOnProjectUuidOnIssueChangesTableTest.class, "schema.sql"); - - DdlChange underTest = new AddIndexOnProjectUuidOnIssueChangesTable(db.database()); - - @Test - public void add_index() throws SQLException { - underTest.execute(); - db.assertIndex(TABLE_NAME, INDEX_NAME, "project_uuid"); - } - - @Test - public void migration_is_reentrant() throws SQLException { - underTest.execute(); - underTest.execute(); - db.assertIndex(TABLE_NAME, INDEX_NAME, "project_uuid"); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v85/AddMessageTypeColumnToCeTaskMessageTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v85/AddMessageTypeColumnToCeTaskMessageTableTest.java deleted file mode 100644 index 1acbee3422c..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v85/AddMessageTypeColumnToCeTaskMessageTableTest.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v85; - -import java.sql.SQLException; -import java.sql.Types; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.api.utils.System2; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.assertj.core.api.Assertions.assertThat; - -public class AddMessageTypeColumnToCeTaskMessageTableTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(AddMessageTypeColumnToCeTaskMessageTableTest.class, "schema.sql"); - - private final DdlChange underTest = new AddMessageTypeColumnToCeTaskMessageTable(db.database()); - - @Before - public void setup() { - insertTaskMessage(1L, "a1"); - insertTaskMessage(2L, "a2"); - insertTaskMessage(3L, "a3"); - } - - @Test - public void add_message_type_column_to_ce_task_message_table() throws SQLException { - underTest.execute(); - - db.assertColumnDefinition("ce_task_message", "message_type", Types.VARCHAR, 255, true); - - assertThat(db.countSql("select count(uuid) from ce_task_message")).isEqualTo(3); - } - - private void insertTaskMessage(Long id, String message) { - db.executeInsert("ce_task_message", - "uuid", "uuid-" + id, - "task_uuid", "task-uuid-" + id, - "message", message, - "created_at", System2.INSTANCE.now()); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v85/AddPrimaryKeyOnUuidForIssueChangesTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v85/AddPrimaryKeyOnUuidForIssueChangesTableTest.java deleted file mode 100644 index 25f8681a9ab..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v85/AddPrimaryKeyOnUuidForIssueChangesTableTest.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v85; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -import static org.assertj.core.api.Assertions.assertThatThrownBy; - -public class AddPrimaryKeyOnUuidForIssueChangesTableTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(AddPrimaryKeyOnUuidForIssueChangesTableTest.class, "schema.sql"); - - private MigrationStep underTest = new AddPrimaryKeyOnUuidForIssueChangesTable(db.database()); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertPrimaryKey("issue_changes", "pk_issue_changes", "uuid"); - } - - @Test - public void skip_if_project_uuid_index_exists() throws SQLException { - db.executeDdl("create index issue_changes_project_uuid on issue_changes ( issue_key)"); - - underTest.execute(); - - db.assertNoPrimaryKey("issue_changes"); - } - - @Test - public void migration_is_not_re_entrant() throws SQLException { - underTest.execute(); - - assertThatThrownBy(() -> underTest.execute()).isInstanceOf(IllegalStateException.class); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v85/AddTypeToPluginsTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v85/AddTypeToPluginsTest.java deleted file mode 100644 index 2df093b2660..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v85/AddTypeToPluginsTest.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v85; - -import java.sql.SQLException; -import java.sql.Types; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -import static org.assertj.core.api.Assertions.assertThat; - -public class AddTypeToPluginsTest { - private static final String TABLE_NAME = "plugins"; - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(AddTypeToPluginsTest.class, "schema.sql"); - - private MigrationStep underTest = new AddTypeToPlugins(db.database()); - - @Test - public void add_column() throws SQLException { - addPlugin("1"); - addPlugin("2"); - underTest.execute(); - db.assertColumnDefinition(TABLE_NAME, "type", Types.VARCHAR, 10, true); - assertThat(db.countRowsOfTable(TABLE_NAME)).isEqualTo(2); - } - - private void addPlugin(String id) { - db.executeInsert(TABLE_NAME, - "uuid", "uuid" + id, - "kee", "kee" + id, - "base_plugin_key", "base" + id, - "file_hash", "hash" + id, - "created_at", 1L, - "updated_at", 2L); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v85/AlterTypeInPluginNotNullableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v85/AlterTypeInPluginNotNullableTest.java deleted file mode 100644 index 9c4ea9061da..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v85/AlterTypeInPluginNotNullableTest.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v85; - -import java.sql.SQLException; -import java.sql.Types; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -import static org.assertj.core.api.Assertions.assertThat; - -public class AlterTypeInPluginNotNullableTest { - private static final String TABLE_NAME = "plugins"; - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(AlterTypeInPluginNotNullableTest.class, "schema.sql"); - - private MigrationStep underTest = new AlterTypeInPluginNotNullable(db.database()); - - @Test - public void add_column() throws SQLException { - addPlugin("1"); - addPlugin("2"); - underTest.execute(); - db.assertColumnDefinition(TABLE_NAME, "type", Types.VARCHAR, 10, false); - assertThat(db.countRowsOfTable(TABLE_NAME)).isEqualTo(2); - } - - private void addPlugin(String id) { - db.executeInsert(TABLE_NAME, - "uuid", "uuid" + id, - "kee", "kee" + id, - "base_plugin_key", "base" + id, - "file_hash", "hash" + id, - "type", "BUNDLED", - "created_at", 1L, - "updated_at", 2L); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v85/CreateTmpIssueChangesTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v85/CreateTmpIssueChangesTableTest.java deleted file mode 100644 index 96267985c85..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v85/CreateTmpIssueChangesTableTest.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v85; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; -import org.sonar.db.CoreDbTester; - -import static java.sql.Types.BIGINT; -import static java.sql.Types.CLOB; -import static java.sql.Types.VARCHAR; - -public class CreateTmpIssueChangesTableTest { - - private static final String TABLE_NAME = "tmp_issue_changes"; - - @Rule - public CoreDbTester dbTester = CoreDbTester.createForSchema(CreateTmpIssueChangesTableTest.class, "schema.sql"); - - @Rule - public ExpectedException expectedException = ExpectedException.none(); - - private CreateTmpIssueChangesTable underTest = new CreateTmpIssueChangesTable(dbTester.database()); - - @Test - public void skip_if_project_uuid_column_exists() throws SQLException { - dbTester.executeDdl("ALTER TABLE issue_changes ADD project_uuid VARCHAR"); - - underTest.execute(); - dbTester.assertTableDoesNotExist(TABLE_NAME); - } - - @Test - public void table_has_been_created() throws SQLException { - underTest.execute(); - - dbTester.assertTableExists(TABLE_NAME); - dbTester.assertColumnDefinition(TABLE_NAME, "uuid", VARCHAR, 40, true); - dbTester.assertColumnDefinition(TABLE_NAME, "kee", VARCHAR, 50, true); - dbTester.assertColumnDefinition(TABLE_NAME, "issue_key", VARCHAR, 50, true); - dbTester.assertColumnDefinition(TABLE_NAME, "user_login", VARCHAR, 255, true); - dbTester.assertColumnDefinition(TABLE_NAME, "change_type", VARCHAR, 20, true); - dbTester.assertColumnDefinition(TABLE_NAME, "change_data", CLOB, null, true); - dbTester.assertColumnDefinition(TABLE_NAME, "created_at", BIGINT, null, true); - dbTester.assertColumnDefinition(TABLE_NAME, "updated_at", BIGINT, null, true); - dbTester.assertColumnDefinition(TABLE_NAME, "issue_change_creation_date", BIGINT, null, true); - dbTester.assertColumnDefinition(TABLE_NAME, "project_uuid", VARCHAR, 50, true); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v85/CreateUserDismissedMessagesTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v85/CreateUserDismissedMessagesTableTest.java deleted file mode 100644 index 7c2608e1bee..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v85/CreateUserDismissedMessagesTableTest.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v85; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; - -import static java.sql.Types.BIGINT; -import static java.sql.Types.VARCHAR; - -public class CreateUserDismissedMessagesTableTest { - private static final String TABLE_NAME = "user_dismissed_messages"; - - @Rule - public CoreDbTester dbTester = CoreDbTester.createEmpty(); - - private final CreateUserDismissedMessagesTable underTest = new CreateUserDismissedMessagesTable(dbTester.database()); - - @Test - public void table_has_been_created() throws SQLException { - underTest.execute(); - - dbTester.assertTableExists(TABLE_NAME); - dbTester.assertPrimaryKey(TABLE_NAME, "pk_user_dismissed_messages", "uuid"); - dbTester.assertColumnDefinition(TABLE_NAME, "uuid", VARCHAR, 40, false); - dbTester.assertColumnDefinition(TABLE_NAME, "user_uuid", VARCHAR, 255, false); - dbTester.assertColumnDefinition(TABLE_NAME, "project_uuid", VARCHAR, 40, false); - dbTester.assertColumnDefinition(TABLE_NAME, "message_type", VARCHAR, 255, false); - dbTester.assertColumnDefinition(TABLE_NAME, "created_at", BIGINT, null, false); - dbTester.assertUniqueIndex(TABLE_NAME, "uniq_user_dismissed_messages", "user_uuid", - "project_uuid", "message_type"); - dbTester.assertIndex(TABLE_NAME, "udm_project_uuid", "project_uuid"); - dbTester.assertIndex(TABLE_NAME, "udm_message_type", "message_type"); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v85/DbVersion85Test.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v85/DbVersion85Test.java deleted file mode 100644 index 54a106d30c8..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v85/DbVersion85Test.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v85; - -import org.junit.Test; -import org.sonar.server.platform.db.migration.version.DbVersion; - -import static org.sonar.server.platform.db.migration.version.DbVersionTestUtils.verifyMigrationNotEmpty; -import static org.sonar.server.platform.db.migration.version.DbVersionTestUtils.verifyMinimumMigrationNumber; - -public class DbVersion85Test { - - private DbVersion underTest = new DbVersion85(); - - @Test - public void migrationNumber_starts_at_4000() { - verifyMinimumMigrationNumber(underTest, 4000); - } - - @Test - public void verify_migration_count() { - verifyMigrationNotEmpty(underTest); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v85/DeleteProjectAlmSettingsOrphansTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v85/DeleteProjectAlmSettingsOrphansTest.java deleted file mode 100644 index 18d6b32a722..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v85/DeleteProjectAlmSettingsOrphansTest.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v85; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.api.utils.System2; -import org.sonar.core.util.Uuids; -import org.sonar.db.CoreDbTester; - -import static org.assertj.core.api.Assertions.assertThat; - -public class DeleteProjectAlmSettingsOrphansTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DeleteProjectAlmSettingsOrphansTest.class, "schema.sql"); - - private DeleteProjectAlmSettingsOrphans underTest = new DeleteProjectAlmSettingsOrphans(db.database()); - - @Test - public void execute_migration() throws SQLException { - String projectUuid1 = insertProject(); - String projectAlmSetting1 = insertProjectAlmSetting(projectUuid1); - String projectUuid2 = insertProject(); - String projectAlmSetting2 = insertProjectAlmSetting(projectUuid2); - String projectUuid3 = insertProject(); - String projectAlmSetting3 = insertProjectAlmSetting(projectUuid3); - - // create orphans - insertProjectAlmSetting(); - insertProjectAlmSetting(); - insertProjectAlmSetting(); - insertProjectAlmSetting(); - - underTest.execute(); - - assertProjectAlmSettingsRowsExist(projectAlmSetting1, projectAlmSetting2, projectAlmSetting3); - } - - private void assertProjectAlmSettingsRowsExist(String... projectAlmSettings) { - assertThat(db.select("select uuid from project_alm_settings") - .stream() - .map(rows -> rows.get("UUID"))).containsOnly(projectAlmSettings); - } - - @Test - public void migration_should_be_reentrant() throws SQLException { - String projectUuid = insertProject(); - String projectAlmSetting = insertProjectAlmSetting(projectUuid); - // create orphans - insertProjectAlmSetting(); - insertProjectAlmSetting(); - insertProjectAlmSetting(); - insertProjectAlmSetting(); - - underTest.execute(); - // should be re-entrant - underTest.execute(); - - assertProjectAlmSettingsRowsExist(projectAlmSetting); - } - - private String insertProjectAlmSetting(String projectUuid) { - String uuid = Uuids.createFast(); - db.executeInsert("PROJECT_ALM_SETTINGS", - "UUID", uuid, - "ALM_SETTING_UUID", uuid + "-name", - "PROJECT_UUID", projectUuid, - "UPDATED_AT", System2.INSTANCE.now(), - "CREATED_AT", System2.INSTANCE.now()); - return uuid; - } - - private String insertProjectAlmSetting() { - String notExistingProjectUuid = Uuids.createFast(); - return insertProjectAlmSetting(notExistingProjectUuid); - } - - private String insertProject() { - String uuid = Uuids.createFast(); - db.executeInsert("PROJECTS", - "UUID", uuid, - "KEE", uuid + "-key", - "QUALIFIER", "TRK", - "ORGANIZATION_UUID", uuid + "-key", - "PRIVATE", Boolean.toString(false), - "UPDATED_AT", System.currentTimeMillis()); - return uuid; - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v85/DropIssueChangesTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v85/DropIssueChangesTableTest.java deleted file mode 100644 index 73ad5876042..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v85/DropIssueChangesTableTest.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v85; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -public class DropIssueChangesTableTest { - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DropIssueChangesTableTest.class, "schema.sql"); - - private MigrationStep underTest = new DropIssueChangesTable(db.database()); - - @Test - public void dont_drop_if_tmp_table_doesnt_exist() throws SQLException { - db.executeDdl("drop table tmp_issue_changes"); - underTest.execute(); - db.assertTableExists("issue_changes"); - } - - @Test - public void execute() throws SQLException { - db.assertTableExists("issue_changes"); - underTest.execute(); - db.assertTableDoesNotExist("issue_changes"); - } - - @Test - public void migration_is_re_entrant() throws SQLException { - db.assertTableExists("issue_changes"); - - underTest.execute(); - - // re-entrant - underTest.execute(); - db.assertTableDoesNotExist("issue_changes"); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v85/DropOrphanFavoritesFromPropertiesTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v85/DropOrphanFavoritesFromPropertiesTest.java deleted file mode 100644 index 13cab92ca65..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v85/DropOrphanFavoritesFromPropertiesTest.java +++ /dev/null @@ -1,119 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v85; - -import java.sql.SQLException; -import java.time.Instant; -import javax.annotation.Nullable; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.core.util.Uuids; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DataChange; - -import static org.assertj.core.api.Assertions.assertThat; - -public class DropOrphanFavoritesFromPropertiesTest { - - private static final String PROPERTIES_TABLE_NAME = "properties"; - - @Rule - public CoreDbTester dbTester = CoreDbTester.createForSchema(DropOrphanFavoritesFromPropertiesTest.class, "schema.sql"); - - private DataChange underTest = new DropOrphanFavoritesFromProperties(dbTester.database()); - - private static final String COMPONENT_UUID_1 = Uuids.createFast(); - private static final String COMPONENT_UUID_2 = Uuids.createFast(); - private static final String COMPONENT_UUID_3 = Uuids.createFast(); - private static final String COMPONENT_UUID_4 = Uuids.createFast(); - - private static final String USER_UUID_1 = "1"; - private static final String USER_UUID_2 = "2"; - - @Before - public void setup() { - insertProperty("1", USER_UUID_1, COMPONENT_UUID_1, "test"); - insertProperty("2", USER_UUID_2, COMPONENT_UUID_2, "test2"); - insertProperty("3", USER_UUID_2, COMPONENT_UUID_3, "test3"); - insertProperty("4", USER_UUID_2, null, "test3"); - } - - @Test - public void migrate() throws SQLException { - insertProperty("5", USER_UUID_1, COMPONENT_UUID_4, "favourite"); - // properties to remove - insertProperty("6", USER_UUID_2, null, "favourite"); - insertProperty("7", USER_UUID_2, null, "favourite"); - insertProperty("8", USER_UUID_2, null, "favourite"); - - underTest.execute(); - - assertThat(dbTester.countRowsOfTable(PROPERTIES_TABLE_NAME)).isEqualTo(5); - assertThat(dbTester.select("select uuid from properties").stream().map(columns -> columns.get("UUID"))) - .containsOnly("1", "2", "3", "4", "5"); - } - - @Test - public void does_not_fail_when_properties_table_empty() throws SQLException { - dbTester.executeUpdateSql("delete from properties"); - - underTest.execute(); - - assertThat(dbTester.countRowsOfTable(PROPERTIES_TABLE_NAME)).isZero(); - } - - @Test - public void does_not_remove_properties_with_key_other_than_favourite() throws SQLException { - underTest.execute(); - - assertThat(dbTester.countRowsOfTable(PROPERTIES_TABLE_NAME)).isEqualTo(4L); - } - - @Test - public void migration_is_re_entrant() throws SQLException { - insertProperty("5", USER_UUID_1, COMPONENT_UUID_1, "favourite"); - // properties to remove - insertProperty("6", USER_UUID_1, null, "favourite"); - insertProperty("7", USER_UUID_2, null, "favourite"); - - underTest.execute(); - - insertProperty("8", USER_UUID_2, null, "favourite"); - insertProperty("9", USER_UUID_2, null, "favourite"); - - // re-entrant - underTest.execute(); - - assertThat(dbTester.countRowsOfTable(PROPERTIES_TABLE_NAME)).isEqualTo(5); - assertThat(dbTester.select("select uuid from properties").stream().map(columns -> columns.get("UUID"))) - .containsOnly("1", "2", "3", "4", "5"); - } - - private void insertProperty(String uuid, String userUuid, @Nullable String componentUuid, String propKey) { - dbTester.executeInsert(PROPERTIES_TABLE_NAME, - "uuid", uuid, - "user_uuid", userUuid, - "component_uuid", componentUuid, - "prop_key", propKey, - "is_empty", true, - "created_at", Instant.now().toEpochMilli()); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v85/DropPeriodAndValueWarningColumnsFromQualityGateConditionsTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v85/DropPeriodAndValueWarningColumnsFromQualityGateConditionsTableTest.java deleted file mode 100644 index cf4f36a59fe..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v85/DropPeriodAndValueWarningColumnsFromQualityGateConditionsTableTest.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v85; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; - -import static java.sql.Types.INTEGER; -import static java.sql.Types.VARCHAR; - -public class DropPeriodAndValueWarningColumnsFromQualityGateConditionsTableTest { - - private static final String TABLE_NAME = "quality_gate_conditions"; - private static final String COLUMN_NAME_PERIOD = "period"; - private static final String COLUMN_NAME_VALUE_WARNING = "value_warning"; - - @Rule - public CoreDbTester dbTester = CoreDbTester.createForSchema(DropPeriodAndValueWarningColumnsFromQualityGateConditionsTableTest.class, "schema.sql"); - - private DropPeriodAndValueWarningColumnsFromQualityGateConditionsTable underTest = new DropPeriodAndValueWarningColumnsFromQualityGateConditionsTable(dbTester.database()); - - @Test - public void column_has_been_dropped() throws SQLException { - dbTester.assertColumnDefinition(TABLE_NAME, COLUMN_NAME_PERIOD, INTEGER, null, true); - dbTester.assertColumnDefinition(TABLE_NAME, COLUMN_NAME_VALUE_WARNING, VARCHAR, null, true); - underTest.execute(); - dbTester.assertColumnDoesNotExist(TABLE_NAME, COLUMN_NAME_PERIOD); - dbTester.assertColumnDoesNotExist(TABLE_NAME, COLUMN_NAME_VALUE_WARNING); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v85/DropProjectAlmBindingsTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v85/DropProjectAlmBindingsTest.java deleted file mode 100644 index 74522662a46..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v85/DropProjectAlmBindingsTest.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v85; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -public class DropProjectAlmBindingsTest { - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DropProjectAlmBindingsTest.class, "schema.sql"); - - private MigrationStep underTest = new DropProjectAlmBindings(db.database()); - - @Test - public void drops_table() throws SQLException { - insertData(); - db.assertTableExists("project_alm_bindings"); - underTest.execute(); - db.assertTableDoesNotExist("project_alm_bindings"); - } - - private void insertData() { - db.executeInsert("project_alm_bindings", - "uuid", "uuid1", - "alm_id", "alm1", - "repo_id", "repo1", - "project_uuid", "project1", - "url", "url1", - "created_at", 123L, - "updated_at", 456L - ); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v85/DropProjectBranchesKeyTypeTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v85/DropProjectBranchesKeyTypeTest.java deleted file mode 100644 index 1104bc36ded..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v85/DropProjectBranchesKeyTypeTest.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v85; - -import java.sql.SQLException; -import java.sql.Types; -import javax.annotation.Nullable; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -import static org.assertj.core.api.Assertions.assertThat; - -public class DropProjectBranchesKeyTypeTest { - private static final String TABLE_NAME = "project_branches"; - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DropProjectBranchesKeyTypeTest.class, "schema.sql"); - - private MigrationStep underTest = new DropProjectBranchesKeyType(db.database()); - - @Test - public void drops_table() throws SQLException { - insertData(1, "PULL_REQUEST", "PULL_REQUEST"); - insertData(2, "BRANCH", "BRANCH"); - - db.assertColumnDefinition(TABLE_NAME, "key_type", Types.VARCHAR, 12, false); - - underTest.execute(); - db.assertIndexDoesNotExist(TABLE_NAME, "project_branches_kee_key_type"); - db.assertUniqueIndex(TABLE_NAME, "uniq_project_branches", "branch_type", "project_uuid", "kee"); - db.assertColumnDoesNotExist(TABLE_NAME, "key_type"); - assertThat(db.countRowsOfTable(TABLE_NAME)).isEqualTo(2); - } - - private void insertData(int id, String keyType, @Nullable String branchType) { - db.executeInsert(TABLE_NAME, - "uuid", "uuid" + id, - "project_uuid", "project" + id, - "kee", "key" + id, - "key_type", keyType, - "created_at", id, - "updated_at", id + 1, - "need_issue_sync", true, - "branch_type", branchType - ); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v85/DropUnusedIndexesTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v85/DropUnusedIndexesTest.java deleted file mode 100644 index 86ec83d9c0a..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v85/DropUnusedIndexesTest.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v85; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -public class DropUnusedIndexesTest { - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DropUnusedIndexesTest.class, "schema.sql"); - - private MigrationStep underTest = new DropUnusedIndexes(db.database()); - - @Test - public void drops_indexes() throws SQLException { - db.assertUniqueIndex("events", "events_uuid", "uuid"); - db.assertUniqueIndex("ce_activity", "ce_activity_uuid", "uuid"); - db.assertIndex("file_sources", "file_sources_updated_at", "updated_at"); - db.assertIndex("users", "users_updated_at", "updated_at"); - db.assertIndex("alm_app_installs", "alm_app_installs_external_id", "user_external_id"); - - underTest.execute(); - - db.assertIndexDoesNotExist("events", "events_uuid"); - db.assertIndexDoesNotExist("ce_activity", "ce_activity_uuid"); - db.assertIndexDoesNotExist("file_sources", "file_sources_updated_at"); - db.assertIndexDoesNotExist("users", "users_updated_at"); - db.assertIndexDoesNotExist("alm_app_installs", "alm_app_installs_external_id"); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v85/DropUnusedPeriodsInSnapshotsTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v85/DropUnusedPeriodsInSnapshotsTest.java deleted file mode 100644 index cd1f719bb42..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v85/DropUnusedPeriodsInSnapshotsTest.java +++ /dev/null @@ -1,102 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v85; - -import java.sql.SQLException; -import java.sql.Types; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.entry; - -public class DropUnusedPeriodsInSnapshotsTest { - private static final String TABLE_NAME = "snapshots"; - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DropUnusedPeriodsInSnapshotsTest.class, "schema.sql"); - - private MigrationStep underTest = new DropUnusedPeriodsInSnapshots(db.database()); - - @Test - public void drops_table() throws SQLException { - insertData(); - db.assertColumnDefinition(TABLE_NAME, "period2_mode", Types.VARCHAR, 100, true); - db.assertColumnDefinition(TABLE_NAME, "period3_mode", Types.VARCHAR, 100, true); - db.assertColumnDefinition(TABLE_NAME, "period4_mode", Types.VARCHAR, 100, true); - db.assertColumnDefinition(TABLE_NAME, "period5_mode", Types.VARCHAR, 100, true); - - db.assertColumnDefinition(TABLE_NAME, "period2_param", Types.VARCHAR, 100, true); - db.assertColumnDefinition(TABLE_NAME, "period3_param", Types.VARCHAR, 100, true); - db.assertColumnDefinition(TABLE_NAME, "period4_param", Types.VARCHAR, 100, true); - db.assertColumnDefinition(TABLE_NAME, "period5_param", Types.VARCHAR, 100, true); - - db.assertColumnDefinition(TABLE_NAME, "period2_date", Types.BIGINT, null, true); - db.assertColumnDefinition(TABLE_NAME, "period3_date", Types.BIGINT, null, true); - db.assertColumnDefinition(TABLE_NAME, "period4_date", Types.BIGINT, null, true); - db.assertColumnDefinition(TABLE_NAME, "period5_date", Types.BIGINT, null, true); - - underTest.execute(); - db.assertColumnDoesNotExist(TABLE_NAME, "period2_mode"); - db.assertColumnDoesNotExist(TABLE_NAME, "period3_mode"); - db.assertColumnDoesNotExist(TABLE_NAME, "period4_mode"); - db.assertColumnDoesNotExist(TABLE_NAME, "period5_mode"); - - db.assertColumnDoesNotExist(TABLE_NAME, "period2_param"); - db.assertColumnDoesNotExist(TABLE_NAME, "period3_param"); - db.assertColumnDoesNotExist(TABLE_NAME, "period4_param"); - db.assertColumnDoesNotExist(TABLE_NAME, "period5_param"); - - db.assertColumnDoesNotExist(TABLE_NAME, "period2_date"); - db.assertColumnDoesNotExist(TABLE_NAME, "period3_date"); - db.assertColumnDoesNotExist(TABLE_NAME, "period4_date"); - db.assertColumnDoesNotExist(TABLE_NAME, "period5_date"); - - assertThat(db.selectFirst("select * from snapshots")).contains(entry("PERIOD1_MODE", "m1")); - - } - - private void insertData() { - db.executeInsert(TABLE_NAME, - "uuid", "uuid1", - "component_uuid", "component1", - - "period1_mode", "m1", - "period2_mode", "m2", - "period3_mode", "m3", - "period4_mode", "m4", - "period5_mode", "m5", - - "period1_param", "p1", - "period2_param", "p2", - "period3_param", "p3", - "period4_param", "p4", - "period5_param", "p5", - - "period1_date", 1, - "period2_date", 2, - "period3_date", 3, - "period4_date", 4, - "period5_date", 5 - ); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v85/DropUnusedVariationsInProjectMeasuresTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v85/DropUnusedVariationsInProjectMeasuresTest.java deleted file mode 100644 index 8c074d991b7..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v85/DropUnusedVariationsInProjectMeasuresTest.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v85; - -import java.sql.SQLException; -import java.sql.Types; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.entry; - -public class DropUnusedVariationsInProjectMeasuresTest { - private static final String TABLE_NAME = "project_measures"; - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DropUnusedVariationsInProjectMeasuresTest.class, "schema.sql"); - - private MigrationStep underTest = new DropUnusedVariationsInProjectMeasures(db.database()); - - @Test - public void drops_table() throws SQLException { - insertData(); - db.assertColumnDefinition(TABLE_NAME, "variation_value_2", Types.DOUBLE, null, true); - db.assertColumnDefinition(TABLE_NAME, "variation_value_3", Types.DOUBLE, null, true); - db.assertColumnDefinition(TABLE_NAME, "variation_value_4", Types.DOUBLE, null, true); - db.assertColumnDefinition(TABLE_NAME, "variation_value_5", Types.DOUBLE, null, true); - - underTest.execute(); - db.assertColumnDoesNotExist(TABLE_NAME, "variation_value_2"); - db.assertColumnDoesNotExist(TABLE_NAME, "variation_value_3"); - db.assertColumnDoesNotExist(TABLE_NAME, "variation_value_4"); - db.assertColumnDoesNotExist(TABLE_NAME, "variation_value_5"); - assertThat(db.selectFirst("select * from project_measures")).contains(entry("VARIATION_VALUE_1", 1.0)); - - } - - private void insertData() { - db.executeInsert(TABLE_NAME, - "uuid", "uuid1", - "analysis_uuid", "analysis1", - "component_uuid", "component1", - "metric_uuid", "metric1", - "variation_value_1", 1.0, - "variation_value_2", 2.0, - "variation_value_3", 3.0, - "variation_value_4", 4.0, - "variation_value_5", 5.0 - ); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v85/FillProjectBranchesBranchTypeTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v85/FillProjectBranchesBranchTypeTest.java deleted file mode 100644 index 53a36e7f81e..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v85/FillProjectBranchesBranchTypeTest.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v85; - -import java.sql.SQLException; -import javax.annotation.Nullable; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.tuple; - -public class FillProjectBranchesBranchTypeTest { - private static final String TABLE_NAME = "project_branches"; - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(FillProjectBranchesBranchTypeTest.class, "schema.sql"); - - private MigrationStep underTest = new FillProjectBranchesBranchType(db.database()); - - @Test - public void drops_table() throws SQLException { - insertData(1, "PULL_REQUEST", "PULL_REQUEST"); - insertData(2, "PULL_REQUEST", null); - insertData(3, "BRANCH", null); - insertData(4, "BRANCH", "BRANCH"); - - underTest.execute(); - assertThat(db.select("select uuid, key_type, branch_type from project_branches")) - .extracting(m -> m.get("UUID"), m -> m.get("KEY_TYPE"), m -> m.get("BRANCH_TYPE")) - .containsOnly( - tuple("uuid1", "PULL_REQUEST", "PULL_REQUEST"), - tuple("uuid2", "PULL_REQUEST", "PULL_REQUEST"), - tuple("uuid3", "BRANCH", "BRANCH"), - tuple("uuid4", "BRANCH", "BRANCH")); - - } - - private void insertData(int id, String keyType, @Nullable String branchType) { - db.executeInsert(TABLE_NAME, - "uuid", "uuid" + id, - "project_uuid", "project" + id, - "kee", "key" + id, - "key_type", keyType, - "created_at", id, - "updated_at", id + 1, - "need_issue_sync", true, - "branch_type", branchType - ); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v85/MakeIssueKeyNotNullOnIssueChangesTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v85/MakeIssueKeyNotNullOnIssueChangesTableTest.java deleted file mode 100644 index ca4bb48285b..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v85/MakeIssueKeyNotNullOnIssueChangesTableTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v85; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -import static java.sql.Types.VARCHAR; - -public class MakeIssueKeyNotNullOnIssueChangesTableTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(MakeIssueKeyNotNullOnIssueChangesTableTest.class, "schema.sql"); - - private MigrationStep underTest = new MakeIssueKeyNotNullOnIssueChangesTable(db.database()); - - @Test - public void issue_key_column_is_not_null() throws SQLException { - underTest.execute(); - - db.assertColumnDefinition("issue_changes", "issue_key", VARCHAR, 50, false); - } - - @Test - public void migration_is_reentrant() throws SQLException { - underTest.execute(); - underTest.execute(); - - db.assertColumnDefinition("issue_changes", "issue_key", VARCHAR, 50, false); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v85/MakeMessageTypeColumnNotNullableOnCeTaskMessageTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v85/MakeMessageTypeColumnNotNullableOnCeTaskMessageTableTest.java deleted file mode 100644 index a8eb628d3f2..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v85/MakeMessageTypeColumnNotNullableOnCeTaskMessageTableTest.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v85; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -import static java.sql.Types.VARCHAR; - -public class MakeMessageTypeColumnNotNullableOnCeTaskMessageTableTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(MakeMessageTypeColumnNotNullableOnCeTaskMessageTableTest.class, "schema.sql"); - - private final MigrationStep underTest = new MakeMessageTypeColumnNotNullableOnCeTaskMessageTable(db.database()); - - @Test - public void message_type_column_is_not_null() throws SQLException { - underTest.execute(); - - db.assertColumnDefinition("ce_task_message", "message_type", VARCHAR, 255, false); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v85/MakeProjectBranchesBranchTypeNotNullableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v85/MakeProjectBranchesBranchTypeNotNullableTest.java deleted file mode 100644 index b13a3b85dfb..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v85/MakeProjectBranchesBranchTypeNotNullableTest.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v85; - -import java.sql.SQLException; -import java.sql.Types; -import javax.annotation.Nullable; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -import static org.assertj.core.api.Assertions.assertThat; - -public class MakeProjectBranchesBranchTypeNotNullableTest { - private static final String TABLE_NAME = "project_branches"; - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(MakeProjectBranchesBranchTypeNotNullableTest.class, "schema.sql"); - - private MigrationStep underTest = new MakeProjectBranchesBranchTypeNotNullable(db.database()); - - @Test - public void drops_table() throws SQLException { - insertData(1, "PULL_REQUEST", "PULL_REQUEST"); - insertData(2, "BRANCH", "BRANCH"); - - db.assertColumnDefinition(TABLE_NAME, "branch_type", Types.VARCHAR, 12, true); - - underTest.execute(); - - db.assertColumnDefinition(TABLE_NAME, "branch_type", Types.VARCHAR, 12, false); - assertThat(db.countRowsOfTable(TABLE_NAME)).isEqualTo(2); - } - - private void insertData(int id, String keyType, @Nullable String branchType) { - db.executeInsert(TABLE_NAME, - "uuid", "uuid" + id, - "project_uuid", "project" + id, - "kee", "key" + id, - "key_type", keyType, - "created_at", id, - "updated_at", id + 1, - "need_issue_sync", true, - "branch_type", branchType - ); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v85/MakeProjectUuidNotNullOnIssueChangesTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v85/MakeProjectUuidNotNullOnIssueChangesTableTest.java deleted file mode 100644 index 84b9170e80f..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v85/MakeProjectUuidNotNullOnIssueChangesTableTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v85; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -import static java.sql.Types.VARCHAR; - -public class MakeProjectUuidNotNullOnIssueChangesTableTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(MakeProjectUuidNotNullOnIssueChangesTableTest.class, "schema.sql"); - - private MigrationStep underTest = new MakeProjectUuidNotNullOnIssueChangesTable(db.database()); - - @Test - public void issue_key_column_is_not_null() throws SQLException { - underTest.execute(); - - db.assertColumnDefinition("issue_changes", "project_uuid", VARCHAR, 50, false); - } - - @Test - public void migration_is_reentrant() throws SQLException { - underTest.execute(); - underTest.execute(); - - db.assertColumnDefinition("issue_changes", "project_uuid", VARCHAR, 50, false); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v85/MakeUuidNotNullOnIssueChangesTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v85/MakeUuidNotNullOnIssueChangesTableTest.java deleted file mode 100644 index 0e8af215179..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v85/MakeUuidNotNullOnIssueChangesTableTest.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v85; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -import static java.sql.Types.VARCHAR; - -public class MakeUuidNotNullOnIssueChangesTableTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(MakeUuidNotNullOnIssueChangesTableTest.class, "schema.sql"); - - private MigrationStep underTest = new MakeUuidNotNullOnIssueChangesTable(db.database()); - - @Test - public void uuid_column_is_not_null() throws SQLException { - underTest.execute(); - - db.assertColumnDefinition("issue_changes", "uuid", VARCHAR, 40, false); - } - - @Test - public void migration_is_reentrant() throws SQLException { - underTest.execute(); - underTest.execute(); - - db.assertColumnDefinition("issue_changes", "uuid", VARCHAR, 40, false); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v85/PopulateFileSourceLineCountTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v85/PopulateFileSourceLineCountTest.java deleted file mode 100644 index 8dfd382060f..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v85/PopulateFileSourceLineCountTest.java +++ /dev/null @@ -1,159 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v85; - -import java.sql.SQLException; -import java.util.stream.Collectors; -import java.util.stream.IntStream; -import javax.annotation.Nullable; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; -import org.sonar.core.util.SequenceUuidFactory; -import org.sonar.core.util.UuidFactory; -import org.sonar.db.CoreDbTester; - -import static org.apache.commons.lang.RandomStringUtils.randomAlphanumeric; -import static org.assertj.core.api.Assertions.assertThat; -import static org.sonar.server.platform.db.migration.version.v85.PopulateFileSourceLineCount.LINE_COUNT_NOT_POPULATED; - -public class PopulateFileSourceLineCountTest { - @Rule - public ExpectedException expectedException = ExpectedException.none(); - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(PopulateFileSourceLineCountTest.class, "schema.sql"); - - private UuidFactory uuidFactory = new SequenceUuidFactory(); - - private PopulateFileSourceLineCount underTest = new PopulateFileSourceLineCount(db.database()); - - @Test - public void execute_has_no_effect_on_empty_table() throws SQLException { - underTest.execute(); - assertThat(db.countRowsOfTable("file_sources")).isZero(); - } - - @Test - public void execute_populates_line_count_of_any_type() throws SQLException { - String projectUuid = randomAlphanumeric(4); - String fileUuid = randomAlphanumeric(5); - int lineCount = 10; - insertUnpopulatedFileSource(projectUuid, fileUuid, lineCount); - assertThat(getLineCountByFileUuid(fileUuid)).isEqualTo(LINE_COUNT_NOT_POPULATED); - - underTest.execute(); - - assertThat(getLineCountByFileUuid(fileUuid)).isEqualTo(lineCount); - } - - @Test - public void execute_changes_only_file_source_with_LINE_COUNT_NOT_POPULATED_value() throws SQLException { - String projectUuid = randomAlphanumeric(4); - String fileUuid1 = randomAlphanumeric(5); - String fileUuid2 = randomAlphanumeric(6); - String fileUuid3 = randomAlphanumeric(7); - int lineCountFile1 = 10; - int lineCountFile2 = 50; - int lineCountFile3 = 150; - - insertPopulatedFileSource(projectUuid, fileUuid1, lineCountFile1); - int badLineCountFile2 = insertInconsistentPopulatedFileSource(projectUuid, fileUuid2, lineCountFile2); - insertUnpopulatedFileSource(projectUuid, fileUuid3, lineCountFile3); - assertThat(getLineCountByFileUuid(fileUuid1)).isEqualTo(lineCountFile1); - assertThat(getLineCountByFileUuid(fileUuid2)).isEqualTo(badLineCountFile2); - assertThat(getLineCountByFileUuid(fileUuid3)).isEqualTo(LINE_COUNT_NOT_POPULATED); - - underTest.execute(); - - assertThat(getLineCountByFileUuid(fileUuid1)).isEqualTo(lineCountFile1); - assertThat(getLineCountByFileUuid(fileUuid2)).isEqualTo(badLineCountFile2); - assertThat(getLineCountByFileUuid(fileUuid3)).isEqualTo(lineCountFile3); - } - - @Test - public void execute_set_line_count_to_zero_when_file_source_has_no_line_hashes() throws SQLException { - String projectUuid = randomAlphanumeric(4); - String fileUuid1 = randomAlphanumeric(5); - - insertFileSource(projectUuid, fileUuid1, null, LINE_COUNT_NOT_POPULATED); - - underTest.execute(); - - assertThat(getLineCountByFileUuid(fileUuid1)).isZero(); - } - - @Test - public void execute_set_line_count_to_1_when_file_source_has_empty_line_hashes() throws SQLException { - String projectUuid = randomAlphanumeric(4); - String fileUuid1 = randomAlphanumeric(5); - - insertFileSource(projectUuid, fileUuid1, "", LINE_COUNT_NOT_POPULATED); - - underTest.execute(); - - assertThat(getLineCountByFileUuid(fileUuid1)).isEqualTo(1); - } - - private int getLineCountByFileUuid(String fileUuid) { - Long res = (Long) db.selectFirst("select line_count as \"LINE_COUNT\" from file_sources where file_uuid = '" + fileUuid + "'") - .get("LINE_COUNT"); - return res.intValue(); - } - - private void insertUnpopulatedFileSource(String projectUuid, String fileUuid, int numberOfHashes) { - String lineHashes = generateLineHashes(numberOfHashes); - - insertFileSource(projectUuid, fileUuid, lineHashes, LINE_COUNT_NOT_POPULATED); - } - - private void insertPopulatedFileSource(String projectUuid, String fileUuid, int lineCount) { - String lineHashes = generateLineHashes(lineCount); - - insertFileSource(projectUuid, fileUuid, lineHashes, lineCount); - } - - private int insertInconsistentPopulatedFileSource(String projectUuid, String fileUuid, int lineCount) { - String lineHashes = generateLineHashes(lineCount); - int badLineCount = lineCount + 6; - - insertFileSource(projectUuid, fileUuid, lineHashes, badLineCount); - - return badLineCount; - } - - private static String generateLineHashes(int numberOfHashes) { - return IntStream.range(0, numberOfHashes) - .mapToObj(String::valueOf) - .collect(Collectors.joining("\n")); - } - - private void insertFileSource(String projectUuid, String fileUuid, @Nullable String lineHashes, int lineCount) { - db.executeInsert( - "FILE_SOURCES", - "UUID", uuidFactory.create(), - "PROJECT_UUID", projectUuid, - "FILE_UUID", fileUuid, - "LINE_HASHES", lineHashes, - "LINE_COUNT", lineCount, - "CREATED_AT", 1_222_333L, - "UPDATED_AT", 1_222_333L); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v85/PopulateMessageTypeColumnOfCeTaskMessageTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v85/PopulateMessageTypeColumnOfCeTaskMessageTableTest.java deleted file mode 100644 index 0bca716b1c0..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v85/PopulateMessageTypeColumnOfCeTaskMessageTableTest.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v85; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.api.utils.System2; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DataChange; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.tuple; - -public class PopulateMessageTypeColumnOfCeTaskMessageTableTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(PopulateMessageTypeColumnOfCeTaskMessageTableTest.class, "schema.sql"); - - private final DataChange underTest = new PopulateMessageTypeColumnOfCeTaskMessageTable(db.database()); - - @Test - public void add_message_type_column_on_empty_table() throws SQLException { - underTest.execute(); - - assertThat(db.countSql("select count(*) from ce_task_message")).isZero(); - } - - @Test - public void add_message_type_column_on_non_empty_table() throws SQLException { - insertTaskMessage(1L, "msg1"); - insertTaskMessage(2L, "msg2"); - insertTaskMessage(3L, "msg3"); - insertTaskMessage(4L, "msg4"); - - underTest.execute(); - - assertThat(db.countSql("select count(*) from ce_task_message")).isEqualTo(4); - assertThat(db.select("select uuid, task_uuid, message, message_type from ce_task_message")) - .extracting(m -> m.get("UUID"), m -> m.get("TASK_UUID"), m -> m.get("MESSAGE"), m -> m.get("MESSAGE_TYPE")) - .containsExactlyInAnyOrder( - tuple("uuid-1", "task-uuid-1", "msg1", "GENERIC"), - tuple("uuid-2", "task-uuid-2", "msg2", "GENERIC"), - tuple("uuid-3", "task-uuid-3", "msg3", "GENERIC"), - tuple("uuid-4", "task-uuid-4", "msg4", "GENERIC")); - } - - private void insertTaskMessage(Long id, String message) { - db.executeInsert("ce_task_message", - "uuid", "uuid-" + id, - "task_uuid", "task-uuid-" + id, - "message", message, - "created_at", System2.INSTANCE.now()); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v85/PopulateTypeInPluginsTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v85/PopulateTypeInPluginsTest.java deleted file mode 100644 index e8f1e2b5329..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v85/PopulateTypeInPluginsTest.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v85; - -import java.sql.SQLException; -import java.sql.Types; -import javax.annotation.Nullable; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -import static org.assertj.core.api.Assertions.assertThat; - -public class PopulateTypeInPluginsTest { - private static final String TABLE_NAME = "plugins"; - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(PopulateTypeInPluginsTest.class, "schema.sql"); - - private MigrationStep underTest = new PopulateTypeInPlugins(db.database()); - - @Test - public void add_column() throws SQLException { - addPlugin("1", null); - addPlugin("2", null); - addPlugin("3", "BUNDLED"); - - underTest.execute(); - db.assertColumnDefinition(TABLE_NAME, "type", Types.VARCHAR, 10, true); - assertThat(db.countRowsOfTable(TABLE_NAME)).isEqualTo(3); - assertThat(db.select("select type as \"TYPE\" from plugins order by uuid").stream().map(r -> r.get("TYPE"))).containsExactly("EXTERNAL", "EXTERNAL", "BUNDLED"); - } - - private void addPlugin(String id, @Nullable String type) { - db.executeInsert(TABLE_NAME, - "uuid", "uuid" + id, - "kee", "kee" + id, - "base_plugin_key", "base" + id, - "file_hash", "hash" + id, - "type", type, - "created_at", 1L, - "updated_at", 2L); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v85/RenameTmpIssueChangesToIssueChangesTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v85/RenameTmpIssueChangesToIssueChangesTest.java deleted file mode 100644 index bd9e206d468..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v85/RenameTmpIssueChangesToIssueChangesTest.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v85; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; -import org.sonar.db.CoreDbTester; - -public class RenameTmpIssueChangesToIssueChangesTest { - - private static final String OLD_TABLE_NAME = "tmp_issue_changes"; - private static final String NEW_TABLE_NAME = "issue_changes"; - - @Rule - public CoreDbTester dbTester = CoreDbTester.createForSchema(RenameTmpIssueChangesToIssueChangesTest.class, "schema.sql"); - - @Rule - public ExpectedException expectedException = ExpectedException.none(); - - private final RenameTmpIssueChangesToIssueChanges underTest = new RenameTmpIssueChangesToIssueChanges(dbTester.database()); - - @Test - public void only_rename_if_tmp_table_exists() throws SQLException { - dbTester.executeDdl("drop table " + OLD_TABLE_NAME); - underTest.execute(); - - dbTester.assertTableDoesNotExist(OLD_TABLE_NAME); - dbTester.assertTableDoesNotExist(NEW_TABLE_NAME); - } - - @Test - public void table_has_been_renamed() throws SQLException { - underTest.execute(); - - dbTester.assertTableDoesNotExist(OLD_TABLE_NAME); - dbTester.assertTableExists(NEW_TABLE_NAME); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v86/AddIndexToApplicationBranchProjsTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v86/AddIndexToApplicationBranchProjsTest.java deleted file mode 100644 index 46ec8337aed..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v86/AddIndexToApplicationBranchProjsTest.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v86; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -public class AddIndexToApplicationBranchProjsTest { - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(AddIndexToApplicationBranchProjsTest.class, "schema.sql"); - - private final MigrationStep underTest = new AddIndexToApplicationBranchProjs(db.database()); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertUniqueIndex("app_branch_project_branch", "uniq_app_branch_proj", "application_branch_uuid", "project_branch_uuid"); - db.assertIndex("app_branch_project_branch", "idx_abpb_app_uuid", "application_uuid"); - db.assertIndex("app_branch_project_branch", "idx_abpb_app_branch_uuid", "application_branch_uuid"); - db.assertIndex("app_branch_project_branch", "idx_abpb_proj_uuid", "project_uuid"); - db.assertIndex("app_branch_project_branch", "idx_abpb_proj_branch_uuid", "project_branch_uuid"); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v86/AddIndexToApplicationProjectsTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v86/AddIndexToApplicationProjectsTest.java deleted file mode 100644 index 04c43564ca5..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v86/AddIndexToApplicationProjectsTest.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v86; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -public class AddIndexToApplicationProjectsTest { - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(AddIndexToApplicationProjectsTest.class, "schema.sql"); - - private final MigrationStep underTest = new AddIndexToApplicationProjects(db.database()); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertUniqueIndex("app_projects", "uniq_app_projects", "application_uuid", "project_uuid"); - db.assertIndex("app_projects", "idx_app_proj_application_uuid", "application_uuid"); - db.assertIndex("app_projects", "idx_app_proj_project_uuid", "project_uuid"); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v86/AddPkToApplicationBranchProjsTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v86/AddPkToApplicationBranchProjsTest.java deleted file mode 100644 index a4da4d7113d..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v86/AddPkToApplicationBranchProjsTest.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v86; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -public class AddPkToApplicationBranchProjsTest { - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(AddPkToApplicationBranchProjsTest.class, "schema.sql"); - - private MigrationStep underTest = new AddPkToApplicationBranchProjs(db.database()); - - @Test - public void execute() throws SQLException { - db.assertNoPrimaryKey("app_branch_project_branch"); - underTest.execute(); - db.assertPrimaryKey("app_branch_project_branch", "pk_app_branch_project_branch", "uuid"); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v86/AddPkToApplicationProjectsTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v86/AddPkToApplicationProjectsTest.java deleted file mode 100644 index 4c5fddc44e3..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v86/AddPkToApplicationProjectsTest.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v86; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -public class AddPkToApplicationProjectsTest { - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(AddPkToApplicationProjectsTest.class, "schema.sql"); - - private MigrationStep underTest = new AddPkToApplicationProjects(db.database()); - - @Test - public void execute() throws SQLException { - db.assertNoPrimaryKey("app_projects"); - underTest.execute(); - db.assertPrimaryKey("app_projects", "pk_app_projects", "uuid"); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v86/AddPrimaryKeyToDefaultQProfilesTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v86/AddPrimaryKeyToDefaultQProfilesTest.java deleted file mode 100644 index e19082b117c..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v86/AddPrimaryKeyToDefaultQProfilesTest.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v86; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -public class AddPrimaryKeyToDefaultQProfilesTest { - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(AddPrimaryKeyToDefaultQProfilesTest.class, "schema.sql"); - - private MigrationStep underTest = new AddPrimaryKeyToDefaultQProfiles(db.database()); - - @Test - public void execute() throws SQLException { - db.assertNoPrimaryKey("default_qprofiles"); - underTest.execute(); - db.assertPrimaryKey("default_qprofiles", "pk_default_qprofiles", "language"); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v86/AddResetPasswordColumnToUsersTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v86/AddResetPasswordColumnToUsersTest.java deleted file mode 100644 index 8843ce07d81..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v86/AddResetPasswordColumnToUsersTest.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v86; - -import java.sql.SQLException; -import java.util.Objects; -import javax.annotation.Nullable; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -import static java.sql.Types.BOOLEAN; -import static java.util.stream.Collectors.toList; -import static org.assertj.core.api.Assertions.assertThat; - -public class AddResetPasswordColumnToUsersTest { - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(AddResetPasswordColumnToUsersTest.class, "schema.sql"); - - private MigrationStep underTest = new AddResetPasswordColumnToUsers(db.database()); - - @Test - public void execute_on_empty_db() throws SQLException { - db.assertColumnDoesNotExist("users", "reset_password"); - underTest.execute(); - db.assertColumnDefinition("users", "reset_password", BOOLEAN, null, true); - } - - @Test - public void execute_on_db_with_user_rows() throws SQLException { - insertUser("uuid-1"); - insertUser("uuid-2"); - insertUser("uuid-3"); - db.assertColumnDoesNotExist("users", "reset_password"); - underTest.execute(); - db.assertColumnDefinition("users", "reset_password", BOOLEAN, null, true); - - assertThatAllUsersResetPasswordFlagAreNotSet(); - } - - private void assertThatAllUsersResetPasswordFlagAreNotSet() { - assertThat(db.select("select reset_password from users") - .stream() - .map(r -> r.get("RESET_PASSWORD")) - .map(this::getBooleanValue) - .filter(Objects::nonNull) - .collect(toList())).isEmpty(); - } - - private Boolean getBooleanValue(@Nullable Object value) { - return value == null ? null : Boolean.parseBoolean(value.toString()); - } - - private void insertUser(String uuid) { - db.executeInsert("users", - "UUID", uuid, - "LOGIN", uuid + "login", - "EXTERNAL_LOGIN", uuid + "-external-login", - "EXTERNAL_IDENTITY_PROVIDER", "sonarqube", - "EXTERNAL_ID", uuid + "-external-id", - "IS_ROOT", false, - "ONBOARDED", false); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v86/AddUniqueIndexOnNameColumnOfGroupsTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v86/AddUniqueIndexOnNameColumnOfGroupsTableTest.java deleted file mode 100644 index 4e3516ce046..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v86/AddUniqueIndexOnNameColumnOfGroupsTableTest.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v86; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -public class AddUniqueIndexOnNameColumnOfGroupsTableTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(AddUniqueIndexOnNameColumnOfGroupsTableTest.class, "schema.sql"); - - private final MigrationStep underTest = new AddUniqueIndexOnNameColumnOfGroupsTable(db.database()); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertUniqueIndex("groups", "uniq_groups_name", "name"); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v86/CreateApplicationProjectsTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v86/CreateApplicationProjectsTableTest.java deleted file mode 100644 index 56fcaa3257e..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v86/CreateApplicationProjectsTableTest.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v86; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; -import org.sonar.server.platform.db.migration.version.v86.CreateApplicationProjectsTable; - -public class CreateApplicationProjectsTableTest { - private final static String TABLE_NAME = "app_projects"; - - @Rule - public CoreDbTester db = CoreDbTester.createEmpty(); - - private MigrationStep underTest = new CreateApplicationProjectsTable(db.database()); - - @Test - public void execute() throws SQLException { - db.assertTableDoesNotExist(TABLE_NAME); - underTest.execute(); - db.assertTableExists(TABLE_NAME); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v86/DbVersion86Test.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v86/DbVersion86Test.java deleted file mode 100644 index 50b61750245..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v86/DbVersion86Test.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v86; - -import org.junit.Test; -import org.sonar.server.platform.db.migration.version.DbVersion; -import org.sonar.server.platform.db.migration.version.v85.DbVersion85; - -import static org.sonar.server.platform.db.migration.version.DbVersionTestUtils.verifyMigrationNotEmpty; -import static org.sonar.server.platform.db.migration.version.DbVersionTestUtils.verifyMinimumMigrationNumber; - -public class DbVersion86Test { - - private DbVersion underTest = new DbVersion86(); - - @Test - public void migrationNumber_starts_at_4100() { - verifyMinimumMigrationNumber(underTest, 4100); - } - - @Test - public void verify_migration_count() { - verifyMigrationNotEmpty(underTest); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v86/DropDefaultQProfilesPkTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v86/DropDefaultQProfilesPkTest.java deleted file mode 100644 index ac99cb1a768..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v86/DropDefaultQProfilesPkTest.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v86; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.sql.DbPrimaryKeyConstraintFinder; -import org.sonar.server.platform.db.migration.sql.DropPrimaryKeySqlGenerator; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -public class DropDefaultQProfilesPkTest { - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DropDefaultQProfilesPkTest.class, "schema.sql"); - - private final MigrationStep underTest = new DropDefaultQProfilesPk(db.database(), new DropPrimaryKeySqlGenerator(db.database(), new DbPrimaryKeyConstraintFinder(db.database()))); - - @Test - public void execute() throws SQLException { - db.assertPrimaryKey("default_qprofiles", "pk_default_qprofiles", "organization_uuid", "language"); - - underTest.execute(); - db.assertNoPrimaryKey("default_qprofiles"); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v86/DropOrganizationFromDefaultQProfilesTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v86/DropOrganizationFromDefaultQProfilesTest.java deleted file mode 100644 index b88f76ecd47..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v86/DropOrganizationFromDefaultQProfilesTest.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v86; - -import java.sql.SQLException; -import java.sql.Types; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -public class DropOrganizationFromDefaultQProfilesTest { - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DropOrganizationFromDefaultQProfilesTest.class, "schema.sql"); - - private MigrationStep underTest = new DropOrganizationFromDefaultQProfiles(db.database()); - - @Test - public void execute() throws SQLException { - db.assertColumnDefinition("default_qprofiles", "organization_uuid", Types.VARCHAR, 40, false); - underTest.execute(); - db.assertColumnDoesNotExist("default_qprofiles", "organization_uuid"); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v86/DropOrganizationFromQualityProfileTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v86/DropOrganizationFromQualityProfileTableTest.java deleted file mode 100644 index 015ddad9e93..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v86/DropOrganizationFromQualityProfileTableTest.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v86; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; - -public class DropOrganizationFromQualityProfileTableTest { - - @Rule - public CoreDbTester dbTester = CoreDbTester.createForSchema(DropOrganizationFromQualityProfileTableTest.class, "schema.sql"); - - private DropOrganizationFromQualityProfileTable underTest = new DropOrganizationFromQualityProfileTable(dbTester.database()); - - @Test - public void column_has_been_dropped() throws SQLException { - underTest.execute(); - dbTester.assertColumnDoesNotExist("org_qprofiles", "organization_uuid"); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v86/DropOrganizationInGroupRolesTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v86/DropOrganizationInGroupRolesTest.java deleted file mode 100644 index 3df26c871b4..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v86/DropOrganizationInGroupRolesTest.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v86; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -public class DropOrganizationInGroupRolesTest { - - @Rule - public CoreDbTester dbTester = CoreDbTester.createForSchema(DropOrganizationInGroupRolesTest.class, "schema.sql"); - - private MigrationStep underTest = new DropOrganizationInGroupRoles(dbTester.database()); - - @Test - public void column_has_been_dropped() throws SQLException { - underTest.execute(); - dbTester.assertColumnDoesNotExist("group_roles", "organization_uuid"); - dbTester.assertUniqueIndex("group_roles", "uniq_group_roles", "group_uuid", "component_uuid", "role"); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v86/DropOrganizationInGroupsTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v86/DropOrganizationInGroupsTest.java deleted file mode 100644 index 3ffe9cdf635..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v86/DropOrganizationInGroupsTest.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v86; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -public class DropOrganizationInGroupsTest { - - @Rule - public CoreDbTester dbTester = CoreDbTester.createForSchema(DropOrganizationInGroupsTest.class, "schema.sql"); - - private final MigrationStep underTest = new DropOrganizationInGroups(dbTester.database()); - - @Test - public void column_has_been_dropped() throws SQLException { - underTest.execute(); - dbTester.assertColumnDoesNotExist("groups", "organization_uuid"); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v86/DropOrganizationInPermissionTemplatesTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v86/DropOrganizationInPermissionTemplatesTest.java deleted file mode 100644 index 188884704e4..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v86/DropOrganizationInPermissionTemplatesTest.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v86; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -public class DropOrganizationInPermissionTemplatesTest { - - @Rule - public CoreDbTester dbTester = CoreDbTester.createForSchema(DropOrganizationInPermissionTemplatesTest.class, "schema.sql"); - - private MigrationStep underTest = new DropOrganizationInPermissionTemplates(dbTester.database()); - - @Test - public void column_has_been_dropped() throws SQLException { - underTest.execute(); - dbTester.assertColumnDoesNotExist("permission_templates", "organization_uuid"); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v86/DropOrganizationInRulesMetadataTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v86/DropOrganizationInRulesMetadataTest.java deleted file mode 100644 index 832271c0597..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v86/DropOrganizationInRulesMetadataTest.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v86; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.sql.DbPrimaryKeyConstraintFinder; -import org.sonar.server.platform.db.migration.sql.DropPrimaryKeySqlGenerator; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -public class DropOrganizationInRulesMetadataTest { - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DropOrganizationInRulesMetadataTest.class, "schema.sql"); - private final DropPrimaryKeySqlGenerator dropPrimaryKeySqlGenerator = new DropPrimaryKeySqlGenerator(db.database(), new DbPrimaryKeyConstraintFinder(db.database())); - - private MigrationStep underTest = new DropOrganizationInRulesMetadata(db.database(), dropPrimaryKeySqlGenerator); - - @Test - public void column_has_been_dropped() throws SQLException { - underTest.execute(); - db.assertColumnDoesNotExist("rules_metadata", "organization_uuid"); - db.assertPrimaryKey("rules_metadata", "pk_rules_metadata", "rule_uuid"); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v86/DropOrganizationInUserRolesTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v86/DropOrganizationInUserRolesTest.java deleted file mode 100644 index ff16bbb74d4..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v86/DropOrganizationInUserRolesTest.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v86; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -public class DropOrganizationInUserRolesTest { - - @Rule - public CoreDbTester dbTester = CoreDbTester.createForSchema(DropOrganizationInUserRolesTest.class, "schema.sql"); - - private MigrationStep underTest = new DropOrganizationInUserRoles(dbTester.database()); - - @Test - public void column_has_been_dropped() throws SQLException { - underTest.execute(); - dbTester.assertColumnDoesNotExist("user_roles", "organization_uuid"); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v86/DropOrganizationInUsersTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v86/DropOrganizationInUsersTest.java deleted file mode 100644 index 8f689b4354a..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v86/DropOrganizationInUsersTest.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v86; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -public class DropOrganizationInUsersTest { - - @Rule - public CoreDbTester dbTester = CoreDbTester.createForSchema(DropOrganizationInUsersTest.class, "schema.sql"); - - private MigrationStep underTest = new DropOrganizationInUsers(dbTester.database()); - - @Test - public void column_has_been_dropped() throws SQLException { - underTest.execute(); - dbTester.assertColumnDoesNotExist("users", "organization_uuid"); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v86/DropOrganizationUuidIndexFromQualityProfileTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v86/DropOrganizationUuidIndexFromQualityProfileTableTest.java deleted file mode 100644 index eec70670bdf..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v86/DropOrganizationUuidIndexFromQualityProfileTableTest.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v86; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -public class DropOrganizationUuidIndexFromQualityProfileTableTest { - - private static final String TABLE_NAME = "org_qprofiles"; - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DropOrganizationUuidIndexFromQualityProfileTableTest.class, "schema.sql"); - - private MigrationStep underTest = new DropOrganizationUuidIndexFromQualityProfileTable(db.database()); - - @Test - public void execute() throws SQLException { - db.assertTableExists(TABLE_NAME); - db.assertIndex(TABLE_NAME, "qprofiles_org_uuid", "organization_uuid"); - - underTest.execute(); - - db.assertIndexDoesNotExist(TABLE_NAME, "qprofiles_org_uuid"); - } - - @Test - public void migration_is_re_entrant() throws SQLException { - underTest.execute(); - - // re-entrant - underTest.execute(); - - db.assertIndexDoesNotExist(TABLE_NAME, "qprofiles_org_uuid"); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v86/MakeNameColumnInGroupsTableNotNullableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v86/MakeNameColumnInGroupsTableNotNullableTest.java deleted file mode 100644 index ac689725669..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v86/MakeNameColumnInGroupsTableNotNullableTest.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v86; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -import static java.sql.Types.VARCHAR; - -public class MakeNameColumnInGroupsTableNotNullableTest { - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(MakeNameColumnInGroupsTableNotNullableTest.class, "schema.sql"); - - private final MigrationStep underTest = new MakeNameColumnInGroupsTableNotNullable(db.database()); - - @Test - public void uuid_column_is_not_null() throws SQLException { - underTest.execute(); - - db.assertColumnDefinition("groups", "name", VARCHAR, 500, false); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v86/MakeResetPasswordColumnNotNullTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v86/MakeResetPasswordColumnNotNullTest.java deleted file mode 100644 index da9efc5240e..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v86/MakeResetPasswordColumnNotNullTest.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v86; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -import static java.sql.Types.BOOLEAN; - -public class MakeResetPasswordColumnNotNullTest { - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(MakeResetPasswordColumnNotNullTest.class, "schema.sql"); - - private MigrationStep underTest = new MakeResetPasswordColumnNotNull(db.database()); - - @Test - public void execute_on_empty_db() throws SQLException { - db.assertColumnDefinition("users", "reset_password", BOOLEAN, null, true); - underTest.execute(); - db.assertColumnDefinition("users", "reset_password", BOOLEAN, null, false); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v86/MigrateApplicationDefinitionsFromXmlToDbTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v86/MigrateApplicationDefinitionsFromXmlToDbTest.java deleted file mode 100644 index 0d083a13f65..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v86/MigrateApplicationDefinitionsFromXmlToDbTest.java +++ /dev/null @@ -1,809 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v86; - -import java.sql.SQLException; -import java.util.Map; -import javax.annotation.Nullable; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.api.impl.utils.TestSystem2; -import org.sonar.api.utils.System2; -import org.sonar.core.util.UuidFactory; -import org.sonar.core.util.UuidFactoryFast; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; -import org.xmlunit.builder.DiffBuilder; -import org.xmlunit.builder.Input; -import org.xmlunit.diff.Diff; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatThrownBy; -import static org.assertj.core.api.Assertions.tuple; -import static org.sonar.server.platform.db.migration.version.v86.MigrateApplicationDefinitionsFromXmlToDb.TEXT_VALUE_MAX_LENGTH; - -public class MigrateApplicationDefinitionsFromXmlToDbTest { - private static final String QUALIFIER_PROJECT = "TRK"; - private static final String QUALIFIER_APP = "APP"; - private static final long NOW = 100_000_000_000L; - - private static final String PROJECT_1_UUID = "proj1-uuid"; - private static final String PROJECT_1_MASTER_BRANCH_UUID = "proj1-master-uuid"; - private static final String PROJECT_1_BRANCH_1_UUID = "proj1-branch1-uuid"; - private static final String PROJECT_1_BRANCH_2_UUID = "proj1-branch2-uuid"; - private static final String PROJECT_2_UUID = "proj2-uuid"; - private static final String PROJECT_2_MASTER_BRANCH_UUID = "proj2-master-uuid"; - private static final String PROJECT_2_BRANCH_1_UUID = "proj2-branch1-uuid"; - private static final String APP_1_UUID = "app1-uuid"; - private static final String APP_1_MASTER_BRANCH_UUID = "app1-master-uuid"; - private static final String APP_1_BRANCH_1_UUID = "app1-branch1-uuid"; - private static final String APP_1_BRANCH_2_UUID = "app1-branch2-uuid"; - private static final String APP_2_UUID = "app2-uuid"; - private static final String APP_2_MASTER_BRANCH_UUID = "app2-master-uuid"; - private static final String APP_2_BRANCH_1_UUID = "app2-branch1-uuid"; - private static final String EMPTY_XML = ""; - - private static final String EMPTY_APP_XML = "\n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - ""; - - private static final String APP_WITH_NO_BRANCHES_XML = "\n" + - " \n" + - " \n" + - " \n" + - " \n" + - "

proj1-key

\n" + - "

proj2-key

\n" + - "
\n" + - "
"; - - private static final String APP_WITH_DUPLICATED_PROJECTS_XML = "\n" + - " \n" + - " \n" + - " \n" + - " \n" + - "

proj1-key

\n" + - "

proj1-key

\n" + - " \n" + - "

proj1-key

\n" + - "
\n" + - " \n" + - "

proj1-key

\n" + - "
\n" + - "
\n" + - "
"; - - private static final String COMPLEX_XML_BEFORE = "\n" + - " \n" + - " \n" + - " \n" + - " \n" + - "

proj1-key

\n" + - "

proj2-key

\n" + - " \n" + - "

proj1-key

\n" + - "

proj2-key

\n" + - "
\n" + - " \n" + - "

proj1-key

\n" + - "

proj2-key

\n" + - "
\n" + - "
\n" + - " \n" + - " \n" + - " \n" + - " \n" + - "

proj1-key

\n" + - "

proj2-key

\n" + - " \n" + - "

proj1-key

\n" + - "

proj2-key

\n" + - "
\n" + - "
\n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - "

proj1-key

\n" + - "
\n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " tag1\n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - "
"; - - private static final String COMPLEX_XML_AFTER = "\n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - "

proj1-key

\n" + - "
\n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " tag1\n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - "
"; - - private static final String LARGE_XML_BEFORE_AND_AFTER = "\n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - "

proj1-key

\n" + - "
\n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " tag1\n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - "
"; - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(MigrateApplicationDefinitionsFromXmlToDbTest.class, "schema.sql"); - - private final UuidFactory uuidFactory = UuidFactoryFast.getInstance(); - private final System2 system2 = new TestSystem2().setNow(NOW); - private final MigrationStep underTest = new MigrateApplicationDefinitionsFromXmlToDb(db.database(), uuidFactory, system2); - - @Test - public void does_nothing_when_no_views_def_property() throws SQLException { - setupProjectsAndApps(); - - underTest.execute(); - - assertThat(db.countSql("select count(*) from app_projects")).isZero(); - assertThat(db.countSql("select count(*) from app_branch_project_branch")).isZero(); - assertThat(db.countSql("select count(*) from internal_properties where kee='views.def'")).isZero(); - } - - @Test - public void does_nothing_when_views_def_property_empty_string() throws SQLException { - setupProjectsAndApps(); - insertViewsDefInternalProperty(""); - - underTest.execute(); - - assertThat(db.countSql("select count(*) from app_projects")).isZero(); - assertThat(db.countSql("select count(*) from app_branch_project_branch")).isZero(); - } - - @Test - public void does_nothing_when_views_def_property_empty_views_content() throws SQLException { - setupProjectsAndApps(); - insertViewsDefInternalProperty(EMPTY_XML); - - underTest.execute(); - - assertThat(db.countSql("select count(*) from app_projects")).isZero(); - assertThat(db.countSql("select count(*) from app_branch_project_branch")).isZero(); - } - - @Test - public void throws_ISE_when_views_def_property_does_not_pass_validation() { - setupProjectsAndApps(); - insertViewsDefInternalProperty("abcdefghi"); - - assertThatThrownBy(underTest::execute) - .isInstanceOf(IllegalStateException.class) - .hasMessage("Failed to migrate views definitions property."); - - assertThat(db.countSql("select count(*) from app_projects")).isZero(); - assertThat(db.countSql("select count(*) from app_branch_project_branch")).isZero(); - } - - @Test - public void migrates_applications_to_new_tables() throws SQLException { - setupProjectsAndApps(); - insertViewsDefInternalProperty(COMPLEX_XML_BEFORE); - - underTest.execute(); - - assertThat(db.select("select uuid from projects")) - .extracting(r -> r.get("UUID")) - .containsExactlyInAnyOrder(PROJECT_1_UUID, PROJECT_2_UUID, APP_1_UUID, APP_2_UUID); - assertThat(db.select("select application_uuid, project_uuid from app_projects")) - .extracting(r -> r.get("APPLICATION_UUID"), r -> r.get("PROJECT_UUID")) - .containsExactlyInAnyOrder( - tuple(APP_1_UUID, PROJECT_1_UUID), - tuple(APP_1_UUID, PROJECT_2_UUID), - tuple(APP_2_UUID, PROJECT_1_UUID), - tuple(APP_2_UUID, PROJECT_2_UUID)); - assertThat(db.select("select application_uuid, project_uuid, application_branch_uuid, project_branch_uuid from app_branch_project_branch")) - .extracting(r -> r.get("APPLICATION_UUID"), r -> r.get("PROJECT_UUID"), r -> r.get("APPLICATION_BRANCH_UUID"), r -> r.get("PROJECT_BRANCH_UUID")) - .containsExactlyInAnyOrder( - tuple(APP_1_UUID, PROJECT_1_UUID, APP_1_BRANCH_1_UUID, PROJECT_1_BRANCH_1_UUID), - tuple(APP_1_UUID, PROJECT_2_UUID, APP_1_BRANCH_1_UUID, PROJECT_2_BRANCH_1_UUID), - tuple(APP_1_UUID, PROJECT_1_UUID, APP_1_BRANCH_2_UUID, PROJECT_1_BRANCH_2_UUID), - tuple(APP_1_UUID, PROJECT_2_UUID, APP_1_BRANCH_2_UUID, PROJECT_2_BRANCH_1_UUID), - tuple(APP_2_UUID, PROJECT_1_UUID, APP_2_BRANCH_1_UUID, PROJECT_1_BRANCH_1_UUID), - tuple(APP_2_UUID, PROJECT_2_UUID, APP_2_BRANCH_1_UUID, PROJECT_2_BRANCH_1_UUID)); - } - - @Test - public void migrates_applications_handling_project_duplications_to_new_tables() throws SQLException { - setupProjectsAndApps(); - insertViewsDefInternalProperty(APP_WITH_DUPLICATED_PROJECTS_XML); - - underTest.execute(); - - assertThat(db.select("select uuid from projects")) - .extracting(r -> r.get("UUID")) - .containsExactlyInAnyOrder(PROJECT_1_UUID, PROJECT_2_UUID, APP_1_UUID, APP_2_UUID); - assertThat(db.select("select application_uuid, project_uuid from app_projects")) - .extracting(r -> r.get("APPLICATION_UUID"), r -> r.get("PROJECT_UUID")) - .containsExactly(tuple(APP_1_UUID, PROJECT_1_UUID)); - assertThat(db.select("select application_uuid, project_uuid, application_branch_uuid, project_branch_uuid from app_branch_project_branch")) - .extracting(r -> r.get("APPLICATION_UUID"), r -> r.get("PROJECT_UUID"), r -> r.get("APPLICATION_BRANCH_UUID"), r -> r.get("PROJECT_BRANCH_UUID")) - .containsExactlyInAnyOrder( - tuple(APP_1_UUID, PROJECT_1_UUID, APP_1_BRANCH_1_UUID, PROJECT_1_BRANCH_1_UUID), - tuple(APP_1_UUID, PROJECT_1_UUID, APP_1_BRANCH_2_UUID, PROJECT_1_BRANCH_2_UUID)); - } - - @Test - public void migration_is_resilient() throws SQLException { - setupProjectsAndApps(); - insertViewsDefInternalProperty(COMPLEX_XML_BEFORE); - - // first attempt - underTest.execute(); - - // xml stays the same (stopped during migration) - updateViewsDefInternalProperty(COMPLEX_XML_BEFORE); - - // second attempt should not fail - underTest.execute(); - - assertThat(db.select("select uuid from projects")) - .extracting(r -> r.get("UUID")) - .containsExactlyInAnyOrder(PROJECT_1_UUID, PROJECT_2_UUID, APP_1_UUID, APP_2_UUID); - assertThat(db.select("select application_uuid, project_uuid from app_projects")) - .extracting(r -> r.get("APPLICATION_UUID"), r -> r.get("PROJECT_UUID")) - .containsExactlyInAnyOrder( - tuple(APP_1_UUID, PROJECT_1_UUID), - tuple(APP_1_UUID, PROJECT_2_UUID), - tuple(APP_2_UUID, PROJECT_1_UUID), - tuple(APP_2_UUID, PROJECT_2_UUID)); - assertThat(db.select("select application_uuid, project_uuid, application_branch_uuid, project_branch_uuid from app_branch_project_branch")) - .extracting(r -> r.get("APPLICATION_UUID"), r -> r.get("PROJECT_UUID"), r -> r.get("APPLICATION_BRANCH_UUID"), r -> r.get("PROJECT_BRANCH_UUID")) - .containsExactlyInAnyOrder( - tuple(APP_1_UUID, PROJECT_1_UUID, APP_1_BRANCH_1_UUID, PROJECT_1_BRANCH_1_UUID), - tuple(APP_1_UUID, PROJECT_2_UUID, APP_1_BRANCH_1_UUID, PROJECT_2_BRANCH_1_UUID), - tuple(APP_1_UUID, PROJECT_1_UUID, APP_1_BRANCH_2_UUID, PROJECT_1_BRANCH_2_UUID), - tuple(APP_1_UUID, PROJECT_2_UUID, APP_1_BRANCH_2_UUID, PROJECT_2_BRANCH_1_UUID), - tuple(APP_2_UUID, PROJECT_1_UUID, APP_2_BRANCH_1_UUID, PROJECT_1_BRANCH_1_UUID), - tuple(APP_2_UUID, PROJECT_2_UUID, APP_2_BRANCH_1_UUID, PROJECT_2_BRANCH_1_UUID)); - } - - @Test - public void migrates_applications_without_application_branches_to_new_tables() throws SQLException { - setupFullProject1(); - setupProject2(); - setupApp1WithNoBranches(); - insertViewsDefInternalProperty(APP_WITH_NO_BRANCHES_XML); - - underTest.execute(); - - assertThat(db.select("select uuid from projects")) - .extracting(r -> r.get("UUID")) - .containsExactlyInAnyOrder(PROJECT_1_UUID, PROJECT_2_UUID, APP_1_UUID); - assertThat(db.select("select application_uuid, project_uuid from app_projects")) - .extracting(r -> r.get("APPLICATION_UUID"), r -> r.get("PROJECT_UUID")) - .containsExactlyInAnyOrder( - tuple(APP_1_UUID, PROJECT_1_UUID), - tuple(APP_1_UUID, PROJECT_2_UUID)); - assertThat(db.countSql("select count(*) from app_branch_project_branch")).isZero(); - } - - @Test - public void skips_apps_that_exist_in_the_definition_but_does_not_exist_in_db() throws SQLException { - setupFullProject1(); - insertViewsDefInternalProperty(EMPTY_APP_XML); - - underTest.execute(); - - assertThat(db.select("select uuid from projects")) - .extracting(r -> r.get("UUID")) - .containsExactlyInAnyOrder(PROJECT_1_UUID); - assertThat(db.countSql("select count(*) from app_projects")).isZero(); - assertThat(db.countSql("select count(*) from app_branch_project_branch")).isZero(); - } - - @Test - public void migrates_app_with_0_projects_in_views_definition() throws SQLException { - setupFullProject1(); - setupProject2(); - setupApp1WithNoBranches(); - insertViewsDefInternalProperty(EMPTY_APP_XML); - - underTest.execute(); - - assertThat(db.select("select uuid from projects")) - .extracting(r -> r.get("UUID")) - .containsExactlyInAnyOrder(PROJECT_1_UUID, PROJECT_2_UUID, APP_1_UUID); - assertThat(db.countSql("select count(*) from app_projects")).isZero(); - assertThat(db.countSql("select count(*) from app_branch_project_branch")).isZero(); - } - - @Test - public void skips_apps_that_are_present_in_views_definition_but_not_in_db() throws SQLException { - setupFullProject1(); - setupProject2(); - setupApp1WithTwoBranches(); - insertViewsDefInternalProperty(COMPLEX_XML_BEFORE); - - underTest.execute(); - - assertThat(db.select("select uuid from projects")) - .extracting(r -> r.get("UUID")) - .containsExactlyInAnyOrder(PROJECT_1_UUID, PROJECT_2_UUID, APP_1_UUID); - assertThat(db.select("select application_uuid, project_uuid from app_projects")) - .extracting(r -> r.get("APPLICATION_UUID"), r -> r.get("PROJECT_UUID")) - .containsExactlyInAnyOrder( - tuple(APP_1_UUID, PROJECT_1_UUID), - tuple(APP_1_UUID, PROJECT_2_UUID)); - assertThat(db.select("select application_uuid, project_uuid, application_branch_uuid, project_branch_uuid from app_branch_project_branch")) - .extracting(r -> r.get("APPLICATION_UUID"), r -> r.get("PROJECT_UUID"), r -> r.get("APPLICATION_BRANCH_UUID"), r -> r.get("PROJECT_BRANCH_UUID")) - .containsExactlyInAnyOrder( - tuple(APP_1_UUID, PROJECT_1_UUID, APP_1_BRANCH_1_UUID, PROJECT_1_BRANCH_1_UUID), - tuple(APP_1_UUID, PROJECT_2_UUID, APP_1_BRANCH_1_UUID, PROJECT_2_BRANCH_1_UUID), - tuple(APP_1_UUID, PROJECT_1_UUID, APP_1_BRANCH_2_UUID, PROJECT_1_BRANCH_2_UUID), - tuple(APP_1_UUID, PROJECT_2_UUID, APP_1_BRANCH_2_UUID, PROJECT_2_BRANCH_1_UUID)); - } - - @Test - public void skips_app_branches_that_are_present_in_views_definition_but_not_in_db() throws SQLException { - setupFullProject1(); - setupProject2(); - setupApp1WithNoBranches(); - setupApp2(); - insertViewsDefInternalProperty(COMPLEX_XML_BEFORE); - - underTest.execute(); - - assertThat(db.select("select uuid from projects")) - .extracting(r -> r.get("UUID")) - .containsExactlyInAnyOrder(PROJECT_1_UUID, PROJECT_2_UUID, APP_1_UUID, APP_2_UUID); - assertThat(db.select("select application_uuid, project_uuid from app_projects")) - .extracting(r -> r.get("APPLICATION_UUID"), r -> r.get("PROJECT_UUID")) - .containsExactlyInAnyOrder( - tuple(APP_1_UUID, PROJECT_1_UUID), - tuple(APP_1_UUID, PROJECT_2_UUID), - tuple(APP_2_UUID, PROJECT_1_UUID), - tuple(APP_2_UUID, PROJECT_2_UUID)); - assertThat(db.select("select application_uuid, project_uuid, application_branch_uuid, project_branch_uuid from app_branch_project_branch")) - .extracting(r -> r.get("APPLICATION_UUID"), r -> r.get("PROJECT_UUID"), r -> r.get("APPLICATION_BRANCH_UUID"), r -> r.get("PROJECT_BRANCH_UUID")) - .containsExactlyInAnyOrder( - tuple(APP_2_UUID, PROJECT_1_UUID, APP_2_BRANCH_1_UUID, PROJECT_1_BRANCH_1_UUID), - tuple(APP_2_UUID, PROJECT_2_UUID, APP_2_BRANCH_1_UUID, PROJECT_2_BRANCH_1_UUID)); - } - - @Test - public void skips_projects_that_are_present_in_apps_views_definitions_but_not_in_db() throws SQLException { - setupPartialProject1(); - setupApp1WithTwoBranches(); - setupApp2(); - insertViewsDefInternalProperty(COMPLEX_XML_BEFORE); - - underTest.execute(); - - assertThat(db.select("select uuid from projects")) - .extracting(r -> r.get("UUID")) - .containsExactlyInAnyOrder(PROJECT_1_UUID, APP_1_UUID, APP_2_UUID); - assertThat(db.select("select application_uuid, project_uuid from app_projects")) - .extracting(r -> r.get("APPLICATION_UUID"), r -> r.get("PROJECT_UUID")) - .containsExactlyInAnyOrder( - tuple(APP_1_UUID, PROJECT_1_UUID), - tuple(APP_2_UUID, PROJECT_1_UUID)); - assertThat(db.select("select application_uuid, project_uuid, application_branch_uuid, project_branch_uuid from app_branch_project_branch")) - .extracting(r -> r.get("APPLICATION_UUID"), r -> r.get("PROJECT_UUID"), r -> r.get("APPLICATION_BRANCH_UUID"), r -> r.get("PROJECT_BRANCH_UUID")) - .containsExactlyInAnyOrder( - tuple(APP_1_UUID, PROJECT_1_UUID, APP_1_BRANCH_1_UUID, PROJECT_1_BRANCH_1_UUID), - tuple(APP_2_UUID, PROJECT_1_UUID, APP_2_BRANCH_1_UUID, PROJECT_1_BRANCH_1_UUID)); - } - - @Test - public void skips_projects_branches_that_are_present_in_apps_views_definitions_but_not_in_db() throws SQLException { - setupPartialProject1(); - setupProject2(); - setupApp1WithTwoBranches(); - setupApp2(); - insertViewsDefInternalProperty(COMPLEX_XML_BEFORE); - - underTest.execute(); - - assertThat(db.select("select uuid from projects")) - .extracting(r -> r.get("UUID")) - .containsExactlyInAnyOrder(PROJECT_1_UUID, PROJECT_2_UUID, APP_1_UUID, APP_2_UUID); - assertThat(db.select("select application_uuid, project_uuid from app_projects")) - .extracting(r -> r.get("APPLICATION_UUID"), r -> r.get("PROJECT_UUID")) - .containsExactlyInAnyOrder( - tuple(APP_1_UUID, PROJECT_1_UUID), - tuple(APP_1_UUID, PROJECT_2_UUID), - tuple(APP_2_UUID, PROJECT_1_UUID), - tuple(APP_2_UUID, PROJECT_2_UUID)); - assertThat(db.select("select application_uuid, project_uuid, application_branch_uuid, project_branch_uuid from app_branch_project_branch")) - .extracting(r -> r.get("APPLICATION_UUID"), r -> r.get("PROJECT_UUID"), r -> r.get("APPLICATION_BRANCH_UUID"), r -> r.get("PROJECT_BRANCH_UUID")) - .containsExactlyInAnyOrder( - tuple(APP_1_UUID, PROJECT_1_UUID, APP_1_BRANCH_1_UUID, PROJECT_1_BRANCH_1_UUID), - tuple(APP_1_UUID, PROJECT_2_UUID, APP_1_BRANCH_1_UUID, PROJECT_2_BRANCH_1_UUID), - tuple(APP_1_UUID, PROJECT_2_UUID, APP_1_BRANCH_2_UUID, PROJECT_2_BRANCH_1_UUID), - tuple(APP_2_UUID, PROJECT_1_UUID, APP_2_BRANCH_1_UUID, PROJECT_1_BRANCH_1_UUID), - tuple(APP_2_UUID, PROJECT_2_UUID, APP_2_BRANCH_1_UUID, PROJECT_2_BRANCH_1_UUID)); - } - - @Test - public void removes_application_definitions_from_xml() throws SQLException { - setupProjectsAndApps(); - insertViewsDefInternalProperty(COMPLEX_XML_BEFORE); - - underTest.execute(); - - assertThat(db.countSql("select count(*) from internal_properties where kee='views.def'")).isOne(); - assertViewsXmlDefinitionSimilar(COMPLEX_XML_AFTER, false); - } - - @Test - public void removes_application_definitions_from_large_xmls() throws SQLException { - setupProjectsAndApps(); - insertViewsDefInternalProperty(LARGE_XML_BEFORE_AND_AFTER); - - underTest.execute(); - - assertThat(db.countSql("select count(*) from internal_properties where kee='views.def'")).isOne(); - assertViewsXmlDefinitionSimilar(LARGE_XML_BEFORE_AND_AFTER, true); - } - - @Test - public void does_not_change_the_xml_if_there_are_no_application_definitions() throws SQLException { - setupProjectsAndApps(); - insertViewsDefInternalProperty(EMPTY_XML); - - underTest.execute(); - - assertThat(db.countSql("select count(*) from internal_properties where kee='views.def'")).isOne(); - assertViewsXmlDefinitionSimilar(EMPTY_XML, false); - } - - private void setupProjectsAndApps() { - setupFullProject1(); - setupProject2(); - setupApp1WithTwoBranches(); - setupApp2(); - } - - private void setupFullProject1() { - setupPartialProject1(); - insertBranch(PROJECT_1_BRANCH_2_UUID, PROJECT_1_UUID, "proj1-branch-2"); - } - - private void setupPartialProject1() { - insertProject(PROJECT_1_UUID, "proj1-key", QUALIFIER_PROJECT); - insertBranch(PROJECT_1_MASTER_BRANCH_UUID, PROJECT_1_UUID, "master"); - insertBranch(PROJECT_1_BRANCH_1_UUID, PROJECT_1_UUID, "proj1-branch-1"); - } - - private void setupProject2() { - insertProject(PROJECT_2_UUID, "proj2-key", QUALIFIER_PROJECT); - insertBranch(PROJECT_2_MASTER_BRANCH_UUID, PROJECT_2_UUID, "master"); - insertBranch(PROJECT_2_BRANCH_1_UUID, PROJECT_2_UUID, "m1"); - } - - private void setupApp1WithNoBranches() { - insertProject(APP_1_UUID, "app1-key", QUALIFIER_APP); - insertBranch(APP_1_MASTER_BRANCH_UUID, APP_1_UUID, "master"); - } - - private void setupApp1WithOneBranch() { - setupApp1WithNoBranches(); - insertBranch(APP_1_BRANCH_1_UUID, APP_1_UUID, "app1-branch1"); - } - - private void setupApp1WithTwoBranches() { - setupApp1WithOneBranch(); - insertBranch(APP_1_BRANCH_2_UUID, APP_1_UUID, "app1-branch2"); - } - - private void setupApp2() { - insertProject(APP_2_UUID, "app2-key", QUALIFIER_APP); - insertBranch(APP_2_MASTER_BRANCH_UUID, APP_2_UUID, "master"); - insertBranch(APP_2_BRANCH_1_UUID, APP_2_UUID, "m1"); - } - - private void insertViewsDefInternalProperty(@Nullable String xml) { - String valueColumn = "text_value"; - if (xml != null && xml.length() > TEXT_VALUE_MAX_LENGTH) { - valueColumn = "clob_value"; - } - - db.executeInsert("internal_properties", - "kee", "views.def", - "is_empty", "false", - valueColumn, xml, - "created_at", system2.now()); - } - - private void updateViewsDefInternalProperty(@Nullable String xml) { - db.executeUpdateSql("update internal_properties set text_value = ? where kee = 'views.def'", - xml); - } - - private void insertProject(String uuid, String key, String qualifier) { - db.executeInsert("PROJECTS", - "UUID", uuid, - "KEE", key, - "QUALIFIER", qualifier, - "ORGANIZATION_UUID", uuid + "-key", - "TAGS", "tag1", - "PRIVATE", Boolean.toString(false), - "UPDATED_AT", System2.INSTANCE.now()); - } - - private void insertBranch(String uuid, String projectUuid, String key) { - db.executeInsert( - "PROJECT_BRANCHES", - "UUID", uuid, - "PROJECT_UUID", projectUuid, - "KEE", key, - "BRANCH_TYPE", "BRANCH", - "MERGE_BRANCH_UUID", null, - "CREATED_AT", System2.INSTANCE.now(), - "UPDATED_AT", System2.INSTANCE.now(), - "NEED_ISSUE_SYNC", Boolean.toString(false)); - } - - private void assertViewsXmlDefinitionSimilar(final String expectedValue, final boolean expectClob) { - Map result = db.selectFirst("select text_value, clob_value from internal_properties where kee='views.def'"); - String textValue = (String) result.get("TEXT_VALUE"); - String clobValue = (String) result.get("CLOB_VALUE"); - - String existingValue; - if (expectClob) { - existingValue = clobValue; - assertThat(textValue).isNull(); - } else { - existingValue = textValue; - assertThat(clobValue).isNull(); - } - - Diff diff = DiffBuilder - .compare(Input.fromString(expectedValue)) - .withTest(Input.fromString(existingValue)) - .ignoreWhitespace() - .ignoreComments() - .checkForSimilar() - .build(); - assertThat(diff.getDifferences()) - .as(expectedValue) - .isEmpty(); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v86/MoveDefaultTemplatesToInternalPropertiesTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v86/MoveDefaultTemplatesToInternalPropertiesTest.java deleted file mode 100644 index b01562a9708..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v86/MoveDefaultTemplatesToInternalPropertiesTest.java +++ /dev/null @@ -1,150 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v86; - -import java.sql.SQLException; -import javax.annotation.Nullable; -import org.assertj.core.groups.Tuple; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.api.impl.utils.TestSystem2; -import org.sonar.api.utils.System2; -import org.sonar.core.util.UuidFactory; -import org.sonar.core.util.UuidFactoryFast; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DataChange; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatThrownBy; -import static org.assertj.core.api.Assertions.tuple; - -public class MoveDefaultTemplatesToInternalPropertiesTest { - - private static final long NOW = 100_000_000_000L; - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(MoveDefaultTemplatesToInternalPropertiesTest.class, "schema.sql"); - - private final UuidFactory uuidFactory = UuidFactoryFast.getInstance(); - private final System2 system2 = new TestSystem2().setNow(NOW); - - private final DataChange underTest = new MoveDefaultTemplatesToInternalProperties(db.database(), system2); - - @Test - public void create_internal_properties_for_all_components() throws SQLException { - insertDefaultOrganization("PRJ", "PORT", "APP"); - - underTest.execute(); - - assertInternalProperties( - tuple("defaultTemplate.prj", "PRJ", NOW), - tuple("defaultTemplate.port", "PORT", NOW), - tuple("defaultTemplate.app", "APP", NOW) - ); - } - - @Test - public void create_internal_properties_when_only_template_for_project() throws SQLException { - insertDefaultOrganization("PRJ", null, null); - - underTest.execute(); - - assertInternalProperties( - tuple("defaultTemplate.prj", "PRJ", NOW)); - } - - @Test - public void create_internal_properties_when_template_for_project_and_portfolio() throws SQLException { - insertDefaultOrganization("PRJ", "PORT", null); - - underTest.execute(); - - assertInternalProperties( - tuple("defaultTemplate.prj", "PRJ", NOW), - tuple("defaultTemplate.port", "PORT", NOW) - ); - } - - @Test - public void create_internal_properties_when_template_for_project_and_application() throws SQLException { - insertDefaultOrganization("PRJ", null, "APP"); - - underTest.execute(); - - assertInternalProperties( - tuple("defaultTemplate.prj", "PRJ", NOW), - tuple("defaultTemplate.app", "APP", NOW) - ); - } - - @Test - public void do_nothing_when_permission_template_for_project_is_missing() throws SQLException { - insertDefaultOrganization(null, null, "APP"); - - underTest.execute(); - - assertThat(db.countRowsOfTable("internal_properties")).isZero(); - } - - @Test - public void migration_is_reentrant() throws SQLException { - insertDefaultOrganization("PRJ", "PORT", "APP"); - - underTest.execute(); - underTest.execute(); - - assertInternalProperties( - tuple("defaultTemplate.prj", "PRJ", NOW), - tuple("defaultTemplate.port", "PORT", NOW), - tuple("defaultTemplate.app", "APP", NOW) - ); - } - - @Test - public void fail_when_default_organization_is_missing() { - assertThatThrownBy(underTest::execute) - .isInstanceOf(IllegalStateException.class) - .hasMessage("Default organization is missing"); - } - - private void assertInternalProperties(Tuple... tuples) { - assertThat(db.select("select kee, text_value, created_at from internal_properties")) - .extracting(m -> m.get("KEE"), m -> m.get("TEXT_VALUE"), m -> m.get("CREATED_AT")) - .containsExactlyInAnyOrder(tuples); - } - - private void insertDefaultOrganization(@Nullable String defaultPermissionTemplateForProject, @Nullable String defaultPermissionTemplateForPortfolio, - @Nullable String defaultPermissionTemplateForApplication) { - String uuid = uuidFactory.create(); - db.executeInsert("organizations", - "uuid", uuid, - "kee", "default-organization", - "name", "name" + uuid, - "default_perm_template_project", defaultPermissionTemplateForProject, - "default_perm_template_port", defaultPermissionTemplateForPortfolio, - "default_perm_template_app", defaultPermissionTemplateForApplication, - "default_quality_gate_uuid", uuid, - "new_project_private", true, - "subscription", uuid, - "created_at", NOW, - "updated_at", NOW); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v86/PopulateResetPasswordDefaultValueTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v86/PopulateResetPasswordDefaultValueTest.java deleted file mode 100644 index 507bafce015..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v86/PopulateResetPasswordDefaultValueTest.java +++ /dev/null @@ -1,121 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v86; - -import java.sql.SQLException; -import javax.annotation.Nullable; -import org.assertj.core.groups.Tuple; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.api.impl.utils.TestSystem2; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -import static java.util.stream.Collectors.toList; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.tuple; - -public class PopulateResetPasswordDefaultValueTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(PopulateResetPasswordDefaultValueTest.class, "schema.sql"); - - private final TestSystem2 system2 = new TestSystem2(); - private final long NOW = 1606375781L; - - private MigrationStep underTest = new PopulateResetPasswordDefaultValue(db.database(), system2); - - @Before - public void before() { - system2.setNow(NOW); - } - - @Test - public void execute_on_empty_db() throws SQLException { - underTest.execute(); - - assertThat(db.countRowsOfTable("users")).isZero(); - } - - @Test - public void execute_on_db_with_user_rows() throws SQLException { - insertUser("uuid-1", null, NOW); - insertUser("uuid-2", null, NOW); - insertUser("uuid-3", null, NOW); - - long expectedUpdatedRowTime = 2_000_000_000L; - system2.setNow(expectedUpdatedRowTime); - - underTest.execute(); - - assertThatUserResetPasswordFlagIsEqualTo( - tuple("uuid-1", false, expectedUpdatedRowTime), - tuple("uuid-2", false, expectedUpdatedRowTime), - tuple("uuid-3", false, expectedUpdatedRowTime)); - } - - @Test - public void does_not_update_already_set_flags() throws SQLException { - insertUser("uuid-1", true, NOW); - insertUser("uuid-2", false, NOW); - insertUser("uuid-3", null, NOW); - - long expectedUpdatedRowTime = 2_000_000_000L; - system2.setNow(expectedUpdatedRowTime); - - underTest.execute(); - - insertUser("uuid-4", null, NOW); - // re-entrant - underTest.execute(); - - assertThatUserResetPasswordFlagIsEqualTo( - tuple("uuid-1", true, NOW), - tuple("uuid-2", false, NOW), - tuple("uuid-3", false, expectedUpdatedRowTime), - tuple("uuid-4", false, expectedUpdatedRowTime)); - } - - private void assertThatUserResetPasswordFlagIsEqualTo(Tuple... tuples) { - assertThat(db.select("select uuid, reset_password, updated_at from users") - .stream() - .map(r -> tuple(r.get("UUID"), getBooleanValue(r.get("RESET_PASSWORD")), r.get("UPDATED_AT"))) - .collect(toList())) - .containsExactlyInAnyOrder(tuples); - } - - private Boolean getBooleanValue(@Nullable Object value) { - return value == null ? null : Boolean.parseBoolean(value.toString()); - } - - private void insertUser(String uuid, @Nullable Boolean resetPassword, long updatedAt) { - db.executeInsert("users", - "UUID", uuid, - "LOGIN", uuid + "login", - "EXTERNAL_LOGIN", uuid + "-external-login", - "EXTERNAL_IDENTITY_PROVIDER", "sonarqube", - "EXTERNAL_ID", uuid + "-external-id", - "IS_ROOT", false, - "RESET_PASSWORD", resetPassword, - "ONBOARDED", false, - "UPDATED_AT", updatedAt); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v86/SecureGitlabSecretParametersTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v86/SecureGitlabSecretParametersTest.java deleted file mode 100644 index db84c728415..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v86/SecureGitlabSecretParametersTest.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v86; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.api.utils.System2; -import org.sonar.core.util.UuidFactory; -import org.sonar.core.util.UuidFactoryFast; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DataChange; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.tuple; - -public class SecureGitlabSecretParametersTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(SecureGitlabSecretParametersTest.class, "schema.sql"); - - private final UuidFactory uuidFactory = UuidFactoryFast.getInstance(); - - private final DataChange underTest = new SecureGitlabSecretParameters(db.database()); - - @Test - public void secure_gitlab_secret_parameters() throws SQLException { - insertGitlabProperties(); - - underTest.execute(); - - assertThat(db.select("select * from PROPERTIES")) - .extracting(r -> r.get("PROP_KEY"), r -> r.get("TEXT_VALUE")) - .containsExactlyInAnyOrder( - tuple("sonar.auth.gitlab.secret.secured", "secret secret"), - tuple("sonar.auth.gitlab.applicationId.secured", "secret applicationId")); - } - - private void insertGitlabProperties() { - db.executeInsert("PROPERTIES", - "prop_key", "sonar.auth.gitlab.secret", - "is_empty", false, - "text_value", "secret secret", - "uuid", uuidFactory.create(), - "created_at", System2.INSTANCE.now()); - db.executeInsert("PROPERTIES", - "prop_key", "sonar.auth.gitlab.applicationId", - "is_empty", false, - "text_value", "secret applicationId", - "uuid", uuidFactory.create(), - "created_at", System2.INSTANCE.now()); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v86/SetForceAuthenticationSettingsTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v86/SetForceAuthenticationSettingsTest.java deleted file mode 100644 index 717e6246212..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v86/SetForceAuthenticationSettingsTest.java +++ /dev/null @@ -1,120 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v86; - -import java.sql.SQLException; -import java.util.Optional; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.api.config.internal.Settings; -import org.sonar.api.impl.utils.TestSystem2; -import org.sonar.api.utils.System2; -import org.sonar.core.util.UuidFactoryFast; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DataChange; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -public class SetForceAuthenticationSettingsTest { - - private static final long NOW = 100_000_000_000L; - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(SetForceAuthenticationSettingsTest.class, "schema.sql"); - - private final System2 system2 = new TestSystem2().setNow(NOW); - - private final Settings settingsMock = mock(Settings.class); - - private final DataChange underTest = new SetForceAuthenticationSettings(db.database(), system2, UuidFactoryFast.getInstance(), settingsMock); - - @Test - public void insert_force_auth_property_based_on_settings_when_false() throws SQLException { - when(settingsMock.getRawString(any())).thenReturn(Optional.of("false")); - underTest.execute(); - - assertThatForceAuthenticationEquals("false"); - } - - @Test - public void insert_force_auth_property_based_on_settings_when_true() throws SQLException { - when(settingsMock.getRawString(any())).thenReturn(Optional.of("true")); - underTest.execute(); - - assertThatForceAuthenticationEquals("true"); - } - - @Test - public void insert_force_auth_property_based_on_settings_when_empty() throws SQLException { - when(settingsMock.getRawString(any())).thenReturn(Optional.empty()); - underTest.execute(); - - assertThatForceAuthenticationEquals("false"); - } - - @Test - public void insert_force_auth_property_if_row_not_exists() throws SQLException { - underTest.execute(); - - assertThatForceAuthenticationEquals("false"); - } - - @Test - public void migration_is_reentrant() throws SQLException { - underTest.execute(); - // re-entrant - underTest.execute(); - - assertThatForceAuthenticationEquals("false"); - } - - @Test - public void do_nothing_if_force_auth_property_exists_with_value_false() throws SQLException { - insertProperty("uuid-1", "sonar.forceAuthentication", "false"); - underTest.execute(); - - assertThatForceAuthenticationEquals("false"); - } - - @Test - public void do_nothing_if_force_auth_property_exists_with_value_true() throws SQLException { - insertProperty("uuid-1", "sonar.forceAuthentication", "true"); - underTest.execute(); - - assertThatForceAuthenticationEquals("true"); - } - - private void assertThatForceAuthenticationEquals(String s) { - assertThat(db.selectFirst("select p.text_value from properties p where p.prop_key = 'sonar.forceAuthentication'")) - .containsEntry("TEXT_VALUE", s); - } - - private void insertProperty(String uuid, String key, String textValue) { - db.executeInsert("properties", - "uuid", uuid, - "prop_key", key, - "is_empty", false, - "text_value", textValue, - "created_at", NOW); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v86/UpdateChangeDataOfQProfileChangesTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v86/UpdateChangeDataOfQProfileChangesTest.java deleted file mode 100644 index 92791450d62..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v86/UpdateChangeDataOfQProfileChangesTest.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v86; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.core.util.Uuids; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DataChange; - -import static org.assertj.core.api.Assertions.assertThat; - -public class UpdateChangeDataOfQProfileChangesTest { - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(UpdateChangeDataOfQProfileChangesTest.class, "schema.sql"); - - private DataChange underTest = new UpdateChangeDataOfQProfileChanges(db.database()); - - @Test - public void change_ruleId_to_ruleUuid() throws SQLException { - insertQProfileChanges("key-1", "severity=MAJOR;ruleUuid=AXJVoXWDOFGkZYIS4z4D"); - insertQProfileChanges("key-2", "severity=MAJOR;ruleId=12915"); - insertQProfileChanges("key-3", "severity=MAJOR;ruleId=12915;something"); - insertQProfileChanges("key-4", "ruleId=12915;something"); - - underTest.execute(); - - assertThatQProfileMigrated("key-1", "severity=MAJOR;ruleUuid=AXJVoXWDOFGkZYIS4z4D"); - assertThatQProfileMigrated("key-2", "severity=MAJOR;ruleUuid=12915"); - assertThatQProfileMigrated("key-3", "severity=MAJOR;ruleUuid=12915;something"); - assertThatQProfileMigrated("key-4", "ruleUuid=12915;something"); - } - - @Test - public void migration_is_reentrant() throws SQLException { - insertQProfileChanges("key-1", "severity=MAJOR;ruleUuid=AXJVoXWDOFGkZYIS4z4D"); - insertQProfileChanges("key-2", "severity=MAJOR;ruleId=12915"); - insertQProfileChanges("key-3", "severity=MAJOR;ruleId=12915;something"); - insertQProfileChanges("key-4", "ruleId=12915;something"); - - underTest.execute(); - // re-entrant - underTest.execute(); - - assertThatQProfileMigrated("key-1", "severity=MAJOR;ruleUuid=AXJVoXWDOFGkZYIS4z4D"); - assertThatQProfileMigrated("key-2", "severity=MAJOR;ruleUuid=12915"); - assertThatQProfileMigrated("key-3", "severity=MAJOR;ruleUuid=12915;something"); - assertThatQProfileMigrated("key-4", "ruleUuid=12915;something"); - } - - private void assertThatQProfileMigrated(String key, String changeData) { - assertThat(db.select("select qpc.kee, qpc.change_data " - + "from qprofile_changes qpc where qpc.kee = '" + key + "'").stream().findFirst()) - .isNotEmpty() - .hasValueSatisfying(stringObjectMap -> assertThat(stringObjectMap) - .extractingByKeys("KEE", "CHANGE_DATA") - .contains(key, changeData)); - - } - - private void insertQProfileChanges(String kee, String changeData) { - db.executeInsert("qprofile_changes", - "kee", kee, - "rules_profile_uuid", Uuids.createFast(), - "change_type", "any", - "change_data", changeData, - "created_at", System.currentTimeMillis()); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v87/AddMonorepoColumnToProjectAlmSettingsTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v87/AddMonorepoColumnToProjectAlmSettingsTableTest.java deleted file mode 100644 index 39084cbacb8..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v87/AddMonorepoColumnToProjectAlmSettingsTableTest.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v87; - -import java.sql.SQLException; -import java.sql.Types; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.assertj.core.api.Assertions.assertThat; - -public class AddMonorepoColumnToProjectAlmSettingsTableTest { - private static final String TABLE_NAME = "project_alm_settings"; - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(AddMonorepoColumnToProjectAlmSettingsTableTest.class, "schema.sql"); - - private final DdlChange underTest = new AddMonorepoColumnToProjectAlmSettingsTable(db.database()); - - @Test - public void add_monorepo_column() throws SQLException { - insertProjectAlmSettings(1); - insertProjectAlmSettings(2); - insertProjectAlmSettings(3); - - underTest.execute(); - - db.assertColumnDefinition("project_alm_settings", "monorepo", Types.BOOLEAN, null, true); - assertThat(db.countRowsOfTable(TABLE_NAME)).isEqualTo(3); - } - - private void insertProjectAlmSettings(int id) { - db.executeInsert("project_alm_settings", - "UUID", "uuid-" + id, - "ALM_SETTING_UUID", "ALM_SETTING_UUID", - "PROJECT_UUID", "PROJECT_UUID-" + id, - "ALM_REPO", "ALM_REPO", - "ALM_SLUG", "ALM_SLUG", - "UPDATED_AT", 12342342, - "CREATED_AT",1232342 - ); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v87/DbVersion87Test.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v87/DbVersion87Test.java deleted file mode 100644 index d495c37873c..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v87/DbVersion87Test.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v87; - -import org.junit.Test; -import org.sonar.server.platform.db.migration.version.DbVersion; - -import static org.sonar.server.platform.db.migration.version.DbVersionTestUtils.verifyMigrationNotEmpty; -import static org.sonar.server.platform.db.migration.version.DbVersionTestUtils.verifyMinimumMigrationNumber; - -public class DbVersion87Test { - - private final DbVersion underTest = new DbVersion87(); - - @Test - public void migrationNumber_starts_at_4200() { - verifyMinimumMigrationNumber(underTest, 4200); - } - - @Test - public void verify_migration_count() { - verifyMigrationNotEmpty(underTest); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v87/DropAlmAppInstallsTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v87/DropAlmAppInstallsTableTest.java deleted file mode 100644 index 768ab0a3f8f..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v87/DropAlmAppInstallsTableTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v87; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.sql.DbPrimaryKeyConstraintFinder; -import org.sonar.server.platform.db.migration.sql.DropPrimaryKeySqlGenerator; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -public class DropAlmAppInstallsTableTest { - private static final String TABLE_NAME = "alm_app_installs"; - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DropAlmAppInstallsTableTest.class, "schema.sql"); - private final DropPrimaryKeySqlGenerator dropPrimaryKeySqlGenerator = new DropPrimaryKeySqlGenerator(db.database(), new DbPrimaryKeyConstraintFinder(db.database())); - - private MigrationStep underTest = new DropAlmAppInstallsTable(db.database(), dropPrimaryKeySqlGenerator); - - @Test - public void execute() throws SQLException { - db.assertTableExists(TABLE_NAME); - underTest.execute(); - db.assertTableDoesNotExist(TABLE_NAME); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v87/DropDescriptionInProjectMeasuresTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v87/DropDescriptionInProjectMeasuresTest.java deleted file mode 100644 index dfa07888f21..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v87/DropDescriptionInProjectMeasuresTest.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v87; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -public class DropDescriptionInProjectMeasuresTest { - - @Rule - public CoreDbTester dbTester = CoreDbTester.createForSchema(DropDescriptionInProjectMeasuresTest.class, "schema.sql"); - - private MigrationStep underTest = new DropDescriptionInProjectMeasures(dbTester.database()); - - @Test - public void column_has_been_dropped() throws SQLException { - underTest.execute(); - dbTester.assertColumnDoesNotExist("project_measures", "description"); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v87/DropOrgMembersTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v87/DropOrgMembersTableTest.java deleted file mode 100644 index 2da0bcf4621..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v87/DropOrgMembersTableTest.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v87; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.sql.DbPrimaryKeyConstraintFinder; -import org.sonar.server.platform.db.migration.sql.DropPrimaryKeySqlGenerator; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -public class DropOrgMembersTableTest { - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DropOrgMembersTableTest.class, "schema.sql"); - private final DropPrimaryKeySqlGenerator dropPrimaryKeySqlGenerator = new DropPrimaryKeySqlGenerator(db.database(), new DbPrimaryKeyConstraintFinder(db.database())); - - private final MigrationStep underTest = new DropOrgMembersTable(db.database(), dropPrimaryKeySqlGenerator); - - @Test - public void table_is_dropped() throws SQLException { - db.assertTableExists("organization_members"); - underTest.execute(); - db.assertTableDoesNotExist("organization_members"); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v87/DropOrgQualityGatesTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v87/DropOrgQualityGatesTableTest.java deleted file mode 100644 index 031e7efb2c9..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v87/DropOrgQualityGatesTableTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v87; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.sql.DbPrimaryKeyConstraintFinder; -import org.sonar.server.platform.db.migration.sql.DropPrimaryKeySqlGenerator; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -public class DropOrgQualityGatesTableTest { - private static final String TABLE_NAME = "org_quality_gates"; - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DropOrgQualityGatesTableTest.class, "schema.sql"); - private final DropPrimaryKeySqlGenerator dropPrimaryKeySqlGenerator = new DropPrimaryKeySqlGenerator(db.database(), new DbPrimaryKeyConstraintFinder(db.database())); - - private MigrationStep underTest = new DropOrgQualityGatesTable(db.database(), dropPrimaryKeySqlGenerator); - - @Test - public void execute() throws SQLException { - db.assertTableExists(TABLE_NAME); - underTest.execute(); - db.assertTableDoesNotExist(TABLE_NAME); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v87/DropOrganizationAlmBindingsTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v87/DropOrganizationAlmBindingsTableTest.java deleted file mode 100644 index a0bc166dea6..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v87/DropOrganizationAlmBindingsTableTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v87; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.sql.DbPrimaryKeyConstraintFinder; -import org.sonar.server.platform.db.migration.sql.DropPrimaryKeySqlGenerator; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -public class DropOrganizationAlmBindingsTableTest { - private static final String TABLE_NAME = "organization_alm_bindings"; - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DropOrganizationAlmBindingsTableTest.class, "schema.sql"); - private final DropPrimaryKeySqlGenerator dropPrimaryKeySqlGenerator = new DropPrimaryKeySqlGenerator(db.database(), new DbPrimaryKeyConstraintFinder(db.database())); - - private MigrationStep underTest = new DropOrganizationAlmBindingsTable(db.database(), dropPrimaryKeySqlGenerator); - - @Test - public void execute() throws SQLException { - db.assertTableExists(TABLE_NAME); - underTest.execute(); - db.assertTableDoesNotExist(TABLE_NAME); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v87/DropOrganizationInComponentsTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v87/DropOrganizationInComponentsTest.java deleted file mode 100644 index c3b86cd6bc1..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v87/DropOrganizationInComponentsTest.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v87; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -public class DropOrganizationInComponentsTest { - @Rule - public CoreDbTester dbTester = CoreDbTester.createForSchema(DropOrganizationInComponentsTest.class, "schema.sql"); - - private final MigrationStep underTest = new DropOrganizationInComponents(dbTester.database()); - - @Test - public void column_has_been_dropped() throws SQLException { - underTest.execute(); - dbTester.assertColumnDoesNotExist("components", "organization_uuid"); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v87/DropOrganizationInProjectsTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v87/DropOrganizationInProjectsTest.java deleted file mode 100644 index a4afa12abd1..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v87/DropOrganizationInProjectsTest.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v87; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -public class DropOrganizationInProjectsTest { - @Rule - public CoreDbTester dbTester = CoreDbTester.createForSchema(DropOrganizationInProjectsTest.class, "schema.sql"); - - private final MigrationStep underTest = new DropOrganizationInProjects(dbTester.database()); - - @Test - public void column_has_been_dropped() throws SQLException { - underTest.execute(); - dbTester.assertColumnDoesNotExist("projects", "organization_uuid"); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v87/DropOrganizationInWebhooksTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v87/DropOrganizationInWebhooksTest.java deleted file mode 100644 index d5545ae3f51..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v87/DropOrganizationInWebhooksTest.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v87; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -public class DropOrganizationInWebhooksTest { - @Rule - public CoreDbTester dbTester = CoreDbTester.createForSchema(DropOrganizationInWebhooksTest.class, "schema.sql"); - - private final MigrationStep underTest = new DropOrganizationInWebhooks(dbTester.database()); - - @Test - public void column_has_been_dropped() throws SQLException { - underTest.execute(); - dbTester.assertIndexDoesNotExist("webhooks", "organization_webhook"); - dbTester.assertIndexDoesNotExist("webhooks", "project_webhook"); - dbTester.assertColumnDoesNotExist("webhooks", "organization_uuid"); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v87/DropOrganizationsTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v87/DropOrganizationsTableTest.java deleted file mode 100644 index e86acbd1fd3..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v87/DropOrganizationsTableTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v87; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.sql.DbPrimaryKeyConstraintFinder; -import org.sonar.server.platform.db.migration.sql.DropPrimaryKeySqlGenerator; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -public class DropOrganizationsTableTest { - private static final String TABLE_NAME = "organizations"; - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DropOrganizationsTableTest.class, "schema.sql"); - private final DropPrimaryKeySqlGenerator dropPrimaryKeySqlGenerator = new DropPrimaryKeySqlGenerator(db.database(), new DbPrimaryKeyConstraintFinder(db.database())); - - private MigrationStep underTest = new DropOrganizationsTable(db.database(), dropPrimaryKeySqlGenerator); - - @Test - public void execute() throws SQLException { - db.assertTableExists(TABLE_NAME); - underTest.execute(); - db.assertTableDoesNotExist(TABLE_NAME); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v87/MakeMonorepoColumnInProjectAlmSettingsTableNotNullableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v87/MakeMonorepoColumnInProjectAlmSettingsTableNotNullableTest.java deleted file mode 100644 index 47dfc60336d..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v87/MakeMonorepoColumnInProjectAlmSettingsTableNotNullableTest.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v87; - -import java.sql.SQLException; -import java.sql.Types; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DdlChange; - -import static org.assertj.core.api.Assertions.assertThat; - -public class MakeMonorepoColumnInProjectAlmSettingsTableNotNullableTest { - private static final String TABLE_NAME = "project_alm_settings"; - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(MakeMonorepoColumnInProjectAlmSettingsTableNotNullableTest.class, "schema.sql"); - - private final DdlChange underTest = new MakeMonorepoColumnInProjectAlmSettingsTableNotNullable(db.database()); - - @Test - public void verify_monorepo_column_not_nullable() throws SQLException { - insertProjectAlmSettings(1); - insertProjectAlmSettings(2); - insertProjectAlmSettings(3); - - underTest.execute(); - - db.assertColumnDefinition(TABLE_NAME, "monorepo", Types.BOOLEAN, null, false); - - assertThat(db.countRowsOfTable(TABLE_NAME)).isEqualTo(3); - } - - private void insertProjectAlmSettings(int id) { - db.executeInsert("project_alm_settings", - "UUID", "uuid-" + id, - "ALM_SETTING_UUID", "ALM_SETTING_UUID", - "PROJECT_UUID", "PROJECT_UUID-" + id, - "ALM_REPO", "ALM_REPO", - "ALM_SLUG", "ALM_SLUG", - "MONOREPO", false, - "UPDATED_AT", 12342342, - "CREATED_AT",1232342 - ); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v87/MoveDefaultProjectVisibilityToGlobalPropertiesTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v87/MoveDefaultProjectVisibilityToGlobalPropertiesTest.java deleted file mode 100644 index 7d25d989bb2..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v87/MoveDefaultProjectVisibilityToGlobalPropertiesTest.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v87; - -import java.sql.SQLException; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.api.impl.utils.TestSystem2; -import org.sonar.core.util.UuidFactory; -import org.sonar.core.util.UuidFactoryFast; -import org.sonar.db.CoreDbTester; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatThrownBy; - -public class MoveDefaultProjectVisibilityToGlobalPropertiesTest { - - private final UuidFactory uuidFactory = UuidFactoryFast.getInstance(); - private final TestSystem2 system2 = new TestSystem2(); - private final long NOW = 1606375781L; - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(MoveDefaultProjectVisibilityToGlobalPropertiesTest.class, "schema.sql"); - - private final MoveDefaultProjectVisibilityToGlobalProperties underTest = new MoveDefaultProjectVisibilityToGlobalProperties(db.database(), - UuidFactoryFast.getInstance(), system2); - - @Before - public void before() { - system2.setNow(NOW); - } - - @Test - public void fail_if_organization_not_exist() { - assertThatThrownBy(underTest::execute) - .isInstanceOf(IllegalStateException.class) - .hasMessage("Default organization is missing"); - } - - @Test - public void migrate_default_project_visibility_if_set_to_true_on_organization() throws SQLException { - insertDefaultOrganization(true); - - underTest.execute(); - - assertThatDefaultProjectVisibilityIsEqualTo("private"); - } - - @Test - public void migrate_default_project_visibility_if_set_to_false_on_organization() throws SQLException { - insertDefaultOrganization(false); - - underTest.execute(); - - assertThatDefaultProjectVisibilityIsEqualTo("public"); - } - - private void insertDefaultOrganization(boolean newProjectPrivate) { - String uuid = uuidFactory.create(); - db.executeInsert("organizations", - "uuid", uuid, - "kee", "default-organization", - "name", "name" + uuid, - "default_perm_template_project", uuidFactory.create(), - "default_perm_template_port", uuidFactory.create(), - "default_perm_template_app", uuidFactory.create(), - "default_quality_gate_uuid", uuid, - "new_project_private", newProjectPrivate, - "subscription", uuid, - "created_at", NOW, - "updated_at", NOW); - } - - private void assertThatDefaultProjectVisibilityIsEqualTo(String s) { - assertThat(db.selectFirst("select p.text_value, p.created_at from properties p where p.prop_key = 'projects.default.visibility'")) - .containsEntry("TEXT_VALUE", s) - .containsEntry("CREATED_AT", NOW); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v87/MoveDefaultQualityGateToGlobalPropertiesTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v87/MoveDefaultQualityGateToGlobalPropertiesTest.java deleted file mode 100644 index 318153ad131..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v87/MoveDefaultQualityGateToGlobalPropertiesTest.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v87; - -import java.sql.SQLException; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.api.impl.utils.TestSystem2; -import org.sonar.core.util.UuidFactory; -import org.sonar.core.util.UuidFactoryFast; -import org.sonar.db.CoreDbTester; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatThrownBy; - -public class MoveDefaultQualityGateToGlobalPropertiesTest { - - private final UuidFactory uuidFactory = UuidFactoryFast.getInstance(); - private final TestSystem2 system2 = new TestSystem2(); - private final long NOW = 1606375781L; - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(MoveDefaultQualityGateToGlobalPropertiesTest.class, "schema.sql"); - - private final MoveDefaultQualityGateToGlobalProperties underTest = new MoveDefaultQualityGateToGlobalProperties(db.database(), - UuidFactoryFast.getInstance(), system2); - - @Before - public void before() { - system2.setNow(NOW); - } - - @Test - public void fail_if_organization_not_exist() { - assertThatThrownBy(underTest::execute) - .isInstanceOf(IllegalStateException.class) - .hasMessage("Default organization is missing"); - } - - @Test - public void migrate_default_quality_gate_from_default_organization() throws SQLException { - insertDefaultOrganization("default-quality-gate-uuid"); - - underTest.execute(); - - assertThatDefaultQualityGateIsEqualTo("default-quality-gate-uuid"); - } - - private void insertDefaultOrganization(String defaultQualityGate) { - String uuid = uuidFactory.create(); - db.executeInsert("organizations", - "uuid", uuid, - "kee", "default-organization", - "name", "name" + uuid, - "default_perm_template_project", uuidFactory.create(), - "default_perm_template_port", uuidFactory.create(), - "default_perm_template_app", uuidFactory.create(), - "default_quality_gate_uuid", defaultQualityGate, - "new_project_private", false, - "subscription", uuid, - "created_at", NOW, - "updated_at", NOW); - } - - private void assertThatDefaultQualityGateIsEqualTo(String s) { - assertThat(db.selectFirst("select p.text_value, p.created_at from properties p where p.prop_key = 'qualitygate.default'")) - .containsEntry("TEXT_VALUE", s) - .containsEntry("CREATED_AT", NOW); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v87/PopulateMonorepoColumnToProjectAlmSettingsTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v87/PopulateMonorepoColumnToProjectAlmSettingsTableTest.java deleted file mode 100644 index 006895d400b..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v87/PopulateMonorepoColumnToProjectAlmSettingsTableTest.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v87; - -import java.sql.SQLException; -import java.sql.Types; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DataChange; - -import static org.assertj.core.api.Assertions.assertThat; - -public class PopulateMonorepoColumnToProjectAlmSettingsTableTest { - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(PopulateMonorepoColumnToProjectAlmSettingsTableTest.class, "schema.sql"); - - private final DataChange underTest = new PopulateMonorepoColumnToProjectAlmSettingsTable(db.database()); - - @Test - public void populate_monorepo_on_empty_table() throws SQLException { - underTest.execute(); - - assertThat(db.countSql("select count(*) from project_alm_settings")).isZero(); - } - - @Test - public void populate_monorepo_column() throws SQLException { - insertProjectAlmSettings(1); - insertProjectAlmSettings(2); - insertProjectAlmSettings(3); - - underTest.execute(); - - db.assertColumnDefinition("project_alm_settings", "monorepo", Types.BOOLEAN, null, true); - assertThat(db.countSql("select count(uuid) from project_alm_settings where monorepo = false")).isEqualTo(3); - } - - private void insertProjectAlmSettings(int id) { - db.executeInsert("project_alm_settings", - "UUID", "uuid-" + id, - "ALM_SETTING_UUID", "ALM_SETTING_UUID", - "PROJECT_UUID", "PROJECT_UUID-" + id, - "ALM_REPO", "ALM_REPO", - "ALM_SLUG", "ALM_SLUG", - "UPDATED_AT", 12342342, - "CREATED_AT",1232342 - ); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v88/AddLastSonarlintConnectionToUsersTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v88/AddLastSonarlintConnectionToUsersTest.java deleted file mode 100644 index 2583cd7f4bb..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v88/AddLastSonarlintConnectionToUsersTest.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v88; - -import java.sql.SQLException; -import java.sql.Types; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class AddLastSonarlintConnectionToUsersTest { - private static final String TABLE_NAME = "users"; - private static final String COLUMN_NAME = "last_sonarlint_connection"; - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(AddLastSonarlintConnectionToUsersTest.class, "schema.sql"); - private final DdlChange underTest = new AddLastSonarlintConnectionToUsers(db.database()); - - @Test - public void add_column() throws SQLException { - db.assertColumnDoesNotExist(TABLE_NAME, COLUMN_NAME); - underTest.execute(); - db.assertColumnDefinition(TABLE_NAME, COLUMN_NAME, Types.BIGINT, null, true); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v88/DbVersion88Test.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v88/DbVersion88Test.java deleted file mode 100644 index 3dbf9b66479..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v88/DbVersion88Test.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v88; - -import org.junit.Test; -import org.sonar.server.platform.db.migration.version.DbVersion; - -import static org.sonar.server.platform.db.migration.version.DbVersionTestUtils.verifyMigrationNotEmpty; -import static org.sonar.server.platform.db.migration.version.DbVersionTestUtils.verifyMinimumMigrationNumber; - -public class DbVersion88Test { - - private final DbVersion underTest = new DbVersion88(); - - @Test - public void migrationNumber_starts_at_4300() { - verifyMinimumMigrationNumber(underTest, 4300); - } - - @Test - public void verify_migration_count() { - verifyMigrationNotEmpty(underTest); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v89/AddIndexOnWebhookUuidInWebhookDeliveriesTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v89/AddIndexOnWebhookUuidInWebhookDeliveriesTableTest.java deleted file mode 100644 index 8418f26d150..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v89/AddIndexOnWebhookUuidInWebhookDeliveriesTableTest.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v89; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -public class AddIndexOnWebhookUuidInWebhookDeliveriesTableTest { - - private static final String TABLE_NAME = "webhook_deliveries"; - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(AddIndexOnWebhookUuidInWebhookDeliveriesTableTest.class, "schema.sql"); - - private final MigrationStep underTest = new AddIndexOnWebhookUuidInWebhookDeliveriesTable(db.database()); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertIndex(TABLE_NAME, "idx_wbhk_dlvrs_wbhk_uuid", "webhook_uuid"); - } - - @Test - public void migration_is_re_entrant() throws SQLException { - underTest.execute(); - - // re-entrant - underTest.execute(); - - db.assertIndex(TABLE_NAME, "idx_wbhk_dlvrs_wbhk_uuid", "webhook_uuid"); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v89/AddIndicesToNewCodePeriodTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v89/AddIndicesToNewCodePeriodTableTest.java deleted file mode 100644 index f584b63c315..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v89/AddIndicesToNewCodePeriodTableTest.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v89; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -public class AddIndicesToNewCodePeriodTableTest { - private static final String TABLE_NAME = "new_code_periods"; - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(AddIndicesToNewCodePeriodTableTest.class, "schema.sql"); - - private final MigrationStep underTest = new AddIndicesToNewCodePeriodTable(db.database()); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertIndex(TABLE_NAME, "idx_ncp_type", "type"); - db.assertIndex(TABLE_NAME, "idx_ncp_value", "value"); - } - - @Test - public void migration_is_re_entrant() throws SQLException { - underTest.execute(); - - // re-entrant - underTest.execute(); - - db.assertIndex(TABLE_NAME, "idx_ncp_type", "type"); - db.assertIndex(TABLE_NAME, "idx_ncp_value", "value"); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v89/AddMainBranchProjectUuidIndexToComponentTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v89/AddMainBranchProjectUuidIndexToComponentTableTest.java deleted file mode 100644 index fe8c6d680e6..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v89/AddMainBranchProjectUuidIndexToComponentTableTest.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v89; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -public class AddMainBranchProjectUuidIndexToComponentTableTest { - private static final String TABLE_NAME = "components"; - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(AddMainBranchProjectUuidIndexToComponentTableTest.class, "schema.sql"); - - private final MigrationStep underTest = new AddMainBranchProjectUuidIndexToComponentTable(db.database()); - - @Test - public void execute() throws SQLException { - underTest.execute(); - - db.assertIndex(TABLE_NAME, "idx_main_branch_prj_uuid", "main_branch_project_uuid"); - } - - @Test - public void migration_is_re_entrant() throws SQLException { - underTest.execute(); - - // re-entrant - underTest.execute(); - - db.assertIndex(TABLE_NAME, "idx_main_branch_prj_uuid", "main_branch_project_uuid"); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v89/DbVersion89Test.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v89/DbVersion89Test.java deleted file mode 100644 index 7ee1b1d5b8c..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v89/DbVersion89Test.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v89; - -import org.junit.Test; -import org.sonar.server.platform.db.migration.version.DbVersion; - -import static org.sonar.server.platform.db.migration.version.DbVersionTestUtils.verifyMigrationNotEmpty; -import static org.sonar.server.platform.db.migration.version.DbVersionTestUtils.verifyMinimumMigrationNumber; - -public class DbVersion89Test { - - private final DbVersion underTest = new DbVersion89(); - - @Test - public void migrationNumber_starts_at_4400() { - verifyMinimumMigrationNumber(underTest, 4400); - } - - @Test - public void verify_migration_count() { - verifyMigrationNotEmpty(underTest); - } - -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v89/DropGithubEndpointOnProjectLevelSettingTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v89/DropGithubEndpointOnProjectLevelSettingTest.java deleted file mode 100644 index 379b5e0dd75..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v89/DropGithubEndpointOnProjectLevelSettingTest.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v89; - -import java.sql.SQLException; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; -import javax.annotation.Nullable; -import org.assertj.core.groups.Tuple; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.api.utils.System2; -import org.sonar.core.util.Uuids; -import org.sonar.db.CoreDbTester; -import org.sonar.server.platform.db.migration.step.MigrationStep; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.tuple; - -public class DropGithubEndpointOnProjectLevelSettingTest { - private static final String DROPPED_PROPERTY = "sonar.pullrequest.github.endpoint"; - private static final String PROP_1_UUID = Uuids.createFast(); - private static final String PROP_2_UUID = Uuids.createFast(); - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(DropGithubEndpointOnProjectLevelSettingTest.class, "schema.sql"); - - private final MigrationStep underTest = new DropGithubEndpointOnProjectLevelSetting(db.database()); - - @Test - public void execute() throws SQLException { - setupProperties(); - - underTest.execute(); - - verifyResult(); - } - - @Test - public void is_reentrant() throws SQLException { - setupProperties(); - - underTest.execute(); - underTest.execute(); - - verifyResult(); - } - - @Test - public void is_successful_when_no_entries_to_drop() throws SQLException { - underTest.execute(); - - assertThat(db.select("SELECT UUID FROM PROPERTIES")).isEmpty(); - } - - private void setupProperties() { - insertProperty(Uuids.createFast(), "some.prop", "1"); - insertProperty(Uuids.createFast(), "some.other.prop", null); - insertProperty(PROP_1_UUID, DROPPED_PROPERTY, "1"); - insertProperty(PROP_2_UUID, DROPPED_PROPERTY, "2"); - insertProperty(Uuids.createFast(), DROPPED_PROPERTY, null); - } - - private void verifyResult() { - List> result = db.select("SELECT UUID, PROP_KEY, COMPONENT_UUID FROM PROPERTIES"); - assertThat(result - .stream() - .map(e -> new Tuple(e.get("PROP_KEY"), e.get("COMPONENT_UUID"))) - .collect(Collectors.toList())) - .containsExactlyInAnyOrder( - tuple("some.prop", "1"), - tuple("some.other.prop", null), - tuple(DROPPED_PROPERTY, null)); - assertThat(result) - .extracting(e -> e.get("UUID")) - .doesNotContain(PROP_1_UUID, PROP_2_UUID); - } - - private void insertProperty(String uuid, String key, @Nullable String projectUuid) { - db.executeInsert("PROPERTIES", - "UUID", uuid, - "PROP_KEY", key, - "COMPONENT_UUID", projectUuid, - "USER_UUID", null, - "IS_EMPTY", false, - "TEXT_VALUE", "AnyValue", - "CLOB_VALUE", null, - "CREATED_AT", System2.INSTANCE.now()); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v89/IncreaseSizeOfValueColumnInNewCodePeriodsTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v89/IncreaseSizeOfValueColumnInNewCodePeriodsTableTest.java deleted file mode 100644 index c6c47e402a1..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v89/IncreaseSizeOfValueColumnInNewCodePeriodsTableTest.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v89; - -import java.sql.SQLException; -import javax.annotation.Nullable; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.api.utils.System2; -import org.sonar.db.CoreDbTester; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatThrownBy; -import static org.assertj.core.api.Assertions.tuple; - -public class IncreaseSizeOfValueColumnInNewCodePeriodsTableTest { - private static final String TABLE_NAME = "new_code_periods"; - private static final String VERY_LONG_BRANCH_NAME = "abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijab" + - "cdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd" + - "efghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijxxxxx"; - private final System2 system = System2.INSTANCE; - - @Rule - public CoreDbTester db = CoreDbTester.createForSchema(IncreaseSizeOfValueColumnInNewCodePeriodsTableTest.class, "schema.sql"); - - private final IncreaseSizeOfValueColumnInNewCodePeriodsTable underTest = new IncreaseSizeOfValueColumnInNewCodePeriodsTable(db.database()); - - @Test - public void cannot_insert_long_value_before_migration() { - assertThatThrownBy(() -> insertNewCodePeriod("1", VERY_LONG_BRANCH_NAME)) - .isInstanceOf(IllegalStateException.class); - } - - @Test - public void can_insert_long_value_after_migration() throws SQLException { - underTest.execute(); - assertThat(db.countRowsOfTable(TABLE_NAME)).isZero(); - - insertNewCodePeriod("1", VERY_LONG_BRANCH_NAME); - - assertThat(db.countRowsOfTable(TABLE_NAME)).isEqualTo(1); - } - - @Test - public void existing_entries_are_not_affected() throws SQLException { - insertNewCodePeriod("1", "branch1"); - insertNewCodePeriod("2", null); - - underTest.execute(); - - assertThat(db.select("select uuid as \"UUID\", value as \"VALUE\"from new_code_periods")) - .extracting(r -> r.get("UUID"), r -> r.get("VALUE")) - .containsExactlyInAnyOrder( - tuple("1", "branch1"), - tuple("2", null)); - } - - private void insertNewCodePeriod(String uuid, @Nullable String value) { - long now = system.now(); - db.executeInsert("NEW_CODE_PERIODS", - "UUID", uuid, - "PROJECT_UUID", "proj-" + uuid, - "BRANCH_UUID", "branch-1", - "TYPE", "REFERENCE_BRANCH", - "VALUE", value, - "UPDATED_AT", now, - "CREATED_AT", now); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v89/util/NetworkInterfaceProviderTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v89/util/NetworkInterfaceProviderTest.java deleted file mode 100644 index 47274ed5545..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v89/util/NetworkInterfaceProviderTest.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * 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.platform.db.migration.version.v89.util; - -import java.net.SocketException; -import java.util.List; -import org.junit.Test; - -import static org.assertj.core.api.Assertions.assertThat; - -public class NetworkInterfaceProviderTest { - private NetworkInterfaceProvider underTest = new NetworkInterfaceProvider(); - - @Test - public void itGetsListOfNetworkInterfaceAddresses() throws SocketException { - assertThat(underTest.getNetworkInterfaceAddresses()) - .isInstanceOf(List.class) - .hasSizeGreaterThan(0); - } -} diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v80/MakeDeprecatedRuleKeysRuleIdIndexNonUniqueTest/deprecated_rule_keys.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v80/MakeDeprecatedRuleKeysRuleIdIndexNonUniqueTest/deprecated_rule_keys.sql deleted file mode 100644 index b46329a103b..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v80/MakeDeprecatedRuleKeysRuleIdIndexNonUniqueTest/deprecated_rule_keys.sql +++ /dev/null @@ -1,11 +0,0 @@ -CREATE TABLE "DEPRECATED_RULE_KEYS" ( - "UUID" VARCHAR(40) NOT NULL, - "RULE_ID" INTEGER NOT NULL, - "OLD_REPOSITORY_KEY" VARCHAR(200) NOT NULL, - "OLD_RULE_KEY" VARCHAR(255) NOT NULL, - "CREATED_AT" BIGINT, - - CONSTRAINT "PK_DEPRECATED_RULE_KEYS" PRIMARY KEY ("UUID") -); -CREATE UNIQUE INDEX "UNIQ_DEPRECATED_RULE_KEYS" ON "DEPRECATED_RULE_KEYS" ("OLD_REPOSITORY_KEY", "OLD_RULE_KEY"); -CREATE UNIQUE INDEX "RULE_ID_DEPRECATED_RULE_KEYS" ON "DEPRECATED_RULE_KEYS" ("RULE_ID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v80/MakeOrganizationsGuardedNullable/organizations.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v80/MakeOrganizationsGuardedNullable/organizations.sql deleted file mode 100644 index 52060aa7dd2..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v80/MakeOrganizationsGuardedNullable/organizations.sql +++ /dev/null @@ -1,21 +0,0 @@ -CREATE TABLE "ORGANIZATIONS" ( - "UUID" VARCHAR(40) NOT NULL, - "KEE" VARCHAR(300) NOT NULL, - "NAME" VARCHAR(300) NOT NULL, - "DESCRIPTION" VARCHAR(256), - "URL" VARCHAR(256), - "AVATAR_URL" VARCHAR(256), - "GUARDED" BOOLEAN NOT NULL, - "DEFAULT_PERM_TEMPLATE_PROJECT" VARCHAR(40), - "DEFAULT_PERM_TEMPLATE_APP" VARCHAR(40), - "DEFAULT_PERM_TEMPLATE_PORT" VARCHAR(40), - "DEFAULT_GROUP_ID" INTEGER, - "DEFAULT_QUALITY_GATE_UUID" VARCHAR(40) NOT NULL, - "NEW_PROJECT_PRIVATE" BOOLEAN NOT NULL, - "SUBSCRIPTION" VARCHAR(40) NOT NULL, - "CREATED_AT" BIGINT NOT NULL, - "UPDATED_AT" BIGINT NOT NULL, - - CONSTRAINT "PK_ORGANIZATIONS" PRIMARY KEY ("UUID") -); -CREATE UNIQUE INDEX "ORGANIZATION_KEY" ON "ORGANIZATIONS" ("KEE"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v80/PopulateNewCodePeriodTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v80/PopulateNewCodePeriodTableTest/schema.sql deleted file mode 100644 index 1b64db325d6..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v80/PopulateNewCodePeriodTableTest/schema.sql +++ /dev/null @@ -1,86 +0,0 @@ -CREATE TABLE "PROJECT_BRANCHES" ( - "UUID" VARCHAR(50) NOT NULL, - "PROJECT_UUID" VARCHAR(50) NOT NULL, - "KEE" VARCHAR(255) NOT NULL, - "KEY_TYPE" VARCHAR(12) NOT NULL, - "BRANCH_TYPE" VARCHAR(12), - "MERGE_BRANCH_UUID" VARCHAR(50), - "PULL_REQUEST_BINARY" BLOB, - "MANUAL_BASELINE_ANALYSIS_UUID" VARCHAR(40), - "CREATED_AT" BIGINT NOT NULL, - "UPDATED_AT" BIGINT NOT NULL, - - CONSTRAINT "PK_PROJECT_BRANCHES" PRIMARY KEY ("UUID") -); -CREATE UNIQUE INDEX "PROJECT_BRANCHES_KEE_KEY_TYPE" ON "PROJECT_BRANCHES" ("PROJECT_UUID", "KEE", "KEY_TYPE"); - -CREATE TABLE "NEW_CODE_PERIODS" ( - "UUID" VARCHAR(40) NOT NULL, - "PROJECT_UUID" VARCHAR(40), - "BRANCH_UUID" VARCHAR(40), - "TYPE" VARCHAR(30) NOT NULL, - "VALUE" VARCHAR(40), - "UPDATED_AT" BIGINT NOT NULL, - "CREATED_AT" BIGINT NOT NULL, - - CONSTRAINT "PK_NEW_CODE_PERIOD" PRIMARY KEY ("UUID") -); - -CREATE TABLE "PROPERTIES" ( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "PROP_KEY" VARCHAR(512) NOT NULL, - "RESOURCE_ID" INTEGER, - "USER_ID" INTEGER, - "IS_EMPTY" BOOLEAN NOT NULL, - "TEXT_VALUE" VARCHAR(4000), - "CLOB_VALUE" CLOB, - "CREATED_AT" BIGINT -); -CREATE INDEX "PROPERTIES_KEY" ON "PROPERTIES" ("PROP_KEY"); - -CREATE TABLE "PROJECTS" ( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "KEE" VARCHAR(400), - "UUID" VARCHAR(50) NOT NULL, - "ROOT_UUID" VARCHAR(50), - "PROJECT_UUID" VARCHAR(50) NOT NULL, - "MODULE_UUID" VARCHAR(50), - "MODULE_UUID_PATH" VARCHAR(1500), - "MAIN_BRANCH_PROJECT_UUID" VARCHAR(50), - "NAME" VARCHAR(2000), - "TAGS" VARCHAR(500), - "ENABLED" BOOLEAN NOT NULL DEFAULT TRUE, - "SCOPE" VARCHAR(3), - "QUALIFIER" VARCHAR(10) -); -CREATE UNIQUE INDEX "PROJECTS_KEE" ON "PROJECTS" ("KEE"); -CREATE INDEX "PROJECTS_ROOT_UUID" ON "PROJECTS" ("ROOT_UUID"); -CREATE UNIQUE INDEX "PROJECTS_UUID" ON "PROJECTS" ("UUID"); -CREATE INDEX "PROJECTS_PROJECT_UUID" ON "PROJECTS" ("PROJECT_UUID"); -CREATE INDEX "PROJECTS_MODULE_UUID" ON "PROJECTS" ("MODULE_UUID"); -CREATE INDEX "PROJECTS_QUALIFIER" ON "PROJECTS" ("QUALIFIER"); - -CREATE TABLE "EVENTS" ( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "NAME" VARCHAR(400), - "ANALYSIS_UUID" VARCHAR(50) NOT NULL, - "COMPONENT_UUID" VARCHAR(50) NOT NULL, - "CATEGORY" VARCHAR(50), - "CREATED_AT" BIGINT NOT NULL, - "DESCRIPTION" VARCHAR(4000), - "EVENT_DATA" VARCHAR(4000) -); -CREATE INDEX "EVENTS_ANALYSIS" ON "EVENTS" ("ANALYSIS_UUID"); -CREATE INDEX "EVENTS_COMPONENT_UUID" ON "EVENTS" ("COMPONENT_UUID"); - -CREATE TABLE "SNAPSHOTS" ( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "UUID" VARCHAR(50) NOT NULL, - "CREATED_AT" BIGINT, - "BUILD_DATE" BIGINT, - "COMPONENT_UUID" VARCHAR(50) NOT NULL, - "STATUS" VARCHAR(4) NOT NULL DEFAULT 'U', - "ISLAST" BOOLEAN NOT NULL DEFAULT FALSE -); -CREATE INDEX "SNAPSHOT_COMPONENT" ON "SNAPSHOTS" ("COMPONENT_UUID"); -CREATE UNIQUE INDEX "ANALYSES_UUID" ON "SNAPSHOTS" ("UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v80/PopulateProjectQualityGatesTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v80/PopulateProjectQualityGatesTableTest/schema.sql deleted file mode 100644 index 97c8f97109d..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v80/PopulateProjectQualityGatesTableTest/schema.sql +++ /dev/null @@ -1,77 +0,0 @@ -CREATE TABLE "PROJECTS" ( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "ORGANIZATION_UUID" VARCHAR(40) NOT NULL, - "KEE" VARCHAR(400), - "UUID" VARCHAR(50) NOT NULL, - "UUID_PATH" VARCHAR(1500) NOT NULL, - "ROOT_UUID" VARCHAR(50) NOT NULL, - "PROJECT_UUID" VARCHAR(50) NOT NULL, - "MODULE_UUID" VARCHAR(50), - "MODULE_UUID_PATH" VARCHAR(1500), - "MAIN_BRANCH_PROJECT_UUID" VARCHAR(50), - "NAME" VARCHAR(2000), - "DESCRIPTION" VARCHAR(2000), - "PRIVATE" BOOLEAN NOT NULL, - "TAGS" VARCHAR(500), - "ENABLED" BOOLEAN NOT NULL DEFAULT TRUE, - "SCOPE" VARCHAR(3), - "QUALIFIER" VARCHAR(10), - "DEPRECATED_KEE" VARCHAR(400), - "PATH" VARCHAR(2000), - "LANGUAGE" VARCHAR(20), - "COPY_COMPONENT_UUID" VARCHAR(50), - "LONG_NAME" VARCHAR(2000), - "DEVELOPER_UUID" VARCHAR(50), - "CREATED_AT" TIMESTAMP, - "AUTHORIZATION_UPDATED_AT" BIGINT, - "B_CHANGED" BOOLEAN, - "B_COPY_COMPONENT_UUID" VARCHAR(50), - "B_DESCRIPTION" VARCHAR(2000), - "B_ENABLED" BOOLEAN, - "B_UUID_PATH" VARCHAR(1500), - "B_LANGUAGE" VARCHAR(20), - "B_LONG_NAME" VARCHAR(500), - "B_MODULE_UUID" VARCHAR(50), - "B_MODULE_UUID_PATH" VARCHAR(1500), - "B_NAME" VARCHAR(500), - "B_PATH" VARCHAR(2000), - "B_QUALIFIER" VARCHAR(10) -); -CREATE INDEX "PROJECTS_ORGANIZATION" ON "PROJECTS" ("ORGANIZATION_UUID"); -CREATE UNIQUE INDEX "PROJECTS_KEE" ON "PROJECTS" ("KEE"); -CREATE INDEX "PROJECTS_ROOT_UUID" ON "PROJECTS" ("ROOT_UUID"); -CREATE UNIQUE INDEX "PROJECTS_UUID" ON "PROJECTS" ("UUID"); -CREATE INDEX "PROJECTS_PROJECT_UUID" ON "PROJECTS" ("PROJECT_UUID"); -CREATE INDEX "PROJECTS_MODULE_UUID" ON "PROJECTS" ("MODULE_UUID"); -CREATE INDEX "PROJECTS_QUALIFIER" ON "PROJECTS" ("QUALIFIER"); - -CREATE TABLE "QUALITY_GATES" ( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "UUID" VARCHAR(40) NOT NULL, - "NAME" VARCHAR(100) NOT NULL, - "IS_BUILT_IN" BOOLEAN NOT NULL, - "CREATED_AT" TIMESTAMP, - "UPDATED_AT" TIMESTAMP, -); -CREATE UNIQUE INDEX "UNIQ_QUALITY_GATES_UUID" ON "QUALITY_GATES" ("UUID"); - - -CREATE TABLE "PROPERTIES" ( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "PROP_KEY" VARCHAR(512) NOT NULL, - "RESOURCE_ID" INTEGER, - "USER_ID" INTEGER, - "IS_EMPTY" BOOLEAN NOT NULL, - "TEXT_VALUE" VARCHAR(4000), - "CLOB_VALUE" CLOB, - "CREATED_AT" BIGINT -); -CREATE INDEX "PROPERTIES_KEY" ON "PROPERTIES" ("PROP_KEY"); - -CREATE TABLE "PROJECT_QGATES" ( -"PROJECT_UUID" VARCHAR(40) NOT NULL, -"QUALITY_GATE_UUID" VARCHAR(40) NOT NULL, - -CONSTRAINT "PK_PROJECT_QGATES" PRIMARY KEY ("PROJECT_UUID") -); -CREATE UNIQUE INDEX "UNIQ_PROJECT_QGATES" ON "PROJECT_QGATES" ("PROJECT_UUID", "QUALITY_GATE_UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v80/RemoveDefaultQualityGateFromPropertiesTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v80/RemoveDefaultQualityGateFromPropertiesTableTest/schema.sql deleted file mode 100644 index 367029ea6ba..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v80/RemoveDefaultQualityGateFromPropertiesTableTest/schema.sql +++ /dev/null @@ -1,11 +0,0 @@ -CREATE TABLE "PROPERTIES" ( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "PROP_KEY" VARCHAR(512) NOT NULL, - "RESOURCE_ID" INTEGER, - "USER_ID" INTEGER, - "IS_EMPTY" BOOLEAN NOT NULL, - "TEXT_VALUE" VARCHAR(4000), - "CLOB_VALUE" CLOB, - "CREATED_AT" BIGINT -); -CREATE INDEX "PROPERTIES_KEY" ON "PROPERTIES" ("PROP_KEY"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v80/RemoveGitHubLoginGenerationStrategyPropertyTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v80/RemoveGitHubLoginGenerationStrategyPropertyTest/schema.sql deleted file mode 100644 index 367029ea6ba..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v80/RemoveGitHubLoginGenerationStrategyPropertyTest/schema.sql +++ /dev/null @@ -1,11 +0,0 @@ -CREATE TABLE "PROPERTIES" ( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "PROP_KEY" VARCHAR(512) NOT NULL, - "RESOURCE_ID" INTEGER, - "USER_ID" INTEGER, - "IS_EMPTY" BOOLEAN NOT NULL, - "TEXT_VALUE" VARCHAR(4000), - "CLOB_VALUE" CLOB, - "CREATED_AT" BIGINT -); -CREATE INDEX "PROPERTIES_KEY" ON "PROPERTIES" ("PROP_KEY"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v80/RemoveLeakPeriodPropertiesTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v80/RemoveLeakPeriodPropertiesTest/schema.sql deleted file mode 100644 index 367029ea6ba..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v80/RemoveLeakPeriodPropertiesTest/schema.sql +++ /dev/null @@ -1,11 +0,0 @@ -CREATE TABLE "PROPERTIES" ( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "PROP_KEY" VARCHAR(512) NOT NULL, - "RESOURCE_ID" INTEGER, - "USER_ID" INTEGER, - "IS_EMPTY" BOOLEAN NOT NULL, - "TEXT_VALUE" VARCHAR(4000), - "CLOB_VALUE" CLOB, - "CREATED_AT" BIGINT -); -CREATE INDEX "PROPERTIES_KEY" ON "PROPERTIES" ("PROP_KEY"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v80/RenameAnalysisPropertiesSnapshotUuidTest/analysis_properties.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v80/RenameAnalysisPropertiesSnapshotUuidTest/analysis_properties.sql deleted file mode 100644 index 0a131046edc..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v80/RenameAnalysisPropertiesSnapshotUuidTest/analysis_properties.sql +++ /dev/null @@ -1,12 +0,0 @@ -CREATE TABLE "ANALYSIS_PROPERTIES" ( - "UUID" VARCHAR(40) NOT NULL, - "SNAPSHOT_UUID" VARCHAR(40) NOT NULL, - "KEE" VARCHAR(512) NOT NULL, - "TEXT_VALUE" VARCHAR(4000), - "CLOB_VALUE" CLOB, - "IS_EMPTY" BOOLEAN NOT NULL, - "CREATED_AT" BIGINT NOT NULL, - - CONSTRAINT "PK_ANALYSIS_PROPERTIES" PRIMARY KEY ("UUID") -); -CREATE INDEX "SNAPSHOT_UUID" ON "ANALYSIS_PROPERTIES" ("SNAPSHOT_UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v81/AddExcludeBranchFromPurgeColumnTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v81/AddExcludeBranchFromPurgeColumnTest/schema.sql deleted file mode 100644 index 32de015c84b..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v81/AddExcludeBranchFromPurgeColumnTest/schema.sql +++ /dev/null @@ -1,12 +0,0 @@ -CREATE TABLE PROJECT_BRANCHES( - UUID VARCHAR(50) NOT NULL, - PROJECT_UUID VARCHAR(50) NOT NULL, - KEE VARCHAR(255) NOT NULL, - BRANCH_TYPE VARCHAR(12), - MERGE_BRANCH_UUID VARCHAR(50), - KEY_TYPE VARCHAR(12) NOT NULL, - PULL_REQUEST_BINARY BLOB, - MANUAL_BASELINE_ANALYSIS_UUID VARCHAR(40), - CREATED_AT BIGINT NOT NULL, - UPDATED_AT BIGINT NOT NULL -); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v81/DeleteSonarPullRequestProviderPropertyTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v81/DeleteSonarPullRequestProviderPropertyTest/schema.sql deleted file mode 100644 index 367029ea6ba..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v81/DeleteSonarPullRequestProviderPropertyTest/schema.sql +++ /dev/null @@ -1,11 +0,0 @@ -CREATE TABLE "PROPERTIES" ( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "PROP_KEY" VARCHAR(512) NOT NULL, - "RESOURCE_ID" INTEGER, - "USER_ID" INTEGER, - "IS_EMPTY" BOOLEAN NOT NULL, - "TEXT_VALUE" VARCHAR(4000), - "CLOB_VALUE" CLOB, - "CREATED_AT" BIGINT -); -CREATE INDEX "PROPERTIES_KEY" ON "PROPERTIES" ("PROP_KEY"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v81/MigrateAzureAlmSettingsTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v81/MigrateAzureAlmSettingsTest/schema.sql deleted file mode 100644 index a84169c089a..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v81/MigrateAzureAlmSettingsTest/schema.sql +++ /dev/null @@ -1,86 +0,0 @@ -CREATE TABLE ALM_SETTINGS( - UUID VARCHAR(40) NOT NULL, - ALM_ID VARCHAR(40) NOT NULL, - KEE VARCHAR(200) NOT NULL, - URL VARCHAR(2000), - APP_ID VARCHAR(80), - PRIVATE_KEY VARCHAR(2000), - PAT VARCHAR(2000), - UPDATED_AT BIGINT NOT NULL, - CREATED_AT BIGINT NOT NULL -); -ALTER TABLE ALM_SETTINGS ADD CONSTRAINT PK_ALM_SETTINGS PRIMARY KEY(UUID); -CREATE UNIQUE INDEX UNIQ_ALM_SETTINGS ON ALM_SETTINGS(KEE); - -CREATE TABLE PROJECT_ALM_SETTINGS( - UUID VARCHAR(40) NOT NULL, - ALM_SETTING_UUID VARCHAR(40) NOT NULL, - PROJECT_UUID VARCHAR(50) NOT NULL, - ALM_REPO VARCHAR(256), - ALM_SLUG VARCHAR(256), - UPDATED_AT BIGINT NOT NULL, - CREATED_AT BIGINT NOT NULL -); -ALTER TABLE PROJECT_ALM_SETTINGS ADD CONSTRAINT PK_PROJECT_ALM_SETTINGS PRIMARY KEY(UUID); -CREATE UNIQUE INDEX UNIQ_PROJECT_ALM_SETTINGS ON PROJECT_ALM_SETTINGS(PROJECT_UUID); -CREATE INDEX PROJECT_ALM_SETTINGS_ALM ON PROJECT_ALM_SETTINGS(ALM_SETTING_UUID); - -CREATE TABLE "PROPERTIES" ( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "PROP_KEY" VARCHAR(512) NOT NULL, - "RESOURCE_ID" INTEGER, - "USER_ID" INTEGER, - "IS_EMPTY" BOOLEAN NOT NULL, - "TEXT_VALUE" VARCHAR(4000), - "CLOB_VALUE" CLOB, - "CREATED_AT" BIGINT -); -CREATE INDEX "PROPERTIES_KEY" ON "PROPERTIES" ("PROP_KEY"); - -CREATE TABLE PROJECTS( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - UUID VARCHAR(50) NOT NULL, - ORGANIZATION_UUID VARCHAR(40) NOT NULL, - KEE VARCHAR(400), - DEPRECATED_KEE VARCHAR(400), - NAME VARCHAR(2000), - LONG_NAME VARCHAR(2000), - DESCRIPTION VARCHAR(2000), - ENABLED BOOLEAN DEFAULT TRUE NOT NULL, - SCOPE VARCHAR(3), - QUALIFIER VARCHAR(10), - PRIVATE BOOLEAN NOT NULL, - ROOT_UUID VARCHAR(50) NOT NULL, - LANGUAGE VARCHAR(20), - COPY_COMPONENT_UUID VARCHAR(50), - DEVELOPER_UUID VARCHAR(50), - PATH VARCHAR(2000), - UUID_PATH VARCHAR(1500) NOT NULL, - PROJECT_UUID VARCHAR(50) NOT NULL, - MODULE_UUID VARCHAR(50), - MODULE_UUID_PATH VARCHAR(1500), - AUTHORIZATION_UPDATED_AT BIGINT, - TAGS VARCHAR(500), - MAIN_BRANCH_PROJECT_UUID VARCHAR(50), - B_CHANGED BOOLEAN, - B_NAME VARCHAR(500), - B_LONG_NAME VARCHAR(500), - B_DESCRIPTION VARCHAR(2000), - B_ENABLED BOOLEAN, - B_QUALIFIER VARCHAR(10), - B_LANGUAGE VARCHAR(20), - B_COPY_COMPONENT_UUID VARCHAR(50), - B_PATH VARCHAR(2000), - B_UUID_PATH VARCHAR(1500), - B_MODULE_UUID VARCHAR(50), - B_MODULE_UUID_PATH VARCHAR(1500), - CREATED_AT TIMESTAMP -); -ALTER TABLE PROJECTS ADD CONSTRAINT PK_PROJECTS PRIMARY KEY(ID); -CREATE INDEX PROJECTS_ORGANIZATION ON PROJECTS(ORGANIZATION_UUID); -CREATE UNIQUE INDEX PROJECTS_KEE ON PROJECTS(KEE); -CREATE INDEX PROJECTS_MODULE_UUID ON PROJECTS(MODULE_UUID); -CREATE INDEX PROJECTS_PROJECT_UUID ON PROJECTS(PROJECT_UUID); -CREATE INDEX PROJECTS_QUALIFIER ON PROJECTS(QUALIFIER); -CREATE INDEX PROJECTS_ROOT_UUID ON PROJECTS(ROOT_UUID); -CREATE INDEX PROJECTS_UUID ON PROJECTS(UUID); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v81/MigrateBitbucketAlmSettingsTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v81/MigrateBitbucketAlmSettingsTest/schema.sql deleted file mode 100644 index a84169c089a..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v81/MigrateBitbucketAlmSettingsTest/schema.sql +++ /dev/null @@ -1,86 +0,0 @@ -CREATE TABLE ALM_SETTINGS( - UUID VARCHAR(40) NOT NULL, - ALM_ID VARCHAR(40) NOT NULL, - KEE VARCHAR(200) NOT NULL, - URL VARCHAR(2000), - APP_ID VARCHAR(80), - PRIVATE_KEY VARCHAR(2000), - PAT VARCHAR(2000), - UPDATED_AT BIGINT NOT NULL, - CREATED_AT BIGINT NOT NULL -); -ALTER TABLE ALM_SETTINGS ADD CONSTRAINT PK_ALM_SETTINGS PRIMARY KEY(UUID); -CREATE UNIQUE INDEX UNIQ_ALM_SETTINGS ON ALM_SETTINGS(KEE); - -CREATE TABLE PROJECT_ALM_SETTINGS( - UUID VARCHAR(40) NOT NULL, - ALM_SETTING_UUID VARCHAR(40) NOT NULL, - PROJECT_UUID VARCHAR(50) NOT NULL, - ALM_REPO VARCHAR(256), - ALM_SLUG VARCHAR(256), - UPDATED_AT BIGINT NOT NULL, - CREATED_AT BIGINT NOT NULL -); -ALTER TABLE PROJECT_ALM_SETTINGS ADD CONSTRAINT PK_PROJECT_ALM_SETTINGS PRIMARY KEY(UUID); -CREATE UNIQUE INDEX UNIQ_PROJECT_ALM_SETTINGS ON PROJECT_ALM_SETTINGS(PROJECT_UUID); -CREATE INDEX PROJECT_ALM_SETTINGS_ALM ON PROJECT_ALM_SETTINGS(ALM_SETTING_UUID); - -CREATE TABLE "PROPERTIES" ( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "PROP_KEY" VARCHAR(512) NOT NULL, - "RESOURCE_ID" INTEGER, - "USER_ID" INTEGER, - "IS_EMPTY" BOOLEAN NOT NULL, - "TEXT_VALUE" VARCHAR(4000), - "CLOB_VALUE" CLOB, - "CREATED_AT" BIGINT -); -CREATE INDEX "PROPERTIES_KEY" ON "PROPERTIES" ("PROP_KEY"); - -CREATE TABLE PROJECTS( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - UUID VARCHAR(50) NOT NULL, - ORGANIZATION_UUID VARCHAR(40) NOT NULL, - KEE VARCHAR(400), - DEPRECATED_KEE VARCHAR(400), - NAME VARCHAR(2000), - LONG_NAME VARCHAR(2000), - DESCRIPTION VARCHAR(2000), - ENABLED BOOLEAN DEFAULT TRUE NOT NULL, - SCOPE VARCHAR(3), - QUALIFIER VARCHAR(10), - PRIVATE BOOLEAN NOT NULL, - ROOT_UUID VARCHAR(50) NOT NULL, - LANGUAGE VARCHAR(20), - COPY_COMPONENT_UUID VARCHAR(50), - DEVELOPER_UUID VARCHAR(50), - PATH VARCHAR(2000), - UUID_PATH VARCHAR(1500) NOT NULL, - PROJECT_UUID VARCHAR(50) NOT NULL, - MODULE_UUID VARCHAR(50), - MODULE_UUID_PATH VARCHAR(1500), - AUTHORIZATION_UPDATED_AT BIGINT, - TAGS VARCHAR(500), - MAIN_BRANCH_PROJECT_UUID VARCHAR(50), - B_CHANGED BOOLEAN, - B_NAME VARCHAR(500), - B_LONG_NAME VARCHAR(500), - B_DESCRIPTION VARCHAR(2000), - B_ENABLED BOOLEAN, - B_QUALIFIER VARCHAR(10), - B_LANGUAGE VARCHAR(20), - B_COPY_COMPONENT_UUID VARCHAR(50), - B_PATH VARCHAR(2000), - B_UUID_PATH VARCHAR(1500), - B_MODULE_UUID VARCHAR(50), - B_MODULE_UUID_PATH VARCHAR(1500), - CREATED_AT TIMESTAMP -); -ALTER TABLE PROJECTS ADD CONSTRAINT PK_PROJECTS PRIMARY KEY(ID); -CREATE INDEX PROJECTS_ORGANIZATION ON PROJECTS(ORGANIZATION_UUID); -CREATE UNIQUE INDEX PROJECTS_KEE ON PROJECTS(KEE); -CREATE INDEX PROJECTS_MODULE_UUID ON PROJECTS(MODULE_UUID); -CREATE INDEX PROJECTS_PROJECT_UUID ON PROJECTS(PROJECT_UUID); -CREATE INDEX PROJECTS_QUALIFIER ON PROJECTS(QUALIFIER); -CREATE INDEX PROJECTS_ROOT_UUID ON PROJECTS(ROOT_UUID); -CREATE INDEX PROJECTS_UUID ON PROJECTS(UUID); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v81/MigrateDefaultBranchesToKeepSettingTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v81/MigrateDefaultBranchesToKeepSettingTest/schema.sql deleted file mode 100644 index 45c10269b8d..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v81/MigrateDefaultBranchesToKeepSettingTest/schema.sql +++ /dev/null @@ -1,58 +0,0 @@ -CREATE TABLE "PROJECTS" ( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "ORGANIZATION_UUID" VARCHAR(40) NOT NULL, - "KEE" VARCHAR(400), - "UUID" VARCHAR(50) NOT NULL, - "UUID_PATH" VARCHAR(1500) NOT NULL, - "ROOT_UUID" VARCHAR(50) NOT NULL, - "PROJECT_UUID" VARCHAR(50) NOT NULL, - "MODULE_UUID" VARCHAR(50), - "MODULE_UUID_PATH" VARCHAR(1500), - "MAIN_BRANCH_PROJECT_UUID" VARCHAR(50), - "NAME" VARCHAR(2000), - "DESCRIPTION" VARCHAR(2000), - "PRIVATE" BOOLEAN NOT NULL, - "TAGS" VARCHAR(500), - "ENABLED" BOOLEAN NOT NULL DEFAULT TRUE, - "SCOPE" VARCHAR(3), - "QUALIFIER" VARCHAR(10), - "DEPRECATED_KEE" VARCHAR(400), - "PATH" VARCHAR(2000), - "LANGUAGE" VARCHAR(20), - "COPY_COMPONENT_UUID" VARCHAR(50), - "LONG_NAME" VARCHAR(2000), - "DEVELOPER_UUID" VARCHAR(50), - "CREATED_AT" TIMESTAMP, - "AUTHORIZATION_UPDATED_AT" BIGINT, - "B_CHANGED" BOOLEAN, - "B_COPY_COMPONENT_UUID" VARCHAR(50), - "B_DESCRIPTION" VARCHAR(2000), - "B_ENABLED" BOOLEAN, - "B_UUID_PATH" VARCHAR(1500), - "B_LANGUAGE" VARCHAR(20), - "B_LONG_NAME" VARCHAR(500), - "B_MODULE_UUID" VARCHAR(50), - "B_MODULE_UUID_PATH" VARCHAR(1500), - "B_NAME" VARCHAR(500), - "B_PATH" VARCHAR(2000), - "B_QUALIFIER" VARCHAR(10) -); -CREATE INDEX "PROJECTS_ORGANIZATION" ON "PROJECTS" ("ORGANIZATION_UUID"); -CREATE UNIQUE INDEX "PROJECTS_KEE" ON "PROJECTS" ("KEE"); -CREATE INDEX "PROJECTS_ROOT_UUID" ON "PROJECTS" ("ROOT_UUID"); -CREATE UNIQUE INDEX "PROJECTS_UUID" ON "PROJECTS" ("UUID"); -CREATE INDEX "PROJECTS_PROJECT_UUID" ON "PROJECTS" ("PROJECT_UUID"); -CREATE INDEX "PROJECTS_MODULE_UUID" ON "PROJECTS" ("MODULE_UUID"); -CREATE INDEX "PROJECTS_QUALIFIER" ON "PROJECTS" ("QUALIFIER"); - -CREATE TABLE "PROPERTIES" ( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "PROP_KEY" VARCHAR(512) NOT NULL, - "RESOURCE_ID" INTEGER, - "USER_ID" INTEGER, - "IS_EMPTY" BOOLEAN NOT NULL, - "TEXT_VALUE" VARCHAR(4000), - "CLOB_VALUE" CLOB, - "CREATED_AT" BIGINT -); -CREATE INDEX "PROPERTIES_KEY" ON "PROPERTIES" ("PROP_KEY"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v81/MigrateDeprecatedGithubPrivateKeyToNewKeyTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v81/MigrateDeprecatedGithubPrivateKeyToNewKeyTest/schema.sql deleted file mode 100644 index 367029ea6ba..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v81/MigrateDeprecatedGithubPrivateKeyToNewKeyTest/schema.sql +++ /dev/null @@ -1,11 +0,0 @@ -CREATE TABLE "PROPERTIES" ( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "PROP_KEY" VARCHAR(512) NOT NULL, - "RESOURCE_ID" INTEGER, - "USER_ID" INTEGER, - "IS_EMPTY" BOOLEAN NOT NULL, - "TEXT_VALUE" VARCHAR(4000), - "CLOB_VALUE" CLOB, - "CREATED_AT" BIGINT -); -CREATE INDEX "PROPERTIES_KEY" ON "PROPERTIES" ("PROP_KEY"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v81/MigrateGithubAlmSettingsTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v81/MigrateGithubAlmSettingsTest/schema.sql deleted file mode 100644 index a84169c089a..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v81/MigrateGithubAlmSettingsTest/schema.sql +++ /dev/null @@ -1,86 +0,0 @@ -CREATE TABLE ALM_SETTINGS( - UUID VARCHAR(40) NOT NULL, - ALM_ID VARCHAR(40) NOT NULL, - KEE VARCHAR(200) NOT NULL, - URL VARCHAR(2000), - APP_ID VARCHAR(80), - PRIVATE_KEY VARCHAR(2000), - PAT VARCHAR(2000), - UPDATED_AT BIGINT NOT NULL, - CREATED_AT BIGINT NOT NULL -); -ALTER TABLE ALM_SETTINGS ADD CONSTRAINT PK_ALM_SETTINGS PRIMARY KEY(UUID); -CREATE UNIQUE INDEX UNIQ_ALM_SETTINGS ON ALM_SETTINGS(KEE); - -CREATE TABLE PROJECT_ALM_SETTINGS( - UUID VARCHAR(40) NOT NULL, - ALM_SETTING_UUID VARCHAR(40) NOT NULL, - PROJECT_UUID VARCHAR(50) NOT NULL, - ALM_REPO VARCHAR(256), - ALM_SLUG VARCHAR(256), - UPDATED_AT BIGINT NOT NULL, - CREATED_AT BIGINT NOT NULL -); -ALTER TABLE PROJECT_ALM_SETTINGS ADD CONSTRAINT PK_PROJECT_ALM_SETTINGS PRIMARY KEY(UUID); -CREATE UNIQUE INDEX UNIQ_PROJECT_ALM_SETTINGS ON PROJECT_ALM_SETTINGS(PROJECT_UUID); -CREATE INDEX PROJECT_ALM_SETTINGS_ALM ON PROJECT_ALM_SETTINGS(ALM_SETTING_UUID); - -CREATE TABLE "PROPERTIES" ( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "PROP_KEY" VARCHAR(512) NOT NULL, - "RESOURCE_ID" INTEGER, - "USER_ID" INTEGER, - "IS_EMPTY" BOOLEAN NOT NULL, - "TEXT_VALUE" VARCHAR(4000), - "CLOB_VALUE" CLOB, - "CREATED_AT" BIGINT -); -CREATE INDEX "PROPERTIES_KEY" ON "PROPERTIES" ("PROP_KEY"); - -CREATE TABLE PROJECTS( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - UUID VARCHAR(50) NOT NULL, - ORGANIZATION_UUID VARCHAR(40) NOT NULL, - KEE VARCHAR(400), - DEPRECATED_KEE VARCHAR(400), - NAME VARCHAR(2000), - LONG_NAME VARCHAR(2000), - DESCRIPTION VARCHAR(2000), - ENABLED BOOLEAN DEFAULT TRUE NOT NULL, - SCOPE VARCHAR(3), - QUALIFIER VARCHAR(10), - PRIVATE BOOLEAN NOT NULL, - ROOT_UUID VARCHAR(50) NOT NULL, - LANGUAGE VARCHAR(20), - COPY_COMPONENT_UUID VARCHAR(50), - DEVELOPER_UUID VARCHAR(50), - PATH VARCHAR(2000), - UUID_PATH VARCHAR(1500) NOT NULL, - PROJECT_UUID VARCHAR(50) NOT NULL, - MODULE_UUID VARCHAR(50), - MODULE_UUID_PATH VARCHAR(1500), - AUTHORIZATION_UPDATED_AT BIGINT, - TAGS VARCHAR(500), - MAIN_BRANCH_PROJECT_UUID VARCHAR(50), - B_CHANGED BOOLEAN, - B_NAME VARCHAR(500), - B_LONG_NAME VARCHAR(500), - B_DESCRIPTION VARCHAR(2000), - B_ENABLED BOOLEAN, - B_QUALIFIER VARCHAR(10), - B_LANGUAGE VARCHAR(20), - B_COPY_COMPONENT_UUID VARCHAR(50), - B_PATH VARCHAR(2000), - B_UUID_PATH VARCHAR(1500), - B_MODULE_UUID VARCHAR(50), - B_MODULE_UUID_PATH VARCHAR(1500), - CREATED_AT TIMESTAMP -); -ALTER TABLE PROJECTS ADD CONSTRAINT PK_PROJECTS PRIMARY KEY(ID); -CREATE INDEX PROJECTS_ORGANIZATION ON PROJECTS(ORGANIZATION_UUID); -CREATE UNIQUE INDEX PROJECTS_KEE ON PROJECTS(KEE); -CREATE INDEX PROJECTS_MODULE_UUID ON PROJECTS(MODULE_UUID); -CREATE INDEX PROJECTS_PROJECT_UUID ON PROJECTS(PROJECT_UUID); -CREATE INDEX PROJECTS_QUALIFIER ON PROJECTS(QUALIFIER); -CREATE INDEX PROJECTS_ROOT_UUID ON PROJECTS(ROOT_UUID); -CREATE INDEX PROJECTS_UUID ON PROJECTS(UUID); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v81/MigrateSlbsAndLlbsToCommonTypeInCeTasksTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v81/MigrateSlbsAndLlbsToCommonTypeInCeTasksTest/schema.sql deleted file mode 100644 index 92974731cd6..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v81/MigrateSlbsAndLlbsToCommonTypeInCeTasksTest/schema.sql +++ /dev/null @@ -1,9 +0,0 @@ -CREATE TABLE "CE_TASK_CHARACTERISTICS" ( - "UUID" VARCHAR(40) NOT NULL, - "TASK_UUID" VARCHAR(40) NOT NULL, - "KEE" VARCHAR(50) NOT NULL, - "TEXT_VALUE" VARCHAR(4000), - - CONSTRAINT "PK_CE_TASK_CHARACTERISTICS" PRIMARY KEY ("UUID") -); -CREATE INDEX "CE_TASK_CHARACTERISTICS_TASK_UUID" ON "CE_TASK_CHARACTERISTICS" ("TASK_UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v81/MigrateSlbsAndLlbsToCommonTypeTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v81/MigrateSlbsAndLlbsToCommonTypeTest/schema.sql deleted file mode 100644 index 479c9fcd6ac..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v81/MigrateSlbsAndLlbsToCommonTypeTest/schema.sql +++ /dev/null @@ -1,15 +0,0 @@ -CREATE TABLE "PROJECT_BRANCHES" ( - "UUID" VARCHAR(50) NOT NULL, - "PROJECT_UUID" VARCHAR(50) NOT NULL, - "KEE" VARCHAR(255) NOT NULL, - "KEY_TYPE" VARCHAR(12) NOT NULL, - "BRANCH_TYPE" VARCHAR(12), - "MERGE_BRANCH_UUID" VARCHAR(50), - "PULL_REQUEST_BINARY" BLOB, - "MANUAL_BASELINE_ANALYSIS_UUID" VARCHAR(40), - "CREATED_AT" BIGINT NOT NULL, - "UPDATED_AT" BIGINT NOT NULL, - - CONSTRAINT "PK_PROJECT_BRANCHES" PRIMARY KEY ("UUID") -); -CREATE UNIQUE INDEX "PROJECT_BRANCHES_KEE_KEY_TYPE" ON "PROJECT_BRANCHES" ("PROJECT_UUID", "KEE", "KEY_TYPE"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v81/PopulateExcludeBranchFromPurgeColumnTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v81/PopulateExcludeBranchFromPurgeColumnTest/schema.sql deleted file mode 100644 index fb58dc66af9..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v81/PopulateExcludeBranchFromPurgeColumnTest/schema.sql +++ /dev/null @@ -1,13 +0,0 @@ -CREATE TABLE PROJECT_BRANCHES( - UUID VARCHAR(50) NOT NULL, - PROJECT_UUID VARCHAR(50) NOT NULL, - KEE VARCHAR(255) NOT NULL, - BRANCH_TYPE VARCHAR(12), - MERGE_BRANCH_UUID VARCHAR(50), - KEY_TYPE VARCHAR(12) NOT NULL, - PULL_REQUEST_BINARY BLOB, - MANUAL_BASELINE_ANALYSIS_UUID VARCHAR(40), - CREATED_AT BIGINT NOT NULL, - UPDATED_AT BIGINT NOT NULL, - EXCLUDE_FROM_PURGE BOOLEAN DEFAULT FALSE NOT NULL -); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v81/RemoveLLBRegexSettingTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v81/RemoveLLBRegexSettingTest/schema.sql deleted file mode 100644 index 367029ea6ba..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v81/RemoveLLBRegexSettingTest/schema.sql +++ /dev/null @@ -1,11 +0,0 @@ -CREATE TABLE "PROPERTIES" ( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "PROP_KEY" VARCHAR(512) NOT NULL, - "RESOURCE_ID" INTEGER, - "USER_ID" INTEGER, - "IS_EMPTY" BOOLEAN NOT NULL, - "TEXT_VALUE" VARCHAR(4000), - "CLOB_VALUE" CLOB, - "CREATED_AT" BIGINT -); -CREATE INDEX "PROPERTIES_KEY" ON "PROPERTIES" ("PROP_KEY"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v81/RemoveNewsboxDismissHotspotsPropertyTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v81/RemoveNewsboxDismissHotspotsPropertyTest/schema.sql deleted file mode 100644 index 8ce5b03c093..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v81/RemoveNewsboxDismissHotspotsPropertyTest/schema.sql +++ /dev/null @@ -1,11 +0,0 @@ -CREATE TABLE "USER_PROPERTIES" ( - "UUID" VARCHAR(40) NOT NULL, - "USER_UUID" VARCHAR(255) NOT NULL, - "KEE" VARCHAR(100) NOT NULL, - "TEXT_VALUE" VARCHAR(4000) NOT NULL, - "CREATED_AT" BIGINT NOT NULL, - "UPDATED_AT" BIGINT NOT NULL, - - CONSTRAINT "PK_USER_PROPERTIES" PRIMARY KEY ("UUID") -); -CREATE UNIQUE INDEX "USER_PROPERTIES_USER_UUID_KEE" ON "USER_PROPERTIES" ("USER_UUID", "KEE"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v81/RenameDaysBeforeDeletingInactiveSLBSettingTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v81/RenameDaysBeforeDeletingInactiveSLBSettingTest/schema.sql deleted file mode 100644 index 367029ea6ba..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v81/RenameDaysBeforeDeletingInactiveSLBSettingTest/schema.sql +++ /dev/null @@ -1,11 +0,0 @@ -CREATE TABLE "PROPERTIES" ( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "PROP_KEY" VARCHAR(512) NOT NULL, - "RESOURCE_ID" INTEGER, - "USER_ID" INTEGER, - "IS_EMPTY" BOOLEAN NOT NULL, - "TEXT_VALUE" VARCHAR(4000), - "CLOB_VALUE" CLOB, - "CREATED_AT" BIGINT -); -CREATE INDEX "PROPERTIES_KEY" ON "PROPERTIES" ("PROP_KEY"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v82/AddIndexOnSlugOfProjectAlmSettingsTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v82/AddIndexOnSlugOfProjectAlmSettingsTest/schema.sql deleted file mode 100644 index 137b8c43e8c..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v82/AddIndexOnSlugOfProjectAlmSettingsTest/schema.sql +++ /dev/null @@ -1,12 +0,0 @@ -CREATE TABLE "PROJECT_ALM_SETTINGS"( - "UUID" VARCHAR(40) NOT NULL, - "ALM_SETTING_UUID" VARCHAR(40) NOT NULL, - "PROJECT_UUID" VARCHAR(50) NOT NULL, - "ALM_REPO" VARCHAR(256), - "ALM_SLUG" VARCHAR(256), - "UPDATED_AT" BIGINT NOT NULL, - "CREATED_AT" BIGINT NOT NULL -); -ALTER TABLE "PROJECT_ALM_SETTINGS" ADD CONSTRAINT "PK_PROJECT_ALM_SETTINGS" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "UNIQ_PROJECT_ALM_SETTINGS" ON "PROJECT_ALM_SETTINGS"("PROJECT_UUID"); -CREATE INDEX "PROJECT_ALM_SETTINGS_ALM" ON "PROJECT_ALM_SETTINGS"("ALM_SETTING_UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v82/DeleteQgateConditionsUsingSecurityHotspotMetricsTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v82/DeleteQgateConditionsUsingSecurityHotspotMetricsTest/schema.sql deleted file mode 100644 index 8a5718c3bc3..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v82/DeleteQgateConditionsUsingSecurityHotspotMetricsTest/schema.sql +++ /dev/null @@ -1,34 +0,0 @@ -CREATE TABLE "METRICS"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "NAME" VARCHAR(64) NOT NULL, - "DESCRIPTION" VARCHAR(255), - "DIRECTION" INTEGER DEFAULT 0 NOT NULL, - "DOMAIN" VARCHAR(64), - "SHORT_NAME" VARCHAR(64), - "QUALITATIVE" BOOLEAN DEFAULT FALSE NOT NULL, - "VAL_TYPE" VARCHAR(8), - "USER_MANAGED" BOOLEAN DEFAULT FALSE, - "ENABLED" BOOLEAN DEFAULT TRUE, - "WORST_VALUE" DOUBLE, - "BEST_VALUE" DOUBLE, - "OPTIMIZED_BEST_VALUE" BOOLEAN, - "HIDDEN" BOOLEAN, - "DELETE_HISTORICAL_DATA" BOOLEAN, - "DECIMAL_SCALE" INTEGER -); -ALTER TABLE "METRICS" ADD CONSTRAINT "PK_METRICS" PRIMARY KEY("ID"); -CREATE UNIQUE INDEX "METRICS_UNIQUE_NAME" ON "METRICS"("NAME"); - - -CREATE TABLE "QUALITY_GATE_CONDITIONS"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "QGATE_ID" INTEGER, - "METRIC_ID" INTEGER, - "PERIOD" INTEGER, - "OPERATOR" VARCHAR(3), - "VALUE_ERROR" VARCHAR(64), - "VALUE_WARNING" VARCHAR(64), - "CREATED_AT" TIMESTAMP, - "UPDATED_AT" TIMESTAMP -); -ALTER TABLE "QUALITY_GATE_CONDITIONS" ADD CONSTRAINT "PK_QUALITY_GATE_CONDITIONS" PRIMARY KEY("ID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v82/DeleteSecurityReviewRatingLiveMeasuresTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v82/DeleteSecurityReviewRatingLiveMeasuresTest/schema.sql deleted file mode 100644 index 3a0e16b77b0..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v82/DeleteSecurityReviewRatingLiveMeasuresTest/schema.sql +++ /dev/null @@ -1,82 +0,0 @@ -CREATE TABLE "COMPONENTS"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "UUID" VARCHAR(50) NOT NULL, - "ORGANIZATION_UUID" VARCHAR(40) NOT NULL, - "KEE" VARCHAR(400), - "DEPRECATED_KEE" VARCHAR(400), - "NAME" VARCHAR(2000), - "LONG_NAME" VARCHAR(2000), - "DESCRIPTION" VARCHAR(2000), - "ENABLED" BOOLEAN DEFAULT TRUE NOT NULL, - "SCOPE" VARCHAR(3), - "QUALIFIER" VARCHAR(10), - "PRIVATE" BOOLEAN NOT NULL, - "ROOT_UUID" VARCHAR(50) NOT NULL, - "LANGUAGE" VARCHAR(20), - "COPY_COMPONENT_UUID" VARCHAR(50), - "PATH" VARCHAR(2000), - "UUID_PATH" VARCHAR(1500) NOT NULL, - "PROJECT_UUID" VARCHAR(50) NOT NULL, - "MODULE_UUID" VARCHAR(50), - "MODULE_UUID_PATH" VARCHAR(1500), - "MAIN_BRANCH_PROJECT_UUID" VARCHAR(50), - "B_CHANGED" BOOLEAN, - "B_NAME" VARCHAR(500), - "B_LONG_NAME" VARCHAR(500), - "B_DESCRIPTION" VARCHAR(2000), - "B_ENABLED" BOOLEAN, - "B_QUALIFIER" VARCHAR(10), - "B_LANGUAGE" VARCHAR(20), - "B_COPY_COMPONENT_UUID" VARCHAR(50), - "B_PATH" VARCHAR(2000), - "B_UUID_PATH" VARCHAR(1500), - "B_MODULE_UUID" VARCHAR(50), - "B_MODULE_UUID_PATH" VARCHAR(1500), - "CREATED_AT" TIMESTAMP -); -ALTER TABLE "COMPONENTS" ADD CONSTRAINT "PK_PROJECTS" PRIMARY KEY("ID"); -CREATE INDEX "PROJECTS_ORGANIZATION" ON "COMPONENTS"("ORGANIZATION_UUID"); -CREATE UNIQUE INDEX "PROJECTS_KEE" ON "COMPONENTS"("KEE"); -CREATE INDEX "PROJECTS_MODULE_UUID" ON "COMPONENTS"("MODULE_UUID"); -CREATE INDEX "PROJECTS_PROJECT_UUID" ON "COMPONENTS"("PROJECT_UUID"); -CREATE INDEX "PROJECTS_QUALIFIER" ON "COMPONENTS"("QUALIFIER"); -CREATE INDEX "PROJECTS_ROOT_UUID" ON "COMPONENTS"("ROOT_UUID"); -CREATE INDEX "PROJECTS_UUID" ON "COMPONENTS"("UUID"); - -CREATE TABLE "METRICS"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "NAME" VARCHAR(64) NOT NULL, - "DESCRIPTION" VARCHAR(255), - "DIRECTION" INTEGER DEFAULT 0 NOT NULL, - "DOMAIN" VARCHAR(64), - "SHORT_NAME" VARCHAR(64), - "QUALITATIVE" BOOLEAN DEFAULT FALSE NOT NULL, - "VAL_TYPE" VARCHAR(8), - "USER_MANAGED" BOOLEAN DEFAULT FALSE, - "ENABLED" BOOLEAN DEFAULT TRUE, - "WORST_VALUE" DOUBLE, - "BEST_VALUE" DOUBLE, - "OPTIMIZED_BEST_VALUE" BOOLEAN, - "HIDDEN" BOOLEAN, - "DELETE_HISTORICAL_DATA" BOOLEAN, - "DECIMAL_SCALE" INTEGER -); -ALTER TABLE "METRICS" ADD CONSTRAINT "PK_METRICS" PRIMARY KEY("ID"); -CREATE UNIQUE INDEX "METRICS_UNIQUE_NAME" ON "METRICS"("NAME"); - -CREATE TABLE "LIVE_MEASURES"( - "UUID" VARCHAR(40) NOT NULL, - "PROJECT_UUID" VARCHAR(50) NOT NULL, - "COMPONENT_UUID" VARCHAR(50) NOT NULL, - "METRIC_ID" INTEGER NOT NULL, - "VALUE" DOUBLE, - "TEXT_VALUE" VARCHAR(4000), - "VARIATION" DOUBLE, - "MEASURE_DATA" BLOB, - "UPDATE_MARKER" VARCHAR(40), - "CREATED_AT" BIGINT NOT NULL, - "UPDATED_AT" BIGINT NOT NULL -); -ALTER TABLE "LIVE_MEASURES" ADD CONSTRAINT "PK_LIVE_MEASURES" PRIMARY KEY("UUID"); -CREATE INDEX "LIVE_MEASURES_PROJECT" ON "LIVE_MEASURES"("PROJECT_UUID"); -CREATE UNIQUE INDEX "LIVE_MEASURES_COMPONENT" ON "LIVE_MEASURES"("COMPONENT_UUID", "METRIC_ID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v82/DropSecurityHotSpotsInReviewStatusTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v82/DropSecurityHotSpotsInReviewStatusTest/schema.sql deleted file mode 100644 index d8f2d4316ab..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v82/DropSecurityHotSpotsInReviewStatusTest/schema.sql +++ /dev/null @@ -1,54 +0,0 @@ -CREATE TABLE "ISSUES"( - "ID" BIGINT NOT NULL AUTO_INCREMENT (1,1), - "KEE" VARCHAR(50) NOT NULL, - "RULE_ID" INTEGER, - "SEVERITY" VARCHAR(10), - "MANUAL_SEVERITY" BOOLEAN NOT NULL, - "MESSAGE" VARCHAR(4000), - "LINE" INTEGER, - "GAP" DOUBLE, - "STATUS" VARCHAR(20), - "RESOLUTION" VARCHAR(20), - "CHECKSUM" VARCHAR(1000), - "REPORTER" VARCHAR(255), - "ASSIGNEE" VARCHAR(255), - "AUTHOR_LOGIN" VARCHAR(255), - "ACTION_PLAN_KEY" VARCHAR(50), - "ISSUE_ATTRIBUTES" VARCHAR(4000), - "EFFORT" INTEGER, - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT, - "ISSUE_CREATION_DATE" BIGINT, - "ISSUE_UPDATE_DATE" BIGINT, - "ISSUE_CLOSE_DATE" BIGINT, - "TAGS" VARCHAR(4000), - "COMPONENT_UUID" VARCHAR(50), - "PROJECT_UUID" VARCHAR(50), - "LOCATIONS" BLOB, - "ISSUE_TYPE" TINYINT, - "FROM_HOTSPOT" BOOLEAN -); -ALTER TABLE "ISSUES" ADD CONSTRAINT "PK_ISSUES" PRIMARY KEY("ID"); -CREATE INDEX "ISSUES_ASSIGNEE" ON "ISSUES"("ASSIGNEE"); -CREATE INDEX "ISSUES_COMPONENT_UUID" ON "ISSUES"("COMPONENT_UUID"); -CREATE INDEX "ISSUES_CREATION_DATE" ON "ISSUES"("ISSUE_CREATION_DATE"); -CREATE UNIQUE INDEX "ISSUES_KEE" ON "ISSUES"("KEE"); -CREATE INDEX "ISSUES_PROJECT_UUID" ON "ISSUES"("PROJECT_UUID"); -CREATE INDEX "ISSUES_RESOLUTION" ON "ISSUES"("RESOLUTION"); -CREATE INDEX "ISSUES_RULE_ID" ON "ISSUES"("RULE_ID"); -CREATE INDEX "ISSUES_UPDATED_AT" ON "ISSUES"("UPDATED_AT"); - -CREATE TABLE "ISSUE_CHANGES"( - "ID" BIGINT NOT NULL AUTO_INCREMENT (1,1), - "KEE" VARCHAR(50), - "ISSUE_KEY" VARCHAR(50) NOT NULL, - "USER_LOGIN" VARCHAR(255), - "CHANGE_TYPE" VARCHAR(20), - "CHANGE_DATA" CLOB(2147483647), - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT, - "ISSUE_CHANGE_CREATION_DATE" BIGINT -); -ALTER TABLE "ISSUE_CHANGES" ADD CONSTRAINT "PK_ISSUE_CHANGES" PRIMARY KEY("ID"); -CREATE INDEX "ISSUE_CHANGES_ISSUE_KEY" ON "ISSUE_CHANGES"("ISSUE_KEY"); -CREATE INDEX "ISSUE_CHANGES_KEE" ON "ISSUE_CHANGES"("KEE"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v82/DropTagsColumnFromComponentsTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v82/DropTagsColumnFromComponentsTableTest/schema.sql deleted file mode 100644 index fda0c51c86c..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v82/DropTagsColumnFromComponentsTableTest/schema.sql +++ /dev/null @@ -1,47 +0,0 @@ -CREATE TABLE "COMPONENTS"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "UUID" VARCHAR(50) NOT NULL, - "ORGANIZATION_UUID" VARCHAR(40) NOT NULL, - "KEE" VARCHAR(400), - "DEPRECATED_KEE" VARCHAR(400), - "NAME" VARCHAR(2000), - "LONG_NAME" VARCHAR(2000), - "DESCRIPTION" VARCHAR(2000), - "ENABLED" BOOLEAN DEFAULT TRUE NOT NULL, - "SCOPE" VARCHAR(3), - "QUALIFIER" VARCHAR(10), - "PRIVATE" BOOLEAN NOT NULL, - "ROOT_UUID" VARCHAR(50) NOT NULL, - "LANGUAGE" VARCHAR(20), - "COPY_COMPONENT_UUID" VARCHAR(50), - "DEVELOPER_UUID" VARCHAR(50), - "PATH" VARCHAR(2000), - "UUID_PATH" VARCHAR(1500) NOT NULL, - "PROJECT_UUID" VARCHAR(50) NOT NULL, - "MODULE_UUID" VARCHAR(50), - "MODULE_UUID_PATH" VARCHAR(1500), - "AUTHORIZATION_UPDATED_AT" BIGINT, - "TAGS" VARCHAR(500), - "MAIN_BRANCH_PROJECT_UUID" VARCHAR(50), - "B_CHANGED" BOOLEAN, - "B_NAME" VARCHAR(500), - "B_LONG_NAME" VARCHAR(500), - "B_DESCRIPTION" VARCHAR(2000), - "B_ENABLED" BOOLEAN, - "B_QUALIFIER" VARCHAR(10), - "B_LANGUAGE" VARCHAR(20), - "B_COPY_COMPONENT_UUID" VARCHAR(50), - "B_PATH" VARCHAR(2000), - "B_UUID_PATH" VARCHAR(1500), - "B_MODULE_UUID" VARCHAR(50), - "B_MODULE_UUID_PATH" VARCHAR(1500), - "CREATED_AT" TIMESTAMP -); -ALTER TABLE "COMPONENTS" ADD CONSTRAINT "PK_PROJECTS" PRIMARY KEY("ID"); -CREATE INDEX "PROJECTS_ORGANIZATION" ON "COMPONENTS"("ORGANIZATION_UUID"); -CREATE UNIQUE INDEX "PROJECTS_KEE" ON "COMPONENTS"("KEE"); -CREATE INDEX "PROJECTS_MODULE_UUID" ON "COMPONENTS"("MODULE_UUID"); -CREATE INDEX "PROJECTS_PROJECT_UUID" ON "COMPONENTS"("PROJECT_UUID"); -CREATE INDEX "PROJECTS_QUALIFIER" ON "COMPONENTS"("QUALIFIER"); -CREATE INDEX "PROJECTS_ROOT_UUID" ON "COMPONENTS"("ROOT_UUID"); -CREATE INDEX "PROJECTS_UUID" ON "COMPONENTS"("UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v82/EnsureHotspotDefaultStatusIsToReviewTest/issues.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v82/EnsureHotspotDefaultStatusIsToReviewTest/issues.sql deleted file mode 100644 index cf65bc42c84..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v82/EnsureHotspotDefaultStatusIsToReviewTest/issues.sql +++ /dev/null @@ -1,39 +0,0 @@ -CREATE TABLE "ISSUES"( - "ID" BIGINT NOT NULL AUTO_INCREMENT (1,1), - "KEE" VARCHAR(50) NOT NULL, - "RULE_ID" INTEGER, - "SEVERITY" VARCHAR(10), - "MANUAL_SEVERITY" BOOLEAN NOT NULL, - "MESSAGE" VARCHAR(4000), - "LINE" INTEGER, - "GAP" DOUBLE, - "STATUS" VARCHAR(20), - "RESOLUTION" VARCHAR(20), - "CHECKSUM" VARCHAR(1000), - "REPORTER" VARCHAR(255), - "ASSIGNEE" VARCHAR(255), - "AUTHOR_LOGIN" VARCHAR(255), - "ACTION_PLAN_KEY" VARCHAR(50), - "ISSUE_ATTRIBUTES" VARCHAR(4000), - "EFFORT" INTEGER, - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT, - "ISSUE_CREATION_DATE" BIGINT, - "ISSUE_UPDATE_DATE" BIGINT, - "ISSUE_CLOSE_DATE" BIGINT, - "TAGS" VARCHAR(4000), - "COMPONENT_UUID" VARCHAR(50), - "PROJECT_UUID" VARCHAR(50), - "LOCATIONS" BLOB, - "ISSUE_TYPE" TINYINT, - "FROM_HOTSPOT" BOOLEAN -); -ALTER TABLE "ISSUES" ADD CONSTRAINT "PK_ISSUES" PRIMARY KEY("ID"); -CREATE INDEX "ISSUES_ASSIGNEE" ON "ISSUES"("ASSIGNEE"); -CREATE INDEX "ISSUES_COMPONENT_UUID" ON "ISSUES"("COMPONENT_UUID"); -CREATE INDEX "ISSUES_CREATION_DATE" ON "ISSUES"("ISSUE_CREATION_DATE"); -CREATE UNIQUE INDEX "ISSUES_KEE" ON "ISSUES"("KEE"); -CREATE INDEX "ISSUES_PROJECT_UUID" ON "ISSUES"("PROJECT_UUID"); -CREATE INDEX "ISSUES_RESOLUTION" ON "ISSUES"("RESOLUTION"); -CREATE INDEX "ISSUES_RULE_ID" ON "ISSUES"("RULE_ID"); -CREATE INDEX "ISSUES_UPDATED_AT" ON "ISSUES"("UPDATED_AT"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v82/MigrateManualVulnerabilitiesToSecurityHotSpotsTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v82/MigrateManualVulnerabilitiesToSecurityHotSpotsTest/schema.sql deleted file mode 100644 index d8f2d4316ab..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v82/MigrateManualVulnerabilitiesToSecurityHotSpotsTest/schema.sql +++ /dev/null @@ -1,54 +0,0 @@ -CREATE TABLE "ISSUES"( - "ID" BIGINT NOT NULL AUTO_INCREMENT (1,1), - "KEE" VARCHAR(50) NOT NULL, - "RULE_ID" INTEGER, - "SEVERITY" VARCHAR(10), - "MANUAL_SEVERITY" BOOLEAN NOT NULL, - "MESSAGE" VARCHAR(4000), - "LINE" INTEGER, - "GAP" DOUBLE, - "STATUS" VARCHAR(20), - "RESOLUTION" VARCHAR(20), - "CHECKSUM" VARCHAR(1000), - "REPORTER" VARCHAR(255), - "ASSIGNEE" VARCHAR(255), - "AUTHOR_LOGIN" VARCHAR(255), - "ACTION_PLAN_KEY" VARCHAR(50), - "ISSUE_ATTRIBUTES" VARCHAR(4000), - "EFFORT" INTEGER, - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT, - "ISSUE_CREATION_DATE" BIGINT, - "ISSUE_UPDATE_DATE" BIGINT, - "ISSUE_CLOSE_DATE" BIGINT, - "TAGS" VARCHAR(4000), - "COMPONENT_UUID" VARCHAR(50), - "PROJECT_UUID" VARCHAR(50), - "LOCATIONS" BLOB, - "ISSUE_TYPE" TINYINT, - "FROM_HOTSPOT" BOOLEAN -); -ALTER TABLE "ISSUES" ADD CONSTRAINT "PK_ISSUES" PRIMARY KEY("ID"); -CREATE INDEX "ISSUES_ASSIGNEE" ON "ISSUES"("ASSIGNEE"); -CREATE INDEX "ISSUES_COMPONENT_UUID" ON "ISSUES"("COMPONENT_UUID"); -CREATE INDEX "ISSUES_CREATION_DATE" ON "ISSUES"("ISSUE_CREATION_DATE"); -CREATE UNIQUE INDEX "ISSUES_KEE" ON "ISSUES"("KEE"); -CREATE INDEX "ISSUES_PROJECT_UUID" ON "ISSUES"("PROJECT_UUID"); -CREATE INDEX "ISSUES_RESOLUTION" ON "ISSUES"("RESOLUTION"); -CREATE INDEX "ISSUES_RULE_ID" ON "ISSUES"("RULE_ID"); -CREATE INDEX "ISSUES_UPDATED_AT" ON "ISSUES"("UPDATED_AT"); - -CREATE TABLE "ISSUE_CHANGES"( - "ID" BIGINT NOT NULL AUTO_INCREMENT (1,1), - "KEE" VARCHAR(50), - "ISSUE_KEY" VARCHAR(50) NOT NULL, - "USER_LOGIN" VARCHAR(255), - "CHANGE_TYPE" VARCHAR(20), - "CHANGE_DATA" CLOB(2147483647), - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT, - "ISSUE_CHANGE_CREATION_DATE" BIGINT -); -ALTER TABLE "ISSUE_CHANGES" ADD CONSTRAINT "PK_ISSUE_CHANGES" PRIMARY KEY("ID"); -CREATE INDEX "ISSUE_CHANGES_ISSUE_KEY" ON "ISSUE_CHANGES"("ISSUE_KEY"); -CREATE INDEX "ISSUE_CHANGES_KEE" ON "ISSUE_CHANGES"("KEE"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v82/PopulateProjectsTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v82/PopulateProjectsTableTest/schema.sql deleted file mode 100644 index b946b235b22..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v82/PopulateProjectsTableTest/schema.sql +++ /dev/null @@ -1,64 +0,0 @@ -CREATE TABLE "COMPONENTS" ( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "ORGANIZATION_UUID" VARCHAR(40) NOT NULL, - "KEE" VARCHAR(400), - "UUID" VARCHAR(50) NOT NULL, - "UUID_PATH" VARCHAR(1500) NOT NULL, - "ROOT_UUID" VARCHAR(50) NOT NULL, - "PROJECT_UUID" VARCHAR(50) NOT NULL, - "MODULE_UUID" VARCHAR(50), - "MODULE_UUID_PATH" VARCHAR(1500), - "MAIN_BRANCH_PROJECT_UUID" VARCHAR(50), - "NAME" VARCHAR(2000), - "DESCRIPTION" VARCHAR(2000), - "PRIVATE" BOOLEAN NOT NULL, - "TAGS" VARCHAR(500), - "ENABLED" BOOLEAN NOT NULL DEFAULT TRUE, - "SCOPE" VARCHAR(3), - "QUALIFIER" VARCHAR(10), - "DEPRECATED_KEE" VARCHAR(400), - "PATH" VARCHAR(2000), - "LANGUAGE" VARCHAR(20), - "COPY_COMPONENT_UUID" VARCHAR(50), - "LONG_NAME" VARCHAR(2000), - "DEVELOPER_UUID" VARCHAR(50), - "CREATED_AT" TIMESTAMP, - "AUTHORIZATION_UPDATED_AT" BIGINT, - "B_CHANGED" BOOLEAN, - "B_COPY_COMPONENT_UUID" VARCHAR(50), - "B_DESCRIPTION" VARCHAR(2000), - "B_ENABLED" BOOLEAN, - "B_UUID_PATH" VARCHAR(1500), - "B_LANGUAGE" VARCHAR(20), - "B_LONG_NAME" VARCHAR(500), - "B_MODULE_UUID" VARCHAR(50), - "B_MODULE_UUID_PATH" VARCHAR(1500), - "B_NAME" VARCHAR(500), - "B_PATH" VARCHAR(2000), - "B_QUALIFIER" VARCHAR(10) -); -CREATE INDEX "PROJECTS_ORGANIZATION" ON "COMPONENTS" ("ORGANIZATION_UUID"); -CREATE UNIQUE INDEX "PROJECTS_KEE" ON "COMPONENTS" ("KEE"); -CREATE INDEX "PROJECTS_ROOT_UUID" ON "COMPONENTS" ("ROOT_UUID"); -CREATE UNIQUE INDEX "PROJECTS_UUID" ON "COMPONENTS" ("UUID"); -CREATE INDEX "PROJECTS_PROJECT_UUID" ON "COMPONENTS" ("PROJECT_UUID"); -CREATE INDEX "PROJECTS_MODULE_UUID" ON "COMPONENTS" ("MODULE_UUID"); -CREATE INDEX "PROJECTS_QUALIFIER" ON "COMPONENTS" ("QUALIFIER"); - -CREATE TABLE PROJECTS ( - UUID VARCHAR(40) PRIMARY KEY, - KEE VARCHAR(400) NOT NULL, - "QUALIFIER" VARCHAR(10) NOT NULL, - ORGANIZATION_UUID VARCHAR(40) NOT NULL, - NAME VARCHAR(2000), - DESCRIPTION VARCHAR(2000), - PRIVATE BOOLEAN NOT NULL, - TAGS VARCHAR(500), - CREATED_AT BIGINT NOT NULL, - UPDATED_AT BIGINT NOT NULL -); - -CREATE UNIQUE INDEX PK_PROJECTS ON PROJECTS(UUID); -CREATE UNIQUE INDEX UNIQ_PROJECTS ON PROJECTS(KEE); -CREATE INDEX IDX_QUALIFIER ON PROJECTS("QUALIFIER"); - diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v82/RemoveNewsboxDismissHotspotsPropertyTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v82/RemoveNewsboxDismissHotspotsPropertyTest/schema.sql deleted file mode 100644 index 8ce5b03c093..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v82/RemoveNewsboxDismissHotspotsPropertyTest/schema.sql +++ /dev/null @@ -1,11 +0,0 @@ -CREATE TABLE "USER_PROPERTIES" ( - "UUID" VARCHAR(40) NOT NULL, - "USER_UUID" VARCHAR(255) NOT NULL, - "KEE" VARCHAR(100) NOT NULL, - "TEXT_VALUE" VARCHAR(4000) NOT NULL, - "CREATED_AT" BIGINT NOT NULL, - "UPDATED_AT" BIGINT NOT NULL, - - CONSTRAINT "PK_USER_PROPERTIES" PRIMARY KEY ("UUID") -); -CREATE UNIQUE INDEX "USER_PROPERTIES_USER_UUID_KEE" ON "USER_PROPERTIES" ("USER_UUID", "KEE"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v82/RenameProjectsTableToComponentsTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v82/RenameProjectsTableToComponentsTest/schema.sql deleted file mode 100644 index 310c9497f30..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v82/RenameProjectsTableToComponentsTest/schema.sql +++ /dev/null @@ -1,48 +0,0 @@ -CREATE TABLE "PROJECTS" ( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "ORGANIZATION_UUID" VARCHAR(40) NOT NULL, - "KEE" VARCHAR(400), - "UUID" VARCHAR(50) NOT NULL, - "UUID_PATH" VARCHAR(1500) NOT NULL, - "ROOT_UUID" VARCHAR(50) NOT NULL, - "PROJECT_UUID" VARCHAR(50) NOT NULL, - "MODULE_UUID" VARCHAR(50), - "MODULE_UUID_PATH" VARCHAR(1500), - "MAIN_BRANCH_PROJECT_UUID" VARCHAR(50), - "NAME" VARCHAR(2000), - "DESCRIPTION" VARCHAR(2000), - "PRIVATE" BOOLEAN NOT NULL, - "TAGS" VARCHAR(500), - "ENABLED" BOOLEAN NOT NULL DEFAULT TRUE, - "SCOPE" VARCHAR(3), - "QUALIFIER" VARCHAR(10), - "DEPRECATED_KEE" VARCHAR(400), - "PATH" VARCHAR(2000), - "LANGUAGE" VARCHAR(20), - "COPY_COMPONENT_UUID" VARCHAR(50), - "LONG_NAME" VARCHAR(2000), - "DEVELOPER_UUID" VARCHAR(50), - "CREATED_AT" TIMESTAMP, - "AUTHORIZATION_UPDATED_AT" BIGINT, - "B_CHANGED" BOOLEAN, - "B_COPY_COMPONENT_UUID" VARCHAR(50), - "B_DESCRIPTION" VARCHAR(2000), - "B_ENABLED" BOOLEAN, - "B_UUID_PATH" VARCHAR(1500), - "B_LANGUAGE" VARCHAR(20), - "B_LONG_NAME" VARCHAR(500), - "B_MODULE_UUID" VARCHAR(50), - "B_MODULE_UUID_PATH" VARCHAR(1500), - "B_NAME" VARCHAR(500), - "B_PATH" VARCHAR(2000), - "B_QUALIFIER" VARCHAR(10) -); -ALTER TABLE "PROJECTS" ADD CONSTRAINT "PK_PROJECTS" PRIMARY KEY("ID"); - -CREATE INDEX "PROJECTS_ORGANIZATION" ON "PROJECTS" ("ORGANIZATION_UUID"); -CREATE UNIQUE INDEX "PROJECTS_KEE" ON "PROJECTS" ("KEE"); -CREATE INDEX "PROJECTS_ROOT_UUID" ON "PROJECTS" ("ROOT_UUID"); -CREATE UNIQUE INDEX "PROJECTS_UUID" ON "PROJECTS" ("UUID"); -CREATE INDEX "PROJECTS_PROJECT_UUID" ON "PROJECTS" ("PROJECT_UUID"); -CREATE INDEX "PROJECTS_MODULE_UUID" ON "PROJECTS" ("MODULE_UUID"); -CREATE INDEX "PROJECTS_QUALIFIER" ON "PROJECTS" ("QUALIFIER"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v83/AddSummaryEnabledColumnToAlmSettingsTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v83/AddSummaryEnabledColumnToAlmSettingsTest/schema.sql deleted file mode 100644 index ead60d1b1e3..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v83/AddSummaryEnabledColumnToAlmSettingsTest/schema.sql +++ /dev/null @@ -1,13 +0,0 @@ -CREATE TABLE "PROJECT_ALM_SETTINGS"( - "UUID" VARCHAR(40) NOT NULL, - "ALM_SETTING_UUID" VARCHAR(40) NOT NULL, - "PROJECT_UUID" VARCHAR(50) NOT NULL, - "ALM_REPO" VARCHAR(256), - "ALM_SLUG" VARCHAR(256), - "UPDATED_AT" BIGINT NOT NULL, - "CREATED_AT" BIGINT NOT NULL -); -ALTER TABLE "PROJECT_ALM_SETTINGS" ADD CONSTRAINT "PK_PROJECT_ALM_SETTINGS" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "UNIQ_PROJECT_ALM_SETTINGS" ON "PROJECT_ALM_SETTINGS"("PROJECT_UUID"); -CREATE INDEX "PROJECT_ALM_SETTINGS_ALM" ON "PROJECT_ALM_SETTINGS"("ALM_SETTING_UUID"); -CREATE INDEX "PROJECT_ALM_SETTINGS_SLUG" ON "PROJECT_ALM_SETTINGS"("ALM_SLUG"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v83/DropIdFromComponentsTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v83/DropIdFromComponentsTableTest/schema.sql deleted file mode 100644 index 58865e22e82..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v83/DropIdFromComponentsTableTest/schema.sql +++ /dev/null @@ -1,44 +0,0 @@ -CREATE TABLE "COMPONENTS"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "UUID" VARCHAR(50) NOT NULL, - "ORGANIZATION_UUID" VARCHAR(40) NOT NULL, - "KEE" VARCHAR(400), - "DEPRECATED_KEE" VARCHAR(400), - "NAME" VARCHAR(2000), - "LONG_NAME" VARCHAR(2000), - "DESCRIPTION" VARCHAR(2000), - "ENABLED" BOOLEAN DEFAULT TRUE NOT NULL, - "SCOPE" VARCHAR(3), - "QUALIFIER" VARCHAR(10), - "PRIVATE" BOOLEAN NOT NULL, - "ROOT_UUID" VARCHAR(50) NOT NULL, - "LANGUAGE" VARCHAR(20), - "COPY_COMPONENT_UUID" VARCHAR(50), - "PATH" VARCHAR(2000), - "UUID_PATH" VARCHAR(1500) NOT NULL, - "PROJECT_UUID" VARCHAR(50) NOT NULL, - "MODULE_UUID" VARCHAR(50), - "MODULE_UUID_PATH" VARCHAR(1500), - "MAIN_BRANCH_PROJECT_UUID" VARCHAR(50), - "B_CHANGED" BOOLEAN, - "B_NAME" VARCHAR(500), - "B_LONG_NAME" VARCHAR(500), - "B_DESCRIPTION" VARCHAR(2000), - "B_ENABLED" BOOLEAN, - "B_QUALIFIER" VARCHAR(10), - "B_LANGUAGE" VARCHAR(20), - "B_COPY_COMPONENT_UUID" VARCHAR(50), - "B_PATH" VARCHAR(2000), - "B_UUID_PATH" VARCHAR(1500), - "B_MODULE_UUID" VARCHAR(50), - "B_MODULE_UUID_PATH" VARCHAR(1500), - "CREATED_AT" TIMESTAMP -); -ALTER TABLE "COMPONENTS" ADD CONSTRAINT "PK_PROJECTS" PRIMARY KEY("ID"); -CREATE INDEX "PROJECTS_ORGANIZATION" ON "COMPONENTS"("ORGANIZATION_UUID"); -CREATE UNIQUE INDEX "PROJECTS_KEE" ON "COMPONENTS"("KEE"); -CREATE INDEX "PROJECTS_MODULE_UUID" ON "COMPONENTS"("MODULE_UUID"); -CREATE INDEX "PROJECTS_PROJECT_UUID" ON "COMPONENTS"("PROJECT_UUID"); -CREATE INDEX "PROJECTS_QUALIFIER" ON "COMPONENTS"("QUALIFIER"); -CREATE INDEX "PROJECTS_ROOT_UUID" ON "COMPONENTS"("ROOT_UUID"); -CREATE INDEX "PROJECTS_UUID" ON "COMPONENTS"("UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v83/PopulateSummaryCommentEnabledColumnForGitHubTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v83/PopulateSummaryCommentEnabledColumnForGitHubTest/schema.sql deleted file mode 100644 index 320a964ba06..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v83/PopulateSummaryCommentEnabledColumnForGitHubTest/schema.sql +++ /dev/null @@ -1,28 +0,0 @@ -CREATE TABLE "ALM_SETTINGS"( - "UUID" VARCHAR(40) NOT NULL, - "ALM_ID" VARCHAR(40) NOT NULL, - "KEE" VARCHAR(200) NOT NULL, - "URL" VARCHAR(2000), - "APP_ID" VARCHAR(80), - "PRIVATE_KEY" VARCHAR(2000), - "PAT" VARCHAR(2000), - "UPDATED_AT" BIGINT NOT NULL, - "CREATED_AT" BIGINT NOT NULL -); -ALTER TABLE "ALM_SETTINGS" ADD CONSTRAINT "PK_ALM_SETTINGS" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "UNIQ_ALM_SETTINGS" ON "ALM_SETTINGS"("KEE"); - -CREATE TABLE "PROJECT_ALM_SETTINGS"( - "UUID" VARCHAR(40) NOT NULL, - "ALM_SETTING_UUID" VARCHAR(40) NOT NULL, - "PROJECT_UUID" VARCHAR(50) NOT NULL, - "ALM_REPO" VARCHAR(256), - "ALM_SLUG" VARCHAR(256), - "UPDATED_AT" BIGINT NOT NULL, - "CREATED_AT" BIGINT NOT NULL, - "SUMMARY_COMMENT_ENABLED" BOOLEAN -); -ALTER TABLE "PROJECT_ALM_SETTINGS" ADD CONSTRAINT "PK_PROJECT_ALM_SETTINGS" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "UNIQ_PROJECT_ALM_SETTINGS" ON "PROJECT_ALM_SETTINGS"("PROJECT_UUID"); -CREATE INDEX "PROJECT_ALM_SETTINGS_ALM" ON "PROJECT_ALM_SETTINGS"("ALM_SETTING_UUID"); -CREATE INDEX "PROJECT_ALM_SETTINGS_SLUG" ON "PROJECT_ALM_SETTINGS"("ALM_SLUG"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v83/grouproles/AddComponentUuidColumnToGroupRolesTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v83/grouproles/AddComponentUuidColumnToGroupRolesTest/schema.sql deleted file mode 100644 index 9373e3f73fc..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v83/grouproles/AddComponentUuidColumnToGroupRolesTest/schema.sql +++ /dev/null @@ -1,10 +0,0 @@ -CREATE TABLE "GROUP_ROLES"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "ORGANIZATION_UUID" VARCHAR(40) NOT NULL, - "GROUP_ID" INTEGER, - "RESOURCE_ID" INTEGER, - "ROLE" VARCHAR(64) NOT NULL -); -ALTER TABLE "GROUP_ROLES" ADD CONSTRAINT "PK_GROUP_ROLES" PRIMARY KEY("ID"); -CREATE UNIQUE INDEX "UNIQ_GROUP_ROLES" ON "GROUP_ROLES"("ORGANIZATION_UUID", "GROUP_ID", "RESOURCE_ID", "ROLE"); -CREATE INDEX "GROUP_ROLES_RESOURCE" ON "GROUP_ROLES"("RESOURCE_ID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v83/grouproles/DropResourceIdFromGroupRolesTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v83/grouproles/DropResourceIdFromGroupRolesTableTest/schema.sql deleted file mode 100644 index 36a3d90337c..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v83/grouproles/DropResourceIdFromGroupRolesTableTest/schema.sql +++ /dev/null @@ -1,12 +0,0 @@ -CREATE TABLE "GROUP_ROLES"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "ORGANIZATION_UUID" VARCHAR(40) NOT NULL, - "COMPONENT_UUID" VARCHAR(50), - "GROUP_ID" INTEGER, - "RESOURCE_ID" INTEGER, - "ROLE" VARCHAR(64) NOT NULL -); -ALTER TABLE "GROUP_ROLES" ADD CONSTRAINT "PK_GROUP_ROLES" PRIMARY KEY("ID"); -CREATE UNIQUE INDEX "UNIQ_GROUP_ROLES" ON "GROUP_ROLES"("ORGANIZATION_UUID", "GROUP_ID", "RESOURCE_ID", "ROLE"); -CREATE INDEX "GROUP_ROLES_RESOURCE" ON "GROUP_ROLES"("RESOURCE_ID"); -CREATE INDEX "GROUP_ROLES_COMPONENT_UUID" ON "GROUP_ROLES"("COMPONENT_UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v83/grouproles/MigrateResourceIdToUuidInGroupRolesTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v83/grouproles/MigrateResourceIdToUuidInGroupRolesTest/schema.sql deleted file mode 100644 index 04d3cb4b33b..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v83/grouproles/MigrateResourceIdToUuidInGroupRolesTest/schema.sql +++ /dev/null @@ -1,58 +0,0 @@ -CREATE TABLE "GROUP_ROLES"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "ORGANIZATION_UUID" VARCHAR(40) NOT NULL, - "COMPONENT_UUID" VARCHAR(50), - "GROUP_ID" INTEGER, - "RESOURCE_ID" INTEGER, - "ROLE" VARCHAR(64) NOT NULL -); -ALTER TABLE "GROUP_ROLES" ADD CONSTRAINT "PK_GROUP_ROLES" PRIMARY KEY("ID"); -CREATE UNIQUE INDEX "UNIQ_GROUP_ROLES" ON "GROUP_ROLES"("ORGANIZATION_UUID", "GROUP_ID", "RESOURCE_ID", "ROLE"); -CREATE UNIQUE INDEX "GROUP_ROLES_UNIQ" ON "GROUP_ROLES"("ORGANIZATION_UUID", "GROUP_ID", "COMPONENT_UUID", "ROLE"); -CREATE INDEX "GROUP_ROLES_RESOURCE" ON "GROUP_ROLES"("RESOURCE_ID"); -CREATE INDEX "GROUP_ROLES_COMPONENT_UUID" ON "GROUP_ROLES"("COMPONENT_UUID"); - -CREATE TABLE "COMPONENTS"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "UUID" VARCHAR(50) NOT NULL, - "ORGANIZATION_UUID" VARCHAR(40) NOT NULL, - "KEE" VARCHAR(400), - "DEPRECATED_KEE" VARCHAR(400), - "NAME" VARCHAR(2000), - "LONG_NAME" VARCHAR(2000), - "DESCRIPTION" VARCHAR(2000), - "ENABLED" BOOLEAN DEFAULT TRUE NOT NULL, - "SCOPE" VARCHAR(3), - "QUALIFIER" VARCHAR(10), - "PRIVATE" BOOLEAN NOT NULL, - "ROOT_UUID" VARCHAR(50) NOT NULL, - "LANGUAGE" VARCHAR(20), - "COPY_COMPONENT_UUID" VARCHAR(50), - "PATH" VARCHAR(2000), - "UUID_PATH" VARCHAR(1500) NOT NULL, - "PROJECT_UUID" VARCHAR(50) NOT NULL, - "MODULE_UUID" VARCHAR(50), - "MODULE_UUID_PATH" VARCHAR(1500), - "MAIN_BRANCH_PROJECT_UUID" VARCHAR(50), - "B_CHANGED" BOOLEAN, - "B_NAME" VARCHAR(500), - "B_LONG_NAME" VARCHAR(500), - "B_DESCRIPTION" VARCHAR(2000), - "B_ENABLED" BOOLEAN, - "B_QUALIFIER" VARCHAR(10), - "B_LANGUAGE" VARCHAR(20), - "B_COPY_COMPONENT_UUID" VARCHAR(50), - "B_PATH" VARCHAR(2000), - "B_UUID_PATH" VARCHAR(1500), - "B_MODULE_UUID" VARCHAR(50), - "B_MODULE_UUID_PATH" VARCHAR(1500), - "CREATED_AT" TIMESTAMP -); -ALTER TABLE "COMPONENTS" ADD CONSTRAINT "PK_PROJECTS" PRIMARY KEY("ID"); -CREATE INDEX "PROJECTS_ORGANIZATION" ON "COMPONENTS"("ORGANIZATION_UUID"); -CREATE UNIQUE INDEX "PROJECTS_KEE" ON "COMPONENTS"("KEE"); -CREATE INDEX "PROJECTS_MODULE_UUID" ON "COMPONENTS"("MODULE_UUID"); -CREATE INDEX "PROJECTS_PROJECT_UUID" ON "COMPONENTS"("PROJECT_UUID"); -CREATE INDEX "PROJECTS_QUALIFIER" ON "COMPONENTS"("QUALIFIER"); -CREATE INDEX "PROJECTS_ROOT_UUID" ON "COMPONENTS"("ROOT_UUID"); -CREATE INDEX "PROJECTS_UUID" ON "COMPONENTS"("UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v83/properties/AddComponentUuidColumnToPropertiesTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v83/properties/AddComponentUuidColumnToPropertiesTest/schema.sql deleted file mode 100644 index 2ac16011ffb..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v83/properties/AddComponentUuidColumnToPropertiesTest/schema.sql +++ /dev/null @@ -1,12 +0,0 @@ -CREATE TABLE "PROPERTIES"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "PROP_KEY" VARCHAR(512) NOT NULL, - "RESOURCE_ID" BIGINT, - "USER_ID" BIGINT, - "IS_EMPTY" BOOLEAN NOT NULL, - "TEXT_VALUE" VARCHAR(4000), - "CLOB_VALUE" CLOB(2147483647), - "CREATED_AT" BIGINT NOT NULL -); -ALTER TABLE "PROPERTIES" ADD CONSTRAINT "PK_PROPERTIES" PRIMARY KEY("ID"); -CREATE INDEX "PROPERTIES_KEY" ON "PROPERTIES"("PROP_KEY"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v83/properties/DropResourceIdFromPropertiesTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v83/properties/DropResourceIdFromPropertiesTableTest/schema.sql deleted file mode 100644 index 529e0a0e1b2..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v83/properties/DropResourceIdFromPropertiesTableTest/schema.sql +++ /dev/null @@ -1,13 +0,0 @@ -CREATE TABLE "PROPERTIES"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "COMPONENT_UUID" VARCHAR(50), - "PROP_KEY" VARCHAR(512) NOT NULL, - "RESOURCE_ID" BIGINT, - "USER_ID" BIGINT, - "IS_EMPTY" BOOLEAN NOT NULL, - "TEXT_VALUE" VARCHAR(4000), - "CLOB_VALUE" CLOB(2147483647), - "CREATED_AT" BIGINT NOT NULL -); -ALTER TABLE "PROPERTIES" ADD CONSTRAINT "PK_PROPERTIES" PRIMARY KEY("ID"); -CREATE INDEX "PROPERTIES_KEY" ON "PROPERTIES"("PROP_KEY"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v83/properties/MigrateResourceIdToUuidInPropertiesTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v83/properties/MigrateResourceIdToUuidInPropertiesTest/schema.sql deleted file mode 100644 index aff8977ca26..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v83/properties/MigrateResourceIdToUuidInPropertiesTest/schema.sql +++ /dev/null @@ -1,58 +0,0 @@ -CREATE TABLE "PROPERTIES"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "COMPONENT_UUID" VARCHAR(50), - "PROP_KEY" VARCHAR(512) NOT NULL, - "RESOURCE_ID" BIGINT, - "USER_ID" BIGINT, - "IS_EMPTY" BOOLEAN NOT NULL, - "TEXT_VALUE" VARCHAR(4000), - "CLOB_VALUE" CLOB(2147483647), - "CREATED_AT" BIGINT NOT NULL -); -ALTER TABLE "PROPERTIES" ADD CONSTRAINT "PK_PROPERTIES" PRIMARY KEY("ID"); -CREATE INDEX "PROPERTIES_KEY" ON "PROPERTIES"("PROP_KEY"); - -CREATE TABLE "COMPONENTS"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "UUID" VARCHAR(50) NOT NULL, - "ORGANIZATION_UUID" VARCHAR(40) NOT NULL, - "KEE" VARCHAR(400), - "DEPRECATED_KEE" VARCHAR(400), - "NAME" VARCHAR(2000), - "LONG_NAME" VARCHAR(2000), - "DESCRIPTION" VARCHAR(2000), - "ENABLED" BOOLEAN DEFAULT TRUE NOT NULL, - "SCOPE" VARCHAR(3), - "QUALIFIER" VARCHAR(10), - "PRIVATE" BOOLEAN NOT NULL, - "ROOT_UUID" VARCHAR(50) NOT NULL, - "LANGUAGE" VARCHAR(20), - "COPY_COMPONENT_UUID" VARCHAR(50), - "PATH" VARCHAR(2000), - "UUID_PATH" VARCHAR(1500) NOT NULL, - "PROJECT_UUID" VARCHAR(50) NOT NULL, - "MODULE_UUID" VARCHAR(50), - "MODULE_UUID_PATH" VARCHAR(1500), - "MAIN_BRANCH_PROJECT_UUID" VARCHAR(50), - "B_CHANGED" BOOLEAN, - "B_NAME" VARCHAR(500), - "B_LONG_NAME" VARCHAR(500), - "B_DESCRIPTION" VARCHAR(2000), - "B_ENABLED" BOOLEAN, - "B_QUALIFIER" VARCHAR(10), - "B_LANGUAGE" VARCHAR(20), - "B_COPY_COMPONENT_UUID" VARCHAR(50), - "B_PATH" VARCHAR(2000), - "B_UUID_PATH" VARCHAR(1500), - "B_MODULE_UUID" VARCHAR(50), - "B_MODULE_UUID_PATH" VARCHAR(1500), - "CREATED_AT" TIMESTAMP -); -ALTER TABLE "COMPONENTS" ADD CONSTRAINT "PK_PROJECTS" PRIMARY KEY("ID"); -CREATE INDEX "PROJECTS_ORGANIZATION" ON "COMPONENTS"("ORGANIZATION_UUID"); -CREATE UNIQUE INDEX "PROJECTS_KEE" ON "COMPONENTS"("KEE"); -CREATE INDEX "PROJECTS_MODULE_UUID" ON "COMPONENTS"("MODULE_UUID"); -CREATE INDEX "PROJECTS_PROJECT_UUID" ON "COMPONENTS"("PROJECT_UUID"); -CREATE INDEX "PROJECTS_QUALIFIER" ON "COMPONENTS"("QUALIFIER"); -CREATE INDEX "PROJECTS_ROOT_UUID" ON "COMPONENTS"("ROOT_UUID"); -CREATE INDEX "PROJECTS_UUID" ON "COMPONENTS"("UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v83/userroles/AddComponentUuidColumnToUserRolesTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v83/userroles/AddComponentUuidColumnToUserRolesTest/schema.sql deleted file mode 100644 index b4879f33cab..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v83/userroles/AddComponentUuidColumnToUserRolesTest/schema.sql +++ /dev/null @@ -1,10 +0,0 @@ -CREATE TABLE "USER_ROLES"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "ORGANIZATION_UUID" VARCHAR(40) NOT NULL, - "USER_ID" INTEGER, - "RESOURCE_ID" INTEGER, - "ROLE" VARCHAR(64) NOT NULL -); -ALTER TABLE "USER_ROLES" ADD CONSTRAINT "PK_USER_ROLES" PRIMARY KEY("ID"); -CREATE INDEX "USER_ROLES_RESOURCE" ON "USER_ROLES"("RESOURCE_ID"); -CREATE INDEX "USER_ROLES_USER" ON "USER_ROLES"("USER_ID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v83/userroles/DropResourceIdFromUserRolesTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v83/userroles/DropResourceIdFromUserRolesTableTest/schema.sql deleted file mode 100644 index 62e4238b217..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v83/userroles/DropResourceIdFromUserRolesTableTest/schema.sql +++ /dev/null @@ -1,12 +0,0 @@ -CREATE TABLE "USER_ROLES"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "ORGANIZATION_UUID" VARCHAR(40) NOT NULL, - "COMPONENT_UUID" VARCHAR(50), - "USER_ID" INTEGER, - "RESOURCE_ID" INTEGER, - "ROLE" VARCHAR(64) NOT NULL -); -ALTER TABLE "USER_ROLES" ADD CONSTRAINT "PK_USER_ROLES" PRIMARY KEY("ID"); -CREATE INDEX "USER_ROLES_RESOURCE" ON "USER_ROLES"("RESOURCE_ID"); -CREATE INDEX "USER_ROLES_USER" ON "USER_ROLES"("USER_ID"); -CREATE INDEX "USER_ROLES_COMPONENT_UUID" ON "USER_ROLES"("COMPONENT_UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v83/userroles/MigrateResourceIdToUuidInUserRolesTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v83/userroles/MigrateResourceIdToUuidInUserRolesTest/schema.sql deleted file mode 100644 index fb91fd36c54..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v83/userroles/MigrateResourceIdToUuidInUserRolesTest/schema.sql +++ /dev/null @@ -1,57 +0,0 @@ -CREATE TABLE "USER_ROLES"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "ORGANIZATION_UUID" VARCHAR(40) NOT NULL, - "COMPONENT_UUID" VARCHAR(50), - "USER_ID" INTEGER, - "RESOURCE_ID" INTEGER, - "ROLE" VARCHAR(64) NOT NULL -); -ALTER TABLE "USER_ROLES" ADD CONSTRAINT "PK_USER_ROLES" PRIMARY KEY("ID"); -CREATE INDEX "USER_ROLES_RESOURCE" ON "USER_ROLES"("RESOURCE_ID"); -CREATE INDEX "USER_ROLES_USER" ON "USER_ROLES"("USER_ID"); -CREATE INDEX "USER_ROLES_COMPONENT_UUID" ON "USER_ROLES"("COMPONENT_UUID"); - -CREATE TABLE "COMPONENTS"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "UUID" VARCHAR(50) NOT NULL, - "ORGANIZATION_UUID" VARCHAR(40) NOT NULL, - "KEE" VARCHAR(400), - "DEPRECATED_KEE" VARCHAR(400), - "NAME" VARCHAR(2000), - "LONG_NAME" VARCHAR(2000), - "DESCRIPTION" VARCHAR(2000), - "ENABLED" BOOLEAN DEFAULT TRUE NOT NULL, - "SCOPE" VARCHAR(3), - "QUALIFIER" VARCHAR(10), - "PRIVATE" BOOLEAN NOT NULL, - "ROOT_UUID" VARCHAR(50) NOT NULL, - "LANGUAGE" VARCHAR(20), - "COPY_COMPONENT_UUID" VARCHAR(50), - "PATH" VARCHAR(2000), - "UUID_PATH" VARCHAR(1500) NOT NULL, - "PROJECT_UUID" VARCHAR(50) NOT NULL, - "MODULE_UUID" VARCHAR(50), - "MODULE_UUID_PATH" VARCHAR(1500), - "MAIN_BRANCH_PROJECT_UUID" VARCHAR(50), - "B_CHANGED" BOOLEAN, - "B_NAME" VARCHAR(500), - "B_LONG_NAME" VARCHAR(500), - "B_DESCRIPTION" VARCHAR(2000), - "B_ENABLED" BOOLEAN, - "B_QUALIFIER" VARCHAR(10), - "B_LANGUAGE" VARCHAR(20), - "B_COPY_COMPONENT_UUID" VARCHAR(50), - "B_PATH" VARCHAR(2000), - "B_UUID_PATH" VARCHAR(1500), - "B_MODULE_UUID" VARCHAR(50), - "B_MODULE_UUID_PATH" VARCHAR(1500), - "CREATED_AT" TIMESTAMP -); -ALTER TABLE "COMPONENTS" ADD CONSTRAINT "PK_PROJECTS" PRIMARY KEY("ID"); -CREATE INDEX "PROJECTS_ORGANIZATION" ON "COMPONENTS"("ORGANIZATION_UUID"); -CREATE UNIQUE INDEX "PROJECTS_KEE" ON "COMPONENTS"("KEE"); -CREATE INDEX "PROJECTS_MODULE_UUID" ON "COMPONENTS"("MODULE_UUID"); -CREATE INDEX "PROJECTS_PROJECT_UUID" ON "COMPONENTS"("PROJECT_UUID"); -CREATE INDEX "PROJECTS_QUALIFIER" ON "COMPONENTS"("QUALIFIER"); -CREATE INDEX "PROJECTS_ROOT_UUID" ON "COMPONENTS"("ROOT_UUID"); -CREATE INDEX "PROJECTS_UUID" ON "COMPONENTS"("UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/AddProjectBranchesNeedIssueSyncTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/AddProjectBranchesNeedIssueSyncTest/schema.sql deleted file mode 100644 index 04995e9560f..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/AddProjectBranchesNeedIssueSyncTest/schema.sql +++ /dev/null @@ -1,15 +0,0 @@ -CREATE TABLE "PROJECT_BRANCHES"( - "UUID" VARCHAR(50) NOT NULL, - "PROJECT_UUID" VARCHAR(50) NOT NULL, - "KEE" VARCHAR(255) NOT NULL, - "BRANCH_TYPE" VARCHAR(12), - "MERGE_BRANCH_UUID" VARCHAR(50), - "KEY_TYPE" VARCHAR(12) NOT NULL, - "PULL_REQUEST_BINARY" BLOB, - "MANUAL_BASELINE_ANALYSIS_UUID" VARCHAR(40), - "CREATED_AT" BIGINT NOT NULL, - "UPDATED_AT" BIGINT NOT NULL, - "EXCLUDE_FROM_PURGE" BOOLEAN DEFAULT FALSE NOT NULL -); -ALTER TABLE "PROJECT_BRANCHES" ADD CONSTRAINT "PK_PROJECT_BRANCHES" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "PROJECT_BRANCHES_KEE_KEY_TYPE" ON "PROJECT_BRANCHES"("PROJECT_UUID", "KEE", "KEY_TYPE"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/MakeProjectBranchesNeedIssueSyncNonNullTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/MakeProjectBranchesNeedIssueSyncNonNullTest/schema.sql deleted file mode 100644 index de231f6b163..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/MakeProjectBranchesNeedIssueSyncNonNullTest/schema.sql +++ /dev/null @@ -1,16 +0,0 @@ -CREATE TABLE "PROJECT_BRANCHES"( - "UUID" VARCHAR(50) NOT NULL, - "PROJECT_UUID" VARCHAR(50) NOT NULL, - "KEE" VARCHAR(255) NOT NULL, - "BRANCH_TYPE" VARCHAR(12), - "MERGE_BRANCH_UUID" VARCHAR(50), - "KEY_TYPE" VARCHAR(12) NOT NULL, - "PULL_REQUEST_BINARY" BLOB, - "MANUAL_BASELINE_ANALYSIS_UUID" VARCHAR(40), - "CREATED_AT" BIGINT NOT NULL, - "UPDATED_AT" BIGINT NOT NULL, - "EXCLUDE_FROM_PURGE" BOOLEAN DEFAULT FALSE NOT NULL, - "NEED_ISSUE_SYNC" BOOLEAN -); -ALTER TABLE "PROJECT_BRANCHES" ADD CONSTRAINT "PK_PROJECT_BRANCHES" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "PROJECT_BRANCHES_KEE_KEY_TYPE" ON "PROJECT_BRANCHES"("PROJECT_UUID", "KEE", "KEY_TYPE"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/PopulateProjectBranchesNeedIssueSyncTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/PopulateProjectBranchesNeedIssueSyncTest/schema.sql deleted file mode 100644 index de231f6b163..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/PopulateProjectBranchesNeedIssueSyncTest/schema.sql +++ /dev/null @@ -1,16 +0,0 @@ -CREATE TABLE "PROJECT_BRANCHES"( - "UUID" VARCHAR(50) NOT NULL, - "PROJECT_UUID" VARCHAR(50) NOT NULL, - "KEE" VARCHAR(255) NOT NULL, - "BRANCH_TYPE" VARCHAR(12), - "MERGE_BRANCH_UUID" VARCHAR(50), - "KEY_TYPE" VARCHAR(12) NOT NULL, - "PULL_REQUEST_BINARY" BLOB, - "MANUAL_BASELINE_ANALYSIS_UUID" VARCHAR(40), - "CREATED_AT" BIGINT NOT NULL, - "UPDATED_AT" BIGINT NOT NULL, - "EXCLUDE_FROM_PURGE" BOOLEAN DEFAULT FALSE NOT NULL, - "NEED_ISSUE_SYNC" BOOLEAN -); -ALTER TABLE "PROJECT_BRANCHES" ADD CONSTRAINT "PK_PROJECT_BRANCHES" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "PROJECT_BRANCHES_KEE_KEY_TYPE" ON "PROJECT_BRANCHES"("PROJECT_UUID", "KEE", "KEY_TYPE"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/RemoveFilesFavouritesFromPropertiesTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/RemoveFilesFavouritesFromPropertiesTest/schema.sql deleted file mode 100644 index d3f75a5915c..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/RemoveFilesFavouritesFromPropertiesTest/schema.sql +++ /dev/null @@ -1,55 +0,0 @@ -CREATE TABLE "COMPONENTS"( - "UUID" VARCHAR(50) NOT NULL, - "ORGANIZATION_UUID" VARCHAR(40) NOT NULL, - "KEE" VARCHAR(400), - "DEPRECATED_KEE" VARCHAR(400), - "NAME" VARCHAR(2000), - "LONG_NAME" VARCHAR(2000), - "DESCRIPTION" VARCHAR(2000), - "ENABLED" BOOLEAN DEFAULT TRUE NOT NULL, - "SCOPE" VARCHAR(3), - "QUALIFIER" VARCHAR(10), - "PRIVATE" BOOLEAN NOT NULL, - "ROOT_UUID" VARCHAR(50) NOT NULL, - "LANGUAGE" VARCHAR(20), - "COPY_COMPONENT_UUID" VARCHAR(50), - "PATH" VARCHAR(2000), - "UUID_PATH" VARCHAR(1500) NOT NULL, - "PROJECT_UUID" VARCHAR(50) NOT NULL, - "MODULE_UUID" VARCHAR(50), - "MODULE_UUID_PATH" VARCHAR(1500), - "MAIN_BRANCH_PROJECT_UUID" VARCHAR(50), - "B_CHANGED" BOOLEAN, - "B_NAME" VARCHAR(500), - "B_LONG_NAME" VARCHAR(500), - "B_DESCRIPTION" VARCHAR(2000), - "B_ENABLED" BOOLEAN, - "B_QUALIFIER" VARCHAR(10), - "B_LANGUAGE" VARCHAR(20), - "B_COPY_COMPONENT_UUID" VARCHAR(50), - "B_PATH" VARCHAR(2000), - "B_UUID_PATH" VARCHAR(1500), - "B_MODULE_UUID" VARCHAR(50), - "B_MODULE_UUID_PATH" VARCHAR(1500), - "CREATED_AT" TIMESTAMP -); -CREATE INDEX "PROJECTS_ORGANIZATION" ON "COMPONENTS"("ORGANIZATION_UUID"); -CREATE UNIQUE INDEX "PROJECTS_KEE" ON "COMPONENTS"("KEE"); -CREATE INDEX "PROJECTS_MODULE_UUID" ON "COMPONENTS"("MODULE_UUID"); -CREATE INDEX "PROJECTS_PROJECT_UUID" ON "COMPONENTS"("PROJECT_UUID"); -CREATE INDEX "PROJECTS_QUALIFIER" ON "COMPONENTS"("QUALIFIER"); -CREATE INDEX "PROJECTS_ROOT_UUID" ON "COMPONENTS"("ROOT_UUID"); -CREATE INDEX "PROJECTS_UUID" ON "COMPONENTS"("UUID"); - -CREATE TABLE "PROPERTIES"( - "UUID" VARCHAR(40) NOT NULL, - "PROP_KEY" VARCHAR(512) NOT NULL, - "USER_UUID" VARCHAR(40), - "IS_EMPTY" BOOLEAN NOT NULL, - "TEXT_VALUE" VARCHAR(4000), - "CLOB_VALUE" CLOB(2147483647), - "CREATED_AT" BIGINT NOT NULL, - "COMPONENT_UUID" VARCHAR(40) -); -ALTER TABLE "PROPERTIES" ADD CONSTRAINT "PK_PROPERTIES" PRIMARY KEY("UUID"); -CREATE INDEX "PROPERTIES_KEY" ON "PROPERTIES"("PROP_KEY"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/activeruleparameters/AddPrimaryKeyOnUuidColumnOfActiveRuleParametersTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/activeruleparameters/AddPrimaryKeyOnUuidColumnOfActiveRuleParametersTableTest/schema.sql deleted file mode 100644 index 814cb67b796..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/activeruleparameters/AddPrimaryKeyOnUuidColumnOfActiveRuleParametersTableTest/schema.sql +++ /dev/null @@ -1,10 +0,0 @@ -CREATE TABLE "ACTIVE_RULE_PARAMETERS"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "UUID" VARCHAR(40) NOT NULL, - "ACTIVE_RULE_ID" INTEGER NOT NULL, - "RULES_PARAMETER_ID" INTEGER NOT NULL, - "VALUE" VARCHAR(4000), - "RULES_PARAMETER_KEY" VARCHAR(128) -); - -CREATE INDEX "IX_ARP_ON_ACTIVE_RULE_ID" ON "ACTIVE_RULE_PARAMETERS"("ACTIVE_RULE_ID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/activeruleparameters/AddUuidColumnToActiveRuleParametersTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/activeruleparameters/AddUuidColumnToActiveRuleParametersTest/schema.sql deleted file mode 100644 index 8366c74f29d..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/activeruleparameters/AddUuidColumnToActiveRuleParametersTest/schema.sql +++ /dev/null @@ -1,9 +0,0 @@ -CREATE TABLE "ACTIVE_RULE_PARAMETERS"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "ACTIVE_RULE_ID" INTEGER NOT NULL, - "RULES_PARAMETER_ID" INTEGER NOT NULL, - "VALUE" VARCHAR(4000), - "RULES_PARAMETER_KEY" VARCHAR(128) -); -ALTER TABLE "ACTIVE_RULE_PARAMETERS" ADD CONSTRAINT "PK_ACTIVE_RULE_PARAMETERS" PRIMARY KEY("ID"); -CREATE INDEX "IX_ARP_ON_ACTIVE_RULE_ID" ON "ACTIVE_RULE_PARAMETERS"("ACTIVE_RULE_ID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/activeruleparameters/DropIdColumnOfActiveRuleParametersTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/activeruleparameters/DropIdColumnOfActiveRuleParametersTableTest/schema.sql deleted file mode 100644 index c95e98df88d..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/activeruleparameters/DropIdColumnOfActiveRuleParametersTableTest/schema.sql +++ /dev/null @@ -1,10 +0,0 @@ -CREATE TABLE "ACTIVE_RULE_PARAMETERS"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "UUID" VARCHAR(40) NOT NULL, - "ACTIVE_RULE_ID" INTEGER NOT NULL, - "RULES_PARAMETER_ID" INTEGER NOT NULL, - "VALUE" VARCHAR(4000), - "RULES_PARAMETER_KEY" VARCHAR(128) -); -ALTER TABLE "ACTIVE_RULE_PARAMETERS" ADD CONSTRAINT "PK_ACTIVE_RULE_PARAMETERS" PRIMARY KEY("UUID"); -CREATE INDEX "IX_ARP_ON_ACTIVE_RULE_ID" ON "ACTIVE_RULE_PARAMETERS"("ACTIVE_RULE_ID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/activeruleparameters/DropPrimaryKeyOnIdColumnOfActiveRuleParametersTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/activeruleparameters/DropPrimaryKeyOnIdColumnOfActiveRuleParametersTableTest/schema.sql deleted file mode 100644 index 88efe9d1252..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/activeruleparameters/DropPrimaryKeyOnIdColumnOfActiveRuleParametersTableTest/schema.sql +++ /dev/null @@ -1,10 +0,0 @@ -CREATE TABLE "ACTIVE_RULE_PARAMETERS"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "UUID" VARCHAR(40) NOT NULL, - "ACTIVE_RULE_ID" INTEGER NOT NULL, - "RULES_PARAMETER_ID" INTEGER NOT NULL, - "VALUE" VARCHAR(4000), - "RULES_PARAMETER_KEY" VARCHAR(128) -); -ALTER TABLE "ACTIVE_RULE_PARAMETERS" ADD CONSTRAINT "PK_ACTIVE_RULE_PARAMETERS" PRIMARY KEY("ID"); -CREATE INDEX "IX_ARP_ON_ACTIVE_RULE_ID" ON "ACTIVE_RULE_PARAMETERS"("ACTIVE_RULE_ID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/activeruleparameters/MakeActiveRuleParametersUuidColumnNotNullableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/activeruleparameters/MakeActiveRuleParametersUuidColumnNotNullableTest/schema.sql deleted file mode 100644 index e3fb5b749c3..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/activeruleparameters/MakeActiveRuleParametersUuidColumnNotNullableTest/schema.sql +++ /dev/null @@ -1,10 +0,0 @@ -CREATE TABLE "ACTIVE_RULE_PARAMETERS"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "UUID" VARCHAR(40), - "ACTIVE_RULE_ID" INTEGER NOT NULL, - "RULES_PARAMETER_ID" INTEGER NOT NULL, - "VALUE" VARCHAR(4000), - "RULES_PARAMETER_KEY" VARCHAR(128) -); -ALTER TABLE "ACTIVE_RULE_PARAMETERS" ADD CONSTRAINT "PK_ACTIVE_RULE_PARAMETERS" PRIMARY KEY("ID"); -CREATE INDEX "IX_ARP_ON_ACTIVE_RULE_ID" ON "ACTIVE_RULE_PARAMETERS"("ACTIVE_RULE_ID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/activeruleparameters/PopulateActiveRuleParametersUuidTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/activeruleparameters/PopulateActiveRuleParametersUuidTest/schema.sql deleted file mode 100644 index e3fb5b749c3..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/activeruleparameters/PopulateActiveRuleParametersUuidTest/schema.sql +++ /dev/null @@ -1,10 +0,0 @@ -CREATE TABLE "ACTIVE_RULE_PARAMETERS"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "UUID" VARCHAR(40), - "ACTIVE_RULE_ID" INTEGER NOT NULL, - "RULES_PARAMETER_ID" INTEGER NOT NULL, - "VALUE" VARCHAR(4000), - "RULES_PARAMETER_KEY" VARCHAR(128) -); -ALTER TABLE "ACTIVE_RULE_PARAMETERS" ADD CONSTRAINT "PK_ACTIVE_RULE_PARAMETERS" PRIMARY KEY("ID"); -CREATE INDEX "IX_ARP_ON_ACTIVE_RULE_ID" ON "ACTIVE_RULE_PARAMETERS"("ACTIVE_RULE_ID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/activerules/AddActiveRuleUuidColumnToActiveRuleParametersTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/activerules/AddActiveRuleUuidColumnToActiveRuleParametersTest/schema.sql deleted file mode 100644 index 04d58e9edf0..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/activerules/AddActiveRuleUuidColumnToActiveRuleParametersTest/schema.sql +++ /dev/null @@ -1,9 +0,0 @@ -CREATE TABLE "ACTIVE_RULE_PARAMETERS"( - "ACTIVE_RULE_ID" INTEGER NOT NULL, - "RULES_PARAMETER_ID" INTEGER NOT NULL, - "VALUE" VARCHAR(4000), - "RULES_PARAMETER_KEY" VARCHAR(128), - "UUID" VARCHAR(40) NOT NULL -); -ALTER TABLE "ACTIVE_RULE_PARAMETERS" ADD CONSTRAINT "PK_ACTIVE_RULE_PARAMETERS" PRIMARY KEY("UUID"); -CREATE INDEX "IX_ARP_ON_ACTIVE_RULE_ID" ON "ACTIVE_RULE_PARAMETERS"("ACTIVE_RULE_ID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/activerules/AddIndexOnActiveRuleUuidOfActiveRuleParametersTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/activerules/AddIndexOnActiveRuleUuidOfActiveRuleParametersTableTest/schema.sql deleted file mode 100644 index b074136418d..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/activerules/AddIndexOnActiveRuleUuidOfActiveRuleParametersTableTest/schema.sql +++ /dev/null @@ -1,9 +0,0 @@ -CREATE TABLE "ACTIVE_RULE_PARAMETERS"( - "ACTIVE_RULE_ID" INTEGER NOT NULL, - "ACTIVE_RULE_UUID" VARCHAR(40) NOT NULL, - "RULES_PARAMETER_ID" INTEGER NOT NULL, - "VALUE" VARCHAR(4000), - "RULES_PARAMETER_KEY" VARCHAR(128), - "UUID" VARCHAR(40) NOT NULL -); -ALTER TABLE "ACTIVE_RULE_PARAMETERS" ADD CONSTRAINT "PK_ACTIVE_RULE_PARAMETERS" PRIMARY KEY("UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/activerules/AddPrimaryKeyOnUuidColumnOfActiveRulesTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/activerules/AddPrimaryKeyOnUuidColumnOfActiveRulesTableTest/schema.sql deleted file mode 100644 index 58802cb272e..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/activerules/AddPrimaryKeyOnUuidColumnOfActiveRulesTableTest/schema.sql +++ /dev/null @@ -1,11 +0,0 @@ -CREATE TABLE "ACTIVE_RULES"( - "ID" INTEGER NOT NULL, - "UUID" VARCHAR(40) NOT NULL, - "PROFILE_ID" INTEGER NOT NULL, - "RULE_ID" INTEGER NOT NULL, - "FAILURE_LEVEL" INTEGER NOT NULL, - "INHERITANCE" VARCHAR(10), - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT -); -CREATE UNIQUE INDEX "UNIQ_PROFILE_RULE_IDS" ON "ACTIVE_RULES"("PROFILE_ID", "RULE_ID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/activerules/AddUuidColumnToActiveRulesTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/activerules/AddUuidColumnToActiveRulesTableTest/schema.sql deleted file mode 100644 index f7f18747670..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/activerules/AddUuidColumnToActiveRulesTableTest/schema.sql +++ /dev/null @@ -1,11 +0,0 @@ -CREATE TABLE "ACTIVE_RULES"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "PROFILE_ID" INTEGER NOT NULL, - "RULE_ID" INTEGER NOT NULL, - "FAILURE_LEVEL" INTEGER NOT NULL, - "INHERITANCE" VARCHAR(10), - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT -); -ALTER TABLE "ACTIVE_RULES" ADD CONSTRAINT "PK_ACTIVE_RULES" PRIMARY KEY("ID"); -CREATE UNIQUE INDEX "UNIQ_PROFILE_RULE_IDS" ON "ACTIVE_RULES"("PROFILE_ID", "RULE_ID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/activerules/DropActiveRuleIdColumnOfActiveRuleParametersTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/activerules/DropActiveRuleIdColumnOfActiveRuleParametersTableTest/schema.sql deleted file mode 100644 index 24d5888764c..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/activerules/DropActiveRuleIdColumnOfActiveRuleParametersTableTest/schema.sql +++ /dev/null @@ -1,10 +0,0 @@ -CREATE TABLE "ACTIVE_RULE_PARAMETERS"( - "ACTIVE_RULE_ID" INTEGER NOT NULL, - "ACTIVE_RULE_UUID" VARCHAR(40) NOT NULL, - "RULES_PARAMETER_ID" INTEGER NOT NULL, - "VALUE" VARCHAR(4000), - "RULES_PARAMETER_KEY" VARCHAR(128), - "UUID" VARCHAR(40) NOT NULL -); -ALTER TABLE "ACTIVE_RULE_PARAMETERS" ADD CONSTRAINT "PK_ACTIVE_RULE_PARAMETERS" PRIMARY KEY("UUID"); -CREATE INDEX "ARP_ACTIVE_RULE_UUID" ON "ACTIVE_RULE_PARAMETERS"("ACTIVE_RULE_UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/activerules/DropIdColumnOfActiveRulesTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/activerules/DropIdColumnOfActiveRulesTableTest/schema.sql deleted file mode 100644 index faf2cd098e9..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/activerules/DropIdColumnOfActiveRulesTableTest/schema.sql +++ /dev/null @@ -1,12 +0,0 @@ -CREATE TABLE "ACTIVE_RULES"( - "ID" INTEGER NOT NULL, - "UUID" VARCHAR(40) NOT NULL, - "PROFILE_ID" INTEGER NOT NULL, - "RULE_ID" INTEGER NOT NULL, - "FAILURE_LEVEL" INTEGER NOT NULL, - "INHERITANCE" VARCHAR(10), - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT -); -ALTER TABLE "ACTIVE_RULES" ADD CONSTRAINT "PK_ACTIVE_RULES" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "UNIQ_PROFILE_RULE_IDS" ON "ACTIVE_RULES"("PROFILE_ID", "RULE_ID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/activerules/DropIndexOnActiveRuleIdOfActiveRuleParametersTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/activerules/DropIndexOnActiveRuleIdOfActiveRuleParametersTableTest/schema.sql deleted file mode 100644 index fe510a7faaf..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/activerules/DropIndexOnActiveRuleIdOfActiveRuleParametersTableTest/schema.sql +++ /dev/null @@ -1,10 +0,0 @@ -CREATE TABLE "ACTIVE_RULE_PARAMETERS"( - "ACTIVE_RULE_ID" INTEGER NOT NULL, - "ACTIVE_RULE_UUID" VARCHAR(40) NOT NULL, - "RULES_PARAMETER_ID" INTEGER NOT NULL, - "VALUE" VARCHAR(4000), - "RULES_PARAMETER_KEY" VARCHAR(128), - "UUID" VARCHAR(40) NOT NULL -); -ALTER TABLE "ACTIVE_RULE_PARAMETERS" ADD CONSTRAINT "PK_ACTIVE_RULE_PARAMETERS" PRIMARY KEY("UUID"); -CREATE INDEX "IX_ARP_ON_ACTIVE_RULE_ID" ON "ACTIVE_RULE_PARAMETERS"("ACTIVE_RULE_ID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/activerules/DropPrimaryKeyOnIdColumnOfActiveRulesTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/activerules/DropPrimaryKeyOnIdColumnOfActiveRulesTableTest/schema.sql deleted file mode 100644 index 642bd8470a6..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/activerules/DropPrimaryKeyOnIdColumnOfActiveRulesTableTest/schema.sql +++ /dev/null @@ -1,12 +0,0 @@ -CREATE TABLE "ACTIVE_RULES"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "UUID" VARCHAR(40) NOT NULL, - "PROFILE_ID" INTEGER NOT NULL, - "RULE_ID" INTEGER NOT NULL, - "FAILURE_LEVEL" INTEGER NOT NULL, - "INHERITANCE" VARCHAR(10), - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT -); -ALTER TABLE "ACTIVE_RULES" ADD CONSTRAINT "PK_ACTIVE_RULES" PRIMARY KEY("ID"); -CREATE UNIQUE INDEX "UNIQ_PROFILE_RULE_IDS" ON "ACTIVE_RULES"("PROFILE_ID", "RULE_ID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/activerules/MakeActiveRuleParametersActiveRuleUuidNotNullableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/activerules/MakeActiveRuleParametersActiveRuleUuidNotNullableTest/schema.sql deleted file mode 100644 index 0f789b84e93..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/activerules/MakeActiveRuleParametersActiveRuleUuidNotNullableTest/schema.sql +++ /dev/null @@ -1,10 +0,0 @@ -CREATE TABLE "ACTIVE_RULE_PARAMETERS"( - "ACTIVE_RULE_ID" INTEGER NOT NULL, - "ACTIVE_RULE_UUID" VARCHAR(40), - "RULES_PARAMETER_ID" INTEGER NOT NULL, - "VALUE" VARCHAR(4000), - "RULES_PARAMETER_KEY" VARCHAR(128), - "UUID" VARCHAR(40) NOT NULL -); -ALTER TABLE "ACTIVE_RULE_PARAMETERS" ADD CONSTRAINT "PK_ACTIVE_RULE_PARAMETERS" PRIMARY KEY("UUID"); -CREATE INDEX "IX_ARP_ON_ACTIVE_RULE_ID" ON "ACTIVE_RULE_PARAMETERS"("ACTIVE_RULE_ID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/activerules/MakeActiveRulesUuidColumnNotNullableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/activerules/MakeActiveRulesUuidColumnNotNullableTest/schema.sql deleted file mode 100644 index 49569a9667a..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/activerules/MakeActiveRulesUuidColumnNotNullableTest/schema.sql +++ /dev/null @@ -1,12 +0,0 @@ -CREATE TABLE "ACTIVE_RULES"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "UUID" VARCHAR(40), - "PROFILE_ID" INTEGER NOT NULL, - "RULE_ID" INTEGER NOT NULL, - "FAILURE_LEVEL" INTEGER NOT NULL, - "INHERITANCE" VARCHAR(10), - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT -); -ALTER TABLE "ACTIVE_RULES" ADD CONSTRAINT "PK_ACTIVE_RULES" PRIMARY KEY("ID"); -CREATE UNIQUE INDEX "UNIQ_PROFILE_RULE_IDS" ON "ACTIVE_RULES"("PROFILE_ID", "RULE_ID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/activerules/PopulateActiveRuleParametersActiveRuleUuidTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/activerules/PopulateActiveRuleParametersActiveRuleUuidTest/schema.sql deleted file mode 100644 index 5d00ec845ca..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/activerules/PopulateActiveRuleParametersActiveRuleUuidTest/schema.sql +++ /dev/null @@ -1,23 +0,0 @@ -CREATE TABLE "ACTIVE_RULE_PARAMETERS"( - "ACTIVE_RULE_ID" INTEGER NOT NULL, - "ACTIVE_RULE_UUID" VARCHAR(40), - "RULES_PARAMETER_ID" INTEGER NOT NULL, - "VALUE" VARCHAR(4000), - "RULES_PARAMETER_KEY" VARCHAR(128), - "UUID" VARCHAR(40) NOT NULL -); -ALTER TABLE "ACTIVE_RULE_PARAMETERS" ADD CONSTRAINT "PK_ACTIVE_RULE_PARAMETERS" PRIMARY KEY("UUID"); -CREATE INDEX "IX_ARP_ON_ACTIVE_RULE_ID" ON "ACTIVE_RULE_PARAMETERS"("ACTIVE_RULE_ID"); - -CREATE TABLE "ACTIVE_RULES"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "UUID" VARCHAR(40) NOT NULL, - "PROFILE_ID" INTEGER NOT NULL, - "RULE_ID" INTEGER NOT NULL, - "FAILURE_LEVEL" INTEGER NOT NULL, - "INHERITANCE" VARCHAR(10), - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT -); -ALTER TABLE "ACTIVE_RULES" ADD CONSTRAINT "PK_ACTIVE_RULES" PRIMARY KEY("ID"); -CREATE UNIQUE INDEX "UNIQ_PROFILE_RULE_IDS" ON "ACTIVE_RULES"("PROFILE_ID", "RULE_ID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/activerules/PopulateActiveRulesUuidTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/activerules/PopulateActiveRulesUuidTest/schema.sql deleted file mode 100644 index 49569a9667a..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/activerules/PopulateActiveRulesUuidTest/schema.sql +++ /dev/null @@ -1,12 +0,0 @@ -CREATE TABLE "ACTIVE_RULES"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "UUID" VARCHAR(40), - "PROFILE_ID" INTEGER NOT NULL, - "RULE_ID" INTEGER NOT NULL, - "FAILURE_LEVEL" INTEGER NOT NULL, - "INHERITANCE" VARCHAR(10), - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT -); -ALTER TABLE "ACTIVE_RULES" ADD CONSTRAINT "PK_ACTIVE_RULES" PRIMARY KEY("ID"); -CREATE UNIQUE INDEX "UNIQ_PROFILE_RULE_IDS" ON "ACTIVE_RULES"("PROFILE_ID", "RULE_ID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/alm/AddClientIdAndClientSecretColumnsTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/alm/AddClientIdAndClientSecretColumnsTest/schema.sql deleted file mode 100644 index 645a8ff17ae..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/alm/AddClientIdAndClientSecretColumnsTest/schema.sql +++ /dev/null @@ -1,13 +0,0 @@ -CREATE TABLE "ALM_SETTINGS"( - "UUID" VARCHAR(40) NOT NULL, - "ALM_ID" VARCHAR(40) NOT NULL, - "KEE" VARCHAR(200) NOT NULL, - "URL" VARCHAR(2000), - "APP_ID" VARCHAR(80), - "PRIVATE_KEY" VARCHAR(2000), - "PAT" VARCHAR(2000), - "UPDATED_AT" BIGINT NOT NULL, - "CREATED_AT" BIGINT NOT NULL -); -ALTER TABLE "ALM_SETTINGS" ADD CONSTRAINT "PK_ALM_SETTINGS" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "UNIQ_ALM_SETTINGS" ON "ALM_SETTINGS"("KEE"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/ceactivity/AddPrimaryKeyOnUuidColumnOfCeActivityTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/ceactivity/AddPrimaryKeyOnUuidColumnOfCeActivityTableTest/schema.sql deleted file mode 100644 index 22ed140880e..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/ceactivity/AddPrimaryKeyOnUuidColumnOfCeActivityTableTest/schema.sql +++ /dev/null @@ -1,32 +0,0 @@ -CREATE TABLE "CE_ACTIVITY"( - "ID" INTEGER NOT NULL, - "UUID" VARCHAR(40) NOT NULL, - "TASK_TYPE" VARCHAR(15) NOT NULL, - "MAIN_COMPONENT_UUID" VARCHAR(40), - "COMPONENT_UUID" VARCHAR(40), - "STATUS" VARCHAR(15) NOT NULL, - "MAIN_IS_LAST" BOOLEAN NOT NULL, - "MAIN_IS_LAST_KEY" VARCHAR(55) NOT NULL, - "IS_LAST" BOOLEAN NOT NULL, - "IS_LAST_KEY" VARCHAR(55) NOT NULL, - "SUBMITTER_UUID" VARCHAR(255), - "SUBMITTED_AT" BIGINT NOT NULL, - "STARTED_AT" BIGINT, - "EXECUTED_AT" BIGINT, - "EXECUTION_COUNT" INTEGER NOT NULL, - "EXECUTION_TIME_MS" BIGINT, - "ANALYSIS_UUID" VARCHAR(50), - "ERROR_MESSAGE" VARCHAR(1000), - "ERROR_STACKTRACE" CLOB(2147483647), - "ERROR_TYPE" VARCHAR(20), - "WORKER_UUID" VARCHAR(40), - "CREATED_AT" BIGINT NOT NULL, - "UPDATED_AT" BIGINT NOT NULL -); -CREATE INDEX "CE_ACTIVITY_COMPONENT" ON "CE_ACTIVITY"("COMPONENT_UUID"); -CREATE INDEX "CE_ACTIVITY_ISLAST" ON "CE_ACTIVITY"("IS_LAST", "STATUS"); -CREATE INDEX "CE_ACTIVITY_ISLAST_KEY" ON "CE_ACTIVITY"("IS_LAST_KEY"); -CREATE INDEX "CE_ACTIVITY_MAIN_COMPONENT" ON "CE_ACTIVITY"("MAIN_COMPONENT_UUID"); -CREATE INDEX "CE_ACTIVITY_MAIN_ISLAST" ON "CE_ACTIVITY"("MAIN_IS_LAST", "STATUS"); -CREATE INDEX "CE_ACTIVITY_MAIN_ISLAST_KEY" ON "CE_ACTIVITY"("MAIN_IS_LAST_KEY"); -CREATE UNIQUE INDEX "CE_ACTIVITY_UUID" ON "CE_ACTIVITY"("UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/ceactivity/DropIdColumnOfCeActivityTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/ceactivity/DropIdColumnOfCeActivityTableTest/schema.sql deleted file mode 100644 index 9aa76b650fd..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/ceactivity/DropIdColumnOfCeActivityTableTest/schema.sql +++ /dev/null @@ -1,33 +0,0 @@ -CREATE TABLE "CE_ACTIVITY"( - "ID" INTEGER NOT NULL, - "UUID" VARCHAR(40) NOT NULL, - "TASK_TYPE" VARCHAR(15) NOT NULL, - "MAIN_COMPONENT_UUID" VARCHAR(40), - "COMPONENT_UUID" VARCHAR(40), - "STATUS" VARCHAR(15) NOT NULL, - "MAIN_IS_LAST" BOOLEAN NOT NULL, - "MAIN_IS_LAST_KEY" VARCHAR(55) NOT NULL, - "IS_LAST" BOOLEAN NOT NULL, - "IS_LAST_KEY" VARCHAR(55) NOT NULL, - "SUBMITTER_UUID" VARCHAR(255), - "SUBMITTED_AT" BIGINT NOT NULL, - "STARTED_AT" BIGINT, - "EXECUTED_AT" BIGINT, - "EXECUTION_COUNT" INTEGER NOT NULL, - "EXECUTION_TIME_MS" BIGINT, - "ANALYSIS_UUID" VARCHAR(50), - "ERROR_MESSAGE" VARCHAR(1000), - "ERROR_STACKTRACE" CLOB(2147483647), - "ERROR_TYPE" VARCHAR(20), - "WORKER_UUID" VARCHAR(40), - "CREATED_AT" BIGINT NOT NULL, - "UPDATED_AT" BIGINT NOT NULL -); -ALTER TABLE "CE_ACTIVITY" ADD CONSTRAINT "PK_CE_ACTIVITY" PRIMARY KEY("UUID"); -CREATE INDEX "CE_ACTIVITY_COMPONENT" ON "CE_ACTIVITY"("COMPONENT_UUID"); -CREATE INDEX "CE_ACTIVITY_ISLAST" ON "CE_ACTIVITY"("IS_LAST", "STATUS"); -CREATE INDEX "CE_ACTIVITY_ISLAST_KEY" ON "CE_ACTIVITY"("IS_LAST_KEY"); -CREATE INDEX "CE_ACTIVITY_MAIN_COMPONENT" ON "CE_ACTIVITY"("MAIN_COMPONENT_UUID"); -CREATE INDEX "CE_ACTIVITY_MAIN_ISLAST" ON "CE_ACTIVITY"("MAIN_IS_LAST", "STATUS"); -CREATE INDEX "CE_ACTIVITY_MAIN_ISLAST_KEY" ON "CE_ACTIVITY"("MAIN_IS_LAST_KEY"); -CREATE UNIQUE INDEX "CE_ACTIVITY_UUID" ON "CE_ACTIVITY"("UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/ceactivity/DropPrimaryKeyOnIdColumnOfCeActivityTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/ceactivity/DropPrimaryKeyOnIdColumnOfCeActivityTableTest/schema.sql deleted file mode 100644 index d8fec2db804..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/ceactivity/DropPrimaryKeyOnIdColumnOfCeActivityTableTest/schema.sql +++ /dev/null @@ -1,33 +0,0 @@ -CREATE TABLE "CE_ACTIVITY"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "UUID" VARCHAR(40) NOT NULL, - "TASK_TYPE" VARCHAR(15) NOT NULL, - "MAIN_COMPONENT_UUID" VARCHAR(40), - "COMPONENT_UUID" VARCHAR(40), - "STATUS" VARCHAR(15) NOT NULL, - "MAIN_IS_LAST" BOOLEAN NOT NULL, - "MAIN_IS_LAST_KEY" VARCHAR(55) NOT NULL, - "IS_LAST" BOOLEAN NOT NULL, - "IS_LAST_KEY" VARCHAR(55) NOT NULL, - "SUBMITTER_UUID" VARCHAR(255), - "SUBMITTED_AT" BIGINT NOT NULL, - "STARTED_AT" BIGINT, - "EXECUTED_AT" BIGINT, - "EXECUTION_COUNT" INTEGER NOT NULL, - "EXECUTION_TIME_MS" BIGINT, - "ANALYSIS_UUID" VARCHAR(50), - "ERROR_MESSAGE" VARCHAR(1000), - "ERROR_STACKTRACE" CLOB(2147483647), - "ERROR_TYPE" VARCHAR(20), - "WORKER_UUID" VARCHAR(40), - "CREATED_AT" BIGINT NOT NULL, - "UPDATED_AT" BIGINT NOT NULL -); -ALTER TABLE "CE_ACTIVITY" ADD CONSTRAINT "PK_CE_ACTIVITY" PRIMARY KEY("ID"); -CREATE INDEX "CE_ACTIVITY_COMPONENT" ON "CE_ACTIVITY"("COMPONENT_UUID"); -CREATE INDEX "CE_ACTIVITY_ISLAST" ON "CE_ACTIVITY"("IS_LAST", "STATUS"); -CREATE INDEX "CE_ACTIVITY_ISLAST_KEY" ON "CE_ACTIVITY"("IS_LAST_KEY"); -CREATE INDEX "CE_ACTIVITY_MAIN_COMPONENT" ON "CE_ACTIVITY"("MAIN_COMPONENT_UUID"); -CREATE INDEX "CE_ACTIVITY_MAIN_ISLAST" ON "CE_ACTIVITY"("MAIN_IS_LAST", "STATUS"); -CREATE INDEX "CE_ACTIVITY_MAIN_ISLAST_KEY" ON "CE_ACTIVITY"("MAIN_IS_LAST_KEY"); -CREATE UNIQUE INDEX "CE_ACTIVITY_UUID" ON "CE_ACTIVITY"("UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/cequeue/AddPrimaryKeyOnUuidColumnOfCeQueueTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/cequeue/AddPrimaryKeyOnUuidColumnOfCeQueueTableTest/schema.sql deleted file mode 100644 index bf5f23f3e28..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/cequeue/AddPrimaryKeyOnUuidColumnOfCeQueueTableTest/schema.sql +++ /dev/null @@ -1,16 +0,0 @@ -CREATE TABLE "CE_QUEUE"( - "ID" INTEGER NOT NULL, - "UUID" VARCHAR(40) NOT NULL, - "TASK_TYPE" VARCHAR(15) NOT NULL, - "MAIN_COMPONENT_UUID" VARCHAR(40), - "COMPONENT_UUID" VARCHAR(40), - "STATUS" VARCHAR(15), - "SUBMITTER_UUID" VARCHAR(255), - "STARTED_AT" BIGINT, - "WORKER_UUID" VARCHAR(40), - "EXECUTION_COUNT" INTEGER NOT NULL, - "CREATED_AT" BIGINT NOT NULL, - "UPDATED_AT" BIGINT NOT NULL -); -CREATE INDEX "CE_QUEUE_MAIN_COMPONENT" ON "CE_QUEUE"("MAIN_COMPONENT_UUID"); -CREATE INDEX "CE_QUEUE_COMPONENT" ON "CE_QUEUE"("COMPONENT_UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/cequeue/DropIdColumnOfCeQueueTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/cequeue/DropIdColumnOfCeQueueTableTest/schema.sql deleted file mode 100644 index 48cfeb2001b..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/cequeue/DropIdColumnOfCeQueueTableTest/schema.sql +++ /dev/null @@ -1,17 +0,0 @@ -CREATE TABLE "CE_QUEUE"( - "ID" INTEGER NOT NULL, - "UUID" VARCHAR(40) NOT NULL, - "TASK_TYPE" VARCHAR(15) NOT NULL, - "MAIN_COMPONENT_UUID" VARCHAR(40), - "COMPONENT_UUID" VARCHAR(40), - "STATUS" VARCHAR(15), - "SUBMITTER_UUID" VARCHAR(255), - "STARTED_AT" BIGINT, - "WORKER_UUID" VARCHAR(40), - "EXECUTION_COUNT" INTEGER NOT NULL, - "CREATED_AT" BIGINT NOT NULL, - "UPDATED_AT" BIGINT NOT NULL -); -ALTER TABLE "CE_QUEUE" ADD CONSTRAINT "PK_CE_QUEUE" PRIMARY KEY("UUID"); -CREATE INDEX "CE_QUEUE_MAIN_COMPONENT" ON "CE_QUEUE"("MAIN_COMPONENT_UUID"); -CREATE INDEX "CE_QUEUE_COMPONENT" ON "CE_QUEUE"("COMPONENT_UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/cequeue/DropPrimaryKeyOnIdColumnOfCeQueueTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/cequeue/DropPrimaryKeyOnIdColumnOfCeQueueTableTest/schema.sql deleted file mode 100644 index ca173102b08..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/cequeue/DropPrimaryKeyOnIdColumnOfCeQueueTableTest/schema.sql +++ /dev/null @@ -1,17 +0,0 @@ -CREATE TABLE "CE_QUEUE"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "UUID" VARCHAR(40) NOT NULL, - "TASK_TYPE" VARCHAR(15) NOT NULL, - "MAIN_COMPONENT_UUID" VARCHAR(40), - "COMPONENT_UUID" VARCHAR(40), - "STATUS" VARCHAR(15), - "SUBMITTER_UUID" VARCHAR(255), - "STARTED_AT" BIGINT, - "WORKER_UUID" VARCHAR(40), - "EXECUTION_COUNT" INTEGER NOT NULL, - "CREATED_AT" BIGINT NOT NULL, - "UPDATED_AT" BIGINT NOT NULL -); -ALTER TABLE "CE_QUEUE" ADD CONSTRAINT "PK_CE_QUEUE" PRIMARY KEY("ID"); -CREATE INDEX "CE_QUEUE_MAIN_COMPONENT" ON "CE_QUEUE"("MAIN_COMPONENT_UUID"); -CREATE INDEX "CE_QUEUE_COMPONENT" ON "CE_QUEUE"("COMPONENT_UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/cequeue/DropUniqueIndexOnUuidColumnOfCeQueueTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/cequeue/DropUniqueIndexOnUuidColumnOfCeQueueTableTest/schema.sql deleted file mode 100644 index 8ab0a1195b3..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/cequeue/DropUniqueIndexOnUuidColumnOfCeQueueTableTest/schema.sql +++ /dev/null @@ -1,18 +0,0 @@ -CREATE TABLE "CE_QUEUE"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "UUID" VARCHAR(40) NOT NULL, - "TASK_TYPE" VARCHAR(15) NOT NULL, - "MAIN_COMPONENT_UUID" VARCHAR(40), - "COMPONENT_UUID" VARCHAR(40), - "STATUS" VARCHAR(15), - "SUBMITTER_UUID" VARCHAR(255), - "STARTED_AT" BIGINT, - "WORKER_UUID" VARCHAR(40), - "EXECUTION_COUNT" INTEGER NOT NULL, - "CREATED_AT" BIGINT NOT NULL, - "UPDATED_AT" BIGINT NOT NULL -); -ALTER TABLE "CE_QUEUE" ADD CONSTRAINT "PK_CE_QUEUE" PRIMARY KEY("ID"); -CREATE INDEX "CE_QUEUE_MAIN_COMPONENT" ON "CE_QUEUE"("MAIN_COMPONENT_UUID"); -CREATE INDEX "CE_QUEUE_COMPONENT" ON "CE_QUEUE"("COMPONENT_UUID"); -CREATE UNIQUE INDEX "CE_QUEUE_UUID" ON "CE_QUEUE"("UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/duplicationsindex/AddPrimaryKeyOnUuidColumnOfDuplicationsIndexTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/duplicationsindex/AddPrimaryKeyOnUuidColumnOfDuplicationsIndexTableTest/schema.sql deleted file mode 100644 index de4522b3c84..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/duplicationsindex/AddPrimaryKeyOnUuidColumnOfDuplicationsIndexTableTest/schema.sql +++ /dev/null @@ -1,12 +0,0 @@ -CREATE TABLE "DUPLICATIONS_INDEX"( - "ID" BIGINT NOT NULL AUTO_INCREMENT (1,1), - "ANALYSIS_UUID" VARCHAR(50) NOT NULL, - "COMPONENT_UUID" VARCHAR(50) NOT NULL, - "HASH" VARCHAR(50) NOT NULL, - "INDEX_IN_FILE" INTEGER NOT NULL, - "START_LINE" INTEGER NOT NULL, - "END_LINE" INTEGER NOT NULL, - "UUID" VARCHAR(40) NOT NULL -); -CREATE INDEX "DUPLICATIONS_INDEX_HASH" ON "DUPLICATIONS_INDEX"("HASH"); -CREATE INDEX "DUPLICATION_ANALYSIS_COMPONENT" ON "DUPLICATIONS_INDEX"("ANALYSIS_UUID", "COMPONENT_UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/duplicationsindex/AddUuidToDuplicationsIndexTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/duplicationsindex/AddUuidToDuplicationsIndexTableTest/schema.sql deleted file mode 100644 index f0001521878..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/duplicationsindex/AddUuidToDuplicationsIndexTableTest/schema.sql +++ /dev/null @@ -1,13 +0,0 @@ -CREATE TABLE "DUPLICATIONS_INDEX"( - "ID" BIGINT NOT NULL AUTO_INCREMENT (1,1), - "ANALYSIS_UUID" VARCHAR(50) NOT NULL, - "COMPONENT_UUID" VARCHAR(50) NOT NULL, - "HASH" VARCHAR(50) NOT NULL, - "INDEX_IN_FILE" INTEGER NOT NULL, - "START_LINE" INTEGER NOT NULL, - "END_LINE" INTEGER NOT NULL -); -ALTER TABLE "DUPLICATIONS_INDEX" ADD CONSTRAINT "PK_DUPLICATIONS_INDEX" PRIMARY KEY("ID"); -CREATE INDEX "DUPLICATIONS_INDEX_HASH" ON "DUPLICATIONS_INDEX"("HASH"); -CREATE INDEX "DUPLICATION_ANALYSIS_COMPONENT" ON "DUPLICATIONS_INDEX"("ANALYSIS_UUID", "COMPONENT_UUID"); - diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/duplicationsindex/DropIdColumnOfDuplicationsIndexTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/duplicationsindex/DropIdColumnOfDuplicationsIndexTableTest/schema.sql deleted file mode 100644 index 1399658a241..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/duplicationsindex/DropIdColumnOfDuplicationsIndexTableTest/schema.sql +++ /dev/null @@ -1,13 +0,0 @@ -CREATE TABLE "DUPLICATIONS_INDEX"( - "ID" BIGINT NOT NULL, - "ANALYSIS_UUID" VARCHAR(50) NOT NULL, - "COMPONENT_UUID" VARCHAR(50) NOT NULL, - "HASH" VARCHAR(50) NOT NULL, - "INDEX_IN_FILE" INTEGER NOT NULL, - "START_LINE" INTEGER NOT NULL, - "END_LINE" INTEGER NOT NULL, - "UUID" VARCHAR(40) NOT NULL, -); -ALTER TABLE "DUPLICATIONS_INDEX" ADD CONSTRAINT "PK_DUPLICATIONS_INDEX" PRIMARY KEY("UUID"); -CREATE INDEX "DUPLICATIONS_INDEX_HASH" ON "DUPLICATIONS_INDEX"("HASH"); -CREATE INDEX "DUPLICATION_ANALYSIS_COMPONENT" ON "DUPLICATIONS_INDEX"("ANALYSIS_UUID", "COMPONENT_UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/duplicationsindex/DropPrimaryKeyOnIdColumnOfDuplicationsIndexTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/duplicationsindex/DropPrimaryKeyOnIdColumnOfDuplicationsIndexTableTest/schema.sql deleted file mode 100644 index e8f7a1414be..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/duplicationsindex/DropPrimaryKeyOnIdColumnOfDuplicationsIndexTableTest/schema.sql +++ /dev/null @@ -1,13 +0,0 @@ -CREATE TABLE "DUPLICATIONS_INDEX"( - "ID" BIGINT NOT NULL AUTO_INCREMENT (1,1), - "ANALYSIS_UUID" VARCHAR(50) NOT NULL, - "COMPONENT_UUID" VARCHAR(50) NOT NULL, - "HASH" VARCHAR(50) NOT NULL, - "INDEX_IN_FILE" INTEGER NOT NULL, - "START_LINE" INTEGER NOT NULL, - "END_LINE" INTEGER NOT NULL, - "UUID" VARCHAR(40) NOT NULL, -); -ALTER TABLE "DUPLICATIONS_INDEX" ADD CONSTRAINT "PK_DUPLICATIONS_INDEX" PRIMARY KEY("ID"); -CREATE INDEX "DUPLICATIONS_INDEX_HASH" ON "DUPLICATIONS_INDEX"("HASH"); -CREATE INDEX "DUPLICATION_ANALYSIS_COMPONENT" ON "DUPLICATIONS_INDEX"("ANALYSIS_UUID", "COMPONENT_UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/duplicationsindex/MakeDuplicationsIndexUuidColumnNotNullableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/duplicationsindex/MakeDuplicationsIndexUuidColumnNotNullableTest/schema.sql deleted file mode 100644 index 6432378da7b..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/duplicationsindex/MakeDuplicationsIndexUuidColumnNotNullableTest/schema.sql +++ /dev/null @@ -1,13 +0,0 @@ -CREATE TABLE "DUPLICATIONS_INDEX"( - "ID" BIGINT NOT NULL AUTO_INCREMENT (1,1), - "ANALYSIS_UUID" VARCHAR(50) NOT NULL, - "COMPONENT_UUID" VARCHAR(50) NOT NULL, - "HASH" VARCHAR(50) NOT NULL, - "INDEX_IN_FILE" INTEGER NOT NULL, - "START_LINE" INTEGER NOT NULL, - "END_LINE" INTEGER NOT NULL, - "UUID" VARCHAR(40) -); -ALTER TABLE "DUPLICATIONS_INDEX" ADD CONSTRAINT "PK_DUPLICATIONS_INDEX" PRIMARY KEY("ID"); -CREATE INDEX "DUPLICATIONS_INDEX_HASH" ON "DUPLICATIONS_INDEX"("HASH"); -CREATE INDEX "DUPLICATION_ANALYSIS_COMPONENT" ON "DUPLICATIONS_INDEX"("ANALYSIS_UUID", "COMPONENT_UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/duplicationsindex/PopulateDuplicationsIndexUuidTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/duplicationsindex/PopulateDuplicationsIndexUuidTest/schema.sql deleted file mode 100644 index 6432378da7b..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/duplicationsindex/PopulateDuplicationsIndexUuidTest/schema.sql +++ /dev/null @@ -1,13 +0,0 @@ -CREATE TABLE "DUPLICATIONS_INDEX"( - "ID" BIGINT NOT NULL AUTO_INCREMENT (1,1), - "ANALYSIS_UUID" VARCHAR(50) NOT NULL, - "COMPONENT_UUID" VARCHAR(50) NOT NULL, - "HASH" VARCHAR(50) NOT NULL, - "INDEX_IN_FILE" INTEGER NOT NULL, - "START_LINE" INTEGER NOT NULL, - "END_LINE" INTEGER NOT NULL, - "UUID" VARCHAR(40) -); -ALTER TABLE "DUPLICATIONS_INDEX" ADD CONSTRAINT "PK_DUPLICATIONS_INDEX" PRIMARY KEY("ID"); -CREATE INDEX "DUPLICATIONS_INDEX_HASH" ON "DUPLICATIONS_INDEX"("HASH"); -CREATE INDEX "DUPLICATION_ANALYSIS_COMPONENT" ON "DUPLICATIONS_INDEX"("ANALYSIS_UUID", "COMPONENT_UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/events/AddPrimaryKeyOnUuidColumnOfEventsTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/events/AddPrimaryKeyOnUuidColumnOfEventsTableTest/schema.sql deleted file mode 100644 index bd6b897194c..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/events/AddPrimaryKeyOnUuidColumnOfEventsTableTest/schema.sql +++ /dev/null @@ -1,15 +0,0 @@ -CREATE TABLE "EVENTS"( - "ID" INTEGER NOT NULL, - "UUID" VARCHAR(40) NOT NULL, - "ANALYSIS_UUID" VARCHAR(50) NOT NULL, - "NAME" VARCHAR(400), - "CATEGORY" VARCHAR(50), - "DESCRIPTION" VARCHAR(4000), - "EVENT_DATA" VARCHAR(4000), - "EVENT_DATE" BIGINT NOT NULL, - "CREATED_AT" BIGINT NOT NULL, - "COMPONENT_UUID" VARCHAR(50) NOT NULL -); -CREATE UNIQUE INDEX "EVENTS_UUID" ON "EVENTS"("UUID"); -CREATE INDEX "EVENTS_ANALYSIS" ON "EVENTS"("ANALYSIS_UUID"); -CREATE INDEX "EVENTS_COMPONENT_UUID" ON "EVENTS"("COMPONENT_UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/events/DropIdColumnOfEventsTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/events/DropIdColumnOfEventsTableTest/schema.sql deleted file mode 100644 index ac79cfaaf79..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/events/DropIdColumnOfEventsTableTest/schema.sql +++ /dev/null @@ -1,16 +0,0 @@ -CREATE TABLE "EVENTS"( - "ID" INTEGER NOT NULL, - "UUID" VARCHAR(40) NOT NULL, - "ANALYSIS_UUID" VARCHAR(50) NOT NULL, - "NAME" VARCHAR(400), - "CATEGORY" VARCHAR(50), - "DESCRIPTION" VARCHAR(4000), - "EVENT_DATA" VARCHAR(4000), - "EVENT_DATE" BIGINT NOT NULL, - "CREATED_AT" BIGINT NOT NULL, - "COMPONENT_UUID" VARCHAR(50) NOT NULL -); -ALTER TABLE "EVENTS" ADD CONSTRAINT "PK_EVENTS" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "EVENTS_UUID" ON "EVENTS"("UUID"); -CREATE INDEX "EVENTS_ANALYSIS" ON "EVENTS"("ANALYSIS_UUID"); -CREATE INDEX "EVENTS_COMPONENT_UUID" ON "EVENTS"("COMPONENT_UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/events/DropPrimaryKeyOnIdColumnOfEventsTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/events/DropPrimaryKeyOnIdColumnOfEventsTableTest/schema.sql deleted file mode 100644 index 2f03d9d6661..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/events/DropPrimaryKeyOnIdColumnOfEventsTableTest/schema.sql +++ /dev/null @@ -1,16 +0,0 @@ -CREATE TABLE "EVENTS"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "UUID" VARCHAR(40) NOT NULL, - "ANALYSIS_UUID" VARCHAR(50) NOT NULL, - "NAME" VARCHAR(400), - "CATEGORY" VARCHAR(50), - "DESCRIPTION" VARCHAR(4000), - "EVENT_DATA" VARCHAR(4000), - "EVENT_DATE" BIGINT NOT NULL, - "CREATED_AT" BIGINT NOT NULL, - "COMPONENT_UUID" VARCHAR(50) NOT NULL -); -ALTER TABLE "EVENTS" ADD CONSTRAINT "PK_EVENTS" PRIMARY KEY("ID"); -CREATE UNIQUE INDEX "EVENTS_UUID" ON "EVENTS"("UUID"); -CREATE INDEX "EVENTS_ANALYSIS" ON "EVENTS"("ANALYSIS_UUID"); -CREATE INDEX "EVENTS_COMPONENT_UUID" ON "EVENTS"("COMPONENT_UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/filesources/AddPrimaryKeyOnUuidColumnOfFileSourcesTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/filesources/AddPrimaryKeyOnUuidColumnOfFileSourcesTableTest/schema.sql deleted file mode 100644 index dfb2d817bc7..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/filesources/AddPrimaryKeyOnUuidColumnOfFileSourcesTableTest/schema.sql +++ /dev/null @@ -1,18 +0,0 @@ -CREATE TABLE "FILE_SOURCES"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "UUID" VARCHAR(40) NOT NULL, - "PROJECT_UUID" VARCHAR(50) NOT NULL, - "FILE_UUID" VARCHAR(50) NOT NULL, - "LINE_HASHES" CLOB(2147483647), - "LINE_HASHES_VERSION" INTEGER, - "DATA_HASH" VARCHAR(50), - "SRC_HASH" VARCHAR(50), - "REVISION" VARCHAR(100), - "LINE_COUNT" INTEGER NOT NULL, - "BINARY_DATA" BLOB, - "CREATED_AT" BIGINT NOT NULL, - "UPDATED_AT" BIGINT NOT NULL -); -CREATE UNIQUE INDEX "FILE_SOURCES_FILE_UUID" ON "FILE_SOURCES"("FILE_UUID"); -CREATE INDEX "FILE_SOURCES_PROJECT_UUID" ON "FILE_SOURCES"("PROJECT_UUID"); -CREATE INDEX "FILE_SOURCES_UPDATED_AT" ON "FILE_SOURCES"("UPDATED_AT"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/filesources/AddUuidColumnToFileSourcesTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/filesources/AddUuidColumnToFileSourcesTableTest/schema.sql deleted file mode 100644 index 179847ee2ce..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/filesources/AddUuidColumnToFileSourcesTableTest/schema.sql +++ /dev/null @@ -1,18 +0,0 @@ -CREATE TABLE "FILE_SOURCES"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "PROJECT_UUID" VARCHAR(50) NOT NULL, - "FILE_UUID" VARCHAR(50) NOT NULL, - "LINE_HASHES" CLOB(2147483647), - "LINE_HASHES_VERSION" INTEGER, - "DATA_HASH" VARCHAR(50), - "SRC_HASH" VARCHAR(50), - "REVISION" VARCHAR(100), - "LINE_COUNT" INTEGER NOT NULL, - "BINARY_DATA" BLOB, - "CREATED_AT" BIGINT NOT NULL, - "UPDATED_AT" BIGINT NOT NULL -); -ALTER TABLE "FILE_SOURCES" ADD CONSTRAINT "PK_FILE_SOURCES" PRIMARY KEY("ID"); -CREATE UNIQUE INDEX "FILE_SOURCES_FILE_UUID" ON "FILE_SOURCES"("FILE_UUID"); -CREATE INDEX "FILE_SOURCES_PROJECT_UUID" ON "FILE_SOURCES"("PROJECT_UUID"); -CREATE INDEX "FILE_SOURCES_UPDATED_AT" ON "FILE_SOURCES"("UPDATED_AT"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/filesources/DropIdColumnOfFileSourcesTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/filesources/DropIdColumnOfFileSourcesTableTest/schema.sql deleted file mode 100644 index 3dab0132b33..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/filesources/DropIdColumnOfFileSourcesTableTest/schema.sql +++ /dev/null @@ -1,19 +0,0 @@ -CREATE TABLE "FILE_SOURCES"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "UUID" VARCHAR(40) NOT NULL, - "PROJECT_UUID" VARCHAR(50) NOT NULL, - "FILE_UUID" VARCHAR(50) NOT NULL, - "LINE_HASHES" CLOB(2147483647), - "LINE_HASHES_VERSION" INTEGER, - "DATA_HASH" VARCHAR(50), - "SRC_HASH" VARCHAR(50), - "REVISION" VARCHAR(100), - "LINE_COUNT" INTEGER NOT NULL, - "BINARY_DATA" BLOB, - "CREATED_AT" BIGINT NOT NULL, - "UPDATED_AT" BIGINT NOT NULL -); -ALTER TABLE "FILE_SOURCES" ADD CONSTRAINT "PK_FILE_SOURCES" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "FILE_SOURCES_FILE_UUID" ON "FILE_SOURCES"("FILE_UUID"); -CREATE INDEX "FILE_SOURCES_PROJECT_UUID" ON "FILE_SOURCES"("PROJECT_UUID"); -CREATE INDEX "FILE_SOURCES_UPDATED_AT" ON "FILE_SOURCES"("UPDATED_AT"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/filesources/DropPrimaryKeyOnIdColumnOfFileSourcesTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/filesources/DropPrimaryKeyOnIdColumnOfFileSourcesTableTest/schema.sql deleted file mode 100644 index a6a2a841f83..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/filesources/DropPrimaryKeyOnIdColumnOfFileSourcesTableTest/schema.sql +++ /dev/null @@ -1,19 +0,0 @@ -CREATE TABLE "FILE_SOURCES"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "UUID" VARCHAR(40) NOT NULL, - "PROJECT_UUID" VARCHAR(50) NOT NULL, - "FILE_UUID" VARCHAR(50) NOT NULL, - "LINE_HASHES" CLOB(2147483647), - "LINE_HASHES_VERSION" INTEGER, - "DATA_HASH" VARCHAR(50), - "SRC_HASH" VARCHAR(50), - "REVISION" VARCHAR(100), - "LINE_COUNT" INTEGER NOT NULL, - "BINARY_DATA" BLOB, - "CREATED_AT" BIGINT NOT NULL, - "UPDATED_AT" BIGINT NOT NULL -); -ALTER TABLE "FILE_SOURCES" ADD CONSTRAINT "PK_FILE_SOURCES" PRIMARY KEY("ID"); -CREATE UNIQUE INDEX "FILE_SOURCES_FILE_UUID" ON "FILE_SOURCES"("FILE_UUID"); -CREATE INDEX "FILE_SOURCES_PROJECT_UUID" ON "FILE_SOURCES"("PROJECT_UUID"); -CREATE INDEX "FILE_SOURCES_UPDATED_AT" ON "FILE_SOURCES"("UPDATED_AT"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/filesources/MakeFileSourcesUuidColumnNotNullableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/filesources/MakeFileSourcesUuidColumnNotNullableTest/schema.sql deleted file mode 100644 index 559418594f8..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/filesources/MakeFileSourcesUuidColumnNotNullableTest/schema.sql +++ /dev/null @@ -1,19 +0,0 @@ -CREATE TABLE "FILE_SOURCES"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "UUID" VARCHAR(40), - "PROJECT_UUID" VARCHAR(50) NOT NULL, - "FILE_UUID" VARCHAR(50) NOT NULL, - "LINE_HASHES" CLOB(2147483647), - "LINE_HASHES_VERSION" INTEGER, - "DATA_HASH" VARCHAR(50), - "SRC_HASH" VARCHAR(50), - "REVISION" VARCHAR(100), - "LINE_COUNT" INTEGER NOT NULL, - "BINARY_DATA" BLOB, - "CREATED_AT" BIGINT NOT NULL, - "UPDATED_AT" BIGINT NOT NULL -); -ALTER TABLE "FILE_SOURCES" ADD CONSTRAINT "PK_FILE_SOURCES" PRIMARY KEY("ID"); -CREATE UNIQUE INDEX "FILE_SOURCES_FILE_UUID" ON "FILE_SOURCES"("FILE_UUID"); -CREATE INDEX "FILE_SOURCES_PROJECT_UUID" ON "FILE_SOURCES"("PROJECT_UUID"); -CREATE INDEX "FILE_SOURCES_UPDATED_AT" ON "FILE_SOURCES"("UPDATED_AT"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/filesources/PopulateFileSourcesUuidTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/filesources/PopulateFileSourcesUuidTest/schema.sql deleted file mode 100644 index 559418594f8..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/filesources/PopulateFileSourcesUuidTest/schema.sql +++ /dev/null @@ -1,19 +0,0 @@ -CREATE TABLE "FILE_SOURCES"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "UUID" VARCHAR(40), - "PROJECT_UUID" VARCHAR(50) NOT NULL, - "FILE_UUID" VARCHAR(50) NOT NULL, - "LINE_HASHES" CLOB(2147483647), - "LINE_HASHES_VERSION" INTEGER, - "DATA_HASH" VARCHAR(50), - "SRC_HASH" VARCHAR(50), - "REVISION" VARCHAR(100), - "LINE_COUNT" INTEGER NOT NULL, - "BINARY_DATA" BLOB, - "CREATED_AT" BIGINT NOT NULL, - "UPDATED_AT" BIGINT NOT NULL -); -ALTER TABLE "FILE_SOURCES" ADD CONSTRAINT "PK_FILE_SOURCES" PRIMARY KEY("ID"); -CREATE UNIQUE INDEX "FILE_SOURCES_FILE_UUID" ON "FILE_SOURCES"("FILE_UUID"); -CREATE INDEX "FILE_SOURCES_PROJECT_UUID" ON "FILE_SOURCES"("PROJECT_UUID"); -CREATE INDEX "FILE_SOURCES_UPDATED_AT" ON "FILE_SOURCES"("UPDATED_AT"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/grouproles/AddPrimaryKeyOnUuidColumnOfGroupRolesTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/grouproles/AddPrimaryKeyOnUuidColumnOfGroupRolesTableTest/schema.sql deleted file mode 100644 index 3203c1421d1..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/grouproles/AddPrimaryKeyOnUuidColumnOfGroupRolesTableTest/schema.sql +++ /dev/null @@ -1,11 +0,0 @@ -CREATE TABLE "GROUP_ROLES"( - "ID" INTEGER NOT NULL, - "UUID" VARCHAR(40) NOT NULL, - "ORGANIZATION_UUID" VARCHAR(40) NOT NULL, - "GROUP_ID" INTEGER, - "ROLE" VARCHAR(64) NOT NULL, - "COMPONENT_UUID" VARCHAR(40) -); - -CREATE INDEX "GROUP_ROLES_COMPONENT_UUID" ON "GROUP_ROLES"("COMPONENT_UUID"); -CREATE UNIQUE INDEX "UNIQ_GROUP_ROLES" ON "GROUP_ROLES"("ORGANIZATION_UUID", "GROUP_ID", "COMPONENT_UUID", "ROLE"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/grouproles/AddUuidColumnToGroupRolesTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/grouproles/AddUuidColumnToGroupRolesTableTest/schema.sql deleted file mode 100644 index b91324d4572..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/grouproles/AddUuidColumnToGroupRolesTableTest/schema.sql +++ /dev/null @@ -1,10 +0,0 @@ -CREATE TABLE "GROUP_ROLES"( - "ID" INTEGER NOT NULL, - "ORGANIZATION_UUID" VARCHAR(40) NOT NULL, - "GROUP_ID" INTEGER, - "ROLE" VARCHAR(64) NOT NULL, - "COMPONENT_UUID" VARCHAR(40) -); -ALTER TABLE "GROUP_ROLES" ADD CONSTRAINT "PK_GROUP_ROLES" PRIMARY KEY("ID"); -CREATE INDEX "GROUP_ROLES_COMPONENT_UUID" ON "GROUP_ROLES"("COMPONENT_UUID"); -CREATE UNIQUE INDEX "UNIQ_GROUP_ROLES" ON "GROUP_ROLES"("ORGANIZATION_UUID", "GROUP_ID", "COMPONENT_UUID", "ROLE"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/grouproles/DropIdColumnOfGroupRolesTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/grouproles/DropIdColumnOfGroupRolesTableTest/schema.sql deleted file mode 100644 index 7ecca2b6b71..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/grouproles/DropIdColumnOfGroupRolesTableTest/schema.sql +++ /dev/null @@ -1,11 +0,0 @@ -CREATE TABLE "GROUP_ROLES"( - "ID" INTEGER NOT NULL, - "UUID" VARCHAR(40) NOT NULL, - "ORGANIZATION_UUID" VARCHAR(40) NOT NULL, - "GROUP_ID" INTEGER, - "ROLE" VARCHAR(64) NOT NULL, - "COMPONENT_UUID" VARCHAR(40) -); -ALTER TABLE "GROUP_ROLES" ADD CONSTRAINT "PK_GROUP_ROLES" PRIMARY KEY("UUID"); -CREATE INDEX "GROUP_ROLES_COMPONENT_UUID" ON "GROUP_ROLES"("COMPONENT_UUID"); -CREATE UNIQUE INDEX "UNIQ_GROUP_ROLES" ON "GROUP_ROLES"("ORGANIZATION_UUID", "GROUP_ID", "COMPONENT_UUID", "ROLE"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/grouproles/DropPrimaryKeyOnIdColumnOfGroupRolesTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/grouproles/DropPrimaryKeyOnIdColumnOfGroupRolesTableTest/schema.sql deleted file mode 100644 index d7d1320aebe..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/grouproles/DropPrimaryKeyOnIdColumnOfGroupRolesTableTest/schema.sql +++ /dev/null @@ -1,11 +0,0 @@ -CREATE TABLE "GROUP_ROLES"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "UUID" VARCHAR(40) NOT NULL, - "ORGANIZATION_UUID" VARCHAR(40) NOT NULL, - "GROUP_ID" INTEGER, - "ROLE" VARCHAR(64) NOT NULL, - "COMPONENT_UUID" VARCHAR(40) -); -ALTER TABLE "GROUP_ROLES" ADD CONSTRAINT "PK_GROUP_ROLES" PRIMARY KEY("ID"); -CREATE INDEX "GROUP_ROLES_COMPONENT_UUID" ON "GROUP_ROLES"("COMPONENT_UUID"); -CREATE UNIQUE INDEX "UNIQ_GROUP_ROLES" ON "GROUP_ROLES"("ORGANIZATION_UUID", "GROUP_ID", "COMPONENT_UUID", "ROLE"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/grouproles/MakeGroupRolesUuidColumnNotNullableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/grouproles/MakeGroupRolesUuidColumnNotNullableTest/schema.sql deleted file mode 100644 index 7c73be272fd..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/grouproles/MakeGroupRolesUuidColumnNotNullableTest/schema.sql +++ /dev/null @@ -1,11 +0,0 @@ -CREATE TABLE "GROUP_ROLES"( - "ID" INTEGER NOT NULL, - "UUID" VARCHAR(40), - "ORGANIZATION_UUID" VARCHAR(40) NOT NULL, - "GROUP_ID" INTEGER, - "ROLE" VARCHAR(64) NOT NULL, - "COMPONENT_UUID" VARCHAR(40) -); -ALTER TABLE "GROUP_ROLES" ADD CONSTRAINT "PK_GROUP_ROLES" PRIMARY KEY("ID"); -CREATE INDEX "GROUP_ROLES_COMPONENT_UUID" ON "GROUP_ROLES"("COMPONENT_UUID"); -CREATE UNIQUE INDEX "UNIQ_GROUP_ROLES" ON "GROUP_ROLES"("ORGANIZATION_UUID", "GROUP_ID", "COMPONENT_UUID", "ROLE"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/grouproles/PopulateGroupRolesUuidTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/grouproles/PopulateGroupRolesUuidTest/schema.sql deleted file mode 100644 index 7c73be272fd..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/grouproles/PopulateGroupRolesUuidTest/schema.sql +++ /dev/null @@ -1,11 +0,0 @@ -CREATE TABLE "GROUP_ROLES"( - "ID" INTEGER NOT NULL, - "UUID" VARCHAR(40), - "ORGANIZATION_UUID" VARCHAR(40) NOT NULL, - "GROUP_ID" INTEGER, - "ROLE" VARCHAR(64) NOT NULL, - "COMPONENT_UUID" VARCHAR(40) -); -ALTER TABLE "GROUP_ROLES" ADD CONSTRAINT "PK_GROUP_ROLES" PRIMARY KEY("ID"); -CREATE INDEX "GROUP_ROLES_COMPONENT_UUID" ON "GROUP_ROLES"("COMPONENT_UUID"); -CREATE UNIQUE INDEX "UNIQ_GROUP_ROLES" ON "GROUP_ROLES"("ORGANIZATION_UUID", "GROUP_ID", "COMPONENT_UUID", "ROLE"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/groups/AddPrimaryKeyOnUuidColumnOfGroupsTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/groups/AddPrimaryKeyOnUuidColumnOfGroupsTableTest/schema.sql deleted file mode 100644 index 8b2000be3e9..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/groups/AddPrimaryKeyOnUuidColumnOfGroupsTableTest/schema.sql +++ /dev/null @@ -1,9 +0,0 @@ -CREATE TABLE "GROUPS"( - "ID" INTEGER NOT NULL, - "UUID" VARCHAR(40) NOT NULL, - "ORGANIZATION_UUID" VARCHAR(40) NOT NULL, - "NAME" VARCHAR(500), - "DESCRIPTION" VARCHAR(200), - "CREATED_AT" TIMESTAMP, - "UPDATED_AT" TIMESTAMP -); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/groups/AddUuidColumnToGroupsTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/groups/AddUuidColumnToGroupsTableTest/schema.sql deleted file mode 100644 index a20ddd6ac66..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/groups/AddUuidColumnToGroupsTableTest/schema.sql +++ /dev/null @@ -1,9 +0,0 @@ -CREATE TABLE "GROUPS"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "ORGANIZATION_UUID" VARCHAR(40) NOT NULL, - "NAME" VARCHAR(500), - "DESCRIPTION" VARCHAR(200), - "CREATED_AT" TIMESTAMP, - "UPDATED_AT" TIMESTAMP -); -ALTER TABLE "GROUPS" ADD CONSTRAINT "PK_GROUPS" PRIMARY KEY("ID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/groups/DropIdColumnOfGroupsTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/groups/DropIdColumnOfGroupsTableTest/schema.sql deleted file mode 100644 index 963af911d8a..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/groups/DropIdColumnOfGroupsTableTest/schema.sql +++ /dev/null @@ -1,10 +0,0 @@ -CREATE TABLE "GROUPS"( - "ID" INTEGER NOT NULL, - "UUID" VARCHAR(40) NOT NULL, - "ORGANIZATION_UUID" VARCHAR(40) NOT NULL, - "NAME" VARCHAR(500), - "DESCRIPTION" VARCHAR(200), - "CREATED_AT" TIMESTAMP, - "UPDATED_AT" TIMESTAMP -); -ALTER TABLE "GROUPS" ADD CONSTRAINT "PK_GROUPS" PRIMARY KEY("UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/groups/DropPrimaryKeyOnIdColumnOfGroupsTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/groups/DropPrimaryKeyOnIdColumnOfGroupsTableTest/schema.sql deleted file mode 100644 index 3b127b99e7a..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/groups/DropPrimaryKeyOnIdColumnOfGroupsTableTest/schema.sql +++ /dev/null @@ -1,10 +0,0 @@ -CREATE TABLE "GROUPS"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "UUID" VARCHAR(40) NOT NULL, - "ORGANIZATION_UUID" VARCHAR(40) NOT NULL, - "NAME" VARCHAR(500), - "DESCRIPTION" VARCHAR(200), - "CREATED_AT" TIMESTAMP, - "UPDATED_AT" TIMESTAMP -); -ALTER TABLE "GROUPS" ADD CONSTRAINT "PK_GROUPS" PRIMARY KEY("ID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/groups/MakeGroupsUuidColumnNotNullableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/groups/MakeGroupsUuidColumnNotNullableTest/schema.sql deleted file mode 100644 index 5c6c10fce76..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/groups/MakeGroupsUuidColumnNotNullableTest/schema.sql +++ /dev/null @@ -1,10 +0,0 @@ -CREATE TABLE "GROUPS"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "UUID" VARCHAR(40), - "ORGANIZATION_UUID" VARCHAR(40) NOT NULL, - "NAME" VARCHAR(500), - "DESCRIPTION" VARCHAR(200), - "CREATED_AT" TIMESTAMP, - "UPDATED_AT" TIMESTAMP -); -ALTER TABLE "GROUPS" ADD CONSTRAINT "PK_GROUPS" PRIMARY KEY("ID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/groups/PopulateGroupsUuidTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/groups/PopulateGroupsUuidTest/schema.sql deleted file mode 100644 index 5c6c10fce76..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/groups/PopulateGroupsUuidTest/schema.sql +++ /dev/null @@ -1,10 +0,0 @@ -CREATE TABLE "GROUPS"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "UUID" VARCHAR(40), - "ORGANIZATION_UUID" VARCHAR(40) NOT NULL, - "NAME" VARCHAR(500), - "DESCRIPTION" VARCHAR(200), - "CREATED_AT" TIMESTAMP, - "UPDATED_AT" TIMESTAMP -); -ALTER TABLE "GROUPS" ADD CONSTRAINT "PK_GROUPS" PRIMARY KEY("ID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/groups/grouproles/AddGroupUuidColumnToGroupRolesTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/groups/grouproles/AddGroupUuidColumnToGroupRolesTest/schema.sql deleted file mode 100644 index 3395ab556f2..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/groups/grouproles/AddGroupUuidColumnToGroupRolesTest/schema.sql +++ /dev/null @@ -1,10 +0,0 @@ -CREATE TABLE "GROUP_ROLES"( - "ORGANIZATION_UUID" VARCHAR(40) NOT NULL, - "GROUP_ID" INTEGER, - "ROLE" VARCHAR(64) NOT NULL, - "COMPONENT_UUID" VARCHAR(40), - "UUID" VARCHAR(40) NOT NULL -); -ALTER TABLE "GROUP_ROLES" ADD CONSTRAINT "PK_GROUP_ROLES" PRIMARY KEY("UUID"); -CREATE INDEX "GROUP_ROLES_COMPONENT_UUID" ON "GROUP_ROLES"("COMPONENT_UUID"); -CREATE UNIQUE INDEX "UNIQ_GROUP_ROLES" ON "GROUP_ROLES"("ORGANIZATION_UUID", "GROUP_ID", "COMPONENT_UUID", "ROLE"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/groups/grouproles/AddIndexOnGroupUuidOfGroupRolesTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/groups/grouproles/AddIndexOnGroupUuidOfGroupRolesTableTest/schema.sql deleted file mode 100644 index f1f49219014..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/groups/grouproles/AddIndexOnGroupUuidOfGroupRolesTableTest/schema.sql +++ /dev/null @@ -1,10 +0,0 @@ -CREATE TABLE "GROUP_ROLES"( - "ORGANIZATION_UUID" VARCHAR(40) NOT NULL, - "GROUP_ID" INTEGER, - "GROUP_UUID" VARCHAR(40) NOT NULL, - "ROLE" VARCHAR(64) NOT NULL, - "COMPONENT_UUID" VARCHAR(40), - "UUID" VARCHAR(40) NOT NULL -); -ALTER TABLE "GROUP_ROLES" ADD CONSTRAINT "PK_GROUP_ROLES" PRIMARY KEY("UUID"); -CREATE INDEX "GROUP_ROLES_COMPONENT_UUID" ON "GROUP_ROLES"("COMPONENT_UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/groups/grouproles/DropGroupIdColumnOfGroupRolesTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/groups/grouproles/DropGroupIdColumnOfGroupRolesTableTest/schema.sql deleted file mode 100644 index 2e809ae1a2e..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/groups/grouproles/DropGroupIdColumnOfGroupRolesTableTest/schema.sql +++ /dev/null @@ -1,11 +0,0 @@ -CREATE TABLE "GROUP_ROLES"( - "ORGANIZATION_UUID" VARCHAR(40) NOT NULL, - "GROUP_ID" INTEGER, - "GROUP_UUID" VARCHAR(40) NOT NULL, - "ROLE" VARCHAR(64) NOT NULL, - "COMPONENT_UUID" VARCHAR(40), - "UUID" VARCHAR(40) NOT NULL -); -ALTER TABLE "GROUP_ROLES" ADD CONSTRAINT "PK_GROUP_ROLES" PRIMARY KEY("UUID"); -CREATE INDEX "GROUP_ROLES_COMPONENT_UUID" ON "GROUP_ROLES"("COMPONENT_UUID"); -CREATE UNIQUE INDEX "UNIQ_GROUP_ROLES" ON "GROUP_ROLES"("ORGANIZATION_UUID", "GROUP_UUID", "COMPONENT_UUID", "ROLE"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/groups/grouproles/DropIndexOnGroupIdOfGroupRolesTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/groups/grouproles/DropIndexOnGroupIdOfGroupRolesTableTest/schema.sql deleted file mode 100644 index a17d5208a43..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/groups/grouproles/DropIndexOnGroupIdOfGroupRolesTableTest/schema.sql +++ /dev/null @@ -1,11 +0,0 @@ -CREATE TABLE "GROUP_ROLES"( - "ORGANIZATION_UUID" VARCHAR(40) NOT NULL, - "GROUP_ID" INTEGER, - "GROUP_UUID" VARCHAR(40) NOT NULL, - "ROLE" VARCHAR(64) NOT NULL, - "COMPONENT_UUID" VARCHAR(40), - "UUID" VARCHAR(40) NOT NULL -); -ALTER TABLE "GROUP_ROLES" ADD CONSTRAINT "PK_GROUP_ROLES" PRIMARY KEY("UUID"); -CREATE INDEX "GROUP_ROLES_COMPONENT_UUID" ON "GROUP_ROLES"("COMPONENT_UUID"); -CREATE UNIQUE INDEX "UNIQ_GROUP_ROLES" ON "GROUP_ROLES"("ORGANIZATION_UUID", "GROUP_ID", "COMPONENT_UUID", "ROLE"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/groups/grouproles/PopulateGroupRolesGroupUuidTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/groups/grouproles/PopulateGroupRolesGroupUuidTest/schema.sql deleted file mode 100644 index dbed7d09f4f..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/groups/grouproles/PopulateGroupRolesGroupUuidTest/schema.sql +++ /dev/null @@ -1,22 +0,0 @@ -CREATE TABLE "GROUPS"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "UUID" VARCHAR(40) NOT NULL, - "ORGANIZATION_UUID" VARCHAR(40) NOT NULL, - "NAME" VARCHAR(500), - "DESCRIPTION" VARCHAR(200), - "CREATED_AT" TIMESTAMP, - "UPDATED_AT" TIMESTAMP -); -ALTER TABLE "GROUPS" ADD CONSTRAINT "PK_GROUPS" PRIMARY KEY("ID"); - -CREATE TABLE "GROUP_ROLES"( - "ORGANIZATION_UUID" VARCHAR(40) NOT NULL, - "GROUP_ID" INTEGER, - "GROUP_UUID" VARCHAR(40), - "ROLE" VARCHAR(64) NOT NULL, - "COMPONENT_UUID" VARCHAR(40), - "UUID" VARCHAR(40) NOT NULL -); -ALTER TABLE "GROUP_ROLES" ADD CONSTRAINT "PK_GROUP_ROLES" PRIMARY KEY("UUID"); -CREATE INDEX "GROUP_ROLES_COMPONENT_UUID" ON "GROUP_ROLES"("COMPONENT_UUID"); -CREATE UNIQUE INDEX "UNIQ_GROUP_ROLES" ON "GROUP_ROLES"("ORGANIZATION_UUID", "GROUP_ID", "COMPONENT_UUID", "ROLE"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/groups/groupsusers/AddGroupUuidColumnToGroupsUsersTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/groups/groupsusers/AddGroupUuidColumnToGroupsUsersTest/schema.sql deleted file mode 100644 index 0d7bb6e917a..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/groups/groupsusers/AddGroupUuidColumnToGroupsUsersTest/schema.sql +++ /dev/null @@ -1,7 +0,0 @@ -CREATE TABLE "GROUPS_USERS"( - "USER_ID" BIGINT, - "GROUP_ID" BIGINT -); -CREATE INDEX "INDEX_GROUPS_USERS_ON_USER_ID" ON "GROUPS_USERS"("USER_ID"); -CREATE INDEX "INDEX_GROUPS_USERS_ON_GROUP_ID" ON "GROUPS_USERS"("GROUP_ID"); -CREATE UNIQUE INDEX "GROUPS_USERS_UNIQUE" ON "GROUPS_USERS"("GROUP_ID", "USER_ID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/groups/groupsusers/AddIndexOnGroupUuidOfGroupsUsersTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/groups/groupsusers/AddIndexOnGroupUuidOfGroupsUsersTableTest/schema.sql deleted file mode 100644 index 4f926b037ad..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/groups/groupsusers/AddIndexOnGroupUuidOfGroupsUsersTableTest/schema.sql +++ /dev/null @@ -1,6 +0,0 @@ -CREATE TABLE "GROUPS_USERS"( - "USER_ID" BIGINT, - "GROUP_UUID" VARCHAR(40) NOT NULL, - "GROUP_ID" BIGINT -); -CREATE INDEX "INDEX_GROUPS_USERS_ON_USER_ID" ON "GROUPS_USERS"("USER_ID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/groups/groupsusers/DropGroupIdColumnOfGroupsUsersTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/groups/groupsusers/DropGroupIdColumnOfGroupsUsersTableTest/schema.sql deleted file mode 100644 index 6f1ef46cb30..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/groups/groupsusers/DropGroupIdColumnOfGroupsUsersTableTest/schema.sql +++ /dev/null @@ -1,8 +0,0 @@ -CREATE TABLE "GROUPS_USERS"( - "USER_ID" BIGINT, - "GROUP_UUID" VARCHAR(40) NOT NULL, - "GROUP_ID" BIGINT -); -CREATE INDEX "INDEX_GROUPS_USERS_ON_USER_ID" ON "GROUPS_USERS"("USER_ID"); -CREATE INDEX "INDEX_GROUPS_USERS_GROUP_UUID" ON "GROUPS_USERS"("GROUP_UUID"); -CREATE UNIQUE INDEX "GROUPS_USERS_UNIQUE" ON "GROUPS_USERS"("GROUP_UUID", "USER_ID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/groups/groupsusers/DropIndexOnGroupIdOfGroupsUsersTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/groups/groupsusers/DropIndexOnGroupIdOfGroupsUsersTableTest/schema.sql deleted file mode 100644 index 214ddd1af92..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/groups/groupsusers/DropIndexOnGroupIdOfGroupsUsersTableTest/schema.sql +++ /dev/null @@ -1,8 +0,0 @@ -CREATE TABLE "GROUPS_USERS"( - "USER_ID" BIGINT, - "GROUP_UUID" VARCHAR(40) NOT NULL, - "GROUP_ID" BIGINT -); -CREATE INDEX "INDEX_GROUPS_USERS_ON_USER_ID" ON "GROUPS_USERS"("USER_ID"); -CREATE INDEX "INDEX_GROUPS_USERS_ON_GROUP_ID" ON "GROUPS_USERS"("GROUP_ID"); -CREATE UNIQUE INDEX "GROUPS_USERS_UNIQUE" ON "GROUPS_USERS"("GROUP_ID", "USER_ID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/groups/groupsusers/MakeGroupsUsersGroupUuidNotNullableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/groups/groupsusers/MakeGroupsUsersGroupUuidNotNullableTest/schema.sql deleted file mode 100644 index 4614b88b6f9..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/groups/groupsusers/MakeGroupsUsersGroupUuidNotNullableTest/schema.sql +++ /dev/null @@ -1,8 +0,0 @@ -CREATE TABLE "GROUPS_USERS"( - "USER_ID" BIGINT, - "GROUP_UUID" VARCHAR(40), - "GROUP_ID" BIGINT -); -CREATE INDEX "INDEX_GROUPS_USERS_ON_USER_ID" ON "GROUPS_USERS"("USER_ID"); -CREATE INDEX "INDEX_GROUPS_USERS_ON_GROUP_ID" ON "GROUPS_USERS"("GROUP_ID"); -CREATE UNIQUE INDEX "GROUPS_USERS_UNIQUE" ON "GROUPS_USERS"("GROUP_ID", "USER_ID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/groups/groupsusers/PopulateGroupsUsersGroupUuidTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/groups/groupsusers/PopulateGroupsUsersGroupUuidTest/schema.sql deleted file mode 100644 index f3c7d7266a8..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/groups/groupsusers/PopulateGroupsUsersGroupUuidTest/schema.sql +++ /dev/null @@ -1,19 +0,0 @@ -CREATE TABLE "GROUPS"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "UUID" VARCHAR(40) NOT NULL, - "ORGANIZATION_UUID" VARCHAR(40) NOT NULL, - "NAME" VARCHAR(500), - "DESCRIPTION" VARCHAR(200), - "CREATED_AT" TIMESTAMP, - "UPDATED_AT" TIMESTAMP -); -ALTER TABLE "GROUPS" ADD CONSTRAINT "PK_GROUPS" PRIMARY KEY("ID"); - -CREATE TABLE "GROUPS_USERS"( - "USER_ID" BIGINT, - "GROUP_UUID" VARCHAR(40), - "GROUP_ID" BIGINT -); -CREATE INDEX "INDEX_GROUPS_USERS_ON_USER_ID" ON "GROUPS_USERS"("USER_ID"); -CREATE INDEX "INDEX_GROUPS_USERS_ON_GROUP_ID" ON "GROUPS_USERS"("GROUP_ID"); -CREATE UNIQUE INDEX "GROUPS_USERS_UNIQUE" ON "GROUPS_USERS"("GROUP_ID", "USER_ID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/groups/organizations/AddDefaultGroupUuidColumnToOrganizationsTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/groups/organizations/AddDefaultGroupUuidColumnToOrganizationsTest/schema.sql deleted file mode 100644 index 169cf356975..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/groups/organizations/AddDefaultGroupUuidColumnToOrganizationsTest/schema.sql +++ /dev/null @@ -1,20 +0,0 @@ -CREATE TABLE "ORGANIZATIONS"( - "UUID" VARCHAR(40) NOT NULL, - "KEE" VARCHAR(255) NOT NULL, - "NAME" VARCHAR(255) NOT NULL, - "DESCRIPTION" VARCHAR(256), - "URL" VARCHAR(256), - "AVATAR_URL" VARCHAR(256), - "GUARDED" BOOLEAN, - "DEFAULT_GROUP_ID" INTEGER, - "DEFAULT_QUALITY_GATE_UUID" VARCHAR(40) NOT NULL, - "DEFAULT_PERM_TEMPLATE_PROJECT" VARCHAR(40), - "DEFAULT_PERM_TEMPLATE_APP" VARCHAR(40), - "DEFAULT_PERM_TEMPLATE_PORT" VARCHAR(40), - "NEW_PROJECT_PRIVATE" BOOLEAN NOT NULL, - "SUBSCRIPTION" VARCHAR(40) NOT NULL, - "CREATED_AT" BIGINT NOT NULL, - "UPDATED_AT" BIGINT NOT NULL -); -ALTER TABLE "ORGANIZATIONS" ADD CONSTRAINT "PK_ORGANIZATIONS" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "ORGANIZATION_KEY" ON "ORGANIZATIONS"("KEE"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/groups/organizations/DropDefaultGroupIdColumnOfOrganizationsTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/groups/organizations/DropDefaultGroupIdColumnOfOrganizationsTableTest/schema.sql deleted file mode 100644 index 65e6acd5661..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/groups/organizations/DropDefaultGroupIdColumnOfOrganizationsTableTest/schema.sql +++ /dev/null @@ -1,21 +0,0 @@ -CREATE TABLE "ORGANIZATIONS"( - "UUID" VARCHAR(40) NOT NULL, - "KEE" VARCHAR(255) NOT NULL, - "NAME" VARCHAR(255) NOT NULL, - "DESCRIPTION" VARCHAR(256), - "URL" VARCHAR(256), - "AVATAR_URL" VARCHAR(256), - "GUARDED" BOOLEAN, - "DEFAULT_GROUP_ID" INTEGER, - "DEFAULT_GROUP_UUID" VARCHAR(40), - "DEFAULT_QUALITY_GATE_UUID" VARCHAR(40) NOT NULL, - "DEFAULT_PERM_TEMPLATE_PROJECT" VARCHAR(40), - "DEFAULT_PERM_TEMPLATE_APP" VARCHAR(40), - "DEFAULT_PERM_TEMPLATE_PORT" VARCHAR(40), - "NEW_PROJECT_PRIVATE" BOOLEAN NOT NULL, - "SUBSCRIPTION" VARCHAR(40) NOT NULL, - "CREATED_AT" BIGINT NOT NULL, - "UPDATED_AT" BIGINT NOT NULL -); -ALTER TABLE "ORGANIZATIONS" ADD CONSTRAINT "PK_ORGANIZATIONS" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "ORGANIZATION_KEY" ON "ORGANIZATIONS"("KEE"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/groups/organizations/PopulateOrganizationsDefaultGroupUuidTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/groups/organizations/PopulateOrganizationsDefaultGroupUuidTest/schema.sql deleted file mode 100644 index 6ecb376b33b..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/groups/organizations/PopulateOrganizationsDefaultGroupUuidTest/schema.sql +++ /dev/null @@ -1,32 +0,0 @@ -CREATE TABLE "GROUPS"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "UUID" VARCHAR(40) NOT NULL, - "ORGANIZATION_UUID" VARCHAR(40) NOT NULL, - "NAME" VARCHAR(500), - "DESCRIPTION" VARCHAR(200), - "CREATED_AT" TIMESTAMP, - "UPDATED_AT" TIMESTAMP -); -ALTER TABLE "GROUPS" ADD CONSTRAINT "PK_GROUPS" PRIMARY KEY("ID"); - -CREATE TABLE "ORGANIZATIONS"( - "UUID" VARCHAR(40) NOT NULL, - "KEE" VARCHAR(255) NOT NULL, - "NAME" VARCHAR(255) NOT NULL, - "DESCRIPTION" VARCHAR(256), - "URL" VARCHAR(256), - "AVATAR_URL" VARCHAR(256), - "GUARDED" BOOLEAN, - "DEFAULT_GROUP_ID" INTEGER, - "DEFAULT_GROUP_UUID" VARCHAR(40), - "DEFAULT_QUALITY_GATE_UUID" VARCHAR(40) NOT NULL, - "DEFAULT_PERM_TEMPLATE_PROJECT" VARCHAR(40), - "DEFAULT_PERM_TEMPLATE_APP" VARCHAR(40), - "DEFAULT_PERM_TEMPLATE_PORT" VARCHAR(40), - "NEW_PROJECT_PRIVATE" BOOLEAN NOT NULL, - "SUBSCRIPTION" VARCHAR(40) NOT NULL, - "CREATED_AT" BIGINT NOT NULL, - "UPDATED_AT" BIGINT NOT NULL -); -ALTER TABLE "ORGANIZATIONS" ADD CONSTRAINT "PK_ORGANIZATIONS" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "ORGANIZATION_KEY" ON "ORGANIZATIONS"("KEE"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/groups/permtemplatesgroups/AddGroupUuidColumnToPermTemplatesGroupsTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/groups/permtemplatesgroups/AddGroupUuidColumnToPermTemplatesGroupsTest/schema.sql deleted file mode 100644 index f8f880ba7d6..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/groups/permtemplatesgroups/AddGroupUuidColumnToPermTemplatesGroupsTest/schema.sql +++ /dev/null @@ -1,9 +0,0 @@ -CREATE TABLE "PERM_TEMPLATES_GROUPS"( - "GROUP_ID" INTEGER, - "TEMPLATE_ID" INTEGER NOT NULL, - "PERMISSION_REFERENCE" VARCHAR(64) NOT NULL, - "CREATED_AT" TIMESTAMP, - "UPDATED_AT" TIMESTAMP, - "UUID" VARCHAR(40) NOT NULL -); -ALTER TABLE "PERM_TEMPLATES_GROUPS" ADD CONSTRAINT "PK_PERM_TEMPLATES_GROUPS" PRIMARY KEY("UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/groups/permtemplatesgroups/DropGroupIdColumnOfPermTemplatesGroupsTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/groups/permtemplatesgroups/DropGroupIdColumnOfPermTemplatesGroupsTableTest/schema.sql deleted file mode 100644 index fa92bad8669..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/groups/permtemplatesgroups/DropGroupIdColumnOfPermTemplatesGroupsTableTest/schema.sql +++ /dev/null @@ -1,10 +0,0 @@ -CREATE TABLE "PERM_TEMPLATES_GROUPS"( - "GROUP_ID" INTEGER, - "GROUP_UUID" VARCHAR(40), - "TEMPLATE_ID" INTEGER NOT NULL, - "PERMISSION_REFERENCE" VARCHAR(64) NOT NULL, - "CREATED_AT" TIMESTAMP, - "UPDATED_AT" TIMESTAMP, - "UUID" VARCHAR(40) NOT NULL -); -ALTER TABLE "PERM_TEMPLATES_GROUPS" ADD CONSTRAINT "PK_PERM_TEMPLATES_GROUPS" PRIMARY KEY("UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/groups/permtemplatesgroups/PopulatePermTemplatesGroupsGroupUuidTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/groups/permtemplatesgroups/PopulatePermTemplatesGroupsGroupUuidTest/schema.sql deleted file mode 100644 index d7f1b662726..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/groups/permtemplatesgroups/PopulatePermTemplatesGroupsGroupUuidTest/schema.sql +++ /dev/null @@ -1,21 +0,0 @@ -CREATE TABLE "GROUPS"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "UUID" VARCHAR(40) NOT NULL, - "ORGANIZATION_UUID" VARCHAR(40) NOT NULL, - "NAME" VARCHAR(500), - "DESCRIPTION" VARCHAR(200), - "CREATED_AT" TIMESTAMP, - "UPDATED_AT" TIMESTAMP -); -ALTER TABLE "GROUPS" ADD CONSTRAINT "PK_GROUPS" PRIMARY KEY("ID"); - -CREATE TABLE "PERM_TEMPLATES_GROUPS"( - "GROUP_ID" INTEGER, - "GROUP_UUID" VARCHAR(40), - "TEMPLATE_ID" INTEGER NOT NULL, - "PERMISSION_REFERENCE" VARCHAR(64) NOT NULL, - "CREATED_AT" TIMESTAMP, - "UPDATED_AT" TIMESTAMP, - "UUID" VARCHAR(40) NOT NULL -); -ALTER TABLE "PERM_TEMPLATES_GROUPS" ADD CONSTRAINT "PK_PERM_TEMPLATES_GROUPS" PRIMARY KEY("UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/groups/qprofileeditgroups/AddGroupUuidColumnToQProfileEditGroupsTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/groups/qprofileeditgroups/AddGroupUuidColumnToQProfileEditGroupsTest/schema.sql deleted file mode 100644 index b375127ef24..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/groups/qprofileeditgroups/AddGroupUuidColumnToQProfileEditGroupsTest/schema.sql +++ /dev/null @@ -1,9 +0,0 @@ -CREATE TABLE "QPROFILE_EDIT_GROUPS"( - "UUID" VARCHAR(40) NOT NULL, - "GROUP_ID" INTEGER NOT NULL, - "QPROFILE_UUID" VARCHAR(255) NOT NULL, - "CREATED_AT" BIGINT NOT NULL -); -ALTER TABLE "QPROFILE_EDIT_GROUPS" ADD CONSTRAINT "PK_QPROFILE_EDIT_GROUPS" PRIMARY KEY("UUID"); -CREATE INDEX "QPROFILE_EDIT_GROUPS_QPROFILE" ON "QPROFILE_EDIT_GROUPS"("QPROFILE_UUID"); -CREATE UNIQUE INDEX "QPROFILE_EDIT_GROUPS_UNIQUE" ON "QPROFILE_EDIT_GROUPS"("GROUP_ID", "QPROFILE_UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/groups/qprofileeditgroups/AddIndexOnGroupUuidOfQProfileEditGroupsTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/groups/qprofileeditgroups/AddIndexOnGroupUuidOfQProfileEditGroupsTableTest/schema.sql deleted file mode 100644 index d7d22ae97b6..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/groups/qprofileeditgroups/AddIndexOnGroupUuidOfQProfileEditGroupsTableTest/schema.sql +++ /dev/null @@ -1,9 +0,0 @@ -CREATE TABLE "QPROFILE_EDIT_GROUPS"( - "UUID" VARCHAR(40) NOT NULL, - "GROUP_ID" INTEGER NOT NULL, - "GROUP_UUID" VARCHAR(40) NOT NULL, - "QPROFILE_UUID" VARCHAR(255) NOT NULL, - "CREATED_AT" BIGINT NOT NULL -); -ALTER TABLE "QPROFILE_EDIT_GROUPS" ADD CONSTRAINT "PK_QPROFILE_EDIT_GROUPS" PRIMARY KEY("UUID"); -CREATE INDEX "QPROFILE_EDIT_GROUPS_QPROFILE" ON "QPROFILE_EDIT_GROUPS"("QPROFILE_UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/groups/qprofileeditgroups/DropGroupIdColumnOfQProfileEditGroupsTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/groups/qprofileeditgroups/DropGroupIdColumnOfQProfileEditGroupsTableTest/schema.sql deleted file mode 100644 index 3a866c066ab..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/groups/qprofileeditgroups/DropGroupIdColumnOfQProfileEditGroupsTableTest/schema.sql +++ /dev/null @@ -1,10 +0,0 @@ -CREATE TABLE "QPROFILE_EDIT_GROUPS"( - "UUID" VARCHAR(40) NOT NULL, - "GROUP_ID" INTEGER NOT NULL, - "GROUP_UUID" VARCHAR(40) NOT NULL, - "QPROFILE_UUID" VARCHAR(255) NOT NULL, - "CREATED_AT" BIGINT NOT NULL -); -ALTER TABLE "QPROFILE_EDIT_GROUPS" ADD CONSTRAINT "PK_QPROFILE_EDIT_GROUPS" PRIMARY KEY("UUID"); -CREATE INDEX "QPROFILE_EDIT_GROUPS_QPROFILE" ON "QPROFILE_EDIT_GROUPS"("QPROFILE_UUID"); -CREATE UNIQUE INDEX "QPROFILE_EDIT_GROUPS_UNIQUE" ON "QPROFILE_EDIT_GROUPS"("GROUP_UUID", "QPROFILE_UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/groups/qprofileeditgroups/DropIndexOnGroupIdOfQProfileEditGroupsTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/groups/qprofileeditgroups/DropIndexOnGroupIdOfQProfileEditGroupsTableTest/schema.sql deleted file mode 100644 index e4deaa55ba0..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/groups/qprofileeditgroups/DropIndexOnGroupIdOfQProfileEditGroupsTableTest/schema.sql +++ /dev/null @@ -1,10 +0,0 @@ -CREATE TABLE "QPROFILE_EDIT_GROUPS"( - "UUID" VARCHAR(40) NOT NULL, - "GROUP_ID" INTEGER NOT NULL, - "GROUP_UUID" VARCHAR(40) NOT NULL, - "QPROFILE_UUID" VARCHAR(255) NOT NULL, - "CREATED_AT" BIGINT NOT NULL -); -ALTER TABLE "QPROFILE_EDIT_GROUPS" ADD CONSTRAINT "PK_QPROFILE_EDIT_GROUPS" PRIMARY KEY("UUID"); -CREATE INDEX "QPROFILE_EDIT_GROUPS_QPROFILE" ON "QPROFILE_EDIT_GROUPS"("QPROFILE_UUID"); -CREATE UNIQUE INDEX "QPROFILE_EDIT_GROUPS_UNIQUE" ON "QPROFILE_EDIT_GROUPS"("GROUP_ID", "QPROFILE_UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/groups/qprofileeditgroups/MakeQProfileEditGroupsGroupUuidNotNullableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/groups/qprofileeditgroups/MakeQProfileEditGroupsGroupUuidNotNullableTest/schema.sql deleted file mode 100644 index f30b909de2e..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/groups/qprofileeditgroups/MakeQProfileEditGroupsGroupUuidNotNullableTest/schema.sql +++ /dev/null @@ -1,10 +0,0 @@ -CREATE TABLE "QPROFILE_EDIT_GROUPS"( - "UUID" VARCHAR(40) NOT NULL, - "GROUP_ID" INTEGER NOT NULL, - "GROUP_UUID" VARCHAR(40), - "QPROFILE_UUID" VARCHAR(255) NOT NULL, - "CREATED_AT" BIGINT NOT NULL -); -ALTER TABLE "QPROFILE_EDIT_GROUPS" ADD CONSTRAINT "PK_QPROFILE_EDIT_GROUPS" PRIMARY KEY("UUID"); -CREATE INDEX "QPROFILE_EDIT_GROUPS_QPROFILE" ON "QPROFILE_EDIT_GROUPS"("QPROFILE_UUID"); -CREATE UNIQUE INDEX "QPROFILE_EDIT_GROUPS_UNIQUE" ON "QPROFILE_EDIT_GROUPS"("GROUP_ID", "QPROFILE_UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/groups/qprofileeditgroups/PopulateQProfileEditGroupsGroupUuidTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/groups/qprofileeditgroups/PopulateQProfileEditGroupsGroupUuidTest/schema.sql deleted file mode 100644 index 05b4a34f279..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/groups/qprofileeditgroups/PopulateQProfileEditGroupsGroupUuidTest/schema.sql +++ /dev/null @@ -1,21 +0,0 @@ -CREATE TABLE "GROUPS"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "UUID" VARCHAR(40) NOT NULL, - "ORGANIZATION_UUID" VARCHAR(40) NOT NULL, - "NAME" VARCHAR(500), - "DESCRIPTION" VARCHAR(200), - "CREATED_AT" TIMESTAMP, - "UPDATED_AT" TIMESTAMP -); -ALTER TABLE "GROUPS" ADD CONSTRAINT "PK_GROUPS" PRIMARY KEY("ID"); - -CREATE TABLE "QPROFILE_EDIT_GROUPS"( - "UUID" VARCHAR(40) NOT NULL, - "GROUP_ID" INTEGER NOT NULL, - "GROUP_UUID" VARCHAR(40), - "QPROFILE_UUID" VARCHAR(255) NOT NULL, - "CREATED_AT" BIGINT NOT NULL -); -ALTER TABLE "QPROFILE_EDIT_GROUPS" ADD CONSTRAINT "PK_QPROFILE_EDIT_GROUPS" PRIMARY KEY("UUID"); -CREATE INDEX "QPROFILE_EDIT_GROUPS_QPROFILE" ON "QPROFILE_EDIT_GROUPS"("QPROFILE_UUID"); -CREATE UNIQUE INDEX "QPROFILE_EDIT_GROUPS_UNIQUE" ON "QPROFILE_EDIT_GROUPS"("GROUP_ID", "QPROFILE_UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/issuechanges/AddIndexOnIssueKeyOfIssueChangesTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/issuechanges/AddIndexOnIssueKeyOfIssueChangesTableTest/schema.sql deleted file mode 100644 index 93de1f11d37..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/issuechanges/AddIndexOnIssueKeyOfIssueChangesTableTest/schema.sql +++ /dev/null @@ -1,11 +0,0 @@ -CREATE TABLE "ISSUE_CHANGES"( - "UUID" VARCHAR(40) NOT NULL, - "KEE" VARCHAR(50), - "ISSUE_KEY" VARCHAR(50) NOT NULL, - "USER_LOGIN" VARCHAR(255), - "CHANGE_TYPE" VARCHAR(20), - "CHANGE_DATA" CLOB(2147483647), - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT, - "ISSUE_CHANGE_CREATION_DATE" BIGINT -); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/issuechanges/AddIndexOnKeeOfIssueChangesTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/issuechanges/AddIndexOnKeeOfIssueChangesTableTest/schema.sql deleted file mode 100644 index 93de1f11d37..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/issuechanges/AddIndexOnKeeOfIssueChangesTableTest/schema.sql +++ /dev/null @@ -1,11 +0,0 @@ -CREATE TABLE "ISSUE_CHANGES"( - "UUID" VARCHAR(40) NOT NULL, - "KEE" VARCHAR(50), - "ISSUE_KEY" VARCHAR(50) NOT NULL, - "USER_LOGIN" VARCHAR(255), - "CHANGE_TYPE" VARCHAR(20), - "CHANGE_DATA" CLOB(2147483647), - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT, - "ISSUE_CHANGE_CREATION_DATE" BIGINT -); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/issuechanges/AddPrimaryKeyOnUuidColumnOfIssueChangesTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/issuechanges/AddPrimaryKeyOnUuidColumnOfIssueChangesTableTest/schema.sql deleted file mode 100644 index 1d8a73f53d7..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/issuechanges/AddPrimaryKeyOnUuidColumnOfIssueChangesTableTest/schema.sql +++ /dev/null @@ -1,13 +0,0 @@ -CREATE TABLE "ISSUE_CHANGES"( - "UUID" VARCHAR(40) NOT NULL, - "KEE" VARCHAR(50), - "ISSUE_KEY" VARCHAR(50) NOT NULL, - "USER_LOGIN" VARCHAR(255), - "CHANGE_TYPE" VARCHAR(20), - "CHANGE_DATA" CLOB(2147483647), - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT, - "ISSUE_CHANGE_CREATION_DATE" BIGINT -); -CREATE INDEX "ISSUE_CHANGES_ISSUE_KEY" ON "ISSUE_CHANGES"("ISSUE_KEY"); -CREATE INDEX "ISSUE_CHANGES_KEE" ON "ISSUE_CHANGES"("KEE"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/issuechanges/CopyIssueChangesTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/issuechanges/CopyIssueChangesTableTest/schema.sql deleted file mode 100644 index 7854927f304..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/issuechanges/CopyIssueChangesTableTest/schema.sql +++ /dev/null @@ -1,52 +0,0 @@ -CREATE TABLE "ISSUE_CHANGES"( - "ID" BIGINT NOT NULL AUTO_INCREMENT (1,1), - "KEE" VARCHAR(50), - "ISSUE_KEY" VARCHAR(50) NOT NULL, - "USER_LOGIN" VARCHAR(255), - "CHANGE_TYPE" VARCHAR(20), - "CHANGE_DATA" CLOB(2147483647), - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT, - "ISSUE_CHANGE_CREATION_DATE" BIGINT -); -CREATE INDEX "ISSUE_CHANGES_ISSUE_KEY" ON "ISSUE_CHANGES"("ISSUE_KEY"); -CREATE INDEX "ISSUE_CHANGES_KEE" ON "ISSUE_CHANGES"("KEE"); - -CREATE TABLE "ISSUES"( - "KEE" VARCHAR(50) NOT NULL, - "RULE_UUID" VARCHAR(40), - "SEVERITY" VARCHAR(10), - "MANUAL_SEVERITY" BOOLEAN NOT NULL, - "MESSAGE" VARCHAR(4000), - "LINE" INTEGER, - "GAP" DOUBLE, - "STATUS" VARCHAR(20), - "RESOLUTION" VARCHAR(20), - "CHECKSUM" VARCHAR(1000), - "REPORTER" VARCHAR(255), - "ASSIGNEE" VARCHAR(255), - "AUTHOR_LOGIN" VARCHAR(255), - "ACTION_PLAN_KEY" VARCHAR(50), - "ISSUE_ATTRIBUTES" VARCHAR(4000), - "EFFORT" INTEGER, - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT, - "ISSUE_CREATION_DATE" BIGINT, - "ISSUE_UPDATE_DATE" BIGINT, - "ISSUE_CLOSE_DATE" BIGINT, - "TAGS" VARCHAR(4000), - "COMPONENT_UUID" VARCHAR(50), - "PROJECT_UUID" VARCHAR(50), - "LOCATIONS" BLOB, - "ISSUE_TYPE" TINYINT, - "FROM_HOTSPOT" BOOLEAN -); -ALTER TABLE "ISSUES" ADD CONSTRAINT "PK_ISSUES" PRIMARY KEY("KEE"); -CREATE INDEX "ISSUES_ASSIGNEE" ON "ISSUES"("ASSIGNEE"); -CREATE INDEX "ISSUES_COMPONENT_UUID" ON "ISSUES"("COMPONENT_UUID"); -CREATE INDEX "ISSUES_CREATION_DATE" ON "ISSUES"("ISSUE_CREATION_DATE"); -CREATE UNIQUE INDEX "ISSUES_KEE" ON "ISSUES"("KEE"); -CREATE INDEX "ISSUES_PROJECT_UUID" ON "ISSUES"("PROJECT_UUID"); -CREATE INDEX "ISSUES_RESOLUTION" ON "ISSUES"("RESOLUTION"); -CREATE INDEX "ISSUES_UPDATED_AT" ON "ISSUES"("UPDATED_AT"); -CREATE INDEX "ISSUES_RULE_UUID" ON "ISSUES"("RULE_UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/issuechanges/DropIssueChangesTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/issuechanges/DropIssueChangesTableTest/schema.sql deleted file mode 100644 index a188f8096fa..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/issuechanges/DropIssueChangesTableTest/schema.sql +++ /dev/null @@ -1,26 +0,0 @@ -CREATE TABLE "ISSUE_CHANGES"( - "ID" BIGINT NOT NULL AUTO_INCREMENT (1,1), - "KEE" VARCHAR(50), - "ISSUE_KEY" VARCHAR(50) NOT NULL, - "USER_LOGIN" VARCHAR(255), - "CHANGE_TYPE" VARCHAR(20), - "CHANGE_DATA" CLOB(2147483647), - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT, - "ISSUE_CHANGE_CREATION_DATE" BIGINT -); -CREATE INDEX "ISSUE_CHANGES_ISSUE_KEY" ON "ISSUE_CHANGES"("ISSUE_KEY"); -CREATE INDEX "ISSUE_CHANGES_KEE" ON "ISSUE_CHANGES"("KEE"); - -CREATE TABLE "ISSUE_CHANGES_COPY"( - "UUID" VARCHAR(40) NOT NULL, - "KEE" VARCHAR(50), - "ISSUE_KEY" VARCHAR(50) NOT NULL, - "USER_LOGIN" VARCHAR(255), - "CHANGE_TYPE" VARCHAR(20), - "CHANGE_DATA" CLOB(2147483647), - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT, - "ISSUE_CHANGE_CREATION_DATE" BIGINT -); - diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/issuechanges/RenameIssueChangesCopyToIssueChangesTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/issuechanges/RenameIssueChangesCopyToIssueChangesTest/schema.sql deleted file mode 100644 index 051df21ef50..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/issuechanges/RenameIssueChangesCopyToIssueChangesTest/schema.sql +++ /dev/null @@ -1,11 +0,0 @@ -CREATE TABLE "ISSUE_CHANGES_COPY"( - "UUID" VARCHAR(40) NOT NULL, - "KEE" VARCHAR(50), - "ISSUE_KEY" VARCHAR(50) NOT NULL, - "USER_LOGIN" VARCHAR(255), - "CHANGE_TYPE" VARCHAR(20), - "CHANGE_DATA" CLOB(2147483647), - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT, - "ISSUE_CHANGE_CREATION_DATE" BIGINT -); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/issues/AddPrimaryKeyOnKeeColumnOfIssuesTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/issues/AddPrimaryKeyOnKeeColumnOfIssuesTableTest/schema.sql deleted file mode 100644 index c195339d1d7..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/issues/AddPrimaryKeyOnKeeColumnOfIssuesTableTest/schema.sql +++ /dev/null @@ -1,38 +0,0 @@ -CREATE TABLE "ISSUES"( - "ID" BIGINT NOT NULL, - "KEE" VARCHAR(50) NOT NULL, - "RULE_ID" INTEGER, - "SEVERITY" VARCHAR(10), - "MANUAL_SEVERITY" BOOLEAN NOT NULL, - "MESSAGE" VARCHAR(4000), - "LINE" INTEGER, - "GAP" DOUBLE, - "STATUS" VARCHAR(20), - "RESOLUTION" VARCHAR(20), - "CHECKSUM" VARCHAR(1000), - "REPORTER" VARCHAR(255), - "ASSIGNEE" VARCHAR(255), - "AUTHOR_LOGIN" VARCHAR(255), - "ACTION_PLAN_KEY" VARCHAR(50), - "ISSUE_ATTRIBUTES" VARCHAR(4000), - "EFFORT" INTEGER, - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT, - "ISSUE_CREATION_DATE" BIGINT, - "ISSUE_UPDATE_DATE" BIGINT, - "ISSUE_CLOSE_DATE" BIGINT, - "TAGS" VARCHAR(4000), - "COMPONENT_UUID" VARCHAR(50), - "PROJECT_UUID" VARCHAR(50), - "LOCATIONS" BLOB, - "ISSUE_TYPE" TINYINT, - "FROM_HOTSPOT" BOOLEAN -); -CREATE INDEX "ISSUES_ASSIGNEE" ON "ISSUES"("ASSIGNEE"); -CREATE INDEX "ISSUES_COMPONENT_UUID" ON "ISSUES"("COMPONENT_UUID"); -CREATE INDEX "ISSUES_CREATION_DATE" ON "ISSUES"("ISSUE_CREATION_DATE"); -CREATE UNIQUE INDEX "ISSUES_KEE" ON "ISSUES"("KEE"); -CREATE INDEX "ISSUES_PROJECT_UUID" ON "ISSUES"("PROJECT_UUID"); -CREATE INDEX "ISSUES_RESOLUTION" ON "ISSUES"("RESOLUTION"); -CREATE INDEX "ISSUES_RULE_ID" ON "ISSUES"("RULE_ID"); -CREATE INDEX "ISSUES_UPDATED_AT" ON "ISSUES"("UPDATED_AT"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/manualmeasures/AddPrimaryKeyOnUuidColumnOfManualMeasureTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/manualmeasures/AddPrimaryKeyOnUuidColumnOfManualMeasureTableTest/schema.sql deleted file mode 100644 index d1048130fdd..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/manualmeasures/AddPrimaryKeyOnUuidColumnOfManualMeasureTableTest/schema.sql +++ /dev/null @@ -1,13 +0,0 @@ -CREATE TABLE "MANUAL_MEASURES"( - "ID" BIGINT NOT NULL AUTO_INCREMENT (1,1), - "METRIC_ID" INTEGER NOT NULL, - "VALUE" DOUBLE, - "TEXT_VALUE" VARCHAR(4000), - "USER_UUID" VARCHAR(255), - "DESCRIPTION" VARCHAR(4000), - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT, - "COMPONENT_UUID" VARCHAR(50) NOT NULL, - "UUID" VARCHAR(40) NOT NULL -); -CREATE INDEX "MANUAL_MEASURES_COMPONENT_UUID" ON "MANUAL_MEASURES"("COMPONENT_UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/manualmeasures/AddUuidToManualMeasuresTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/manualmeasures/AddUuidToManualMeasuresTest/schema.sql deleted file mode 100644 index 91889223c63..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/manualmeasures/AddUuidToManualMeasuresTest/schema.sql +++ /dev/null @@ -1,13 +0,0 @@ -CREATE TABLE "MANUAL_MEASURES"( - "ID" BIGINT NOT NULL AUTO_INCREMENT (1,1), - "METRIC_ID" INTEGER NOT NULL, - "VALUE" DOUBLE, - "TEXT_VALUE" VARCHAR(4000), - "USER_UUID" VARCHAR(255), - "DESCRIPTION" VARCHAR(4000), - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT, - "COMPONENT_UUID" VARCHAR(50) NOT NULL -); -ALTER TABLE "MANUAL_MEASURES" ADD CONSTRAINT "PK_MANUAL_MEASURES" PRIMARY KEY("ID"); -CREATE INDEX "MANUAL_MEASURES_COMPONENT_UUID" ON "MANUAL_MEASURES"("COMPONENT_UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/manualmeasures/DropIdColumnOfManualMeasuresTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/manualmeasures/DropIdColumnOfManualMeasuresTableTest/schema.sql deleted file mode 100644 index d1048130fdd..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/manualmeasures/DropIdColumnOfManualMeasuresTableTest/schema.sql +++ /dev/null @@ -1,13 +0,0 @@ -CREATE TABLE "MANUAL_MEASURES"( - "ID" BIGINT NOT NULL AUTO_INCREMENT (1,1), - "METRIC_ID" INTEGER NOT NULL, - "VALUE" DOUBLE, - "TEXT_VALUE" VARCHAR(4000), - "USER_UUID" VARCHAR(255), - "DESCRIPTION" VARCHAR(4000), - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT, - "COMPONENT_UUID" VARCHAR(50) NOT NULL, - "UUID" VARCHAR(40) NOT NULL -); -CREATE INDEX "MANUAL_MEASURES_COMPONENT_UUID" ON "MANUAL_MEASURES"("COMPONENT_UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/manualmeasures/DropPrimaryKeyOnIdColumnOfManualMeasuresTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/manualmeasures/DropPrimaryKeyOnIdColumnOfManualMeasuresTableTest/schema.sql deleted file mode 100644 index dae762bdba3..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/manualmeasures/DropPrimaryKeyOnIdColumnOfManualMeasuresTableTest/schema.sql +++ /dev/null @@ -1,14 +0,0 @@ -CREATE TABLE "MANUAL_MEASURES"( - "ID" BIGINT NOT NULL AUTO_INCREMENT (1,1), - "METRIC_ID" INTEGER NOT NULL, - "VALUE" DOUBLE, - "TEXT_VALUE" VARCHAR(4000), - "USER_UUID" VARCHAR(255), - "DESCRIPTION" VARCHAR(4000), - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT, - "COMPONENT_UUID" VARCHAR(50) NOT NULL, - "UUID" VARCHAR(40) NOT NULL -); -ALTER TABLE "MANUAL_MEASURES" ADD CONSTRAINT "PK_MANUAL_MEASURES" PRIMARY KEY("ID"); -CREATE INDEX "MANUAL_MEASURES_COMPONENT_UUID" ON "MANUAL_MEASURES"("COMPONENT_UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/manualmeasures/MakeManualMeasuresUuidColumnNotNullableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/manualmeasures/MakeManualMeasuresUuidColumnNotNullableTest/schema.sql deleted file mode 100644 index c9ff15f330d..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/manualmeasures/MakeManualMeasuresUuidColumnNotNullableTest/schema.sql +++ /dev/null @@ -1,14 +0,0 @@ -CREATE TABLE "MANUAL_MEASURES"( - "ID" BIGINT NOT NULL AUTO_INCREMENT (1,1), - "METRIC_ID" INTEGER NOT NULL, - "VALUE" DOUBLE, - "TEXT_VALUE" VARCHAR(4000), - "USER_UUID" VARCHAR(255), - "DESCRIPTION" VARCHAR(4000), - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT, - "COMPONENT_UUID" VARCHAR(50) NOT NULL, - "UUID" VARCHAR(40) -); -ALTER TABLE "MANUAL_MEASURES" ADD CONSTRAINT "PK_MANUAL_MEASURES" PRIMARY KEY("ID"); -CREATE INDEX "MANUAL_MEASURES_COMPONENT_UUID" ON "MANUAL_MEASURES"("COMPONENT_UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/manualmeasures/PopulateManualMeasuresUuidTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/manualmeasures/PopulateManualMeasuresUuidTest/schema.sql deleted file mode 100644 index c9ff15f330d..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/manualmeasures/PopulateManualMeasuresUuidTest/schema.sql +++ /dev/null @@ -1,14 +0,0 @@ -CREATE TABLE "MANUAL_MEASURES"( - "ID" BIGINT NOT NULL AUTO_INCREMENT (1,1), - "METRIC_ID" INTEGER NOT NULL, - "VALUE" DOUBLE, - "TEXT_VALUE" VARCHAR(4000), - "USER_UUID" VARCHAR(255), - "DESCRIPTION" VARCHAR(4000), - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT, - "COMPONENT_UUID" VARCHAR(50) NOT NULL, - "UUID" VARCHAR(40) -); -ALTER TABLE "MANUAL_MEASURES" ADD CONSTRAINT "PK_MANUAL_MEASURES" PRIMARY KEY("ID"); -CREATE INDEX "MANUAL_MEASURES_COMPONENT_UUID" ON "MANUAL_MEASURES"("COMPONENT_UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/metrics/AddPrimaryKeyOnUuidColumnOfMetricsTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/metrics/AddPrimaryKeyOnUuidColumnOfMetricsTableTest/schema.sql deleted file mode 100644 index 51a7ed18a25..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/metrics/AddPrimaryKeyOnUuidColumnOfMetricsTableTest/schema.sql +++ /dev/null @@ -1,20 +0,0 @@ -CREATE TABLE "METRICS"( - "ID" INTEGER NOT NULL, - "UUID" VARCHAR(40) NOT NULL, - "NAME" VARCHAR(64) NOT NULL, - "DESCRIPTION" VARCHAR(255), - "DIRECTION" INTEGER DEFAULT 0 NOT NULL, - "DOMAIN" VARCHAR(64), - "SHORT_NAME" VARCHAR(64), - "QUALITATIVE" BOOLEAN DEFAULT FALSE NOT NULL, - "VAL_TYPE" VARCHAR(8), - "USER_MANAGED" BOOLEAN DEFAULT FALSE, - "ENABLED" BOOLEAN DEFAULT TRUE, - "WORST_VALUE" DOUBLE, - "BEST_VALUE" DOUBLE, - "OPTIMIZED_BEST_VALUE" BOOLEAN, - "HIDDEN" BOOLEAN, - "DELETE_HISTORICAL_DATA" BOOLEAN, - "DECIMAL_SCALE" INTEGER -); -CREATE UNIQUE INDEX "METRICS_UNIQUE_NAME" ON "METRICS"("NAME"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/metrics/AddUuidColumnToMetricsTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/metrics/AddUuidColumnToMetricsTableTest/schema.sql deleted file mode 100644 index 8ca314830d2..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/metrics/AddUuidColumnToMetricsTableTest/schema.sql +++ /dev/null @@ -1,20 +0,0 @@ -CREATE TABLE "METRICS"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "NAME" VARCHAR(64) NOT NULL, - "DESCRIPTION" VARCHAR(255), - "DIRECTION" INTEGER DEFAULT 0 NOT NULL, - "DOMAIN" VARCHAR(64), - "SHORT_NAME" VARCHAR(64), - "QUALITATIVE" BOOLEAN DEFAULT FALSE NOT NULL, - "VAL_TYPE" VARCHAR(8), - "USER_MANAGED" BOOLEAN DEFAULT FALSE, - "ENABLED" BOOLEAN DEFAULT TRUE, - "WORST_VALUE" DOUBLE, - "BEST_VALUE" DOUBLE, - "OPTIMIZED_BEST_VALUE" BOOLEAN, - "HIDDEN" BOOLEAN, - "DELETE_HISTORICAL_DATA" BOOLEAN, - "DECIMAL_SCALE" INTEGER -); -ALTER TABLE "METRICS" ADD CONSTRAINT "PK_METRICS" PRIMARY KEY("ID"); -CREATE UNIQUE INDEX "METRICS_UNIQUE_NAME" ON "METRICS"("NAME"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/metrics/DropIdColumnOfMetricsTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/metrics/DropIdColumnOfMetricsTableTest/schema.sql deleted file mode 100644 index cc5c53aec36..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/metrics/DropIdColumnOfMetricsTableTest/schema.sql +++ /dev/null @@ -1,21 +0,0 @@ -CREATE TABLE "METRICS"( - "ID" INTEGER NOT NULL, - "UUID" VARCHAR(40) NOT NULL, - "NAME" VARCHAR(64) NOT NULL, - "DESCRIPTION" VARCHAR(255), - "DIRECTION" INTEGER DEFAULT 0 NOT NULL, - "DOMAIN" VARCHAR(64), - "SHORT_NAME" VARCHAR(64), - "QUALITATIVE" BOOLEAN DEFAULT FALSE NOT NULL, - "VAL_TYPE" VARCHAR(8), - "USER_MANAGED" BOOLEAN DEFAULT FALSE, - "ENABLED" BOOLEAN DEFAULT TRUE, - "WORST_VALUE" DOUBLE, - "BEST_VALUE" DOUBLE, - "OPTIMIZED_BEST_VALUE" BOOLEAN, - "HIDDEN" BOOLEAN, - "DELETE_HISTORICAL_DATA" BOOLEAN, - "DECIMAL_SCALE" INTEGER -); -ALTER TABLE "METRICS" ADD CONSTRAINT "PK_METRICS" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "METRICS_UNIQUE_NAME" ON "METRICS"("NAME"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/metrics/DropPrimaryKeyOnIdColumnOfMetricsTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/metrics/DropPrimaryKeyOnIdColumnOfMetricsTableTest/schema.sql deleted file mode 100644 index a5940e9702e..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/metrics/DropPrimaryKeyOnIdColumnOfMetricsTableTest/schema.sql +++ /dev/null @@ -1,21 +0,0 @@ -CREATE TABLE "METRICS"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "UUID" VARCHAR(40) NOT NULL, - "NAME" VARCHAR(64) NOT NULL, - "DESCRIPTION" VARCHAR(255), - "DIRECTION" INTEGER DEFAULT 0 NOT NULL, - "DOMAIN" VARCHAR(64), - "SHORT_NAME" VARCHAR(64), - "QUALITATIVE" BOOLEAN DEFAULT FALSE NOT NULL, - "VAL_TYPE" VARCHAR(8), - "USER_MANAGED" BOOLEAN DEFAULT FALSE, - "ENABLED" BOOLEAN DEFAULT TRUE, - "WORST_VALUE" DOUBLE, - "BEST_VALUE" DOUBLE, - "OPTIMIZED_BEST_VALUE" BOOLEAN, - "HIDDEN" BOOLEAN, - "DELETE_HISTORICAL_DATA" BOOLEAN, - "DECIMAL_SCALE" INTEGER -); -ALTER TABLE "METRICS" ADD CONSTRAINT "PK_METRICS" PRIMARY KEY("ID"); -CREATE UNIQUE INDEX "METRICS_UNIQUE_NAME" ON "METRICS"("NAME"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/metrics/MakeMetricsUuidColumnNotNullableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/metrics/MakeMetricsUuidColumnNotNullableTest/schema.sql deleted file mode 100644 index 5e215f6a7a9..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/metrics/MakeMetricsUuidColumnNotNullableTest/schema.sql +++ /dev/null @@ -1,21 +0,0 @@ -CREATE TABLE "METRICS"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "UUID" VARCHAR(40), - "NAME" VARCHAR(64) NOT NULL, - "DESCRIPTION" VARCHAR(255), - "DIRECTION" INTEGER DEFAULT 0 NOT NULL, - "DOMAIN" VARCHAR(64), - "SHORT_NAME" VARCHAR(64), - "QUALITATIVE" BOOLEAN DEFAULT FALSE NOT NULL, - "VAL_TYPE" VARCHAR(8), - "USER_MANAGED" BOOLEAN DEFAULT FALSE, - "ENABLED" BOOLEAN DEFAULT TRUE, - "WORST_VALUE" DOUBLE, - "BEST_VALUE" DOUBLE, - "OPTIMIZED_BEST_VALUE" BOOLEAN, - "HIDDEN" BOOLEAN, - "DELETE_HISTORICAL_DATA" BOOLEAN, - "DECIMAL_SCALE" INTEGER -); -ALTER TABLE "METRICS" ADD CONSTRAINT "PK_METRICS" PRIMARY KEY("ID"); -CREATE UNIQUE INDEX "METRICS_UNIQUE_NAME" ON "METRICS"("NAME"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/metrics/PopulateMetricsUuidTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/metrics/PopulateMetricsUuidTest/schema.sql deleted file mode 100644 index 5e215f6a7a9..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/metrics/PopulateMetricsUuidTest/schema.sql +++ /dev/null @@ -1,21 +0,0 @@ -CREATE TABLE "METRICS"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "UUID" VARCHAR(40), - "NAME" VARCHAR(64) NOT NULL, - "DESCRIPTION" VARCHAR(255), - "DIRECTION" INTEGER DEFAULT 0 NOT NULL, - "DOMAIN" VARCHAR(64), - "SHORT_NAME" VARCHAR(64), - "QUALITATIVE" BOOLEAN DEFAULT FALSE NOT NULL, - "VAL_TYPE" VARCHAR(8), - "USER_MANAGED" BOOLEAN DEFAULT FALSE, - "ENABLED" BOOLEAN DEFAULT TRUE, - "WORST_VALUE" DOUBLE, - "BEST_VALUE" DOUBLE, - "OPTIMIZED_BEST_VALUE" BOOLEAN, - "HIDDEN" BOOLEAN, - "DELETE_HISTORICAL_DATA" BOOLEAN, - "DECIMAL_SCALE" INTEGER -); -ALTER TABLE "METRICS" ADD CONSTRAINT "PK_METRICS" PRIMARY KEY("ID"); -CREATE UNIQUE INDEX "METRICS_UNIQUE_NAME" ON "METRICS"("NAME"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/metrics/livemeasures/AddIndexOnMetricUuidOfLiveMeasuresTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/metrics/livemeasures/AddIndexOnMetricUuidOfLiveMeasuresTableTest/schema.sql deleted file mode 100644 index 4f1c3afd5d6..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/metrics/livemeasures/AddIndexOnMetricUuidOfLiveMeasuresTableTest/schema.sql +++ /dev/null @@ -1,13 +0,0 @@ -CREATE TABLE "LIVE_MEASURES"( - "UUID" VARCHAR(40) NOT NULL, - "PROJECT_UUID" VARCHAR(50) NOT NULL, - "COMPONENT_UUID" VARCHAR(50) NOT NULL, - "METRIC_UUID" VARCHAR(40) NOT NULL, - "VALUE" DOUBLE, - "TEXT_VALUE" VARCHAR(4000), - "VARIATION" DOUBLE, - "MEASURE_DATA" BLOB, - "UPDATE_MARKER" VARCHAR(40), - "CREATED_AT" BIGINT NOT NULL, - "UPDATED_AT" BIGINT NOT NULL -); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/metrics/livemeasures/AddIndexOnProjectUuidOfLiveMeasuresTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/metrics/livemeasures/AddIndexOnProjectUuidOfLiveMeasuresTableTest/schema.sql deleted file mode 100644 index 4f1c3afd5d6..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/metrics/livemeasures/AddIndexOnProjectUuidOfLiveMeasuresTableTest/schema.sql +++ /dev/null @@ -1,13 +0,0 @@ -CREATE TABLE "LIVE_MEASURES"( - "UUID" VARCHAR(40) NOT NULL, - "PROJECT_UUID" VARCHAR(50) NOT NULL, - "COMPONENT_UUID" VARCHAR(50) NOT NULL, - "METRIC_UUID" VARCHAR(40) NOT NULL, - "VALUE" DOUBLE, - "TEXT_VALUE" VARCHAR(4000), - "VARIATION" DOUBLE, - "MEASURE_DATA" BLOB, - "UPDATE_MARKER" VARCHAR(40), - "CREATED_AT" BIGINT NOT NULL, - "UPDATED_AT" BIGINT NOT NULL -); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/metrics/livemeasures/CopyLiveMeasuresTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/metrics/livemeasures/CopyLiveMeasuresTableTest/schema.sql deleted file mode 100644 index e969dd3add3..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/metrics/livemeasures/CopyLiveMeasuresTableTest/schema.sql +++ /dev/null @@ -1,16 +0,0 @@ -CREATE TABLE "LIVE_MEASURES"( - "UUID" VARCHAR(40) NOT NULL, - "PROJECT_UUID" VARCHAR(50) NOT NULL, - "COMPONENT_UUID" VARCHAR(50) NOT NULL, - "METRIC_ID" INTEGER NOT NULL, - "VALUE" DOUBLE, - "TEXT_VALUE" VARCHAR(4000), - "VARIATION" DOUBLE, - "MEASURE_DATA" BLOB, - "UPDATE_MARKER" VARCHAR(40), - "CREATED_AT" BIGINT NOT NULL, - "UPDATED_AT" BIGINT NOT NULL -); -ALTER TABLE "LIVE_MEASURES" ADD CONSTRAINT "PK_LIVE_MEASURES" PRIMARY KEY("UUID"); -CREATE INDEX "LIVE_MEASURES_PROJECT" ON "LIVE_MEASURES"("PROJECT_UUID"); -CREATE UNIQUE INDEX "LIVE_MEASURES_COMPONENT" ON "LIVE_MEASURES"("COMPONENT_UUID", "METRIC_ID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/metrics/livemeasures/DropLiveMeasuresTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/metrics/livemeasures/DropLiveMeasuresTableTest/schema.sql deleted file mode 100644 index 979f28bb677..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/metrics/livemeasures/DropLiveMeasuresTableTest/schema.sql +++ /dev/null @@ -1,30 +0,0 @@ -CREATE TABLE "LIVE_MEASURES"( - "UUID" VARCHAR(40) NOT NULL, - "PROJECT_UUID" VARCHAR(50) NOT NULL, - "COMPONENT_UUID" VARCHAR(50) NOT NULL, - "METRIC_ID" INTEGER NOT NULL, - "VALUE" DOUBLE, - "TEXT_VALUE" VARCHAR(4000), - "VARIATION" DOUBLE, - "MEASURE_DATA" BLOB, - "UPDATE_MARKER" VARCHAR(40), - "CREATED_AT" BIGINT NOT NULL, - "UPDATED_AT" BIGINT NOT NULL -); -ALTER TABLE "LIVE_MEASURES" ADD CONSTRAINT "PK_LIVE_MEASURES" PRIMARY KEY("UUID"); -CREATE INDEX "LIVE_MEASURES_PROJECT" ON "LIVE_MEASURES"("PROJECT_UUID"); -CREATE UNIQUE INDEX "LIVE_MEASURES_COMPONENT" ON "LIVE_MEASURES"("COMPONENT_UUID", "METRIC_ID"); - -CREATE TABLE "LIVE_MEASURES_COPY"( - "UUID" VARCHAR(40) NOT NULL, - "PROJECT_UUID" VARCHAR(50) NOT NULL, - "COMPONENT_UUID" VARCHAR(50) NOT NULL, - "METRIC_UUID" VARCHAR(40) NOT NULL, - "VALUE" DOUBLE, - "TEXT_VALUE" VARCHAR(4000), - "VARIATION" DOUBLE, - "MEASURE_DATA" BLOB, - "UPDATE_MARKER" VARCHAR(40), - "CREATED_AT" BIGINT NOT NULL, - "UPDATED_AT" BIGINT NOT NULL -); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/metrics/livemeasures/RenameLiveMeasuresCopyToLiveMeasuresTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/metrics/livemeasures/RenameLiveMeasuresCopyToLiveMeasuresTest/schema.sql deleted file mode 100644 index 6688560c8be..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/metrics/livemeasures/RenameLiveMeasuresCopyToLiveMeasuresTest/schema.sql +++ /dev/null @@ -1,13 +0,0 @@ -CREATE TABLE "LIVE_MEASURES_COPY"( - "UUID" VARCHAR(40) NOT NULL, - "PROJECT_UUID" VARCHAR(50) NOT NULL, - "COMPONENT_UUID" VARCHAR(50) NOT NULL, - "METRIC_UUID" VARCHAR(40) NOT NULL, - "VALUE" DOUBLE, - "TEXT_VALUE" VARCHAR(4000), - "VARIATION" DOUBLE, - "MEASURE_DATA" BLOB, - "UPDATE_MARKER" VARCHAR(40), - "CREATED_AT" BIGINT NOT NULL, - "UPDATED_AT" BIGINT NOT NULL -); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/metrics/manualmeasures/AddMetricUuidColumnToManualMeasuresTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/metrics/manualmeasures/AddMetricUuidColumnToManualMeasuresTest/schema.sql deleted file mode 100644 index 37a120d6215..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/metrics/manualmeasures/AddMetricUuidColumnToManualMeasuresTest/schema.sql +++ /dev/null @@ -1,35 +0,0 @@ -CREATE TABLE "MANUAL_MEASURES"( - "UUID" VARCHAR(40) NOT NULL, - "METRIC_ID" INTEGER NOT NULL, - "VALUE" DOUBLE, - "TEXT_VALUE" VARCHAR(4000), - "USER_UUID" VARCHAR(255), - "DESCRIPTION" VARCHAR(4000), - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT, - "COMPONENT_UUID" VARCHAR(50) NOT NULL -); -ALTER TABLE "MANUAL_MEASURES" ADD CONSTRAINT "PK_MANUAL_MEASURES" PRIMARY KEY("UUID"); -CREATE INDEX "MANUAL_MEASURES_COMPONENT_UUID" ON "MANUAL_MEASURES"("COMPONENT_UUID"); - -CREATE TABLE "METRICS"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "NAME" VARCHAR(64) NOT NULL, - "DESCRIPTION" VARCHAR(255), - "DIRECTION" INTEGER DEFAULT 0 NOT NULL, - "DOMAIN" VARCHAR(64), - "SHORT_NAME" VARCHAR(64), - "QUALITATIVE" BOOLEAN DEFAULT FALSE NOT NULL, - "VAL_TYPE" VARCHAR(8), - "USER_MANAGED" BOOLEAN DEFAULT FALSE, - "ENABLED" BOOLEAN DEFAULT TRUE, - "WORST_VALUE" DOUBLE, - "BEST_VALUE" DOUBLE, - "OPTIMIZED_BEST_VALUE" BOOLEAN, - "HIDDEN" BOOLEAN, - "DELETE_HISTORICAL_DATA" BOOLEAN, - "DECIMAL_SCALE" INTEGER, - "UUID" VARCHAR(40) NOT NULL -); -ALTER TABLE "METRICS" ADD CONSTRAINT "PK_METRICS" PRIMARY KEY("ID"); -CREATE UNIQUE INDEX "METRICS_UNIQUE_NAME" ON "METRICS"("NAME"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/metrics/manualmeasures/DropMetricIdColumnOfManualMeasuresTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/metrics/manualmeasures/DropMetricIdColumnOfManualMeasuresTableTest/schema.sql deleted file mode 100644 index 3bb1010e374..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/metrics/manualmeasures/DropMetricIdColumnOfManualMeasuresTableTest/schema.sql +++ /dev/null @@ -1,36 +0,0 @@ -CREATE TABLE "MANUAL_MEASURES"( - "UUID" VARCHAR(40) NOT NULL, - "METRIC_UUID" VARCHAR(40) NOT NULL, - "METRIC_ID" INTEGER NOT NULL, - "VALUE" DOUBLE, - "TEXT_VALUE" VARCHAR(4000), - "USER_UUID" VARCHAR(255), - "DESCRIPTION" VARCHAR(4000), - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT, - "COMPONENT_UUID" VARCHAR(50) NOT NULL -); -ALTER TABLE "MANUAL_MEASURES" ADD CONSTRAINT "PK_MANUAL_MEASURES" PRIMARY KEY("UUID"); -CREATE INDEX "MANUAL_MEASURES_COMPONENT_UUID" ON "MANUAL_MEASURES"("COMPONENT_UUID"); - -CREATE TABLE "METRICS"( - "ID" INTEGER NOT NULL, - "NAME" VARCHAR(64) NOT NULL, - "DESCRIPTION" VARCHAR(255), - "DIRECTION" INTEGER DEFAULT 0 NOT NULL, - "DOMAIN" VARCHAR(64), - "SHORT_NAME" VARCHAR(64), - "QUALITATIVE" BOOLEAN DEFAULT FALSE NOT NULL, - "VAL_TYPE" VARCHAR(8), - "USER_MANAGED" BOOLEAN DEFAULT FALSE, - "ENABLED" BOOLEAN DEFAULT TRUE, - "WORST_VALUE" DOUBLE, - "BEST_VALUE" DOUBLE, - "OPTIMIZED_BEST_VALUE" BOOLEAN, - "HIDDEN" BOOLEAN, - "DELETE_HISTORICAL_DATA" BOOLEAN, - "DECIMAL_SCALE" INTEGER, - "UUID" VARCHAR(40) NOT NULL -); -ALTER TABLE "METRICS" ADD CONSTRAINT "PK_METRICS" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "METRICS_UNIQUE_NAME" ON "METRICS"("NAME"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/metrics/manualmeasures/MakeManualMeasuresMetricUuidNotNullableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/metrics/manualmeasures/MakeManualMeasuresMetricUuidNotNullableTest/schema.sql deleted file mode 100644 index fe619cf50f2..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/metrics/manualmeasures/MakeManualMeasuresMetricUuidNotNullableTest/schema.sql +++ /dev/null @@ -1,36 +0,0 @@ -CREATE TABLE "MANUAL_MEASURES"( - "UUID" VARCHAR(40) NOT NULL, - "METRIC_UUID" VARCHAR(40), - "METRIC_ID" INTEGER NOT NULL, - "VALUE" DOUBLE, - "TEXT_VALUE" VARCHAR(4000), - "USER_UUID" VARCHAR(255), - "DESCRIPTION" VARCHAR(4000), - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT, - "COMPONENT_UUID" VARCHAR(50) NOT NULL -); -ALTER TABLE "MANUAL_MEASURES" ADD CONSTRAINT "PK_MANUAL_MEASURES" PRIMARY KEY("UUID"); -CREATE INDEX "MANUAL_MEASURES_COMPONENT_UUID" ON "MANUAL_MEASURES"("COMPONENT_UUID"); - -CREATE TABLE "METRICS"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "NAME" VARCHAR(64) NOT NULL, - "DESCRIPTION" VARCHAR(255), - "DIRECTION" INTEGER DEFAULT 0 NOT NULL, - "DOMAIN" VARCHAR(64), - "SHORT_NAME" VARCHAR(64), - "QUALITATIVE" BOOLEAN DEFAULT FALSE NOT NULL, - "VAL_TYPE" VARCHAR(8), - "USER_MANAGED" BOOLEAN DEFAULT FALSE, - "ENABLED" BOOLEAN DEFAULT TRUE, - "WORST_VALUE" DOUBLE, - "BEST_VALUE" DOUBLE, - "OPTIMIZED_BEST_VALUE" BOOLEAN, - "HIDDEN" BOOLEAN, - "DELETE_HISTORICAL_DATA" BOOLEAN, - "DECIMAL_SCALE" INTEGER, - "UUID" VARCHAR(40) NOT NULL -); -ALTER TABLE "METRICS" ADD CONSTRAINT "PK_METRICS" PRIMARY KEY("ID"); -CREATE UNIQUE INDEX "METRICS_UNIQUE_NAME" ON "METRICS"("NAME"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/metrics/manualmeasures/PopulateManualMeasuresMetricUuidTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/metrics/manualmeasures/PopulateManualMeasuresMetricUuidTest/schema.sql deleted file mode 100644 index fe619cf50f2..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/metrics/manualmeasures/PopulateManualMeasuresMetricUuidTest/schema.sql +++ /dev/null @@ -1,36 +0,0 @@ -CREATE TABLE "MANUAL_MEASURES"( - "UUID" VARCHAR(40) NOT NULL, - "METRIC_UUID" VARCHAR(40), - "METRIC_ID" INTEGER NOT NULL, - "VALUE" DOUBLE, - "TEXT_VALUE" VARCHAR(4000), - "USER_UUID" VARCHAR(255), - "DESCRIPTION" VARCHAR(4000), - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT, - "COMPONENT_UUID" VARCHAR(50) NOT NULL -); -ALTER TABLE "MANUAL_MEASURES" ADD CONSTRAINT "PK_MANUAL_MEASURES" PRIMARY KEY("UUID"); -CREATE INDEX "MANUAL_MEASURES_COMPONENT_UUID" ON "MANUAL_MEASURES"("COMPONENT_UUID"); - -CREATE TABLE "METRICS"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "NAME" VARCHAR(64) NOT NULL, - "DESCRIPTION" VARCHAR(255), - "DIRECTION" INTEGER DEFAULT 0 NOT NULL, - "DOMAIN" VARCHAR(64), - "SHORT_NAME" VARCHAR(64), - "QUALITATIVE" BOOLEAN DEFAULT FALSE NOT NULL, - "VAL_TYPE" VARCHAR(8), - "USER_MANAGED" BOOLEAN DEFAULT FALSE, - "ENABLED" BOOLEAN DEFAULT TRUE, - "WORST_VALUE" DOUBLE, - "BEST_VALUE" DOUBLE, - "OPTIMIZED_BEST_VALUE" BOOLEAN, - "HIDDEN" BOOLEAN, - "DELETE_HISTORICAL_DATA" BOOLEAN, - "DECIMAL_SCALE" INTEGER, - "UUID" VARCHAR(40) NOT NULL -); -ALTER TABLE "METRICS" ADD CONSTRAINT "PK_METRICS" PRIMARY KEY("ID"); -CREATE UNIQUE INDEX "METRICS_UNIQUE_NAME" ON "METRICS"("NAME"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/metrics/projectmeasures/AddIndexOnMetricUuidAndAnalysisUuidOfProjectMeasuresTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/metrics/projectmeasures/AddIndexOnMetricUuidAndAnalysisUuidOfProjectMeasuresTableTest/schema.sql deleted file mode 100644 index bcd93c5d249..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/metrics/projectmeasures/AddIndexOnMetricUuidAndAnalysisUuidOfProjectMeasuresTableTest/schema.sql +++ /dev/null @@ -1,21 +0,0 @@ -CREATE TABLE "PROJECT_MEASURES"( - "VALUE" DOUBLE, - "METRIC_UUID" VARCHAR(40) NOT NULL, - "METRIC_ID" INTEGER NOT NULL, - "ANALYSIS_UUID" VARCHAR(50) NOT NULL, - "COMPONENT_UUID" VARCHAR(50) NOT NULL, - "TEXT_VALUE" VARCHAR(4000), - "ALERT_STATUS" VARCHAR(5), - "ALERT_TEXT" VARCHAR(4000), - "DESCRIPTION" VARCHAR(4000), - "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" BLOB, - "UUID" VARCHAR(40) NOT NULL -); -ALTER TABLE "PROJECT_MEASURES" ADD CONSTRAINT "PK_PROJECT_MEASURES" PRIMARY KEY("UUID"); -CREATE INDEX "MEASURES_COMPONENT_UUID" ON "PROJECT_MEASURES"("COMPONENT_UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/metrics/projectmeasures/AddIndexOnMetricUuidOfProjectMeasuresTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/metrics/projectmeasures/AddIndexOnMetricUuidOfProjectMeasuresTableTest/schema.sql deleted file mode 100644 index bcd93c5d249..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/metrics/projectmeasures/AddIndexOnMetricUuidOfProjectMeasuresTableTest/schema.sql +++ /dev/null @@ -1,21 +0,0 @@ -CREATE TABLE "PROJECT_MEASURES"( - "VALUE" DOUBLE, - "METRIC_UUID" VARCHAR(40) NOT NULL, - "METRIC_ID" INTEGER NOT NULL, - "ANALYSIS_UUID" VARCHAR(50) NOT NULL, - "COMPONENT_UUID" VARCHAR(50) NOT NULL, - "TEXT_VALUE" VARCHAR(4000), - "ALERT_STATUS" VARCHAR(5), - "ALERT_TEXT" VARCHAR(4000), - "DESCRIPTION" VARCHAR(4000), - "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" BLOB, - "UUID" VARCHAR(40) NOT NULL -); -ALTER TABLE "PROJECT_MEASURES" ADD CONSTRAINT "PK_PROJECT_MEASURES" PRIMARY KEY("UUID"); -CREATE INDEX "MEASURES_COMPONENT_UUID" ON "PROJECT_MEASURES"("COMPONENT_UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/metrics/projectmeasures/AddMetricUuidColumnToProjectMeasuresTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/metrics/projectmeasures/AddMetricUuidColumnToProjectMeasuresTest/schema.sql deleted file mode 100644 index 847518066d5..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/metrics/projectmeasures/AddMetricUuidColumnToProjectMeasuresTest/schema.sql +++ /dev/null @@ -1,21 +0,0 @@ -CREATE TABLE "PROJECT_MEASURES"( - "VALUE" DOUBLE, - "METRIC_ID" INTEGER NOT NULL, - "ANALYSIS_UUID" VARCHAR(50) NOT NULL, - "COMPONENT_UUID" VARCHAR(50) NOT NULL, - "TEXT_VALUE" VARCHAR(4000), - "ALERT_STATUS" VARCHAR(5), - "ALERT_TEXT" VARCHAR(4000), - "DESCRIPTION" VARCHAR(4000), - "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" BLOB, - "UUID" VARCHAR(40) NOT NULL -); -ALTER TABLE "PROJECT_MEASURES" ADD CONSTRAINT "PK_PROJECT_MEASURES" PRIMARY KEY("UUID"); -CREATE INDEX "MEASURES_ANALYSIS_METRIC" ON "PROJECT_MEASURES"("ANALYSIS_UUID", "METRIC_ID"); -CREATE INDEX "MEASURES_COMPONENT_UUID" ON "PROJECT_MEASURES"("COMPONENT_UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/metrics/projectmeasures/DeleteSecurityReviewRatingProjectMeasuresTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/metrics/projectmeasures/DeleteSecurityReviewRatingProjectMeasuresTest/schema.sql deleted file mode 100644 index 8200c0c931e..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/metrics/projectmeasures/DeleteSecurityReviewRatingProjectMeasuresTest/schema.sql +++ /dev/null @@ -1,42 +0,0 @@ -CREATE TABLE "METRICS"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "UUID" VARCHAR(40) NOT NULL, - "NAME" VARCHAR(64) NOT NULL, - "DESCRIPTION" VARCHAR(255), - "DIRECTION" INTEGER DEFAULT 0 NOT NULL, - "DOMAIN" VARCHAR(64), - "SHORT_NAME" VARCHAR(64), - "QUALITATIVE" BOOLEAN DEFAULT FALSE NOT NULL, - "VAL_TYPE" VARCHAR(8), - "USER_MANAGED" BOOLEAN DEFAULT FALSE, - "ENABLED" BOOLEAN DEFAULT TRUE, - "WORST_VALUE" DOUBLE, - "BEST_VALUE" DOUBLE, - "OPTIMIZED_BEST_VALUE" BOOLEAN, - "HIDDEN" BOOLEAN, - "DELETE_HISTORICAL_DATA" BOOLEAN, - "DECIMAL_SCALE" INTEGER -); -ALTER TABLE "METRICS" ADD CONSTRAINT "PK_METRICS" PRIMARY KEY("ID"); -CREATE UNIQUE INDEX "METRICS_UNIQUE_NAME" ON "METRICS"("NAME"); - -CREATE TABLE "PROJECT_MEASURES"( - "VALUE" DOUBLE, - "METRIC_UUID" VARCHAR(40) NOT NULL, - "ANALYSIS_UUID" VARCHAR(50) NOT NULL, - "COMPONENT_UUID" VARCHAR(50) NOT NULL, - "TEXT_VALUE" VARCHAR(4000), - "ALERT_STATUS" VARCHAR(5), - "ALERT_TEXT" VARCHAR(4000), - "DESCRIPTION" VARCHAR(4000), - "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" BLOB, - "UUID" VARCHAR(40) NOT NULL -); -ALTER TABLE "PROJECT_MEASURES" ADD CONSTRAINT "PK_PROJECT_MEASURES" PRIMARY KEY("UUID"); -CREATE INDEX "MEASURES_COMPONENT_UUID" ON "PROJECT_MEASURES"("COMPONENT_UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/metrics/projectmeasures/DropIndexOnMetricIdOfProjectMeasuresTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/metrics/projectmeasures/DropIndexOnMetricIdOfProjectMeasuresTableTest/schema.sql deleted file mode 100644 index 90d0eb46d3e..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/metrics/projectmeasures/DropIndexOnMetricIdOfProjectMeasuresTableTest/schema.sql +++ /dev/null @@ -1,22 +0,0 @@ -CREATE TABLE "PROJECT_MEASURES"( - "VALUE" DOUBLE, - "METRIC_UUID" VARCHAR(40) NOT NULL, - "METRIC_ID" INTEGER NOT NULL, - "ANALYSIS_UUID" VARCHAR(50) NOT NULL, - "COMPONENT_UUID" VARCHAR(50) NOT NULL, - "TEXT_VALUE" VARCHAR(4000), - "ALERT_STATUS" VARCHAR(5), - "ALERT_TEXT" VARCHAR(4000), - "DESCRIPTION" VARCHAR(4000), - "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" BLOB, - "UUID" VARCHAR(40) NOT NULL -); -ALTER TABLE "PROJECT_MEASURES" ADD CONSTRAINT "PK_PROJECT_MEASURES" PRIMARY KEY("UUID"); -CREATE INDEX "MEASURES_ANALYSIS_METRIC" ON "PROJECT_MEASURES"("ANALYSIS_UUID", "METRIC_ID"); -CREATE INDEX "MEASURES_COMPONENT_UUID" ON "PROJECT_MEASURES"("COMPONENT_UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/metrics/projectmeasures/DropMetricIdColumnOfProjectMeasuresTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/metrics/projectmeasures/DropMetricIdColumnOfProjectMeasuresTableTest/schema.sql deleted file mode 100644 index 55356e78300..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/metrics/projectmeasures/DropMetricIdColumnOfProjectMeasuresTableTest/schema.sql +++ /dev/null @@ -1,22 +0,0 @@ -CREATE TABLE "PROJECT_MEASURES"( - "VALUE" DOUBLE, - "METRIC_UUID" VARCHAR(40) NOT NULL, - "METRIC_ID" INTEGER NOT NULL, - "ANALYSIS_UUID" VARCHAR(50) NOT NULL, - "COMPONENT_UUID" VARCHAR(50) NOT NULL, - "TEXT_VALUE" VARCHAR(4000), - "ALERT_STATUS" VARCHAR(5), - "ALERT_TEXT" VARCHAR(4000), - "DESCRIPTION" VARCHAR(4000), - "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" BLOB, - "UUID" VARCHAR(40) NOT NULL -); -ALTER TABLE "PROJECT_MEASURES" ADD CONSTRAINT "PK_PROJECT_MEASURES" PRIMARY KEY("UUID"); -CREATE INDEX "MEASURES_ANALYSIS_METRIC" ON "PROJECT_MEASURES"("ANALYSIS_UUID", "METRIC_UUID"); -CREATE INDEX "MEASURES_COMPONENT_UUID" ON "PROJECT_MEASURES"("COMPONENT_UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/metrics/projectmeasures/MakeProjectMeasuresMetricUuidNotNullableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/metrics/projectmeasures/MakeProjectMeasuresMetricUuidNotNullableTest/schema.sql deleted file mode 100644 index d78a04c7c95..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/metrics/projectmeasures/MakeProjectMeasuresMetricUuidNotNullableTest/schema.sql +++ /dev/null @@ -1,22 +0,0 @@ -CREATE TABLE "PROJECT_MEASURES"( - "VALUE" DOUBLE, - "METRIC_UUID" VARCHAR(40), - "METRIC_ID" INTEGER NOT NULL, - "ANALYSIS_UUID" VARCHAR(50) NOT NULL, - "COMPONENT_UUID" VARCHAR(50) NOT NULL, - "TEXT_VALUE" VARCHAR(4000), - "ALERT_STATUS" VARCHAR(5), - "ALERT_TEXT" VARCHAR(4000), - "DESCRIPTION" VARCHAR(4000), - "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" BLOB, - "UUID" VARCHAR(40) NOT NULL -); -ALTER TABLE "PROJECT_MEASURES" ADD CONSTRAINT "PK_PROJECT_MEASURES" PRIMARY KEY("UUID"); -CREATE INDEX "MEASURES_ANALYSIS_METRIC" ON "PROJECT_MEASURES"("ANALYSIS_UUID", "METRIC_ID"); -CREATE INDEX "MEASURES_COMPONENT_UUID" ON "PROJECT_MEASURES"("COMPONENT_UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/metrics/projectmeasures/PopulateProjectMeasuresMetricUuidTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/metrics/projectmeasures/PopulateProjectMeasuresMetricUuidTest/schema.sql deleted file mode 100644 index ae7f3c32c33..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/metrics/projectmeasures/PopulateProjectMeasuresMetricUuidTest/schema.sql +++ /dev/null @@ -1,44 +0,0 @@ -CREATE TABLE "PROJECT_MEASURES"( - "VALUE" DOUBLE, - "METRIC_UUID" VARCHAR(40), - "METRIC_ID" INTEGER NOT NULL, - "ANALYSIS_UUID" VARCHAR(50) NOT NULL, - "COMPONENT_UUID" VARCHAR(50) NOT NULL, - "TEXT_VALUE" VARCHAR(4000), - "ALERT_STATUS" VARCHAR(5), - "ALERT_TEXT" VARCHAR(4000), - "DESCRIPTION" VARCHAR(4000), - "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" BLOB, - "UUID" VARCHAR(40) NOT NULL -); -ALTER TABLE "PROJECT_MEASURES" ADD CONSTRAINT "PK_PROJECT_MEASURES" PRIMARY KEY("UUID"); -CREATE INDEX "MEASURES_ANALYSIS_METRIC" ON "PROJECT_MEASURES"("ANALYSIS_UUID", "METRIC_ID"); -CREATE INDEX "MEASURES_COMPONENT_UUID" ON "PROJECT_MEASURES"("COMPONENT_UUID"); - -CREATE TABLE "METRICS"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "UUID" VARCHAR(40), - "NAME" VARCHAR(64) NOT NULL, - "DESCRIPTION" VARCHAR(255), - "DIRECTION" INTEGER DEFAULT 0 NOT NULL, - "DOMAIN" VARCHAR(64), - "SHORT_NAME" VARCHAR(64), - "QUALITATIVE" BOOLEAN DEFAULT FALSE NOT NULL, - "VAL_TYPE" VARCHAR(8), - "USER_MANAGED" BOOLEAN DEFAULT FALSE, - "ENABLED" BOOLEAN DEFAULT TRUE, - "WORST_VALUE" DOUBLE, - "BEST_VALUE" DOUBLE, - "OPTIMIZED_BEST_VALUE" BOOLEAN, - "HIDDEN" BOOLEAN, - "DELETE_HISTORICAL_DATA" BOOLEAN, - "DECIMAL_SCALE" INTEGER -); -ALTER TABLE "METRICS" ADD CONSTRAINT "PK_METRICS" PRIMARY KEY("ID"); -CREATE UNIQUE INDEX "METRICS_UNIQUE_NAME" ON "METRICS"("NAME"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/metrics/qualitygateconditions/AddMetricUuidColumnToQualityGateConditionsTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/metrics/qualitygateconditions/AddMetricUuidColumnToQualityGateConditionsTest/schema.sql deleted file mode 100644 index dff1d72e573..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/metrics/qualitygateconditions/AddMetricUuidColumnToQualityGateConditionsTest/schema.sql +++ /dev/null @@ -1,34 +0,0 @@ -CREATE TABLE "QUALITY_GATE_CONDITIONS"( - "UUID" VARCHAR(40) NOT NULL, - "QGATE_ID" INTEGER, - "METRIC_ID" INTEGER, - "PERIOD" INTEGER, - "OPERATOR" VARCHAR(3), - "VALUE_ERROR" VARCHAR(64), - "VALUE_WARNING" VARCHAR(64), - "CREATED_AT" TIMESTAMP, - "UPDATED_AT" TIMESTAMP -); -ALTER TABLE "QUALITY_GATE_CONDITIONS" ADD CONSTRAINT "PK_QUALITY_GATE_CONDITIONS" PRIMARY KEY("UUID"); - -CREATE TABLE "METRICS"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "UUID" VARCHAR(40) NOT NULL, - "NAME" VARCHAR(64) NOT NULL, - "DESCRIPTION" VARCHAR(255), - "DIRECTION" INTEGER DEFAULT 0 NOT NULL, - "DOMAIN" VARCHAR(64), - "SHORT_NAME" VARCHAR(64), - "QUALITATIVE" BOOLEAN DEFAULT FALSE NOT NULL, - "VAL_TYPE" VARCHAR(8), - "USER_MANAGED" BOOLEAN DEFAULT FALSE, - "ENABLED" BOOLEAN DEFAULT TRUE, - "WORST_VALUE" DOUBLE, - "BEST_VALUE" DOUBLE, - "OPTIMIZED_BEST_VALUE" BOOLEAN, - "HIDDEN" BOOLEAN, - "DELETE_HISTORICAL_DATA" BOOLEAN, - "DECIMAL_SCALE" INTEGER -); -ALTER TABLE "METRICS" ADD CONSTRAINT "PK_METRICS" PRIMARY KEY("ID"); -CREATE UNIQUE INDEX "METRICS_UNIQUE_NAME" ON "METRICS"("NAME"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/metrics/qualitygateconditions/DropMetricIdColumnOfQualityGateConditionsTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/metrics/qualitygateconditions/DropMetricIdColumnOfQualityGateConditionsTableTest/schema.sql deleted file mode 100644 index aa2aaf71563..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/metrics/qualitygateconditions/DropMetricIdColumnOfQualityGateConditionsTableTest/schema.sql +++ /dev/null @@ -1,35 +0,0 @@ -CREATE TABLE "QUALITY_GATE_CONDITIONS"( - "UUID" VARCHAR(40) NOT NULL, - "QGATE_ID" INTEGER, - "METRIC_UUID" VARCHAR(40) NOT NULL, - "METRIC_ID" INTEGER, - "PERIOD" INTEGER, - "OPERATOR" VARCHAR(3), - "VALUE_ERROR" VARCHAR(64), - "VALUE_WARNING" VARCHAR(64), - "CREATED_AT" TIMESTAMP, - "UPDATED_AT" TIMESTAMP -); -ALTER TABLE "QUALITY_GATE_CONDITIONS" ADD CONSTRAINT "PK_QUALITY_GATE_CONDITIONS" PRIMARY KEY("UUID"); - -CREATE TABLE "METRICS"( - "ID" INTEGER NOT NULL, - "UUID" VARCHAR(40) NOT NULL, - "NAME" VARCHAR(64) NOT NULL, - "DESCRIPTION" VARCHAR(255), - "DIRECTION" INTEGER DEFAULT 0 NOT NULL, - "DOMAIN" VARCHAR(64), - "SHORT_NAME" VARCHAR(64), - "QUALITATIVE" BOOLEAN DEFAULT FALSE NOT NULL, - "VAL_TYPE" VARCHAR(8), - "USER_MANAGED" BOOLEAN DEFAULT FALSE, - "ENABLED" BOOLEAN DEFAULT TRUE, - "WORST_VALUE" DOUBLE, - "BEST_VALUE" DOUBLE, - "OPTIMIZED_BEST_VALUE" BOOLEAN, - "HIDDEN" BOOLEAN, - "DELETE_HISTORICAL_DATA" BOOLEAN, - "DECIMAL_SCALE" INTEGER -); -ALTER TABLE "METRICS" ADD CONSTRAINT "PK_METRICS" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "METRICS_UNIQUE_NAME" ON "METRICS"("NAME"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/metrics/qualitygateconditions/MakeQualityGateConditionsMetricUuidNotNullableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/metrics/qualitygateconditions/MakeQualityGateConditionsMetricUuidNotNullableTest/schema.sql deleted file mode 100644 index 2b5a222cb91..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/metrics/qualitygateconditions/MakeQualityGateConditionsMetricUuidNotNullableTest/schema.sql +++ /dev/null @@ -1,35 +0,0 @@ -CREATE TABLE "QUALITY_GATE_CONDITIONS"( - "UUID" VARCHAR(40) NOT NULL, - "QGATE_ID" INTEGER, - "METRIC_UUID" VARCHAR(40), - "METRIC_ID" INTEGER, - "PERIOD" INTEGER, - "OPERATOR" VARCHAR(3), - "VALUE_ERROR" VARCHAR(64), - "VALUE_WARNING" VARCHAR(64), - "CREATED_AT" TIMESTAMP, - "UPDATED_AT" TIMESTAMP -); -ALTER TABLE "QUALITY_GATE_CONDITIONS" ADD CONSTRAINT "PK_QUALITY_GATE_CONDITIONS" PRIMARY KEY("UUID"); - -CREATE TABLE "METRICS"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "UUID" VARCHAR(40) NOT NULL, - "NAME" VARCHAR(64) NOT NULL, - "DESCRIPTION" VARCHAR(255), - "DIRECTION" INTEGER DEFAULT 0 NOT NULL, - "DOMAIN" VARCHAR(64), - "SHORT_NAME" VARCHAR(64), - "QUALITATIVE" BOOLEAN DEFAULT FALSE NOT NULL, - "VAL_TYPE" VARCHAR(8), - "USER_MANAGED" BOOLEAN DEFAULT FALSE, - "ENABLED" BOOLEAN DEFAULT TRUE, - "WORST_VALUE" DOUBLE, - "BEST_VALUE" DOUBLE, - "OPTIMIZED_BEST_VALUE" BOOLEAN, - "HIDDEN" BOOLEAN, - "DELETE_HISTORICAL_DATA" BOOLEAN, - "DECIMAL_SCALE" INTEGER -); -ALTER TABLE "METRICS" ADD CONSTRAINT "PK_METRICS" PRIMARY KEY("ID"); -CREATE UNIQUE INDEX "METRICS_UNIQUE_NAME" ON "METRICS"("NAME"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/metrics/qualitygateconditions/PopulateQualityGateConditionsMetricUuidTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/metrics/qualitygateconditions/PopulateQualityGateConditionsMetricUuidTest/schema.sql deleted file mode 100644 index 2b5a222cb91..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/metrics/qualitygateconditions/PopulateQualityGateConditionsMetricUuidTest/schema.sql +++ /dev/null @@ -1,35 +0,0 @@ -CREATE TABLE "QUALITY_GATE_CONDITIONS"( - "UUID" VARCHAR(40) NOT NULL, - "QGATE_ID" INTEGER, - "METRIC_UUID" VARCHAR(40), - "METRIC_ID" INTEGER, - "PERIOD" INTEGER, - "OPERATOR" VARCHAR(3), - "VALUE_ERROR" VARCHAR(64), - "VALUE_WARNING" VARCHAR(64), - "CREATED_AT" TIMESTAMP, - "UPDATED_AT" TIMESTAMP -); -ALTER TABLE "QUALITY_GATE_CONDITIONS" ADD CONSTRAINT "PK_QUALITY_GATE_CONDITIONS" PRIMARY KEY("UUID"); - -CREATE TABLE "METRICS"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "UUID" VARCHAR(40) NOT NULL, - "NAME" VARCHAR(64) NOT NULL, - "DESCRIPTION" VARCHAR(255), - "DIRECTION" INTEGER DEFAULT 0 NOT NULL, - "DOMAIN" VARCHAR(64), - "SHORT_NAME" VARCHAR(64), - "QUALITATIVE" BOOLEAN DEFAULT FALSE NOT NULL, - "VAL_TYPE" VARCHAR(8), - "USER_MANAGED" BOOLEAN DEFAULT FALSE, - "ENABLED" BOOLEAN DEFAULT TRUE, - "WORST_VALUE" DOUBLE, - "BEST_VALUE" DOUBLE, - "OPTIMIZED_BEST_VALUE" BOOLEAN, - "HIDDEN" BOOLEAN, - "DELETE_HISTORICAL_DATA" BOOLEAN, - "DECIMAL_SCALE" INTEGER -); -ALTER TABLE "METRICS" ADD CONSTRAINT "PK_METRICS" PRIMARY KEY("ID"); -CREATE UNIQUE INDEX "METRICS_UNIQUE_NAME" ON "METRICS"("NAME"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/notifications/AddPrimaryKeyOnUuidColumnOfNotificationTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/notifications/AddPrimaryKeyOnUuidColumnOfNotificationTableTest/schema.sql deleted file mode 100644 index 530b33a0863..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/notifications/AddPrimaryKeyOnUuidColumnOfNotificationTableTest/schema.sql +++ /dev/null @@ -1,6 +0,0 @@ -CREATE TABLE "NOTIFICATIONS"( - "ID" INTEGER NOT NULL, - "DATA" BLOB, - "UUID" VARCHAR(40) NOT NULL, - "CREATED_AT" BIGINT NOT NULL -); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/notifications/AddUuidAndCreatedAtColumnsToNotificationTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/notifications/AddUuidAndCreatedAtColumnsToNotificationTest/schema.sql deleted file mode 100644 index bde193df885..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/notifications/AddUuidAndCreatedAtColumnsToNotificationTest/schema.sql +++ /dev/null @@ -1,5 +0,0 @@ -CREATE TABLE "NOTIFICATIONS"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "DATA" BLOB -); -ALTER TABLE "NOTIFICATIONS" ADD CONSTRAINT "PK_NOTIFICATIONS" PRIMARY KEY("ID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/notifications/DropIdColumnOfNotificationTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/notifications/DropIdColumnOfNotificationTableTest/schema.sql deleted file mode 100644 index b007218aa89..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/notifications/DropIdColumnOfNotificationTableTest/schema.sql +++ /dev/null @@ -1,7 +0,0 @@ -CREATE TABLE "NOTIFICATIONS"( - "ID" INTEGER NOT NULL, - "DATA" BLOB, - "UUID" VARCHAR(40) NOT NULL, - "CREATED_AT" BIGINT NOT NULL -); -ALTER TABLE "NOTIFICATIONS" ADD CONSTRAINT "PK_NOTIFICATIONS" PRIMARY KEY("UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/notifications/DropPrimaryKeyOnIdColumnOfNotificationTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/notifications/DropPrimaryKeyOnIdColumnOfNotificationTableTest/schema.sql deleted file mode 100644 index 082c809f6e0..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/notifications/DropPrimaryKeyOnIdColumnOfNotificationTableTest/schema.sql +++ /dev/null @@ -1,7 +0,0 @@ -CREATE TABLE "NOTIFICATIONS"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "UUID" VARCHAR(40) NOT NULL, - "CREATED_AT" BIGINT NOT NULL, - "DATA" BLOB -); -ALTER TABLE "NOTIFICATIONS" ADD CONSTRAINT "PK_NOTIFICATIONS" PRIMARY KEY("ID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/notifications/MakeNotificationUuidAndCreatedAtColumnsNotNullableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/notifications/MakeNotificationUuidAndCreatedAtColumnsNotNullableTest/schema.sql deleted file mode 100644 index 3e3bae5d79d..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/notifications/MakeNotificationUuidAndCreatedAtColumnsNotNullableTest/schema.sql +++ /dev/null @@ -1,7 +0,0 @@ -CREATE TABLE "NOTIFICATIONS"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "UUID" VARCHAR(40), - "CREATED_AT" BIGINT, - "DATA" BLOB -); -ALTER TABLE "NOTIFICATIONS" ADD CONSTRAINT "PK_NOTIFICATIONS" PRIMARY KEY("ID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/notifications/PopulateNotificationUuidAndCreatedAtTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/notifications/PopulateNotificationUuidAndCreatedAtTest/schema.sql deleted file mode 100644 index ca8451dbfd5..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/notifications/PopulateNotificationUuidAndCreatedAtTest/schema.sql +++ /dev/null @@ -1,7 +0,0 @@ -CREATE TABLE "NOTIFICATIONS"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "UUID" VARCHAR(40), - "CREATED_AT" BIGINT NULL, - "DATA" BLOB -); -ALTER TABLE "NOTIFICATIONS" ADD CONSTRAINT "PK_NOTIFICATIONS" PRIMARY KEY("ID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/AddPrimaryKeyOnUuidColumnOfPermissionTemplatesTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/AddPrimaryKeyOnUuidColumnOfPermissionTemplatesTableTest/schema.sql deleted file mode 100644 index 52bb4a2e2c5..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/AddPrimaryKeyOnUuidColumnOfPermissionTemplatesTableTest/schema.sql +++ /dev/null @@ -1,12 +0,0 @@ -CREATE TABLE "PERMISSION_TEMPLATES"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "UUID" VARCHAR(40) NOT NULL, - "ORGANIZATION_UUID" VARCHAR(40) NOT NULL, - "NAME" VARCHAR(100) NOT NULL, - "KEE" VARCHAR(100) NOT NULL, - "DESCRIPTION" VARCHAR(4000), - "CREATED_AT" TIMESTAMP, - "UPDATED_AT" TIMESTAMP, - "KEY_PATTERN" VARCHAR(500) -); - diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/AddUuidColumnToPermissionTemplatesTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/AddUuidColumnToPermissionTemplatesTest/schema.sql deleted file mode 100644 index 0a21fe126d2..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/AddUuidColumnToPermissionTemplatesTest/schema.sql +++ /dev/null @@ -1,11 +0,0 @@ -CREATE TABLE "PERMISSION_TEMPLATES"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "ORGANIZATION_UUID" VARCHAR(40) NOT NULL, - "NAME" VARCHAR(100) NOT NULL, - "KEE" VARCHAR(100) NOT NULL, - "DESCRIPTION" VARCHAR(4000), - "CREATED_AT" TIMESTAMP, - "UPDATED_AT" TIMESTAMP, - "KEY_PATTERN" VARCHAR(500) -); -ALTER TABLE "PERMISSION_TEMPLATES" ADD CONSTRAINT "PK_PERMISSION_TEMPLATES" PRIMARY KEY("ID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/DropIdColumnOfPermissionTemplatesTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/DropIdColumnOfPermissionTemplatesTableTest/schema.sql deleted file mode 100644 index abff11e7672..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/DropIdColumnOfPermissionTemplatesTableTest/schema.sql +++ /dev/null @@ -1,12 +0,0 @@ -CREATE TABLE "PERMISSION_TEMPLATES"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "UUID" VARCHAR(40) NOT NULL, - "ORGANIZATION_UUID" VARCHAR(40) NOT NULL, - "NAME" VARCHAR(100) NOT NULL, - "KEE" VARCHAR(100) NOT NULL, - "DESCRIPTION" VARCHAR(4000), - "CREATED_AT" TIMESTAMP, - "UPDATED_AT" TIMESTAMP, - "KEY_PATTERN" VARCHAR(500) -); -ALTER TABLE "PERMISSION_TEMPLATES" ADD CONSTRAINT "PK_PERMISSION_TEMPLATES" PRIMARY KEY("UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/DropKeeColumnOfPermissionTemplatesTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/DropKeeColumnOfPermissionTemplatesTableTest/schema.sql deleted file mode 100644 index 10c79779e6d..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/DropKeeColumnOfPermissionTemplatesTableTest/schema.sql +++ /dev/null @@ -1,11 +0,0 @@ -CREATE TABLE "PERMISSION_TEMPLATES"( - "UUID" VARCHAR(40) NOT NULL, - "ORGANIZATION_UUID" VARCHAR(40) NOT NULL, - "NAME" VARCHAR(100) NOT NULL, - "KEE" VARCHAR(100) NOT NULL, - "DESCRIPTION" VARCHAR(4000), - "CREATED_AT" TIMESTAMP, - "UPDATED_AT" TIMESTAMP, - "KEY_PATTERN" VARCHAR(500) -); -ALTER TABLE "PERMISSION_TEMPLATES" ADD CONSTRAINT "PK_PERMISSION_TEMPLATES" PRIMARY KEY("UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/DropPrimaryKeyOnIdColumnOfPermissionTemplatesTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/DropPrimaryKeyOnIdColumnOfPermissionTemplatesTableTest/schema.sql deleted file mode 100644 index ed17fd38257..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/DropPrimaryKeyOnIdColumnOfPermissionTemplatesTableTest/schema.sql +++ /dev/null @@ -1,12 +0,0 @@ -CREATE TABLE "PERMISSION_TEMPLATES"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "UUID" VARCHAR(40) NOT NULL, - "ORGANIZATION_UUID" VARCHAR(40) NOT NULL, - "NAME" VARCHAR(100) NOT NULL, - "KEE" VARCHAR(100) NOT NULL, - "DESCRIPTION" VARCHAR(4000), - "CREATED_AT" TIMESTAMP, - "UPDATED_AT" TIMESTAMP, - "KEY_PATTERN" VARCHAR(500) -); -ALTER TABLE "PERMISSION_TEMPLATES" ADD CONSTRAINT "PK_PERMISSION_TEMPLATES" PRIMARY KEY("ID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/MakePermissionTemplateUuidColumnNotNullableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/MakePermissionTemplateUuidColumnNotNullableTest/schema.sql deleted file mode 100644 index a9667137aec..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/MakePermissionTemplateUuidColumnNotNullableTest/schema.sql +++ /dev/null @@ -1,12 +0,0 @@ -CREATE TABLE "PERMISSION_TEMPLATES"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "UUID" VARCHAR(40), - "ORGANIZATION_UUID" VARCHAR(40) NOT NULL, - "NAME" VARCHAR(100) NOT NULL, - "KEE" VARCHAR(100) NOT NULL, - "DESCRIPTION" VARCHAR(4000), - "CREATED_AT" TIMESTAMP, - "UPDATED_AT" TIMESTAMP, - "KEY_PATTERN" VARCHAR(500) -); -ALTER TABLE "PERMISSION_TEMPLATES" ADD CONSTRAINT "PK_PERMISSION_TEMPLATES" PRIMARY KEY("ID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/PopulatePermissionTemplatesUuidTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/PopulatePermissionTemplatesUuidTest/schema.sql deleted file mode 100644 index a9667137aec..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/PopulatePermissionTemplatesUuidTest/schema.sql +++ /dev/null @@ -1,12 +0,0 @@ -CREATE TABLE "PERMISSION_TEMPLATES"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "UUID" VARCHAR(40), - "ORGANIZATION_UUID" VARCHAR(40) NOT NULL, - "NAME" VARCHAR(100) NOT NULL, - "KEE" VARCHAR(100) NOT NULL, - "DESCRIPTION" VARCHAR(4000), - "CREATED_AT" TIMESTAMP, - "UPDATED_AT" TIMESTAMP, - "KEY_PATTERN" VARCHAR(500) -); -ALTER TABLE "PERMISSION_TEMPLATES" ADD CONSTRAINT "PK_PERMISSION_TEMPLATES" PRIMARY KEY("ID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtemplatesgroups/AddTemplateUuidColumnToPermTemplatesGroupsTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtemplatesgroups/AddTemplateUuidColumnToPermTemplatesGroupsTest/schema.sql deleted file mode 100644 index 8fc600ae7dd..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtemplatesgroups/AddTemplateUuidColumnToPermTemplatesGroupsTest/schema.sql +++ /dev/null @@ -1,9 +0,0 @@ -CREATE TABLE "PERM_TEMPLATES_GROUPS"( - "UUID" VARCHAR(40) NOT NULL, - "GROUP_ID" INTEGER, - "TEMPLATE_ID" INTEGER NOT NULL, - "PERMISSION_REFERENCE" VARCHAR(64) NOT NULL, - "CREATED_AT" TIMESTAMP, - "UPDATED_AT" TIMESTAMP -); -ALTER TABLE "PERM_TEMPLATES_GROUPS" ADD CONSTRAINT "PK_PERM_TEMPLATES_GROUPS" PRIMARY KEY("UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtemplatesgroups/DropTemplateIdColumnOfPermTemplatesGroupsTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtemplatesgroups/DropTemplateIdColumnOfPermTemplatesGroupsTableTest/schema.sql deleted file mode 100644 index 9be99ebafe8..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtemplatesgroups/DropTemplateIdColumnOfPermTemplatesGroupsTableTest/schema.sql +++ /dev/null @@ -1,10 +0,0 @@ -CREATE TABLE "PERM_TEMPLATES_GROUPS"( - "UUID" VARCHAR(40) NOT NULL, - "GROUP_ID" INTEGER, - "TEMPLATE_UUID" VARCHAR(40) NOT NULL, - "TEMPLATE_ID" INTEGER NOT NULL, - "PERMISSION_REFERENCE" VARCHAR(64) NOT NULL, - "CREATED_AT" TIMESTAMP, - "UPDATED_AT" TIMESTAMP -); -ALTER TABLE "PERM_TEMPLATES_GROUPS" ADD CONSTRAINT "PK_PERM_TEMPLATES_GROUPS" PRIMARY KEY("UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtemplatesgroups/MakePermTemplatesGroupsTemplateUuidColumnNotNullableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtemplatesgroups/MakePermTemplatesGroupsTemplateUuidColumnNotNullableTest/schema.sql deleted file mode 100644 index a3174f7b947..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtemplatesgroups/MakePermTemplatesGroupsTemplateUuidColumnNotNullableTest/schema.sql +++ /dev/null @@ -1,10 +0,0 @@ -CREATE TABLE "PERM_TEMPLATES_GROUPS"( - "UUID" VARCHAR(40) NOT NULL, - "GROUP_ID" INTEGER, - "TEMPLATE_UUID" VARCHAR(40), - "TEMPLATE_ID" INTEGER NOT NULL, - "PERMISSION_REFERENCE" VARCHAR(64) NOT NULL, - "CREATED_AT" TIMESTAMP, - "UPDATED_AT" TIMESTAMP -); -ALTER TABLE "PERM_TEMPLATES_GROUPS" ADD CONSTRAINT "PK_PERM_TEMPLATES_GROUPS" PRIMARY KEY("UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtemplatesgroups/PopulatePermTemplatesGroupsTemplateUuidColumnTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtemplatesgroups/PopulatePermTemplatesGroupsTemplateUuidColumnTest/schema.sql deleted file mode 100644 index 5f566add810..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtemplatesgroups/PopulatePermTemplatesGroupsTemplateUuidColumnTest/schema.sql +++ /dev/null @@ -1,23 +0,0 @@ -CREATE TABLE "PERM_TEMPLATES_GROUPS"( - "UUID" VARCHAR(40) NOT NULL, - "GROUP_ID" INTEGER, - "TEMPLATE_UUID" VARCHAR(40), - "TEMPLATE_ID" INTEGER NOT NULL, - "PERMISSION_REFERENCE" VARCHAR(64) NOT NULL, - "CREATED_AT" TIMESTAMP, - "UPDATED_AT" TIMESTAMP -); -ALTER TABLE "PERM_TEMPLATES_GROUPS" ADD CONSTRAINT "PK_PERM_TEMPLATES_GROUPS" PRIMARY KEY("UUID"); - -CREATE TABLE "PERMISSION_TEMPLATES"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "UUID" VARCHAR(40) NOT NULL, - "ORGANIZATION_UUID" VARCHAR(40) NOT NULL, - "NAME" VARCHAR(100) NOT NULL, - "KEE" VARCHAR(100) NOT NULL, - "DESCRIPTION" VARCHAR(4000), - "CREATED_AT" TIMESTAMP, - "UPDATED_AT" TIMESTAMP, - "KEY_PATTERN" VARCHAR(500) -); -ALTER TABLE "PERMISSION_TEMPLATES" ADD CONSTRAINT "PK_PERMISSION_TEMPLATES" PRIMARY KEY("ID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtemplatesusers/AddTemplateUuidColumnToPermTemplatesUsersTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtemplatesusers/AddTemplateUuidColumnToPermTemplatesUsersTest/schema.sql deleted file mode 100644 index e9a334d0030..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtemplatesusers/AddTemplateUuidColumnToPermTemplatesUsersTest/schema.sql +++ /dev/null @@ -1,9 +0,0 @@ -CREATE TABLE "PERM_TEMPLATES_USERS"( - "UUID" VARCHAR(40) NOT NULL, - "USER_ID" INTEGER NOT NULL, - "TEMPLATE_ID" INTEGER NOT NULL, - "PERMISSION_REFERENCE" VARCHAR(64) NOT NULL, - "CREATED_AT" TIMESTAMP, - "UPDATED_AT" TIMESTAMP -); -ALTER TABLE "PERM_TEMPLATES_USERS" ADD CONSTRAINT "PK_PERM_TEMPLATES_USERS" PRIMARY KEY("UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtemplatesusers/DropTemplateIdColumnOfPermTemplatesUsersTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtemplatesusers/DropTemplateIdColumnOfPermTemplatesUsersTableTest/schema.sql deleted file mode 100644 index af182cb58ab..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtemplatesusers/DropTemplateIdColumnOfPermTemplatesUsersTableTest/schema.sql +++ /dev/null @@ -1,10 +0,0 @@ -CREATE TABLE "PERM_TEMPLATES_USERS"( - "UUID" VARCHAR(40) NOT NULL, - "USER_ID" INTEGER NOT NULL, - "TEMPLATE_UUID" VARCHAR(40) NOT NULL, - "TEMPLATE_ID" INTEGER NOT NULL, - "PERMISSION_REFERENCE" VARCHAR(64) NOT NULL, - "CREATED_AT" TIMESTAMP, - "UPDATED_AT" TIMESTAMP -); -ALTER TABLE "PERM_TEMPLATES_USERS" ADD CONSTRAINT "PK_PERM_TEMPLATES_USERS" PRIMARY KEY("UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtemplatesusers/MakePermTemplatesUsersTemplateUuidColumnNotNullableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtemplatesusers/MakePermTemplatesUsersTemplateUuidColumnNotNullableTest/schema.sql deleted file mode 100644 index d175d8aa1aa..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtemplatesusers/MakePermTemplatesUsersTemplateUuidColumnNotNullableTest/schema.sql +++ /dev/null @@ -1,10 +0,0 @@ -CREATE TABLE "PERM_TEMPLATES_USERS"( - "UUID" VARCHAR(40) NOT NULL, - "USER_ID" INTEGER NOT NULL, - "TEMPLATE_UUID" VARCHAR(40), - "TEMPLATE_ID" INTEGER NOT NULL, - "PERMISSION_REFERENCE" VARCHAR(64) NOT NULL, - "CREATED_AT" TIMESTAMP, - "UPDATED_AT" TIMESTAMP -); -ALTER TABLE "PERM_TEMPLATES_USERS" ADD CONSTRAINT "PK_PERM_TEMPLATES_USERS" PRIMARY KEY("UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtemplatesusers/PopulatePermTemplatesUsersTemplateUuidColumnTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtemplatesusers/PopulatePermTemplatesUsersTemplateUuidColumnTest/schema.sql deleted file mode 100644 index 055479cfb13..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtemplatesusers/PopulatePermTemplatesUsersTemplateUuidColumnTest/schema.sql +++ /dev/null @@ -1,23 +0,0 @@ -CREATE TABLE "PERMISSION_TEMPLATES"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "UUID" VARCHAR(40) NOT NULL, - "ORGANIZATION_UUID" VARCHAR(40) NOT NULL, - "NAME" VARCHAR(100) NOT NULL, - "KEE" VARCHAR(100) NOT NULL, - "DESCRIPTION" VARCHAR(4000), - "CREATED_AT" TIMESTAMP, - "UPDATED_AT" TIMESTAMP, - "KEY_PATTERN" VARCHAR(500) -); -ALTER TABLE "PERMISSION_TEMPLATES" ADD CONSTRAINT "PK_PERMISSION_TEMPLATES" PRIMARY KEY("ID"); - -CREATE TABLE "PERM_TEMPLATES_USERS"( - "UUID" VARCHAR(40) NOT NULL, - "USER_ID" INTEGER NOT NULL, - "TEMPLATE_UUID" VARCHAR(40), - "TEMPLATE_ID" INTEGER NOT NULL, - "PERMISSION_REFERENCE" VARCHAR(64) NOT NULL, - "CREATED_AT" TIMESTAMP, - "UPDATED_AT" TIMESTAMP -); -ALTER TABLE "PERM_TEMPLATES_USERS" ADD CONSTRAINT "PK_PERM_TEMPLATES_USERS" PRIMARY KEY("UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtplcharacteristics/AddTemplateUuidColumnToPermTplCharacteristicsTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtplcharacteristics/AddTemplateUuidColumnToPermTplCharacteristicsTest/schema.sql deleted file mode 100644 index bd692486b2a..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtplcharacteristics/AddTemplateUuidColumnToPermTplCharacteristicsTest/schema.sql +++ /dev/null @@ -1,10 +0,0 @@ -CREATE TABLE "PERM_TPL_CHARACTERISTICS"( - "UUID" VARCHAR(40) NOT NULL, - "TEMPLATE_ID" INTEGER NOT NULL, - "PERMISSION_KEY" VARCHAR(64) NOT NULL, - "WITH_PROJECT_CREATOR" BOOLEAN DEFAULT FALSE NOT NULL, - "CREATED_AT" BIGINT NOT NULL, - "UPDATED_AT" BIGINT NOT NULL -); -ALTER TABLE "PERM_TPL_CHARACTERISTICS" ADD CONSTRAINT "PK_PERM_TPL_CHARACTERISTICS" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "UNIQ_PERM_TPL_CHARAC" ON "PERM_TPL_CHARACTERISTICS"("TEMPLATE_ID", "PERMISSION_KEY"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtplcharacteristics/AddUniqueIndexOnTemplateUuidAndPermissionKeyColumnsOfPermTplCharacteristicsTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtplcharacteristics/AddUniqueIndexOnTemplateUuidAndPermissionKeyColumnsOfPermTplCharacteristicsTableTest/schema.sql deleted file mode 100644 index 648fb65271a..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtplcharacteristics/AddUniqueIndexOnTemplateUuidAndPermissionKeyColumnsOfPermTplCharacteristicsTableTest/schema.sql +++ /dev/null @@ -1,11 +0,0 @@ -CREATE TABLE "PERM_TPL_CHARACTERISTICS"( - "UUID" VARCHAR(40) NOT NULL, - "TEMPLATE_ID" INTEGER NOT NULL, - "TEMPLATE_UUID" VARCHAR(40) NOT NULL, - "PERMISSION_KEY" VARCHAR(64) NOT NULL, - "WITH_PROJECT_CREATOR" BOOLEAN DEFAULT FALSE NOT NULL, - "CREATED_AT" BIGINT NOT NULL, - "UPDATED_AT" BIGINT NOT NULL -); -ALTER TABLE "PERM_TPL_CHARACTERISTICS" ADD CONSTRAINT "PK_PERM_TPL_CHARACTERISTICS" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "UNIQ_PERM_TPL_CHARAC" ON "PERM_TPL_CHARACTERISTICS"("TEMPLATE_ID", "PERMISSION_KEY"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtplcharacteristics/DropTemplateIdColumnOfPermTplCharacteristicsTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtplcharacteristics/DropTemplateIdColumnOfPermTplCharacteristicsTableTest/schema.sql deleted file mode 100644 index f61883e3019..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtplcharacteristics/DropTemplateIdColumnOfPermTplCharacteristicsTableTest/schema.sql +++ /dev/null @@ -1,11 +0,0 @@ -CREATE TABLE "PERM_TPL_CHARACTERISTICS"( - "UUID" VARCHAR(40) NOT NULL, - "TEMPLATE_UUID" VARCHAR(40) NOT NULL, - "TEMPLATE_ID" INTEGER NOT NULL, - "PERMISSION_KEY" VARCHAR(64) NOT NULL, - "WITH_PROJECT_CREATOR" BOOLEAN DEFAULT FALSE NOT NULL, - "CREATED_AT" BIGINT NOT NULL, - "UPDATED_AT" BIGINT NOT NULL -); -ALTER TABLE "PERM_TPL_CHARACTERISTICS" ADD CONSTRAINT "PK_PERM_TPL_CHARACTERISTICS" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "UNIQ_PERM_TPL_CHARAC" ON "PERM_TPL_CHARACTERISTICS"("TEMPLATE_UUID", "PERMISSION_KEY"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtplcharacteristics/DropUniqueIndexOnTemplateIdAndPermissionKeyColumnsOfPermTplCharacteristicsTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtplcharacteristics/DropUniqueIndexOnTemplateIdAndPermissionKeyColumnsOfPermTplCharacteristicsTableTest/schema.sql deleted file mode 100644 index 47559a2cab0..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtplcharacteristics/DropUniqueIndexOnTemplateIdAndPermissionKeyColumnsOfPermTplCharacteristicsTableTest/schema.sql +++ /dev/null @@ -1,11 +0,0 @@ -CREATE TABLE "PERM_TPL_CHARACTERISTICS"( - "UUID" VARCHAR(40) NOT NULL, - "TEMPLATE_UUID" INTEGER NOT NULL, - "TEMPLATE_ID" VARCHAR(40) NOT NULL, - "PERMISSION_KEY" VARCHAR(64) NOT NULL, - "WITH_PROJECT_CREATOR" BOOLEAN DEFAULT FALSE NOT NULL, - "CREATED_AT" BIGINT NOT NULL, - "UPDATED_AT" BIGINT NOT NULL -); -ALTER TABLE "PERM_TPL_CHARACTERISTICS" ADD CONSTRAINT "PK_PERM_TPL_CHARACTERISTICS" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "UNIQ_PERM_TPL_CHARAC" ON "PERM_TPL_CHARACTERISTICS"("TEMPLATE_ID", "PERMISSION_KEY"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtplcharacteristics/MakePermTplCharacteristicsTemplateUuidColumnNotNullableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtplcharacteristics/MakePermTplCharacteristicsTemplateUuidColumnNotNullableTest/schema.sql deleted file mode 100644 index 5e36ef16eff..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtplcharacteristics/MakePermTplCharacteristicsTemplateUuidColumnNotNullableTest/schema.sql +++ /dev/null @@ -1,11 +0,0 @@ -CREATE TABLE "PERM_TPL_CHARACTERISTICS"( - "UUID" VARCHAR(40) NOT NULL, - "TEMPLATE_ID" INTEGER NOT NULL, - "TEMPLATE_UUID" VARCHAR(40), - "PERMISSION_KEY" VARCHAR(64) NOT NULL, - "WITH_PROJECT_CREATOR" BOOLEAN DEFAULT FALSE NOT NULL, - "CREATED_AT" BIGINT NOT NULL, - "UPDATED_AT" BIGINT NOT NULL -); -ALTER TABLE "PERM_TPL_CHARACTERISTICS" ADD CONSTRAINT "PK_PERM_TPL_CHARACTERISTICS" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "UNIQ_PERM_TPL_CHARAC" ON "PERM_TPL_CHARACTERISTICS"("TEMPLATE_ID", "PERMISSION_KEY"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtplcharacteristics/PopulatePermTplCharacteristicsTemplateUuidColumnTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtplcharacteristics/PopulatePermTplCharacteristicsTemplateUuidColumnTest/schema.sql deleted file mode 100644 index 2443d0d12c8..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permissiontemplates/fk/permtplcharacteristics/PopulatePermTplCharacteristicsTemplateUuidColumnTest/schema.sql +++ /dev/null @@ -1,24 +0,0 @@ -CREATE TABLE "PERMISSION_TEMPLATES"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "UUID" VARCHAR(40) NOT NULL, - "ORGANIZATION_UUID" VARCHAR(40) NOT NULL, - "NAME" VARCHAR(100) NOT NULL, - "KEE" VARCHAR(100) NOT NULL, - "DESCRIPTION" VARCHAR(4000), - "CREATED_AT" TIMESTAMP, - "UPDATED_AT" TIMESTAMP, - "KEY_PATTERN" VARCHAR(500) -); -ALTER TABLE "PERMISSION_TEMPLATES" ADD CONSTRAINT "PK_PERMISSION_TEMPLATES" PRIMARY KEY("ID"); - -CREATE TABLE "PERM_TPL_CHARACTERISTICS"( - "UUID" VARCHAR(40) NOT NULL, - "TEMPLATE_ID" INTEGER NOT NULL, - "TEMPLATE_UUID" VARCHAR(40), - "PERMISSION_KEY" VARCHAR(64) NOT NULL, - "WITH_PROJECT_CREATOR" BOOLEAN DEFAULT FALSE NOT NULL, - "CREATED_AT" BIGINT NOT NULL, - "UPDATED_AT" BIGINT NOT NULL -); -ALTER TABLE "PERM_TPL_CHARACTERISTICS" ADD CONSTRAINT "PK_PERM_TPL_CHARACTERISTICS" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "UNIQ_PERM_TPL_CHARAC" ON "PERM_TPL_CHARACTERISTICS"("TEMPLATE_ID", "PERMISSION_KEY"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permtemplatesgroups/AddPrimaryKeyOnUuidColumnOfPermTemplatesGroupsTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permtemplatesgroups/AddPrimaryKeyOnUuidColumnOfPermTemplatesGroupsTableTest/schema.sql deleted file mode 100644 index f3319b5bc6f..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permtemplatesgroups/AddPrimaryKeyOnUuidColumnOfPermTemplatesGroupsTableTest/schema.sql +++ /dev/null @@ -1,9 +0,0 @@ -CREATE TABLE "PERM_TEMPLATES_GROUPS"( - "ID" INTEGER NOT NULL, - "UUID" VARCHAR(40) NOT NULL, - "GROUP_ID" INTEGER, - "TEMPLATE_ID" INTEGER NOT NULL, - "PERMISSION_REFERENCE" VARCHAR(64) NOT NULL, - "CREATED_AT" TIMESTAMP, - "UPDATED_AT" TIMESTAMP -); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permtemplatesgroups/AddUuidColumnToPermTemplatesGroupsTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permtemplatesgroups/AddUuidColumnToPermTemplatesGroupsTableTest/schema.sql deleted file mode 100644 index fa6baad81b0..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permtemplatesgroups/AddUuidColumnToPermTemplatesGroupsTableTest/schema.sql +++ /dev/null @@ -1,9 +0,0 @@ -CREATE TABLE "PERM_TEMPLATES_GROUPS"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "GROUP_ID" INTEGER, - "TEMPLATE_ID" INTEGER NOT NULL, - "PERMISSION_REFERENCE" VARCHAR(64) NOT NULL, - "CREATED_AT" TIMESTAMP, - "UPDATED_AT" TIMESTAMP -); -ALTER TABLE "PERM_TEMPLATES_GROUPS" ADD CONSTRAINT "PK_PERM_TEMPLATES_GROUPS" PRIMARY KEY("ID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permtemplatesgroups/DropIdColumnOfPermTemplatesGroupsTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permtemplatesgroups/DropIdColumnOfPermTemplatesGroupsTableTest/schema.sql deleted file mode 100644 index 395419e5803..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permtemplatesgroups/DropIdColumnOfPermTemplatesGroupsTableTest/schema.sql +++ /dev/null @@ -1,10 +0,0 @@ -CREATE TABLE "PERM_TEMPLATES_GROUPS"( - "ID" INTEGER NOT NULL, - "UUID" VARCHAR(40) NOT NULL, - "GROUP_ID" INTEGER, - "TEMPLATE_ID" INTEGER NOT NULL, - "PERMISSION_REFERENCE" VARCHAR(64) NOT NULL, - "CREATED_AT" TIMESTAMP, - "UPDATED_AT" TIMESTAMP -); -ALTER TABLE "PERM_TEMPLATES_GROUPS" ADD CONSTRAINT "PK_PERM_TEMPLATES_GROUPS" PRIMARY KEY("UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permtemplatesgroups/DropPrimaryKeyOnIdColumnOfPermTemplatesGroupsTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permtemplatesgroups/DropPrimaryKeyOnIdColumnOfPermTemplatesGroupsTableTest/schema.sql deleted file mode 100644 index dcef0db3e5e..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permtemplatesgroups/DropPrimaryKeyOnIdColumnOfPermTemplatesGroupsTableTest/schema.sql +++ /dev/null @@ -1,10 +0,0 @@ -CREATE TABLE "PERM_TEMPLATES_GROUPS"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "UUID" VARCHAR(40) NOT NULL, - "GROUP_ID" INTEGER, - "TEMPLATE_ID" INTEGER NOT NULL, - "PERMISSION_REFERENCE" VARCHAR(64) NOT NULL, - "CREATED_AT" TIMESTAMP, - "UPDATED_AT" TIMESTAMP -); -ALTER TABLE "PERM_TEMPLATES_GROUPS" ADD CONSTRAINT "PK_PERM_TEMPLATES_GROUPS" PRIMARY KEY("ID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permtemplatesgroups/MakePermTemplatesGroupsUuidColumnNotNullableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permtemplatesgroups/MakePermTemplatesGroupsUuidColumnNotNullableTest/schema.sql deleted file mode 100644 index a1d04848527..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permtemplatesgroups/MakePermTemplatesGroupsUuidColumnNotNullableTest/schema.sql +++ /dev/null @@ -1,10 +0,0 @@ -CREATE TABLE "PERM_TEMPLATES_GROUPS"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "UUID" VARCHAR(40), - "GROUP_ID" INTEGER, - "TEMPLATE_ID" INTEGER NOT NULL, - "PERMISSION_REFERENCE" VARCHAR(64) NOT NULL, - "CREATED_AT" TIMESTAMP, - "UPDATED_AT" TIMESTAMP -); -ALTER TABLE "PERM_TEMPLATES_GROUPS" ADD CONSTRAINT "PK_PERM_TEMPLATES_GROUPS" PRIMARY KEY("ID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permtemplatesgroups/PopulatePermTemplatesGroupsUuidTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permtemplatesgroups/PopulatePermTemplatesGroupsUuidTest/schema.sql deleted file mode 100644 index a1d04848527..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permtemplatesgroups/PopulatePermTemplatesGroupsUuidTest/schema.sql +++ /dev/null @@ -1,10 +0,0 @@ -CREATE TABLE "PERM_TEMPLATES_GROUPS"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "UUID" VARCHAR(40), - "GROUP_ID" INTEGER, - "TEMPLATE_ID" INTEGER NOT NULL, - "PERMISSION_REFERENCE" VARCHAR(64) NOT NULL, - "CREATED_AT" TIMESTAMP, - "UPDATED_AT" TIMESTAMP -); -ALTER TABLE "PERM_TEMPLATES_GROUPS" ADD CONSTRAINT "PK_PERM_TEMPLATES_GROUPS" PRIMARY KEY("ID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permtemplatesusers/AddPrimaryKeyOnUuidColumnOfPermTemplatesUsersTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permtemplatesusers/AddPrimaryKeyOnUuidColumnOfPermTemplatesUsersTableTest/schema.sql deleted file mode 100644 index d51c8ba2245..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permtemplatesusers/AddPrimaryKeyOnUuidColumnOfPermTemplatesUsersTableTest/schema.sql +++ /dev/null @@ -1,9 +0,0 @@ -CREATE TABLE "PERM_TEMPLATES_USERS"( - "ID" INTEGER NOT NULL, - "UUID" VARCHAR(40) NOT NULL, - "USER_ID" INTEGER NOT NULL, - "TEMPLATE_ID" INTEGER NOT NULL, - "PERMISSION_REFERENCE" VARCHAR(64) NOT NULL, - "CREATED_AT" TIMESTAMP, - "UPDATED_AT" TIMESTAMP -); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permtemplatesusers/AddUuidColumnToPermTemplatesUsersTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permtemplatesusers/AddUuidColumnToPermTemplatesUsersTableTest/schema.sql deleted file mode 100644 index 285b963b8cd..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permtemplatesusers/AddUuidColumnToPermTemplatesUsersTableTest/schema.sql +++ /dev/null @@ -1,9 +0,0 @@ -CREATE TABLE "PERM_TEMPLATES_USERS"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "USER_ID" INTEGER NOT NULL, - "TEMPLATE_ID" INTEGER NOT NULL, - "PERMISSION_REFERENCE" VARCHAR(64) NOT NULL, - "CREATED_AT" TIMESTAMP, - "UPDATED_AT" TIMESTAMP -); -ALTER TABLE "PERM_TEMPLATES_USERS" ADD CONSTRAINT "PK_PERM_TEMPLATES_USERS" PRIMARY KEY("ID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permtemplatesusers/DropIdColumnOfPermTemplatesUsersTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permtemplatesusers/DropIdColumnOfPermTemplatesUsersTableTest/schema.sql deleted file mode 100644 index f2974f76813..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permtemplatesusers/DropIdColumnOfPermTemplatesUsersTableTest/schema.sql +++ /dev/null @@ -1,10 +0,0 @@ -CREATE TABLE "PERM_TEMPLATES_USERS"( - "ID" INTEGER NOT NULL, - "UUID" VARCHAR(40) NOT NULL, - "USER_ID" INTEGER NOT NULL, - "TEMPLATE_ID" INTEGER NOT NULL, - "PERMISSION_REFERENCE" VARCHAR(64) NOT NULL, - "CREATED_AT" TIMESTAMP, - "UPDATED_AT" TIMESTAMP -); -ALTER TABLE "PERM_TEMPLATES_USERS" ADD CONSTRAINT "PK_PERM_TEMPLATES_USERS" PRIMARY KEY("UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permtemplatesusers/DropPrimaryKeyOnIdColumnOfPermTemplatesUsersTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permtemplatesusers/DropPrimaryKeyOnIdColumnOfPermTemplatesUsersTableTest/schema.sql deleted file mode 100644 index dc2d8b31e74..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permtemplatesusers/DropPrimaryKeyOnIdColumnOfPermTemplatesUsersTableTest/schema.sql +++ /dev/null @@ -1,10 +0,0 @@ -CREATE TABLE "PERM_TEMPLATES_USERS"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "UUID" VARCHAR(40) NOT NULL, - "USER_ID" INTEGER NOT NULL, - "TEMPLATE_ID" INTEGER NOT NULL, - "PERMISSION_REFERENCE" VARCHAR(64) NOT NULL, - "CREATED_AT" TIMESTAMP, - "UPDATED_AT" TIMESTAMP -); -ALTER TABLE "PERM_TEMPLATES_USERS" ADD CONSTRAINT "PK_PERM_TEMPLATES_USERS" PRIMARY KEY("ID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permtemplatesusers/MakePermTemplatesUsersUuidColumnNotNullableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permtemplatesusers/MakePermTemplatesUsersUuidColumnNotNullableTest/schema.sql deleted file mode 100644 index 23c2c4f21e6..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permtemplatesusers/MakePermTemplatesUsersUuidColumnNotNullableTest/schema.sql +++ /dev/null @@ -1,10 +0,0 @@ -CREATE TABLE "PERM_TEMPLATES_USERS"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "UUID" VARCHAR(40), - "USER_ID" INTEGER NOT NULL, - "TEMPLATE_ID" INTEGER NOT NULL, - "PERMISSION_REFERENCE" VARCHAR(64) NOT NULL, - "CREATED_AT" TIMESTAMP, - "UPDATED_AT" TIMESTAMP -); -ALTER TABLE "PERM_TEMPLATES_USERS" ADD CONSTRAINT "PK_PERM_TEMPLATES_USERS" PRIMARY KEY("ID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permtemplatesusers/PopulatePermTemplatesUsersUuidTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permtemplatesusers/PopulatePermTemplatesUsersUuidTest/schema.sql deleted file mode 100644 index 23c2c4f21e6..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permtemplatesusers/PopulatePermTemplatesUsersUuidTest/schema.sql +++ /dev/null @@ -1,10 +0,0 @@ -CREATE TABLE "PERM_TEMPLATES_USERS"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "UUID" VARCHAR(40), - "USER_ID" INTEGER NOT NULL, - "TEMPLATE_ID" INTEGER NOT NULL, - "PERMISSION_REFERENCE" VARCHAR(64) NOT NULL, - "CREATED_AT" TIMESTAMP, - "UPDATED_AT" TIMESTAMP -); -ALTER TABLE "PERM_TEMPLATES_USERS" ADD CONSTRAINT "PK_PERM_TEMPLATES_USERS" PRIMARY KEY("ID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permtplcharacteristics/AddPrimaryKeyOnUuidColumnOfPermTplCharacteristicsTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permtplcharacteristics/AddPrimaryKeyOnUuidColumnOfPermTplCharacteristicsTableTest/schema.sql deleted file mode 100644 index e8784cadf0c..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permtplcharacteristics/AddPrimaryKeyOnUuidColumnOfPermTplCharacteristicsTableTest/schema.sql +++ /dev/null @@ -1,10 +0,0 @@ -CREATE TABLE "PERM_TPL_CHARACTERISTICS"( - "ID" INTEGER NOT NULL, - "UUID" VARCHAR(40) NOT NULL, - "TEMPLATE_ID" INTEGER NOT NULL, - "PERMISSION_KEY" VARCHAR(64) NOT NULL, - "WITH_PROJECT_CREATOR" BOOLEAN DEFAULT FALSE NOT NULL, - "CREATED_AT" BIGINT NOT NULL, - "UPDATED_AT" BIGINT NOT NULL -); -CREATE UNIQUE INDEX "UNIQ_PERM_TPL_CHARAC" ON "PERM_TPL_CHARACTERISTICS"("TEMPLATE_ID", "PERMISSION_KEY"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permtplcharacteristics/AddUuidColumnToPermTplCharacteristicsTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permtplcharacteristics/AddUuidColumnToPermTplCharacteristicsTableTest/schema.sql deleted file mode 100644 index 174c2e880c9..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permtplcharacteristics/AddUuidColumnToPermTplCharacteristicsTableTest/schema.sql +++ /dev/null @@ -1,10 +0,0 @@ -CREATE TABLE "PERM_TPL_CHARACTERISTICS"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "TEMPLATE_ID" INTEGER NOT NULL, - "PERMISSION_KEY" VARCHAR(64) NOT NULL, - "WITH_PROJECT_CREATOR" BOOLEAN DEFAULT FALSE NOT NULL, - "CREATED_AT" BIGINT NOT NULL, - "UPDATED_AT" BIGINT NOT NULL -); -ALTER TABLE "PERM_TPL_CHARACTERISTICS" ADD CONSTRAINT "PK_PERM_TPL_CHARACTERISTICS" PRIMARY KEY("ID"); -CREATE UNIQUE INDEX "UNIQ_PERM_TPL_CHARAC" ON "PERM_TPL_CHARACTERISTICS"("TEMPLATE_ID", "PERMISSION_KEY"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permtplcharacteristics/DropIdColumnOfPermTplCharacteristicsTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permtplcharacteristics/DropIdColumnOfPermTplCharacteristicsTableTest/schema.sql deleted file mode 100644 index 8fad4d5a96c..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permtplcharacteristics/DropIdColumnOfPermTplCharacteristicsTableTest/schema.sql +++ /dev/null @@ -1,11 +0,0 @@ -CREATE TABLE "PERM_TPL_CHARACTERISTICS"( - "ID" INTEGER NOT NULL, - "UUID" VARCHAR(40) NOT NULL, - "TEMPLATE_ID" INTEGER NOT NULL, - "PERMISSION_KEY" VARCHAR(64) NOT NULL, - "WITH_PROJECT_CREATOR" BOOLEAN DEFAULT FALSE NOT NULL, - "CREATED_AT" BIGINT NOT NULL, - "UPDATED_AT" BIGINT NOT NULL -); -ALTER TABLE "PERM_TPL_CHARACTERISTICS" ADD CONSTRAINT "PK_PERM_TPL_CHARACTERISTICS" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "UNIQ_PERM_TPL_CHARAC" ON "PERM_TPL_CHARACTERISTICS"("TEMPLATE_ID", "PERMISSION_KEY"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permtplcharacteristics/DropPrimaryKeyOnIdColumnOfPermTplCharacteristicsTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permtplcharacteristics/DropPrimaryKeyOnIdColumnOfPermTplCharacteristicsTableTest/schema.sql deleted file mode 100644 index 3cf4c91cf61..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permtplcharacteristics/DropPrimaryKeyOnIdColumnOfPermTplCharacteristicsTableTest/schema.sql +++ /dev/null @@ -1,11 +0,0 @@ -CREATE TABLE "PERM_TPL_CHARACTERISTICS"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "UUID" VARCHAR(40) NOT NULL, - "TEMPLATE_ID" INTEGER NOT NULL, - "PERMISSION_KEY" VARCHAR(64) NOT NULL, - "WITH_PROJECT_CREATOR" BOOLEAN DEFAULT FALSE NOT NULL, - "CREATED_AT" BIGINT NOT NULL, - "UPDATED_AT" BIGINT NOT NULL -); -ALTER TABLE "PERM_TPL_CHARACTERISTICS" ADD CONSTRAINT "PK_PERM_TPL_CHARACTERISTICS" PRIMARY KEY("ID"); -CREATE UNIQUE INDEX "UNIQ_PERM_TPL_CHARAC" ON "PERM_TPL_CHARACTERISTICS"("TEMPLATE_ID", "PERMISSION_KEY"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permtplcharacteristics/MakePermTplCharacteristicsUuidColumnNotNullableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permtplcharacteristics/MakePermTplCharacteristicsUuidColumnNotNullableTest/schema.sql deleted file mode 100644 index ea986ff54d8..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permtplcharacteristics/MakePermTplCharacteristicsUuidColumnNotNullableTest/schema.sql +++ /dev/null @@ -1,11 +0,0 @@ -CREATE TABLE "PERM_TPL_CHARACTERISTICS"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "UUID" VARCHAR(40), - "TEMPLATE_ID" INTEGER NOT NULL, - "PERMISSION_KEY" VARCHAR(64) NOT NULL, - "WITH_PROJECT_CREATOR" BOOLEAN DEFAULT FALSE NOT NULL, - "CREATED_AT" BIGINT NOT NULL, - "UPDATED_AT" BIGINT NOT NULL -); -ALTER TABLE "PERM_TPL_CHARACTERISTICS" ADD CONSTRAINT "PK_PERM_TPL_CHARACTERISTICS" PRIMARY KEY("ID"); -CREATE UNIQUE INDEX "UNIQ_PERM_TPL_CHARAC" ON "PERM_TPL_CHARACTERISTICS"("TEMPLATE_ID", "PERMISSION_KEY"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permtplcharacteristics/PopulatePermTplCharacteristicsUuidTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permtplcharacteristics/PopulatePermTplCharacteristicsUuidTest/schema.sql deleted file mode 100644 index ea986ff54d8..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/permtplcharacteristics/PopulatePermTplCharacteristicsUuidTest/schema.sql +++ /dev/null @@ -1,11 +0,0 @@ -CREATE TABLE "PERM_TPL_CHARACTERISTICS"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "UUID" VARCHAR(40), - "TEMPLATE_ID" INTEGER NOT NULL, - "PERMISSION_KEY" VARCHAR(64) NOT NULL, - "WITH_PROJECT_CREATOR" BOOLEAN DEFAULT FALSE NOT NULL, - "CREATED_AT" BIGINT NOT NULL, - "UPDATED_AT" BIGINT NOT NULL -); -ALTER TABLE "PERM_TPL_CHARACTERISTICS" ADD CONSTRAINT "PK_PERM_TPL_CHARACTERISTICS" PRIMARY KEY("ID"); -CREATE UNIQUE INDEX "UNIQ_PERM_TPL_CHARAC" ON "PERM_TPL_CHARACTERISTICS"("TEMPLATE_ID", "PERMISSION_KEY"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/projectmeasures/AddPrimaryKeyOnUuidColumnOfProjectMeasureTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/projectmeasures/AddPrimaryKeyOnUuidColumnOfProjectMeasureTableTest/schema.sql deleted file mode 100644 index 81664d485b2..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/projectmeasures/AddPrimaryKeyOnUuidColumnOfProjectMeasureTableTest/schema.sql +++ /dev/null @@ -1,21 +0,0 @@ -CREATE TABLE "PROJECT_MEASURES"( - "ID" BIGINT NOT NULL AUTO_INCREMENT (1,1), - "UUID" VARCHAR(40) NOT NULL, - "VALUE" DOUBLE, - "METRIC_ID" INTEGER NOT NULL, - "ANALYSIS_UUID" VARCHAR(50) NOT NULL, - "COMPONENT_UUID" VARCHAR(50) NOT NULL, - "TEXT_VALUE" VARCHAR(4000), - "ALERT_STATUS" VARCHAR(5), - "ALERT_TEXT" VARCHAR(4000), - "DESCRIPTION" VARCHAR(4000), - "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" BLOB -); -CREATE INDEX "MEASURES_ANALYSIS_METRIC" ON "PROJECT_MEASURES"("ANALYSIS_UUID", "METRIC_ID"); -CREATE INDEX "MEASURES_COMPONENT_UUID" ON "PROJECT_MEASURES"("COMPONENT_UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/projectmeasures/AddTechIndexOnUuidOfProjectMeasuresTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/projectmeasures/AddTechIndexOnUuidOfProjectMeasuresTableTest/schema.sql deleted file mode 100644 index ba02385e040..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/projectmeasures/AddTechIndexOnUuidOfProjectMeasuresTableTest/schema.sql +++ /dev/null @@ -1,22 +0,0 @@ -CREATE TABLE "PROJECT_MEASURES"( - "ID" BIGINT NOT NULL AUTO_INCREMENT (1,1), - "UUID" VARCHAR(40), - "VALUE" DOUBLE, - "METRIC_ID" INTEGER NOT NULL, - "ANALYSIS_UUID" VARCHAR(50) NOT NULL, - "COMPONENT_UUID" VARCHAR(50) NOT NULL, - "TEXT_VALUE" VARCHAR(4000), - "ALERT_STATUS" VARCHAR(5), - "ALERT_TEXT" VARCHAR(4000), - "DESCRIPTION" VARCHAR(4000), - "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" BLOB -); -ALTER TABLE "PROJECT_MEASURES" ADD CONSTRAINT "PK_PROJECT_MEASURES" PRIMARY KEY("ID"); -CREATE INDEX "MEASURES_ANALYSIS_METRIC" ON "PROJECT_MEASURES"("ANALYSIS_UUID", "METRIC_ID"); -CREATE INDEX "MEASURES_COMPONENT_UUID" ON "PROJECT_MEASURES"("COMPONENT_UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/projectmeasures/AddUuidToProjectMeasuresTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/projectmeasures/AddUuidToProjectMeasuresTest/schema.sql deleted file mode 100644 index 3ff9ce0fef9..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/projectmeasures/AddUuidToProjectMeasuresTest/schema.sql +++ /dev/null @@ -1,21 +0,0 @@ -CREATE TABLE "PROJECT_MEASURES"( - "ID" BIGINT NOT NULL AUTO_INCREMENT (1,1), - "VALUE" DOUBLE, - "METRIC_ID" INTEGER NOT NULL, - "ANALYSIS_UUID" VARCHAR(50) NOT NULL, - "COMPONENT_UUID" VARCHAR(50) NOT NULL, - "TEXT_VALUE" VARCHAR(4000), - "ALERT_STATUS" VARCHAR(5), - "ALERT_TEXT" VARCHAR(4000), - "DESCRIPTION" VARCHAR(4000), - "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" BLOB -); -ALTER TABLE "PROJECT_MEASURES" ADD CONSTRAINT "PK_PROJECT_MEASURES" PRIMARY KEY("ID"); -CREATE INDEX "MEASURES_ANALYSIS_METRIC" ON "PROJECT_MEASURES"("ANALYSIS_UUID", "METRIC_ID"); -CREATE INDEX "MEASURES_COMPONENT_UUID" ON "PROJECT_MEASURES"("COMPONENT_UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/projectmeasures/DropIdColumnOfProjectMeasuresTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/projectmeasures/DropIdColumnOfProjectMeasuresTableTest/schema.sql deleted file mode 100644 index f66002cb755..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/projectmeasures/DropIdColumnOfProjectMeasuresTableTest/schema.sql +++ /dev/null @@ -1,22 +0,0 @@ -CREATE TABLE "PROJECT_MEASURES"( - "ID" BIGINT NOT NULL AUTO_INCREMENT (1,1), - "UUID" VARCHAR(40) NOT NULL, - "VALUE" DOUBLE, - "METRIC_ID" INTEGER NOT NULL, - "ANALYSIS_UUID" VARCHAR(50) NOT NULL, - "COMPONENT_UUID" VARCHAR(50) NOT NULL, - "TEXT_VALUE" VARCHAR(4000), - "ALERT_STATUS" VARCHAR(5), - "ALERT_TEXT" VARCHAR(4000), - "DESCRIPTION" VARCHAR(4000), - "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" BLOB -); -ALTER TABLE "PROJECT_MEASURES" ADD CONSTRAINT "PK_PROJECT_MEASURES" PRIMARY KEY("UUID"); -CREATE INDEX "MEASURES_ANALYSIS_METRIC" ON "PROJECT_MEASURES"("ANALYSIS_UUID", "METRIC_ID"); -CREATE INDEX "MEASURES_COMPONENT_UUID" ON "PROJECT_MEASURES"("COMPONENT_UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/projectmeasures/DropPrimaryKeyOnIdColumnOfProjectMeasuresTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/projectmeasures/DropPrimaryKeyOnIdColumnOfProjectMeasuresTableTest/schema.sql deleted file mode 100644 index fd01be5f1bd..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/projectmeasures/DropPrimaryKeyOnIdColumnOfProjectMeasuresTableTest/schema.sql +++ /dev/null @@ -1,22 +0,0 @@ -CREATE TABLE "PROJECT_MEASURES"( - "ID" BIGINT NOT NULL AUTO_INCREMENT (1,1), - "UUID" VARCHAR(40) NOT NULL, - "VALUE" DOUBLE, - "METRIC_ID" INTEGER NOT NULL, - "ANALYSIS_UUID" VARCHAR(50) NOT NULL, - "COMPONENT_UUID" VARCHAR(50) NOT NULL, - "TEXT_VALUE" VARCHAR(4000), - "ALERT_STATUS" VARCHAR(5), - "ALERT_TEXT" VARCHAR(4000), - "DESCRIPTION" VARCHAR(4000), - "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" BLOB -); -ALTER TABLE "PROJECT_MEASURES" ADD CONSTRAINT "PK_PROJECT_MEASURES" PRIMARY KEY("ID"); -CREATE INDEX "MEASURES_ANALYSIS_METRIC" ON "PROJECT_MEASURES"("ANALYSIS_UUID", "METRIC_ID"); -CREATE INDEX "MEASURES_COMPONENT_UUID" ON "PROJECT_MEASURES"("COMPONENT_UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/projectmeasures/DropTechIndexOnUuidOfProjectMeasuresTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/projectmeasures/DropTechIndexOnUuidOfProjectMeasuresTableTest/schema.sql deleted file mode 100644 index 09beb37f52e..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/projectmeasures/DropTechIndexOnUuidOfProjectMeasuresTableTest/schema.sql +++ /dev/null @@ -1,23 +0,0 @@ -CREATE TABLE "PROJECT_MEASURES"( - "ID" BIGINT NOT NULL AUTO_INCREMENT (1,1), - "UUID" VARCHAR(40), - "VALUE" DOUBLE, - "METRIC_ID" INTEGER NOT NULL, - "ANALYSIS_UUID" VARCHAR(50) NOT NULL, - "COMPONENT_UUID" VARCHAR(50) NOT NULL, - "TEXT_VALUE" VARCHAR(4000), - "ALERT_STATUS" VARCHAR(5), - "ALERT_TEXT" VARCHAR(4000), - "DESCRIPTION" VARCHAR(4000), - "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" BLOB -); -ALTER TABLE "PROJECT_MEASURES" ADD CONSTRAINT "PK_PROJECT_MEASURES" PRIMARY KEY("ID"); -CREATE INDEX "MEASURES_ANALYSIS_METRIC" ON "PROJECT_MEASURES"("ANALYSIS_UUID", "METRIC_ID"); -CREATE INDEX "MEASURES_COMPONENT_UUID" ON "PROJECT_MEASURES"("COMPONENT_UUID"); -CREATE INDEX "TECH_INDEX_UUID" ON "PROJECT_MEASURES"("UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/projectmeasures/MakeProjectMeasuresUuidColumnNotNullableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/projectmeasures/MakeProjectMeasuresUuidColumnNotNullableTest/schema.sql deleted file mode 100644 index ba02385e040..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/projectmeasures/MakeProjectMeasuresUuidColumnNotNullableTest/schema.sql +++ /dev/null @@ -1,22 +0,0 @@ -CREATE TABLE "PROJECT_MEASURES"( - "ID" BIGINT NOT NULL AUTO_INCREMENT (1,1), - "UUID" VARCHAR(40), - "VALUE" DOUBLE, - "METRIC_ID" INTEGER NOT NULL, - "ANALYSIS_UUID" VARCHAR(50) NOT NULL, - "COMPONENT_UUID" VARCHAR(50) NOT NULL, - "TEXT_VALUE" VARCHAR(4000), - "ALERT_STATUS" VARCHAR(5), - "ALERT_TEXT" VARCHAR(4000), - "DESCRIPTION" VARCHAR(4000), - "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" BLOB -); -ALTER TABLE "PROJECT_MEASURES" ADD CONSTRAINT "PK_PROJECT_MEASURES" PRIMARY KEY("ID"); -CREATE INDEX "MEASURES_ANALYSIS_METRIC" ON "PROJECT_MEASURES"("ANALYSIS_UUID", "METRIC_ID"); -CREATE INDEX "MEASURES_COMPONENT_UUID" ON "PROJECT_MEASURES"("COMPONENT_UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/projectmeasures/PopulateProjectMeasuresUuidTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/projectmeasures/PopulateProjectMeasuresUuidTest/schema.sql deleted file mode 100644 index ba02385e040..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/projectmeasures/PopulateProjectMeasuresUuidTest/schema.sql +++ /dev/null @@ -1,22 +0,0 @@ -CREATE TABLE "PROJECT_MEASURES"( - "ID" BIGINT NOT NULL AUTO_INCREMENT (1,1), - "UUID" VARCHAR(40), - "VALUE" DOUBLE, - "METRIC_ID" INTEGER NOT NULL, - "ANALYSIS_UUID" VARCHAR(50) NOT NULL, - "COMPONENT_UUID" VARCHAR(50) NOT NULL, - "TEXT_VALUE" VARCHAR(4000), - "ALERT_STATUS" VARCHAR(5), - "ALERT_TEXT" VARCHAR(4000), - "DESCRIPTION" VARCHAR(4000), - "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" BLOB -); -ALTER TABLE "PROJECT_MEASURES" ADD CONSTRAINT "PK_PROJECT_MEASURES" PRIMARY KEY("ID"); -CREATE INDEX "MEASURES_ANALYSIS_METRIC" ON "PROJECT_MEASURES"("ANALYSIS_UUID", "METRIC_ID"); -CREATE INDEX "MEASURES_COMPONENT_UUID" ON "PROJECT_MEASURES"("COMPONENT_UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/projectqprofiles/AddPrimaryKeyOnUuidColumnOfProjectQProfilesTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/projectqprofiles/AddPrimaryKeyOnUuidColumnOfProjectQProfilesTableTest/schema.sql deleted file mode 100644 index b294830aee9..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/projectqprofiles/AddPrimaryKeyOnUuidColumnOfProjectQProfilesTableTest/schema.sql +++ /dev/null @@ -1,7 +0,0 @@ -CREATE TABLE "PROJECT_QPROFILES"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "UUID" VARCHAR(40) NOT NULL, - "PROJECT_UUID" VARCHAR(50) NOT NULL, - "PROFILE_KEY" VARCHAR(50) NOT NULL -); -CREATE UNIQUE INDEX "UNIQ_PROJECT_QPROFILES" ON "PROJECT_QPROFILES"("PROJECT_UUID", "PROFILE_KEY"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/projectqprofiles/AddUuidColumnToProjectQProfilesTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/projectqprofiles/AddUuidColumnToProjectQProfilesTableTest/schema.sql deleted file mode 100644 index c7530b1d254..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/projectqprofiles/AddUuidColumnToProjectQProfilesTableTest/schema.sql +++ /dev/null @@ -1,7 +0,0 @@ -CREATE TABLE "PROJECT_QPROFILES"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "PROJECT_UUID" VARCHAR(50) NOT NULL, - "PROFILE_KEY" VARCHAR(50) NOT NULL -); -ALTER TABLE "PROJECT_QPROFILES" ADD CONSTRAINT "PK_PROJECT_QPROFILES" PRIMARY KEY("ID"); -CREATE UNIQUE INDEX "UNIQ_PROJECT_QPROFILES" ON "PROJECT_QPROFILES"("PROJECT_UUID", "PROFILE_KEY"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/projectqprofiles/DropIdColumnOfProjectQProfilesTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/projectqprofiles/DropIdColumnOfProjectQProfilesTableTest/schema.sql deleted file mode 100644 index d531ef1fa69..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/projectqprofiles/DropIdColumnOfProjectQProfilesTableTest/schema.sql +++ /dev/null @@ -1,8 +0,0 @@ -CREATE TABLE "PROJECT_QPROFILES"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "UUID" VARCHAR(40) NOT NULL, - "PROJECT_UUID" VARCHAR(50) NOT NULL, - "PROFILE_KEY" VARCHAR(50) NOT NULL -); -ALTER TABLE "PROJECT_QPROFILES" ADD CONSTRAINT "PK_PROJECT_QPROFILES" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "UNIQ_PROJECT_QPROFILES" ON "PROJECT_QPROFILES"("PROJECT_UUID", "PROFILE_KEY"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/projectqprofiles/DropPrimaryKeyOnIdColumnOfProjectQProfilesTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/projectqprofiles/DropPrimaryKeyOnIdColumnOfProjectQProfilesTableTest/schema.sql deleted file mode 100644 index 75824e05246..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/projectqprofiles/DropPrimaryKeyOnIdColumnOfProjectQProfilesTableTest/schema.sql +++ /dev/null @@ -1,8 +0,0 @@ -CREATE TABLE "PROJECT_QPROFILES"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "UUID" VARCHAR(40) NOT NULL, - "PROJECT_UUID" VARCHAR(50) NOT NULL, - "PROFILE_KEY" VARCHAR(50) NOT NULL -); -ALTER TABLE "PROJECT_QPROFILES" ADD CONSTRAINT "PK_PROJECT_QPROFILES" PRIMARY KEY("ID"); -CREATE UNIQUE INDEX "UNIQ_PROJECT_QPROFILES" ON "PROJECT_QPROFILES"("PROJECT_UUID", "PROFILE_KEY"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/projectqprofiles/MakeProjectQProfilesUuidColumnNotNullableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/projectqprofiles/MakeProjectQProfilesUuidColumnNotNullableTest/schema.sql deleted file mode 100644 index f961bdc422c..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/projectqprofiles/MakeProjectQProfilesUuidColumnNotNullableTest/schema.sql +++ /dev/null @@ -1,8 +0,0 @@ -CREATE TABLE "PROJECT_QPROFILES"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "UUID" VARCHAR(40), - "PROJECT_UUID" VARCHAR(50) NOT NULL, - "PROFILE_KEY" VARCHAR(50) NOT NULL -); -ALTER TABLE "PROJECT_QPROFILES" ADD CONSTRAINT "PK_PROJECT_QPROFILES" PRIMARY KEY("ID"); -CREATE UNIQUE INDEX "UNIQ_PROJECT_QPROFILES" ON "PROJECT_QPROFILES"("PROJECT_UUID", "PROFILE_KEY"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/projectqprofiles/PopulateProjectQProfilesUuidTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/projectqprofiles/PopulateProjectQProfilesUuidTest/schema.sql deleted file mode 100644 index f961bdc422c..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/projectqprofiles/PopulateProjectQProfilesUuidTest/schema.sql +++ /dev/null @@ -1,8 +0,0 @@ -CREATE TABLE "PROJECT_QPROFILES"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "UUID" VARCHAR(40), - "PROJECT_UUID" VARCHAR(50) NOT NULL, - "PROFILE_KEY" VARCHAR(50) NOT NULL -); -ALTER TABLE "PROJECT_QPROFILES" ADD CONSTRAINT "PK_PROJECT_QPROFILES" PRIMARY KEY("ID"); -CREATE UNIQUE INDEX "UNIQ_PROJECT_QPROFILES" ON "PROJECT_QPROFILES"("PROJECT_UUID", "PROFILE_KEY"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/properties/AddPrimaryKeyOnUuidColumnOfPropertiesTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/properties/AddPrimaryKeyOnUuidColumnOfPropertiesTableTest/schema.sql deleted file mode 100644 index e2598421ec2..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/properties/AddPrimaryKeyOnUuidColumnOfPropertiesTableTest/schema.sql +++ /dev/null @@ -1,12 +0,0 @@ -CREATE TABLE "PROPERTIES"( - "ID" INTEGER NOT NULL, - "UUID" VARCHAR(40) NOT NULL, - "PROP_KEY" VARCHAR(512) NOT NULL, - "RESOURCE_ID" BIGINT, - "USER_ID" BIGINT, - "IS_EMPTY" BOOLEAN NOT NULL, - "TEXT_VALUE" VARCHAR(4000), - "CLOB_VALUE" CLOB(2147483647), - "CREATED_AT" BIGINT NOT NULL -); -CREATE INDEX "PROPERTIES_KEY" ON "PROPERTIES"("PROP_KEY"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/properties/AddUuidColumnToPropertiesTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/properties/AddUuidColumnToPropertiesTest/schema.sql deleted file mode 100644 index 2ac16011ffb..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/properties/AddUuidColumnToPropertiesTest/schema.sql +++ /dev/null @@ -1,12 +0,0 @@ -CREATE TABLE "PROPERTIES"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "PROP_KEY" VARCHAR(512) NOT NULL, - "RESOURCE_ID" BIGINT, - "USER_ID" BIGINT, - "IS_EMPTY" BOOLEAN NOT NULL, - "TEXT_VALUE" VARCHAR(4000), - "CLOB_VALUE" CLOB(2147483647), - "CREATED_AT" BIGINT NOT NULL -); -ALTER TABLE "PROPERTIES" ADD CONSTRAINT "PK_PROPERTIES" PRIMARY KEY("ID"); -CREATE INDEX "PROPERTIES_KEY" ON "PROPERTIES"("PROP_KEY"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/properties/DropIdColumnOfPropertiesTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/properties/DropIdColumnOfPropertiesTableTest/schema.sql deleted file mode 100644 index 363c084bb6f..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/properties/DropIdColumnOfPropertiesTableTest/schema.sql +++ /dev/null @@ -1,13 +0,0 @@ -CREATE TABLE "PROPERTIES"( - "ID" INTEGER NOT NULL, - "UUID" VARCHAR(40) NOT NULL, - "PROP_KEY" VARCHAR(512) NOT NULL, - "RESOURCE_ID" BIGINT, - "USER_ID" BIGINT, - "IS_EMPTY" BOOLEAN NOT NULL, - "TEXT_VALUE" VARCHAR(4000), - "CLOB_VALUE" CLOB(2147483647), - "CREATED_AT" BIGINT NOT NULL -); -ALTER TABLE "PROPERTIES" ADD CONSTRAINT "PK_PROPERTIES" PRIMARY KEY("UUID"); -CREATE INDEX "PROPERTIES_KEY" ON "PROPERTIES"("PROP_KEY"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/properties/DropPrimaryKeyOnIdColumnOfPropertiesTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/properties/DropPrimaryKeyOnIdColumnOfPropertiesTableTest/schema.sql deleted file mode 100644 index 87e741f36e3..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/properties/DropPrimaryKeyOnIdColumnOfPropertiesTableTest/schema.sql +++ /dev/null @@ -1,13 +0,0 @@ -CREATE TABLE "PROPERTIES"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "UUID" VARCHAR(40) NOT NULL, - "PROP_KEY" VARCHAR(512) NOT NULL, - "RESOURCE_ID" BIGINT, - "USER_ID" BIGINT, - "IS_EMPTY" BOOLEAN NOT NULL, - "TEXT_VALUE" VARCHAR(4000), - "CLOB_VALUE" CLOB(2147483647), - "CREATED_AT" BIGINT NOT NULL -); -ALTER TABLE "PROPERTIES" ADD CONSTRAINT "PK_PROPERTIES" PRIMARY KEY("ID"); -CREATE INDEX "PROPERTIES_KEY" ON "PROPERTIES"("PROP_KEY"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/properties/MakeNotificationUuidColumnNotNullableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/properties/MakeNotificationUuidColumnNotNullableTest/schema.sql deleted file mode 100644 index 8b61cd12907..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/properties/MakeNotificationUuidColumnNotNullableTest/schema.sql +++ /dev/null @@ -1,13 +0,0 @@ -CREATE TABLE "PROPERTIES"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "UUID" VARCHAR(40), - "PROP_KEY" VARCHAR(512) NOT NULL, - "RESOURCE_ID" BIGINT, - "USER_ID" BIGINT, - "IS_EMPTY" BOOLEAN NOT NULL, - "TEXT_VALUE" VARCHAR(4000), - "CLOB_VALUE" CLOB(2147483647), - "CREATED_AT" BIGINT NOT NULL -); -ALTER TABLE "PROPERTIES" ADD CONSTRAINT "PK_PROPERTIES" PRIMARY KEY("ID"); -CREATE INDEX "PROPERTIES_KEY" ON "PROPERTIES"("PROP_KEY"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/properties/MakePropertiesUuidColumnNotNullable/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/properties/MakePropertiesUuidColumnNotNullable/schema.sql deleted file mode 100644 index 9b6848f3a3c..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/properties/MakePropertiesUuidColumnNotNullable/schema.sql +++ /dev/null @@ -1,13 +0,0 @@ -CREATE TABLE "PROPERTIES"( - "ID" INTEGER, - "UUID" VARCHAR(40), - "PROP_KEY" VARCHAR(512) NOT NULL, - "RESOURCE_ID" BIGINT, - "USER_ID" BIGINT, - "IS_EMPTY" BOOLEAN NOT NULL, - "TEXT_VALUE" VARCHAR(4000), - "CLOB_VALUE" CLOB(2147483647), - "CREATED_AT" BIGINT NOT NULL -); -ALTER TABLE "PROPERTIES" ADD CONSTRAINT "PK_PROPERTIES" PRIMARY KEY("ID"); -CREATE INDEX "PROPERTIES_KEY" ON "PROPERTIES"("PROP_KEY"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/properties/PopulatePropertiesUuidAndCreatedAtTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/properties/PopulatePropertiesUuidAndCreatedAtTest/schema.sql deleted file mode 100644 index 8b61cd12907..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/properties/PopulatePropertiesUuidAndCreatedAtTest/schema.sql +++ /dev/null @@ -1,13 +0,0 @@ -CREATE TABLE "PROPERTIES"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "UUID" VARCHAR(40), - "PROP_KEY" VARCHAR(512) NOT NULL, - "RESOURCE_ID" BIGINT, - "USER_ID" BIGINT, - "IS_EMPTY" BOOLEAN NOT NULL, - "TEXT_VALUE" VARCHAR(4000), - "CLOB_VALUE" CLOB(2147483647), - "CREATED_AT" BIGINT NOT NULL -); -ALTER TABLE "PROPERTIES" ADD CONSTRAINT "PK_PROPERTIES" PRIMARY KEY("ID"); -CREATE INDEX "PROPERTIES_KEY" ON "PROPERTIES"("PROP_KEY"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/qualitygateconditions/AddPrimaryKeyOnUuidColumnOfQualityGateConditionsTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/qualitygateconditions/AddPrimaryKeyOnUuidColumnOfQualityGateConditionsTableTest/schema.sql deleted file mode 100644 index eb63669fd7e..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/qualitygateconditions/AddPrimaryKeyOnUuidColumnOfQualityGateConditionsTableTest/schema.sql +++ /dev/null @@ -1,12 +0,0 @@ -CREATE TABLE "QUALITY_GATE_CONDITIONS"( - "ID" INTEGER NOT NULL, - "UUID" VARCHAR(40) NOT NULL, - "QGATE_ID" INTEGER, - "METRIC_ID" INTEGER, - "PERIOD" INTEGER, - "OPERATOR" VARCHAR(3), - "VALUE_ERROR" VARCHAR(64), - "VALUE_WARNING" VARCHAR(64), - "CREATED_AT" TIMESTAMP, - "UPDATED_AT" TIMESTAMP -); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/qualitygateconditions/AddUuidColumnToQualityGateConditionsTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/qualitygateconditions/AddUuidColumnToQualityGateConditionsTableTest/schema.sql deleted file mode 100644 index a347b023e66..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/qualitygateconditions/AddUuidColumnToQualityGateConditionsTableTest/schema.sql +++ /dev/null @@ -1,12 +0,0 @@ -CREATE TABLE "QUALITY_GATE_CONDITIONS"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "QGATE_ID" INTEGER, - "METRIC_ID" INTEGER, - "PERIOD" INTEGER, - "OPERATOR" VARCHAR(3), - "VALUE_ERROR" VARCHAR(64), - "VALUE_WARNING" VARCHAR(64), - "CREATED_AT" TIMESTAMP, - "UPDATED_AT" TIMESTAMP -); -ALTER TABLE "QUALITY_GATE_CONDITIONS" ADD CONSTRAINT "PK_QUALITY_GATE_CONDITIONS" PRIMARY KEY("ID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/qualitygateconditions/DropIdColumnOfQualityGateConditionsTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/qualitygateconditions/DropIdColumnOfQualityGateConditionsTableTest/schema.sql deleted file mode 100644 index 68093696c1e..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/qualitygateconditions/DropIdColumnOfQualityGateConditionsTableTest/schema.sql +++ /dev/null @@ -1,13 +0,0 @@ -CREATE TABLE "QUALITY_GATE_CONDITIONS"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "UUID" VARCHAR(40) NOT NULL, - "QGATE_ID" INTEGER, - "METRIC_ID" INTEGER, - "PERIOD" INTEGER, - "OPERATOR" VARCHAR(3), - "VALUE_ERROR" VARCHAR(64), - "VALUE_WARNING" VARCHAR(64), - "CREATED_AT" TIMESTAMP, - "UPDATED_AT" TIMESTAMP -); -ALTER TABLE "QUALITY_GATE_CONDITIONS" ADD CONSTRAINT "PK_QUALITY_GATE_CONDITIONS" PRIMARY KEY("UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/qualitygateconditions/DropPrimaryKeyOnIdColumnOfQualityGateConditionsTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/qualitygateconditions/DropPrimaryKeyOnIdColumnOfQualityGateConditionsTableTest/schema.sql deleted file mode 100644 index 751e993b7ee..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/qualitygateconditions/DropPrimaryKeyOnIdColumnOfQualityGateConditionsTableTest/schema.sql +++ /dev/null @@ -1,13 +0,0 @@ -CREATE TABLE "QUALITY_GATE_CONDITIONS"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "UUID" VARCHAR(40) NOT NULL, - "QGATE_ID" INTEGER, - "METRIC_ID" INTEGER, - "PERIOD" INTEGER, - "OPERATOR" VARCHAR(3), - "VALUE_ERROR" VARCHAR(64), - "VALUE_WARNING" VARCHAR(64), - "CREATED_AT" TIMESTAMP, - "UPDATED_AT" TIMESTAMP -); -ALTER TABLE "QUALITY_GATE_CONDITIONS" ADD CONSTRAINT "PK_QUALITY_GATE_CONDITIONS" PRIMARY KEY("ID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/qualitygateconditions/MakeQualityGateConditionsUuidColumnNotNullableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/qualitygateconditions/MakeQualityGateConditionsUuidColumnNotNullableTest/schema.sql deleted file mode 100644 index dd697725c44..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/qualitygateconditions/MakeQualityGateConditionsUuidColumnNotNullableTest/schema.sql +++ /dev/null @@ -1,12 +0,0 @@ -CREATE TABLE "QUALITY_GATE_CONDITIONS"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "UUID" VARCHAR(40) NOT NULL, - "QGATE_ID" INTEGER, - "METRIC_ID" INTEGER, - "PERIOD" INTEGER, - "OPERATOR" VARCHAR(3), - "VALUE_ERROR" VARCHAR(64), - "VALUE_WARNING" VARCHAR(64), - "CREATED_AT" TIMESTAMP, - "UPDATED_AT" TIMESTAMP -); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/qualitygateconditions/PopulateQualityGateConditionsUuidTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/qualitygateconditions/PopulateQualityGateConditionsUuidTest/schema.sql deleted file mode 100644 index 2f6bb7f50c1..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/qualitygateconditions/PopulateQualityGateConditionsUuidTest/schema.sql +++ /dev/null @@ -1,13 +0,0 @@ -CREATE TABLE "QUALITY_GATE_CONDITIONS"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "UUID" VARCHAR(40), - "QGATE_ID" INTEGER, - "METRIC_ID" INTEGER, - "PERIOD" INTEGER, - "OPERATOR" VARCHAR(3), - "VALUE_ERROR" VARCHAR(64), - "VALUE_WARNING" VARCHAR(64), - "CREATED_AT" TIMESTAMP, - "UPDATED_AT" TIMESTAMP -); -ALTER TABLE "QUALITY_GATE_CONDITIONS" ADD CONSTRAINT "PK_QUALITY_GATE_CONDITIONS" PRIMARY KEY("ID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/qualitygates/AddPrimaryKeyOnUuidColumnOfQGatesTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/qualitygates/AddPrimaryKeyOnUuidColumnOfQGatesTableTest/schema.sql deleted file mode 100644 index 11efefb9936..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/qualitygates/AddPrimaryKeyOnUuidColumnOfQGatesTableTest/schema.sql +++ /dev/null @@ -1,9 +0,0 @@ -CREATE TABLE "QUALITY_GATES"( - "ID" INTEGER NOT NULL, - "UUID" VARCHAR(40) NOT NULL, - "NAME" VARCHAR(100) NOT NULL, - "IS_BUILT_IN" BOOLEAN NOT NULL, - "CREATED_AT" TIMESTAMP, - "UPDATED_AT" TIMESTAMP -); -CREATE UNIQUE INDEX "UNIQ_QUALITY_GATES_UUID" ON "QUALITY_GATES"("UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/qualitygates/AddQGateUuidColumnForQGateConditionsTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/qualitygates/AddQGateUuidColumnForQGateConditionsTest/schema.sql deleted file mode 100644 index 00b6663de81..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/qualitygates/AddQGateUuidColumnForQGateConditionsTest/schema.sql +++ /dev/null @@ -1,23 +0,0 @@ -CREATE TABLE "QUALITY_GATE_CONDITIONS"( - "QGATE_ID" INTEGER, - "METRIC_ID" INTEGER, - "PERIOD" INTEGER, - "OPERATOR" VARCHAR(3), - "VALUE_ERROR" VARCHAR(64), - "VALUE_WARNING" VARCHAR(64), - "CREATED_AT" TIMESTAMP, - "UPDATED_AT" TIMESTAMP, - "UUID" VARCHAR(40) NOT NULL -); -ALTER TABLE "QUALITY_GATE_CONDITIONS" ADD CONSTRAINT "PK_QUALITY_GATE_CONDITIONS" PRIMARY KEY("UUID"); - -CREATE TABLE "QUALITY_GATES"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "UUID" VARCHAR(40) NOT NULL, - "NAME" VARCHAR(100) NOT NULL, - "IS_BUILT_IN" BOOLEAN NOT NULL, - "CREATED_AT" TIMESTAMP, - "UPDATED_AT" TIMESTAMP -); -ALTER TABLE "QUALITY_GATES" ADD CONSTRAINT "PK_QUALITY_GATES" PRIMARY KEY("ID"); -CREATE UNIQUE INDEX "UNIQ_QUALITY_GATES_UUID" ON "QUALITY_GATES"("UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/qualitygates/DropIdColumnOfQGateTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/qualitygates/DropIdColumnOfQGateTableTest/schema.sql deleted file mode 100644 index dfcae5380ea..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/qualitygates/DropIdColumnOfQGateTableTest/schema.sql +++ /dev/null @@ -1,10 +0,0 @@ -CREATE TABLE "QUALITY_GATES"( - "ID" INTEGER NOT NULL, - "UUID" VARCHAR(40) NOT NULL, - "NAME" VARCHAR(100) NOT NULL, - "IS_BUILT_IN" BOOLEAN NOT NULL, - "CREATED_AT" TIMESTAMP, - "UPDATED_AT" TIMESTAMP -); -ALTER TABLE "QUALITY_GATES" ADD CONSTRAINT "PK_QUALITY_GATES" PRIMARY KEY("UUID"); - diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/qualitygates/DropOrphansQGateConditionsTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/qualitygates/DropOrphansQGateConditionsTest/schema.sql deleted file mode 100644 index 497d17eddf5..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/qualitygates/DropOrphansQGateConditionsTest/schema.sql +++ /dev/null @@ -1,24 +0,0 @@ -CREATE TABLE "QUALITY_GATE_CONDITIONS"( - "QGATE_ID" INTEGER, - "QGATE_UUID" VARCHAR(40), - "METRIC_ID" INTEGER, - "PERIOD" INTEGER, - "OPERATOR" VARCHAR(3), - "VALUE_ERROR" VARCHAR(64), - "VALUE_WARNING" VARCHAR(64), - "CREATED_AT" TIMESTAMP, - "UPDATED_AT" TIMESTAMP, - "UUID" VARCHAR(40) NOT NULL -); -ALTER TABLE "QUALITY_GATE_CONDITIONS" ADD CONSTRAINT "PK_QUALITY_GATE_CONDITIONS" PRIMARY KEY("UUID"); - -CREATE TABLE "QUALITY_GATES"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "UUID" VARCHAR(40) NOT NULL, - "NAME" VARCHAR(100) NOT NULL, - "IS_BUILT_IN" BOOLEAN NOT NULL, - "CREATED_AT" TIMESTAMP, - "UPDATED_AT" TIMESTAMP -); -ALTER TABLE "QUALITY_GATES" ADD CONSTRAINT "PK_QUALITY_GATES" PRIMARY KEY("ID"); -CREATE UNIQUE INDEX "UNIQ_QUALITY_GATES_UUID" ON "QUALITY_GATES"("UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/qualitygates/DropPrimaryKeyOnIdColumnOfQGatesTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/qualitygates/DropPrimaryKeyOnIdColumnOfQGatesTableTest/schema.sql deleted file mode 100644 index 5093408fcda..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/qualitygates/DropPrimaryKeyOnIdColumnOfQGatesTableTest/schema.sql +++ /dev/null @@ -1,10 +0,0 @@ -CREATE TABLE "QUALITY_GATES"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "UUID" VARCHAR(40) NOT NULL, - "NAME" VARCHAR(100) NOT NULL, - "IS_BUILT_IN" BOOLEAN NOT NULL, - "CREATED_AT" TIMESTAMP, - "UPDATED_AT" TIMESTAMP -); -ALTER TABLE "QUALITY_GATES" ADD CONSTRAINT "PK_QUALITY_GATES" PRIMARY KEY("ID"); -CREATE UNIQUE INDEX "UNIQ_QUALITY_GATES_UUID" ON "QUALITY_GATES"("UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/qualitygates/DropQGateIdColumnForQGateConditionsTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/qualitygates/DropQGateIdColumnForQGateConditionsTest/schema.sql deleted file mode 100644 index cd2a8e3f853..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/qualitygates/DropQGateIdColumnForQGateConditionsTest/schema.sql +++ /dev/null @@ -1,13 +0,0 @@ -CREATE TABLE "QUALITY_GATE_CONDITIONS"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "QGATE_ID" INTEGER, - "QGATE_UUID" VARCHAR(40) NOT NULL, - "METRIC_ID" INTEGER, - "PERIOD" INTEGER, - "OPERATOR" VARCHAR(3), - "VALUE_ERROR" VARCHAR(64), - "VALUE_WARNING" VARCHAR(64), - "CREATED_AT" TIMESTAMP, - "UPDATED_AT" TIMESTAMP -); -ALTER TABLE "QUALITY_GATE_CONDITIONS" ADD CONSTRAINT "PK_QUALITY_GATE_CONDITIONS" PRIMARY KEY("ID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/qualitygates/DropUniqueIndexOnUuidColumnOfQualityGatesTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/qualitygates/DropUniqueIndexOnUuidColumnOfQualityGatesTableTest/schema.sql deleted file mode 100644 index 11efefb9936..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/qualitygates/DropUniqueIndexOnUuidColumnOfQualityGatesTableTest/schema.sql +++ /dev/null @@ -1,9 +0,0 @@ -CREATE TABLE "QUALITY_GATES"( - "ID" INTEGER NOT NULL, - "UUID" VARCHAR(40) NOT NULL, - "NAME" VARCHAR(100) NOT NULL, - "IS_BUILT_IN" BOOLEAN NOT NULL, - "CREATED_AT" TIMESTAMP, - "UPDATED_AT" TIMESTAMP -); -CREATE UNIQUE INDEX "UNIQ_QUALITY_GATES_UUID" ON "QUALITY_GATES"("UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/qualitygates/MakeQGateUuidColumnNotNullableForQGateConditionsTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/qualitygates/MakeQGateUuidColumnNotNullableForQGateConditionsTest/schema.sql deleted file mode 100644 index 5fc71ff5b95..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/qualitygates/MakeQGateUuidColumnNotNullableForQGateConditionsTest/schema.sql +++ /dev/null @@ -1,13 +0,0 @@ -CREATE TABLE "QUALITY_GATE_CONDITIONS"( - "QGATE_ID" INTEGER, - "QGATE_UUID" VARCHAR(40), - "METRIC_ID" INTEGER, - "PERIOD" INTEGER, - "OPERATOR" VARCHAR(3), - "VALUE_ERROR" VARCHAR(64), - "VALUE_WARNING" VARCHAR(64), - "CREATED_AT" TIMESTAMP, - "UPDATED_AT" TIMESTAMP, - "UUID" VARCHAR(40) NOT NULL -); -ALTER TABLE "QUALITY_GATE_CONDITIONS" ADD CONSTRAINT "PK_QUALITY_GATE_CONDITIONS" PRIMARY KEY("UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/qualitygates/PopulateQGateUuidColumnForQGateConditionsTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/qualitygates/PopulateQGateUuidColumnForQGateConditionsTest/schema.sql deleted file mode 100644 index 497d17eddf5..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/qualitygates/PopulateQGateUuidColumnForQGateConditionsTest/schema.sql +++ /dev/null @@ -1,24 +0,0 @@ -CREATE TABLE "QUALITY_GATE_CONDITIONS"( - "QGATE_ID" INTEGER, - "QGATE_UUID" VARCHAR(40), - "METRIC_ID" INTEGER, - "PERIOD" INTEGER, - "OPERATOR" VARCHAR(3), - "VALUE_ERROR" VARCHAR(64), - "VALUE_WARNING" VARCHAR(64), - "CREATED_AT" TIMESTAMP, - "UPDATED_AT" TIMESTAMP, - "UUID" VARCHAR(40) NOT NULL -); -ALTER TABLE "QUALITY_GATE_CONDITIONS" ADD CONSTRAINT "PK_QUALITY_GATE_CONDITIONS" PRIMARY KEY("UUID"); - -CREATE TABLE "QUALITY_GATES"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "UUID" VARCHAR(40) NOT NULL, - "NAME" VARCHAR(100) NOT NULL, - "IS_BUILT_IN" BOOLEAN NOT NULL, - "CREATED_AT" TIMESTAMP, - "UPDATED_AT" TIMESTAMP -); -ALTER TABLE "QUALITY_GATES" ADD CONSTRAINT "PK_QUALITY_GATES" PRIMARY KEY("ID"); -CREATE UNIQUE INDEX "UNIQ_QUALITY_GATES_UUID" ON "QUALITY_GATES"("UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/AddPrimaryKeyOnUuidColumnOfRulesTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/AddPrimaryKeyOnUuidColumnOfRulesTableTest/schema.sql deleted file mode 100644 index df25471a0ba..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/AddPrimaryKeyOnUuidColumnOfRulesTableTest/schema.sql +++ /dev/null @@ -1,29 +0,0 @@ -CREATE TABLE "RULES"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "NAME" VARCHAR(200), - "PLUGIN_RULE_KEY" VARCHAR(200) NOT NULL, - "PLUGIN_KEY" VARCHAR(200), - "PLUGIN_CONFIG_KEY" VARCHAR(200), - "PLUGIN_NAME" VARCHAR(255) NOT NULL, - "SCOPE" VARCHAR(20) NOT NULL, - "DESCRIPTION" CLOB(2147483647), - "PRIORITY" INTEGER, - "STATUS" VARCHAR(40), - "LANGUAGE" VARCHAR(20), - "DEF_REMEDIATION_FUNCTION" VARCHAR(20), - "DEF_REMEDIATION_GAP_MULT" VARCHAR(20), - "DEF_REMEDIATION_BASE_EFFORT" VARCHAR(20), - "GAP_DESCRIPTION" VARCHAR(4000), - "SYSTEM_TAGS" VARCHAR(4000), - "IS_TEMPLATE" BOOLEAN DEFAULT FALSE NOT NULL, - "DESCRIPTION_FORMAT" VARCHAR(20), - "RULE_TYPE" TINYINT, - "SECURITY_STANDARDS" VARCHAR(4000), - "IS_AD_HOC" BOOLEAN NOT NULL, - "IS_EXTERNAL" BOOLEAN NOT NULL, - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT, - "UUID" VARCHAR(40) NOT NULL, - "TEMPLATE_UUID" VARCHAR(40) -); -CREATE UNIQUE INDEX "RULES_REPO_KEY" ON "RULES"("PLUGIN_RULE_KEY", "PLUGIN_NAME"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/AddUuidAndTemplateUuidColumnsToRulesTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/AddUuidAndTemplateUuidColumnsToRulesTest/schema.sql deleted file mode 100644 index 66e55fb1b3f..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/AddUuidAndTemplateUuidColumnsToRulesTest/schema.sql +++ /dev/null @@ -1,29 +0,0 @@ -CREATE TABLE "RULES"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "NAME" VARCHAR(200), - "PLUGIN_RULE_KEY" VARCHAR(200) NOT NULL, - "PLUGIN_KEY" VARCHAR(200), - "PLUGIN_CONFIG_KEY" VARCHAR(200), - "PLUGIN_NAME" VARCHAR(255) NOT NULL, - "SCOPE" VARCHAR(20) NOT NULL, - "DESCRIPTION" CLOB(2147483647), - "PRIORITY" INTEGER, - "TEMPLATE_ID" INTEGER, - "STATUS" VARCHAR(40), - "LANGUAGE" VARCHAR(20), - "DEF_REMEDIATION_FUNCTION" VARCHAR(20), - "DEF_REMEDIATION_GAP_MULT" VARCHAR(20), - "DEF_REMEDIATION_BASE_EFFORT" VARCHAR(20), - "GAP_DESCRIPTION" VARCHAR(4000), - "SYSTEM_TAGS" VARCHAR(4000), - "IS_TEMPLATE" BOOLEAN DEFAULT FALSE NOT NULL, - "DESCRIPTION_FORMAT" VARCHAR(20), - "RULE_TYPE" TINYINT, - "SECURITY_STANDARDS" VARCHAR(4000), - "IS_AD_HOC" BOOLEAN NOT NULL, - "IS_EXTERNAL" BOOLEAN NOT NULL, - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT -); -ALTER TABLE "RULES" ADD CONSTRAINT "PK_RULES" PRIMARY KEY("ID"); -CREATE UNIQUE INDEX "RULES_REPO_KEY" ON "RULES"("PLUGIN_RULE_KEY", "PLUGIN_NAME"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/DropIdColumnOfRulesTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/DropIdColumnOfRulesTableTest/schema.sql deleted file mode 100644 index 4045c3e578a..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/DropIdColumnOfRulesTableTest/schema.sql +++ /dev/null @@ -1,30 +0,0 @@ -CREATE TABLE "RULES"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "NAME" VARCHAR(200), - "PLUGIN_RULE_KEY" VARCHAR(200) NOT NULL, - "PLUGIN_KEY" VARCHAR(200), - "PLUGIN_CONFIG_KEY" VARCHAR(200), - "PLUGIN_NAME" VARCHAR(255) NOT NULL, - "SCOPE" VARCHAR(20) NOT NULL, - "DESCRIPTION" CLOB(2147483647), - "PRIORITY" INTEGER, - "STATUS" VARCHAR(40), - "LANGUAGE" VARCHAR(20), - "DEF_REMEDIATION_FUNCTION" VARCHAR(20), - "DEF_REMEDIATION_GAP_MULT" VARCHAR(20), - "DEF_REMEDIATION_BASE_EFFORT" VARCHAR(20), - "GAP_DESCRIPTION" VARCHAR(4000), - "SYSTEM_TAGS" VARCHAR(4000), - "IS_TEMPLATE" BOOLEAN DEFAULT FALSE NOT NULL, - "DESCRIPTION_FORMAT" VARCHAR(20), - "RULE_TYPE" TINYINT, - "SECURITY_STANDARDS" VARCHAR(4000), - "IS_AD_HOC" BOOLEAN NOT NULL, - "IS_EXTERNAL" BOOLEAN NOT NULL, - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT, - "UUID" VARCHAR(40) NOT NULL, - "TEMPLATE_UUID" VARCHAR(40) -); -ALTER TABLE "RULES" ADD CONSTRAINT "PK_RULES" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "RULES_REPO_KEY" ON "RULES"("PLUGIN_RULE_KEY", "PLUGIN_NAME"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/DropPrimaryKeyOnIdColumnOfRulesTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/DropPrimaryKeyOnIdColumnOfRulesTableTest/schema.sql deleted file mode 100644 index 04dc8de79c8..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/DropPrimaryKeyOnIdColumnOfRulesTableTest/schema.sql +++ /dev/null @@ -1,30 +0,0 @@ -CREATE TABLE "RULES"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "NAME" VARCHAR(200), - "PLUGIN_RULE_KEY" VARCHAR(200) NOT NULL, - "PLUGIN_KEY" VARCHAR(200), - "PLUGIN_CONFIG_KEY" VARCHAR(200), - "PLUGIN_NAME" VARCHAR(255) NOT NULL, - "SCOPE" VARCHAR(20) NOT NULL, - "DESCRIPTION" CLOB(2147483647), - "PRIORITY" INTEGER, - "STATUS" VARCHAR(40), - "LANGUAGE" VARCHAR(20), - "DEF_REMEDIATION_FUNCTION" VARCHAR(20), - "DEF_REMEDIATION_GAP_MULT" VARCHAR(20), - "DEF_REMEDIATION_BASE_EFFORT" VARCHAR(20), - "GAP_DESCRIPTION" VARCHAR(4000), - "SYSTEM_TAGS" VARCHAR(4000), - "IS_TEMPLATE" BOOLEAN DEFAULT FALSE NOT NULL, - "DESCRIPTION_FORMAT" VARCHAR(20), - "RULE_TYPE" TINYINT, - "SECURITY_STANDARDS" VARCHAR(4000), - "IS_AD_HOC" BOOLEAN NOT NULL, - "IS_EXTERNAL" BOOLEAN NOT NULL, - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT, - "UUID" VARCHAR(40) NOT NULL, - "TEMPLATE_UUID" VARCHAR(40) -); -ALTER TABLE "RULES" ADD CONSTRAINT "PK_RULES" PRIMARY KEY("ID"); -CREATE UNIQUE INDEX "RULES_REPO_KEY" ON "RULES"("PLUGIN_RULE_KEY", "PLUGIN_NAME"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/DropTemplateIdColumnOfRulesTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/DropTemplateIdColumnOfRulesTableTest/schema.sql deleted file mode 100644 index ee19fb605ea..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/DropTemplateIdColumnOfRulesTableTest/schema.sql +++ /dev/null @@ -1,31 +0,0 @@ -CREATE TABLE "RULES"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "NAME" VARCHAR(200), - "PLUGIN_RULE_KEY" VARCHAR(200) NOT NULL, - "PLUGIN_KEY" VARCHAR(200), - "PLUGIN_CONFIG_KEY" VARCHAR(200), - "PLUGIN_NAME" VARCHAR(255) NOT NULL, - "SCOPE" VARCHAR(20) NOT NULL, - "DESCRIPTION" CLOB(2147483647), - "PRIORITY" INTEGER, - "TEMPLATE_ID" INTEGER, - "STATUS" VARCHAR(40), - "LANGUAGE" VARCHAR(20), - "DEF_REMEDIATION_FUNCTION" VARCHAR(20), - "DEF_REMEDIATION_GAP_MULT" VARCHAR(20), - "DEF_REMEDIATION_BASE_EFFORT" VARCHAR(20), - "GAP_DESCRIPTION" VARCHAR(4000), - "SYSTEM_TAGS" VARCHAR(4000), - "IS_TEMPLATE" BOOLEAN DEFAULT FALSE NOT NULL, - "DESCRIPTION_FORMAT" VARCHAR(20), - "RULE_TYPE" TINYINT, - "SECURITY_STANDARDS" VARCHAR(4000), - "IS_AD_HOC" BOOLEAN NOT NULL, - "IS_EXTERNAL" BOOLEAN NOT NULL, - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT, - "UUID" VARCHAR(40) NOT NULL, - "TEMPLATE_UUID" VARCHAR(40) -); -ALTER TABLE "RULES" ADD CONSTRAINT "PK_RULES" PRIMARY KEY("ID"); -CREATE UNIQUE INDEX "RULES_REPO_KEY" ON "RULES"("PLUGIN_RULE_KEY", "PLUGIN_NAME"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/MakeRulesUuidColumnNotNullableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/MakeRulesUuidColumnNotNullableTest/schema.sql deleted file mode 100644 index e2d578ae008..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/MakeRulesUuidColumnNotNullableTest/schema.sql +++ /dev/null @@ -1,31 +0,0 @@ -CREATE TABLE "RULES"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "NAME" VARCHAR(200), - "PLUGIN_RULE_KEY" VARCHAR(200) NOT NULL, - "PLUGIN_KEY" VARCHAR(200), - "PLUGIN_CONFIG_KEY" VARCHAR(200), - "PLUGIN_NAME" VARCHAR(255) NOT NULL, - "SCOPE" VARCHAR(20) NOT NULL, - "DESCRIPTION" CLOB(2147483647), - "PRIORITY" INTEGER, - "TEMPLATE_ID" INTEGER, - "STATUS" VARCHAR(40), - "LANGUAGE" VARCHAR(20), - "DEF_REMEDIATION_FUNCTION" VARCHAR(20), - "DEF_REMEDIATION_GAP_MULT" VARCHAR(20), - "DEF_REMEDIATION_BASE_EFFORT" VARCHAR(20), - "GAP_DESCRIPTION" VARCHAR(4000), - "SYSTEM_TAGS" VARCHAR(4000), - "IS_TEMPLATE" BOOLEAN DEFAULT FALSE NOT NULL, - "DESCRIPTION_FORMAT" VARCHAR(20), - "RULE_TYPE" TINYINT, - "SECURITY_STANDARDS" VARCHAR(4000), - "IS_AD_HOC" BOOLEAN NOT NULL, - "IS_EXTERNAL" BOOLEAN NOT NULL, - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT, - "UUID" VARCHAR(40), - "TEMPLATE_UUID" VARCHAR(40) -); -ALTER TABLE "RULES" ADD CONSTRAINT "PK_RULES" PRIMARY KEY("ID"); -CREATE UNIQUE INDEX "RULES_REPO_KEY" ON "RULES"("PLUGIN_RULE_KEY", "PLUGIN_NAME"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/PopulateRulesTemplateUuidTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/PopulateRulesTemplateUuidTest/schema.sql deleted file mode 100644 index ee19fb605ea..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/PopulateRulesTemplateUuidTest/schema.sql +++ /dev/null @@ -1,31 +0,0 @@ -CREATE TABLE "RULES"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "NAME" VARCHAR(200), - "PLUGIN_RULE_KEY" VARCHAR(200) NOT NULL, - "PLUGIN_KEY" VARCHAR(200), - "PLUGIN_CONFIG_KEY" VARCHAR(200), - "PLUGIN_NAME" VARCHAR(255) NOT NULL, - "SCOPE" VARCHAR(20) NOT NULL, - "DESCRIPTION" CLOB(2147483647), - "PRIORITY" INTEGER, - "TEMPLATE_ID" INTEGER, - "STATUS" VARCHAR(40), - "LANGUAGE" VARCHAR(20), - "DEF_REMEDIATION_FUNCTION" VARCHAR(20), - "DEF_REMEDIATION_GAP_MULT" VARCHAR(20), - "DEF_REMEDIATION_BASE_EFFORT" VARCHAR(20), - "GAP_DESCRIPTION" VARCHAR(4000), - "SYSTEM_TAGS" VARCHAR(4000), - "IS_TEMPLATE" BOOLEAN DEFAULT FALSE NOT NULL, - "DESCRIPTION_FORMAT" VARCHAR(20), - "RULE_TYPE" TINYINT, - "SECURITY_STANDARDS" VARCHAR(4000), - "IS_AD_HOC" BOOLEAN NOT NULL, - "IS_EXTERNAL" BOOLEAN NOT NULL, - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT, - "UUID" VARCHAR(40) NOT NULL, - "TEMPLATE_UUID" VARCHAR(40) -); -ALTER TABLE "RULES" ADD CONSTRAINT "PK_RULES" PRIMARY KEY("ID"); -CREATE UNIQUE INDEX "RULES_REPO_KEY" ON "RULES"("PLUGIN_RULE_KEY", "PLUGIN_NAME"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/PopulateRulesUuidTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/PopulateRulesUuidTest/schema.sql deleted file mode 100644 index e2d578ae008..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/PopulateRulesUuidTest/schema.sql +++ /dev/null @@ -1,31 +0,0 @@ -CREATE TABLE "RULES"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "NAME" VARCHAR(200), - "PLUGIN_RULE_KEY" VARCHAR(200) NOT NULL, - "PLUGIN_KEY" VARCHAR(200), - "PLUGIN_CONFIG_KEY" VARCHAR(200), - "PLUGIN_NAME" VARCHAR(255) NOT NULL, - "SCOPE" VARCHAR(20) NOT NULL, - "DESCRIPTION" CLOB(2147483647), - "PRIORITY" INTEGER, - "TEMPLATE_ID" INTEGER, - "STATUS" VARCHAR(40), - "LANGUAGE" VARCHAR(20), - "DEF_REMEDIATION_FUNCTION" VARCHAR(20), - "DEF_REMEDIATION_GAP_MULT" VARCHAR(20), - "DEF_REMEDIATION_BASE_EFFORT" VARCHAR(20), - "GAP_DESCRIPTION" VARCHAR(4000), - "SYSTEM_TAGS" VARCHAR(4000), - "IS_TEMPLATE" BOOLEAN DEFAULT FALSE NOT NULL, - "DESCRIPTION_FORMAT" VARCHAR(20), - "RULE_TYPE" TINYINT, - "SECURITY_STANDARDS" VARCHAR(4000), - "IS_AD_HOC" BOOLEAN NOT NULL, - "IS_EXTERNAL" BOOLEAN NOT NULL, - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT, - "UUID" VARCHAR(40), - "TEMPLATE_UUID" VARCHAR(40) -); -ALTER TABLE "RULES" ADD CONSTRAINT "PK_RULES" PRIMARY KEY("ID"); -CREATE UNIQUE INDEX "RULES_REPO_KEY" ON "RULES"("PLUGIN_RULE_KEY", "PLUGIN_NAME"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/activerules/AddIndexToActiveRulesTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/activerules/AddIndexToActiveRulesTableTest/schema.sql deleted file mode 100644 index b3b1b4d7c04..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/activerules/AddIndexToActiveRulesTableTest/schema.sql +++ /dev/null @@ -1,42 +0,0 @@ -CREATE TABLE "RULES"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "NAME" VARCHAR(200), - "PLUGIN_RULE_KEY" VARCHAR(200) NOT NULL, - "PLUGIN_KEY" VARCHAR(200), - "PLUGIN_CONFIG_KEY" VARCHAR(200), - "PLUGIN_NAME" VARCHAR(255) NOT NULL, - "SCOPE" VARCHAR(20) NOT NULL, - "DESCRIPTION" CLOB(2147483647), - "PRIORITY" INTEGER, - "STATUS" VARCHAR(40), - "LANGUAGE" VARCHAR(20), - "DEF_REMEDIATION_FUNCTION" VARCHAR(20), - "DEF_REMEDIATION_GAP_MULT" VARCHAR(20), - "DEF_REMEDIATION_BASE_EFFORT" VARCHAR(20), - "GAP_DESCRIPTION" VARCHAR(4000), - "SYSTEM_TAGS" VARCHAR(4000), - "IS_TEMPLATE" BOOLEAN DEFAULT FALSE NOT NULL, - "DESCRIPTION_FORMAT" VARCHAR(20), - "RULE_TYPE" TINYINT, - "SECURITY_STANDARDS" VARCHAR(4000), - "IS_AD_HOC" BOOLEAN NOT NULL, - "IS_EXTERNAL" BOOLEAN NOT NULL, - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT, - "UUID" VARCHAR(40) NOT NULL, - "TEMPLATE_UUID" VARCHAR(40) -); -ALTER TABLE "RULES" ADD CONSTRAINT "PK_RULES" PRIMARY KEY("ID"); -CREATE UNIQUE INDEX "RULES_REPO_KEY" ON "RULES"("PLUGIN_RULE_KEY", "PLUGIN_NAME"); - -CREATE TABLE "ACTIVE_RULES"( - "RULE_ID" INTEGER NOT NULL, - "FAILURE_LEVEL" INTEGER NOT NULL, - "INHERITANCE" VARCHAR(10), - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT, - "UUID" VARCHAR(40) NOT NULL, - "PROFILE_UUID" VARCHAR(40) NOT NULL, - "RULE_UUID" VARCHAR(40) NOT NULL -); -ALTER TABLE "ACTIVE_RULES" ADD CONSTRAINT "PK_ACTIVE_RULES" PRIMARY KEY("UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/activerules/AddRuleUuidColumnToActiveRulesTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/activerules/AddRuleUuidColumnToActiveRulesTableTest/schema.sql deleted file mode 100644 index d05e47d8bc5..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/activerules/AddRuleUuidColumnToActiveRulesTableTest/schema.sql +++ /dev/null @@ -1,42 +0,0 @@ -CREATE TABLE "RULES"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "NAME" VARCHAR(200), - "PLUGIN_RULE_KEY" VARCHAR(200) NOT NULL, - "PLUGIN_KEY" VARCHAR(200), - "PLUGIN_CONFIG_KEY" VARCHAR(200), - "PLUGIN_NAME" VARCHAR(255) NOT NULL, - "SCOPE" VARCHAR(20) NOT NULL, - "DESCRIPTION" CLOB(2147483647), - "PRIORITY" INTEGER, - "STATUS" VARCHAR(40), - "LANGUAGE" VARCHAR(20), - "DEF_REMEDIATION_FUNCTION" VARCHAR(20), - "DEF_REMEDIATION_GAP_MULT" VARCHAR(20), - "DEF_REMEDIATION_BASE_EFFORT" VARCHAR(20), - "GAP_DESCRIPTION" VARCHAR(4000), - "SYSTEM_TAGS" VARCHAR(4000), - "IS_TEMPLATE" BOOLEAN DEFAULT FALSE NOT NULL, - "DESCRIPTION_FORMAT" VARCHAR(20), - "RULE_TYPE" TINYINT, - "SECURITY_STANDARDS" VARCHAR(4000), - "IS_AD_HOC" BOOLEAN NOT NULL, - "IS_EXTERNAL" BOOLEAN NOT NULL, - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT, - "UUID" VARCHAR(40) NOT NULL, - "TEMPLATE_UUID" VARCHAR(40) -); -ALTER TABLE "RULES" ADD CONSTRAINT "PK_RULES" PRIMARY KEY("ID"); -CREATE UNIQUE INDEX "RULES_REPO_KEY" ON "RULES"("PLUGIN_RULE_KEY", "PLUGIN_NAME"); - -CREATE TABLE "ACTIVE_RULES"( - "RULE_ID" INTEGER NOT NULL, - "FAILURE_LEVEL" INTEGER NOT NULL, - "INHERITANCE" VARCHAR(10), - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT, - "UUID" VARCHAR(40) NOT NULL, - "PROFILE_UUID" VARCHAR(40) NOT NULL -); -ALTER TABLE "ACTIVE_RULES" ADD CONSTRAINT "PK_ACTIVE_RULES" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "UNIQ_PROFILE_RULE_IDS" ON "ACTIVE_RULES"("PROFILE_UUID", "RULE_ID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/activerules/DropIndexOnRuleIdColumnOfActiveRulesTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/activerules/DropIndexOnRuleIdColumnOfActiveRulesTableTest/schema.sql deleted file mode 100644 index 9156127c902..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/activerules/DropIndexOnRuleIdColumnOfActiveRulesTableTest/schema.sql +++ /dev/null @@ -1,43 +0,0 @@ -CREATE TABLE "RULES"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "NAME" VARCHAR(200), - "PLUGIN_RULE_KEY" VARCHAR(200) NOT NULL, - "PLUGIN_KEY" VARCHAR(200), - "PLUGIN_CONFIG_KEY" VARCHAR(200), - "PLUGIN_NAME" VARCHAR(255) NOT NULL, - "SCOPE" VARCHAR(20) NOT NULL, - "DESCRIPTION" CLOB(2147483647), - "PRIORITY" INTEGER, - "STATUS" VARCHAR(40), - "LANGUAGE" VARCHAR(20), - "DEF_REMEDIATION_FUNCTION" VARCHAR(20), - "DEF_REMEDIATION_GAP_MULT" VARCHAR(20), - "DEF_REMEDIATION_BASE_EFFORT" VARCHAR(20), - "GAP_DESCRIPTION" VARCHAR(4000), - "SYSTEM_TAGS" VARCHAR(4000), - "IS_TEMPLATE" BOOLEAN DEFAULT FALSE NOT NULL, - "DESCRIPTION_FORMAT" VARCHAR(20), - "RULE_TYPE" TINYINT, - "SECURITY_STANDARDS" VARCHAR(4000), - "IS_AD_HOC" BOOLEAN NOT NULL, - "IS_EXTERNAL" BOOLEAN NOT NULL, - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT, - "UUID" VARCHAR(40) NOT NULL, - "TEMPLATE_UUID" VARCHAR(40) -); -ALTER TABLE "RULES" ADD CONSTRAINT "PK_RULES" PRIMARY KEY("ID"); -CREATE UNIQUE INDEX "RULES_REPO_KEY" ON "RULES"("PLUGIN_RULE_KEY", "PLUGIN_NAME"); - -CREATE TABLE "ACTIVE_RULES"( - "RULE_ID" INTEGER NOT NULL, - "FAILURE_LEVEL" INTEGER NOT NULL, - "INHERITANCE" VARCHAR(10), - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT, - "UUID" VARCHAR(40) NOT NULL, - "PROFILE_UUID" VARCHAR(40) NOT NULL, - "RULE_UUID" VARCHAR(40) NOT NULL -); -ALTER TABLE "ACTIVE_RULES" ADD CONSTRAINT "PK_ACTIVE_RULES" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "UNIQ_PROFILE_RULE_IDS" ON "ACTIVE_RULES"("PROFILE_UUID", "RULE_ID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/activerules/DropRuleIdColumnOfActiveRulesTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/activerules/DropRuleIdColumnOfActiveRulesTableTest/schema.sql deleted file mode 100644 index d786db82af6..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/activerules/DropRuleIdColumnOfActiveRulesTableTest/schema.sql +++ /dev/null @@ -1,43 +0,0 @@ -CREATE TABLE "RULES"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "NAME" VARCHAR(200), - "PLUGIN_RULE_KEY" VARCHAR(200) NOT NULL, - "PLUGIN_KEY" VARCHAR(200), - "PLUGIN_CONFIG_KEY" VARCHAR(200), - "PLUGIN_NAME" VARCHAR(255) NOT NULL, - "SCOPE" VARCHAR(20) NOT NULL, - "DESCRIPTION" CLOB(2147483647), - "PRIORITY" INTEGER, - "STATUS" VARCHAR(40), - "LANGUAGE" VARCHAR(20), - "DEF_REMEDIATION_FUNCTION" VARCHAR(20), - "DEF_REMEDIATION_GAP_MULT" VARCHAR(20), - "DEF_REMEDIATION_BASE_EFFORT" VARCHAR(20), - "GAP_DESCRIPTION" VARCHAR(4000), - "SYSTEM_TAGS" VARCHAR(4000), - "IS_TEMPLATE" BOOLEAN DEFAULT FALSE NOT NULL, - "DESCRIPTION_FORMAT" VARCHAR(20), - "RULE_TYPE" TINYINT, - "SECURITY_STANDARDS" VARCHAR(4000), - "IS_AD_HOC" BOOLEAN NOT NULL, - "IS_EXTERNAL" BOOLEAN NOT NULL, - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT, - "UUID" VARCHAR(40) NOT NULL, - "TEMPLATE_UUID" VARCHAR(40) -); -ALTER TABLE "RULES" ADD CONSTRAINT "PK_RULES" PRIMARY KEY("ID"); -CREATE UNIQUE INDEX "RULES_REPO_KEY" ON "RULES"("PLUGIN_RULE_KEY", "PLUGIN_NAME"); - -CREATE TABLE "ACTIVE_RULES"( - "RULE_ID" INTEGER NOT NULL, - "FAILURE_LEVEL" INTEGER NOT NULL, - "INHERITANCE" VARCHAR(10), - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT, - "UUID" VARCHAR(40) NOT NULL, - "PROFILE_UUID" VARCHAR(40) NOT NULL, - "RULE_UUID" VARCHAR(40) NOT NULL -); -ALTER TABLE "ACTIVE_RULES" ADD CONSTRAINT "PK_ACTIVE_RULES" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "UNIQ_PROFILE_RULE_UUIDS" ON "ACTIVE_RULES"("PROFILE_UUID", "RULE_UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/activerules/MakeActiveRulesRuleUuidColumnNotNullableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/activerules/MakeActiveRulesRuleUuidColumnNotNullableTest/schema.sql deleted file mode 100644 index ac68fc9c530..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/activerules/MakeActiveRulesRuleUuidColumnNotNullableTest/schema.sql +++ /dev/null @@ -1,43 +0,0 @@ -CREATE TABLE "RULES"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "NAME" VARCHAR(200), - "PLUGIN_RULE_KEY" VARCHAR(200) NOT NULL, - "PLUGIN_KEY" VARCHAR(200), - "PLUGIN_CONFIG_KEY" VARCHAR(200), - "PLUGIN_NAME" VARCHAR(255) NOT NULL, - "SCOPE" VARCHAR(20) NOT NULL, - "DESCRIPTION" CLOB(2147483647), - "PRIORITY" INTEGER, - "STATUS" VARCHAR(40), - "LANGUAGE" VARCHAR(20), - "DEF_REMEDIATION_FUNCTION" VARCHAR(20), - "DEF_REMEDIATION_GAP_MULT" VARCHAR(20), - "DEF_REMEDIATION_BASE_EFFORT" VARCHAR(20), - "GAP_DESCRIPTION" VARCHAR(4000), - "SYSTEM_TAGS" VARCHAR(4000), - "IS_TEMPLATE" BOOLEAN DEFAULT FALSE NOT NULL, - "DESCRIPTION_FORMAT" VARCHAR(20), - "RULE_TYPE" TINYINT, - "SECURITY_STANDARDS" VARCHAR(4000), - "IS_AD_HOC" BOOLEAN NOT NULL, - "IS_EXTERNAL" BOOLEAN NOT NULL, - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT, - "UUID" VARCHAR(40) NOT NULL, - "TEMPLATE_UUID" VARCHAR(40) -); -ALTER TABLE "RULES" ADD CONSTRAINT "PK_RULES" PRIMARY KEY("ID"); -CREATE UNIQUE INDEX "RULES_REPO_KEY" ON "RULES"("PLUGIN_RULE_KEY", "PLUGIN_NAME"); - -CREATE TABLE "ACTIVE_RULES"( - "RULE_ID" INTEGER NOT NULL, - "FAILURE_LEVEL" INTEGER NOT NULL, - "INHERITANCE" VARCHAR(10), - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT, - "UUID" VARCHAR(40) NOT NULL, - "PROFILE_UUID" VARCHAR(40) NOT NULL, - "RULE_UUID" VARCHAR(40) -); -ALTER TABLE "ACTIVE_RULES" ADD CONSTRAINT "PK_ACTIVE_RULES" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "UNIQ_PROFILE_RULE_IDS" ON "ACTIVE_RULES"("PROFILE_UUID", "RULE_ID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/activerules/PopulateActiveRulesRuleUuidColumnTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/activerules/PopulateActiveRulesRuleUuidColumnTest/schema.sql deleted file mode 100644 index ac68fc9c530..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/activerules/PopulateActiveRulesRuleUuidColumnTest/schema.sql +++ /dev/null @@ -1,43 +0,0 @@ -CREATE TABLE "RULES"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "NAME" VARCHAR(200), - "PLUGIN_RULE_KEY" VARCHAR(200) NOT NULL, - "PLUGIN_KEY" VARCHAR(200), - "PLUGIN_CONFIG_KEY" VARCHAR(200), - "PLUGIN_NAME" VARCHAR(255) NOT NULL, - "SCOPE" VARCHAR(20) NOT NULL, - "DESCRIPTION" CLOB(2147483647), - "PRIORITY" INTEGER, - "STATUS" VARCHAR(40), - "LANGUAGE" VARCHAR(20), - "DEF_REMEDIATION_FUNCTION" VARCHAR(20), - "DEF_REMEDIATION_GAP_MULT" VARCHAR(20), - "DEF_REMEDIATION_BASE_EFFORT" VARCHAR(20), - "GAP_DESCRIPTION" VARCHAR(4000), - "SYSTEM_TAGS" VARCHAR(4000), - "IS_TEMPLATE" BOOLEAN DEFAULT FALSE NOT NULL, - "DESCRIPTION_FORMAT" VARCHAR(20), - "RULE_TYPE" TINYINT, - "SECURITY_STANDARDS" VARCHAR(4000), - "IS_AD_HOC" BOOLEAN NOT NULL, - "IS_EXTERNAL" BOOLEAN NOT NULL, - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT, - "UUID" VARCHAR(40) NOT NULL, - "TEMPLATE_UUID" VARCHAR(40) -); -ALTER TABLE "RULES" ADD CONSTRAINT "PK_RULES" PRIMARY KEY("ID"); -CREATE UNIQUE INDEX "RULES_REPO_KEY" ON "RULES"("PLUGIN_RULE_KEY", "PLUGIN_NAME"); - -CREATE TABLE "ACTIVE_RULES"( - "RULE_ID" INTEGER NOT NULL, - "FAILURE_LEVEL" INTEGER NOT NULL, - "INHERITANCE" VARCHAR(10), - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT, - "UUID" VARCHAR(40) NOT NULL, - "PROFILE_UUID" VARCHAR(40) NOT NULL, - "RULE_UUID" VARCHAR(40) -); -ALTER TABLE "ACTIVE_RULES" ADD CONSTRAINT "PK_ACTIVE_RULES" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "UNIQ_PROFILE_RULE_IDS" ON "ACTIVE_RULES"("PROFILE_UUID", "RULE_ID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/deprecatedrulekeys/AddIndexToDeprecatedRuleKeysTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/deprecatedrulekeys/AddIndexToDeprecatedRuleKeysTableTest/schema.sql deleted file mode 100644 index 7d99e6c84e9..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/deprecatedrulekeys/AddIndexToDeprecatedRuleKeysTableTest/schema.sql +++ /dev/null @@ -1,41 +0,0 @@ -CREATE TABLE "RULES"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "NAME" VARCHAR(200), - "PLUGIN_RULE_KEY" VARCHAR(200) NOT NULL, - "PLUGIN_KEY" VARCHAR(200), - "PLUGIN_CONFIG_KEY" VARCHAR(200), - "PLUGIN_NAME" VARCHAR(255) NOT NULL, - "SCOPE" VARCHAR(20) NOT NULL, - "DESCRIPTION" CLOB(2147483647), - "PRIORITY" INTEGER, - "STATUS" VARCHAR(40), - "LANGUAGE" VARCHAR(20), - "DEF_REMEDIATION_FUNCTION" VARCHAR(20), - "DEF_REMEDIATION_GAP_MULT" VARCHAR(20), - "DEF_REMEDIATION_BASE_EFFORT" VARCHAR(20), - "GAP_DESCRIPTION" VARCHAR(4000), - "SYSTEM_TAGS" VARCHAR(4000), - "IS_TEMPLATE" BOOLEAN DEFAULT FALSE NOT NULL, - "DESCRIPTION_FORMAT" VARCHAR(20), - "RULE_TYPE" TINYINT, - "SECURITY_STANDARDS" VARCHAR(4000), - "IS_AD_HOC" BOOLEAN NOT NULL, - "IS_EXTERNAL" BOOLEAN NOT NULL, - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT, - "UUID" VARCHAR(40) NOT NULL, - "TEMPLATE_UUID" VARCHAR(40) -); -ALTER TABLE "RULES" ADD CONSTRAINT "PK_RULES" PRIMARY KEY("ID"); -CREATE UNIQUE INDEX "RULES_REPO_KEY" ON "RULES"("PLUGIN_RULE_KEY", "PLUGIN_NAME"); - -CREATE TABLE "DEPRECATED_RULE_KEYS"( - "UUID" VARCHAR(40) NOT NULL, - "RULE_ID" INTEGER NOT NULL, - "OLD_REPOSITORY_KEY" VARCHAR(255) NOT NULL, - "OLD_RULE_KEY" VARCHAR(200) NOT NULL, - "CREATED_AT" BIGINT NOT NULL, - "RULE_UUID" VARCHAR(40) NOT NULL -); -ALTER TABLE "DEPRECATED_RULE_KEYS" ADD CONSTRAINT "PK_DEPRECATED_RULE_KEYS" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "UNIQ_DEPRECATED_RULE_KEYS" ON "DEPRECATED_RULE_KEYS"("OLD_REPOSITORY_KEY", "OLD_RULE_KEY"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/deprecatedrulekeys/AddRuleUuidColumnToDeprecatedRuleKeysTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/deprecatedrulekeys/AddRuleUuidColumnToDeprecatedRuleKeysTableTest/schema.sql deleted file mode 100644 index 5f7d81c739c..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/deprecatedrulekeys/AddRuleUuidColumnToDeprecatedRuleKeysTableTest/schema.sql +++ /dev/null @@ -1,41 +0,0 @@ -CREATE TABLE "RULES"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "NAME" VARCHAR(200), - "PLUGIN_RULE_KEY" VARCHAR(200) NOT NULL, - "PLUGIN_KEY" VARCHAR(200), - "PLUGIN_CONFIG_KEY" VARCHAR(200), - "PLUGIN_NAME" VARCHAR(255) NOT NULL, - "SCOPE" VARCHAR(20) NOT NULL, - "DESCRIPTION" CLOB(2147483647), - "PRIORITY" INTEGER, - "STATUS" VARCHAR(40), - "LANGUAGE" VARCHAR(20), - "DEF_REMEDIATION_FUNCTION" VARCHAR(20), - "DEF_REMEDIATION_GAP_MULT" VARCHAR(20), - "DEF_REMEDIATION_BASE_EFFORT" VARCHAR(20), - "GAP_DESCRIPTION" VARCHAR(4000), - "SYSTEM_TAGS" VARCHAR(4000), - "IS_TEMPLATE" BOOLEAN DEFAULT FALSE NOT NULL, - "DESCRIPTION_FORMAT" VARCHAR(20), - "RULE_TYPE" TINYINT, - "SECURITY_STANDARDS" VARCHAR(4000), - "IS_AD_HOC" BOOLEAN NOT NULL, - "IS_EXTERNAL" BOOLEAN NOT NULL, - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT, - "UUID" VARCHAR(40) NOT NULL, - "TEMPLATE_UUID" VARCHAR(40) -); -ALTER TABLE "RULES" ADD CONSTRAINT "PK_RULES" PRIMARY KEY("ID"); -CREATE UNIQUE INDEX "RULES_REPO_KEY" ON "RULES"("PLUGIN_RULE_KEY", "PLUGIN_NAME"); - -CREATE TABLE "DEPRECATED_RULE_KEYS"( - "UUID" VARCHAR(40) NOT NULL, - "RULE_ID" INTEGER NOT NULL, - "OLD_REPOSITORY_KEY" VARCHAR(255) NOT NULL, - "OLD_RULE_KEY" VARCHAR(200) NOT NULL, - "CREATED_AT" BIGINT NOT NULL -); -ALTER TABLE "DEPRECATED_RULE_KEYS" ADD CONSTRAINT "PK_DEPRECATED_RULE_KEYS" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "UNIQ_DEPRECATED_RULE_KEYS" ON "DEPRECATED_RULE_KEYS"("OLD_REPOSITORY_KEY", "OLD_RULE_KEY"); -CREATE INDEX "RULE_ID_DEPRECATED_RULE_KEYS" ON "DEPRECATED_RULE_KEYS"("RULE_ID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/deprecatedrulekeys/DropIndexOnRuleIdColumnOfDeprecatedRuleKeysTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/deprecatedrulekeys/DropIndexOnRuleIdColumnOfDeprecatedRuleKeysTableTest/schema.sql deleted file mode 100644 index 9f9a6ff004a..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/deprecatedrulekeys/DropIndexOnRuleIdColumnOfDeprecatedRuleKeysTableTest/schema.sql +++ /dev/null @@ -1,42 +0,0 @@ -CREATE TABLE "RULES"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "NAME" VARCHAR(200), - "PLUGIN_RULE_KEY" VARCHAR(200) NOT NULL, - "PLUGIN_KEY" VARCHAR(200), - "PLUGIN_CONFIG_KEY" VARCHAR(200), - "PLUGIN_NAME" VARCHAR(255) NOT NULL, - "SCOPE" VARCHAR(20) NOT NULL, - "DESCRIPTION" CLOB(2147483647), - "PRIORITY" INTEGER, - "STATUS" VARCHAR(40), - "LANGUAGE" VARCHAR(20), - "DEF_REMEDIATION_FUNCTION" VARCHAR(20), - "DEF_REMEDIATION_GAP_MULT" VARCHAR(20), - "DEF_REMEDIATION_BASE_EFFORT" VARCHAR(20), - "GAP_DESCRIPTION" VARCHAR(4000), - "SYSTEM_TAGS" VARCHAR(4000), - "IS_TEMPLATE" BOOLEAN DEFAULT FALSE NOT NULL, - "DESCRIPTION_FORMAT" VARCHAR(20), - "RULE_TYPE" TINYINT, - "SECURITY_STANDARDS" VARCHAR(4000), - "IS_AD_HOC" BOOLEAN NOT NULL, - "IS_EXTERNAL" BOOLEAN NOT NULL, - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT, - "UUID" VARCHAR(40) NOT NULL, - "TEMPLATE_UUID" VARCHAR(40) -); -ALTER TABLE "RULES" ADD CONSTRAINT "PK_RULES" PRIMARY KEY("ID"); -CREATE UNIQUE INDEX "RULES_REPO_KEY" ON "RULES"("PLUGIN_RULE_KEY", "PLUGIN_NAME"); - -CREATE TABLE "DEPRECATED_RULE_KEYS"( - "UUID" VARCHAR(40) NOT NULL, - "RULE_ID" INTEGER NOT NULL, - "OLD_REPOSITORY_KEY" VARCHAR(255) NOT NULL, - "OLD_RULE_KEY" VARCHAR(200) NOT NULL, - "CREATED_AT" BIGINT NOT NULL, - "RULE_UUID" VARCHAR(40) NOT NULL -); -ALTER TABLE "DEPRECATED_RULE_KEYS" ADD CONSTRAINT "PK_DEPRECATED_RULE_KEYS" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "UNIQ_DEPRECATED_RULE_KEYS" ON "DEPRECATED_RULE_KEYS"("OLD_REPOSITORY_KEY", "OLD_RULE_KEY"); -CREATE INDEX "RULE_ID_DEPRECATED_RULE_KEYS" ON "DEPRECATED_RULE_KEYS"("RULE_ID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/deprecatedrulekeys/DropRuleIdColumnOfDeprecatedRuleKeysTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/deprecatedrulekeys/DropRuleIdColumnOfDeprecatedRuleKeysTableTest/schema.sql deleted file mode 100644 index 557f113a0c2..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/deprecatedrulekeys/DropRuleIdColumnOfDeprecatedRuleKeysTableTest/schema.sql +++ /dev/null @@ -1,42 +0,0 @@ -CREATE TABLE "RULES"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "NAME" VARCHAR(200), - "PLUGIN_RULE_KEY" VARCHAR(200) NOT NULL, - "PLUGIN_KEY" VARCHAR(200), - "PLUGIN_CONFIG_KEY" VARCHAR(200), - "PLUGIN_NAME" VARCHAR(255) NOT NULL, - "SCOPE" VARCHAR(20) NOT NULL, - "DESCRIPTION" CLOB(2147483647), - "PRIORITY" INTEGER, - "STATUS" VARCHAR(40), - "LANGUAGE" VARCHAR(20), - "DEF_REMEDIATION_FUNCTION" VARCHAR(20), - "DEF_REMEDIATION_GAP_MULT" VARCHAR(20), - "DEF_REMEDIATION_BASE_EFFORT" VARCHAR(20), - "GAP_DESCRIPTION" VARCHAR(4000), - "SYSTEM_TAGS" VARCHAR(4000), - "IS_TEMPLATE" BOOLEAN DEFAULT FALSE NOT NULL, - "DESCRIPTION_FORMAT" VARCHAR(20), - "RULE_TYPE" TINYINT, - "SECURITY_STANDARDS" VARCHAR(4000), - "IS_AD_HOC" BOOLEAN NOT NULL, - "IS_EXTERNAL" BOOLEAN NOT NULL, - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT, - "UUID" VARCHAR(40) NOT NULL, - "TEMPLATE_UUID" VARCHAR(40) -); -ALTER TABLE "RULES" ADD CONSTRAINT "PK_RULES" PRIMARY KEY("ID"); -CREATE UNIQUE INDEX "RULES_REPO_KEY" ON "RULES"("PLUGIN_RULE_KEY", "PLUGIN_NAME"); - -CREATE TABLE "DEPRECATED_RULE_KEYS"( - "UUID" VARCHAR(40) NOT NULL, - "RULE_ID" INTEGER NOT NULL, - "OLD_REPOSITORY_KEY" VARCHAR(255) NOT NULL, - "OLD_RULE_KEY" VARCHAR(200) NOT NULL, - "CREATED_AT" BIGINT NOT NULL, - "RULE_UUID" VARCHAR(40) NOT NULL -); -ALTER TABLE "DEPRECATED_RULE_KEYS" ADD CONSTRAINT "PK_DEPRECATED_RULE_KEYS" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "UNIQ_DEPRECATED_RULE_KEYS" ON "DEPRECATED_RULE_KEYS"("OLD_REPOSITORY_KEY", "OLD_RULE_KEY"); -CREATE INDEX "RULE_UUID_DEPRECATED_RULE_KEYS" ON "DEPRECATED_RULE_KEYS"("RULE_UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/deprecatedrulekeys/MakeDeprecatedRuleKeysRuleUuidColumnNotNullableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/deprecatedrulekeys/MakeDeprecatedRuleKeysRuleUuidColumnNotNullableTest/schema.sql deleted file mode 100644 index a33abf46805..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/deprecatedrulekeys/MakeDeprecatedRuleKeysRuleUuidColumnNotNullableTest/schema.sql +++ /dev/null @@ -1,42 +0,0 @@ -CREATE TABLE "RULES"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "NAME" VARCHAR(200), - "PLUGIN_RULE_KEY" VARCHAR(200) NOT NULL, - "PLUGIN_KEY" VARCHAR(200), - "PLUGIN_CONFIG_KEY" VARCHAR(200), - "PLUGIN_NAME" VARCHAR(255) NOT NULL, - "SCOPE" VARCHAR(20) NOT NULL, - "DESCRIPTION" CLOB(2147483647), - "PRIORITY" INTEGER, - "STATUS" VARCHAR(40), - "LANGUAGE" VARCHAR(20), - "DEF_REMEDIATION_FUNCTION" VARCHAR(20), - "DEF_REMEDIATION_GAP_MULT" VARCHAR(20), - "DEF_REMEDIATION_BASE_EFFORT" VARCHAR(20), - "GAP_DESCRIPTION" VARCHAR(4000), - "SYSTEM_TAGS" VARCHAR(4000), - "IS_TEMPLATE" BOOLEAN DEFAULT FALSE NOT NULL, - "DESCRIPTION_FORMAT" VARCHAR(20), - "RULE_TYPE" TINYINT, - "SECURITY_STANDARDS" VARCHAR(4000), - "IS_AD_HOC" BOOLEAN NOT NULL, - "IS_EXTERNAL" BOOLEAN NOT NULL, - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT, - "UUID" VARCHAR(40) NOT NULL, - "TEMPLATE_UUID" VARCHAR(40) -); -ALTER TABLE "RULES" ADD CONSTRAINT "PK_RULES" PRIMARY KEY("ID"); -CREATE UNIQUE INDEX "RULES_REPO_KEY" ON "RULES"("PLUGIN_RULE_KEY", "PLUGIN_NAME"); - -CREATE TABLE "DEPRECATED_RULE_KEYS"( - "UUID" VARCHAR(40) NOT NULL, - "RULE_ID" INTEGER NOT NULL, - "OLD_REPOSITORY_KEY" VARCHAR(255) NOT NULL, - "OLD_RULE_KEY" VARCHAR(200) NOT NULL, - "CREATED_AT" BIGINT NOT NULL, - "RULE_UUID" VARCHAR(40) -); -ALTER TABLE "DEPRECATED_RULE_KEYS" ADD CONSTRAINT "PK_DEPRECATED_RULE_KEYS" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "UNIQ_DEPRECATED_RULE_KEYS" ON "DEPRECATED_RULE_KEYS"("OLD_REPOSITORY_KEY", "OLD_RULE_KEY"); -CREATE INDEX "RULE_ID_DEPRECATED_RULE_KEYS" ON "DEPRECATED_RULE_KEYS"("RULE_ID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/deprecatedrulekeys/PopulateDeprecatedRuleKeysRuleUuidColumnTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/deprecatedrulekeys/PopulateDeprecatedRuleKeysRuleUuidColumnTest/schema.sql deleted file mode 100644 index a33abf46805..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/deprecatedrulekeys/PopulateDeprecatedRuleKeysRuleUuidColumnTest/schema.sql +++ /dev/null @@ -1,42 +0,0 @@ -CREATE TABLE "RULES"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "NAME" VARCHAR(200), - "PLUGIN_RULE_KEY" VARCHAR(200) NOT NULL, - "PLUGIN_KEY" VARCHAR(200), - "PLUGIN_CONFIG_KEY" VARCHAR(200), - "PLUGIN_NAME" VARCHAR(255) NOT NULL, - "SCOPE" VARCHAR(20) NOT NULL, - "DESCRIPTION" CLOB(2147483647), - "PRIORITY" INTEGER, - "STATUS" VARCHAR(40), - "LANGUAGE" VARCHAR(20), - "DEF_REMEDIATION_FUNCTION" VARCHAR(20), - "DEF_REMEDIATION_GAP_MULT" VARCHAR(20), - "DEF_REMEDIATION_BASE_EFFORT" VARCHAR(20), - "GAP_DESCRIPTION" VARCHAR(4000), - "SYSTEM_TAGS" VARCHAR(4000), - "IS_TEMPLATE" BOOLEAN DEFAULT FALSE NOT NULL, - "DESCRIPTION_FORMAT" VARCHAR(20), - "RULE_TYPE" TINYINT, - "SECURITY_STANDARDS" VARCHAR(4000), - "IS_AD_HOC" BOOLEAN NOT NULL, - "IS_EXTERNAL" BOOLEAN NOT NULL, - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT, - "UUID" VARCHAR(40) NOT NULL, - "TEMPLATE_UUID" VARCHAR(40) -); -ALTER TABLE "RULES" ADD CONSTRAINT "PK_RULES" PRIMARY KEY("ID"); -CREATE UNIQUE INDEX "RULES_REPO_KEY" ON "RULES"("PLUGIN_RULE_KEY", "PLUGIN_NAME"); - -CREATE TABLE "DEPRECATED_RULE_KEYS"( - "UUID" VARCHAR(40) NOT NULL, - "RULE_ID" INTEGER NOT NULL, - "OLD_REPOSITORY_KEY" VARCHAR(255) NOT NULL, - "OLD_RULE_KEY" VARCHAR(200) NOT NULL, - "CREATED_AT" BIGINT NOT NULL, - "RULE_UUID" VARCHAR(40) -); -ALTER TABLE "DEPRECATED_RULE_KEYS" ADD CONSTRAINT "PK_DEPRECATED_RULE_KEYS" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "UNIQ_DEPRECATED_RULE_KEYS" ON "DEPRECATED_RULE_KEYS"("OLD_REPOSITORY_KEY", "OLD_RULE_KEY"); -CREATE INDEX "RULE_ID_DEPRECATED_RULE_KEYS" ON "DEPRECATED_RULE_KEYS"("RULE_ID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/issues/AddIndexesToIssuesTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/issues/AddIndexesToIssuesTableTest/schema.sql deleted file mode 100644 index 6b6f0a98684..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/issues/AddIndexesToIssuesTableTest/schema.sql +++ /dev/null @@ -1,31 +0,0 @@ -CREATE TABLE "ISSUES"( - "KEE" VARCHAR(50) NOT NULL, - "RULE_ID" INTEGER, - "SEVERITY" VARCHAR(10), - "MANUAL_SEVERITY" BOOLEAN NOT NULL, - "MESSAGE" VARCHAR(4000), - "LINE" INTEGER, - "GAP" DOUBLE, - "STATUS" VARCHAR(20), - "RESOLUTION" VARCHAR(20), - "CHECKSUM" VARCHAR(1000), - "REPORTER" VARCHAR(255), - "ASSIGNEE" VARCHAR(255), - "AUTHOR_LOGIN" VARCHAR(255), - "ACTION_PLAN_KEY" VARCHAR(50), - "ISSUE_ATTRIBUTES" VARCHAR(4000), - "EFFORT" INTEGER, - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT, - "ISSUE_CREATION_DATE" BIGINT, - "ISSUE_UPDATE_DATE" BIGINT, - "ISSUE_CLOSE_DATE" BIGINT, - "TAGS" VARCHAR(4000), - "COMPONENT_UUID" VARCHAR(50), - "PROJECT_UUID" VARCHAR(50), - "LOCATIONS" BLOB, - "ISSUE_TYPE" TINYINT, - "FROM_HOTSPOT" BOOLEAN, - "RULE_UUID" VARCHAR(40) -); -ALTER TABLE "ISSUES" ADD CONSTRAINT "PK_ISSUES" PRIMARY KEY("KEE"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/issues/CopyIssuesTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/issues/CopyIssuesTableTest/schema.sql deleted file mode 100644 index cf65bc42c84..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/issues/CopyIssuesTableTest/schema.sql +++ /dev/null @@ -1,39 +0,0 @@ -CREATE TABLE "ISSUES"( - "ID" BIGINT NOT NULL AUTO_INCREMENT (1,1), - "KEE" VARCHAR(50) NOT NULL, - "RULE_ID" INTEGER, - "SEVERITY" VARCHAR(10), - "MANUAL_SEVERITY" BOOLEAN NOT NULL, - "MESSAGE" VARCHAR(4000), - "LINE" INTEGER, - "GAP" DOUBLE, - "STATUS" VARCHAR(20), - "RESOLUTION" VARCHAR(20), - "CHECKSUM" VARCHAR(1000), - "REPORTER" VARCHAR(255), - "ASSIGNEE" VARCHAR(255), - "AUTHOR_LOGIN" VARCHAR(255), - "ACTION_PLAN_KEY" VARCHAR(50), - "ISSUE_ATTRIBUTES" VARCHAR(4000), - "EFFORT" INTEGER, - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT, - "ISSUE_CREATION_DATE" BIGINT, - "ISSUE_UPDATE_DATE" BIGINT, - "ISSUE_CLOSE_DATE" BIGINT, - "TAGS" VARCHAR(4000), - "COMPONENT_UUID" VARCHAR(50), - "PROJECT_UUID" VARCHAR(50), - "LOCATIONS" BLOB, - "ISSUE_TYPE" TINYINT, - "FROM_HOTSPOT" BOOLEAN -); -ALTER TABLE "ISSUES" ADD CONSTRAINT "PK_ISSUES" PRIMARY KEY("ID"); -CREATE INDEX "ISSUES_ASSIGNEE" ON "ISSUES"("ASSIGNEE"); -CREATE INDEX "ISSUES_COMPONENT_UUID" ON "ISSUES"("COMPONENT_UUID"); -CREATE INDEX "ISSUES_CREATION_DATE" ON "ISSUES"("ISSUE_CREATION_DATE"); -CREATE UNIQUE INDEX "ISSUES_KEE" ON "ISSUES"("KEE"); -CREATE INDEX "ISSUES_PROJECT_UUID" ON "ISSUES"("PROJECT_UUID"); -CREATE INDEX "ISSUES_RESOLUTION" ON "ISSUES"("RESOLUTION"); -CREATE INDEX "ISSUES_RULE_ID" ON "ISSUES"("RULE_ID"); -CREATE INDEX "ISSUES_UPDATED_AT" ON "ISSUES"("UPDATED_AT"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/issues/DropIssuesTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/issues/DropIssuesTableTest/schema.sql deleted file mode 100644 index a791fda4a80..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/issues/DropIssuesTableTest/schema.sql +++ /dev/null @@ -1,70 +0,0 @@ -CREATE TABLE "ISSUES_COPY"( - "KEE" VARCHAR(50) NOT NULL, - "RULE_ID" INTEGER, - "SEVERITY" VARCHAR(10), - "MANUAL_SEVERITY" BOOLEAN NOT NULL, - "MESSAGE" VARCHAR(4000), - "LINE" INTEGER, - "GAP" DOUBLE, - "STATUS" VARCHAR(20), - "RESOLUTION" VARCHAR(20), - "CHECKSUM" VARCHAR(1000), - "REPORTER" VARCHAR(255), - "ASSIGNEE" VARCHAR(255), - "AUTHOR_LOGIN" VARCHAR(255), - "ACTION_PLAN_KEY" VARCHAR(50), - "ISSUE_ATTRIBUTES" VARCHAR(4000), - "EFFORT" INTEGER, - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT, - "ISSUE_CREATION_DATE" BIGINT, - "ISSUE_UPDATE_DATE" BIGINT, - "ISSUE_CLOSE_DATE" BIGINT, - "TAGS" VARCHAR(4000), - "COMPONENT_UUID" VARCHAR(50), - "PROJECT_UUID" VARCHAR(50), - "LOCATIONS" BLOB, - "ISSUE_TYPE" TINYINT, - "FROM_HOTSPOT" BOOLEAN, - "RULE_UUID" VARCHAR(40) -); - -CREATE TABLE "ISSUES"( - "ID" BIGINT NOT NULL AUTO_INCREMENT (1,1), - "KEE" VARCHAR(50) NOT NULL, - "RULE_ID" INTEGER, - "SEVERITY" VARCHAR(10), - "MANUAL_SEVERITY" BOOLEAN NOT NULL, - "MESSAGE" VARCHAR(4000), - "LINE" INTEGER, - "GAP" DOUBLE, - "STATUS" VARCHAR(20), - "RESOLUTION" VARCHAR(20), - "CHECKSUM" VARCHAR(1000), - "REPORTER" VARCHAR(255), - "ASSIGNEE" VARCHAR(255), - "AUTHOR_LOGIN" VARCHAR(255), - "ACTION_PLAN_KEY" VARCHAR(50), - "ISSUE_ATTRIBUTES" VARCHAR(4000), - "EFFORT" INTEGER, - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT, - "ISSUE_CREATION_DATE" BIGINT, - "ISSUE_UPDATE_DATE" BIGINT, - "ISSUE_CLOSE_DATE" BIGINT, - "TAGS" VARCHAR(4000), - "COMPONENT_UUID" VARCHAR(50), - "PROJECT_UUID" VARCHAR(50), - "LOCATIONS" BLOB, - "ISSUE_TYPE" TINYINT, - "FROM_HOTSPOT" BOOLEAN -); -ALTER TABLE "ISSUES" ADD CONSTRAINT "PK_ISSUES" PRIMARY KEY("ID"); -CREATE INDEX "ISSUES_ASSIGNEE" ON "ISSUES"("ASSIGNEE"); -CREATE INDEX "ISSUES_COMPONENT_UUID" ON "ISSUES"("COMPONENT_UUID"); -CREATE INDEX "ISSUES_CREATION_DATE" ON "ISSUES"("ISSUE_CREATION_DATE"); -CREATE UNIQUE INDEX "ISSUES_KEE" ON "ISSUES"("KEE"); -CREATE INDEX "ISSUES_PROJECT_UUID" ON "ISSUES"("PROJECT_UUID"); -CREATE INDEX "ISSUES_RESOLUTION" ON "ISSUES"("RESOLUTION"); -CREATE INDEX "ISSUES_RULE_ID" ON "ISSUES"("RULE_ID"); -CREATE INDEX "ISSUES_UPDATED_AT" ON "ISSUES"("UPDATED_AT"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/issues/RenameIssuesCopyToIssuesTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/issues/RenameIssuesCopyToIssuesTest/schema.sql deleted file mode 100644 index 0c3fc02ca51..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/issues/RenameIssuesCopyToIssuesTest/schema.sql +++ /dev/null @@ -1,30 +0,0 @@ -CREATE TABLE "ISSUES_COPY"( - "KEE" VARCHAR(50) NOT NULL, - "RULE_ID" INTEGER, - "SEVERITY" VARCHAR(10), - "MANUAL_SEVERITY" BOOLEAN NOT NULL, - "MESSAGE" VARCHAR(4000), - "LINE" INTEGER, - "GAP" DOUBLE, - "STATUS" VARCHAR(20), - "RESOLUTION" VARCHAR(20), - "CHECKSUM" VARCHAR(1000), - "REPORTER" VARCHAR(255), - "ASSIGNEE" VARCHAR(255), - "AUTHOR_LOGIN" VARCHAR(255), - "ACTION_PLAN_KEY" VARCHAR(50), - "ISSUE_ATTRIBUTES" VARCHAR(4000), - "EFFORT" INTEGER, - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT, - "ISSUE_CREATION_DATE" BIGINT, - "ISSUE_UPDATE_DATE" BIGINT, - "ISSUE_CLOSE_DATE" BIGINT, - "TAGS" VARCHAR(4000), - "COMPONENT_UUID" VARCHAR(50), - "PROJECT_UUID" VARCHAR(50), - "LOCATIONS" BLOB, - "ISSUE_TYPE" TINYINT, - "FROM_HOTSPOT" BOOLEAN, - "RULE_UUID" VARCHAR(40) -); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/rulesmetadata/AddPrimaryKeyOnUuidAndOrganizationUuidColumnOfRulesMetadataTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/rulesmetadata/AddPrimaryKeyOnUuidAndOrganizationUuidColumnOfRulesMetadataTableTest/schema.sql deleted file mode 100644 index 7e46834a915..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/rulesmetadata/AddPrimaryKeyOnUuidAndOrganizationUuidColumnOfRulesMetadataTableTest/schema.sql +++ /dev/null @@ -1,50 +0,0 @@ -CREATE TABLE "RULES"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "NAME" VARCHAR(200), - "PLUGIN_RULE_KEY" VARCHAR(200) NOT NULL, - "PLUGIN_KEY" VARCHAR(200), - "PLUGIN_CONFIG_KEY" VARCHAR(200), - "PLUGIN_NAME" VARCHAR(255) NOT NULL, - "SCOPE" VARCHAR(20) NOT NULL, - "DESCRIPTION" CLOB(2147483647), - "PRIORITY" INTEGER, - "STATUS" VARCHAR(40), - "LANGUAGE" VARCHAR(20), - "DEF_REMEDIATION_FUNCTION" VARCHAR(20), - "DEF_REMEDIATION_GAP_MULT" VARCHAR(20), - "DEF_REMEDIATION_BASE_EFFORT" VARCHAR(20), - "GAP_DESCRIPTION" VARCHAR(4000), - "SYSTEM_TAGS" VARCHAR(4000), - "IS_TEMPLATE" BOOLEAN DEFAULT FALSE NOT NULL, - "DESCRIPTION_FORMAT" VARCHAR(20), - "RULE_TYPE" TINYINT, - "SECURITY_STANDARDS" VARCHAR(4000), - "IS_AD_HOC" BOOLEAN NOT NULL, - "IS_EXTERNAL" BOOLEAN NOT NULL, - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT, - "UUID" VARCHAR(40) NOT NULL, - "TEMPLATE_UUID" VARCHAR(40) -); -ALTER TABLE "RULES" ADD CONSTRAINT "PK_RULES" PRIMARY KEY("ID"); -CREATE UNIQUE INDEX "RULES_REPO_KEY" ON "RULES"("PLUGIN_RULE_KEY", "PLUGIN_NAME"); - -CREATE TABLE "RULES_METADATA"( - "RULE_ID" INTEGER NOT NULL, - "ORGANIZATION_UUID" VARCHAR(40) NOT NULL, - "NOTE_DATA" CLOB(2147483647), - "NOTE_USER_UUID" VARCHAR(255), - "NOTE_CREATED_AT" BIGINT, - "NOTE_UPDATED_AT" BIGINT, - "REMEDIATION_FUNCTION" VARCHAR(20), - "REMEDIATION_GAP_MULT" VARCHAR(20), - "REMEDIATION_BASE_EFFORT" VARCHAR(20), - "TAGS" VARCHAR(4000), - "AD_HOC_NAME" VARCHAR(200), - "AD_HOC_DESCRIPTION" CLOB(2147483647), - "AD_HOC_SEVERITY" VARCHAR(10), - "AD_HOC_TYPE" TINYINT, - "CREATED_AT" BIGINT NOT NULL, - "UPDATED_AT" BIGINT NOT NULL, - "RULE_UUID" VARCHAR(40) NOT NULL -); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/rulesmetadata/AddRuleUuidColumnToRulesMetadataTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/rulesmetadata/AddRuleUuidColumnToRulesMetadataTableTest/schema.sql deleted file mode 100644 index 6dd1263edd1..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/rulesmetadata/AddRuleUuidColumnToRulesMetadataTableTest/schema.sql +++ /dev/null @@ -1,50 +0,0 @@ -CREATE TABLE "RULES"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "NAME" VARCHAR(200), - "PLUGIN_RULE_KEY" VARCHAR(200) NOT NULL, - "PLUGIN_KEY" VARCHAR(200), - "PLUGIN_CONFIG_KEY" VARCHAR(200), - "PLUGIN_NAME" VARCHAR(255) NOT NULL, - "SCOPE" VARCHAR(20) NOT NULL, - "DESCRIPTION" CLOB(2147483647), - "PRIORITY" INTEGER, - "STATUS" VARCHAR(40), - "LANGUAGE" VARCHAR(20), - "DEF_REMEDIATION_FUNCTION" VARCHAR(20), - "DEF_REMEDIATION_GAP_MULT" VARCHAR(20), - "DEF_REMEDIATION_BASE_EFFORT" VARCHAR(20), - "GAP_DESCRIPTION" VARCHAR(4000), - "SYSTEM_TAGS" VARCHAR(4000), - "IS_TEMPLATE" BOOLEAN DEFAULT FALSE NOT NULL, - "DESCRIPTION_FORMAT" VARCHAR(20), - "RULE_TYPE" TINYINT, - "SECURITY_STANDARDS" VARCHAR(4000), - "IS_AD_HOC" BOOLEAN NOT NULL, - "IS_EXTERNAL" BOOLEAN NOT NULL, - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT, - "UUID" VARCHAR(40) NOT NULL, - "TEMPLATE_UUID" VARCHAR(40) -); -ALTER TABLE "RULES" ADD CONSTRAINT "PK_RULES" PRIMARY KEY("ID"); -CREATE UNIQUE INDEX "RULES_REPO_KEY" ON "RULES"("PLUGIN_RULE_KEY", "PLUGIN_NAME"); - -CREATE TABLE "RULES_METADATA"( - "RULE_ID" INTEGER NOT NULL, - "ORGANIZATION_UUID" VARCHAR(40) NOT NULL, - "NOTE_DATA" CLOB(2147483647), - "NOTE_USER_UUID" VARCHAR(255), - "NOTE_CREATED_AT" BIGINT, - "NOTE_UPDATED_AT" BIGINT, - "REMEDIATION_FUNCTION" VARCHAR(20), - "REMEDIATION_GAP_MULT" VARCHAR(20), - "REMEDIATION_BASE_EFFORT" VARCHAR(20), - "TAGS" VARCHAR(4000), - "AD_HOC_NAME" VARCHAR(200), - "AD_HOC_DESCRIPTION" CLOB(2147483647), - "AD_HOC_SEVERITY" VARCHAR(10), - "AD_HOC_TYPE" TINYINT, - "CREATED_AT" BIGINT NOT NULL, - "UPDATED_AT" BIGINT NOT NULL -); -ALTER TABLE "RULES_METADATA" ADD CONSTRAINT "PK_RULES_METADATA" PRIMARY KEY("RULE_ID", "ORGANIZATION_UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/rulesmetadata/DropPrimaryKeyOnIdColumnOfRulesMetadataTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/rulesmetadata/DropPrimaryKeyOnIdColumnOfRulesMetadataTableTest/schema.sql deleted file mode 100644 index 9f014613799..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/rulesmetadata/DropPrimaryKeyOnIdColumnOfRulesMetadataTableTest/schema.sql +++ /dev/null @@ -1,51 +0,0 @@ -CREATE TABLE "RULES"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "NAME" VARCHAR(200), - "PLUGIN_RULE_KEY" VARCHAR(200) NOT NULL, - "PLUGIN_KEY" VARCHAR(200), - "PLUGIN_CONFIG_KEY" VARCHAR(200), - "PLUGIN_NAME" VARCHAR(255) NOT NULL, - "SCOPE" VARCHAR(20) NOT NULL, - "DESCRIPTION" CLOB(2147483647), - "PRIORITY" INTEGER, - "STATUS" VARCHAR(40), - "LANGUAGE" VARCHAR(20), - "DEF_REMEDIATION_FUNCTION" VARCHAR(20), - "DEF_REMEDIATION_GAP_MULT" VARCHAR(20), - "DEF_REMEDIATION_BASE_EFFORT" VARCHAR(20), - "GAP_DESCRIPTION" VARCHAR(4000), - "SYSTEM_TAGS" VARCHAR(4000), - "IS_TEMPLATE" BOOLEAN DEFAULT FALSE NOT NULL, - "DESCRIPTION_FORMAT" VARCHAR(20), - "RULE_TYPE" TINYINT, - "SECURITY_STANDARDS" VARCHAR(4000), - "IS_AD_HOC" BOOLEAN NOT NULL, - "IS_EXTERNAL" BOOLEAN NOT NULL, - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT, - "UUID" VARCHAR(40) NOT NULL, - "TEMPLATE_UUID" VARCHAR(40) -); -ALTER TABLE "RULES" ADD CONSTRAINT "PK_RULES" PRIMARY KEY("ID"); -CREATE UNIQUE INDEX "RULES_REPO_KEY" ON "RULES"("PLUGIN_RULE_KEY", "PLUGIN_NAME"); - -CREATE TABLE "RULES_METADATA"( - "RULE_ID" INTEGER NOT NULL, - "ORGANIZATION_UUID" VARCHAR(40) NOT NULL, - "NOTE_DATA" CLOB(2147483647), - "NOTE_USER_UUID" VARCHAR(255), - "NOTE_CREATED_AT" BIGINT, - "NOTE_UPDATED_AT" BIGINT, - "REMEDIATION_FUNCTION" VARCHAR(20), - "REMEDIATION_GAP_MULT" VARCHAR(20), - "REMEDIATION_BASE_EFFORT" VARCHAR(20), - "TAGS" VARCHAR(4000), - "AD_HOC_NAME" VARCHAR(200), - "AD_HOC_DESCRIPTION" CLOB(2147483647), - "AD_HOC_SEVERITY" VARCHAR(10), - "AD_HOC_TYPE" TINYINT, - "CREATED_AT" BIGINT NOT NULL, - "UPDATED_AT" BIGINT NOT NULL, - "RULE_UUID" VARCHAR(40) NOT NULL -); -ALTER TABLE "RULES_METADATA" ADD CONSTRAINT "PK_RULES_METADATA" PRIMARY KEY("RULE_ID", "ORGANIZATION_UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/rulesmetadata/DropRuleIdColumnOfRulesMetadataTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/rulesmetadata/DropRuleIdColumnOfRulesMetadataTableTest/schema.sql deleted file mode 100644 index d7862acb77c..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/rulesmetadata/DropRuleIdColumnOfRulesMetadataTableTest/schema.sql +++ /dev/null @@ -1,51 +0,0 @@ -create TABLE "RULES"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "NAME" VARCHAR(200), - "PLUGIN_RULE_KEY" VARCHAR(200) NOT NULL, - "PLUGIN_KEY" VARCHAR(200), - "PLUGIN_CONFIG_KEY" VARCHAR(200), - "PLUGIN_NAME" VARCHAR(255) NOT NULL, - "SCOPE" VARCHAR(20) NOT NULL, - "DESCRIPTION" CLOB(2147483647), - "PRIORITY" INTEGER, - "STATUS" VARCHAR(40), - "LANGUAGE" VARCHAR(20), - "DEF_REMEDIATION_FUNCTION" VARCHAR(20), - "DEF_REMEDIATION_GAP_MULT" VARCHAR(20), - "DEF_REMEDIATION_BASE_EFFORT" VARCHAR(20), - "GAP_DESCRIPTION" VARCHAR(4000), - "SYSTEM_TAGS" VARCHAR(4000), - "IS_TEMPLATE" BOOLEAN DEFAULT FALSE NOT NULL, - "DESCRIPTION_FORMAT" VARCHAR(20), - "RULE_TYPE" TINYINT, - "SECURITY_STANDARDS" VARCHAR(4000), - "IS_AD_HOC" BOOLEAN NOT NULL, - "IS_EXTERNAL" BOOLEAN NOT NULL, - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT, - "UUID" VARCHAR(40) NOT NULL, - "TEMPLATE_UUID" VARCHAR(40) -); -alter table "RULES" add CONSTRAINT "PK_RULES" PRIMARY KEY("ID"); -create UNIQUE INDEX "RULES_REPO_KEY" ON "RULES"("PLUGIN_RULE_KEY", "PLUGIN_NAME"); - -CREATE TABLE "RULES_METADATA"( - "RULE_ID" INTEGER NOT NULL, - "ORGANIZATION_UUID" VARCHAR(40) NOT NULL, - "NOTE_DATA" CLOB(2147483647), - "NOTE_USER_UUID" VARCHAR(255), - "NOTE_CREATED_AT" BIGINT, - "NOTE_UPDATED_AT" BIGINT, - "REMEDIATION_FUNCTION" VARCHAR(20), - "REMEDIATION_GAP_MULT" VARCHAR(20), - "REMEDIATION_BASE_EFFORT" VARCHAR(20), - "TAGS" VARCHAR(4000), - "AD_HOC_NAME" VARCHAR(200), - "AD_HOC_DESCRIPTION" CLOB(2147483647), - "AD_HOC_SEVERITY" VARCHAR(10), - "AD_HOC_TYPE" TINYINT, - "CREATED_AT" BIGINT NOT NULL, - "UPDATED_AT" BIGINT NOT NULL, - "RULE_UUID" VARCHAR(40) NOT NULL -); -ALTER TABLE "RULES_METADATA" ADD CONSTRAINT "PK_RULES_METADATA" PRIMARY KEY("RULE_UUID", "ORGANIZATION_UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/rulesmetadata/MakeRulesMetadataRuleUuidColumnNotNullableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/rulesmetadata/MakeRulesMetadataRuleUuidColumnNotNullableTest/schema.sql deleted file mode 100644 index 9e725d8243b..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/rulesmetadata/MakeRulesMetadataRuleUuidColumnNotNullableTest/schema.sql +++ /dev/null @@ -1,51 +0,0 @@ -CREATE TABLE "RULES"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "NAME" VARCHAR(200), - "PLUGIN_RULE_KEY" VARCHAR(200) NOT NULL, - "PLUGIN_KEY" VARCHAR(200), - "PLUGIN_CONFIG_KEY" VARCHAR(200), - "PLUGIN_NAME" VARCHAR(255) NOT NULL, - "SCOPE" VARCHAR(20) NOT NULL, - "DESCRIPTION" CLOB(2147483647), - "PRIORITY" INTEGER, - "STATUS" VARCHAR(40), - "LANGUAGE" VARCHAR(20), - "DEF_REMEDIATION_FUNCTION" VARCHAR(20), - "DEF_REMEDIATION_GAP_MULT" VARCHAR(20), - "DEF_REMEDIATION_BASE_EFFORT" VARCHAR(20), - "GAP_DESCRIPTION" VARCHAR(4000), - "SYSTEM_TAGS" VARCHAR(4000), - "IS_TEMPLATE" BOOLEAN DEFAULT FALSE NOT NULL, - "DESCRIPTION_FORMAT" VARCHAR(20), - "RULE_TYPE" TINYINT, - "SECURITY_STANDARDS" VARCHAR(4000), - "IS_AD_HOC" BOOLEAN NOT NULL, - "IS_EXTERNAL" BOOLEAN NOT NULL, - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT, - "UUID" VARCHAR(40) NOT NULL, - "TEMPLATE_UUID" VARCHAR(40) -); -ALTER TABLE "RULES" ADD CONSTRAINT "PK_RULES" PRIMARY KEY("ID"); -CREATE UNIQUE INDEX "RULES_REPO_KEY" ON "RULES"("PLUGIN_RULE_KEY", "PLUGIN_NAME"); - -CREATE TABLE "RULES_METADATA"( - "RULE_ID" INTEGER NOT NULL, - "ORGANIZATION_UUID" VARCHAR(40) NOT NULL, - "NOTE_DATA" CLOB(2147483647), - "NOTE_USER_UUID" VARCHAR(255), - "NOTE_CREATED_AT" BIGINT, - "NOTE_UPDATED_AT" BIGINT, - "REMEDIATION_FUNCTION" VARCHAR(20), - "REMEDIATION_GAP_MULT" VARCHAR(20), - "REMEDIATION_BASE_EFFORT" VARCHAR(20), - "TAGS" VARCHAR(4000), - "AD_HOC_NAME" VARCHAR(200), - "AD_HOC_DESCRIPTION" CLOB(2147483647), - "AD_HOC_SEVERITY" VARCHAR(10), - "AD_HOC_TYPE" TINYINT, - "CREATED_AT" BIGINT NOT NULL, - "UPDATED_AT" BIGINT NOT NULL, - "RULE_UUID" VARCHAR(40) -); -ALTER TABLE "RULES_METADATA" ADD CONSTRAINT "PK_RULES_METADATA" PRIMARY KEY("RULE_ID", "ORGANIZATION_UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/rulesmetadata/PopulateRulesMetadataRuleUuidColumnTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/rulesmetadata/PopulateRulesMetadataRuleUuidColumnTest/schema.sql deleted file mode 100644 index 9e725d8243b..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/rulesmetadata/PopulateRulesMetadataRuleUuidColumnTest/schema.sql +++ /dev/null @@ -1,51 +0,0 @@ -CREATE TABLE "RULES"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "NAME" VARCHAR(200), - "PLUGIN_RULE_KEY" VARCHAR(200) NOT NULL, - "PLUGIN_KEY" VARCHAR(200), - "PLUGIN_CONFIG_KEY" VARCHAR(200), - "PLUGIN_NAME" VARCHAR(255) NOT NULL, - "SCOPE" VARCHAR(20) NOT NULL, - "DESCRIPTION" CLOB(2147483647), - "PRIORITY" INTEGER, - "STATUS" VARCHAR(40), - "LANGUAGE" VARCHAR(20), - "DEF_REMEDIATION_FUNCTION" VARCHAR(20), - "DEF_REMEDIATION_GAP_MULT" VARCHAR(20), - "DEF_REMEDIATION_BASE_EFFORT" VARCHAR(20), - "GAP_DESCRIPTION" VARCHAR(4000), - "SYSTEM_TAGS" VARCHAR(4000), - "IS_TEMPLATE" BOOLEAN DEFAULT FALSE NOT NULL, - "DESCRIPTION_FORMAT" VARCHAR(20), - "RULE_TYPE" TINYINT, - "SECURITY_STANDARDS" VARCHAR(4000), - "IS_AD_HOC" BOOLEAN NOT NULL, - "IS_EXTERNAL" BOOLEAN NOT NULL, - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT, - "UUID" VARCHAR(40) NOT NULL, - "TEMPLATE_UUID" VARCHAR(40) -); -ALTER TABLE "RULES" ADD CONSTRAINT "PK_RULES" PRIMARY KEY("ID"); -CREATE UNIQUE INDEX "RULES_REPO_KEY" ON "RULES"("PLUGIN_RULE_KEY", "PLUGIN_NAME"); - -CREATE TABLE "RULES_METADATA"( - "RULE_ID" INTEGER NOT NULL, - "ORGANIZATION_UUID" VARCHAR(40) NOT NULL, - "NOTE_DATA" CLOB(2147483647), - "NOTE_USER_UUID" VARCHAR(255), - "NOTE_CREATED_AT" BIGINT, - "NOTE_UPDATED_AT" BIGINT, - "REMEDIATION_FUNCTION" VARCHAR(20), - "REMEDIATION_GAP_MULT" VARCHAR(20), - "REMEDIATION_BASE_EFFORT" VARCHAR(20), - "TAGS" VARCHAR(4000), - "AD_HOC_NAME" VARCHAR(200), - "AD_HOC_DESCRIPTION" CLOB(2147483647), - "AD_HOC_SEVERITY" VARCHAR(10), - "AD_HOC_TYPE" TINYINT, - "CREATED_AT" BIGINT NOT NULL, - "UPDATED_AT" BIGINT NOT NULL, - "RULE_UUID" VARCHAR(40) -); -ALTER TABLE "RULES_METADATA" ADD CONSTRAINT "PK_RULES_METADATA" PRIMARY KEY("RULE_ID", "ORGANIZATION_UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/rulesparameters/AddIndexesToRulesParametersTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/rulesparameters/AddIndexesToRulesParametersTableTest/schema.sql deleted file mode 100644 index 13198189e57..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/rulesparameters/AddIndexesToRulesParametersTableTest/schema.sql +++ /dev/null @@ -1,41 +0,0 @@ -CREATE TABLE "RULES"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "NAME" VARCHAR(200), - "PLUGIN_RULE_KEY" VARCHAR(200) NOT NULL, - "PLUGIN_KEY" VARCHAR(200), - "PLUGIN_CONFIG_KEY" VARCHAR(200), - "PLUGIN_NAME" VARCHAR(255) NOT NULL, - "SCOPE" VARCHAR(20) NOT NULL, - "DESCRIPTION" CLOB(2147483647), - "PRIORITY" INTEGER, - "STATUS" VARCHAR(40), - "LANGUAGE" VARCHAR(20), - "DEF_REMEDIATION_FUNCTION" VARCHAR(20), - "DEF_REMEDIATION_GAP_MULT" VARCHAR(20), - "DEF_REMEDIATION_BASE_EFFORT" VARCHAR(20), - "GAP_DESCRIPTION" VARCHAR(4000), - "SYSTEM_TAGS" VARCHAR(4000), - "IS_TEMPLATE" BOOLEAN DEFAULT FALSE NOT NULL, - "DESCRIPTION_FORMAT" VARCHAR(20), - "RULE_TYPE" TINYINT, - "SECURITY_STANDARDS" VARCHAR(4000), - "IS_AD_HOC" BOOLEAN NOT NULL, - "IS_EXTERNAL" BOOLEAN NOT NULL, - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT, - "UUID" VARCHAR(40) NOT NULL, - "TEMPLATE_UUID" VARCHAR(40) -); -ALTER TABLE "RULES" ADD CONSTRAINT "PK_RULES" PRIMARY KEY("ID"); -CREATE UNIQUE INDEX "RULES_REPO_KEY" ON "RULES"("PLUGIN_RULE_KEY", "PLUGIN_NAME"); - -CREATE TABLE "RULES_PARAMETERS"( - "UUID" VARCHAR(40) NOT NULL, - "RULE_ID" INTEGER NOT NULL, - "NAME" VARCHAR(128) NOT NULL, - "DESCRIPTION" VARCHAR(4000), - "PARAM_TYPE" VARCHAR(512) NOT NULL, - "DEFAULT_VALUE" VARCHAR(4000), - "RULE_UUID" VARCHAR(40) NOT NULL -); -ALTER TABLE "RULES_PARAMETERS" ADD CONSTRAINT "PK_RULES_PARAMETERS" PRIMARY KEY("UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/rulesparameters/AddRuleUuidColumnToRulesParametersTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/rulesparameters/AddRuleUuidColumnToRulesParametersTableTest/schema.sql deleted file mode 100644 index 88e9e77a4e3..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/rulesparameters/AddRuleUuidColumnToRulesParametersTableTest/schema.sql +++ /dev/null @@ -1,42 +0,0 @@ -CREATE TABLE "RULES"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "NAME" VARCHAR(200), - "PLUGIN_RULE_KEY" VARCHAR(200) NOT NULL, - "PLUGIN_KEY" VARCHAR(200), - "PLUGIN_CONFIG_KEY" VARCHAR(200), - "PLUGIN_NAME" VARCHAR(255) NOT NULL, - "SCOPE" VARCHAR(20) NOT NULL, - "DESCRIPTION" CLOB(2147483647), - "PRIORITY" INTEGER, - "STATUS" VARCHAR(40), - "LANGUAGE" VARCHAR(20), - "DEF_REMEDIATION_FUNCTION" VARCHAR(20), - "DEF_REMEDIATION_GAP_MULT" VARCHAR(20), - "DEF_REMEDIATION_BASE_EFFORT" VARCHAR(20), - "GAP_DESCRIPTION" VARCHAR(4000), - "SYSTEM_TAGS" VARCHAR(4000), - "IS_TEMPLATE" BOOLEAN DEFAULT FALSE NOT NULL, - "DESCRIPTION_FORMAT" VARCHAR(20), - "RULE_TYPE" TINYINT, - "SECURITY_STANDARDS" VARCHAR(4000), - "IS_AD_HOC" BOOLEAN NOT NULL, - "IS_EXTERNAL" BOOLEAN NOT NULL, - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT, - "UUID" VARCHAR(40) NOT NULL, - "TEMPLATE_UUID" VARCHAR(40) -); -ALTER TABLE "RULES" ADD CONSTRAINT "PK_RULES" PRIMARY KEY("ID"); -CREATE UNIQUE INDEX "RULES_REPO_KEY" ON "RULES"("PLUGIN_RULE_KEY", "PLUGIN_NAME"); - -CREATE TABLE "RULES_PARAMETERS"( - "UUID" VARCHAR(40) NOT NULL, - "RULE_ID" INTEGER NOT NULL, - "NAME" VARCHAR(128) NOT NULL, - "DESCRIPTION" VARCHAR(4000), - "PARAM_TYPE" VARCHAR(512) NOT NULL, - "DEFAULT_VALUE" VARCHAR(4000) -); -ALTER TABLE "RULES_PARAMETERS" ADD CONSTRAINT "PK_RULES_PARAMETERS" PRIMARY KEY("UUID"); -CREATE INDEX "RULES_PARAMETERS_RULE_ID" ON "RULES_PARAMETERS"("RULE_ID"); -CREATE UNIQUE INDEX "RULES_PARAMETERS_UNIQUE" ON "RULES_PARAMETERS"("RULE_ID", "NAME"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/rulesparameters/DropIndexesOnRuleIdColumnOfRulesParametersTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/rulesparameters/DropIndexesOnRuleIdColumnOfRulesParametersTableTest/schema.sql deleted file mode 100644 index 81bbe5119c2..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/rulesparameters/DropIndexesOnRuleIdColumnOfRulesParametersTableTest/schema.sql +++ /dev/null @@ -1,43 +0,0 @@ -CREATE TABLE "RULES"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "NAME" VARCHAR(200), - "PLUGIN_RULE_KEY" VARCHAR(200) NOT NULL, - "PLUGIN_KEY" VARCHAR(200), - "PLUGIN_CONFIG_KEY" VARCHAR(200), - "PLUGIN_NAME" VARCHAR(255) NOT NULL, - "SCOPE" VARCHAR(20) NOT NULL, - "DESCRIPTION" CLOB(2147483647), - "PRIORITY" INTEGER, - "STATUS" VARCHAR(40), - "LANGUAGE" VARCHAR(20), - "DEF_REMEDIATION_FUNCTION" VARCHAR(20), - "DEF_REMEDIATION_GAP_MULT" VARCHAR(20), - "DEF_REMEDIATION_BASE_EFFORT" VARCHAR(20), - "GAP_DESCRIPTION" VARCHAR(4000), - "SYSTEM_TAGS" VARCHAR(4000), - "IS_TEMPLATE" BOOLEAN DEFAULT FALSE NOT NULL, - "DESCRIPTION_FORMAT" VARCHAR(20), - "RULE_TYPE" TINYINT, - "SECURITY_STANDARDS" VARCHAR(4000), - "IS_AD_HOC" BOOLEAN NOT NULL, - "IS_EXTERNAL" BOOLEAN NOT NULL, - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT, - "UUID" VARCHAR(40) NOT NULL, - "TEMPLATE_UUID" VARCHAR(40) -); -ALTER TABLE "RULES" ADD CONSTRAINT "PK_RULES" PRIMARY KEY("ID"); -CREATE UNIQUE INDEX "RULES_REPO_KEY" ON "RULES"("PLUGIN_RULE_KEY", "PLUGIN_NAME"); - -CREATE TABLE "RULES_PARAMETERS"( - "UUID" VARCHAR(40) NOT NULL, - "RULE_ID" INTEGER NOT NULL, - "NAME" VARCHAR(128) NOT NULL, - "DESCRIPTION" VARCHAR(4000), - "PARAM_TYPE" VARCHAR(512) NOT NULL, - "DEFAULT_VALUE" VARCHAR(4000), - "RULE_UUID" VARCHAR(40) NOT NULL -); -ALTER TABLE "RULES_PARAMETERS" ADD CONSTRAINT "PK_RULES_PARAMETERS" PRIMARY KEY("UUID"); -CREATE INDEX "RULES_PARAMETERS_RULE_ID" ON "RULES_PARAMETERS"("RULE_ID"); -CREATE UNIQUE INDEX "RULES_PARAMETERS_UNIQUE" ON "RULES_PARAMETERS"("RULE_ID", "NAME"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/rulesparameters/DropRuleIdColumnOfRulesParametersTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/rulesparameters/DropRuleIdColumnOfRulesParametersTableTest/schema.sql deleted file mode 100644 index eafb90192e1..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/rulesparameters/DropRuleIdColumnOfRulesParametersTableTest/schema.sql +++ /dev/null @@ -1,43 +0,0 @@ -create TABLE "RULES"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "NAME" VARCHAR(200), - "PLUGIN_RULE_KEY" VARCHAR(200) NOT NULL, - "PLUGIN_KEY" VARCHAR(200), - "PLUGIN_CONFIG_KEY" VARCHAR(200), - "PLUGIN_NAME" VARCHAR(255) NOT NULL, - "SCOPE" VARCHAR(20) NOT NULL, - "DESCRIPTION" CLOB(2147483647), - "PRIORITY" INTEGER, - "STATUS" VARCHAR(40), - "LANGUAGE" VARCHAR(20), - "DEF_REMEDIATION_FUNCTION" VARCHAR(20), - "DEF_REMEDIATION_GAP_MULT" VARCHAR(20), - "DEF_REMEDIATION_BASE_EFFORT" VARCHAR(20), - "GAP_DESCRIPTION" VARCHAR(4000), - "SYSTEM_TAGS" VARCHAR(4000), - "IS_TEMPLATE" BOOLEAN DEFAULT FALSE NOT NULL, - "DESCRIPTION_FORMAT" VARCHAR(20), - "RULE_TYPE" TINYINT, - "SECURITY_STANDARDS" VARCHAR(4000), - "IS_AD_HOC" BOOLEAN NOT NULL, - "IS_EXTERNAL" BOOLEAN NOT NULL, - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT, - "UUID" VARCHAR(40) NOT NULL, - "TEMPLATE_UUID" VARCHAR(40) -); -alter table "RULES" add CONSTRAINT "PK_RULES" PRIMARY KEY("ID"); -create UNIQUE INDEX "RULES_REPO_KEY" ON "RULES"("PLUGIN_RULE_KEY", "PLUGIN_NAME"); - -create TABLE "RULES_PARAMETERS"( - "UUID" VARCHAR(40) NOT NULL, - "RULE_ID" INTEGER NOT NULL, - "NAME" VARCHAR(128) NOT NULL, - "DESCRIPTION" VARCHAR(4000), - "PARAM_TYPE" VARCHAR(512) NOT NULL, - "DEFAULT_VALUE" VARCHAR(4000), - "RULE_UUID" VARCHAR(40) NOT NULL -); -alter table "RULES_PARAMETERS" add CONSTRAINT "PK_RULES_PARAMETERS" PRIMARY KEY("UUID"); -create INDEX "RULES_PARAMETERS_RULE_UUID" ON "RULES_PARAMETERS"("RULE_UUID"); -create UNIQUE INDEX "RULES_PARAMETERS_UNIQUE" ON "RULES_PARAMETERS"("RULE_UUID", "NAME"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/rulesparameters/MakeRulesParametersRuleUuidColumnNotNullableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/rulesparameters/MakeRulesParametersRuleUuidColumnNotNullableTest/schema.sql deleted file mode 100644 index 9fdc54dfb08..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/rulesparameters/MakeRulesParametersRuleUuidColumnNotNullableTest/schema.sql +++ /dev/null @@ -1,43 +0,0 @@ -CREATE TABLE "RULES"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "NAME" VARCHAR(200), - "PLUGIN_RULE_KEY" VARCHAR(200) NOT NULL, - "PLUGIN_KEY" VARCHAR(200), - "PLUGIN_CONFIG_KEY" VARCHAR(200), - "PLUGIN_NAME" VARCHAR(255) NOT NULL, - "SCOPE" VARCHAR(20) NOT NULL, - "DESCRIPTION" CLOB(2147483647), - "PRIORITY" INTEGER, - "STATUS" VARCHAR(40), - "LANGUAGE" VARCHAR(20), - "DEF_REMEDIATION_FUNCTION" VARCHAR(20), - "DEF_REMEDIATION_GAP_MULT" VARCHAR(20), - "DEF_REMEDIATION_BASE_EFFORT" VARCHAR(20), - "GAP_DESCRIPTION" VARCHAR(4000), - "SYSTEM_TAGS" VARCHAR(4000), - "IS_TEMPLATE" BOOLEAN DEFAULT FALSE NOT NULL, - "DESCRIPTION_FORMAT" VARCHAR(20), - "RULE_TYPE" TINYINT, - "SECURITY_STANDARDS" VARCHAR(4000), - "IS_AD_HOC" BOOLEAN NOT NULL, - "IS_EXTERNAL" BOOLEAN NOT NULL, - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT, - "UUID" VARCHAR(40) NOT NULL, - "TEMPLATE_UUID" VARCHAR(40) -); -ALTER TABLE "RULES" ADD CONSTRAINT "PK_RULES" PRIMARY KEY("ID"); -CREATE UNIQUE INDEX "RULES_REPO_KEY" ON "RULES"("PLUGIN_RULE_KEY", "PLUGIN_NAME"); - -CREATE TABLE "RULES_PARAMETERS"( - "UUID" VARCHAR(40) NOT NULL, - "RULE_ID" INTEGER NOT NULL, - "NAME" VARCHAR(128) NOT NULL, - "DESCRIPTION" VARCHAR(4000), - "PARAM_TYPE" VARCHAR(512) NOT NULL, - "DEFAULT_VALUE" VARCHAR(4000), - "RULE_UUID" VARCHAR(40) -); -ALTER TABLE "RULES_PARAMETERS" ADD CONSTRAINT "PK_RULES_PARAMETERS" PRIMARY KEY("UUID"); -CREATE INDEX "RULES_PARAMETERS_RULE_ID" ON "RULES_PARAMETERS"("RULE_ID"); -CREATE UNIQUE INDEX "RULES_PARAMETERS_UNIQUE" ON "RULES_PARAMETERS"("RULE_ID", "NAME"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/rulesparameters/PopulateRulesParametersRuleUuidColumnTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/rulesparameters/PopulateRulesParametersRuleUuidColumnTest/schema.sql deleted file mode 100644 index 9fdc54dfb08..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rules/rulesparameters/PopulateRulesParametersRuleUuidColumnTest/schema.sql +++ /dev/null @@ -1,43 +0,0 @@ -CREATE TABLE "RULES"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "NAME" VARCHAR(200), - "PLUGIN_RULE_KEY" VARCHAR(200) NOT NULL, - "PLUGIN_KEY" VARCHAR(200), - "PLUGIN_CONFIG_KEY" VARCHAR(200), - "PLUGIN_NAME" VARCHAR(255) NOT NULL, - "SCOPE" VARCHAR(20) NOT NULL, - "DESCRIPTION" CLOB(2147483647), - "PRIORITY" INTEGER, - "STATUS" VARCHAR(40), - "LANGUAGE" VARCHAR(20), - "DEF_REMEDIATION_FUNCTION" VARCHAR(20), - "DEF_REMEDIATION_GAP_MULT" VARCHAR(20), - "DEF_REMEDIATION_BASE_EFFORT" VARCHAR(20), - "GAP_DESCRIPTION" VARCHAR(4000), - "SYSTEM_TAGS" VARCHAR(4000), - "IS_TEMPLATE" BOOLEAN DEFAULT FALSE NOT NULL, - "DESCRIPTION_FORMAT" VARCHAR(20), - "RULE_TYPE" TINYINT, - "SECURITY_STANDARDS" VARCHAR(4000), - "IS_AD_HOC" BOOLEAN NOT NULL, - "IS_EXTERNAL" BOOLEAN NOT NULL, - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT, - "UUID" VARCHAR(40) NOT NULL, - "TEMPLATE_UUID" VARCHAR(40) -); -ALTER TABLE "RULES" ADD CONSTRAINT "PK_RULES" PRIMARY KEY("ID"); -CREATE UNIQUE INDEX "RULES_REPO_KEY" ON "RULES"("PLUGIN_RULE_KEY", "PLUGIN_NAME"); - -CREATE TABLE "RULES_PARAMETERS"( - "UUID" VARCHAR(40) NOT NULL, - "RULE_ID" INTEGER NOT NULL, - "NAME" VARCHAR(128) NOT NULL, - "DESCRIPTION" VARCHAR(4000), - "PARAM_TYPE" VARCHAR(512) NOT NULL, - "DEFAULT_VALUE" VARCHAR(4000), - "RULE_UUID" VARCHAR(40) -); -ALTER TABLE "RULES_PARAMETERS" ADD CONSTRAINT "PK_RULES_PARAMETERS" PRIMARY KEY("UUID"); -CREATE INDEX "RULES_PARAMETERS_RULE_ID" ON "RULES_PARAMETERS"("RULE_ID"); -CREATE UNIQUE INDEX "RULES_PARAMETERS_UNIQUE" ON "RULES_PARAMETERS"("RULE_ID", "NAME"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rulesparameters/AddPrimaryKeyOnUuidColumnOfRulesParametersTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rulesparameters/AddPrimaryKeyOnUuidColumnOfRulesParametersTableTest/schema.sql deleted file mode 100644 index 961a5cb8cac..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rulesparameters/AddPrimaryKeyOnUuidColumnOfRulesParametersTableTest/schema.sql +++ /dev/null @@ -1,11 +0,0 @@ -CREATE TABLE "RULES_PARAMETERS"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "UUID" VARCHAR(40) NOT NULL, - "RULE_ID" INTEGER NOT NULL, - "NAME" VARCHAR(128) NOT NULL, - "DESCRIPTION" VARCHAR(4000), - "PARAM_TYPE" VARCHAR(512) NOT NULL, - "DEFAULT_VALUE" VARCHAR(4000) -); -CREATE INDEX "RULES_PARAMETERS_RULE_ID" ON "RULES_PARAMETERS"("RULE_ID"); -CREATE UNIQUE INDEX "RULES_PARAMETERS_UNIQUE" ON "RULES_PARAMETERS"("RULE_ID", "NAME"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rulesparameters/AddUuidColumnToRulesParametersTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rulesparameters/AddUuidColumnToRulesParametersTest/schema.sql deleted file mode 100644 index 98a62c638d9..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rulesparameters/AddUuidColumnToRulesParametersTest/schema.sql +++ /dev/null @@ -1,11 +0,0 @@ -CREATE TABLE "RULES_PARAMETERS"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "RULE_ID" INTEGER NOT NULL, - "NAME" VARCHAR(128) NOT NULL, - "DESCRIPTION" VARCHAR(4000), - "PARAM_TYPE" VARCHAR(512) NOT NULL, - "DEFAULT_VALUE" VARCHAR(4000) -); -ALTER TABLE "RULES_PARAMETERS" ADD CONSTRAINT "PK_RULES_PARAMETERS" PRIMARY KEY("ID"); -CREATE INDEX "RULES_PARAMETERS_RULE_ID" ON "RULES_PARAMETERS"("RULE_ID"); -CREATE UNIQUE INDEX "RULES_PARAMETERS_UNIQUE" ON "RULES_PARAMETERS"("RULE_ID", "NAME"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rulesparameters/DropIdColumnOfRulesParametersTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rulesparameters/DropIdColumnOfRulesParametersTableTest/schema.sql deleted file mode 100644 index 60597fff321..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rulesparameters/DropIdColumnOfRulesParametersTableTest/schema.sql +++ /dev/null @@ -1,12 +0,0 @@ -CREATE TABLE "RULES_PARAMETERS"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "UUID" VARCHAR(40) NOT NULL, - "RULE_ID" INTEGER NOT NULL, - "NAME" VARCHAR(128) NOT NULL, - "DESCRIPTION" VARCHAR(4000), - "PARAM_TYPE" VARCHAR(512) NOT NULL, - "DEFAULT_VALUE" VARCHAR(4000) -); -ALTER TABLE "RULES_PARAMETERS" ADD CONSTRAINT "PK_RULES_PARAMETERS" PRIMARY KEY("UUID"); -CREATE INDEX "RULES_PARAMETERS_RULE_ID" ON "RULES_PARAMETERS"("RULE_ID"); -CREATE UNIQUE INDEX "RULES_PARAMETERS_UNIQUE" ON "RULES_PARAMETERS"("RULE_ID", "NAME"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rulesparameters/DropPrimaryKeyOnIdColumnOfRulesParametersTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rulesparameters/DropPrimaryKeyOnIdColumnOfRulesParametersTableTest/schema.sql deleted file mode 100644 index efdec30874f..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rulesparameters/DropPrimaryKeyOnIdColumnOfRulesParametersTableTest/schema.sql +++ /dev/null @@ -1,12 +0,0 @@ -CREATE TABLE "RULES_PARAMETERS"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "UUID" VARCHAR(40) NOT NULL, - "RULE_ID" INTEGER NOT NULL, - "NAME" VARCHAR(128) NOT NULL, - "DESCRIPTION" VARCHAR(4000), - "PARAM_TYPE" VARCHAR(512) NOT NULL, - "DEFAULT_VALUE" VARCHAR(4000) -); -ALTER TABLE "RULES_PARAMETERS" ADD CONSTRAINT "PK_RULES_PARAMETERS" PRIMARY KEY("ID"); -CREATE INDEX "RULES_PARAMETERS_RULE_ID" ON "RULES_PARAMETERS"("RULE_ID"); -CREATE UNIQUE INDEX "RULES_PARAMETERS_UNIQUE" ON "RULES_PARAMETERS"("RULE_ID", "NAME"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rulesparameters/MakeRulesParametersUuidColumnNotNullableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rulesparameters/MakeRulesParametersUuidColumnNotNullableTest/schema.sql deleted file mode 100644 index 55efee58993..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rulesparameters/MakeRulesParametersUuidColumnNotNullableTest/schema.sql +++ /dev/null @@ -1,12 +0,0 @@ -CREATE TABLE "RULES_PARAMETERS"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "UUID" VARCHAR(40), - "RULE_ID" INTEGER NOT NULL, - "NAME" VARCHAR(128) NOT NULL, - "DESCRIPTION" VARCHAR(4000), - "PARAM_TYPE" VARCHAR(512) NOT NULL, - "DEFAULT_VALUE" VARCHAR(4000) -); -ALTER TABLE "RULES_PARAMETERS" ADD CONSTRAINT "PK_RULES_PARAMETERS" PRIMARY KEY("ID"); -CREATE INDEX "RULES_PARAMETERS_RULE_ID" ON "RULES_PARAMETERS"("RULE_ID"); -CREATE UNIQUE INDEX "RULES_PARAMETERS_UNIQUE" ON "RULES_PARAMETERS"("RULE_ID", "NAME"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rulesparameters/PopulateRulesParametersUuidTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rulesparameters/PopulateRulesParametersUuidTest/schema.sql deleted file mode 100644 index 55efee58993..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rulesparameters/PopulateRulesParametersUuidTest/schema.sql +++ /dev/null @@ -1,12 +0,0 @@ -CREATE TABLE "RULES_PARAMETERS"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "UUID" VARCHAR(40), - "RULE_ID" INTEGER NOT NULL, - "NAME" VARCHAR(128) NOT NULL, - "DESCRIPTION" VARCHAR(4000), - "PARAM_TYPE" VARCHAR(512) NOT NULL, - "DEFAULT_VALUE" VARCHAR(4000) -); -ALTER TABLE "RULES_PARAMETERS" ADD CONSTRAINT "PK_RULES_PARAMETERS" PRIMARY KEY("ID"); -CREATE INDEX "RULES_PARAMETERS_RULE_ID" ON "RULES_PARAMETERS"("RULE_ID"); -CREATE UNIQUE INDEX "RULES_PARAMETERS_UNIQUE" ON "RULES_PARAMETERS"("RULE_ID", "NAME"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rulesparameters/fk/AddRulesParameterUuidColumnToActiveRuleParametersTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rulesparameters/fk/AddRulesParameterUuidColumnToActiveRuleParametersTest/schema.sql deleted file mode 100644 index 04d58e9edf0..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rulesparameters/fk/AddRulesParameterUuidColumnToActiveRuleParametersTest/schema.sql +++ /dev/null @@ -1,9 +0,0 @@ -CREATE TABLE "ACTIVE_RULE_PARAMETERS"( - "ACTIVE_RULE_ID" INTEGER NOT NULL, - "RULES_PARAMETER_ID" INTEGER NOT NULL, - "VALUE" VARCHAR(4000), - "RULES_PARAMETER_KEY" VARCHAR(128), - "UUID" VARCHAR(40) NOT NULL -); -ALTER TABLE "ACTIVE_RULE_PARAMETERS" ADD CONSTRAINT "PK_ACTIVE_RULE_PARAMETERS" PRIMARY KEY("UUID"); -CREATE INDEX "IX_ARP_ON_ACTIVE_RULE_ID" ON "ACTIVE_RULE_PARAMETERS"("ACTIVE_RULE_ID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rulesparameters/fk/DropRulesParameterIdColumnOfActiveRuleParametersTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rulesparameters/fk/DropRulesParameterIdColumnOfActiveRuleParametersTableTest/schema.sql deleted file mode 100644 index 3782982a167..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rulesparameters/fk/DropRulesParameterIdColumnOfActiveRuleParametersTableTest/schema.sql +++ /dev/null @@ -1,10 +0,0 @@ -CREATE TABLE "ACTIVE_RULE_PARAMETERS"( - "ACTIVE_RULE_ID" INTEGER NOT NULL, - "RULES_PARAMETER_ID" INTEGER NOT NULL, - "RULES_PARAMETER_UUID" VARCHAR(40) NOT NULL, - "VALUE" VARCHAR(4000), - "RULES_PARAMETER_KEY" VARCHAR(128), - "UUID" VARCHAR(40) NOT NULL -); -ALTER TABLE "ACTIVE_RULE_PARAMETERS" ADD CONSTRAINT "PK_ACTIVE_RULE_PARAMETERS" PRIMARY KEY("UUID"); -CREATE INDEX "IX_ARP_ON_ACTIVE_RULE_ID" ON "ACTIVE_RULE_PARAMETERS"("ACTIVE_RULE_ID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rulesparameters/fk/MakeActiveRuleParametersRulesParameterUuidColumnNotNullableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rulesparameters/fk/MakeActiveRuleParametersRulesParameterUuidColumnNotNullableTest/schema.sql deleted file mode 100644 index de06e416db2..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rulesparameters/fk/MakeActiveRuleParametersRulesParameterUuidColumnNotNullableTest/schema.sql +++ /dev/null @@ -1,10 +0,0 @@ -CREATE TABLE "ACTIVE_RULE_PARAMETERS"( - "ACTIVE_RULE_ID" INTEGER NOT NULL, - "RULES_PARAMETER_ID" INTEGER NOT NULL, - "RULES_PARAMETER_UUID" VARCHAR(40), - "VALUE" VARCHAR(4000), - "RULES_PARAMETER_KEY" VARCHAR(128), - "UUID" VARCHAR(40) NOT NULL -); -ALTER TABLE "ACTIVE_RULE_PARAMETERS" ADD CONSTRAINT "PK_ACTIVE_RULE_PARAMETERS" PRIMARY KEY("UUID"); -CREATE INDEX "IX_ARP_ON_ACTIVE_RULE_ID" ON "ACTIVE_RULE_PARAMETERS"("ACTIVE_RULE_ID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rulesparameters/fk/PopulateActiveRuleParametersRulesParameterUuidTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rulesparameters/fk/PopulateActiveRuleParametersRulesParameterUuidTest/schema.sql deleted file mode 100644 index 0bb696c346c..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rulesparameters/fk/PopulateActiveRuleParametersRulesParameterUuidTest/schema.sql +++ /dev/null @@ -1,23 +0,0 @@ -CREATE TABLE "RULES_PARAMETERS"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "UUID" VARCHAR(40) NOT NULL, - "RULE_ID" INTEGER NOT NULL, - "NAME" VARCHAR(128) NOT NULL, - "DESCRIPTION" VARCHAR(4000), - "PARAM_TYPE" VARCHAR(512) NOT NULL, - "DEFAULT_VALUE" VARCHAR(4000) -); -ALTER TABLE "RULES_PARAMETERS" ADD CONSTRAINT "PK_RULES_PARAMETERS" PRIMARY KEY("ID"); -CREATE INDEX "RULES_PARAMETERS_RULE_ID" ON "RULES_PARAMETERS"("RULE_ID"); -CREATE UNIQUE INDEX "RULES_PARAMETERS_UNIQUE" ON "RULES_PARAMETERS"("RULE_ID", "NAME"); - -CREATE TABLE "ACTIVE_RULE_PARAMETERS"( - "ACTIVE_RULE_ID" INTEGER NOT NULL, - "RULES_PARAMETER_ID" INTEGER NOT NULL, - "RULES_PARAMETER_UUID" VARCHAR(40), - "VALUE" VARCHAR(4000), - "RULES_PARAMETER_KEY" VARCHAR(128), - "UUID" VARCHAR(40) NOT NULL -); -ALTER TABLE "ACTIVE_RULE_PARAMETERS" ADD CONSTRAINT "PK_ACTIVE_RULE_PARAMETERS" PRIMARY KEY("UUID"); -CREATE INDEX "IX_ARP_ON_ACTIVE_RULE_ID" ON "ACTIVE_RULE_PARAMETERS"("ACTIVE_RULE_ID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/AddPrimaryKeyOnUuidColumnOfRulesProfilesTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/AddPrimaryKeyOnUuidColumnOfRulesProfilesTableTest/schema.sql deleted file mode 100644 index 8f7a7f216ae..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/AddPrimaryKeyOnUuidColumnOfRulesProfilesTableTest/schema.sql +++ /dev/null @@ -1,10 +0,0 @@ -CREATE TABLE "RULES_PROFILES"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "UUID" VARCHAR(40) NOT NULL, - "NAME" VARCHAR(100) NOT NULL, - "LANGUAGE" VARCHAR(20), - "IS_BUILT_IN" BOOLEAN NOT NULL, - "RULES_UPDATED_AT" VARCHAR(100), - "CREATED_AT" TIMESTAMP, - "UPDATED_AT" TIMESTAMP -); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/AddUuidColumnToRulesProfilesTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/AddUuidColumnToRulesProfilesTableTest/schema.sql deleted file mode 100644 index de92d69aeb0..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/AddUuidColumnToRulesProfilesTableTest/schema.sql +++ /dev/null @@ -1,12 +0,0 @@ -CREATE TABLE "RULES_PROFILES"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "NAME" VARCHAR(100) NOT NULL, - "LANGUAGE" VARCHAR(20), - "KEE" VARCHAR(255) NOT NULL, - "IS_BUILT_IN" BOOLEAN NOT NULL, - "RULES_UPDATED_AT" VARCHAR(100), - "CREATED_AT" TIMESTAMP, - "UPDATED_AT" TIMESTAMP -); -ALTER TABLE "RULES_PROFILES" ADD CONSTRAINT "PK_RULES_PROFILES" PRIMARY KEY("ID"); -CREATE UNIQUE INDEX "UNIQ_QPROF_KEY" ON "RULES_PROFILES"("KEE"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/DropIdColumnOfRulesProfilesTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/DropIdColumnOfRulesProfilesTableTest/schema.sql deleted file mode 100644 index 0236b7e6554..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/DropIdColumnOfRulesProfilesTableTest/schema.sql +++ /dev/null @@ -1,11 +0,0 @@ -CREATE TABLE "RULES_PROFILES"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "UUID" VARCHAR(40) NOT NULL, - "NAME" VARCHAR(100) NOT NULL, - "LANGUAGE" VARCHAR(20), - "IS_BUILT_IN" BOOLEAN NOT NULL, - "RULES_UPDATED_AT" VARCHAR(100), - "CREATED_AT" TIMESTAMP, - "UPDATED_AT" TIMESTAMP -); -ALTER TABLE "RULES_PROFILES" ADD CONSTRAINT "PK_RULES_PROFILES" PRIMARY KEY("UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/DropKeeColumnOfRulesProfilesTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/DropKeeColumnOfRulesProfilesTableTest/schema.sql deleted file mode 100644 index eeb2ebcbd94..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/DropKeeColumnOfRulesProfilesTableTest/schema.sql +++ /dev/null @@ -1,13 +0,0 @@ -CREATE TABLE "RULES_PROFILES"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "UUID" VARCHAR(40) NOT NULL, - "NAME" VARCHAR(100) NOT NULL, - "LANGUAGE" VARCHAR(20), - "KEE" VARCHAR(255) NOT NULL, - "IS_BUILT_IN" BOOLEAN NOT NULL, - "RULES_UPDATED_AT" VARCHAR(100), - "CREATED_AT" TIMESTAMP, - "UPDATED_AT" TIMESTAMP -); -ALTER TABLE "RULES_PROFILES" ADD CONSTRAINT "PK_RULES_PROFILES" PRIMARY KEY("ID"); -CREATE UNIQUE INDEX "UNIQ_QPROF_KEY" ON "RULES_PROFILES"("KEE"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/DropPrimaryKeyOnIdColumnOfRulesProfilesTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/DropPrimaryKeyOnIdColumnOfRulesProfilesTableTest/schema.sql deleted file mode 100644 index 20448a4d9fe..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/DropPrimaryKeyOnIdColumnOfRulesProfilesTableTest/schema.sql +++ /dev/null @@ -1,11 +0,0 @@ -CREATE TABLE "RULES_PROFILES"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "UUID" VARCHAR(40) NOT NULL, - "NAME" VARCHAR(100) NOT NULL, - "LANGUAGE" VARCHAR(20), - "IS_BUILT_IN" BOOLEAN NOT NULL, - "RULES_UPDATED_AT" VARCHAR(100), - "CREATED_AT" TIMESTAMP, - "UPDATED_AT" TIMESTAMP -); -ALTER TABLE "RULES_PROFILES" ADD CONSTRAINT "PK_RULES_PROFILES" PRIMARY KEY("ID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/DropUniqueIndexOnKeeColumnOfRulesProfilesTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/DropUniqueIndexOnKeeColumnOfRulesProfilesTableTest/schema.sql deleted file mode 100644 index eeb2ebcbd94..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/DropUniqueIndexOnKeeColumnOfRulesProfilesTableTest/schema.sql +++ /dev/null @@ -1,13 +0,0 @@ -CREATE TABLE "RULES_PROFILES"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "UUID" VARCHAR(40) NOT NULL, - "NAME" VARCHAR(100) NOT NULL, - "LANGUAGE" VARCHAR(20), - "KEE" VARCHAR(255) NOT NULL, - "IS_BUILT_IN" BOOLEAN NOT NULL, - "RULES_UPDATED_AT" VARCHAR(100), - "CREATED_AT" TIMESTAMP, - "UPDATED_AT" TIMESTAMP -); -ALTER TABLE "RULES_PROFILES" ADD CONSTRAINT "PK_RULES_PROFILES" PRIMARY KEY("ID"); -CREATE UNIQUE INDEX "UNIQ_QPROF_KEY" ON "RULES_PROFILES"("KEE"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/MakeRulesProfilesUuidColumnNotNullableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/MakeRulesProfilesUuidColumnNotNullableTest/schema.sql deleted file mode 100644 index fd1ad1ea6a2..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/MakeRulesProfilesUuidColumnNotNullableTest/schema.sql +++ /dev/null @@ -1,13 +0,0 @@ -CREATE TABLE "RULES_PROFILES"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "UUID" VARCHAR(40), - "NAME" VARCHAR(100) NOT NULL, - "LANGUAGE" VARCHAR(20), - "KEE" VARCHAR(255) NOT NULL, - "IS_BUILT_IN" BOOLEAN NOT NULL, - "RULES_UPDATED_AT" VARCHAR(100), - "CREATED_AT" TIMESTAMP, - "UPDATED_AT" TIMESTAMP -); -ALTER TABLE "RULES_PROFILES" ADD CONSTRAINT "PK_RULES_PROFILES" PRIMARY KEY("ID"); -CREATE UNIQUE INDEX "UNIQ_QPROF_KEY" ON "RULES_PROFILES"("KEE"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/PopulateRulesProfilesUuidTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/PopulateRulesProfilesUuidTest/schema.sql deleted file mode 100644 index fd1ad1ea6a2..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/PopulateRulesProfilesUuidTest/schema.sql +++ /dev/null @@ -1,13 +0,0 @@ -CREATE TABLE "RULES_PROFILES"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "UUID" VARCHAR(40), - "NAME" VARCHAR(100) NOT NULL, - "LANGUAGE" VARCHAR(20), - "KEE" VARCHAR(255) NOT NULL, - "IS_BUILT_IN" BOOLEAN NOT NULL, - "RULES_UPDATED_AT" VARCHAR(100), - "CREATED_AT" TIMESTAMP, - "UPDATED_AT" TIMESTAMP -); -ALTER TABLE "RULES_PROFILES" ADD CONSTRAINT "PK_RULES_PROFILES" PRIMARY KEY("ID"); -CREATE UNIQUE INDEX "UNIQ_QPROF_KEY" ON "RULES_PROFILES"("KEE"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/fk/activerules/AddProfileUuidColumnToActiveRulesTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/fk/activerules/AddProfileUuidColumnToActiveRulesTableTest/schema.sql deleted file mode 100644 index d2e7c11c080..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/fk/activerules/AddProfileUuidColumnToActiveRulesTableTest/schema.sql +++ /dev/null @@ -1,11 +0,0 @@ -CREATE TABLE "ACTIVE_RULES"( - "UUID" VARCHAR(40) NOT NULL, - "PROFILE_ID" INTEGER NOT NULL, - "RULE_ID" INTEGER NOT NULL, - "FAILURE_LEVEL" INTEGER NOT NULL, - "INHERITANCE" VARCHAR(10), - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT -); -ALTER TABLE "ACTIVE_RULES" ADD CONSTRAINT "PK_ACTIVE_RULES" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "UNIQ_PROFILE_RULE_IDS" ON "ACTIVE_RULES"("PROFILE_ID", "RULE_ID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/fk/activerules/AddUniqueIndexOnProfileUuidColumnOfActiveRulesTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/fk/activerules/AddUniqueIndexOnProfileUuidColumnOfActiveRulesTableTest/schema.sql deleted file mode 100644 index 2dedcc6b5e2..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/fk/activerules/AddUniqueIndexOnProfileUuidColumnOfActiveRulesTableTest/schema.sql +++ /dev/null @@ -1,11 +0,0 @@ -CREATE TABLE "ACTIVE_RULES"( - "UUID" VARCHAR(40) NOT NULL, - "PROFILE_ID" INTEGER NOT NULL, - "PROFILE_UUID" VARCHAR(40), - "RULE_ID" INTEGER NOT NULL, - "FAILURE_LEVEL" INTEGER NOT NULL, - "INHERITANCE" VARCHAR(10), - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT -); -ALTER TABLE "ACTIVE_RULES" ADD CONSTRAINT "PK_ACTIVE_RULES" PRIMARY KEY("UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/fk/activerules/DropProfileIdColumnOfActiveRulesTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/fk/activerules/DropProfileIdColumnOfActiveRulesTableTest/schema.sql deleted file mode 100644 index 2adacc4076d..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/fk/activerules/DropProfileIdColumnOfActiveRulesTableTest/schema.sql +++ /dev/null @@ -1,12 +0,0 @@ -CREATE TABLE "ACTIVE_RULES"( - "UUID" VARCHAR(40) NOT NULL, - "PROFILE_ID" INTEGER NOT NULL, - "PROFILE_UUID" VARCHAR(40) NOT NULL, - "RULE_ID" INTEGER NOT NULL, - "FAILURE_LEVEL" INTEGER NOT NULL, - "INHERITANCE" VARCHAR(10), - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT -); -ALTER TABLE "ACTIVE_RULES" ADD CONSTRAINT "PK_ACTIVE_RULES" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "UNIQ_PROFILE_RULE_IDS" ON "ACTIVE_RULES"("PROFILE_UUID", "RULE_ID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/fk/activerules/DropUniqueIndexOnProfileIdColumnOfActiveRulesTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/fk/activerules/DropUniqueIndexOnProfileIdColumnOfActiveRulesTableTest/schema.sql deleted file mode 100644 index d7d0db7aa73..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/fk/activerules/DropUniqueIndexOnProfileIdColumnOfActiveRulesTableTest/schema.sql +++ /dev/null @@ -1,12 +0,0 @@ -CREATE TABLE "ACTIVE_RULES"( - "UUID" VARCHAR(40) NOT NULL, - "PROFILE_ID" INTEGER NOT NULL, - "PROFILE_UUID" VARCHAR(40), - "RULE_ID" INTEGER NOT NULL, - "FAILURE_LEVEL" INTEGER NOT NULL, - "INHERITANCE" VARCHAR(10), - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT -); -ALTER TABLE "ACTIVE_RULES" ADD CONSTRAINT "PK_ACTIVE_RULES" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "UNIQ_PROFILE_RULE_IDS" ON "ACTIVE_RULES"("PROFILE_ID", "RULE_ID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/fk/activerules/MakeActiveRulesProfileUuidColumnNotNullableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/fk/activerules/MakeActiveRulesProfileUuidColumnNotNullableTest/schema.sql deleted file mode 100644 index 161696a041f..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/fk/activerules/MakeActiveRulesProfileUuidColumnNotNullableTest/schema.sql +++ /dev/null @@ -1,26 +0,0 @@ -CREATE TABLE "RULES_PROFILES"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "UUID" VARCHAR(40) NOT NULL, - "NAME" VARCHAR(100) NOT NULL, - "LANGUAGE" VARCHAR(20), - "KEE" VARCHAR(255) NOT NULL, - "IS_BUILT_IN" BOOLEAN NOT NULL, - "RULES_UPDATED_AT" VARCHAR(100), - "CREATED_AT" TIMESTAMP, - "UPDATED_AT" TIMESTAMP -); -ALTER TABLE "RULES_PROFILES" ADD CONSTRAINT "PK_RULES_PROFILES" PRIMARY KEY("ID"); -CREATE UNIQUE INDEX "UNIQ_QPROF_KEY" ON "RULES_PROFILES"("KEE"); - -CREATE TABLE "ACTIVE_RULES"( - "UUID" VARCHAR(40) NOT NULL, - "PROFILE_ID" INTEGER NOT NULL, - "PROFILE_UUID" VARCHAR(40), - "RULE_ID" INTEGER NOT NULL, - "FAILURE_LEVEL" INTEGER NOT NULL, - "INHERITANCE" VARCHAR(10), - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT -); -ALTER TABLE "ACTIVE_RULES" ADD CONSTRAINT "PK_ACTIVE_RULES" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "UNIQ_PROFILE_RULE_IDS" ON "ACTIVE_RULES"("PROFILE_ID", "RULE_ID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/fk/activerules/PopulateActiveRulesProfileUuidTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/fk/activerules/PopulateActiveRulesProfileUuidTest/schema.sql deleted file mode 100644 index 161696a041f..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/fk/activerules/PopulateActiveRulesProfileUuidTest/schema.sql +++ /dev/null @@ -1,26 +0,0 @@ -CREATE TABLE "RULES_PROFILES"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "UUID" VARCHAR(40) NOT NULL, - "NAME" VARCHAR(100) NOT NULL, - "LANGUAGE" VARCHAR(20), - "KEE" VARCHAR(255) NOT NULL, - "IS_BUILT_IN" BOOLEAN NOT NULL, - "RULES_UPDATED_AT" VARCHAR(100), - "CREATED_AT" TIMESTAMP, - "UPDATED_AT" TIMESTAMP -); -ALTER TABLE "RULES_PROFILES" ADD CONSTRAINT "PK_RULES_PROFILES" PRIMARY KEY("ID"); -CREATE UNIQUE INDEX "UNIQ_QPROF_KEY" ON "RULES_PROFILES"("KEE"); - -CREATE TABLE "ACTIVE_RULES"( - "UUID" VARCHAR(40) NOT NULL, - "PROFILE_ID" INTEGER NOT NULL, - "PROFILE_UUID" VARCHAR(40), - "RULE_ID" INTEGER NOT NULL, - "FAILURE_LEVEL" INTEGER NOT NULL, - "INHERITANCE" VARCHAR(10), - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT -); -ALTER TABLE "ACTIVE_RULES" ADD CONSTRAINT "PK_ACTIVE_RULES" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "UNIQ_PROFILE_RULE_IDS" ON "ACTIVE_RULES"("PROFILE_ID", "RULE_ID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/fk/orgqprofiles/PopulateOrgQProfilesRulesProfileUuidTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/fk/orgqprofiles/PopulateOrgQProfilesRulesProfileUuidTest/schema.sql deleted file mode 100644 index a1781cb90cc..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/fk/orgqprofiles/PopulateOrgQProfilesRulesProfileUuidTest/schema.sql +++ /dev/null @@ -1,28 +0,0 @@ -CREATE TABLE "RULES_PROFILES"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "UUID" VARCHAR(40) NOT NULL, - "NAME" VARCHAR(100) NOT NULL, - "LANGUAGE" VARCHAR(20), - "KEE" VARCHAR(255) NOT NULL, - "IS_BUILT_IN" BOOLEAN NOT NULL, - "RULES_UPDATED_AT" VARCHAR(100), - "CREATED_AT" TIMESTAMP, - "UPDATED_AT" TIMESTAMP -); -ALTER TABLE "RULES_PROFILES" ADD CONSTRAINT "PK_RULES_PROFILES" PRIMARY KEY("ID"); -CREATE UNIQUE INDEX "UNIQ_QPROF_KEY" ON "RULES_PROFILES"("KEE"); - -CREATE TABLE "ORG_QPROFILES"( - "UUID" VARCHAR(255) NOT NULL, - "ORGANIZATION_UUID" VARCHAR(40) NOT NULL, - "RULES_PROFILE_UUID" VARCHAR(255) NOT NULL, - "PARENT_UUID" VARCHAR(255), - "LAST_USED" BIGINT, - "USER_UPDATED_AT" BIGINT, - "CREATED_AT" BIGINT NOT NULL, - "UPDATED_AT" BIGINT NOT NULL -); -ALTER TABLE "ORG_QPROFILES" ADD CONSTRAINT "PK_ORG_QPROFILES" PRIMARY KEY("UUID"); -CREATE INDEX "QPROFILES_ORG_UUID" ON "ORG_QPROFILES"("ORGANIZATION_UUID"); -CREATE INDEX "QPROFILES_RP_UUID" ON "ORG_QPROFILES"("RULES_PROFILE_UUID"); -CREATE INDEX "ORG_QPROFILES_PARENT_UUID" ON "ORG_QPROFILES"("PARENT_UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/fk/qprofilechanges/PopulateQProfileChangesRulesProfileUuidTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/fk/qprofilechanges/PopulateQProfileChangesRulesProfileUuidTest/schema.sql deleted file mode 100644 index 75148b62b24..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/rulesprofiles/fk/qprofilechanges/PopulateQProfileChangesRulesProfileUuidTest/schema.sql +++ /dev/null @@ -1,24 +0,0 @@ -CREATE TABLE "RULES_PROFILES"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "UUID" VARCHAR(40) NOT NULL, - "NAME" VARCHAR(100) NOT NULL, - "LANGUAGE" VARCHAR(20), - "KEE" VARCHAR(255) NOT NULL, - "IS_BUILT_IN" BOOLEAN NOT NULL, - "RULES_UPDATED_AT" VARCHAR(100), - "CREATED_AT" TIMESTAMP, - "UPDATED_AT" TIMESTAMP -); -ALTER TABLE "RULES_PROFILES" ADD CONSTRAINT "PK_RULES_PROFILES" PRIMARY KEY("ID"); -CREATE UNIQUE INDEX "UNIQ_QPROF_KEY" ON "RULES_PROFILES"("KEE"); - -CREATE TABLE "QPROFILE_CHANGES"( - "KEE" VARCHAR(40) NOT NULL, - "RULES_PROFILE_UUID" VARCHAR(255) NOT NULL, - "CHANGE_TYPE" VARCHAR(20) NOT NULL, - "USER_UUID" VARCHAR(255), - "CHANGE_DATA" CLOB(2147483647), - "CREATED_AT" BIGINT NOT NULL -); -ALTER TABLE "QPROFILE_CHANGES" ADD CONSTRAINT "PK_QPROFILE_CHANGES" PRIMARY KEY("KEE"); -CREATE INDEX "QP_CHANGES_RULES_PROFILE_UUID" ON "QPROFILE_CHANGES"("RULES_PROFILE_UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/snapshots/AddPrimaryKeyOnUuidColumnOfSnapshotsTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/snapshots/AddPrimaryKeyOnUuidColumnOfSnapshotsTableTest/schema.sql deleted file mode 100644 index dcc23f6b586..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/snapshots/AddPrimaryKeyOnUuidColumnOfSnapshotsTableTest/schema.sql +++ /dev/null @@ -1,30 +0,0 @@ -CREATE TABLE "SNAPSHOTS"( - "ID" INTEGER NOT NULL, - "UUID" VARCHAR(50) NOT NULL, - "COMPONENT_UUID" VARCHAR(50) NOT NULL, - "STATUS" VARCHAR(4) DEFAULT 'U' NOT NULL, - "ISLAST" BOOLEAN DEFAULT FALSE NOT NULL, - "VERSION" VARCHAR(500), - "PURGE_STATUS" INTEGER, - "BUILD_STRING" VARCHAR(100), - "REVISION" VARCHAR(100), - "BUILD_DATE" BIGINT, - "PERIOD1_MODE" VARCHAR(100), - "PERIOD1_PARAM" VARCHAR(100), - "PERIOD2_MODE" VARCHAR(100), - "PERIOD2_PARAM" VARCHAR(100), - "PERIOD3_MODE" VARCHAR(100), - "PERIOD3_PARAM" VARCHAR(100), - "PERIOD4_MODE" VARCHAR(100), - "PERIOD4_PARAM" VARCHAR(100), - "PERIOD5_MODE" VARCHAR(100), - "PERIOD5_PARAM" VARCHAR(100), - "PERIOD1_DATE" BIGINT, - "PERIOD2_DATE" BIGINT, - "PERIOD3_DATE" BIGINT, - "PERIOD4_DATE" BIGINT, - "PERIOD5_DATE" BIGINT, - "CREATED_AT" BIGINT -); -CREATE UNIQUE INDEX "ANALYSES_UUID" ON "SNAPSHOTS"("UUID"); -CREATE INDEX "SNAPSHOT_COMPONENT" ON "SNAPSHOTS"("COMPONENT_UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/snapshots/DropIdColumnOfSnapshotsTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/snapshots/DropIdColumnOfSnapshotsTableTest/schema.sql deleted file mode 100644 index c1891409f11..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/snapshots/DropIdColumnOfSnapshotsTableTest/schema.sql +++ /dev/null @@ -1,31 +0,0 @@ -CREATE TABLE "SNAPSHOTS"( - "ID" INTEGER NOT NULL, - "UUID" VARCHAR(50) NOT NULL, - "COMPONENT_UUID" VARCHAR(50) NOT NULL, - "STATUS" VARCHAR(4) DEFAULT 'U' NOT NULL, - "ISLAST" BOOLEAN DEFAULT FALSE NOT NULL, - "VERSION" VARCHAR(500), - "PURGE_STATUS" INTEGER, - "BUILD_STRING" VARCHAR(100), - "REVISION" VARCHAR(100), - "BUILD_DATE" BIGINT, - "PERIOD1_MODE" VARCHAR(100), - "PERIOD1_PARAM" VARCHAR(100), - "PERIOD2_MODE" VARCHAR(100), - "PERIOD2_PARAM" VARCHAR(100), - "PERIOD3_MODE" VARCHAR(100), - "PERIOD3_PARAM" VARCHAR(100), - "PERIOD4_MODE" VARCHAR(100), - "PERIOD4_PARAM" VARCHAR(100), - "PERIOD5_MODE" VARCHAR(100), - "PERIOD5_PARAM" VARCHAR(100), - "PERIOD1_DATE" BIGINT, - "PERIOD2_DATE" BIGINT, - "PERIOD3_DATE" BIGINT, - "PERIOD4_DATE" BIGINT, - "PERIOD5_DATE" BIGINT, - "CREATED_AT" BIGINT -); -ALTER TABLE "SNAPSHOTS" ADD CONSTRAINT "PK_SNAPSHOTS" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "ANALYSES_UUID" ON "SNAPSHOTS"("UUID"); -CREATE INDEX "SNAPSHOT_COMPONENT" ON "SNAPSHOTS"("COMPONENT_UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/snapshots/DropPrimaryKeyOnIdColumnOfSnapshotsTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/snapshots/DropPrimaryKeyOnIdColumnOfSnapshotsTableTest/schema.sql deleted file mode 100644 index 3d3e2694b15..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/snapshots/DropPrimaryKeyOnIdColumnOfSnapshotsTableTest/schema.sql +++ /dev/null @@ -1,31 +0,0 @@ -CREATE TABLE "SNAPSHOTS"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "UUID" VARCHAR(50) NOT NULL, - "COMPONENT_UUID" VARCHAR(50) NOT NULL, - "STATUS" VARCHAR(4) DEFAULT 'U' NOT NULL, - "ISLAST" BOOLEAN DEFAULT FALSE NOT NULL, - "VERSION" VARCHAR(500), - "PURGE_STATUS" INTEGER, - "BUILD_STRING" VARCHAR(100), - "REVISION" VARCHAR(100), - "BUILD_DATE" BIGINT, - "PERIOD1_MODE" VARCHAR(100), - "PERIOD1_PARAM" VARCHAR(100), - "PERIOD2_MODE" VARCHAR(100), - "PERIOD2_PARAM" VARCHAR(100), - "PERIOD3_MODE" VARCHAR(100), - "PERIOD3_PARAM" VARCHAR(100), - "PERIOD4_MODE" VARCHAR(100), - "PERIOD4_PARAM" VARCHAR(100), - "PERIOD5_MODE" VARCHAR(100), - "PERIOD5_PARAM" VARCHAR(100), - "PERIOD1_DATE" BIGINT, - "PERIOD2_DATE" BIGINT, - "PERIOD3_DATE" BIGINT, - "PERIOD4_DATE" BIGINT, - "PERIOD5_DATE" BIGINT, - "CREATED_AT" BIGINT -); -ALTER TABLE "SNAPSHOTS" ADD CONSTRAINT "PK_SNAPSHOTS" PRIMARY KEY("ID"); -CREATE UNIQUE INDEX "ANALYSES_UUID" ON "SNAPSHOTS"("UUID"); -CREATE INDEX "SNAPSHOT_COMPONENT" ON "SNAPSHOTS"("COMPONENT_UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/userroles/AddPrimaryKeyOnUuidColumnOfUserRolesTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/userroles/AddPrimaryKeyOnUuidColumnOfUserRolesTableTest/schema.sql deleted file mode 100644 index 782ae4e6684..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/userroles/AddPrimaryKeyOnUuidColumnOfUserRolesTableTest/schema.sql +++ /dev/null @@ -1,10 +0,0 @@ -CREATE TABLE "USER_ROLES"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "UUID" VARCHAR(40) NOT NULL, - "ORGANIZATION_UUID" VARCHAR(40) NOT NULL, - "USER_ID" INTEGER, - "ROLE" VARCHAR(64) NOT NULL, - "COMPONENT_UUID" VARCHAR(40) -); -CREATE INDEX "USER_ROLES_USER" ON "USER_ROLES"("USER_ID"); -CREATE INDEX "USER_ROLES_COMPONENT_UUID" ON "USER_ROLES"("COMPONENT_UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/userroles/AddUuidColumnToUserRolesTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/userroles/AddUuidColumnToUserRolesTableTest/schema.sql deleted file mode 100644 index b30da4d7928..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/userroles/AddUuidColumnToUserRolesTableTest/schema.sql +++ /dev/null @@ -1,10 +0,0 @@ -CREATE TABLE "USER_ROLES"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "ORGANIZATION_UUID" VARCHAR(40) NOT NULL, - "USER_ID" INTEGER, - "ROLE" VARCHAR(64) NOT NULL, - "COMPONENT_UUID" VARCHAR(40) -); -ALTER TABLE "USER_ROLES" ADD CONSTRAINT "PK_USER_ROLES" PRIMARY KEY("ID"); -CREATE INDEX "USER_ROLES_USER" ON "USER_ROLES"("USER_ID"); -CREATE INDEX "USER_ROLES_COMPONENT_UUID" ON "USER_ROLES"("COMPONENT_UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/userroles/DropIdColumnOfUserRolesTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/userroles/DropIdColumnOfUserRolesTableTest/schema.sql deleted file mode 100644 index 334d2d2b80f..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/userroles/DropIdColumnOfUserRolesTableTest/schema.sql +++ /dev/null @@ -1,11 +0,0 @@ -CREATE TABLE "USER_ROLES"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "UUID" VARCHAR(40) NOT NULL, - "ORGANIZATION_UUID" VARCHAR(40) NOT NULL, - "USER_ID" INTEGER, - "ROLE" VARCHAR(64) NOT NULL, - "COMPONENT_UUID" VARCHAR(40) -); -ALTER TABLE "USER_ROLES" ADD CONSTRAINT "PK_USER_ROLES" PRIMARY KEY("UUID"); -CREATE INDEX "USER_ROLES_USER" ON "USER_ROLES"("USER_ID"); -CREATE INDEX "USER_ROLES_COMPONENT_UUID" ON "USER_ROLES"("COMPONENT_UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/userroles/DropPrimaryKeyOnIdColumnOfUserRolesTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/userroles/DropPrimaryKeyOnIdColumnOfUserRolesTableTest/schema.sql deleted file mode 100644 index 1970f132a00..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/userroles/DropPrimaryKeyOnIdColumnOfUserRolesTableTest/schema.sql +++ /dev/null @@ -1,11 +0,0 @@ -CREATE TABLE "USER_ROLES"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "UUID" VARCHAR(40) NOT NULL, - "ORGANIZATION_UUID" VARCHAR(40) NOT NULL, - "USER_ID" INTEGER, - "ROLE" VARCHAR(64) NOT NULL, - "COMPONENT_UUID" VARCHAR(40) -); -ALTER TABLE "USER_ROLES" ADD CONSTRAINT "PK_USER_ROLES" PRIMARY KEY("ID"); -CREATE INDEX "USER_ROLES_USER" ON "USER_ROLES"("USER_ID"); -CREATE INDEX "USER_ROLES_COMPONENT_UUID" ON "USER_ROLES"("COMPONENT_UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/userroles/MakeUserRolesUuidColumnNotNullableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/userroles/MakeUserRolesUuidColumnNotNullableTest/schema.sql deleted file mode 100644 index 80f78b06ede..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/userroles/MakeUserRolesUuidColumnNotNullableTest/schema.sql +++ /dev/null @@ -1,11 +0,0 @@ -CREATE TABLE "USER_ROLES"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "UUID" VARCHAR(40), - "ORGANIZATION_UUID" VARCHAR(40) NOT NULL, - "USER_ID" INTEGER, - "ROLE" VARCHAR(64) NOT NULL, - "COMPONENT_UUID" VARCHAR(40) -); -ALTER TABLE "USER_ROLES" ADD CONSTRAINT "PK_USER_ROLES" PRIMARY KEY("ID"); -CREATE INDEX "USER_ROLES_USER" ON "USER_ROLES"("USER_ID"); -CREATE INDEX "USER_ROLES_COMPONENT_UUID" ON "USER_ROLES"("COMPONENT_UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/userroles/PopulateUserRolesUuidTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/userroles/PopulateUserRolesUuidTest/schema.sql deleted file mode 100644 index 80f78b06ede..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/userroles/PopulateUserRolesUuidTest/schema.sql +++ /dev/null @@ -1,11 +0,0 @@ -CREATE TABLE "USER_ROLES"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "UUID" VARCHAR(40), - "ORGANIZATION_UUID" VARCHAR(40) NOT NULL, - "USER_ID" INTEGER, - "ROLE" VARCHAR(64) NOT NULL, - "COMPONENT_UUID" VARCHAR(40) -); -ALTER TABLE "USER_ROLES" ADD CONSTRAINT "PK_USER_ROLES" PRIMARY KEY("ID"); -CREATE INDEX "USER_ROLES_USER" ON "USER_ROLES"("USER_ID"); -CREATE INDEX "USER_ROLES_COMPONENT_UUID" ON "USER_ROLES"("COMPONENT_UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/AddPrimaryKeyOnUuidColumnOfUsersTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/AddPrimaryKeyOnUuidColumnOfUsersTableTest/schema.sql deleted file mode 100644 index 3b7668e51e3..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/AddPrimaryKeyOnUuidColumnOfUsersTableTest/schema.sql +++ /dev/null @@ -1,29 +0,0 @@ -CREATE TABLE "USERS"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "UUID" VARCHAR(255) NOT NULL, - "LOGIN" VARCHAR(255) NOT NULL, - "ORGANIZATION_UUID" VARCHAR(40), - "NAME" VARCHAR(200), - "EMAIL" VARCHAR(100), - "CRYPTED_PASSWORD" VARCHAR(100), - "SALT" VARCHAR(40), - "HASH_METHOD" VARCHAR(10), - "ACTIVE" BOOLEAN DEFAULT TRUE, - "SCM_ACCOUNTS" VARCHAR(4000), - "EXTERNAL_LOGIN" VARCHAR(255) NOT NULL, - "EXTERNAL_IDENTITY_PROVIDER" VARCHAR(100) NOT NULL, - "EXTERNAL_ID" VARCHAR(255) NOT NULL, - "IS_ROOT" BOOLEAN NOT NULL, - "USER_LOCAL" BOOLEAN, - "ONBOARDED" BOOLEAN NOT NULL, - "HOMEPAGE_TYPE" VARCHAR(40), - "HOMEPAGE_PARAMETER" VARCHAR(40), - "LAST_CONNECTION_DATE" BIGINT, - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT -); -CREATE UNIQUE INDEX "USERS_LOGIN" ON "USERS"("LOGIN"); -CREATE INDEX "USERS_UPDATED_AT" ON "USERS"("UPDATED_AT"); -CREATE UNIQUE INDEX "USERS_UUID" ON "USERS"("UUID"); -CREATE UNIQUE INDEX "UNIQ_EXTERNAL_ID" ON "USERS"("EXTERNAL_IDENTITY_PROVIDER", "EXTERNAL_ID"); -CREATE UNIQUE INDEX "UNIQ_EXTERNAL_LOGIN" ON "USERS"("EXTERNAL_IDENTITY_PROVIDER", "EXTERNAL_LOGIN"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/DropIdColumnOfUsersTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/DropIdColumnOfUsersTableTest/schema.sql deleted file mode 100644 index c1eab3c95ac..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/DropIdColumnOfUsersTableTest/schema.sql +++ /dev/null @@ -1,30 +0,0 @@ -CREATE TABLE "USERS"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "UUID" VARCHAR(255) NOT NULL, - "LOGIN" VARCHAR(255) NOT NULL, - "ORGANIZATION_UUID" VARCHAR(40), - "NAME" VARCHAR(200), - "EMAIL" VARCHAR(100), - "CRYPTED_PASSWORD" VARCHAR(100), - "SALT" VARCHAR(40), - "HASH_METHOD" VARCHAR(10), - "ACTIVE" BOOLEAN DEFAULT TRUE, - "SCM_ACCOUNTS" VARCHAR(4000), - "EXTERNAL_LOGIN" VARCHAR(255) NOT NULL, - "EXTERNAL_IDENTITY_PROVIDER" VARCHAR(100) NOT NULL, - "EXTERNAL_ID" VARCHAR(255) NOT NULL, - "IS_ROOT" BOOLEAN NOT NULL, - "USER_LOCAL" BOOLEAN, - "ONBOARDED" BOOLEAN NOT NULL, - "HOMEPAGE_TYPE" VARCHAR(40), - "HOMEPAGE_PARAMETER" VARCHAR(40), - "LAST_CONNECTION_DATE" BIGINT, - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT -); -ALTER TABLE "USERS" ADD CONSTRAINT "PK_USERS" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "USERS_LOGIN" ON "USERS"("LOGIN"); -CREATE INDEX "USERS_UPDATED_AT" ON "USERS"("UPDATED_AT"); -CREATE UNIQUE INDEX "USERS_UUID" ON "USERS"("UUID"); -CREATE UNIQUE INDEX "UNIQ_EXTERNAL_ID" ON "USERS"("EXTERNAL_IDENTITY_PROVIDER", "EXTERNAL_ID"); -CREATE UNIQUE INDEX "UNIQ_EXTERNAL_LOGIN" ON "USERS"("EXTERNAL_IDENTITY_PROVIDER", "EXTERNAL_LOGIN"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/DropPrimaryKeyOnIdColumnOfUsersTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/DropPrimaryKeyOnIdColumnOfUsersTableTest/schema.sql deleted file mode 100644 index 014607f5179..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/DropPrimaryKeyOnIdColumnOfUsersTableTest/schema.sql +++ /dev/null @@ -1,30 +0,0 @@ -CREATE TABLE "USERS"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "UUID" VARCHAR(255) NOT NULL, - "LOGIN" VARCHAR(255) NOT NULL, - "ORGANIZATION_UUID" VARCHAR(40), - "NAME" VARCHAR(200), - "EMAIL" VARCHAR(100), - "CRYPTED_PASSWORD" VARCHAR(100), - "SALT" VARCHAR(40), - "HASH_METHOD" VARCHAR(10), - "ACTIVE" BOOLEAN DEFAULT TRUE, - "SCM_ACCOUNTS" VARCHAR(4000), - "EXTERNAL_LOGIN" VARCHAR(255) NOT NULL, - "EXTERNAL_IDENTITY_PROVIDER" VARCHAR(100) NOT NULL, - "EXTERNAL_ID" VARCHAR(255) NOT NULL, - "IS_ROOT" BOOLEAN NOT NULL, - "USER_LOCAL" BOOLEAN, - "ONBOARDED" BOOLEAN NOT NULL, - "HOMEPAGE_TYPE" VARCHAR(40), - "HOMEPAGE_PARAMETER" VARCHAR(40), - "LAST_CONNECTION_DATE" BIGINT, - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT -); -ALTER TABLE "USERS" ADD CONSTRAINT "PK_USERS" PRIMARY KEY("ID"); -CREATE UNIQUE INDEX "USERS_LOGIN" ON "USERS"("LOGIN"); -CREATE INDEX "USERS_UPDATED_AT" ON "USERS"("UPDATED_AT"); -CREATE UNIQUE INDEX "USERS_UUID" ON "USERS"("UUID"); -CREATE UNIQUE INDEX "UNIQ_EXTERNAL_ID" ON "USERS"("EXTERNAL_IDENTITY_PROVIDER", "EXTERNAL_ID"); -CREATE UNIQUE INDEX "UNIQ_EXTERNAL_LOGIN" ON "USERS"("EXTERNAL_IDENTITY_PROVIDER", "EXTERNAL_LOGIN"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/DropUniqueIndexOnUuidColumnOfUsersTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/DropUniqueIndexOnUuidColumnOfUsersTableTest/schema.sql deleted file mode 100644 index 3b7668e51e3..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/DropUniqueIndexOnUuidColumnOfUsersTableTest/schema.sql +++ /dev/null @@ -1,29 +0,0 @@ -CREATE TABLE "USERS"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "UUID" VARCHAR(255) NOT NULL, - "LOGIN" VARCHAR(255) NOT NULL, - "ORGANIZATION_UUID" VARCHAR(40), - "NAME" VARCHAR(200), - "EMAIL" VARCHAR(100), - "CRYPTED_PASSWORD" VARCHAR(100), - "SALT" VARCHAR(40), - "HASH_METHOD" VARCHAR(10), - "ACTIVE" BOOLEAN DEFAULT TRUE, - "SCM_ACCOUNTS" VARCHAR(4000), - "EXTERNAL_LOGIN" VARCHAR(255) NOT NULL, - "EXTERNAL_IDENTITY_PROVIDER" VARCHAR(100) NOT NULL, - "EXTERNAL_ID" VARCHAR(255) NOT NULL, - "IS_ROOT" BOOLEAN NOT NULL, - "USER_LOCAL" BOOLEAN, - "ONBOARDED" BOOLEAN NOT NULL, - "HOMEPAGE_TYPE" VARCHAR(40), - "HOMEPAGE_PARAMETER" VARCHAR(40), - "LAST_CONNECTION_DATE" BIGINT, - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT -); -CREATE UNIQUE INDEX "USERS_LOGIN" ON "USERS"("LOGIN"); -CREATE INDEX "USERS_UPDATED_AT" ON "USERS"("UPDATED_AT"); -CREATE UNIQUE INDEX "USERS_UUID" ON "USERS"("UUID"); -CREATE UNIQUE INDEX "UNIQ_EXTERNAL_ID" ON "USERS"("EXTERNAL_IDENTITY_PROVIDER", "EXTERNAL_ID"); -CREATE UNIQUE INDEX "UNIQ_EXTERNAL_LOGIN" ON "USERS"("EXTERNAL_IDENTITY_PROVIDER", "EXTERNAL_LOGIN"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/groupsusers/AddIndexOnUserUuidOfGroupsUsersTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/groupsusers/AddIndexOnUserUuidOfGroupsUsersTableTest/schema.sql deleted file mode 100644 index 87f8c34ea67..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/groupsusers/AddIndexOnUserUuidOfGroupsUsersTableTest/schema.sql +++ /dev/null @@ -1,7 +0,0 @@ -CREATE TABLE "GROUPS_USERS"( - "USER_ID" BIGINT, - "GROUP_UUID" VARCHAR(40) NOT NULL, - "USER_UUID" VARCHAR(40) NOT NULL -); -CREATE INDEX "INDEX_GROUPS_USERS_GROUP_UUID" ON "GROUPS_USERS"("GROUP_UUID"); -CREATE UNIQUE INDEX "GROUPS_USERS_UNIQUE" ON "GROUPS_USERS"("GROUP_UUID", "USER_ID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/groupsusers/AddUniqueIndexOnUserUuidAndGroupIdOfGroupsUsersTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/groupsusers/AddUniqueIndexOnUserUuidAndGroupIdOfGroupsUsersTableTest/schema.sql deleted file mode 100644 index 98085c9b74d..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/groupsusers/AddUniqueIndexOnUserUuidAndGroupIdOfGroupsUsersTableTest/schema.sql +++ /dev/null @@ -1,7 +0,0 @@ -CREATE TABLE "GROUPS_USERS"( - "USER_ID" BIGINT, - "GROUP_UUID" VARCHAR(40) NOT NULL, - "USER_UUID" VARCHAR(40) NOT NULL -); -CREATE INDEX "INDEX_GROUPS_USERS_USER_UUID" ON "GROUPS_USERS"("USER_UUID"); -CREATE INDEX "INDEX_GROUPS_USERS_GROUP_UUID" ON "GROUPS_USERS"("GROUP_UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/groupsusers/AddUserUuidColumnToGroupsUsersTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/groupsusers/AddUserUuidColumnToGroupsUsersTest/schema.sql deleted file mode 100644 index a8f6820a912..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/groupsusers/AddUserUuidColumnToGroupsUsersTest/schema.sql +++ /dev/null @@ -1,7 +0,0 @@ -CREATE TABLE "GROUPS_USERS"( - "USER_ID" BIGINT, - "GROUP_UUID" VARCHAR(40) NOT NULL -); -CREATE INDEX "INDEX_GROUPS_USERS_ON_USER_ID" ON "GROUPS_USERS"("USER_ID"); -CREATE INDEX "INDEX_GROUPS_USERS_GROUP_UUID" ON "GROUPS_USERS"("GROUP_UUID"); -CREATE UNIQUE INDEX "GROUPS_USERS_UNIQUE" ON "GROUPS_USERS"("GROUP_UUID", "USER_ID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/groupsusers/DropIndexOnUserIdOfGroupsUsersTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/groupsusers/DropIndexOnUserIdOfGroupsUsersTableTest/schema.sql deleted file mode 100644 index e0a585dd66e..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/groupsusers/DropIndexOnUserIdOfGroupsUsersTableTest/schema.sql +++ /dev/null @@ -1,8 +0,0 @@ -CREATE TABLE "GROUPS_USERS"( - "USER_ID" BIGINT, - "GROUP_UUID" VARCHAR(40) NOT NULL, - "USER_UUID" VARCHAR(40) NOT NULL -); -CREATE INDEX "INDEX_GROUPS_USERS_ON_USER_ID" ON "GROUPS_USERS"("USER_ID"); -CREATE INDEX "INDEX_GROUPS_USERS_GROUP_UUID" ON "GROUPS_USERS"("GROUP_UUID"); -CREATE UNIQUE INDEX "GROUPS_USERS_UNIQUE" ON "GROUPS_USERS"("GROUP_UUID", "USER_ID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/groupsusers/DropUniqueIndexOnUserIdAndGroupIdOfGroupsUsersTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/groupsusers/DropUniqueIndexOnUserIdAndGroupIdOfGroupsUsersTableTest/schema.sql deleted file mode 100644 index b71880d2f10..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/groupsusers/DropUniqueIndexOnUserIdAndGroupIdOfGroupsUsersTableTest/schema.sql +++ /dev/null @@ -1,8 +0,0 @@ -CREATE TABLE "GROUPS_USERS"( - "USER_ID" BIGINT, - "GROUP_UUID" VARCHAR(40) NOT NULL, - "USER_UUID" VARCHAR(40) NOT NULL -); -CREATE INDEX "INDEX_GROUPS_USERS_USER_UUID" ON "GROUPS_USERS"("USER_UUID"); -CREATE INDEX "INDEX_GROUPS_USERS_GROUP_UUID" ON "GROUPS_USERS"("GROUP_UUID"); -CREATE UNIQUE INDEX "GROUPS_USERS_UNIQUE" ON "GROUPS_USERS"("GROUP_UUID", "USER_ID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/groupsusers/DropUserIdColumnOfGroupsUsersTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/groupsusers/DropUserIdColumnOfGroupsUsersTableTest/schema.sql deleted file mode 100644 index b74eac2c904..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/groupsusers/DropUserIdColumnOfGroupsUsersTableTest/schema.sql +++ /dev/null @@ -1,8 +0,0 @@ -CREATE TABLE "GROUPS_USERS"( - "USER_ID" BIGINT, - "GROUP_UUID" VARCHAR(40) NOT NULL, - "USER_UUID" VARCHAR(40) NOT NULL -); -CREATE INDEX "INDEX_GROUPS_USERS_USER_UUID" ON "GROUPS_USERS"("USER_UUID"); -CREATE INDEX "INDEX_GROUPS_USERS_GROUP_UUID" ON "GROUPS_USERS"("GROUP_UUID"); -CREATE UNIQUE INDEX "GROUPS_USERS_UNIQUE" ON "GROUPS_USERS"("GROUP_UUID", "USER_UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/groupsusers/MakeGroupsUsersUserUuidColumnNotNullableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/groupsusers/MakeGroupsUsersUserUuidColumnNotNullableTest/schema.sql deleted file mode 100644 index 167965e4750..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/groupsusers/MakeGroupsUsersUserUuidColumnNotNullableTest/schema.sql +++ /dev/null @@ -1,8 +0,0 @@ -CREATE TABLE "GROUPS_USERS"( - "USER_ID" BIGINT, - "GROUP_UUID" VARCHAR(40) NOT NULL, - "USER_UUID" VARCHAR(40) -); -CREATE INDEX "INDEX_GROUPS_USERS_ON_USER_ID" ON "GROUPS_USERS"("USER_ID"); -CREATE INDEX "INDEX_GROUPS_USERS_ON_GROUP_UUID" ON "GROUPS_USERS"("GROUP_UUID"); -CREATE UNIQUE INDEX "GROUPS_USERS_UNIQUE" ON "GROUPS_USERS"("GROUP_UUID", "USER_ID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/groupsusers/PopulateGroupsUsersUserUuidTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/groupsusers/PopulateGroupsUsersUserUuidTest/schema.sql deleted file mode 100644 index 38059ac5a3a..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/groupsusers/PopulateGroupsUsersUserUuidTest/schema.sql +++ /dev/null @@ -1,40 +0,0 @@ -CREATE TABLE "USERS"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "UUID" VARCHAR(255) NOT NULL, - "LOGIN" VARCHAR(255) NOT NULL, - "ORGANIZATION_UUID" VARCHAR(40), - "NAME" VARCHAR(200), - "EMAIL" VARCHAR(100), - "CRYPTED_PASSWORD" VARCHAR(100), - "SALT" VARCHAR(40), - "HASH_METHOD" VARCHAR(10), - "ACTIVE" BOOLEAN DEFAULT TRUE, - "SCM_ACCOUNTS" VARCHAR(4000), - "EXTERNAL_LOGIN" VARCHAR(255) NOT NULL, - "EXTERNAL_IDENTITY_PROVIDER" VARCHAR(100) NOT NULL, - "EXTERNAL_ID" VARCHAR(255) NOT NULL, - "IS_ROOT" BOOLEAN NOT NULL, - "USER_LOCAL" BOOLEAN, - "ONBOARDED" BOOLEAN NOT NULL, - "HOMEPAGE_TYPE" VARCHAR(40), - "HOMEPAGE_PARAMETER" VARCHAR(40), - "LAST_CONNECTION_DATE" BIGINT, - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT -); -ALTER TABLE "USERS" ADD CONSTRAINT "PK_USERS" PRIMARY KEY("ID"); -CREATE UNIQUE INDEX "USERS_LOGIN" ON "USERS"("LOGIN"); -CREATE INDEX "USERS_UPDATED_AT" ON "USERS"("UPDATED_AT"); -CREATE UNIQUE INDEX "USERS_UUID" ON "USERS"("UUID"); -CREATE UNIQUE INDEX "UNIQ_EXTERNAL_ID" ON "USERS"("EXTERNAL_IDENTITY_PROVIDER", "EXTERNAL_ID"); -CREATE UNIQUE INDEX "UNIQ_EXTERNAL_LOGIN" ON "USERS"("EXTERNAL_IDENTITY_PROVIDER", "EXTERNAL_LOGIN"); - - -CREATE TABLE "GROUPS_USERS"( - "USER_ID" BIGINT, - "GROUP_UUID" VARCHAR(40) NOT NULL, - "USER_UUID" VARCHAR(40) -); -CREATE INDEX "INDEX_GROUPS_USERS_ON_USER_ID" ON "GROUPS_USERS"("USER_ID"); -CREATE INDEX "INDEX_GROUPS_USERS_ON_GROUP_UUID" ON "GROUPS_USERS"("GROUP_UUID"); -CREATE UNIQUE INDEX "GROUPS_USERS_UNIQUE" ON "GROUPS_USERS"("GROUP_UUID", "USER_ID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/organizationmembers/AddIndexOnUserUuidOfOrganizationMembersTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/organizationmembers/AddIndexOnUserUuidOfOrganizationMembersTableTest/schema.sql deleted file mode 100644 index 20cd2336941..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/organizationmembers/AddIndexOnUserUuidOfOrganizationMembersTableTest/schema.sql +++ /dev/null @@ -1,7 +0,0 @@ -CREATE TABLE "ORGANIZATION_MEMBERS"( - "ORGANIZATION_UUID" VARCHAR(40) NOT NULL, - "USER_ID" INTEGER NOT NULL, - "USER_UUID" VARCHAR(40) NOT NULL, -); -ALTER TABLE "ORGANIZATION_MEMBERS" ADD CONSTRAINT "PK_ORGANIZATION_MEMBERS" PRIMARY KEY("ORGANIZATION_UUID", "USER_ID"); - diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/organizationmembers/AddPrimaryKeyOnUserUuidAndOrganizationUuidColumnsOfUserRolesTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/organizationmembers/AddPrimaryKeyOnUserUuidAndOrganizationUuidColumnsOfUserRolesTableTest/schema.sql deleted file mode 100644 index 3fa77611bd6..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/organizationmembers/AddPrimaryKeyOnUserUuidAndOrganizationUuidColumnsOfUserRolesTableTest/schema.sql +++ /dev/null @@ -1,7 +0,0 @@ -CREATE TABLE "ORGANIZATION_MEMBERS"( - "ORGANIZATION_UUID" VARCHAR(40) NOT NULL, - "USER_ID" INTEGER NOT NULL, - "USER_UUID" VARCHAR(40) NOT NULL, -); -CREATE INDEX "ORG_MEMBERS_ON_USER_ID" ON "ORGANIZATION_MEMBERS"("USER_UUID"); - diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/organizationmembers/AddUserUuidColumnToOrganizationMembersTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/organizationmembers/AddUserUuidColumnToOrganizationMembersTest/schema.sql deleted file mode 100644 index 1a0f1aa45a5..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/organizationmembers/AddUserUuidColumnToOrganizationMembersTest/schema.sql +++ /dev/null @@ -1,7 +0,0 @@ -CREATE TABLE "ORGANIZATION_MEMBERS"( - "ORGANIZATION_UUID" VARCHAR(40) NOT NULL, - "USER_ID" INTEGER NOT NULL -); -ALTER TABLE "ORGANIZATION_MEMBERS" ADD CONSTRAINT "PK_ORGANIZATION_MEMBERS" PRIMARY KEY("ORGANIZATION_UUID", "USER_ID"); -CREATE INDEX "IX_ORG_MEMBERS_ON_USER_ID" ON "ORGANIZATION_MEMBERS"("USER_ID"); - diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/organizationmembers/DropIndexOnUserIdOfOrganizationMembersTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/organizationmembers/DropIndexOnUserIdOfOrganizationMembersTableTest/schema.sql deleted file mode 100644 index 83a23943158..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/organizationmembers/DropIndexOnUserIdOfOrganizationMembersTableTest/schema.sql +++ /dev/null @@ -1,8 +0,0 @@ -CREATE TABLE "ORGANIZATION_MEMBERS"( - "ORGANIZATION_UUID" VARCHAR(40) NOT NULL, - "USER_ID" INTEGER NOT NULL, - "USER_UUID" VARCHAR(40) NOT NULL, -); -ALTER TABLE "ORGANIZATION_MEMBERS" ADD CONSTRAINT "PK_ORGANIZATION_MEMBERS" PRIMARY KEY("ORGANIZATION_UUID", "USER_ID"); -CREATE INDEX "IX_ORG_MEMBERS_ON_USER_ID" ON "ORGANIZATION_MEMBERS"("USER_ID"); - diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/organizationmembers/DropPrimaryKeyOnUserIdAndOrganizationUuidOfOrganizationMembersTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/organizationmembers/DropPrimaryKeyOnUserIdAndOrganizationUuidOfOrganizationMembersTableTest/schema.sql deleted file mode 100644 index e72612d2481..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/organizationmembers/DropPrimaryKeyOnUserIdAndOrganizationUuidOfOrganizationMembersTableTest/schema.sql +++ /dev/null @@ -1,8 +0,0 @@ -CREATE TABLE "ORGANIZATION_MEMBERS"( - "ORGANIZATION_UUID" VARCHAR(40) NOT NULL, - "USER_ID" INTEGER NOT NULL, - "USER_UUID" VARCHAR(40) NOT NULL, -); -ALTER TABLE "ORGANIZATION_MEMBERS" ADD CONSTRAINT "PK_ORGANIZATION_MEMBERS" PRIMARY KEY("ORGANIZATION_UUID", "USER_ID"); -CREATE INDEX "ORG_MEMBERS_ON_USER_UUID" ON "ORGANIZATION_MEMBERS"("USER_UUID"); - diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/organizationmembers/DropUserIdColumnOfOrganizationMembersTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/organizationmembers/DropUserIdColumnOfOrganizationMembersTableTest/schema.sql deleted file mode 100644 index 6f3084dc7ba..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/organizationmembers/DropUserIdColumnOfOrganizationMembersTableTest/schema.sql +++ /dev/null @@ -1,7 +0,0 @@ -CREATE TABLE "ORGANIZATION_MEMBERS"( - "ORGANIZATION_UUID" VARCHAR(40) NOT NULL, - "USER_ID" INTEGER NOT NULL, - "USER_UUID" VARCHAR(40) NOT NULL, -); -CREATE INDEX "ORG_MEMBERS_ON_USER_ID" ON "ORGANIZATION_MEMBERS"("USER_UUID"); -ALTER TABLE "ORGANIZATION_MEMBERS" ADD CONSTRAINT "PK_ORGANIZATION_MEMBERS" PRIMARY KEY("ORGANIZATION_UUID", "USER_UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/organizationmembers/MakeOrganizationMembersUserUuidColumnNotNullableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/organizationmembers/MakeOrganizationMembersUserUuidColumnNotNullableTest/schema.sql deleted file mode 100644 index 5951c00d434..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/organizationmembers/MakeOrganizationMembersUserUuidColumnNotNullableTest/schema.sql +++ /dev/null @@ -1,8 +0,0 @@ -CREATE TABLE "ORGANIZATION_MEMBERS"( - "ORGANIZATION_UUID" VARCHAR(40) NOT NULL, - "USER_ID" INTEGER NOT NULL, - "USER_UUID" VARCHAR(40), -); -ALTER TABLE "ORGANIZATION_MEMBERS" ADD CONSTRAINT "PK_ORGANIZATION_MEMBERS" PRIMARY KEY("ORGANIZATION_UUID", "USER_ID"); -CREATE INDEX "IX_ORG_MEMBERS_ON_USER_ID" ON "ORGANIZATION_MEMBERS"("USER_ID"); - diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/organizationmembers/PopulateOrganizationMembersUserUuidTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/organizationmembers/PopulateOrganizationMembersUserUuidTest/schema.sql deleted file mode 100644 index 3dbd7d9a215..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/organizationmembers/PopulateOrganizationMembersUserUuidTest/schema.sql +++ /dev/null @@ -1,40 +0,0 @@ -CREATE TABLE "USERS"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "UUID" VARCHAR(255) NOT NULL, - "LOGIN" VARCHAR(255) NOT NULL, - "ORGANIZATION_UUID" VARCHAR(40), - "NAME" VARCHAR(200), - "EMAIL" VARCHAR(100), - "CRYPTED_PASSWORD" VARCHAR(100), - "SALT" VARCHAR(40), - "HASH_METHOD" VARCHAR(10), - "ACTIVE" BOOLEAN DEFAULT TRUE, - "SCM_ACCOUNTS" VARCHAR(4000), - "EXTERNAL_LOGIN" VARCHAR(255) NOT NULL, - "EXTERNAL_IDENTITY_PROVIDER" VARCHAR(100) NOT NULL, - "EXTERNAL_ID" VARCHAR(255) NOT NULL, - "IS_ROOT" BOOLEAN NOT NULL, - "USER_LOCAL" BOOLEAN, - "ONBOARDED" BOOLEAN NOT NULL, - "HOMEPAGE_TYPE" VARCHAR(40), - "HOMEPAGE_PARAMETER" VARCHAR(40), - "LAST_CONNECTION_DATE" BIGINT, - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT -); -ALTER TABLE "USERS" ADD CONSTRAINT "PK_USERS" PRIMARY KEY("ID"); -CREATE UNIQUE INDEX "USERS_LOGIN" ON "USERS"("LOGIN"); -CREATE INDEX "USERS_UPDATED_AT" ON "USERS"("UPDATED_AT"); -CREATE UNIQUE INDEX "USERS_UUID" ON "USERS"("UUID"); -CREATE UNIQUE INDEX "UNIQ_EXTERNAL_ID" ON "USERS"("EXTERNAL_IDENTITY_PROVIDER", "EXTERNAL_ID"); -CREATE UNIQUE INDEX "UNIQ_EXTERNAL_LOGIN" ON "USERS"("EXTERNAL_IDENTITY_PROVIDER", "EXTERNAL_LOGIN"); - - -CREATE TABLE "ORGANIZATION_MEMBERS"( - "ORGANIZATION_UUID" VARCHAR(40) NOT NULL, - "USER_ID" INTEGER NOT NULL, - "USER_UUID" VARCHAR(40), -); -ALTER TABLE "ORGANIZATION_MEMBERS" ADD CONSTRAINT "PK_ORGANIZATION_MEMBERS" PRIMARY KEY("ORGANIZATION_UUID", "USER_ID"); -CREATE INDEX "IX_ORG_MEMBERS_ON_USER_ID" ON "ORGANIZATION_MEMBERS"("USER_ID"); - diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/permtemplatesusers/AddUserUuidColumnToPermTemplatesUsersTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/permtemplatesusers/AddUserUuidColumnToPermTemplatesUsersTest/schema.sql deleted file mode 100644 index 10b095f9b4a..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/permtemplatesusers/AddUserUuidColumnToPermTemplatesUsersTest/schema.sql +++ /dev/null @@ -1,9 +0,0 @@ -CREATE TABLE "PERM_TEMPLATES_USERS"( - "USER_ID" INTEGER NOT NULL, - "TEMPLATE_ID" INTEGER NOT NULL, - "PERMISSION_REFERENCE" VARCHAR(64) NOT NULL, - "CREATED_AT" TIMESTAMP, - "UPDATED_AT" TIMESTAMP, - "UUID" VARCHAR(40) NOT NULL -); -ALTER TABLE "PERM_TEMPLATES_USERS" ADD CONSTRAINT "PK_PERM_TEMPLATES_USERS" PRIMARY KEY("UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/permtemplatesusers/DropUserIdColumnOfPermTemplatesUsersTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/permtemplatesusers/DropUserIdColumnOfPermTemplatesUsersTableTest/schema.sql deleted file mode 100644 index fc2cdb8b524..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/permtemplatesusers/DropUserIdColumnOfPermTemplatesUsersTableTest/schema.sql +++ /dev/null @@ -1,11 +0,0 @@ -CREATE TABLE "PERM_TEMPLATES_USERS"( - "USER_ID" INTEGER NOT NULL, - "TEMPLATE_ID" INTEGER NOT NULL, - "PERMISSION_REFERENCE" VARCHAR(64) NOT NULL, - "CREATED_AT" TIMESTAMP, - "UPDATED_AT" TIMESTAMP, - "UUID" VARCHAR(40) NOT NULL, - "USER_UUID" VARCHAR(40) NOT NULL -); -ALTER TABLE "PERM_TEMPLATES_USERS" ADD CONSTRAINT "PK_PERM_TEMPLATES_USERS" PRIMARY KEY("UUID"); - diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/permtemplatesusers/MakePermTemplatesUsersUserUuidColumnNotNullableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/permtemplatesusers/MakePermTemplatesUsersUserUuidColumnNotNullableTest/schema.sql deleted file mode 100644 index 752db98d466..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/permtemplatesusers/MakePermTemplatesUsersUserUuidColumnNotNullableTest/schema.sql +++ /dev/null @@ -1,11 +0,0 @@ -CREATE TABLE "PERM_TEMPLATES_USERS"( - "USER_ID" INTEGER NOT NULL, - "TEMPLATE_ID" INTEGER NOT NULL, - "PERMISSION_REFERENCE" VARCHAR(64) NOT NULL, - "CREATED_AT" TIMESTAMP, - "UPDATED_AT" TIMESTAMP, - "UUID" VARCHAR(40) NOT NULL, - "USER_UUID" VARCHAR(40) -); -ALTER TABLE "PERM_TEMPLATES_USERS" ADD CONSTRAINT "PK_PERM_TEMPLATES_USERS" PRIMARY KEY("UUID"); - diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/permtemplatesusers/PopulatePermTemplatesUsersUserUuidTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/permtemplatesusers/PopulatePermTemplatesUsersUserUuidTest/schema.sql deleted file mode 100644 index cd73faec4b4..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/permtemplatesusers/PopulatePermTemplatesUsersUserUuidTest/schema.sql +++ /dev/null @@ -1,42 +0,0 @@ -CREATE TABLE "USERS"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "UUID" VARCHAR(255) NOT NULL, - "LOGIN" VARCHAR(255) NOT NULL, - "ORGANIZATION_UUID" VARCHAR(40), - "NAME" VARCHAR(200), - "EMAIL" VARCHAR(100), - "CRYPTED_PASSWORD" VARCHAR(100), - "SALT" VARCHAR(40), - "HASH_METHOD" VARCHAR(10), - "ACTIVE" BOOLEAN DEFAULT TRUE, - "SCM_ACCOUNTS" VARCHAR(4000), - "EXTERNAL_LOGIN" VARCHAR(255) NOT NULL, - "EXTERNAL_IDENTITY_PROVIDER" VARCHAR(100) NOT NULL, - "EXTERNAL_ID" VARCHAR(255) NOT NULL, - "IS_ROOT" BOOLEAN NOT NULL, - "USER_LOCAL" BOOLEAN, - "ONBOARDED" BOOLEAN NOT NULL, - "HOMEPAGE_TYPE" VARCHAR(40), - "HOMEPAGE_PARAMETER" VARCHAR(40), - "LAST_CONNECTION_DATE" BIGINT, - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT -); -ALTER TABLE "USERS" ADD CONSTRAINT "PK_USERS" PRIMARY KEY("ID"); -CREATE UNIQUE INDEX "USERS_LOGIN" ON "USERS"("LOGIN"); -CREATE INDEX "USERS_UPDATED_AT" ON "USERS"("UPDATED_AT"); -CREATE UNIQUE INDEX "USERS_UUID" ON "USERS"("UUID"); -CREATE UNIQUE INDEX "UNIQ_EXTERNAL_ID" ON "USERS"("EXTERNAL_IDENTITY_PROVIDER", "EXTERNAL_ID"); -CREATE UNIQUE INDEX "UNIQ_EXTERNAL_LOGIN" ON "USERS"("EXTERNAL_IDENTITY_PROVIDER", "EXTERNAL_LOGIN"); - -CREATE TABLE "PERM_TEMPLATES_USERS"( - "USER_ID" INTEGER NOT NULL, - "TEMPLATE_ID" INTEGER NOT NULL, - "PERMISSION_REFERENCE" VARCHAR(64) NOT NULL, - "CREATED_AT" TIMESTAMP, - "UPDATED_AT" TIMESTAMP, - "UUID" VARCHAR(40) NOT NULL, - "USER_UUID" VARCHAR(40) -); -ALTER TABLE "PERM_TEMPLATES_USERS" ADD CONSTRAINT "PK_PERM_TEMPLATES_USERS" PRIMARY KEY("UUID"); - diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/properties/AddUserUuidColumnToPropertiesUsersTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/properties/AddUserUuidColumnToPropertiesUsersTest/schema.sql deleted file mode 100644 index e63f2fb66c8..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/properties/AddUserUuidColumnToPropertiesUsersTest/schema.sql +++ /dev/null @@ -1,11 +0,0 @@ -CREATE TABLE "PROPERTIES"( - "UUID" VARCHAR(40) NOT NULL, - "PROP_KEY" VARCHAR(512) NOT NULL, - "IS_EMPTY" BOOLEAN NOT NULL, - "TEXT_VALUE" VARCHAR(4000), - "CLOB_VALUE" CLOB(2147483647), - "CREATED_AT" BIGINT NOT NULL, - "COMPONENT_UUID" VARCHAR(40) -); -ALTER TABLE "PROPERTIES" ADD CONSTRAINT "PK_PROPERTIES" PRIMARY KEY("UUID"); -CREATE INDEX "PROPERTIES_KEY" ON "PROPERTIES"("PROP_KEY"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/properties/DropUserIdColumnOfPropertiesTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/properties/DropUserIdColumnOfPropertiesTableTest/schema.sql deleted file mode 100644 index a3d1fbfeeea..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/properties/DropUserIdColumnOfPropertiesTableTest/schema.sql +++ /dev/null @@ -1,15 +0,0 @@ -CREATE TABLE "PROPERTIES"( - "UUID" VARCHAR(40) NOT NULL, - "PROP_KEY" VARCHAR(512) NOT NULL, - "USER_ID" INTEGER, - "IS_EMPTY" BOOLEAN NOT NULL, - "TEXT_VALUE" VARCHAR(4000), - "CLOB_VALUE" CLOB(2147483647), - "CREATED_AT" BIGINT NOT NULL, - "COMPONENT_UUID" VARCHAR(40), - "USER_UUID" VARCHAR(40) -); -ALTER TABLE "PROPERTIES" ADD CONSTRAINT "PK_PROPERTIES" PRIMARY KEY("UUID"); -CREATE INDEX "PROPERTIES_KEY" ON "PROPERTIES"("PROP_KEY"); - - diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/properties/PopulatePropertiesUserUuidTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/properties/PopulatePropertiesUserUuidTest/schema.sql deleted file mode 100644 index 7b392af768c..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/properties/PopulatePropertiesUserUuidTest/schema.sql +++ /dev/null @@ -1,44 +0,0 @@ -CREATE TABLE "USERS"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "UUID" VARCHAR(255) NOT NULL, - "LOGIN" VARCHAR(255) NOT NULL, - "ORGANIZATION_UUID" VARCHAR(40), - "NAME" VARCHAR(200), - "EMAIL" VARCHAR(100), - "CRYPTED_PASSWORD" VARCHAR(100), - "SALT" VARCHAR(40), - "HASH_METHOD" VARCHAR(10), - "ACTIVE" BOOLEAN DEFAULT TRUE, - "SCM_ACCOUNTS" VARCHAR(4000), - "EXTERNAL_LOGIN" VARCHAR(255) NOT NULL, - "EXTERNAL_IDENTITY_PROVIDER" VARCHAR(100) NOT NULL, - "EXTERNAL_ID" VARCHAR(255) NOT NULL, - "IS_ROOT" BOOLEAN NOT NULL, - "USER_LOCAL" BOOLEAN, - "ONBOARDED" BOOLEAN NOT NULL, - "HOMEPAGE_TYPE" VARCHAR(40), - "HOMEPAGE_PARAMETER" VARCHAR(40), - "LAST_CONNECTION_DATE" BIGINT, - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT -); -ALTER TABLE "USERS" ADD CONSTRAINT "PK_USERS" PRIMARY KEY("ID"); -CREATE UNIQUE INDEX "USERS_LOGIN" ON "USERS"("LOGIN"); -CREATE INDEX "USERS_UPDATED_AT" ON "USERS"("UPDATED_AT"); -CREATE UNIQUE INDEX "USERS_UUID" ON "USERS"("UUID"); -CREATE UNIQUE INDEX "UNIQ_EXTERNAL_ID" ON "USERS"("EXTERNAL_IDENTITY_PROVIDER", "EXTERNAL_ID"); -CREATE UNIQUE INDEX "UNIQ_EXTERNAL_LOGIN" ON "USERS"("EXTERNAL_IDENTITY_PROVIDER", "EXTERNAL_LOGIN"); - -CREATE TABLE "PROPERTIES"( - "UUID" VARCHAR(40) NOT NULL, - "PROP_KEY" VARCHAR(512) NOT NULL, - "USER_ID" INTEGER, - "IS_EMPTY" BOOLEAN NOT NULL, - "TEXT_VALUE" VARCHAR(4000), - "CLOB_VALUE" CLOB(2147483647), - "CREATED_AT" BIGINT NOT NULL, - "COMPONENT_UUID" VARCHAR(40), - "USER_UUID" VARCHAR(40) -); -ALTER TABLE "PROPERTIES" ADD CONSTRAINT "PK_PROPERTIES" PRIMARY KEY("UUID"); -CREATE INDEX "PROPERTIES_KEY" ON "PROPERTIES"("PROP_KEY"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/qprofileeditusers/AddUniqueIndexOnUserUuidAndQProfileUuidOfQProfileEditUsersTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/qprofileeditusers/AddUniqueIndexOnUserUuidAndQProfileUuidOfQProfileEditUsersTableTest/schema.sql deleted file mode 100644 index 6111eb1f8e1..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/qprofileeditusers/AddUniqueIndexOnUserUuidAndQProfileUuidOfQProfileEditUsersTableTest/schema.sql +++ /dev/null @@ -1,9 +0,0 @@ -CREATE TABLE "QPROFILE_EDIT_USERS"( - "UUID" VARCHAR(40) NOT NULL, - "USER_ID" INTEGER NOT NULL, - "QPROFILE_UUID" VARCHAR(255) NOT NULL, - "CREATED_AT" BIGINT NOT NULL, - "USER_UUID" VARCHAR(40) NOT NULL -); -ALTER TABLE "QPROFILE_EDIT_USERS" ADD CONSTRAINT "PK_QPROFILE_EDIT_USERS" PRIMARY KEY("UUID"); -CREATE INDEX "QPROFILE_EDIT_USERS_QPROFILE" ON "QPROFILE_EDIT_USERS"("QPROFILE_UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/qprofileeditusers/AddUserUuidColumnToQProfileEditUsersTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/qprofileeditusers/AddUserUuidColumnToQProfileEditUsersTest/schema.sql deleted file mode 100644 index 1149cf96ee7..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/qprofileeditusers/AddUserUuidColumnToQProfileEditUsersTest/schema.sql +++ /dev/null @@ -1,9 +0,0 @@ -CREATE TABLE "QPROFILE_EDIT_USERS"( - "UUID" VARCHAR(40) NOT NULL, - "USER_ID" INTEGER NOT NULL, - "QPROFILE_UUID" VARCHAR(255) NOT NULL, - "CREATED_AT" BIGINT NOT NULL -); -ALTER TABLE "QPROFILE_EDIT_USERS" ADD CONSTRAINT "PK_QPROFILE_EDIT_USERS" PRIMARY KEY("UUID"); -CREATE INDEX "QPROFILE_EDIT_USERS_QPROFILE" ON "QPROFILE_EDIT_USERS"("QPROFILE_UUID"); -CREATE UNIQUE INDEX "QPROFILE_EDIT_USERS_UNIQUE" ON "QPROFILE_EDIT_USERS"("USER_ID", "QPROFILE_UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/qprofileeditusers/DropUniqueIndexOnUserIdAndQProfileUuidOfQProfileEditUsersTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/qprofileeditusers/DropUniqueIndexOnUserIdAndQProfileUuidOfQProfileEditUsersTableTest/schema.sql deleted file mode 100644 index 94fa29f1c1a..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/qprofileeditusers/DropUniqueIndexOnUserIdAndQProfileUuidOfQProfileEditUsersTableTest/schema.sql +++ /dev/null @@ -1,10 +0,0 @@ -CREATE TABLE "QPROFILE_EDIT_USERS"( - "UUID" VARCHAR(40) NOT NULL, - "USER_ID" INTEGER NOT NULL, - "QPROFILE_UUID" VARCHAR(255) NOT NULL, - "CREATED_AT" BIGINT NOT NULL, - "USER_UUID" VARCHAR(40) NOT NULL -); -ALTER TABLE "QPROFILE_EDIT_USERS" ADD CONSTRAINT "PK_QPROFILE_EDIT_USERS" PRIMARY KEY("UUID"); -CREATE INDEX "QPROFILE_EDIT_USERS_QPROFILE" ON "QPROFILE_EDIT_USERS"("QPROFILE_UUID"); -CREATE UNIQUE INDEX "QPROFILE_EDIT_USERS_UNIQUE" ON "QPROFILE_EDIT_USERS"("USER_ID", "QPROFILE_UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/qprofileeditusers/DropUserIdColumnOfQProfileEditUsersTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/qprofileeditusers/DropUserIdColumnOfQProfileEditUsersTableTest/schema.sql deleted file mode 100644 index e1a14b02b7b..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/qprofileeditusers/DropUserIdColumnOfQProfileEditUsersTableTest/schema.sql +++ /dev/null @@ -1,10 +0,0 @@ -CREATE TABLE "QPROFILE_EDIT_USERS"( - "UUID" VARCHAR(40) NOT NULL, - "USER_ID" INTEGER NOT NULL, - "QPROFILE_UUID" VARCHAR(255) NOT NULL, - "CREATED_AT" BIGINT NOT NULL, - "USER_UUID" VARCHAR(40) NOT NULL -); -ALTER TABLE "QPROFILE_EDIT_USERS" ADD CONSTRAINT "PK_QPROFILE_EDIT_USERS" PRIMARY KEY("UUID"); -CREATE INDEX "QPROFILE_EDIT_USERS_QPROFILE" ON "QPROFILE_EDIT_USERS"("QPROFILE_UUID"); -CREATE UNIQUE INDEX "QPROFILE_EDIT_USERS_UNIQUE" ON "QPROFILE_EDIT_USERS"("USER_UUID", "QPROFILE_UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/qprofileeditusers/MakeQProfileEditUsersUserUuidColumnNotNullableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/qprofileeditusers/MakeQProfileEditUsersUserUuidColumnNotNullableTest/schema.sql deleted file mode 100644 index d1a00b9e64b..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/qprofileeditusers/MakeQProfileEditUsersUserUuidColumnNotNullableTest/schema.sql +++ /dev/null @@ -1,10 +0,0 @@ -CREATE TABLE "QPROFILE_EDIT_USERS"( - "UUID" VARCHAR(40) NOT NULL, - "USER_ID" INTEGER NOT NULL, - "QPROFILE_UUID" VARCHAR(255) NOT NULL, - "CREATED_AT" BIGINT NOT NULL, - "USER_UUID" VARCHAR(40) -); -ALTER TABLE "QPROFILE_EDIT_USERS" ADD CONSTRAINT "PK_QPROFILE_EDIT_USERS" PRIMARY KEY("UUID"); -CREATE INDEX "QPROFILE_EDIT_USERS_QPROFILE" ON "QPROFILE_EDIT_USERS"("QPROFILE_UUID"); -CREATE UNIQUE INDEX "QPROFILE_EDIT_USERS_UNIQUE" ON "QPROFILE_EDIT_USERS"("USER_ID", "QPROFILE_UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/qprofileeditusers/PopulateQProfileEditUsersUserUuidTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/qprofileeditusers/PopulateQProfileEditUsersUserUuidTest/schema.sql deleted file mode 100644 index d10b8b5184c..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/qprofileeditusers/PopulateQProfileEditUsersUserUuidTest/schema.sql +++ /dev/null @@ -1,41 +0,0 @@ -CREATE TABLE "USERS"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "UUID" VARCHAR(255) NOT NULL, - "LOGIN" VARCHAR(255) NOT NULL, - "ORGANIZATION_UUID" VARCHAR(40), - "NAME" VARCHAR(200), - "EMAIL" VARCHAR(100), - "CRYPTED_PASSWORD" VARCHAR(100), - "SALT" VARCHAR(40), - "HASH_METHOD" VARCHAR(10), - "ACTIVE" BOOLEAN DEFAULT TRUE, - "SCM_ACCOUNTS" VARCHAR(4000), - "EXTERNAL_LOGIN" VARCHAR(255) NOT NULL, - "EXTERNAL_IDENTITY_PROVIDER" VARCHAR(100) NOT NULL, - "EXTERNAL_ID" VARCHAR(255) NOT NULL, - "IS_ROOT" BOOLEAN NOT NULL, - "USER_LOCAL" BOOLEAN, - "ONBOARDED" BOOLEAN NOT NULL, - "HOMEPAGE_TYPE" VARCHAR(40), - "HOMEPAGE_PARAMETER" VARCHAR(40), - "LAST_CONNECTION_DATE" BIGINT, - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT -); -ALTER TABLE "USERS" ADD CONSTRAINT "PK_USERS" PRIMARY KEY("ID"); -CREATE UNIQUE INDEX "USERS_LOGIN" ON "USERS"("LOGIN"); -CREATE INDEX "USERS_UPDATED_AT" ON "USERS"("UPDATED_AT"); -CREATE UNIQUE INDEX "USERS_UUID" ON "USERS"("UUID"); -CREATE UNIQUE INDEX "UNIQ_EXTERNAL_ID" ON "USERS"("EXTERNAL_IDENTITY_PROVIDER", "EXTERNAL_ID"); -CREATE UNIQUE INDEX "UNIQ_EXTERNAL_LOGIN" ON "USERS"("EXTERNAL_IDENTITY_PROVIDER", "EXTERNAL_LOGIN"); - -CREATE TABLE "QPROFILE_EDIT_USERS"( - "UUID" VARCHAR(40) NOT NULL, - "USER_ID" INTEGER NOT NULL, - "QPROFILE_UUID" VARCHAR(255) NOT NULL, - "CREATED_AT" BIGINT NOT NULL, - "USER_UUID" VARCHAR(40) -); -ALTER TABLE "QPROFILE_EDIT_USERS" ADD CONSTRAINT "PK_QPROFILE_EDIT_USERS" PRIMARY KEY("UUID"); -CREATE INDEX "QPROFILE_EDIT_USERS_QPROFILE" ON "QPROFILE_EDIT_USERS"("QPROFILE_UUID"); -CREATE UNIQUE INDEX "QPROFILE_EDIT_USERS_UNIQUE" ON "QPROFILE_EDIT_USERS"("USER_ID", "QPROFILE_UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/userroles/AddIndexOnUserUuidOfUserRolesTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/userroles/AddIndexOnUserUuidOfUserRolesTableTest/schema.sql deleted file mode 100644 index fee4bf2e2c9..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/userroles/AddIndexOnUserUuidOfUserRolesTableTest/schema.sql +++ /dev/null @@ -1,10 +0,0 @@ -CREATE TABLE "USER_ROLES"( - "ORGANIZATION_UUID" VARCHAR(40) NOT NULL, - "USER_ID" INTEGER, - "ROLE" VARCHAR(64) NOT NULL, - "COMPONENT_UUID" VARCHAR(40), - "UUID" VARCHAR(40) NOT NULL, - "USER_UUID" VARCHAR(40) -); -ALTER TABLE "USER_ROLES" ADD CONSTRAINT "PK_USER_ROLES" PRIMARY KEY("UUID"); -CREATE INDEX "USER_ROLES_COMPONENT_UUID" ON "USER_ROLES"("COMPONENT_UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/userroles/AddUserUuidColumnToUserRolesTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/userroles/AddUserUuidColumnToUserRolesTest/schema.sql deleted file mode 100644 index b1619df129c..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/userroles/AddUserUuidColumnToUserRolesTest/schema.sql +++ /dev/null @@ -1,10 +0,0 @@ -CREATE TABLE "USER_ROLES"( - "ORGANIZATION_UUID" VARCHAR(40) NOT NULL, - "USER_ID" INTEGER, - "ROLE" VARCHAR(64) NOT NULL, - "COMPONENT_UUID" VARCHAR(40), - "UUID" VARCHAR(40) NOT NULL -); -ALTER TABLE "USER_ROLES" ADD CONSTRAINT "PK_USER_ROLES" PRIMARY KEY("UUID"); -CREATE INDEX "USER_ROLES_USER" ON "USER_ROLES"("USER_ID"); -CREATE INDEX "USER_ROLES_COMPONENT_UUID" ON "USER_ROLES"("COMPONENT_UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/userroles/DropIndexOnUserIdOfUserRolesTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/userroles/DropIndexOnUserIdOfUserRolesTableTest/schema.sql deleted file mode 100644 index 6080af78618..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/userroles/DropIndexOnUserIdOfUserRolesTableTest/schema.sql +++ /dev/null @@ -1,11 +0,0 @@ -CREATE TABLE "USER_ROLES"( - "ORGANIZATION_UUID" VARCHAR(40) NOT NULL, - "USER_ID" INTEGER, - "ROLE" VARCHAR(64) NOT NULL, - "COMPONENT_UUID" VARCHAR(40), - "UUID" VARCHAR(40) NOT NULL, - "USER_UUID" VARCHAR(40) -); -ALTER TABLE "USER_ROLES" ADD CONSTRAINT "PK_USER_ROLES" PRIMARY KEY("UUID"); -CREATE INDEX "USER_ROLES_USER" ON "USER_ROLES"("USER_ID"); -CREATE INDEX "USER_ROLES_COMPONENT_UUID" ON "USER_ROLES"("COMPONENT_UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/userroles/DropUserIdColumnOfUserRolesTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/userroles/DropUserIdColumnOfUserRolesTableTest/schema.sql deleted file mode 100644 index 6080af78618..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/userroles/DropUserIdColumnOfUserRolesTableTest/schema.sql +++ /dev/null @@ -1,11 +0,0 @@ -CREATE TABLE "USER_ROLES"( - "ORGANIZATION_UUID" VARCHAR(40) NOT NULL, - "USER_ID" INTEGER, - "ROLE" VARCHAR(64) NOT NULL, - "COMPONENT_UUID" VARCHAR(40), - "UUID" VARCHAR(40) NOT NULL, - "USER_UUID" VARCHAR(40) -); -ALTER TABLE "USER_ROLES" ADD CONSTRAINT "PK_USER_ROLES" PRIMARY KEY("UUID"); -CREATE INDEX "USER_ROLES_USER" ON "USER_ROLES"("USER_ID"); -CREATE INDEX "USER_ROLES_COMPONENT_UUID" ON "USER_ROLES"("COMPONENT_UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/userroles/PopulateUserRolesUserUuidTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/userroles/PopulateUserRolesUserUuidTest/schema.sql deleted file mode 100644 index a1ad51f0b38..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/users/fk/userroles/PopulateUserRolesUserUuidTest/schema.sql +++ /dev/null @@ -1,42 +0,0 @@ -CREATE TABLE "USERS"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "UUID" VARCHAR(255) NOT NULL, - "LOGIN" VARCHAR(255) NOT NULL, - "ORGANIZATION_UUID" VARCHAR(40), - "NAME" VARCHAR(200), - "EMAIL" VARCHAR(100), - "CRYPTED_PASSWORD" VARCHAR(100), - "SALT" VARCHAR(40), - "HASH_METHOD" VARCHAR(10), - "ACTIVE" BOOLEAN DEFAULT TRUE, - "SCM_ACCOUNTS" VARCHAR(4000), - "EXTERNAL_LOGIN" VARCHAR(255) NOT NULL, - "EXTERNAL_IDENTITY_PROVIDER" VARCHAR(100) NOT NULL, - "EXTERNAL_ID" VARCHAR(255) NOT NULL, - "IS_ROOT" BOOLEAN NOT NULL, - "USER_LOCAL" BOOLEAN, - "ONBOARDED" BOOLEAN NOT NULL, - "HOMEPAGE_TYPE" VARCHAR(40), - "HOMEPAGE_PARAMETER" VARCHAR(40), - "LAST_CONNECTION_DATE" BIGINT, - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT -); -ALTER TABLE "USERS" ADD CONSTRAINT "PK_USERS" PRIMARY KEY("ID"); -CREATE UNIQUE INDEX "USERS_LOGIN" ON "USERS"("LOGIN"); -CREATE INDEX "USERS_UPDATED_AT" ON "USERS"("UPDATED_AT"); -CREATE UNIQUE INDEX "USERS_UUID" ON "USERS"("UUID"); -CREATE UNIQUE INDEX "UNIQ_EXTERNAL_ID" ON "USERS"("EXTERNAL_IDENTITY_PROVIDER", "EXTERNAL_ID"); -CREATE UNIQUE INDEX "UNIQ_EXTERNAL_LOGIN" ON "USERS"("EXTERNAL_IDENTITY_PROVIDER", "EXTERNAL_LOGIN"); - -CREATE TABLE "USER_ROLES"( - "ORGANIZATION_UUID" VARCHAR(40) NOT NULL, - "USER_ID" INTEGER, - "ROLE" VARCHAR(64) NOT NULL, - "COMPONENT_UUID" VARCHAR(40), - "UUID" VARCHAR(40) NOT NULL, - "USER_UUID" VARCHAR(40) -); -ALTER TABLE "USER_ROLES" ADD CONSTRAINT "PK_USER_ROLES" PRIMARY KEY("UUID"); -CREATE INDEX "USER_ROLES_USER" ON "USER_ROLES"("USER_ID"); -CREATE INDEX "USER_ROLES_COMPONENT_UUID" ON "USER_ROLES"("COMPONENT_UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/usertokens/AddPrimaryKeyOnUuidColumnOfUserTokensTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/usertokens/AddPrimaryKeyOnUuidColumnOfUserTokensTableTest/schema.sql deleted file mode 100644 index ca5001f995a..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/usertokens/AddPrimaryKeyOnUuidColumnOfUserTokensTableTest/schema.sql +++ /dev/null @@ -1,11 +0,0 @@ -CREATE TABLE "USER_TOKENS"( - "ID" INTEGER NOT NULL, - "UUID" VARCHAR(40) NOT NULL, - "USER_UUID" VARCHAR(255) NOT NULL, - "NAME" VARCHAR(100) NOT NULL, - "TOKEN_HASH" VARCHAR(255) NOT NULL, - "LAST_CONNECTION_DATE" BIGINT, - "CREATED_AT" BIGINT NOT NULL -); -CREATE UNIQUE INDEX "USER_TOKENS_USER_UUID_NAME" ON "USER_TOKENS"("USER_UUID", "NAME"); -CREATE UNIQUE INDEX "USER_TOKENS_TOKEN_HASH" ON "USER_TOKENS"("TOKEN_HASH"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/usertokens/AddUuidColumnToUserTokensTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/usertokens/AddUuidColumnToUserTokensTest/schema.sql deleted file mode 100644 index 485c3d4f80c..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/usertokens/AddUuidColumnToUserTokensTest/schema.sql +++ /dev/null @@ -1,11 +0,0 @@ -CREATE TABLE "USER_TOKENS"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "USER_UUID" VARCHAR(255) NOT NULL, - "NAME" VARCHAR(100) NOT NULL, - "TOKEN_HASH" VARCHAR(255) NOT NULL, - "LAST_CONNECTION_DATE" BIGINT, - "CREATED_AT" BIGINT NOT NULL -); -ALTER TABLE "USER_TOKENS" ADD CONSTRAINT "PK_USER_TOKENS" PRIMARY KEY("ID"); -CREATE UNIQUE INDEX "USER_TOKENS_USER_UUID_NAME" ON "USER_TOKENS"("USER_UUID", "NAME"); -CREATE UNIQUE INDEX "USER_TOKENS_TOKEN_HASH" ON "USER_TOKENS"("TOKEN_HASH"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/usertokens/DropIdColumnOfUserTokensTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/usertokens/DropIdColumnOfUserTokensTableTest/schema.sql deleted file mode 100644 index 894ee4b0fc4..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/usertokens/DropIdColumnOfUserTokensTableTest/schema.sql +++ /dev/null @@ -1,12 +0,0 @@ -CREATE TABLE "USER_TOKENS"( - "ID" INTEGER NOT NULL, - "UUID" VARCHAR(40) NOT NULL, - "USER_UUID" VARCHAR(255) NOT NULL, - "NAME" VARCHAR(100) NOT NULL, - "TOKEN_HASH" VARCHAR(255) NOT NULL, - "LAST_CONNECTION_DATE" BIGINT, - "CREATED_AT" BIGINT NOT NULL -); -ALTER TABLE "USER_TOKENS" ADD CONSTRAINT "PK_USER_TOKENS" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "USER_TOKENS_USER_UUID_NAME" ON "USER_TOKENS"("USER_UUID", "NAME"); -CREATE UNIQUE INDEX "USER_TOKENS_TOKEN_HASH" ON "USER_TOKENS"("TOKEN_HASH"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/usertokens/DropPrimaryKeyOnIdColumnOfUserTokensTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/usertokens/DropPrimaryKeyOnIdColumnOfUserTokensTableTest/schema.sql deleted file mode 100644 index 485c3d4f80c..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/usertokens/DropPrimaryKeyOnIdColumnOfUserTokensTableTest/schema.sql +++ /dev/null @@ -1,11 +0,0 @@ -CREATE TABLE "USER_TOKENS"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "USER_UUID" VARCHAR(255) NOT NULL, - "NAME" VARCHAR(100) NOT NULL, - "TOKEN_HASH" VARCHAR(255) NOT NULL, - "LAST_CONNECTION_DATE" BIGINT, - "CREATED_AT" BIGINT NOT NULL -); -ALTER TABLE "USER_TOKENS" ADD CONSTRAINT "PK_USER_TOKENS" PRIMARY KEY("ID"); -CREATE UNIQUE INDEX "USER_TOKENS_USER_UUID_NAME" ON "USER_TOKENS"("USER_UUID", "NAME"); -CREATE UNIQUE INDEX "USER_TOKENS_TOKEN_HASH" ON "USER_TOKENS"("TOKEN_HASH"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/usertokens/MakeUserTokensUuidNotNullableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/usertokens/MakeUserTokensUuidNotNullableTest/schema.sql deleted file mode 100644 index df2072a73cb..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/usertokens/MakeUserTokensUuidNotNullableTest/schema.sql +++ /dev/null @@ -1,12 +0,0 @@ -CREATE TABLE "USER_TOKENS"( - "ID" INTEGER NOT NULL, - "UUID" VARCHAR(40), - "USER_UUID" VARCHAR(255) NOT NULL, - "NAME" VARCHAR(100) NOT NULL, - "TOKEN_HASH" VARCHAR(255) NOT NULL, - "LAST_CONNECTION_DATE" BIGINT, - "CREATED_AT" BIGINT NOT NULL -); -ALTER TABLE "USER_TOKENS" ADD CONSTRAINT "PK_USER_TOKENS" PRIMARY KEY("ID"); -CREATE UNIQUE INDEX "USER_TOKENS_USER_UUID_NAME" ON "USER_TOKENS"("USER_UUID", "NAME"); -CREATE UNIQUE INDEX "USER_TOKENS_TOKEN_HASH" ON "USER_TOKENS"("TOKEN_HASH"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/usertokens/PopulateUserTokensUuidTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/usertokens/PopulateUserTokensUuidTest/schema.sql deleted file mode 100644 index b4869dc5a9c..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v84/usertokens/PopulateUserTokensUuidTest/schema.sql +++ /dev/null @@ -1,12 +0,0 @@ -CREATE TABLE "USER_TOKENS"( - "ID" INTEGER NOT NULL AUTO_INCREMENT (1,1), - "UUID" VARCHAR(40), - "USER_UUID" VARCHAR(255) NOT NULL, - "NAME" VARCHAR(100) NOT NULL, - "TOKEN_HASH" VARCHAR(255) NOT NULL, - "LAST_CONNECTION_DATE" BIGINT, - "CREATED_AT" BIGINT NOT NULL -); -ALTER TABLE "USER_TOKENS" ADD CONSTRAINT "PK_USER_TOKENS" PRIMARY KEY("ID"); -CREATE UNIQUE INDEX "USER_TOKENS_USER_UUID_NAME" ON "USER_TOKENS"("USER_UUID", "NAME"); -CREATE UNIQUE INDEX "USER_TOKENS_TOKEN_HASH" ON "USER_TOKENS"("TOKEN_HASH"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/AddIndexOnIssueKeyForIssueChangesTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/AddIndexOnIssueKeyForIssueChangesTableTest/schema.sql deleted file mode 100644 index aaed9cd5d0a..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/AddIndexOnIssueKeyForIssueChangesTableTest/schema.sql +++ /dev/null @@ -1,13 +0,0 @@ -CREATE TABLE "ISSUE_CHANGES"( - "UUID" VARCHAR(40) NOT NULL, - "KEE" VARCHAR(50), - "ISSUE_KEY" VARCHAR(50) NOT NULL, - "USER_LOGIN" VARCHAR(255), - "CHANGE_TYPE" VARCHAR(20), - "CHANGE_DATA" CLOB, - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT, - "ISSUE_CHANGE_CREATION_DATE" BIGINT, - "PROJECT_UUID" VARCHAR(50) -); -ALTER TABLE "ISSUE_CHANGES" ADD CONSTRAINT "PK_ISSUE_CHANGES" PRIMARY KEY("UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/AddIndexOnKeeForIssueChangesTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/AddIndexOnKeeForIssueChangesTableTest/schema.sql deleted file mode 100644 index 46907cf96eb..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/AddIndexOnKeeForIssueChangesTableTest/schema.sql +++ /dev/null @@ -1,14 +0,0 @@ -CREATE TABLE "ISSUE_CHANGES"( - "UUID" VARCHAR(40) NOT NULL, - "KEE" VARCHAR(50), - "ISSUE_KEY" VARCHAR(50) NOT NULL, - "USER_LOGIN" VARCHAR(255), - "CHANGE_TYPE" VARCHAR(20), - "CHANGE_DATA" CLOB, - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT, - "ISSUE_CHANGE_CREATION_DATE" BIGINT, - "PROJECT_UUID" VARCHAR(50) -); -ALTER TABLE "ISSUE_CHANGES" ADD CONSTRAINT "PK_ISSUE_CHANGES" PRIMARY KEY("UUID"); -CREATE INDEX "ISSUE_CHANGES_ISSUE_KEY" ON "ISSUE_CHANGES"("ISSUE_KEY"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/AddIndexOnMessageTypeColumnOfCeTaskMessageTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/AddIndexOnMessageTypeColumnOfCeTaskMessageTableTest/schema.sql deleted file mode 100644 index 4200aab9747..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/AddIndexOnMessageTypeColumnOfCeTaskMessageTableTest/schema.sql +++ /dev/null @@ -1,9 +0,0 @@ -CREATE TABLE "CE_TASK_MESSAGE"( - "UUID" VARCHAR(40) NOT NULL, - "TASK_UUID" VARCHAR(40) NOT NULL, - "MESSAGE" VARCHAR(4000) NOT NULL, - "CREATED_AT" BIGINT NOT NULL, - "MESSAGE_TYPE" VARCHAR(255) NOT NULL -); -ALTER TABLE "CE_TASK_MESSAGE" ADD CONSTRAINT "PK_CE_TASK_MESSAGE" PRIMARY KEY("UUID"); -CREATE INDEX "CE_TASK_MESSAGE_TASK" ON "CE_TASK_MESSAGE"("TASK_UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/AddIndexOnProjectUuidOnIssueChangesTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/AddIndexOnProjectUuidOnIssueChangesTableTest/schema.sql deleted file mode 100644 index 7eb35b38156..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/AddIndexOnProjectUuidOnIssueChangesTableTest/schema.sql +++ /dev/null @@ -1,15 +0,0 @@ -CREATE TABLE "ISSUE_CHANGES"( - "UUID" VARCHAR(40) NOT NULL, - "KEE" VARCHAR(50), - "ISSUE_KEY" VARCHAR(50) NOT NULL, - "USER_LOGIN" VARCHAR(255), - "CHANGE_TYPE" VARCHAR(20), - "CHANGE_DATA" CLOB, - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT, - "ISSUE_CHANGE_CREATION_DATE" BIGINT, - "PROJECT_UUID" VARCHAR(50) -); -ALTER TABLE "ISSUE_CHANGES" ADD CONSTRAINT "PK_ISSUE_CHANGES" PRIMARY KEY("UUID"); -CREATE INDEX "ISSUE_CHANGES_ISSUE_KEY" ON "ISSUE_CHANGES"("ISSUE_KEY"); -CREATE INDEX "ISSUE_CHANGES_KEE" ON "ISSUE_CHANGES"("KEE"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/AddIsDismissibleColumnToCeTaskMessageTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/AddIsDismissibleColumnToCeTaskMessageTableTest/schema.sql deleted file mode 100644 index e3a716c9e4b..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/AddIsDismissibleColumnToCeTaskMessageTableTest/schema.sql +++ /dev/null @@ -1,8 +0,0 @@ -CREATE TABLE "CE_TASK_MESSAGE"( - "UUID" VARCHAR(40) NOT NULL, - "TASK_UUID" VARCHAR(40) NOT NULL, - "MESSAGE" VARCHAR(4000) NOT NULL, - "CREATED_AT" BIGINT NOT NULL -); -ALTER TABLE "CE_TASK_MESSAGE" ADD CONSTRAINT "PK_CE_TASK_MESSAGE" PRIMARY KEY("UUID"); -CREATE INDEX "CE_TASK_MESSAGE_TASK" ON "CE_TASK_MESSAGE"("TASK_UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/AddMessageTypeColumnToCeTaskMessageTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/AddMessageTypeColumnToCeTaskMessageTableTest/schema.sql deleted file mode 100644 index 67237e59da5..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/AddMessageTypeColumnToCeTaskMessageTableTest/schema.sql +++ /dev/null @@ -1,9 +0,0 @@ -CREATE TABLE "CE_TASK_MESSAGE" ( - "UUID" VARCHAR(40) NOT NULL, - "TASK_UUID" VARCHAR(40) NOT NULL, - "MESSAGE" VARCHAR(4000) NOT NULL, - "CREATED_AT" BIGINT NOT NULL, - - CONSTRAINT "CE_TASK_MESSAGE" PRIMARY KEY ("UUID") -); -CREATE INDEX "CE_TASK_MESSAGE_TASK" ON "CE_TASK_MESSAGE" ("TASK_UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/AddPrimaryKeyOnUuidForIssueChangesTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/AddPrimaryKeyOnUuidForIssueChangesTableTest/schema.sql deleted file mode 100644 index e712a9619ab..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/AddPrimaryKeyOnUuidForIssueChangesTableTest/schema.sql +++ /dev/null @@ -1,12 +0,0 @@ -CREATE TABLE "ISSUE_CHANGES"( - "UUID" VARCHAR(40) NOT NULL, - "KEE" VARCHAR(50), - "ISSUE_KEY" VARCHAR(50) NOT NULL, - "USER_LOGIN" VARCHAR(255), - "CHANGE_TYPE" VARCHAR(20), - "CHANGE_DATA" CLOB, - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT, - "ISSUE_CHANGE_CREATION_DATE" BIGINT, - "PROJECT_UUID" VARCHAR(50) -); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/AddTypeToPluginsTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/AddTypeToPluginsTest/schema.sql deleted file mode 100644 index c2a001fefdd..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/AddTypeToPluginsTest/schema.sql +++ /dev/null @@ -1,10 +0,0 @@ -CREATE TABLE "PLUGINS"( - "UUID" VARCHAR(40) NOT NULL, - "KEE" VARCHAR(200) NOT NULL, - "BASE_PLUGIN_KEY" VARCHAR(200), - "FILE_HASH" VARCHAR(200) NOT NULL, - "CREATED_AT" BIGINT NOT NULL, - "UPDATED_AT" BIGINT NOT NULL -); -ALTER TABLE "PLUGINS" ADD CONSTRAINT "PK_PLUGINS" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "PLUGINS_KEY" ON "PLUGINS"("KEE"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/AlterTypeInPluginNotNullableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/AlterTypeInPluginNotNullableTest/schema.sql deleted file mode 100644 index 3d438e8eaa8..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/AlterTypeInPluginNotNullableTest/schema.sql +++ /dev/null @@ -1,11 +0,0 @@ -CREATE TABLE "PLUGINS"( - "UUID" VARCHAR(40) NOT NULL, - "KEE" VARCHAR(200) NOT NULL, - "BASE_PLUGIN_KEY" VARCHAR(200), - "FILE_HASH" VARCHAR(200) NOT NULL, - "TYPE" VARCHAR(10), - "CREATED_AT" BIGINT NOT NULL, - "UPDATED_AT" BIGINT NOT NULL -); -ALTER TABLE "PLUGINS" ADD CONSTRAINT "PK_PLUGINS" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "PLUGINS_KEY" ON "PLUGINS"("KEE"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/CreateTmpIssueChangesTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/CreateTmpIssueChangesTableTest/schema.sql deleted file mode 100644 index 24310fbc986..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/CreateTmpIssueChangesTableTest/schema.sql +++ /dev/null @@ -1,53 +0,0 @@ -CREATE TABLE "ISSUE_CHANGES"( - "UUID" VARCHAR(40) NOT NULL, - "KEE" VARCHAR(50), - "ISSUE_KEY" VARCHAR(50) NOT NULL, - "USER_LOGIN" VARCHAR(255), - "CHANGE_TYPE" VARCHAR(20), - "CHANGE_DATA" CLOB, - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT, - "ISSUE_CHANGE_CREATION_DATE" BIGINT -); -ALTER TABLE "ISSUE_CHANGES" ADD CONSTRAINT "PK_ISSUE_CHANGES" PRIMARY KEY("UUID"); -CREATE INDEX "ISSUE_CHANGES_ISSUE_KEY" ON "ISSUE_CHANGES"("ISSUE_KEY"); -CREATE INDEX "ISSUE_CHANGES_KEE" ON "ISSUE_CHANGES"("KEE"); - -CREATE TABLE "ISSUES"( - "KEE" VARCHAR(50) NOT NULL, - "RULE_UUID" VARCHAR(40), - "SEVERITY" VARCHAR(10), - "MANUAL_SEVERITY" BOOLEAN NOT NULL, - "MESSAGE" VARCHAR(4000), - "LINE" INTEGER, - "GAP" DOUBLE, - "STATUS" VARCHAR(20), - "RESOLUTION" VARCHAR(20), - "CHECKSUM" VARCHAR(1000), - "REPORTER" VARCHAR(255), - "ASSIGNEE" VARCHAR(255), - "AUTHOR_LOGIN" VARCHAR(255), - "ACTION_PLAN_KEY" VARCHAR(50), - "ISSUE_ATTRIBUTES" VARCHAR(4000), - "EFFORT" INTEGER, - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT, - "ISSUE_CREATION_DATE" BIGINT, - "ISSUE_UPDATE_DATE" BIGINT, - "ISSUE_CLOSE_DATE" BIGINT, - "TAGS" VARCHAR(4000), - "COMPONENT_UUID" VARCHAR(50), - "PROJECT_UUID" VARCHAR(50), - "LOCATIONS" BLOB, - "ISSUE_TYPE" TINYINT, - "FROM_HOTSPOT" BOOLEAN -); -ALTER TABLE "ISSUES" ADD CONSTRAINT "PK_ISSUES" PRIMARY KEY("KEE"); -CREATE INDEX "ISSUES_ASSIGNEE" ON "ISSUES"("ASSIGNEE"); -CREATE INDEX "ISSUES_COMPONENT_UUID" ON "ISSUES"("COMPONENT_UUID"); -CREATE INDEX "ISSUES_CREATION_DATE" ON "ISSUES"("ISSUE_CREATION_DATE"); -CREATE UNIQUE INDEX "ISSUES_KEE" ON "ISSUES"("KEE"); -CREATE INDEX "ISSUES_PROJECT_UUID" ON "ISSUES"("PROJECT_UUID"); -CREATE INDEX "ISSUES_RESOLUTION" ON "ISSUES"("RESOLUTION"); -CREATE INDEX "ISSUES_UPDATED_AT" ON "ISSUES"("UPDATED_AT"); -CREATE INDEX "ISSUES_RULE_UUID" ON "ISSUES"("RULE_UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/DeleteProjectAlmSettingsOrphansTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/DeleteProjectAlmSettingsOrphansTest/schema.sql deleted file mode 100644 index 9f63206c4c5..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/DeleteProjectAlmSettingsOrphansTest/schema.sql +++ /dev/null @@ -1,30 +0,0 @@ -CREATE TABLE "PROJECTS"( - "UUID" VARCHAR(40) NOT NULL, - "KEE" VARCHAR(400) NOT NULL, - "QUALIFIER" VARCHAR(10) NOT NULL, - "ORGANIZATION_UUID" VARCHAR(40) NOT NULL, - "NAME" VARCHAR(2000), - "DESCRIPTION" VARCHAR(2000), - "PRIVATE" BOOLEAN NOT NULL, - "TAGS" VARCHAR(500), - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT NOT NULL -); -ALTER TABLE "PROJECTS" ADD CONSTRAINT "PK_NEW_PROJECTS" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "UNIQ_PROJECTS_KEE" ON "PROJECTS"("KEE"); -CREATE INDEX "IDX_QUALIFIER" ON "PROJECTS"("QUALIFIER"); - -CREATE TABLE "PROJECT_ALM_SETTINGS"( - "UUID" VARCHAR(40) NOT NULL, - "ALM_SETTING_UUID" VARCHAR(40) NOT NULL, - "PROJECT_UUID" VARCHAR(50) NOT NULL, - "ALM_REPO" VARCHAR(256), - "ALM_SLUG" VARCHAR(256), - "UPDATED_AT" BIGINT NOT NULL, - "CREATED_AT" BIGINT NOT NULL, - "SUMMARY_COMMENT_ENABLED" BOOLEAN -); -ALTER TABLE "PROJECT_ALM_SETTINGS" ADD CONSTRAINT "PK_PROJECT_ALM_SETTINGS" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "UNIQ_PROJECT_ALM_SETTINGS" ON "PROJECT_ALM_SETTINGS"("PROJECT_UUID"); -CREATE INDEX "PROJECT_ALM_SETTINGS_ALM" ON "PROJECT_ALM_SETTINGS"("ALM_SETTING_UUID"); -CREATE INDEX "PROJECT_ALM_SETTINGS_SLUG" ON "PROJECT_ALM_SETTINGS"("ALM_SLUG"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/DropIssueChangesTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/DropIssueChangesTableTest/schema.sql deleted file mode 100644 index f39bedb9f15..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/DropIssueChangesTableTest/schema.sql +++ /dev/null @@ -1,39 +0,0 @@ -CREATE TABLE "ISSUE_CHANGES"( - "ID" BIGINT NOT NULL AUTO_INCREMENT (1,1), - "KEE" VARCHAR(50), - "ISSUE_KEY" VARCHAR(50) NOT NULL, - "USER_LOGIN" VARCHAR(255), - "CHANGE_TYPE" VARCHAR(20), - "CHANGE_DATA" CLOB(2147483647), - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT, - "ISSUE_CHANGE_CREATION_DATE" BIGINT -); -CREATE INDEX "ISSUE_CHANGES_ISSUE_KEY" ON "ISSUE_CHANGES"("ISSUE_KEY"); -CREATE INDEX "ISSUE_CHANGES_KEE" ON "ISSUE_CHANGES"("KEE"); - -CREATE TABLE "TMP_ISSUE_CHANGES"( - "UUID" VARCHAR(40), - "KEE" VARCHAR(50), - "ISSUE_KEY" VARCHAR(50), - "USER_LOGIN" VARCHAR(255), - "CHANGE_TYPE" VARCHAR(20), - "CHANGE_DATA" CLOB(2147483647), - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT, - "PROJECT_UUID" VARCHAR(50), - "ISSUE_CHANGE_CREATION_DATE" BIGINT -); - -CREATE TABLE "ISSUE_CHANGES_COPY"( - "UUID" VARCHAR(40) NOT NULL, - "KEE" VARCHAR(50), - "ISSUE_KEY" VARCHAR(50) NOT NULL, - "USER_LOGIN" VARCHAR(255), - "CHANGE_TYPE" VARCHAR(20), - "CHANGE_DATA" CLOB(2147483647), - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT, - "ISSUE_CHANGE_CREATION_DATE" BIGINT -); - diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/DropOrphanFavoritesFromPropertiesTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/DropOrphanFavoritesFromPropertiesTest/schema.sql deleted file mode 100644 index eb6cd7f9a5c..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/DropOrphanFavoritesFromPropertiesTest/schema.sql +++ /dev/null @@ -1,12 +0,0 @@ -CREATE TABLE "PROPERTIES"( - "PROP_KEY" VARCHAR(512) NOT NULL, - "IS_EMPTY" BOOLEAN NOT NULL, - "TEXT_VALUE" VARCHAR(4000), - "CLOB_VALUE" CLOB(2147483647), - "CREATED_AT" BIGINT NOT NULL, - "COMPONENT_UUID" VARCHAR(40), - "UUID" VARCHAR(40) NOT NULL, - "USER_UUID" VARCHAR(255) -); -ALTER TABLE "PROPERTIES" ADD CONSTRAINT "PK_PROPERTIES" PRIMARY KEY("UUID"); -CREATE INDEX "PROPERTIES_KEY" ON "PROPERTIES"("PROP_KEY"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/DropPeriodAndValueWarningColumnsFromQualityGateConditionsTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/DropPeriodAndValueWarningColumnsFromQualityGateConditionsTableTest/schema.sql deleted file mode 100644 index 53249a51cc0..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/DropPeriodAndValueWarningColumnsFromQualityGateConditionsTableTest/schema.sql +++ /dev/null @@ -1,12 +0,0 @@ -CREATE TABLE "QUALITY_GATE_CONDITIONS"( - "PERIOD" INTEGER, - "OPERATOR" VARCHAR(3), - "VALUE_ERROR" VARCHAR(64), - "VALUE_WARNING" VARCHAR(64), - "CREATED_AT" TIMESTAMP, - "UPDATED_AT" TIMESTAMP, - "UUID" VARCHAR(40) NOT NULL, - "METRIC_UUID" VARCHAR(40) NOT NULL, - "QGATE_UUID" VARCHAR(40) NOT NULL -); -ALTER TABLE "QUALITY_GATE_CONDITIONS" ADD CONSTRAINT "PK_QUALITY_GATE_CONDITIONS" PRIMARY KEY("UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/DropProjectAlmBindingsTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/DropProjectAlmBindingsTest/schema.sql deleted file mode 100644 index aac315b35ac..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/DropProjectAlmBindingsTest/schema.sql +++ /dev/null @@ -1,13 +0,0 @@ -CREATE TABLE "PROJECT_ALM_BINDINGS"( - "UUID" VARCHAR(40) NOT NULL, - "ALM_ID" VARCHAR(40) NOT NULL, - "REPO_ID" VARCHAR(256) NOT NULL, - "PROJECT_UUID" VARCHAR(40) NOT NULL, - "GITHUB_SLUG" VARCHAR(256), - "URL" VARCHAR(2000) NOT NULL, - "CREATED_AT" BIGINT NOT NULL, - "UPDATED_AT" BIGINT NOT NULL -); -ALTER TABLE "PROJECT_ALM_BINDINGS" ADD CONSTRAINT "PK_PROJECT_ALM_BINDINGS" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "PROJECT_ALM_BINDINGS_ALM_REPO" ON "PROJECT_ALM_BINDINGS"("ALM_ID", "REPO_ID"); -CREATE UNIQUE INDEX "PROJECT_ALM_BINDINGS_PROJECT" ON "PROJECT_ALM_BINDINGS"("PROJECT_UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/DropProjectBranchesKeyTypeTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/DropProjectBranchesKeyTypeTest/schema.sql deleted file mode 100644 index 93927b5fb55..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/DropProjectBranchesKeyTypeTest/schema.sql +++ /dev/null @@ -1,16 +0,0 @@ -CREATE TABLE "PROJECT_BRANCHES"( - "UUID" VARCHAR(50) NOT NULL, - "PROJECT_UUID" VARCHAR(50) NOT NULL, - "KEE" VARCHAR(255) NOT NULL, - "BRANCH_TYPE" VARCHAR(12) NOT NULL, - "MERGE_BRANCH_UUID" VARCHAR(50), - "KEY_TYPE" VARCHAR(12) NOT NULL, - "PULL_REQUEST_BINARY" BLOB, - "MANUAL_BASELINE_ANALYSIS_UUID" VARCHAR(40), - "CREATED_AT" BIGINT NOT NULL, - "UPDATED_AT" BIGINT NOT NULL, - "EXCLUDE_FROM_PURGE" BOOLEAN DEFAULT FALSE NOT NULL, - "NEED_ISSUE_SYNC" BOOLEAN NOT NULL -); -ALTER TABLE "PROJECT_BRANCHES" ADD CONSTRAINT "PK_PROJECT_BRANCHES" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "PROJECT_BRANCHES_KEE_KEY_TYPE" ON "PROJECT_BRANCHES"("PROJECT_UUID", "KEE", "KEY_TYPE"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/DropUnusedIndexesTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/DropUnusedIndexesTest/schema.sql deleted file mode 100644 index 2f3316e177f..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/DropUnusedIndexesTest/schema.sql +++ /dev/null @@ -1,111 +0,0 @@ -CREATE TABLE "ALM_APP_INSTALLS"( - "UUID" VARCHAR(40) NOT NULL, - "ALM_ID" VARCHAR(40) NOT NULL, - "OWNER_ID" VARCHAR(4000) NOT NULL, - "INSTALL_ID" VARCHAR(4000) NOT NULL, - "IS_OWNER_USER" BOOLEAN NOT NULL, - "USER_EXTERNAL_ID" VARCHAR(255), - "CREATED_AT" BIGINT NOT NULL, - "UPDATED_AT" BIGINT NOT NULL -); -ALTER TABLE "ALM_APP_INSTALLS" ADD CONSTRAINT "PK_ALM_APP_INSTALLS" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "ALM_APP_INSTALLS_OWNER" ON "ALM_APP_INSTALLS"("ALM_ID", "OWNER_ID"); -CREATE UNIQUE INDEX "ALM_APP_INSTALLS_INSTALL" ON "ALM_APP_INSTALLS"("ALM_ID", "INSTALL_ID"); -CREATE INDEX "ALM_APP_INSTALLS_EXTERNAL_ID" ON "ALM_APP_INSTALLS"("USER_EXTERNAL_ID"); - -CREATE TABLE "USERS"( - "UUID" VARCHAR(255) NOT NULL, - "LOGIN" VARCHAR(255) NOT NULL, - "ORGANIZATION_UUID" VARCHAR(40), - "NAME" VARCHAR(200), - "EMAIL" VARCHAR(100), - "CRYPTED_PASSWORD" VARCHAR(100), - "SALT" VARCHAR(40), - "HASH_METHOD" VARCHAR(10), - "ACTIVE" BOOLEAN DEFAULT TRUE, - "SCM_ACCOUNTS" VARCHAR(4000), - "EXTERNAL_LOGIN" VARCHAR(255) NOT NULL, - "EXTERNAL_IDENTITY_PROVIDER" VARCHAR(100) NOT NULL, - "EXTERNAL_ID" VARCHAR(255) NOT NULL, - "IS_ROOT" BOOLEAN NOT NULL, - "USER_LOCAL" BOOLEAN, - "ONBOARDED" BOOLEAN NOT NULL, - "HOMEPAGE_TYPE" VARCHAR(40), - "HOMEPAGE_PARAMETER" VARCHAR(40), - "LAST_CONNECTION_DATE" BIGINT, - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT -); -ALTER TABLE "USERS" ADD CONSTRAINT "PK_USERS" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "USERS_LOGIN" ON "USERS"("LOGIN"); -CREATE INDEX "USERS_UPDATED_AT" ON "USERS"("UPDATED_AT"); -CREATE UNIQUE INDEX "UNIQ_EXTERNAL_ID" ON "USERS"("EXTERNAL_IDENTITY_PROVIDER", "EXTERNAL_ID"); -CREATE UNIQUE INDEX "UNIQ_EXTERNAL_LOGIN" ON "USERS"("EXTERNAL_IDENTITY_PROVIDER", "EXTERNAL_LOGIN"); - -CREATE TABLE "FILE_SOURCES"( - "PROJECT_UUID" VARCHAR(50) NOT NULL, - "FILE_UUID" VARCHAR(50) NOT NULL, - "LINE_HASHES" CLOB(2147483647), - "LINE_HASHES_VERSION" INTEGER, - "DATA_HASH" VARCHAR(50), - "SRC_HASH" VARCHAR(50), - "REVISION" VARCHAR(100), - "LINE_COUNT" INTEGER NOT NULL, - "BINARY_DATA" BLOB, - "CREATED_AT" BIGINT NOT NULL, - "UPDATED_AT" BIGINT NOT NULL, - "UUID" VARCHAR(40) NOT NULL -); -ALTER TABLE "FILE_SOURCES" ADD CONSTRAINT "PK_FILE_SOURCES" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "FILE_SOURCES_FILE_UUID" ON "FILE_SOURCES"("FILE_UUID"); -CREATE INDEX "FILE_SOURCES_PROJECT_UUID" ON "FILE_SOURCES"("PROJECT_UUID"); -CREATE INDEX "FILE_SOURCES_UPDATED_AT" ON "FILE_SOURCES"("UPDATED_AT"); - -CREATE TABLE "CE_ACTIVITY"( - "UUID" VARCHAR(40) NOT NULL, - "TASK_TYPE" VARCHAR(15) NOT NULL, - "MAIN_COMPONENT_UUID" VARCHAR(40), - "COMPONENT_UUID" VARCHAR(40), - "STATUS" VARCHAR(15) NOT NULL, - "MAIN_IS_LAST" BOOLEAN NOT NULL, - "MAIN_IS_LAST_KEY" VARCHAR(55) NOT NULL, - "IS_LAST" BOOLEAN NOT NULL, - "IS_LAST_KEY" VARCHAR(55) NOT NULL, - "SUBMITTER_UUID" VARCHAR(255), - "SUBMITTED_AT" BIGINT NOT NULL, - "STARTED_AT" BIGINT, - "EXECUTED_AT" BIGINT, - "EXECUTION_COUNT" INTEGER NOT NULL, - "EXECUTION_TIME_MS" BIGINT, - "ANALYSIS_UUID" VARCHAR(50), - "ERROR_MESSAGE" VARCHAR(1000), - "ERROR_STACKTRACE" CLOB(2147483647), - "ERROR_TYPE" VARCHAR(20), - "WORKER_UUID" VARCHAR(40), - "CREATED_AT" BIGINT NOT NULL, - "UPDATED_AT" BIGINT NOT NULL -); -ALTER TABLE "CE_ACTIVITY" ADD CONSTRAINT "PK_CE_ACTIVITY" PRIMARY KEY("UUID"); -CREATE INDEX "CE_ACTIVITY_COMPONENT" ON "CE_ACTIVITY"("COMPONENT_UUID"); -CREATE INDEX "CE_ACTIVITY_ISLAST" ON "CE_ACTIVITY"("IS_LAST", "STATUS"); -CREATE INDEX "CE_ACTIVITY_ISLAST_KEY" ON "CE_ACTIVITY"("IS_LAST_KEY"); -CREATE INDEX "CE_ACTIVITY_MAIN_COMPONENT" ON "CE_ACTIVITY"("MAIN_COMPONENT_UUID"); -CREATE INDEX "CE_ACTIVITY_MAIN_ISLAST" ON "CE_ACTIVITY"("MAIN_IS_LAST", "STATUS"); -CREATE INDEX "CE_ACTIVITY_MAIN_ISLAST_KEY" ON "CE_ACTIVITY"("MAIN_IS_LAST_KEY"); -CREATE UNIQUE INDEX "CE_ACTIVITY_UUID" ON "CE_ACTIVITY"("UUID"); - -CREATE TABLE "EVENTS"( - "UUID" VARCHAR(40) NOT NULL, - "ANALYSIS_UUID" VARCHAR(50) NOT NULL, - "NAME" VARCHAR(400), - "CATEGORY" VARCHAR(50), - "DESCRIPTION" VARCHAR(4000), - "EVENT_DATA" VARCHAR(4000), - "EVENT_DATE" BIGINT NOT NULL, - "CREATED_AT" BIGINT NOT NULL, - "COMPONENT_UUID" VARCHAR(50) NOT NULL -); -ALTER TABLE "EVENTS" ADD CONSTRAINT "PK_EVENTS" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "EVENTS_UUID" ON "EVENTS"("UUID"); -CREATE INDEX "EVENTS_ANALYSIS" ON "EVENTS"("ANALYSIS_UUID"); -CREATE INDEX "EVENTS_COMPONENT_UUID" ON "EVENTS"("COMPONENT_UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/DropUnusedPeriodsInSnapshotsTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/DropUnusedPeriodsInSnapshotsTest/schema.sql deleted file mode 100644 index 186c3b6bd6a..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/DropUnusedPeriodsInSnapshotsTest/schema.sql +++ /dev/null @@ -1,30 +0,0 @@ -CREATE TABLE "SNAPSHOTS"( - "UUID" VARCHAR(50) NOT NULL, - "COMPONENT_UUID" VARCHAR(50) NOT NULL, - "STATUS" VARCHAR(4) DEFAULT 'U' NOT NULL, - "ISLAST" BOOLEAN DEFAULT FALSE NOT NULL, - "VERSION" VARCHAR(500), - "PURGE_STATUS" INTEGER, - "BUILD_STRING" VARCHAR(100), - "REVISION" VARCHAR(100), - "BUILD_DATE" BIGINT, - "PERIOD1_MODE" VARCHAR(100), - "PERIOD1_PARAM" VARCHAR(100), - "PERIOD2_MODE" VARCHAR(100), - "PERIOD2_PARAM" VARCHAR(100), - "PERIOD3_MODE" VARCHAR(100), - "PERIOD3_PARAM" VARCHAR(100), - "PERIOD4_MODE" VARCHAR(100), - "PERIOD4_PARAM" VARCHAR(100), - "PERIOD5_MODE" VARCHAR(100), - "PERIOD5_PARAM" VARCHAR(100), - "PERIOD1_DATE" BIGINT, - "PERIOD2_DATE" BIGINT, - "PERIOD3_DATE" BIGINT, - "PERIOD4_DATE" BIGINT, - "PERIOD5_DATE" BIGINT, - "CREATED_AT" BIGINT -); -ALTER TABLE "SNAPSHOTS" ADD CONSTRAINT "PK_SNAPSHOTS" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "ANALYSES_UUID" ON "SNAPSHOTS"("UUID"); -CREATE INDEX "SNAPSHOT_COMPONENT" ON "SNAPSHOTS"("COMPONENT_UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/DropUnusedVariationsInProjectMeasuresTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/DropUnusedVariationsInProjectMeasuresTest/schema.sql deleted file mode 100644 index 7f14e31a89f..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/DropUnusedVariationsInProjectMeasuresTest/schema.sql +++ /dev/null @@ -1,21 +0,0 @@ -CREATE TABLE "PROJECT_MEASURES"( - "VALUE" DOUBLE, - "ANALYSIS_UUID" VARCHAR(50) NOT NULL, - "COMPONENT_UUID" VARCHAR(50) NOT NULL, - "TEXT_VALUE" VARCHAR(4000), - "ALERT_STATUS" VARCHAR(5), - "ALERT_TEXT" VARCHAR(4000), - "DESCRIPTION" VARCHAR(4000), - "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" BLOB, - "UUID" VARCHAR(40) NOT NULL, - "METRIC_UUID" VARCHAR(40) NOT NULL -); -ALTER TABLE "PROJECT_MEASURES" ADD CONSTRAINT "PK_PROJECT_MEASURES" PRIMARY KEY("UUID"); -CREATE INDEX "MEASURES_COMPONENT_UUID" ON "PROJECT_MEASURES"("COMPONENT_UUID"); -CREATE INDEX "MEASURES_ANALYSIS_METRIC" ON "PROJECT_MEASURES"("ANALYSIS_UUID", "METRIC_UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/FillProjectBranchesBranchTypeTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/FillProjectBranchesBranchTypeTest/schema.sql deleted file mode 100644 index 094c3286a05..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/FillProjectBranchesBranchTypeTest/schema.sql +++ /dev/null @@ -1,16 +0,0 @@ -CREATE TABLE "PROJECT_BRANCHES"( - "UUID" VARCHAR(50) NOT NULL, - "PROJECT_UUID" VARCHAR(50) NOT NULL, - "KEE" VARCHAR(255) NOT NULL, - "BRANCH_TYPE" VARCHAR(12), - "MERGE_BRANCH_UUID" VARCHAR(50), - "KEY_TYPE" VARCHAR(12) NOT NULL, - "PULL_REQUEST_BINARY" BLOB, - "MANUAL_BASELINE_ANALYSIS_UUID" VARCHAR(40), - "CREATED_AT" BIGINT NOT NULL, - "UPDATED_AT" BIGINT NOT NULL, - "EXCLUDE_FROM_PURGE" BOOLEAN DEFAULT FALSE NOT NULL, - "NEED_ISSUE_SYNC" BOOLEAN NOT NULL -); -ALTER TABLE "PROJECT_BRANCHES" ADD CONSTRAINT "PK_PROJECT_BRANCHES" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "PROJECT_BRANCHES_KEE_KEY_TYPE" ON "PROJECT_BRANCHES"("PROJECT_UUID", "KEE", "KEY_TYPE"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/MakeIsDismissibleColumnNotNullableOnCeTaskMessageTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/MakeIsDismissibleColumnNotNullableOnCeTaskMessageTableTest/schema.sql deleted file mode 100644 index 672cf3d9d73..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/MakeIsDismissibleColumnNotNullableOnCeTaskMessageTableTest/schema.sql +++ /dev/null @@ -1,9 +0,0 @@ -CREATE TABLE "CE_TASK_MESSAGE"( - "UUID" VARCHAR(40) NOT NULL, - "TASK_UUID" VARCHAR(40) NOT NULL, - "MESSAGE" VARCHAR(4000) NOT NULL, - "CREATED_AT" BIGINT NOT NULL, - "IS_DISMISSIBLE" BOOLEAN NOT NULL -); -ALTER TABLE "CE_TASK_MESSAGE" ADD CONSTRAINT "PK_CE_TASK_MESSAGE" PRIMARY KEY("UUID"); -CREATE INDEX "CE_TASK_MESSAGE_TASK" ON "CE_TASK_MESSAGE"("TASK_UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/MakeIssueKeyNotNullOnIssueChangesTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/MakeIssueKeyNotNullOnIssueChangesTableTest/schema.sql deleted file mode 100644 index 79ecb88e3e8..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/MakeIssueKeyNotNullOnIssueChangesTableTest/schema.sql +++ /dev/null @@ -1,12 +0,0 @@ -CREATE TABLE "ISSUE_CHANGES"( - "UUID" VARCHAR(40), - "KEE" VARCHAR(50), - "ISSUE_KEY" VARCHAR(50), - "USER_LOGIN" VARCHAR(255), - "CHANGE_TYPE" VARCHAR(20), - "CHANGE_DATA" CLOB, - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT, - "ISSUE_CHANGE_CREATION_DATE" BIGINT, - "PROJECT_UUID" VARCHAR(50) -); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/MakeMessageTypeColumnNotNullableOnCeTaskMessageTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/MakeMessageTypeColumnNotNullableOnCeTaskMessageTableTest/schema.sql deleted file mode 100644 index c46fbbfd8c6..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/MakeMessageTypeColumnNotNullableOnCeTaskMessageTableTest/schema.sql +++ /dev/null @@ -1,9 +0,0 @@ -CREATE TABLE "CE_TASK_MESSAGE"( - "UUID" VARCHAR(40) NOT NULL, - "TASK_UUID" VARCHAR(40) NOT NULL, - "MESSAGE" VARCHAR(4000) NOT NULL, - "CREATED_AT" BIGINT NOT NULL, - "MESSAGE_TYPE" VARCHAR(255) -); -ALTER TABLE "CE_TASK_MESSAGE" ADD CONSTRAINT "PK_CE_TASK_MESSAGE" PRIMARY KEY("UUID"); -CREATE INDEX "CE_TASK_MESSAGE_TASK" ON "CE_TASK_MESSAGE"("TASK_UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/MakeProjectBranchesBranchTypeNotNullableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/MakeProjectBranchesBranchTypeNotNullableTest/schema.sql deleted file mode 100644 index 094c3286a05..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/MakeProjectBranchesBranchTypeNotNullableTest/schema.sql +++ /dev/null @@ -1,16 +0,0 @@ -CREATE TABLE "PROJECT_BRANCHES"( - "UUID" VARCHAR(50) NOT NULL, - "PROJECT_UUID" VARCHAR(50) NOT NULL, - "KEE" VARCHAR(255) NOT NULL, - "BRANCH_TYPE" VARCHAR(12), - "MERGE_BRANCH_UUID" VARCHAR(50), - "KEY_TYPE" VARCHAR(12) NOT NULL, - "PULL_REQUEST_BINARY" BLOB, - "MANUAL_BASELINE_ANALYSIS_UUID" VARCHAR(40), - "CREATED_AT" BIGINT NOT NULL, - "UPDATED_AT" BIGINT NOT NULL, - "EXCLUDE_FROM_PURGE" BOOLEAN DEFAULT FALSE NOT NULL, - "NEED_ISSUE_SYNC" BOOLEAN NOT NULL -); -ALTER TABLE "PROJECT_BRANCHES" ADD CONSTRAINT "PK_PROJECT_BRANCHES" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "PROJECT_BRANCHES_KEE_KEY_TYPE" ON "PROJECT_BRANCHES"("PROJECT_UUID", "KEE", "KEY_TYPE"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/MakeProjectUuidNotNullOnIssueChangesTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/MakeProjectUuidNotNullOnIssueChangesTableTest/schema.sql deleted file mode 100644 index 917bb5a92fe..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/MakeProjectUuidNotNullOnIssueChangesTableTest/schema.sql +++ /dev/null @@ -1,12 +0,0 @@ -CREATE TABLE "ISSUE_CHANGES"( - "UUID" VARCHAR(40) NOT NULL, - "KEE" VARCHAR(50), - "ISSUE_KEY" VARCHAR(50) NOT NULL, - "USER_LOGIN" VARCHAR(255), - "CHANGE_TYPE" VARCHAR(20), - "CHANGE_DATA" CLOB, - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT, - "ISSUE_CHANGE_CREATION_DATE" BIGINT, - "PROJECT_UUID" VARCHAR(40) -); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/MakeUuidNotNullOnIssueChangesTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/MakeUuidNotNullOnIssueChangesTableTest/schema.sql deleted file mode 100644 index 66c414690f3..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/MakeUuidNotNullOnIssueChangesTableTest/schema.sql +++ /dev/null @@ -1,12 +0,0 @@ -CREATE TABLE "ISSUE_CHANGES"( - "UUID" VARCHAR(40), - "KEE" VARCHAR(50), - "ISSUE_KEY" VARCHAR(50) NOT NULL, - "USER_LOGIN" VARCHAR(255), - "CHANGE_TYPE" VARCHAR(20), - "CHANGE_DATA" CLOB, - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT, - "ISSUE_CHANGE_CREATION_DATE" BIGINT, - "PROJECT_UUID" VARCHAR(50) -); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/PopulateFileSourceLineCountTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/PopulateFileSourceLineCountTest/schema.sql deleted file mode 100644 index 261f2992115..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/PopulateFileSourceLineCountTest/schema.sql +++ /dev/null @@ -1,18 +0,0 @@ -CREATE TABLE "FILE_SOURCES"( - "PROJECT_UUID" VARCHAR(50) NOT NULL, - "FILE_UUID" VARCHAR(50) NOT NULL, - "LINE_HASHES" CLOB(2147483647), - "LINE_HASHES_VERSION" INTEGER, - "DATA_HASH" VARCHAR(50), - "SRC_HASH" VARCHAR(50), - "REVISION" VARCHAR(100), - "LINE_COUNT" INTEGER NOT NULL, - "BINARY_DATA" BLOB, - "CREATED_AT" BIGINT NOT NULL, - "UPDATED_AT" BIGINT NOT NULL, - "UUID" VARCHAR(40) NOT NULL -); -ALTER TABLE "FILE_SOURCES" ADD CONSTRAINT "PK_FILE_SOURCES" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "FILE_SOURCES_FILE_UUID" ON "FILE_SOURCES"("FILE_UUID"); -CREATE INDEX "FILE_SOURCES_PROJECT_UUID" ON "FILE_SOURCES"("PROJECT_UUID"); -CREATE INDEX "FILE_SOURCES_UPDATED_AT" ON "FILE_SOURCES"("UPDATED_AT"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/PopulateIsDismissibleColumnOfCeTaskMessageTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/PopulateIsDismissibleColumnOfCeTaskMessageTableTest/schema.sql deleted file mode 100644 index d5fcd2b20cd..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/PopulateIsDismissibleColumnOfCeTaskMessageTableTest/schema.sql +++ /dev/null @@ -1,9 +0,0 @@ -CREATE TABLE "CE_TASK_MESSAGE"( - "UUID" VARCHAR(40) NOT NULL, - "TASK_UUID" VARCHAR(40) NOT NULL, - "MESSAGE" VARCHAR(4000) NOT NULL, - "CREATED_AT" BIGINT NOT NULL, - "IS_DISMISSIBLE" BOOLEAN NULL -); -ALTER TABLE "CE_TASK_MESSAGE" ADD CONSTRAINT "PK_CE_TASK_MESSAGE" PRIMARY KEY("UUID"); -CREATE INDEX "CE_TASK_MESSAGE_TASK" ON "CE_TASK_MESSAGE"("TASK_UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/PopulateMessageTypeColumnOfCeTaskMessageTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/PopulateMessageTypeColumnOfCeTaskMessageTableTest/schema.sql deleted file mode 100644 index c46fbbfd8c6..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/PopulateMessageTypeColumnOfCeTaskMessageTableTest/schema.sql +++ /dev/null @@ -1,9 +0,0 @@ -CREATE TABLE "CE_TASK_MESSAGE"( - "UUID" VARCHAR(40) NOT NULL, - "TASK_UUID" VARCHAR(40) NOT NULL, - "MESSAGE" VARCHAR(4000) NOT NULL, - "CREATED_AT" BIGINT NOT NULL, - "MESSAGE_TYPE" VARCHAR(255) -); -ALTER TABLE "CE_TASK_MESSAGE" ADD CONSTRAINT "PK_CE_TASK_MESSAGE" PRIMARY KEY("UUID"); -CREATE INDEX "CE_TASK_MESSAGE_TASK" ON "CE_TASK_MESSAGE"("TASK_UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/PopulateTypeInPluginsTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/PopulateTypeInPluginsTest/schema.sql deleted file mode 100644 index 3d438e8eaa8..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/PopulateTypeInPluginsTest/schema.sql +++ /dev/null @@ -1,11 +0,0 @@ -CREATE TABLE "PLUGINS"( - "UUID" VARCHAR(40) NOT NULL, - "KEE" VARCHAR(200) NOT NULL, - "BASE_PLUGIN_KEY" VARCHAR(200), - "FILE_HASH" VARCHAR(200) NOT NULL, - "TYPE" VARCHAR(10), - "CREATED_AT" BIGINT NOT NULL, - "UPDATED_AT" BIGINT NOT NULL -); -ALTER TABLE "PLUGINS" ADD CONSTRAINT "PK_PLUGINS" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "PLUGINS_KEY" ON "PLUGINS"("KEE"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/RenameTmpIssueChangesToIssueChangesTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/RenameTmpIssueChangesToIssueChangesTest/schema.sql deleted file mode 100644 index 105176773ed..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v85/RenameTmpIssueChangesToIssueChangesTest/schema.sql +++ /dev/null @@ -1,12 +0,0 @@ -CREATE TABLE "TMP_ISSUE_CHANGES"( - "UUID" VARCHAR(40), - "KEE" VARCHAR(50), - "ISSUE_KEY" VARCHAR(50), - "USER_LOGIN" VARCHAR(255), - "CHANGE_TYPE" VARCHAR(20), - "CHANGE_DATA" CLOB, - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT, - "ISSUE_CHANGE_CREATION_DATE" BIGINT, - "PROJECT_UUID" VARCHAR(50) -); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v86/AddIndexToApplicationBranchProjsTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v86/AddIndexToApplicationBranchProjsTest/schema.sql deleted file mode 100644 index 845d2fd0b18..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v86/AddIndexToApplicationBranchProjsTest/schema.sql +++ /dev/null @@ -1,9 +0,0 @@ -CREATE TABLE "APP_BRANCH_PROJECT_BRANCH"( - "UUID" VARCHAR(40) NOT NULL, - "APPLICATION_UUID" VARCHAR(40) NOT NULL, - "APPLICATION_BRANCH_UUID" VARCHAR(40) NOT NULL, - "PROJECT_UUID" VARCHAR(40) NOT NULL, - "PROJECT_BRANCH_UUID" VARCHAR(40) NOT NULL, - "CREATED_AT" BIGINT NOT NULL -); -ALTER TABLE "APP_BRANCH_PROJECT_BRANCH" ADD CONSTRAINT "PK_APP_BRANCH_PROJECT_BRANCH" PRIMARY KEY("UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v86/AddIndexToApplicationProjectsTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v86/AddIndexToApplicationProjectsTest/schema.sql deleted file mode 100644 index 7c2627968a6..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v86/AddIndexToApplicationProjectsTest/schema.sql +++ /dev/null @@ -1,7 +0,0 @@ -CREATE TABLE "APP_PROJECTS"( - "UUID" VARCHAR(40) NOT NULL, - "APPLICATION_UUID" VARCHAR(40) NOT NULL, - "PROJECT_UUID" VARCHAR(40) NOT NULL, - "CREATED_AT" BIGINT NOT NULL -); -ALTER TABLE "APP_PROJECTS" ADD CONSTRAINT "PK_APP_PROJECTS" PRIMARY KEY("UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v86/AddPkToApplicationBranchProjsTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v86/AddPkToApplicationBranchProjsTest/schema.sql deleted file mode 100644 index 3270865158a..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v86/AddPkToApplicationBranchProjsTest/schema.sql +++ /dev/null @@ -1,8 +0,0 @@ -CREATE TABLE "APP_BRANCH_PROJECT_BRANCH"( - "UUID" VARCHAR(40) NOT NULL, - "APPLICATION_UUID" VARCHAR(40) NOT NULL, - "APPLICATION_BRANCH_UUID" VARCHAR(40) NOT NULL, - "PROJECT_UUID" VARCHAR(40) NOT NULL, - "PROJECT_BRANCH_UUID" VARCHAR(40) NOT NULL, - "CREATED_AT" BIGINT NOT NULL -); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v86/AddPkToApplicationProjectsTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v86/AddPkToApplicationProjectsTest/schema.sql deleted file mode 100644 index 3cb13c2066a..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v86/AddPkToApplicationProjectsTest/schema.sql +++ /dev/null @@ -1,6 +0,0 @@ -CREATE TABLE "APP_PROJECTS"( - "UUID" VARCHAR(40) NOT NULL, - "APPLICATION_UUID" VARCHAR(40) NOT NULL, - "PROJECT_UUID" VARCHAR(40) NOT NULL, - "CREATED_AT" BIGINT NOT NULL -); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v86/AddPrimaryKeyToDefaultQProfilesTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v86/AddPrimaryKeyToDefaultQProfilesTest/schema.sql deleted file mode 100644 index 6e5205d8d1f..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v86/AddPrimaryKeyToDefaultQProfilesTest/schema.sql +++ /dev/null @@ -1,7 +0,0 @@ -CREATE TABLE "DEFAULT_QPROFILES"( - "LANGUAGE" VARCHAR(20) NOT NULL, - "QPROFILE_UUID" VARCHAR(255) NOT NULL, - "CREATED_AT" BIGINT NOT NULL, - "UPDATED_AT" BIGINT NOT NULL -); -CREATE UNIQUE INDEX "UNIQ_DEFAULT_QPROFILES_UUID" ON "DEFAULT_QPROFILES"("QPROFILE_UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v86/AddResetPasswordColumnToUsersTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v86/AddResetPasswordColumnToUsersTest/schema.sql deleted file mode 100644 index 542deb026c8..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v86/AddResetPasswordColumnToUsersTest/schema.sql +++ /dev/null @@ -1,28 +0,0 @@ -CREATE TABLE "USERS"( - "UUID" VARCHAR(255) NOT NULL, - "LOGIN" VARCHAR(255) NOT NULL, - "NAME" VARCHAR(200), - "EMAIL" VARCHAR(100), - "CRYPTED_PASSWORD" VARCHAR(100), - "SALT" VARCHAR(40), - "HASH_METHOD" VARCHAR(10), - "ACTIVE" BOOLEAN DEFAULT TRUE, - "SCM_ACCOUNTS" VARCHAR(4000), - "EXTERNAL_LOGIN" VARCHAR(255) NOT NULL, - "EXTERNAL_IDENTITY_PROVIDER" VARCHAR(100) NOT NULL, - "EXTERNAL_ID" VARCHAR(255) NOT NULL, - "IS_ROOT" BOOLEAN NOT NULL, - "USER_LOCAL" BOOLEAN, - "ONBOARDED" BOOLEAN NOT NULL, - "HOMEPAGE_TYPE" VARCHAR(40), - "HOMEPAGE_PARAMETER" VARCHAR(40), - "LAST_CONNECTION_DATE" BIGINT, - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT -); -ALTER TABLE "USERS" ADD CONSTRAINT "PK_USERS" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "USERS_LOGIN" ON "USERS"("LOGIN"); -CREATE INDEX "USERS_UPDATED_AT" ON "USERS"("UPDATED_AT"); -CREATE UNIQUE INDEX "UNIQ_EXTERNAL_ID" ON "USERS"("EXTERNAL_IDENTITY_PROVIDER", "EXTERNAL_ID"); -CREATE UNIQUE INDEX "UNIQ_EXTERNAL_LOGIN" ON "USERS"("EXTERNAL_IDENTITY_PROVIDER", "EXTERNAL_LOGIN"); - diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v86/AddUniqueIndexOnNameColumnOfGroupsTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v86/AddUniqueIndexOnNameColumnOfGroupsTableTest/schema.sql deleted file mode 100644 index e573be04b87..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v86/AddUniqueIndexOnNameColumnOfGroupsTableTest/schema.sql +++ /dev/null @@ -1,8 +0,0 @@ -CREATE TABLE "GROUPS"( - "NAME" VARCHAR(500) NOT NULL, - "DESCRIPTION" VARCHAR(200), - "CREATED_AT" TIMESTAMP, - "UPDATED_AT" TIMESTAMP, - "UUID" VARCHAR(40) NOT NULL -); -ALTER TABLE "GROUPS" ADD CONSTRAINT "PK_GROUPS" PRIMARY KEY("UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v86/DropDefaultQProfilesPkTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v86/DropDefaultQProfilesPkTest/schema.sql deleted file mode 100644 index 85b059b64a1..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v86/DropDefaultQProfilesPkTest/schema.sql +++ /dev/null @@ -1,9 +0,0 @@ -CREATE TABLE "DEFAULT_QPROFILES"( - "ORGANIZATION_UUID" VARCHAR(40) NOT NULL, - "LANGUAGE" VARCHAR(20) NOT NULL, - "QPROFILE_UUID" VARCHAR(255) NOT NULL, - "CREATED_AT" BIGINT NOT NULL, - "UPDATED_AT" BIGINT NOT NULL -); -ALTER TABLE "DEFAULT_QPROFILES" ADD CONSTRAINT "PK_DEFAULT_QPROFILES" PRIMARY KEY("ORGANIZATION_UUID", "LANGUAGE"); -CREATE UNIQUE INDEX "UNIQ_DEFAULT_QPROFILES_UUID" ON "DEFAULT_QPROFILES"("QPROFILE_UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v86/DropOrganizationFromDefaultQProfilesTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v86/DropOrganizationFromDefaultQProfilesTest/schema.sql deleted file mode 100644 index c72d6748129..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v86/DropOrganizationFromDefaultQProfilesTest/schema.sql +++ /dev/null @@ -1,8 +0,0 @@ -CREATE TABLE "DEFAULT_QPROFILES"( - "ORGANIZATION_UUID" VARCHAR(40) NOT NULL, - "LANGUAGE" VARCHAR(20) NOT NULL, - "QPROFILE_UUID" VARCHAR(255) NOT NULL, - "CREATED_AT" BIGINT NOT NULL, - "UPDATED_AT" BIGINT NOT NULL -); -CREATE UNIQUE INDEX "UNIQ_DEFAULT_QPROFILES_UUID" ON "DEFAULT_QPROFILES"("QPROFILE_UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v86/DropOrganizationFromQualityProfileTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v86/DropOrganizationFromQualityProfileTableTest/schema.sql deleted file mode 100644 index 5c036b57764..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v86/DropOrganizationFromQualityProfileTableTest/schema.sql +++ /dev/null @@ -1,13 +0,0 @@ -CREATE TABLE "ORG_QPROFILES"( - "UUID" VARCHAR(255) NOT NULL, - "ORGANIZATION_UUID" VARCHAR(40) NOT NULL, - "RULES_PROFILE_UUID" VARCHAR(255) NOT NULL, - "PARENT_UUID" VARCHAR(255), - "LAST_USED" BIGINT, - "USER_UPDATED_AT" BIGINT, - "CREATED_AT" BIGINT NOT NULL, - "UPDATED_AT" BIGINT NOT NULL -); -ALTER TABLE "ORG_QPROFILES" ADD CONSTRAINT "PK_ORG_QPROFILES" PRIMARY KEY("UUID"); -CREATE INDEX "QPROFILES_RP_UUID" ON "ORG_QPROFILES"("RULES_PROFILE_UUID"); -CREATE INDEX "ORG_QPROFILES_PARENT_UUID" ON "ORG_QPROFILES"("PARENT_UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v86/DropOrganizationInGroupRolesTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v86/DropOrganizationInGroupRolesTest/schema.sql deleted file mode 100644 index 0a63c1e9aec..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v86/DropOrganizationInGroupRolesTest/schema.sql +++ /dev/null @@ -1,10 +0,0 @@ -CREATE TABLE "GROUP_ROLES"( - "ORGANIZATION_UUID" VARCHAR(40) NOT NULL, - "ROLE" VARCHAR(64) NOT NULL, - "COMPONENT_UUID" VARCHAR(40), - "UUID" VARCHAR(40) NOT NULL, - "GROUP_UUID" VARCHAR(40) -); -ALTER TABLE "GROUP_ROLES" ADD CONSTRAINT "PK_GROUP_ROLES" PRIMARY KEY("UUID"); -CREATE INDEX "GROUP_ROLES_COMPONENT_UUID" ON "GROUP_ROLES"("COMPONENT_UUID"); -CREATE UNIQUE INDEX "UNIQ_GROUP_ROLES" ON "GROUP_ROLES"("ORGANIZATION_UUID", "GROUP_UUID", "COMPONENT_UUID", "ROLE"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v86/DropOrganizationInGroupsTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v86/DropOrganizationInGroupsTest/schema.sql deleted file mode 100644 index 3f76dd2c610..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v86/DropOrganizationInGroupsTest/schema.sql +++ /dev/null @@ -1,9 +0,0 @@ -CREATE TABLE "GROUPS"( - "ORGANIZATION_UUID" VARCHAR(40) NOT NULL, - "NAME" VARCHAR(500), - "DESCRIPTION" VARCHAR(200), - "CREATED_AT" TIMESTAMP, - "UPDATED_AT" TIMESTAMP, - "UUID" VARCHAR(40) NOT NULL -); -ALTER TABLE "GROUPS" ADD CONSTRAINT "PK_GROUPS" PRIMARY KEY("UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v86/DropOrganizationInPermissionTemplatesTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v86/DropOrganizationInPermissionTemplatesTest/schema.sql deleted file mode 100644 index c9a2ab5a05c..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v86/DropOrganizationInPermissionTemplatesTest/schema.sql +++ /dev/null @@ -1,10 +0,0 @@ -CREATE TABLE "PERMISSION_TEMPLATES"( - "ORGANIZATION_UUID" VARCHAR(40) NOT NULL, - "NAME" VARCHAR(100) NOT NULL, - "DESCRIPTION" VARCHAR(4000), - "CREATED_AT" TIMESTAMP, - "UPDATED_AT" TIMESTAMP, - "KEY_PATTERN" VARCHAR(500), - "UUID" VARCHAR(40) NOT NULL -); -ALTER TABLE "PERMISSION_TEMPLATES" ADD CONSTRAINT "PK_PERMISSION_TEMPLATES" PRIMARY KEY("UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v86/DropOrganizationInRulesMetadataTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v86/DropOrganizationInRulesMetadataTest/schema.sql deleted file mode 100644 index a7137424d38..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v86/DropOrganizationInRulesMetadataTest/schema.sql +++ /dev/null @@ -1,19 +0,0 @@ -CREATE TABLE "RULES_METADATA"( - "ORGANIZATION_UUID" VARCHAR(40) NOT NULL, - "NOTE_DATA" CLOB, - "NOTE_USER_UUID" VARCHAR(255), - "NOTE_CREATED_AT" BIGINT, - "NOTE_UPDATED_AT" BIGINT, - "REMEDIATION_FUNCTION" VARCHAR(20), - "REMEDIATION_GAP_MULT" VARCHAR(20), - "REMEDIATION_BASE_EFFORT" VARCHAR(20), - "TAGS" VARCHAR(4000), - "AD_HOC_NAME" VARCHAR(200), - "AD_HOC_DESCRIPTION" CLOB, - "AD_HOC_SEVERITY" VARCHAR(10), - "AD_HOC_TYPE" TINYINT, - "CREATED_AT" BIGINT NOT NULL, - "UPDATED_AT" BIGINT NOT NULL, - "RULE_UUID" VARCHAR(40) NOT NULL -); -ALTER TABLE "RULES_METADATA" ADD CONSTRAINT "PK_RULES_METADATA" PRIMARY KEY("RULE_UUID", "ORGANIZATION_UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v86/DropOrganizationInUserRolesTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v86/DropOrganizationInUserRolesTest/schema.sql deleted file mode 100644 index 5acabc59b9e..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v86/DropOrganizationInUserRolesTest/schema.sql +++ /dev/null @@ -1,10 +0,0 @@ -CREATE TABLE "USER_ROLES"( - "ORGANIZATION_UUID" VARCHAR(40) NOT NULL, - "ROLE" VARCHAR(64) NOT NULL, - "COMPONENT_UUID" VARCHAR(40), - "UUID" VARCHAR(40) NOT NULL, - "USER_UUID" VARCHAR(255) -); -ALTER TABLE "USER_ROLES" ADD CONSTRAINT "PK_USER_ROLES" PRIMARY KEY("UUID"); -CREATE INDEX "USER_ROLES_COMPONENT_UUID" ON "USER_ROLES"("COMPONENT_UUID"); -CREATE INDEX "USER_ROLES_USER" ON "USER_ROLES"("USER_UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v86/DropOrganizationInUsersTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v86/DropOrganizationInUsersTest/schema.sql deleted file mode 100644 index b748aff7b53..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v86/DropOrganizationInUsersTest/schema.sql +++ /dev/null @@ -1,28 +0,0 @@ -CREATE TABLE "USERS"( - "UUID" VARCHAR(255) NOT NULL, - "LOGIN" VARCHAR(255) NOT NULL, - "ORGANIZATION_UUID" VARCHAR(40), - "NAME" VARCHAR(200), - "EMAIL" VARCHAR(100), - "CRYPTED_PASSWORD" VARCHAR(100), - "SALT" VARCHAR(40), - "HASH_METHOD" VARCHAR(10), - "ACTIVE" BOOLEAN DEFAULT TRUE, - "SCM_ACCOUNTS" VARCHAR(4000), - "EXTERNAL_LOGIN" VARCHAR(255) NOT NULL, - "EXTERNAL_IDENTITY_PROVIDER" VARCHAR(100) NOT NULL, - "EXTERNAL_ID" VARCHAR(255) NOT NULL, - "IS_ROOT" BOOLEAN NOT NULL, - "USER_LOCAL" BOOLEAN, - "ONBOARDED" BOOLEAN NOT NULL, - "HOMEPAGE_TYPE" VARCHAR(40), - "HOMEPAGE_PARAMETER" VARCHAR(40), - "LAST_CONNECTION_DATE" BIGINT, - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT -); -ALTER TABLE "USERS" ADD CONSTRAINT "PK_USERS" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "USERS_LOGIN" ON "USERS"("LOGIN"); -CREATE INDEX "USERS_UPDATED_AT" ON "USERS"("UPDATED_AT"); -CREATE UNIQUE INDEX "UNIQ_EXTERNAL_ID" ON "USERS"("EXTERNAL_IDENTITY_PROVIDER", "EXTERNAL_ID"); -CREATE UNIQUE INDEX "UNIQ_EXTERNAL_LOGIN" ON "USERS"("EXTERNAL_IDENTITY_PROVIDER", "EXTERNAL_LOGIN"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v86/DropOrganizationUuidIndexFromQualityProfileTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v86/DropOrganizationUuidIndexFromQualityProfileTableTest/schema.sql deleted file mode 100644 index 9aa88c12962..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v86/DropOrganizationUuidIndexFromQualityProfileTableTest/schema.sql +++ /dev/null @@ -1,15 +0,0 @@ - -CREATE TABLE "ORG_QPROFILES"( - "UUID" VARCHAR(255) NOT NULL, - "ORGANIZATION_UUID" VARCHAR(40) NOT NULL, - "RULES_PROFILE_UUID" VARCHAR(255) NOT NULL, - "PARENT_UUID" VARCHAR(255), - "LAST_USED" BIGINT, - "USER_UPDATED_AT" BIGINT, - "CREATED_AT" BIGINT NOT NULL, - "UPDATED_AT" BIGINT NOT NULL -); -ALTER TABLE "ORG_QPROFILES" ADD CONSTRAINT "PK_ORG_QPROFILES" PRIMARY KEY("UUID"); -CREATE INDEX "QPROFILES_ORG_UUID" ON "ORG_QPROFILES"("ORGANIZATION_UUID"); -CREATE INDEX "QPROFILES_RP_UUID" ON "ORG_QPROFILES"("RULES_PROFILE_UUID"); -CREATE INDEX "ORG_QPROFILES_PARENT_UUID" ON "ORG_QPROFILES"("PARENT_UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v86/MakeNameColumnInGroupsTableNotNullableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v86/MakeNameColumnInGroupsTableNotNullableTest/schema.sql deleted file mode 100644 index 2784c044c77..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v86/MakeNameColumnInGroupsTableNotNullableTest/schema.sql +++ /dev/null @@ -1,8 +0,0 @@ -CREATE TABLE "GROUPS"( - "NAME" VARCHAR(500), - "DESCRIPTION" VARCHAR(200), - "CREATED_AT" TIMESTAMP, - "UPDATED_AT" TIMESTAMP, - "UUID" VARCHAR(40) NOT NULL -); -ALTER TABLE "GROUPS" ADD CONSTRAINT "PK_GROUPS" PRIMARY KEY("UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v86/MakeResetPasswordColumnNotNullTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v86/MakeResetPasswordColumnNotNullTest/schema.sql deleted file mode 100644 index be6b1ef0e77..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v86/MakeResetPasswordColumnNotNullTest/schema.sql +++ /dev/null @@ -1,29 +0,0 @@ -CREATE TABLE "USERS"( - "UUID" VARCHAR(255) NOT NULL, - "LOGIN" VARCHAR(255) NOT NULL, - "NAME" VARCHAR(200), - "EMAIL" VARCHAR(100), - "CRYPTED_PASSWORD" VARCHAR(100), - "SALT" VARCHAR(40), - "HASH_METHOD" VARCHAR(10), - "ACTIVE" BOOLEAN DEFAULT TRUE, - "SCM_ACCOUNTS" VARCHAR(4000), - "EXTERNAL_LOGIN" VARCHAR(255) NOT NULL, - "EXTERNAL_IDENTITY_PROVIDER" VARCHAR(100) NOT NULL, - "EXTERNAL_ID" VARCHAR(255) NOT NULL, - "IS_ROOT" BOOLEAN NOT NULL, - "USER_LOCAL" BOOLEAN, - "ONBOARDED" BOOLEAN NOT NULL, - "RESET_PASSWORD" BOOLEAN, - "HOMEPAGE_TYPE" VARCHAR(40), - "HOMEPAGE_PARAMETER" VARCHAR(40), - "LAST_CONNECTION_DATE" BIGINT, - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT -); -ALTER TABLE "USERS" ADD CONSTRAINT "PK_USERS" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "USERS_LOGIN" ON "USERS"("LOGIN"); -CREATE INDEX "USERS_UPDATED_AT" ON "USERS"("UPDATED_AT"); -CREATE UNIQUE INDEX "UNIQ_EXTERNAL_ID" ON "USERS"("EXTERNAL_IDENTITY_PROVIDER", "EXTERNAL_ID"); -CREATE UNIQUE INDEX "UNIQ_EXTERNAL_LOGIN" ON "USERS"("EXTERNAL_IDENTITY_PROVIDER", "EXTERNAL_LOGIN"); - diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v86/MigrateApplicationDefinitionsFromXmlToDbTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v86/MigrateApplicationDefinitionsFromXmlToDbTest/schema.sql deleted file mode 100644 index dc3010a47b5..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v86/MigrateApplicationDefinitionsFromXmlToDbTest/schema.sql +++ /dev/null @@ -1,66 +0,0 @@ -CREATE TABLE "PROJECTS"( - "UUID" VARCHAR(40) NOT NULL, - "KEE" VARCHAR(400) NOT NULL, - "QUALIFIER" VARCHAR(10) NOT NULL, - "ORGANIZATION_UUID" VARCHAR(40) NOT NULL, - "NAME" VARCHAR(2000), - "DESCRIPTION" VARCHAR(2000), - "PRIVATE" BOOLEAN NOT NULL, - "TAGS" VARCHAR(500), - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT NOT NULL -); -ALTER TABLE "PROJECTS" ADD CONSTRAINT "PK_NEW_PROJECTS" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "UNIQ_PROJECTS_KEE" ON "PROJECTS"("KEE"); -CREATE INDEX "IDX_QUALIFIER" ON "PROJECTS"("QUALIFIER"); - -CREATE TABLE "PROJECT_BRANCHES"( - "UUID" VARCHAR(50) NOT NULL, - "PROJECT_UUID" VARCHAR(50) NOT NULL, - "KEE" VARCHAR(255) NOT NULL, - "BRANCH_TYPE" VARCHAR(12) NOT NULL, - "MERGE_BRANCH_UUID" VARCHAR(50), - "PULL_REQUEST_BINARY" BLOB, - "MANUAL_BASELINE_ANALYSIS_UUID" VARCHAR(40), - "CREATED_AT" BIGINT NOT NULL, - "UPDATED_AT" BIGINT NOT NULL, - "EXCLUDE_FROM_PURGE" BOOLEAN DEFAULT FALSE NOT NULL, - "NEED_ISSUE_SYNC" BOOLEAN NOT NULL -); -ALTER TABLE "PROJECT_BRANCHES" ADD CONSTRAINT "PK_PROJECT_BRANCHES" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "UNIQ_PROJECT_BRANCHES" ON "PROJECT_BRANCHES"("BRANCH_TYPE", "PROJECT_UUID", "KEE"); - -CREATE TABLE "INTERNAL_PROPERTIES"( - "KEE" VARCHAR(20) NOT NULL, - "IS_EMPTY" BOOLEAN NOT NULL, - "TEXT_VALUE" VARCHAR(4000), - "CLOB_VALUE" CLOB, - "CREATED_AT" BIGINT NOT NULL -); -ALTER TABLE "INTERNAL_PROPERTIES" ADD CONSTRAINT "PK_INTERNAL_PROPERTIES" PRIMARY KEY("KEE"); - -CREATE TABLE "APP_BRANCH_PROJECT_BRANCH"( - "UUID" VARCHAR(40) NOT NULL, - "APPLICATION_UUID" VARCHAR(40) NOT NULL, - "APPLICATION_BRANCH_UUID" VARCHAR(40) NOT NULL, - "PROJECT_UUID" VARCHAR(40) NOT NULL, - "PROJECT_BRANCH_UUID" VARCHAR(40) NOT NULL, - "CREATED_AT" BIGINT NOT NULL -); -ALTER TABLE "APP_BRANCH_PROJECT_BRANCH" ADD CONSTRAINT "PK_APP_BRANCH_PROJECT_BRANCH" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "UNIQ_APP_BRANCH_PROJ" ON "APP_BRANCH_PROJECT_BRANCH"("APPLICATION_BRANCH_UUID", "PROJECT_BRANCH_UUID"); -CREATE INDEX "IDX_ABPB_APP_UUID" ON "APP_BRANCH_PROJECT_BRANCH"("APPLICATION_UUID"); -CREATE INDEX "IDX_ABPB_APP_BRANCH_UUID" ON "APP_BRANCH_PROJECT_BRANCH"("APPLICATION_BRANCH_UUID"); -CREATE INDEX "IDX_ABPB_PROJ_UUID" ON "APP_BRANCH_PROJECT_BRANCH"("PROJECT_UUID"); -CREATE INDEX "IDX_ABPB_PROJ_BRANCH_UUID" ON "APP_BRANCH_PROJECT_BRANCH"("PROJECT_BRANCH_UUID"); - -CREATE TABLE "APP_PROJECTS"( - "UUID" VARCHAR(40) NOT NULL, - "APPLICATION_UUID" VARCHAR(40) NOT NULL, - "PROJECT_UUID" VARCHAR(40) NOT NULL, - "CREATED_AT" BIGINT NOT NULL -); -ALTER TABLE "APP_PROJECTS" ADD CONSTRAINT "PK_APP_PROJECTS" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "UNIQ_APP_PROJECTS" ON "APP_PROJECTS"("APPLICATION_UUID", "PROJECT_UUID"); -CREATE INDEX "IDX_APP_PROJ_APPLICATION_UUID" ON "APP_PROJECTS"("APPLICATION_UUID"); -CREATE INDEX "IDX_APP_PROJ_PROJECT_UUID" ON "APP_PROJECTS"("PROJECT_UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v86/MoveDefaultTemplatesToInternalPropertiesTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v86/MoveDefaultTemplatesToInternalPropertiesTest/schema.sql deleted file mode 100644 index a101d7797ce..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v86/MoveDefaultTemplatesToInternalPropertiesTest/schema.sql +++ /dev/null @@ -1,29 +0,0 @@ -CREATE TABLE "INTERNAL_PROPERTIES"( - "KEE" VARCHAR(20) NOT NULL, - "IS_EMPTY" BOOLEAN NOT NULL, - "TEXT_VALUE" VARCHAR(4000), - "CLOB_VALUE" CLOB, - "CREATED_AT" BIGINT NOT NULL -); -ALTER TABLE "INTERNAL_PROPERTIES" ADD CONSTRAINT "PK_INTERNAL_PROPERTIES" PRIMARY KEY("KEE"); - -CREATE TABLE "ORGANIZATIONS"( - "UUID" VARCHAR(40) NOT NULL, - "KEE" VARCHAR(255) NOT NULL, - "NAME" VARCHAR(255) NOT NULL, - "DESCRIPTION" VARCHAR(256), - "URL" VARCHAR(256), - "AVATAR_URL" VARCHAR(256), - "GUARDED" BOOLEAN, - "DEFAULT_QUALITY_GATE_UUID" VARCHAR(40) NOT NULL, - "DEFAULT_PERM_TEMPLATE_PROJECT" VARCHAR(40), - "DEFAULT_PERM_TEMPLATE_APP" VARCHAR(40), - "DEFAULT_PERM_TEMPLATE_PORT" VARCHAR(40), - "NEW_PROJECT_PRIVATE" BOOLEAN NOT NULL, - "SUBSCRIPTION" VARCHAR(40) NOT NULL, - "CREATED_AT" BIGINT NOT NULL, - "UPDATED_AT" BIGINT NOT NULL, - "DEFAULT_GROUP_UUID" VARCHAR(40) -); -ALTER TABLE "ORGANIZATIONS" ADD CONSTRAINT "PK_ORGANIZATIONS" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "ORGANIZATION_KEY" ON "ORGANIZATIONS"("KEE"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v86/PopulateResetPasswordDefaultValueTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v86/PopulateResetPasswordDefaultValueTest/schema.sql deleted file mode 100644 index be6b1ef0e77..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v86/PopulateResetPasswordDefaultValueTest/schema.sql +++ /dev/null @@ -1,29 +0,0 @@ -CREATE TABLE "USERS"( - "UUID" VARCHAR(255) NOT NULL, - "LOGIN" VARCHAR(255) NOT NULL, - "NAME" VARCHAR(200), - "EMAIL" VARCHAR(100), - "CRYPTED_PASSWORD" VARCHAR(100), - "SALT" VARCHAR(40), - "HASH_METHOD" VARCHAR(10), - "ACTIVE" BOOLEAN DEFAULT TRUE, - "SCM_ACCOUNTS" VARCHAR(4000), - "EXTERNAL_LOGIN" VARCHAR(255) NOT NULL, - "EXTERNAL_IDENTITY_PROVIDER" VARCHAR(100) NOT NULL, - "EXTERNAL_ID" VARCHAR(255) NOT NULL, - "IS_ROOT" BOOLEAN NOT NULL, - "USER_LOCAL" BOOLEAN, - "ONBOARDED" BOOLEAN NOT NULL, - "RESET_PASSWORD" BOOLEAN, - "HOMEPAGE_TYPE" VARCHAR(40), - "HOMEPAGE_PARAMETER" VARCHAR(40), - "LAST_CONNECTION_DATE" BIGINT, - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT -); -ALTER TABLE "USERS" ADD CONSTRAINT "PK_USERS" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "USERS_LOGIN" ON "USERS"("LOGIN"); -CREATE INDEX "USERS_UPDATED_AT" ON "USERS"("UPDATED_AT"); -CREATE UNIQUE INDEX "UNIQ_EXTERNAL_ID" ON "USERS"("EXTERNAL_IDENTITY_PROVIDER", "EXTERNAL_ID"); -CREATE UNIQUE INDEX "UNIQ_EXTERNAL_LOGIN" ON "USERS"("EXTERNAL_IDENTITY_PROVIDER", "EXTERNAL_LOGIN"); - diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v86/SecureGitlabSecretParametersTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v86/SecureGitlabSecretParametersTest/schema.sql deleted file mode 100644 index dfe931f54d1..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v86/SecureGitlabSecretParametersTest/schema.sql +++ /dev/null @@ -1,12 +0,0 @@ -CREATE TABLE "PROPERTIES"( - "PROP_KEY" VARCHAR(512) NOT NULL, - "IS_EMPTY" BOOLEAN NOT NULL, - "TEXT_VALUE" VARCHAR(4000), - "CLOB_VALUE" CLOB, - "CREATED_AT" BIGINT NOT NULL, - "COMPONENT_UUID" VARCHAR(40), - "UUID" VARCHAR(40) NOT NULL, - "USER_UUID" VARCHAR(255) -); -ALTER TABLE "PROPERTIES" ADD CONSTRAINT "PK_PROPERTIES" PRIMARY KEY("UUID"); -CREATE INDEX "PROPERTIES_KEY" ON "PROPERTIES"("PROP_KEY"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v86/SetForceAuthenticationSettingsTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v86/SetForceAuthenticationSettingsTest/schema.sql deleted file mode 100644 index dfe931f54d1..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v86/SetForceAuthenticationSettingsTest/schema.sql +++ /dev/null @@ -1,12 +0,0 @@ -CREATE TABLE "PROPERTIES"( - "PROP_KEY" VARCHAR(512) NOT NULL, - "IS_EMPTY" BOOLEAN NOT NULL, - "TEXT_VALUE" VARCHAR(4000), - "CLOB_VALUE" CLOB, - "CREATED_AT" BIGINT NOT NULL, - "COMPONENT_UUID" VARCHAR(40), - "UUID" VARCHAR(40) NOT NULL, - "USER_UUID" VARCHAR(255) -); -ALTER TABLE "PROPERTIES" ADD CONSTRAINT "PK_PROPERTIES" PRIMARY KEY("UUID"); -CREATE INDEX "PROPERTIES_KEY" ON "PROPERTIES"("PROP_KEY"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v86/UpdateChangeDataOfQProfileChangesTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v86/UpdateChangeDataOfQProfileChangesTest/schema.sql deleted file mode 100644 index 5cb1137f8de..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v86/UpdateChangeDataOfQProfileChangesTest/schema.sql +++ /dev/null @@ -1,10 +0,0 @@ -CREATE TABLE "QPROFILE_CHANGES"( - "KEE" VARCHAR(40) NOT NULL, - "RULES_PROFILE_UUID" VARCHAR(255) NOT NULL, - "CHANGE_TYPE" VARCHAR(20) NOT NULL, - "USER_UUID" VARCHAR(255), - "CHANGE_DATA" CLOB, - "CREATED_AT" BIGINT NOT NULL -); -ALTER TABLE "QPROFILE_CHANGES" ADD CONSTRAINT "PK_QPROFILE_CHANGES" PRIMARY KEY("KEE"); -CREATE INDEX "QP_CHANGES_RULES_PROFILE_UUID" ON "QPROFILE_CHANGES"("RULES_PROFILE_UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v87/AddMonorepoColumnToProjectAlmSettingsTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v87/AddMonorepoColumnToProjectAlmSettingsTableTest/schema.sql deleted file mode 100644 index 6da26ad8dc2..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v87/AddMonorepoColumnToProjectAlmSettingsTableTest/schema.sql +++ /dev/null @@ -1,14 +0,0 @@ -CREATE TABLE "PROJECT_ALM_SETTINGS"( - "UUID" VARCHAR(40) NOT NULL, - "ALM_SETTING_UUID" VARCHAR(40) NOT NULL, - "PROJECT_UUID" VARCHAR(50) NOT NULL, - "ALM_REPO" VARCHAR(256), - "ALM_SLUG" VARCHAR(256), - "UPDATED_AT" BIGINT NOT NULL, - "CREATED_AT" BIGINT NOT NULL, - "SUMMARY_COMMENT_ENABLED" BOOLEAN -); -ALTER TABLE "PROJECT_ALM_SETTINGS" ADD CONSTRAINT "PK_PROJECT_ALM_SETTINGS" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "UNIQ_PROJECT_ALM_SETTINGS" ON "PROJECT_ALM_SETTINGS"("PROJECT_UUID"); -CREATE INDEX "PROJECT_ALM_SETTINGS_ALM" ON "PROJECT_ALM_SETTINGS"("ALM_SETTING_UUID"); -CREATE INDEX "PROJECT_ALM_SETTINGS_SLUG" ON "PROJECT_ALM_SETTINGS"("ALM_SLUG"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v87/DropAlmAppInstallsTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v87/DropAlmAppInstallsTableTest/schema.sql deleted file mode 100644 index 287ad39509a..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v87/DropAlmAppInstallsTableTest/schema.sql +++ /dev/null @@ -1,14 +0,0 @@ -CREATE TABLE "ALM_APP_INSTALLS"( - "UUID" VARCHAR(40) NOT NULL, - "ALM_ID" VARCHAR(40) NOT NULL, - "OWNER_ID" VARCHAR(4000) NOT NULL, - "INSTALL_ID" VARCHAR(4000) NOT NULL, - "IS_OWNER_USER" BOOLEAN NOT NULL, - "USER_EXTERNAL_ID" VARCHAR(255), - "CREATED_AT" BIGINT NOT NULL, - "UPDATED_AT" BIGINT NOT NULL -); -ALTER TABLE "ALM_APP_INSTALLS" ADD CONSTRAINT "PK_ALM_APP_INSTALLS" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "ALM_APP_INSTALLS_OWNER" ON "ALM_APP_INSTALLS"("ALM_ID", "OWNER_ID"); -CREATE UNIQUE INDEX "ALM_APP_INSTALLS_INSTALL" ON "ALM_APP_INSTALLS"("ALM_ID", "INSTALL_ID"); -CREATE INDEX "ALM_APP_INSTALLS_EXTERNAL_ID" ON "ALM_APP_INSTALLS"("USER_EXTERNAL_ID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v87/DropDescriptionInProjectMeasuresTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v87/DropDescriptionInProjectMeasuresTest/schema.sql deleted file mode 100644 index 87fb2c67389..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v87/DropDescriptionInProjectMeasuresTest/schema.sql +++ /dev/null @@ -1,17 +0,0 @@ -CREATE TABLE "PROJECT_MEASURES"( - "VALUE" DOUBLE, - "ANALYSIS_UUID" VARCHAR(50) NOT NULL, - "COMPONENT_UUID" VARCHAR(50) NOT NULL, - "TEXT_VALUE" VARCHAR(4000), - "ALERT_STATUS" VARCHAR(5), - "ALERT_TEXT" VARCHAR(4000), - "DESCRIPTION" VARCHAR(4000), - "PERSON_ID" INTEGER, - "VARIATION_VALUE_1" DOUBLE, - "MEASURE_DATA" BLOB, - "UUID" VARCHAR(40) NOT NULL, - "METRIC_UUID" VARCHAR(40) NOT NULL -); -ALTER TABLE "PROJECT_MEASURES" ADD CONSTRAINT "PK_PROJECT_MEASURES" PRIMARY KEY("UUID"); -CREATE INDEX "MEASURES_COMPONENT_UUID" ON "PROJECT_MEASURES"("COMPONENT_UUID"); -CREATE INDEX "MEASURES_ANALYSIS_METRIC" ON "PROJECT_MEASURES"("ANALYSIS_UUID", "METRIC_UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v87/DropOrgMembersTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v87/DropOrgMembersTableTest/schema.sql deleted file mode 100644 index 68a71ad4d62..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v87/DropOrgMembersTableTest/schema.sql +++ /dev/null @@ -1,28 +0,0 @@ - -CREATE TABLE "ORGANIZATION_MEMBERS"( - "ORGANIZATION_UUID" VARCHAR(40) NOT NULL, - "USER_UUID" VARCHAR(255) NOT NULL -); -ALTER TABLE "ORGANIZATION_MEMBERS" ADD CONSTRAINT "PK_ORGANIZATION_MEMBERS" PRIMARY KEY("USER_UUID", "ORGANIZATION_UUID"); -CREATE INDEX "ORG_MEMBERS_USER_UUID" ON "ORGANIZATION_MEMBERS"("USER_UUID"); - -CREATE TABLE "ORGANIZATIONS"( - "UUID" VARCHAR(40) NOT NULL, - "KEE" VARCHAR(255) NOT NULL, - "NAME" VARCHAR(255) NOT NULL, - "DESCRIPTION" VARCHAR(256), - "URL" VARCHAR(256), - "AVATAR_URL" VARCHAR(256), - "GUARDED" BOOLEAN, - "DEFAULT_QUALITY_GATE_UUID" VARCHAR(40) NOT NULL, - "DEFAULT_PERM_TEMPLATE_PROJECT" VARCHAR(40), - "DEFAULT_PERM_TEMPLATE_APP" VARCHAR(40), - "DEFAULT_PERM_TEMPLATE_PORT" VARCHAR(40), - "NEW_PROJECT_PRIVATE" BOOLEAN NOT NULL, - "SUBSCRIPTION" VARCHAR(40) NOT NULL, - "CREATED_AT" BIGINT NOT NULL, - "UPDATED_AT" BIGINT NOT NULL, - "DEFAULT_GROUP_UUID" VARCHAR(40) -); -ALTER TABLE "ORGANIZATIONS" ADD CONSTRAINT "PK_ORGANIZATIONS" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "ORGANIZATION_KEY" ON "ORGANIZATIONS"("KEE"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v87/DropOrgQualityGatesTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v87/DropOrgQualityGatesTableTest/schema.sql deleted file mode 100644 index 64da6bc3e86..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v87/DropOrgQualityGatesTableTest/schema.sql +++ /dev/null @@ -1,7 +0,0 @@ -CREATE TABLE "ORG_QUALITY_GATES"( - "UUID" VARCHAR(40) NOT NULL, - "ORGANIZATION_UUID" VARCHAR(40) NOT NULL, - "QUALITY_GATE_UUID" VARCHAR(40) NOT NULL -); -ALTER TABLE "ORG_QUALITY_GATES" ADD CONSTRAINT "PK_ORG_QUALITY_GATES" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "UNIQ_ORG_QUALITY_GATES" ON "ORG_QUALITY_GATES"("ORGANIZATION_UUID", "QUALITY_GATE_UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v87/DropOrganizationAlmBindingsTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v87/DropOrganizationAlmBindingsTableTest/schema.sql deleted file mode 100644 index 0c733480992..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v87/DropOrganizationAlmBindingsTableTest/schema.sql +++ /dev/null @@ -1,13 +0,0 @@ -CREATE TABLE "ORGANIZATION_ALM_BINDINGS"( - "UUID" VARCHAR(40) NOT NULL, - "ORGANIZATION_UUID" VARCHAR(40) NOT NULL, - "ALM_APP_INSTALL_UUID" VARCHAR(40) NOT NULL, - "ALM_ID" VARCHAR(40) NOT NULL, - "URL" VARCHAR(2000) NOT NULL, - "USER_UUID" VARCHAR(255) NOT NULL, - "MEMBERS_SYNC_ENABLED" BOOLEAN, - "CREATED_AT" BIGINT NOT NULL -); -ALTER TABLE "ORGANIZATION_ALM_BINDINGS" ADD CONSTRAINT "PK_ORGANIZATION_ALM_BINDINGS" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "ORG_ALM_BINDINGS_ORG" ON "ORGANIZATION_ALM_BINDINGS"("ORGANIZATION_UUID"); -CREATE UNIQUE INDEX "ORG_ALM_BINDINGS_INSTALL" ON "ORGANIZATION_ALM_BINDINGS"("ALM_APP_INSTALL_UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v87/DropOrganizationInComponentsTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v87/DropOrganizationInComponentsTest/schema.sql deleted file mode 100644 index 2d117e3da7e..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v87/DropOrganizationInComponentsTest/schema.sql +++ /dev/null @@ -1,42 +0,0 @@ -CREATE TABLE "COMPONENTS"( - "UUID" VARCHAR(50) NOT NULL, - "ORGANIZATION_UUID" VARCHAR(40) NOT NULL, - "KEE" VARCHAR(400), - "DEPRECATED_KEE" VARCHAR(400), - "NAME" VARCHAR(2000), - "LONG_NAME" VARCHAR(2000), - "DESCRIPTION" VARCHAR(2000), - "ENABLED" BOOLEAN DEFAULT TRUE NOT NULL, - "SCOPE" VARCHAR(3), - "QUALIFIER" VARCHAR(10), - "PRIVATE" BOOLEAN NOT NULL, - "ROOT_UUID" VARCHAR(50) NOT NULL, - "LANGUAGE" VARCHAR(20), - "COPY_COMPONENT_UUID" VARCHAR(50), - "PATH" VARCHAR(2000), - "UUID_PATH" VARCHAR(1500) NOT NULL, - "PROJECT_UUID" VARCHAR(50) NOT NULL, - "MODULE_UUID" VARCHAR(50), - "MODULE_UUID_PATH" VARCHAR(1500), - "MAIN_BRANCH_PROJECT_UUID" VARCHAR(50), - "B_CHANGED" BOOLEAN, - "B_NAME" VARCHAR(500), - "B_LONG_NAME" VARCHAR(500), - "B_DESCRIPTION" VARCHAR(2000), - "B_ENABLED" BOOLEAN, - "B_QUALIFIER" VARCHAR(10), - "B_LANGUAGE" VARCHAR(20), - "B_COPY_COMPONENT_UUID" VARCHAR(50), - "B_PATH" VARCHAR(2000), - "B_UUID_PATH" VARCHAR(1500), - "B_MODULE_UUID" VARCHAR(50), - "B_MODULE_UUID_PATH" VARCHAR(1500), - "CREATED_AT" TIMESTAMP -); -CREATE INDEX "PROJECTS_ORGANIZATION" ON "COMPONENTS"("ORGANIZATION_UUID"); -CREATE UNIQUE INDEX "PROJECTS_KEE" ON "COMPONENTS"("KEE"); -CREATE INDEX "PROJECTS_MODULE_UUID" ON "COMPONENTS"("MODULE_UUID"); -CREATE INDEX "PROJECTS_PROJECT_UUID" ON "COMPONENTS"("PROJECT_UUID"); -CREATE INDEX "PROJECTS_QUALIFIER" ON "COMPONENTS"("QUALIFIER"); -CREATE INDEX "PROJECTS_ROOT_UUID" ON "COMPONENTS"("ROOT_UUID"); -CREATE INDEX "PROJECTS_UUID" ON "COMPONENTS"("UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v87/DropOrganizationInProjectsTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v87/DropOrganizationInProjectsTest/schema.sql deleted file mode 100644 index 282e616941b..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v87/DropOrganizationInProjectsTest/schema.sql +++ /dev/null @@ -1,15 +0,0 @@ -CREATE TABLE "PROJECTS"( - "UUID" VARCHAR(40) NOT NULL, - "KEE" VARCHAR(400) NOT NULL, - "QUALIFIER" VARCHAR(10) NOT NULL, - "ORGANIZATION_UUID" VARCHAR(40) NOT NULL, - "NAME" VARCHAR(2000), - "DESCRIPTION" VARCHAR(2000), - "PRIVATE" BOOLEAN NOT NULL, - "TAGS" VARCHAR(500), - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT NOT NULL -); -ALTER TABLE "PROJECTS" ADD CONSTRAINT "PK_NEW_PROJECTS" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "UNIQ_PROJECTS_KEE" ON "PROJECTS"("KEE"); -CREATE INDEX "IDX_QUALIFIER" ON "PROJECTS"("QUALIFIER"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v87/DropOrganizationInWebhooksTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v87/DropOrganizationInWebhooksTest/schema.sql deleted file mode 100644 index 005eb2c3b37..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v87/DropOrganizationInWebhooksTest/schema.sql +++ /dev/null @@ -1,34 +0,0 @@ -CREATE TABLE "WEBHOOKS"( - "UUID" VARCHAR(40) NOT NULL, - "ORGANIZATION_UUID" VARCHAR(40), - "PROJECT_UUID" VARCHAR(40), - "NAME" VARCHAR(100) NOT NULL, - "URL" VARCHAR(2000) NOT NULL, - "SECRET" VARCHAR(200), - "CREATED_AT" BIGINT NOT NULL, - "UPDATED_AT" BIGINT -); -ALTER TABLE "WEBHOOKS" ADD CONSTRAINT "PK_WEBHOOKS" PRIMARY KEY("UUID"); -CREATE INDEX "ORGANIZATION_WEBHOOK" ON "WEBHOOKS"("ORGANIZATION_UUID"); -CREATE INDEX "PROJECT_WEBHOOK" ON "WEBHOOKS"("PROJECT_UUID"); - -CREATE TABLE "ORGANIZATIONS"( - "UUID" VARCHAR(40) NOT NULL, - "KEE" VARCHAR(255) NOT NULL, - "NAME" VARCHAR(255) NOT NULL, - "DESCRIPTION" VARCHAR(256), - "URL" VARCHAR(256), - "AVATAR_URL" VARCHAR(256), - "GUARDED" BOOLEAN, - "DEFAULT_QUALITY_GATE_UUID" VARCHAR(40) NOT NULL, - "DEFAULT_PERM_TEMPLATE_PROJECT" VARCHAR(40), - "DEFAULT_PERM_TEMPLATE_APP" VARCHAR(40), - "DEFAULT_PERM_TEMPLATE_PORT" VARCHAR(40), - "NEW_PROJECT_PRIVATE" BOOLEAN NOT NULL, - "SUBSCRIPTION" VARCHAR(40) NOT NULL, - "CREATED_AT" BIGINT NOT NULL, - "UPDATED_AT" BIGINT NOT NULL, - "DEFAULT_GROUP_UUID" VARCHAR(40) -); -ALTER TABLE "ORGANIZATIONS" ADD CONSTRAINT "PK_ORGANIZATIONS" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "ORGANIZATION_KEY" ON "ORGANIZATIONS"("KEE"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v87/DropOrganizationsTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v87/DropOrganizationsTableTest/schema.sql deleted file mode 100644 index 74675ee2148..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v87/DropOrganizationsTableTest/schema.sql +++ /dev/null @@ -1,20 +0,0 @@ -CREATE TABLE "ORGANIZATIONS"( - "UUID" VARCHAR(40) NOT NULL, - "KEE" VARCHAR(255) NOT NULL, - "NAME" VARCHAR(255) NOT NULL, - "DESCRIPTION" VARCHAR(256), - "URL" VARCHAR(256), - "AVATAR_URL" VARCHAR(256), - "GUARDED" BOOLEAN, - "DEFAULT_QUALITY_GATE_UUID" VARCHAR(40) NOT NULL, - "DEFAULT_PERM_TEMPLATE_PROJECT" VARCHAR(40), - "DEFAULT_PERM_TEMPLATE_APP" VARCHAR(40), - "DEFAULT_PERM_TEMPLATE_PORT" VARCHAR(40), - "NEW_PROJECT_PRIVATE" BOOLEAN NOT NULL, - "SUBSCRIPTION" VARCHAR(40) NOT NULL, - "CREATED_AT" BIGINT NOT NULL, - "UPDATED_AT" BIGINT NOT NULL, - "DEFAULT_GROUP_UUID" VARCHAR(40) -); -ALTER TABLE "ORGANIZATIONS" ADD CONSTRAINT "PK_ORGANIZATIONS" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "ORGANIZATION_KEY" ON "ORGANIZATIONS"("KEE"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v87/MakeMonorepoColumnInProjectAlmSettingsTableNotNullableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v87/MakeMonorepoColumnInProjectAlmSettingsTableNotNullableTest/schema.sql deleted file mode 100644 index cf1dd7252b3..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v87/MakeMonorepoColumnInProjectAlmSettingsTableNotNullableTest/schema.sql +++ /dev/null @@ -1,15 +0,0 @@ -CREATE TABLE "PROJECT_ALM_SETTINGS"( - "UUID" VARCHAR(40) NOT NULL, - "ALM_SETTING_UUID" VARCHAR(40) NOT NULL, - "PROJECT_UUID" VARCHAR(50) NOT NULL, - "ALM_REPO" VARCHAR(256), - "ALM_SLUG" VARCHAR(256), - "UPDATED_AT" BIGINT NOT NULL, - "CREATED_AT" BIGINT NOT NULL, - "SUMMARY_COMMENT_ENABLED" BOOLEAN, - "MONOREPO" BOOLEAN -); -ALTER TABLE "PROJECT_ALM_SETTINGS" ADD CONSTRAINT "PK_PROJECT_ALM_SETTINGS" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "UNIQ_PROJECT_ALM_SETTINGS" ON "PROJECT_ALM_SETTINGS"("PROJECT_UUID"); -CREATE INDEX "PROJECT_ALM_SETTINGS_ALM" ON "PROJECT_ALM_SETTINGS"("ALM_SETTING_UUID"); -CREATE INDEX "PROJECT_ALM_SETTINGS_SLUG" ON "PROJECT_ALM_SETTINGS"("ALM_SLUG"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v87/MoveDefaultProjectVisibilityToGlobalPropertiesTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v87/MoveDefaultProjectVisibilityToGlobalPropertiesTest/schema.sql deleted file mode 100644 index 09e88e08ef1..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v87/MoveDefaultProjectVisibilityToGlobalPropertiesTest/schema.sql +++ /dev/null @@ -1,33 +0,0 @@ -CREATE TABLE "PROPERTIES"( - "PROP_KEY" VARCHAR(512) NOT NULL, - "IS_EMPTY" BOOLEAN NOT NULL, - "TEXT_VALUE" VARCHAR(4000), - "CLOB_VALUE" CLOB, - "CREATED_AT" BIGINT NOT NULL, - "COMPONENT_UUID" VARCHAR(40), - "UUID" VARCHAR(40) NOT NULL, - "USER_UUID" VARCHAR(255) -); -ALTER TABLE "PROPERTIES" ADD CONSTRAINT "PK_PROPERTIES" PRIMARY KEY("UUID"); -CREATE INDEX "PROPERTIES_KEY" ON "PROPERTIES"("PROP_KEY"); - -CREATE TABLE "ORGANIZATIONS"( - "UUID" VARCHAR(40) NOT NULL, - "KEE" VARCHAR(255) NOT NULL, - "NAME" VARCHAR(255) NOT NULL, - "DESCRIPTION" VARCHAR(256), - "URL" VARCHAR(256), - "AVATAR_URL" VARCHAR(256), - "GUARDED" BOOLEAN, - "DEFAULT_QUALITY_GATE_UUID" VARCHAR(40) NOT NULL, - "DEFAULT_PERM_TEMPLATE_PROJECT" VARCHAR(40), - "DEFAULT_PERM_TEMPLATE_APP" VARCHAR(40), - "DEFAULT_PERM_TEMPLATE_PORT" VARCHAR(40), - "NEW_PROJECT_PRIVATE" BOOLEAN NOT NULL, - "SUBSCRIPTION" VARCHAR(40) NOT NULL, - "CREATED_AT" BIGINT NOT NULL, - "UPDATED_AT" BIGINT NOT NULL, - "DEFAULT_GROUP_UUID" VARCHAR(40) -); -ALTER TABLE "ORGANIZATIONS" ADD CONSTRAINT "PK_ORGANIZATIONS" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "ORGANIZATION_KEY" ON "ORGANIZATIONS"("KEE"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v87/MoveDefaultQualityGateToGlobalPropertiesTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v87/MoveDefaultQualityGateToGlobalPropertiesTest/schema.sql deleted file mode 100644 index 09e88e08ef1..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v87/MoveDefaultQualityGateToGlobalPropertiesTest/schema.sql +++ /dev/null @@ -1,33 +0,0 @@ -CREATE TABLE "PROPERTIES"( - "PROP_KEY" VARCHAR(512) NOT NULL, - "IS_EMPTY" BOOLEAN NOT NULL, - "TEXT_VALUE" VARCHAR(4000), - "CLOB_VALUE" CLOB, - "CREATED_AT" BIGINT NOT NULL, - "COMPONENT_UUID" VARCHAR(40), - "UUID" VARCHAR(40) NOT NULL, - "USER_UUID" VARCHAR(255) -); -ALTER TABLE "PROPERTIES" ADD CONSTRAINT "PK_PROPERTIES" PRIMARY KEY("UUID"); -CREATE INDEX "PROPERTIES_KEY" ON "PROPERTIES"("PROP_KEY"); - -CREATE TABLE "ORGANIZATIONS"( - "UUID" VARCHAR(40) NOT NULL, - "KEE" VARCHAR(255) NOT NULL, - "NAME" VARCHAR(255) NOT NULL, - "DESCRIPTION" VARCHAR(256), - "URL" VARCHAR(256), - "AVATAR_URL" VARCHAR(256), - "GUARDED" BOOLEAN, - "DEFAULT_QUALITY_GATE_UUID" VARCHAR(40) NOT NULL, - "DEFAULT_PERM_TEMPLATE_PROJECT" VARCHAR(40), - "DEFAULT_PERM_TEMPLATE_APP" VARCHAR(40), - "DEFAULT_PERM_TEMPLATE_PORT" VARCHAR(40), - "NEW_PROJECT_PRIVATE" BOOLEAN NOT NULL, - "SUBSCRIPTION" VARCHAR(40) NOT NULL, - "CREATED_AT" BIGINT NOT NULL, - "UPDATED_AT" BIGINT NOT NULL, - "DEFAULT_GROUP_UUID" VARCHAR(40) -); -ALTER TABLE "ORGANIZATIONS" ADD CONSTRAINT "PK_ORGANIZATIONS" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "ORGANIZATION_KEY" ON "ORGANIZATIONS"("KEE"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v87/PopulateMonorepoColumnToProjectAlmSettingsTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v87/PopulateMonorepoColumnToProjectAlmSettingsTableTest/schema.sql deleted file mode 100644 index cf1dd7252b3..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v87/PopulateMonorepoColumnToProjectAlmSettingsTableTest/schema.sql +++ /dev/null @@ -1,15 +0,0 @@ -CREATE TABLE "PROJECT_ALM_SETTINGS"( - "UUID" VARCHAR(40) NOT NULL, - "ALM_SETTING_UUID" VARCHAR(40) NOT NULL, - "PROJECT_UUID" VARCHAR(50) NOT NULL, - "ALM_REPO" VARCHAR(256), - "ALM_SLUG" VARCHAR(256), - "UPDATED_AT" BIGINT NOT NULL, - "CREATED_AT" BIGINT NOT NULL, - "SUMMARY_COMMENT_ENABLED" BOOLEAN, - "MONOREPO" BOOLEAN -); -ALTER TABLE "PROJECT_ALM_SETTINGS" ADD CONSTRAINT "PK_PROJECT_ALM_SETTINGS" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "UNIQ_PROJECT_ALM_SETTINGS" ON "PROJECT_ALM_SETTINGS"("PROJECT_UUID"); -CREATE INDEX "PROJECT_ALM_SETTINGS_ALM" ON "PROJECT_ALM_SETTINGS"("ALM_SETTING_UUID"); -CREATE INDEX "PROJECT_ALM_SETTINGS_SLUG" ON "PROJECT_ALM_SETTINGS"("ALM_SLUG"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v88/AddLastSonarlintConnectionToUsersTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v88/AddLastSonarlintConnectionToUsersTest/schema.sql deleted file mode 100644 index 92b679b0905..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v88/AddLastSonarlintConnectionToUsersTest/schema.sql +++ /dev/null @@ -1,28 +0,0 @@ -CREATE TABLE "USERS"( - "UUID" VARCHAR(255) NOT NULL, - "LOGIN" VARCHAR(255) NOT NULL, - "NAME" VARCHAR(200), - "EMAIL" VARCHAR(100), - "CRYPTED_PASSWORD" VARCHAR(100), - "SALT" VARCHAR(40), - "HASH_METHOD" VARCHAR(10), - "ACTIVE" BOOLEAN DEFAULT TRUE, - "SCM_ACCOUNTS" VARCHAR(4000), - "EXTERNAL_LOGIN" VARCHAR(255) NOT NULL, - "EXTERNAL_IDENTITY_PROVIDER" VARCHAR(100) NOT NULL, - "EXTERNAL_ID" VARCHAR(255) NOT NULL, - "IS_ROOT" BOOLEAN NOT NULL, - "USER_LOCAL" BOOLEAN, - "ONBOARDED" BOOLEAN NOT NULL, - "HOMEPAGE_TYPE" VARCHAR(40), - "HOMEPAGE_PARAMETER" VARCHAR(40), - "LAST_CONNECTION_DATE" BIGINT, - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT, - "RESET_PASSWORD" BOOLEAN NOT NULL -); -ALTER TABLE "USERS" ADD CONSTRAINT "PK_USERS" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "USERS_LOGIN" ON "USERS"("LOGIN"); -CREATE INDEX "USERS_UPDATED_AT" ON "USERS"("UPDATED_AT"); -CREATE UNIQUE INDEX "UNIQ_EXTERNAL_ID" ON "USERS"("EXTERNAL_IDENTITY_PROVIDER", "EXTERNAL_ID"); -CREATE UNIQUE INDEX "UNIQ_EXTERNAL_LOGIN" ON "USERS"("EXTERNAL_IDENTITY_PROVIDER", "EXTERNAL_LOGIN"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v89/AddIndexOnWebhookUuidInWebhookDeliveriesTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v89/AddIndexOnWebhookUuidInWebhookDeliveriesTableTest/schema.sql deleted file mode 100644 index b27a7bcefef..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v89/AddIndexOnWebhookUuidInWebhookDeliveriesTableTest/schema.sql +++ /dev/null @@ -1,18 +0,0 @@ -CREATE TABLE "WEBHOOK_DELIVERIES"( - "UUID" VARCHAR(40) NOT NULL, - "WEBHOOK_UUID" VARCHAR(40) NOT NULL, - "COMPONENT_UUID" VARCHAR(40) NOT NULL, - "CE_TASK_UUID" VARCHAR(40), - "ANALYSIS_UUID" VARCHAR(40), - "NAME" VARCHAR(100) NOT NULL, - "URL" VARCHAR(2000) NOT NULL, - "SUCCESS" BOOLEAN NOT NULL, - "HTTP_STATUS" INTEGER, - "DURATION_MS" BIGINT NOT NULL, - "PAYLOAD" CLOB NOT NULL, - "ERROR_STACKTRACE" CLOB, - "CREATED_AT" BIGINT NOT NULL -); -ALTER TABLE "WEBHOOK_DELIVERIES" ADD CONSTRAINT "PK_WEBHOOK_DELIVERIES" PRIMARY KEY("UUID"); -CREATE INDEX "COMPONENT_UUID" ON "WEBHOOK_DELIVERIES"("COMPONENT_UUID"); -CREATE INDEX "CE_TASK_UUID" ON "WEBHOOK_DELIVERIES"("CE_TASK_UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v89/AddIndicesToNewCodePeriodTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v89/AddIndicesToNewCodePeriodTableTest/schema.sql deleted file mode 100644 index 534c0eb6f55..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v89/AddIndicesToNewCodePeriodTableTest/schema.sql +++ /dev/null @@ -1,11 +0,0 @@ -CREATE TABLE "NEW_CODE_PERIODS"( - "UUID" VARCHAR(40) NOT NULL, - "PROJECT_UUID" VARCHAR(40), - "BRANCH_UUID" VARCHAR(40), - "TYPE" VARCHAR(30) NOT NULL, - "VALUE" VARCHAR(40), - "UPDATED_AT" BIGINT NOT NULL, - "CREATED_AT" BIGINT NOT NULL -); -ALTER TABLE "NEW_CODE_PERIODS" ADD CONSTRAINT "PK_NEW_CODE_PERIODS" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "UNIQ_NEW_CODE_PERIODS" ON "NEW_CODE_PERIODS"("PROJECT_UUID", "BRANCH_UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v89/AddMainBranchProjectUuidIndexToComponentTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v89/AddMainBranchProjectUuidIndexToComponentTableTest/schema.sql deleted file mode 100644 index adc6b495cec..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v89/AddMainBranchProjectUuidIndexToComponentTableTest/schema.sql +++ /dev/null @@ -1,40 +0,0 @@ -CREATE TABLE "COMPONENTS"( - "UUID" VARCHAR(50) NOT NULL, - "KEE" VARCHAR(400), - "DEPRECATED_KEE" VARCHAR(400), - "NAME" VARCHAR(2000), - "LONG_NAME" VARCHAR(2000), - "DESCRIPTION" VARCHAR(2000), - "ENABLED" BOOLEAN DEFAULT TRUE NOT NULL, - "SCOPE" VARCHAR(3), - "QUALIFIER" VARCHAR(10), - "PRIVATE" BOOLEAN NOT NULL, - "ROOT_UUID" VARCHAR(50) NOT NULL, - "LANGUAGE" VARCHAR(20), - "COPY_COMPONENT_UUID" VARCHAR(50), - "PATH" VARCHAR(2000), - "UUID_PATH" VARCHAR(1500) NOT NULL, - "PROJECT_UUID" VARCHAR(50) NOT NULL, - "MODULE_UUID" VARCHAR(50), - "MODULE_UUID_PATH" VARCHAR(1500), - "MAIN_BRANCH_PROJECT_UUID" VARCHAR(50), - "B_CHANGED" BOOLEAN, - "B_NAME" VARCHAR(500), - "B_LONG_NAME" VARCHAR(500), - "B_DESCRIPTION" VARCHAR(2000), - "B_ENABLED" BOOLEAN, - "B_QUALIFIER" VARCHAR(10), - "B_LANGUAGE" VARCHAR(20), - "B_COPY_COMPONENT_UUID" VARCHAR(50), - "B_PATH" VARCHAR(2000), - "B_UUID_PATH" VARCHAR(1500), - "B_MODULE_UUID" VARCHAR(50), - "B_MODULE_UUID_PATH" VARCHAR(1500), - "CREATED_AT" TIMESTAMP -); -CREATE UNIQUE INDEX "PROJECTS_KEE" ON "COMPONENTS"("KEE"); -CREATE INDEX "PROJECTS_MODULE_UUID" ON "COMPONENTS"("MODULE_UUID"); -CREATE INDEX "PROJECTS_PROJECT_UUID" ON "COMPONENTS"("PROJECT_UUID"); -CREATE INDEX "PROJECTS_QUALIFIER" ON "COMPONENTS"("QUALIFIER"); -CREATE INDEX "PROJECTS_ROOT_UUID" ON "COMPONENTS"("ROOT_UUID"); -CREATE INDEX "PROJECTS_UUID" ON "COMPONENTS"("UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v89/DropGithubEndpointOnProjectLevelSettingTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v89/DropGithubEndpointOnProjectLevelSettingTest/schema.sql deleted file mode 100644 index dfe931f54d1..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v89/DropGithubEndpointOnProjectLevelSettingTest/schema.sql +++ /dev/null @@ -1,12 +0,0 @@ -CREATE TABLE "PROPERTIES"( - "PROP_KEY" VARCHAR(512) NOT NULL, - "IS_EMPTY" BOOLEAN NOT NULL, - "TEXT_VALUE" VARCHAR(4000), - "CLOB_VALUE" CLOB, - "CREATED_AT" BIGINT NOT NULL, - "COMPONENT_UUID" VARCHAR(40), - "UUID" VARCHAR(40) NOT NULL, - "USER_UUID" VARCHAR(255) -); -ALTER TABLE "PROPERTIES" ADD CONSTRAINT "PK_PROPERTIES" PRIMARY KEY("UUID"); -CREATE INDEX "PROPERTIES_KEY" ON "PROPERTIES"("PROP_KEY"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v89/IncreaseSizeOfValueColumnInNewCodePeriodsTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v89/IncreaseSizeOfValueColumnInNewCodePeriodsTableTest/schema.sql deleted file mode 100644 index b560d20c68a..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v89/IncreaseSizeOfValueColumnInNewCodePeriodsTableTest/schema.sql +++ /dev/null @@ -1,13 +0,0 @@ -CREATE TABLE "NEW_CODE_PERIODS"( - "UUID" VARCHAR(40) NOT NULL, - "PROJECT_UUID" VARCHAR(40), - "BRANCH_UUID" VARCHAR(40), - "TYPE" VARCHAR(30) NOT NULL, - "VALUE" VARCHAR(40), - "UPDATED_AT" BIGINT NOT NULL, - "CREATED_AT" BIGINT NOT NULL -); -ALTER TABLE "NEW_CODE_PERIODS" ADD CONSTRAINT "PK_NEW_CODE_PERIODS" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "UNIQ_NEW_CODE_PERIODS" ON "NEW_CODE_PERIODS"("PROJECT_UUID", "BRANCH_UUID"); -CREATE INDEX "IDX_NCP_TYPE" ON "NEW_CODE_PERIODS"("TYPE"); -CREATE INDEX "IDX_NCP_VALUE" ON "NEW_CODE_PERIODS"("VALUE"); -- GitLab