From 753dbacdecc5d737afcd09b6f1c4809aa2a3d2fa Mon Sep 17 00:00:00 2001
From: =?utf8?q?S=C3=A9bastien=20Lesaint?=
Date: Wed, 19 Jun 2019 14:30:01 +0200
Subject: [PATCH] SONAR-12218 remove DB migrations before 8.0
---
.../ComputeEngineContainerImplTest.java | 2 +-
.../MigrationConfigurationModule.java | 38 -
.../DefaultOrganizationUuidProvider.java | 2 +-
.../DefaultOrganizationUuidProviderImpl.java | 2 +-
.../version/v56/CreateInitialSchema.java | 924 -----------
.../db/migration/version/v56/DbVersion56.java | 32 -
.../version/v56/PopulateInitialSchema.java | 126 --
.../migration/version/v56/package-info.java | 24 -
.../migration/version/v561/DbVersion561.java | 30 -
.../UpdateUsersExternalIdentityWhenEmpty.java | 69 -
.../migration/version/v561/package-info.java | 24 -
.../AddAnalysisUuidColumnToCeActivity.java | 45 -
.../v60/AddAnalysisUuidColumnToEvents.java | 45 -
.../v60/AddAnalysisUuidColumnToMeasures.java | 45 -
.../version/v60/AddBColumnsToProjects.java | 55 -
...AnalysisUuidColumnToDuplicationsIndex.java | 46 -
.../v60/AddComponentUuidColumnToMeasures.java | 45 -
.../AddComponentUuidColumnsToSnapshots.java | 46 -
.../v60/AddIndexOnAnalysisUuidOfMeasures.java | 46 -
.../AddIndexOnComponentUuidOfMeasures.java | 44 -
.../v60/AddLastUsedColumnToRulesProfiles.java | 44 -
.../v60/AddProfileKeyToActivities.java | 44 -
.../v60/AddUniqueIndexOnUuidOfSnapshots.java | 44 -
.../v60/AddUserUpdatedAtToRulesProfiles.java | 44 -
.../version/v60/AddUuidColumnToSnapshots.java | 45 -
.../version/v60/AddUuidColumnsToProjects.java | 47 -
.../v60/AddUuidPathColumnToProjects.java | 44 -
.../v60/CleanEventsWithoutAnalysisUuid.java | 45 -
.../v60/CleanEventsWithoutSnapshotId.java | 45 -
.../CleanMeasuresWithNullAnalysisUuid.java | 45 -
.../v60/CleanOrphanRowsInProjects.java | 48 -
.../v60/CleanOrphanRowsInSnapshots.java | 62 -
.../v60/CleanUsurperRootComponents.java | 156 --
.../CreatePermTemplatesCharacteristics.java | 66 -
.../v60/CreateTemporaryIndicesFor1211.java | 51 -
.../db/migration/version/v60/DbVersion60.java | 110 --
...nsIndexRowsWithoutComponentOrAnalysis.java | 61 -
.../DeleteOrphanMeasuresWithoutComponent.java | 45 -
.../v60/DropIdColumnsFromProjects.java | 44 -
.../v60/DropIdColumnsFromSnapshots.java | 44 -
...icationsIndexSidFromDuplicationsIndex.java | 39 -
.../DropIndexEventsSnapshotIdFromEvents.java | 39 -
.../v60/DropIndexOnSnapshotIdOfMeasures.java | 39 -
.../DropIndexProjectsRootIdFromProjects.java | 39 -
.../DropIndexProjectsUuidFromProjects.java | 39 -
.../DropIndicesOnTreeColumnsOfSnapshots.java | 46 -
.../v60/DropProjectIdColumnFromMeasures.java | 41 -
.../v60/DropRememberMeColumnsFromUsers.java | 40 -
...DropResourceIndexRidFromResourceIndex.java | 41 -
.../DropSnapshotIdColumnFromCeActivity.java | 44 -
.../v60/DropSnapshotIdColumnFromEvents.java | 40 -
.../v60/DropSnapshotIdColumnFromMeasures.java | 40 -
...napshotIdColumnsFromDuplicationsIndex.java | 41 -
.../DropSnapshotProjectIdFromSnapshots.java | 46 -
.../v60/DropTemporaryIndicesOf1210.java | 46 -
.../v60/DropTreeColumnsFromSnapshots.java | 41 -
.../version/v60/DropTreesOfSnapshots.java | 50 -
.../v60/DropUnusedMeasuresColumns.java | 58 -
.../FixProjectUuidOfDeveloperProjects.java | 53 -
.../v60/MakeAnalysisUuidNotNullOnEvents.java | 59 -
.../MakeAnalysisUuidNotNullOnMeasures.java | 45 -
...nalysisUuidNotNullOnDuplicationsIndex.java | 66 -
...omponentUuidColumnsNotNullOnSnapshots.java | 70 -
.../MakeComponentUuidNotNullOnMeasures.java | 45 -
.../MakeProfileKeyNotNullOnActivities.java | 44 -
.../v60/MakeUuidColumnNotNullOnSnapshots.java | 45 -
.../v60/MakeUuidColumnsNotNullOnProjects.java | 55 -
.../MakeUuidPathColumnNotNullOnProjects.java | 44 -
.../migration/version/v60/Migration1223.java | 43 -
...opulateAnalysisUuidColumnOnCeActivity.java | 54 -
.../v60/PopulateAnalysisUuidOnEvents.java | 55 -
.../v60/PopulateAnalysisUuidOnMeasures.java | 74 -
...uidAndAnalysisUuidOfDuplicationsIndex.java | 81 -
...pulateComponentUuidColumnsOfSnapshots.java | 85 -
.../v60/PopulateComponentUuidOfMeasures.java | 54 -
...PopulateLastUsedColumnOfRulesProfiles.java | 90 --
.../v60/PopulateProfileKeyOfActivities.java | 66 -
.../PopulateUserUpdatedAtOfRulesProfiles.java | 91 --
.../v60/PopulateUuidColumnOnSnapshots.java | 55 -
.../v60/PopulateUuidColumnsOfProjects.java | 167 --
.../v60/PopulateUuidPathColumnOnProjects.java | 169 --
...RecreateIndexProjectsUuidFromProjects.java | 43 -
.../v60/RemoveUsersPasswordWhenNotLocal.java | 50 -
...rilyDropIndexOfAnalysisUuidOnMeasures.java | 44 -
.../migration/version/v60/package-info.java | 23 -
.../version/v61/AddBUuidPathToProjects.java | 44 -
.../v61/AddErrorColumnsToCeActivity.java | 46 -
.../v61/CopyActivitiesToQprofileChanges.java | 68 -
.../version/v61/CreateTableCeTaskInput.java | 47 -
.../v61/CreateTableInternalProperties.java | 49 -
.../version/v61/CreateTableProperties2.java | 69 -
.../v61/CreateTableQprofileChanges.java | 49 -
.../v61/CreateTableRuleRepositories.java | 46 -
.../v61/CreateTableScannerContext.java | 47 -
.../db/migration/version/v61/DbVersion61.java | 56 -
.../version/v61/DeleteProjectDashboards.java | 74 -
.../version/v61/DeleteReportsFromCeQueue.java | 47 -
.../v61/DropIsGlobalFromDashboards.java | 40 -
.../version/v61/DropTableActivities.java | 46 -
.../version/v61/DropTableProperties.java | 46 -
.../migration/version/v61/Migration1304.java | 39 -
.../version/v61/PopulateTableProperties2.java | 84 -
.../RemoveViewsDefinitionFromProperties.java | 86 --
.../RenameTableProperties2ToProperties.java | 56 -
.../v61/ShrinkModuleUuidPathOfProjects.java | 44 -
.../migration/version/v61/package-info.java | 23 -
.../v62/AddIsRootColumnOnTableUsers.java | 41 -
.../v62/AddOrganizationUuidToGroupRoles.java | 46 -
.../v62/AddOrganizationUuidToGroups.java | 46 -
...OrganizationUuidToPermissionTemplates.java | 46 -
.../v62/AddOrganizationUuidToUserRoles.java | 46 -
.../v62/CreateDefaultOrganization.java | 86 --
.../version/v62/CreateTableOrganizations.java | 62 -
.../v62/CreateTableWebhookDeliveries.java | 77 -
.../db/migration/version/v62/DbVersion62.java | 54 -
.../v62/DeletePermissionShareDashboard.java | 51 -
.../version/v62/DropIssueFiltersTables.java | 47 -
.../version/v62/DropMeasureFiltersTables.java | 47 -
.../v62/DropRelatedDashboardTables.java | 48 -
...nizationUuidInUniqueIndexOfGroupRoles.java | 56 -
...keOrganizationUuidNotNullOnGroupRoles.java | 45 -
.../MakeOrganizationUuidNotNullOnGroups.java | 45 -
...ationUuidNotNullOnPermissionTemplates.java | 45 -
...akeOrganizationUuidNotNullOnUserRoles.java | 45 -
.../MakeRootColumnNotNullOnTableUsers.java | 40 -
.../v62/PopulateIsRootColumnOnTableUsers.java | 81 -
.../PopulateOrganizationUuidOfGroupRoles.java | 61 -
.../v62/PopulateOrganizationUuidOfGroups.java | 67 -
...OrganizationUuidOfPermissionTemplates.java | 67 -
.../PopulateOrganizationUuidOfUserRoles.java | 61 -
...UpdateQualityGateConditionsOnCoverage.java | 237 ---
.../migration/version/v62/package-info.java | 23 -
.../v63/AddColumnGuardedToOrganizations.java | 44 -
...ultPermTemplateColumnsToOrganizations.java | 53 -
.../AddIndexOnOrganizationUuidOfProjects.java | 47 -
.../v63/AddOrganizationUuidToProjects.java | 46 -
.../version/v63/AddUserIdToOrganizations.java | 45 -
.../version/v63/AddUuidToEvents.java | 45 -
.../db/migration/version/v63/DbVersion63.java | 56 -
.../v63/DeleteMeasuresHavingNoValue.java | 56 -
.../version/v63/DeleteUselessProperties.java | 59 -
.../version/v63/DropTableResourceIndex.java | 60 -
...lumnGuardedOfOrganizationsNotNullable.java | 44 -
.../v63/MakeDefaultOrganizationGuarded.java | 43 -
.../MakeIndexOnOrganizationsKeeUnique.java | 57 -
...OrganizationUuidOfProjectsNotNullable.java | 42 -
.../version/v63/MakeUuidNotNullOnEvents.java | 54 -
.../PopulateColumnGuardedOfOrganizations.java | 46 -
...ultPermTemplateColumnsOfOrganizations.java | 147 --
.../PopulateOrganizationUuidToProjects.java | 63 -
.../v63/PopulateUuidColumnOfEvents.java | 55 -
.../version/v63/UnsetUserRootFlags.java | 51 -
.../migration/version/v63/package-info.java | 24 -
...CeActivityWorkerUuidAndExecutionCount.java | 52 -
...AddCeQueueWorkerUuidAndExecutionCount.java | 52 -
.../v64/AddColumnNewProjectPrivate.java | 43 -
.../version/v64/AddColumnProjectsPrivate.java | 43 -
.../v64/AddDefaultGroupIdToOrganizations.java | 44 -
.../v64/AddIndexLoadedTemplatesType.java | 46 -
.../v64/AddIndexOnActiveRuleParameters.java | 43 -
.../AddQualityProfileOrganizationUuid.java | 47 -
.../version/v64/AddTagsToProjects.java | 45 -
.../v64/CleanLoadedTemplateOrphans.java | 37 -
.../v64/CleanOrphanRowsInGroupsUsers.java | 48 -
...CreateMembersGroupsInEachOrganization.java | 92 --
.../v64/CreateOrganizationMembersTable.java | 47 -
.../version/v64/CreateRulesMetadata.java | 101 --
.../db/migration/version/v64/DbVersion64.java | 76 -
.../v64/DeleteDefaultGroupSetting.java | 39 -
...rmissionTemplatesLinkedToRemovedUsers.java | 47 -
.../v64/DropMetadataColumnsFromRules.java | 44 -
.../DropUniqueIndexOnQualityProfileKey.java | 41 -
...nQualityProfileOrganizationUuidAndKey.java | 42 -
.../v64/ExtendLoadedTemplateTypeColumn.java | 44 -
...keCeActivityExecutionCountNotNullable.java | 49 -
.../MakeCeQueueExecutionCountNotNullable.java | 48 -
...akeColumnNewProjectPrivateNotNullable.java | 43 -
.../MakeColumnProjectsPrivateNotNullable.java | 43 -
...keComponentsPrivateBasedOnPermissions.java | 282 ----
.../v64/MakeProjectUuidNotNullable.java | 65 -
.../v64/MakeQualityProfileKeyUnique.java | 50 -
...tyProfileOrganizationUuidAndKeyUnique.java | 55 -
...ityProfileOrganizationUuidNotNullable.java | 47 -
...teColumnDefaultGroupIdOfOrganizations.java | 63 -
.../v64/PopulateColumnProjectsPrivate.java | 51 -
.../v64/PopulateOrganizationMembersTable.java | 82 -
.../version/v64/PopulateRulesMetadata.java | 128 --
.../PurgeComponentsWithoutProjectUuid.java | 81 -
.../version/v64/RestoreSonarUsersGroups.java | 211 ---
.../v64/SetAllUsersIntoSonarUsersGroup.java | 56 -
.../v64/SetCopyComponentUuidOnLocalViews.java | 99 --
.../v64/SetNewProjectPrivateToFalse.java | 38 -
...etOrganizationMembersIntoMembersGroup.java | 56 -
...alityProfileOrganizationUuidToDefault.java | 43 -
...ateProjectInDefaultPermissionTemplate.java | 188 ---
.../SupportProjectVisibilityInTemplates.java | 55 -
...UpgradeQualityTemplateLoadedTemplates.java | 69 -
.../migration/version/v64/package-info.java | 24 -
.../v65/AddBuiltInFlagToRulesProfiles.java | 44 -
.../v65/AddIndexOnEsQueueCreatedAt.java | 47 -
...ndexRulesProfileUuidOnQProfileChanges.java | 53 -
.../version/v65/AddUsersOnboarded.java | 43 -
.../v65/CleanOrphanRowsInGroupRoles.java | 71 -
.../v65/CleanOrphanRowsInManualMeasures.java | 86 --
.../v65/CleanOrphanRowsInProjectLinks.java | 76 -
.../v65/CleanOrphanRowsInProperties.java | 85 -
.../v65/CleanOrphanRowsInUserRoles.java | 71 -
.../version/v65/CreateEsQueueTable.java | 72 -
.../v65/CreateTableDefaultQProfiles.java | 81 -
.../version/v65/CreateTableOrgQProfiles.java | 103 --
.../db/migration/version/v65/DbVersion65.java | 67 -
.../v65/DeleteCeWorkerCountSetting.java | 38 -
.../v65/DeleteLoadedTemplatesOnQProfiles.java | 45 -
.../v65/DeleteOrphansFromRulesProfiles.java | 51 -
.../v65/DropIndexEventsComponentUuid.java | 40 -
.../DropIndexManualMeasuresComponentUuid.java | 40 -
.../DropIsDefaultColumnFromRulesProfiles.java | 73 -
.../v65/DropOrgColumnsFromRulesProfiles.java | 42 -
.../version/v65/DropTableAuthors.java | 38 -
...reIssueProjectUuidConsistencyOnIssues.java | 57 -
.../MakeEventsComponentUuidNotNullable.java | 46 -
...anualMeasuresComponentUuidNotNullable.java | 46 -
...MakeRulesProfilesIsBuiltInNotNullable.java | 48 -
.../v65/MakeUsersOnboardedNotNullable.java | 46 -
.../v65/PopulateEventsComponentUuid.java | 83 -
.../version/v65/PopulateOrgQProfiles.java | 65 -
.../v65/PopulateTableDefaultQProfiles.java | 126 --
.../version/v65/PopulateUsersOnboarded.java | 44 -
.../version/v65/PurgeDeveloperData.java | 109 --
.../v65/RecreateIndexEventsComponentUuid.java | 49 -
...reateIndexManualMeasuresComponentUuid.java | 49 -
...eyToRulesProfileUuidOnQProfileChanges.java | 51 -
.../v65/SetRulesProfilesIsBuiltInToFalse.java | 46 -
...IsBuiltInToTrueForDefaultOrganization.java | 77 -
...eOrgQProfilesToPointToBuiltInProfiles.java | 124 --
.../migration/version/v65/package-info.java | 24 -
.../v66/AddBranchColumnToProjectsTable.java | 44 -
.../AddErrorTypeColumnToCeActivityTable.java | 45 -
.../v66/AddIndexOnProjectBranchesKey.java | 52 -
.../version/v66/AddPluginKeyToRules.java | 45 -
.../v66/CreateTableCeTaskCharacteristics.java | 83 -
.../version/v66/CreateTablePlugins.java | 81 -
.../v66/CreateTableProjectBranches.java | 76 -
.../v66/CreateTableQProfileEditGroups.java | 82 -
.../v66/CreateTableQProfileEditUsers.java | 82 -
.../db/migration/version/v66/DbVersion66.java | 44 -
.../v66/DeleteLeakSettingsOnViews.java | 47 -
.../v66/FixEmptyIdentityProviderInUsers.java | 55 -
.../v66/PopulateMainProjectBranches.java | 62 -
.../version/v66/PurgeTableProperties.java | 68 -
.../migration/version/v66/package-info.java | 24 -
.../AddAnalysisUuidToWebhookDeliveries.java | 48 -
.../version/v67/CleanupDisabledUsers.java | 66 -
.../version/v67/CopyDeprecatedServerId.java | 63 -
.../v67/CreateTableAnalysisProperties.java | 87 --
.../db/migration/version/v67/DbVersion67.java | 39 -
.../version/v67/DropOldLicenses.java | 51 -
...ratePreviousAnalysisToPreviousVersion.java | 48 -
...AnalysisUuidColumnOnWebhookDeliveries.java | 56 -
...idColumnToNullableOnWebhookDeliveries.java | 46 -
.../migration/version/v67/package-info.java | 24 -
...DefaultQualityGateUuidToOrganizations.java | 45 -
.../version/v70/AddHomepageToUsers.java | 50 -
.../v70/AddIsBuiltInToQualityGates.java | 44 -
.../v70/AddLiveMeasuresMetricIndex.java | 59 -
.../version/v70/AddSnapshotIsLastIndex.java | 47 -
.../version/v70/AddUuidToQualityGates.java | 44 -
...iateQualityGatesToDefaultOrganization.java | 61 -
.../version/v70/CreateBuiltInQualityGate.java | 62 -
.../v70/CreateOrgQualityGatesTable.java | 82 -
.../version/v70/CreateTableLiveMeasures.java | 109 --
.../v70/CreateTempTableLiveMeasuresP.java | 52 -
.../db/migration/version/v70/DbVersion70.java | 65 -
.../version/v70/DeleteFileMeasures.java | 48 -
.../DeleteGlobalSonarQualityGateSetting.java | 45 -
.../version/v70/DeletePersonMeasures.java | 87 --
.../v70/DropIndexOnPersonMeasures.java | 40 -
.../version/v70/DropLoadedTemplatesTable.java | 37 -
.../version/v70/DropSnapshotIsLastIndex.java | 40 -
.../v70/DropTempTableLiveMeasuresP.java | 40 -
.../DropUniqueIndexOnQualityGatesName.java | 40 -
.../MakeQualityGatesIsBuiltInNotNullable.java | 48 -
.../MakeUuidNotNullableOnQualityGates.java | 56 -
.../v70/PopulateDefaultQualityGate.java | 63 -
.../version/v70/PopulateLiveMeasures.java | 255 ---
.../version/v70/PopulateOrgQualityGates.java | 71 -
.../v70/PopulateQualityGatesIsBuiltIn.java | 55 -
.../v70/PopulateUuidOnQualityGates.java | 55 -
...alSonarQualityGateSettingToDefaultOrg.java | 78 -
.../v70/RemoveQualityGateLoadedTemplates.java | 47 -
.../v70/RenameOldSonarQubeWayQualityGate.java | 63 -
...yGateUuidAsNotNullableInOrganizations.java | 46 -
.../migration/version/v70/package-info.java | 24 -
.../v71/AddKeyTypeInProjectBranches.java | 46 -
...AddPullRequestBinaryInProjectBranches.java | 46 -
.../migration/version/v71/AddRuleScope.java | 45 -
...AddWebhookKeyToWebhookDeliveriesTable.java | 58 -
.../v71/CleanBrokenProjectToQGReferences.java | 72 -
.../v71/CleanCeChildTablesOrphans.java | 56 -
.../v71/CreateDeprecatedRuleKeysTable.java | 103 --
.../version/v71/CreateTableProjectLinks2.java | 77 -
.../version/v71/CreateWebhooksTable.java | 121 --
.../db/migration/version/v71/DbVersion71.java | 56 -
.../v71/DeleteMeasuresOfProjectCopies.java | 43 -
...teSettingsDefinedInSonarDotProperties.java | 127 --
.../version/v71/DropTableProjectLinks.java | 38 -
.../IncreaseBranchTypeSizeForPullRequest.java | 45 -
...keKeyTypeNotNullableInProjectBranches.java | 46 -
.../v71/MakeScopeNotNullableInRules.java | 46 -
.../v71/MigrateWebhooksToWebhooksTable.java | 292 ----
.../v71/PopulateTableProjectLinks2.java | 112 --
...enameTableProjectLinks2ToProjectLinks.java | 56 -
.../v71/ReplaceIndexInProjectBranches.java | 74 -
.../SetKeyTypeToBranchInProjectBranches.java | 53 -
.../version/v71/SetRuleScopeToMain.java | 50 -
.../UpdatePermissionTooLongTemplateKeys.java | 66 -
.../version/v71/UseRuleIdInQPChangesData.java | 85 -
.../migration/version/v71/package-info.java | 24 -
.../version/v72/AddExternalIdToUsers.java | 46 -
.../version/v72/AddFileSourceLineCount.java | 42 -
.../v72/AddHashMethodToUsersTable.java | 45 -
.../AddLineHashesVersionToFileSources.java | 44 -
.../v72/AddOrganizationUuidToUsers.java | 47 -
.../version/v72/AddRuleExternal.java | 45 -
.../migration/version/v72/AddUUIDtoUsers.java | 48 -
.../v72/AddUniqueIndexOnRulesParameters.java | 59 -
.../version/v72/AddUniqueIndexesOnUsers.java | 62 -
.../v72/CreateAlmAppInstallsTable.java | 109 --
.../v72/CreateProjectMappingsTable.java | 103 --
.../db/migration/version/v72/DbVersion72.java | 62 -
.../v72/DropUserIdFromOrganizations.java | 37 -
.../FixDuplicationInExternalLoginOnUsers.java | 56 -
.../v72/IncreaseCryptedPasswordSize.java | 45 -
.../MakeFileSourceLineCountNotNullable.java | 43 -
.../MakeSomeColumnsOfUsersNotNullable.java | 72 -
.../v72/PopulateFileSourceLineCount.java | 65 -
.../v72/PopulateHashMethodOnUsers.java | 44 -
.../v72/PopulateOrganizationUuidOnUsers.java | 55 -
.../version/v72/PopulateUUIDOnUsers.java | 58 -
.../v72/PurgeDuplicateRulesParameters.java | 75 -
.../version/v72/PurgeOrphansForCE.java | 65 -
...xternalIdentityToExternalLoginOnUsers.java | 46 -
...enameLoginToUserUuidOnTableUserTokens.java | 69 -
...ginToNoteUserUuidOnTableRulesMetadata.java | 48 -
...LoginToSubmitterUuidOnTableCeActivity.java | 52 -
...terLoginToSubmitterUuidOnTableCeQueue.java | 46 -
...rLoginToUserUuidOnTableManualMeasures.java | 48 -
...LoginToUserUuidOnTableQProfileChanges.java | 46 -
...uesFromExternalColumnsAndLoginOfUsers.java | 82 -
.../migration/version/v72/package-info.java | 24 -
.../v73/AddFromHotspotFlagToIssues.java | 47 -
.../v73/AddIndexOnOrganizationMembers.java | 47 -
.../v73/AddSecurityStandardsToRules.java | 49 -
.../v73/AddSubscriptionToOrganizations.java | 48 -
.../v73/CreateProjectAlmBindingsTable.java | 121 --
.../db/migration/version/v73/DbVersion73.java | 46 -
...MissingQualityProfilesOnOrganizations.java | 172 ---
...opulateHotspotAdminPermissionOnGroups.java | 70 -
...nPermissionOnTemplatesCharacteristics.java | 74 -
...tspotAdminPermissionOnTemplatesGroups.java | 74 -
...otspotAdminPermissionOnTemplatesUsers.java | 74 -
...PopulateHotspotAdminPermissionOnUsers.java | 70 -
.../v73/PopulateMainApplicationBranches.java | 65 -
.../PopulateSubscriptionOnOrganizations.java | 84 -
...ubscriptionOnOrganizationsNotNullable.java | 47 -
.../migration/version/v73/package-info.java | 24 -
.../v74/AddAdHocColumnsInInRulesMetadata.java | 62 -
...dPortfolioCreatorToSonarAdministrator.java | 81 -
...ultPermTemplateColumnsToOrganizations.java | 55 -
.../version/v74/AddIsAdHocToRules.java | 47 -
.../v74/AddTmpColumnsToCeActivity.java | 31 -
.../version/v74/AddTmpColumnsToCeQueue.java | 31 -
.../version/v74/AddTmpColumnsToCeTable.java | 70 -
.../v74/AddTmpLastKeyColumnsToCeActivity.java | 105 --
.../v74/CleanOrphanRowsInCeTables.java | 66 -
...ationsAndPortfoliosCreatorPermissions.java | 102 --
.../version/v74/CreateCeTaskMessage.java | 83 -
.../db/migration/version/v74/DbVersion74.java | 55 -
...aultPermTemplateViewFromOrganizations.java | 39 -
...eMainComponentUuidColumnsToCeActivity.java | 30 -
...lizeMainComponentUuidColumnsToCeQueue.java | 28 -
...lizeMainComponentUuidColumnsToCeTable.java | 91 --
...inalizeMainLastKeyColumnsToCeActivity.java | 146 --
...IncreaseOrganizationsKeeAndNameLength.java | 56 -
...ateDefaultPermTemplateOnOrganizations.java | 57 -
.../version/v74/PopulateIsAdHocOnRules.java | 54 -
...PopulateNullValuesOfIsExternalOnRules.java | 54 -
.../v74/PopulateTmpColumnsToCeActivity.java | 95 --
.../v74/PopulateTmpColumnsToCeQueue.java | 135 --
...PopulateTmpLastKeyColumnsToCeActivity.java | 74 -
...sExternalAndIsAdHocNotNullableInRules.java | 50 -
.../migration/version/v74/package-info.java | 24 -
.../version/v75/AddEventComponentChanges.java | 133 --
.../AddIsOwnerUserColumnInAlmAppInstall.java | 46 -
...ddUserExternalIdColumnInAlmAppInstall.java | 58 -
.../CreateOrganizationsAlmBindingsTable.java | 114 --
.../db/migration/version/v75/DbVersion75.java | 36 -
...sOwnerUserNotNullableInAlmAppInstalls.java | 46 -
.../migration/version/v75/package-info.java | 24 -
.../AddUniqueIndexInUserPropertiesTable.java | 58 -
...niqueIndexOnExternalLoginInUsersTable.java | 57 -
.../v76/CreateUserPropertiesTable.java | 94 --
.../db/migration/version/v76/DbVersion76.java | 41 -
.../v76/DeleteModuleAndFolderMeasures.java | 59 -
.../v76/DeleteUselessOnboardingSetting.java | 52 -
.../version/v76/DeleteUselessProperty.java | 45 -
.../version/v76/FixDirectionOfMetrics.java | 59 -
.../version/v76/MigrateModuleProperties.java | 125 --
...igrateNoMoreUsedQualityGateConditions.java | 428 -----
.../migration/version/v76/package-info.java | 24 -
.../version/v77/AddBuildStringToSnapshot.java | 50 -
.../AddLastConnectionDateToUserTokens.java | 46 -
.../v77/AddLastConnectionDateToUsers.java | 46 -
.../AddManualBaselineToProjectBranches.java | 53 -
.../AddMembersSyncFlagToOrgAlmBinding.java | 46 -
.../db/migration/version/v77/DbVersion77.java | 42 -
.../DeleteFavoritesExceedingOneHundred.java | 135 --
...itesOnNotSupportedComponentQualifiers.java | 50 -
.../DeleteTestDataTypeFromFileSources.java | 47 -
.../v77/DropDataTypeFromFileSources.java | 63 -
.../v77/DropElasticsearchIndexTests.java | 43 -
.../version/v77/TruncateEsQueue.java | 39 -
.../migration/version/v77/package-info.java | 24 -
.../v78/AddIndexToOrgQProfileParentUuid.java | 52 -
...dSecurityFieldsToElasticsearchIndices.java | 55 -
.../version/v78/AddSnapshotRevision.java | 47 -
.../version/v78/AddWebhooksSecret.java | 47 -
...reateInternalComponentPropertiesTable.java | 106 --
.../db/migration/version/v78/DbVersion78.java | 40 -
...nsOnNewAndResolvedIssuesNotifications.java | 49 -
.../version/v78/MigrateRevision.java | 50 -
.../v78/RemoveOrphansFromProjectBranches.java | 47 -
.../v78/UpdateSecurityHotspotsStatuses.java | 242 ---
.../migration/version/v78/package-info.java | 24 -
.../version/v79/CreateInitialSchema.java | 1375 +++++++++++++++++
.../db/migration/version/v79/DbVersion79.java | 8 +-
.../v79/MigrateVstsProviderToAzureDevOps.java | 65 -
.../version/v79/PopulateInitialSchema.java | 276 ++++
.../v79/PopulateInstallDateAndVersion.java | 90 --
.../version/v79/ReindexIssuesAndRules.java | 49 -
...oveQGConditionsOnSecurityReviewRating.java | 48 -
...ateEnvAndSystemVarsFromScannerContext.java | 59 -
.../MigrationConfigurationModuleTest.java | 2 +-
...faultOrganizationUuidProviderImplTest.java | 2 +-
.../TestDefaultOrganizationUuidProvider.java | 3 +-
.../version/v56/DbVersion56Test.java | 47 -
.../v56/PopulateInitialSchemaTest.java | 131 --
.../version/v561/DbVersion561Test.java | 47 -
...ateUsersExternalIdentityWhenEmptyTest.java | 102 --
...AddAnalysisUuidColumnToCeActivityTest.java | 82 -
.../AddAnalysisUuidColumnToEventsTest.java | 77 -
.../AddAnalysisUuidColumnToMeasuresTest.java | 78 -
.../v60/AddBColumnsToProjectsTest.java | 87 --
...ysisUuidColumnToDuplicationsIndexTest.java | 83 -
.../AddComponentUuidColumnToMeasuresTest.java | 75 -
...ddComponentUuidColumnsToSnapshotsTest.java | 76 -
...AddIndexOnComponentUuidOfMeasuresTest.java | 50 -
.../AddLastUsedColumnToRulesProfilesTest.java | 74 -
.../v60/AddProfileKeyToActivitiesTest.java | 72 -
.../AddUniqueIndexOnUuidOfSnapshotsTest.java | 49 -
.../AddUserUpdatedAtToRulesProfilesTest.java | 74 -
.../v60/AddUuidColumnToSnapshotsTest.java | 74 -
.../v60/AddUuidColumnsToProjectsTest.java | 67 -
.../CleanEventsWithoutAnalysisUuidTest.java | 90 --
.../v60/CleanEventsWithoutSnapshotIdTest.java | 89 --
...CleanMeasuresWithNullAnalysisUuidTest.java | 87 --
.../v60/CleanOrphanRowsInSnapshotsTest.java | 160 --
.../v60/CleanUsurperRootComponentsTest.java | 365 -----
...reatePermTemplatesCharacteristicsTest.java | 55 -
.../CreateTemporaryIndicesFor1211Test.java | 56 -
.../version/v60/DbVersion60Test.java | 48 -
...eteOrphanMeasuresWithoutComponentTest.java | 89 --
.../v60/DropIdColumnsFromProjectsTest.java | 50 -
.../v60/DropIdColumnsFromSnapshotsTest.java | 50 -
...ionsIndexSidFromDuplicationsIndexTest.java | 57 -
...opIndexProjectsRootIdFromProjectsTest.java | 58 -
...DropIndexProjectsUuidFromProjectsTest.java | 58 -
.../DropProjectIdColumnFromMeasuresTest.java | 48 -
.../DropRememberMeColumnsFromUsersTest.java | 48 -
...ResourceIndexRidFromResourceIndexTest.java | 58 -
...ropSnapshotIdColumnFromCeActivityTest.java | 48 -
.../DropSnapshotIdColumnFromEventsTest.java | 48 -
.../DropSnapshotIdColumnFromMeasuresTest.java | 48 -
...ropSnapshotProjectIdFromSnapshotsTest.java | 60 -
.../v60/DropTemporaryIndicesOf1210Test.java | 59 -
.../v60/DropTreeColumnsFromSnapshotsTest.java | 50 -
.../version/v60/DropTreesOfSnapshotsTest.java | 91 --
.../v60/DropUnusedMeasuresColumnsTest.java | 50 -
...FixProjectUuidOfDeveloperProjectsTest.java | 110 --
...MakeAnalysisUuidNotNullOnMeasuresTest.java | 87 --
...sisUuidNotNullOnDuplicationsIndexTest.java | 111 --
...nentUuidColumnsNotNullOnSnapshotsTest.java | 92 --
...akeComponentUuidNotNullOnMeasuresTest.java | 92 --
...MakeProfileKeyNotNullOnActivitiesTest.java | 78 -
.../MakeUuidColumnNotNullOnSnapshotsTest.java | 85 -
.../MakeUuidColumnsNotNullOnProjectsTest.java | 101 --
.../version/v60/Migration1223Test.java | 76 -
...ateAnalysisUuidColumnOnCeActivityTest.java | 113 --
.../v60/PopulateAnalysisUuidOnEventsTest.java | 136 --
.../PopulateAnalysisUuidOnMeasuresTest.java | 122 --
...ndAnalysisUuidOfDuplicationsIndexTest.java | 119 --
...teComponentUuidColumnsOfSnapshotsTest.java | 119 --
.../PopulateComponentUuidOfMeasuresTest.java | 121 --
...lateLastUsedColumnOfRulesProfilesTest.java | 134 --
.../PopulateProfileKeyOfActivitiesTest.java | 112 --
...ulateUserUpdatedAtOfRulesProfilesTest.java | 120 --
.../PopulateUuidColumnOnSnapshotsTest.java | 94 --
.../PopulateUuidColumnsOfProjectsTest.java | 114 --
.../PopulateUuidPathColumnOnProjectsTest.java | 173 ---
...eateIndexProjectsUuidFromProjectsTest.java | 54 -
.../RemoveUsersPasswordWhenNotLocalTest.java | 112 --
.../v61/AddErrorColumnsToCeActivityTest.java | 85 -
.../CopyActivitiesToQprofileChangesTest.java | 136 --
.../v61/CreateTableCeTaskInputTest.java | 62 -
.../CreateTableInternalPropertiesTest.java | 64 -
.../v61/CreateTableProperties2Test.java | 67 -
.../v61/CreateTableQprofileChangesTest.java | 64 -
.../v61/CreateTableRuleRepositoriesTest.java | 62 -
.../v61/CreateTableScannerContextTest.java | 62 -
.../version/v61/DbVersion61Test.java | 47 -
.../v61/DeleteProjectDashboardsTest.java | 139 --
.../v61/DeleteReportsFromCeQueueTest.java | 59 -
.../v61/DropIsGlobalFromDashboardsTest.java | 49 -
.../version/v61/Migration1304Test.java | 78 -
.../v61/PopulateTableProperties2Test.java | 403 -----
...moveViewsDefinitionFromPropertiesTest.java | 97 --
.../v62/AddIsRootColumnOnTableUsersTest.java | 53 -
.../AddOrganizationUuidToGroupRolesTest.java | 57 -
.../v62/AddOrganizationUuidToGroupsTest.java | 55 -
...nizationUuidToPermissionTemplatesTest.java | 56 -
.../AddOrganizationUuidToUserRolesTest.java | 57 -
.../v62/CreateDefaultOrganizationTest.java | 193 ---
.../v62/CreateTableOrganizationsTest.java | 68 -
.../v62/CreateTableWebhookDeliveriesTest.java | 76 -
.../version/v62/DbVersion62Test.java | 46 -
.../DeletePermissionShareDashboardTest.java | 73 -
.../v62/DropIssueFiltersTableTest.java | 51 -
.../v62/DropMeasureFiltersTableTest.java | 51 -
.../v62/DropRelatedDashboardTablesTest.java | 55 -
...ganizationUuidNotNullOnGroupRolesTest.java | 85 -
...keOrganizationUuidNotNullOnGroupsTest.java | 84 -
...nUuidNotNullOnPermissionTemplatesTest.java | 86 --
...rganizationUuidNotNullOnUserRolesTest.java | 85 -
...MakeRootColumnNotNullOnTableUsersTest.java | 51 -
.../PopulateIsRootColumnOnTableUsersTest.java | 195 ---
...ulateOrganizationUuidOfGroupRolesTest.java | 76 -
.../PopulateOrganizationUuidOfGroupsTest.java | 91 --
...nizationUuidOfPermissionTemplatesTest.java | 77 -
...pulateOrganizationUuidOfUserRolesTest.java | 76 -
...teQualityGateConditionsOnCoverageTest.java | 379 -----
.../AddColumnGuardedToOrganizationsTest.java | 55 -
...ermTemplateColumnsToOrganizationsTest.java | 56 -
...IndexOnOrganizationUuidOfProjectsTest.java | 53 -
.../AddOrganizationUuidToProjectsTest.java | 55 -
.../v63/AddUserIdToOrganizationsTest.java | 56 -
.../version/v63/AddUuidToEventsTest.java | 57 -
.../version/v63/DbVersion63Test.java | 47 -
.../v63/DeleteMeasuresHavingNoValueTest.java | 163 --
.../v63/DeleteUselessPropertiesTest.java | 162 --
.../v63/DropTableResourceIndexTest.java | 48 -
...GuardedOfOrganizationsNotNullableTest.java | 82 -
.../MakeDefaultOrganizationGuardedTest.java | 124 --
...nOrganizationsKeeUniqueReentranceTest.java | 80 -
...MakeIndexOnOrganizationsKeeUniqueTest.java | 79 -
...nizationUuidOfProjectsNotNullableTest.java | 85 -
.../v63/MakeUuidNotNullOnEventsTest.java | 86 --
...ulateColumnGuardedOfOrganizationsTest.java | 96 --
...ermTemplateColumnsOfOrganizationsTest.java | 298 ----
...opulateOrganizationUuidToProjectsTest.java | 112 --
.../v63/PopulateUuidColumnOfEventsTest.java | 92 --
.../version/v63/UnsetUserRootFlagsTest.java | 87 --
...tivityWorkerUuidAndExecutionCountTest.java | 54 -
...eQueueWorkerUuidAndExecutionCountTest.java | 54 -
.../v64/AddColumnNewProjectPrivateTest.java | 52 -
.../v64/AddColumnProjectsPrivateTest.java | 52 -
.../AddDefaultGroupIdToOrganizationsTest.java | 56 -
.../v64/AddIndexLoadedTemplatesTypeTest.java | 54 -
.../AddIndexOnActiveRuleParametersTest.java | 55 -
...AddQualityProfileOrganizationUuidTest.java | 42 -
.../version/v64/AddTagsToProjectsTest.java | 56 -
.../v64/CleanLoadedTemplateOrphansTest.java | 66 -
.../v64/CleanOrphanRowsInGroupsUsersTest.java | 115 --
...teMembersGroupsInEachOrganizationTest.java | 324 ----
.../CreateOrganizationMembersTableTest.java | 61 -
.../version/v64/CreateRulesMetadataTest.java | 70 -
.../version/v64/DbVersion64Test.java | 39 -
.../v64/DeleteDefaultGroupSettingTest.java | 87 --
...sionTemplatesLinkedToRemovedUsersTest.java | 134 --
.../v64/DropMetadataColumnsFromRulesTest.java | 49 -
...ropUniqueIndexOnQualityProfileKeyTest.java | 39 -
...lityProfileOrganizationUuidAndKeyTest.java | 40 -
.../ExtendLoadedTemplateTypeColumnTest.java | 78 -
...ActivityExecutionCountNotNullableTest.java | 93 --
...eCeQueueExecutionCountNotNullableTest.java | 88 --
...olumnNewProjectPrivateNotNullableTest.java | 42 -
...eColumnProjectsPrivateNotNullableTest.java | 42 -
...mponentsPrivateBasedOnPermissionsTest.java | 492 ------
.../v64/MakeProjectUuidNotNullableTest.java | 79 -
.../v64/MakeQualityProfileKeyUniqueTest.java | 40 -
...ofileOrganizationUuidAndKeyUniqueTest.java | 39 -
...lumnDefaultGroupIdOfOrganizationsTest.java | 179 ---
.../PopulateColumnProjectsPrivateTest.java | 101 --
.../PopulateOrganizationMembersTableTest.java | 311 ----
.../v64/PopulateRulesMetadataTest.java | 291 ----
...PurgeComponentsWithoutProjectUuidTest.java | 360 -----
.../v64/RestoreSonarUsersGroupsTest.java | 362 -----
.../SetAllUsersIntoSonarUsersGroupTest.java | 132 --
.../SetCopyComponentUuidOnLocalViewsTest.java | 209 ---
.../v64/SetNewProjectPrivateToFalseTest.java | 53 -
...ganizationMembersIntoMembersGroupTest.java | 173 ---
...yProfileOrganizationUuidToDefaultTest.java | 60 -
...fileOrganizationUuidToNotNullableTest.java | 42 -
...rojectInDefaultPermissionTemplateTest.java | 281 ----
...pportProjectVisibilityInTemplatesTest.java | 189 ---
...adeQualityTemplateLoadedTemplatesTest.java | 156 --
.../AddBuiltInFlagToRulesProfilesTest.java | 56 -
.../v65/AddIndexOnEsQueueCreatedAtTest.java | 41 -
...RulesProfileUuidOnQProfileChangesTest.java | 44 -
.../version/v65/AddUsersOnboardedTest.java | 43 -
.../v65/CleanOrphanRowsInGroupRolesTest.java | 188 ---
.../CleanOrphanRowsInManualMeasuresTest.java | 152 --
.../CleanOrphanRowsInProjectLinksTest.java | 115 --
.../v65/CleanOrphanRowsInPropertiesTest.java | 142 --
.../v65/CleanOrphanRowsInUserRolesTest.java | 176 ---
.../version/v65/CreateEsQueueTableTest.java | 55 -
.../v65/CreateTableDefaultQProfilesTest.java | 65 -
.../v65/CreateTableOrgQProfilesTest.java | 70 -
.../version/v65/DbVersion65Test.java | 39 -
.../v65/DeleteCeWorkerCountSettingTest.java | 82 -
.../DeleteLoadedTemplatesOnQProfilesTest.java | 73 -
.../DeleteOrphansFromRulesProfilesTest.java | 276 ----
.../v65/DropIndexEventsComponentUuidTest.java | 45 -
...pIndexManualMeasuresComponentUuidTest.java | 45 -
...pIsDefaultColumnFromRulesProfilesTest.java | 43 -
.../DropOrgColumnsFromRulesProfilesTest.java | 45 -
.../version/v65/DropTableAuthorsTest.java | 49 -
...sueProjectUuidConsistencyOnIssuesTest.java | 115 --
...akeEventsComponentUuidNotNullableTest.java | 69 -
...lMeasuresComponentUuidNotNullableTest.java | 66 -
...RulesProfilesIsBuiltInNotNullableTest.java | 60 -
.../MakeUsersOnboardedNotNullableTest.java | 63 -
.../v65/PopulateEventsComponentUuidTest.java | 129 --
.../version/v65/PopulateOrgQProfilesTest.java | 116 --
.../PopulateTableDefaultQProfilesTest.java | 111 --
.../v65/PopulateUsersOnboardedTest.java | 68 -
.../version/v65/PurgeDeveloperDataTest.java | 238 ---
.../RecreateIndexEventsComponentUuidTest.java | 44 -
...eIndexManualMeasuresComponentUuidTest.java | 44 -
...RulesProfileUuidOnQProfileChangesTest.java | 45 -
.../SetRulesProfilesIsBuiltInToFalseTest.java | 103 --
...iltInToTrueForDefaultOrganizationTest.java | 157 --
...QProfilesToPointToBuiltInProfilesTest.java | 200 ---
...dErrorTypeColumnToCeActivityTableTest.java | 55 -
.../version/v66/AddPluginKeyToRulesTest.java | 53 -
.../CreateTableCeTaskCharacteristicsTest.java | 61 -
.../version/v66/CreateTablePluginsTest.java | 68 -
.../v66/CreateTableProjectBranchesTest.java | 66 -
.../CreateTableQProfileEditGroupsTest.java | 66 -
.../v66/CreateTableQProfileEditUsersTest.java | 66 -
.../version/v66/DbVersion66Test.java | 41 -
.../v66/DeleteLeakSettingsOnViewsTest.java | 139 --
.../FixEmptyIdentityProviderInUsersTest.java | 105 --
.../v66/PopulateMainProjectBranchesTest.java | 124 --
.../version/v66/PurgeTablePropertiesTest.java | 95 --
...ddAnalysisUuidToWebhookDeliveriesTest.java | 55 -
.../version/v67/CleanupDisabledUsersTest.java | 227 ---
.../v67/CopyDeprecatedServerIdTest.java | 89 --
.../CreateTableAnalysisPropertiesTest.java | 54 -
.../version/v67/DbVersion67Test.java | 41 -
.../version/v67/DropOldLicensesTest.java | 80 -
...PreviousAnalysisToPreviousVersionTest.java | 105 --
...ysisUuidColumnOnWebhookDeliveriesTest.java | 110 --
...lumnToNullableOnWebhookDeliveriesTest.java | 55 -
...ultQualityGateUuidToOrganizationsTest.java | 55 -
.../version/v70/AddHomepageToUsersTest.java | 61 -
.../v70/AddIsBuiltInToQualityGatesTest.java | 56 -
.../v70/AddLiveMeasuresMetricIndexTest.java | 45 -
.../v70/AddSnapshotIsLastIndexTest.java | 52 -
.../v70/AddUuidToQualityGatesTest.java | 54 -
...QualityGatesToDefaultOrganizationTest.java | 152 --
.../v70/CreateBuiltInQualityGateTest.java | 86 --
.../v70/CreateOrgQualityGatesTableTest.java | 64 -
.../v70/CreateTableLiveMeasuresTest.java | 58 -
.../v70/CreateTempTableLiveMeasuresPTest.java | 52 -
.../version/v70/DbVersion70Test.java | 41 -
.../version/v70/DeleteFileMeasuresTest.java | 127 --
...leteGlobalSonarQualityGateSettingTest.java | 100 --
.../version/v70/DeletePersonMeasuresTest.java | 126 --
.../v70/DropIndexOnPersonMeasuresTest.java | 48 -
.../v70/DropLoadedTemplatesTableTest.java | 48 -
.../v70/DropSnapshotIsLastIndexTest.java | 47 -
.../v70/DropTempTableLiveMeasuresPTest.java | 51 -
...DropUniqueIndexOnQualityGatesNameTest.java | 51 -
...eQualityGatesIsBuiltInNotNullableTest.java | 57 -
...MakeUuidNotNullableOnQualityGatesTest.java | 55 -
.../v70/PopulateDefaultQualityGateTest.java | 146 --
.../version/v70/PopulateLiveMeasuresTest.java | 288 ----
.../v70/PopulateOrgQualityGatesTest.java | 145 --
.../PopulateQualityGatesIsBuiltInTest.java | 123 --
.../v70/PopulateUuidOnQualityGatesTest.java | 125 --
...narQualityGateSettingToDefaultOrgTest.java | 162 --
.../RemoveQualityGateLoadedTemplatesTest.java | 92 --
.../RenameOldSonarQubeWayQualityGateTest.java | 145 --
...eUuidAsNotNullableInOrganizationsTest.java | 57 -
.../v71/AddKeyTypeInProjectBranchesTest.java | 56 -
...ullRequestBinaryInProjectBranchesTest.java | 57 -
.../version/v71/AddRuleScopeTest.java | 54 -
...ebhookKeyToWebhookDeliveriesTableTest.java | 93 --
.../CleanBrokenProjectToQGReferencesTest.java | 154 --
.../v71/CleanCeChildTablesOrphansTest.java | 183 ---
.../CreateDeprecatedRuleKeysTableTest.java | 65 -
.../v71/CreateTableProjectLinks2Test.java | 66 -
.../version/v71/CreateWebhooksTableTest.java | 59 -
.../version/v71/DbVersion71Test.java | 41 -
.../DeleteMeasuresOfProjectCopiesTest.java | 104 --
...ttingsDefinedInSonarDotPropertiesTest.java | 130 --
.../v71/DropTableProjectLinksTest.java | 49 -
...reaseBranchTypeSizeForPullRequestTest.java | 67 -
...yTypeNotNullableInProjectBranchesTest.java | 61 -
.../v71/MakeScopeNotNullableInRulesTest.java | 56 -
.../MigrateWebhooksToWebhooksTableTest.java | 454 ------
.../v71/PopulateTableProjectLinks2Test.java | 208 ---
...eTableProjectLinks2ToProjectLinksTest.java | 57 -
.../ReplaceIndexInProjectBranchesTest.java | 87 --
...tKeyTypeToBranchInProjectBranchesTest.java | 108 --
.../version/v71/SetRuleScopeToMainTest.java | 92 --
...datePermissionTooLongTemplateKeysTest.java | 107 --
.../v71/UseRuleIdInQPChangesDataTest.java | 195 ---
.../version/v72/AddExternalIdToUsersTest.java | 55 -
.../v72/AddFileSourceLineCountTest.java | 55 -
.../v72/AddHashMethodToUsersTableTest.java | 54 -
...AddLineHashesVersionToFileSourcesTest.java | 53 -
.../v72/AddOrganizationUuidToUsersTest.java | 55 -
.../version/v72/AddRuleExternalTest.java | 58 -
.../version/v72/AddUUIDtoUsersTest.java | 59 -
.../AddUniqueIndexOnRulesParametersTest.java | 53 -
.../v72/AddUniqueIndexesOnUsersTest.java | 55 -
.../v72/CreateAlmAppInstallsTableTest.java | 69 -
.../v72/CreateProjectMappingsTableTest.java | 66 -
.../version/v72/DbVersion72Test.java | 40 -
.../v72/DropUserIdFromOrganizationsTest.java | 54 -
...DuplicationInExternalLoginOnUsersTest.java | 99 --
.../v72/IncreaseCryptedPasswordSizeTest.java | 64 -
...akeFileSourceLineCountNotNullableTest.java | 61 -
...MakeSomeColumnsOfUsersNotNullableTest.java | 61 -
.../v72/PopulateFileSourceLineCountTest.java | 89 --
.../v72/PopulateHashMethodOnUsersTest.java | 101 --
.../PopulateOrganizationUuidOnUsersTest.java | 130 --
.../version/v72/PopulateUUIDOnUsersTest.java | 135 --
.../PurgeDuplicateRulesParametersTest.java | 92 --
.../version/v72/PurgeOrphansForCETest.java | 215 ---
...nalIdentityToExternalLoginOnUsersTest.java | 57 -
...eLoginToUserUuidOnTableUserTokensTest.java | 58 -
...oNoteUserUuidOnTableRulesMetadataTest.java | 56 -
...nToSubmitterUuidOnTableCeActivityTest.java | 62 -
...oginToSubmitterUuidOnTableCeQueueTest.java | 56 -
...inToUserUuidOnTableManualMeasuresTest.java | 56 -
...nToUserUuidOnTableQProfileChangesTest.java | 55 -
...romExternalColumnsAndLoginOfUsersTest.java | 121 --
.../v73/AddFromHotspotFlagToIssuesTest.java | 55 -
.../AddIndexOnOrganizationMembersTest.java | 55 -
.../v73/AddSecurityStandardsToRulesTest.java | 56 -
.../AddSubscriptionToOrganizationsTest.java | 55 -
.../CreateProjectAlmBindingsTableTest.java | 71 -
.../version/v73/DbVersion73Test.java | 40 -
...ingQualityProfilesOnOrganizationsTest.java | 204 ---
...ateHotspotAdminPermissionOnGroupsTest.java | 77 -
...missionOnTemplatesCharacteristicsTest.java | 95 --
...tAdminPermissionOnTemplatesGroupsTest.java | 87 --
...otAdminPermissionOnTemplatesUsersTest.java | 87 --
...lateHotspotAdminPermissionOnUsersTest.java | 77 -
.../PopulateMainApplicationBranchesTest.java | 126 --
...pulateSubscriptionOnOrganizationsTest.java | 186 ---
...riptionOnOrganizationsNotNullableTest.java | 53 -
.../AddAdHocColumnsInInRulesMetadataTest.java | 60 -
...tfolioCreatorToSonarAdministratorTest.java | 148 --
...ermTemplateColumnsToOrganizationsTest.java | 55 -
.../version/v74/AddIsAdHocToRulesTest.java | 55 -
.../v74/AddTmpColumnsToCeActivityTest.java | 56 -
.../v74/AddTmpColumnsToCeQueueTest.java | 56 -
.../AddTmpLastKeyColumnsToCeActivityTest.java | 62 -
.../v74/CleanOrphanRowsInCeTablesTest.java | 193 ---
...nsAndPortfoliosCreatorPermissionsTest.java | 213 ---
.../version/v74/CreateCeTaskMessageTest.java | 68 -
.../version/v74/DbVersion74Test.java | 40 -
...PermTemplateViewFromOrganizationsTest.java | 54 -
...nComponentUuidColumnsToCeActivityTest.java | 63 -
...MainComponentUuidColumnsToCeQueueTest.java | 63 -
...izeMainLastKeyColumnsToCeActivityTest.java | 72 -
...easeOrganizationsKeeAndNameLengthTest.java | 55 -
...efaultPermTemplateOnOrganizationsTest.java | 109 --
.../v74/PopulateIsAdHocOnRulesTest.java | 120 --
...lateNullValuesOfIsExternalOnRulesTest.java | 105 --
.../PopulateTmpColumnsToCeActivityTest.java | 222 ---
.../v74/PopulateTmpColumnsToCeQueueTest.java | 216 ---
...lateTmpLastKeyColumnsToCeActivityTest.java | 116 --
.../db/migration/version/v74/Row.java | 67 -
...ernalAndIsAdHocNotNullableInRulesTest.java | 54 -
.../v75/AddEventComponentChangesTest.java | 75 -
...dIsOwnerUserColumnInAlmAppInstallTest.java | 56 -
...erExternalIdColumnInAlmAppInstallTest.java | 57 -
...eateOrganizationsAlmBindingsTableTest.java | 66 -
.../version/v75/DbVersion75Test.java | 40 -
...erUserNotNullableInAlmAppInstallsTest.java | 53 -
...dUniqueIndexInUserPropertiesTableTest.java | 55 -
...eIndexOnExternalLoginInUsersTableTest.java | 54 -
.../v76/CreateUserPropertiesTableTest.java | 63 -
.../version/v76/DbVersion76Test.java | 41 -
.../DeleteModuleAndFolderMeasuresTest.java | 139 --
.../DeleteUselessOnboardingSettingTest.java | 67 -
.../v76/DeleteUselessPropertyTest.java | 108 --
.../v76/FixDirectionOfMetricsTest.java | 101 --
.../v76/MigrateModulePropertiesTest.java | 201 ---
...teNoMoreUsedQualityGateConditionsTest.java | 311 ----
.../v77/AddBuildStringToSnapshotTest.java | 58 -
...AddLastConnectionDateToUserTokensTest.java | 58 -
.../v77/AddLastConnectionDateToUsersTest.java | 58 -
...ddManualBaselineToProjectBranchesTest.java | 56 -
...AddMembersSyncFlagToOrgAlmBindingTest.java | 56 -
.../version/v77/DbVersion77Test.java | 42 -
...eleteFavoritesExceedingOneHundredTest.java | 183 ---
...OnNotSupportedComponentQualifiersTest.java | 126 --
...DeleteTestDataTypeFromFileSourcesTest.java | 82 -
.../v77/DropDataTypeFromFileSourcesTest.java | 58 -
.../v77/DropElasticsearchIndexTestsTest.java | 60 -
.../version/v77/TruncateEsQueueTest.java | 85 -
.../AddIndexToOrgQProfileParentUuidTest.java | 54 -
...urityFieldsToElasticsearchIndicesTest.java | 57 -
.../version/v78/AddSnapshotRevisionTest.java | 55 -
.../version/v78/AddWebhooksSecretTest.java | 55 -
...eInternalComponentPropertiesTableTest.java | 62 -
.../version/v78/DbVersion78Test.java | 41 -
...NewAndResolvedIssuesNotificationsTest.java | 89 --
.../version/v78/MigrateRevisionTest.java | 94 --
.../RemoveOrphansFromProjectBranchesTest.java | 104 --
.../UpdateSecurityHotspotsStatusesTest.java | 233 ---
.../{v56 => v79}/CreateInitialSchemaTest.java | 45 +-
.../version/v79/DbVersion79Test.java | 16 +-
.../MigrateVstsProviderToAzureDevOpsTest.java | 105 --
.../v79/PopulateInitialSchemaTest.java | 257 +++
.../PopulateInstallDateAndVersionTest.java | 126 --
.../v79/ReindexIssuesAndRulesTest.java | 61 -
...GConditionsOnSecurityReviewRatingTest.java | 120 --
...nvAndSystemVarsFromScannerContextTest.java | 113 --
.../internal_properties.sql | 0
.../v56/PopulateInitialSchemaTest/v56.sql | 47 -
.../schema.sql | 17 -
.../old_ce_activity.sql | 17 -
.../events_before_6-0.sql | 12 -
.../old_measures.sql | 18 -
.../old_projects.sql | 23 -
.../duplications_index_5.6.sql | 9 -
.../project_measures_5.6.sql | 29 -
.../old_snapshots.sql | 33 -
.../rules_profiles.sql | 13 -
.../activities.sql | 10 -
.../rules_profiles.sql | 12 -
.../old_snapshots.sql | 32 -
.../old_projects.sql | 22 -
.../in_progress_events.sql | 15 -
.../in_progress_events.sql | 15 -
.../in_progress_measures.sql | 20 -
...progress_snapshots_and_children_tables.sql | 101 --
.../complete_schema.sql | 668 --------
.../empty.sql | 0
.../in_progress_project_measures.sql | 32 -
.../in_progress_snapshots.sql | 33 -
.../projects_5.6.sql | 23 -
.../in_progress_measures.sql | 20 -
.../in_progress_duplications_index.sql | 11 -
.../in_progress_snapshots.sql | 34 -
.../in_progress_project_measures.sql | 32 -
.../activities.sql | 11 -
.../in_progress_snapshots.sql | 34 -
.../in_progress_projects.sql | 25 -
.../in_progress_ce_activity.sql | 52 -
.../in_progress_events_with_snapshots.sql | 48 -
.../old_measures.sql | 54 -
.../in_progress_measures_with_snapshots.sql | 45 -
.../in_progress_snapshots_with_projects.sql | 57 -
.../in_progress_measures_with_projects.sql | 65 -
.../rules_profiles.sql | 84 -
.../activities.sql | 11 -
.../schema.sql | 25 -
.../in_progress_snapshots.sql | 34 -
.../in_progress_projects.sql | 25 -
.../in_progress_projects_and_snapshots.sql | 58 -
.../schema.sql | 15 -
.../old_ce_activity.sql | 17 -
.../schema.sql | 22 -
.../v61/CreateTableCeTaskInputTest/empty.sql | 0
.../empty.sql | 0
.../v61/CreateTableProperties2Test/empty.sql | 0
.../CreateTableQprofileChangesTest/empty.sql | 0
.../CreateTableRuleRepositoriesTest/empty.sql | 0
.../DeleteProjectDashboardsTest/schema.sql | 39 -
.../DeleteReportsFromCeQueueTest/schema.sql | 11 -
.../properties_and_properties_2_tables.sql | 20 -
.../properties_and_internal_properties.sql | 17 -
.../table_users.sql | 17 -
.../previous-group_roles.sql | 6 -
.../previous-groups.sql | 7 -
.../previous-permission_templates.sql | 9 -
.../previous-user_roles.sql | 10 -
.../organizations_and_internal_properties.sql | 21 -
.../CreateTableOrganizationsTest/empty.sql | 0
.../empty.sql | 0
.../roles.sql | 18 -
.../v62/DropIssueFiltersTableTest/schema.sql | 20 -
.../DropMeasureFiltersTableTest/schema.sql | 20 -
.../DropRelatedDashboardTablesTest/schema.sql | 47 -
.../in_progress_group_roles.sql | 11 -
.../in_progress_groups.sql | 8 -
.../in_progress_permission_templates.sql | 10 -
.../in_progress_user_roles.sql | 7 -
.../users_with_nullable_root.sql | 18 -
.../users_and_permissions_tables.sql | 52 -
.../group_roles.sql | 21 -
.../user_groups.sql | 16 -
.../permission_templates.sql | 18 -
.../user_roles.sql | 15 -
.../schema.sql | 40 -
.../previous-organizations.sql | 14 -
.../previous-organizations.sql | 10 -
.../projects.sql | 42 -
.../previous-projects.sql | 41 -
.../previous-organizations.sql | 15 -
.../AddUuidToEventsTest/previous-events.sql | 11 -
.../project_measures.sql | 21 -
.../properties.sql | 11 -
.../v63/DropTableResourceIndexTest/schema.sql | 12 -
.../organizations_with_nullable_guarded.sql | 15 -
.../organizations_and_internal_properties.sql | 24 -
.../organizations_with_unique_index.sql | 16 -
.../organizations_with_non_unique_index.sql | 16 -
.../projects_with_nullable_organization.sql | 42 -
.../in_progress_events.sql | 12 -
.../organizations.sql | 15 -
.../properties_and_organizations.sql | 47 -
.../projects_with_nullable_organization.sql | 42 -
.../in_progress_events.sql | 12 -
.../in_progress_users.sql | 18 -
.../ce_activity.sql | 23 -
.../ce_queue.sql | 14 -
...ons_without_new_project_private_column.sql | 17 -
.../projects_without_private_column.sql | 44 -
.../previous-organizations.sql | 16 -
.../loaded_templates_without_index.sql | 5 -
.../active_rule_parameters_without_index.sql | 7 -
.../initial.sql | 14 -
.../previous-projects.sql | 44 -
.../loaded-templates.sql | 5 -
.../initial.sql | 26 -
.../initial.sql | 66 -
.../empty.sql | 0
.../v64/CreateRulesMetadataTest/empty.sql | 0
.../DeleteDefaultGroupSettingTest/initial.sql | 11 -
.../initial.sql | 27 -
.../rules.sql | 31 -
.../initial.sql | 15 -
.../initial.sql | 15 -
.../loaded-templates.sql | 5 -
.../ce_activity.sql | 25 -
.../ce_queue.sql | 16 -
...th_nullable_new_project_private_column.sql | 18 -
.../projects_with_nullable_private_column.sql | 45 -
...rojects_and_group_roles_and_user_roles.sql | 93 --
.../projects_with_nullable_project_uuid.sql | 44 -
.../initial.sql | 14 -
.../initial.sql | 14 -
.../initial.sql | 35 -
.../projects_with_nullable_private_column.sql | 45 -
.../initial.sql | 77 -
...d_organization_and_internal_properties.sql | 73 -
.../projects_and_children_tables.sql | 242 ---
.../RestoreSonarUsersGroupsTest/initial.sql | 65 -
.../initial.sql | 36 -
.../in_progress_projects.sql | 43 -
.../initial.sql | 18 -
.../initial.sql | 61 -
.../initial.sql | 15 -
.../initial.sql | 15 -
...ns_and_groups_and_permission_templates.sql | 55 -
.../permission_templates_and_groups.sql | 19 -
...ternal_properties_and_loaded_templates.sql | 32 -
.../rules_profiles_6_4.sql | 15 -
.../initial.sql | 9 -
.../initial.sql | 9 -
.../users_without_onboarded_column.sql | 18 -
.../group_roles_and_projects.sql | 55 -
.../manual_measures_and_projects.sql | 58 -
.../project_links_and_projects.sql | 53 -
.../properties_and_projects.sql | 57 -
.../user_roles_and_projects.sql | 55 -
.../v65/CreateEsQueueTableTest/empty.sql | 0
.../CreateTableDefaultQProfilesTest/empty.sql | 0
.../v65/CreateTableOrgQProfilesTest/empty.sql | 0
.../properties.sql | 11 -
.../initial.sql | 6 -
.../initial.sql | 57 -
.../events.sql | 15 -
.../manual_measures.sql | 12 -
.../initial.sql | 16 -
.../initial.sql | 15 -
.../v65/DropTableAuthorsTest/authors.sql | 8 -
.../issues_and_projects.sql | 83 -
.../events.sql | 15 -
.../manual_measures.sql | 11 -
.../initial.sql | 16 -
.../users_with_nullable_onboarded_column.sql | 19 -
.../events_and_snapshots.sql | 44 -
.../v65/PopulateOrgQProfilesTest/initial.sql | 29 -
.../initial.sql | 26 -
.../users_with_onboarded_column.sql | 19 -
.../projects_and_child_tables.sql | 147 --
.../events.sql | 14 -
.../manual_measures.sql | 11 -
.../initial.sql | 9 -
.../initial.sql | 16 -
.../initial.sql | 34 -
.../initial.sql | 33 -
.../ce_activity_6_5.sql | 21 -
.../old_snapshots.sql | 29 -
.../v66/AddPluginKeyToRulesTest/rules_6_5.sql | 23 -
.../empty.sql | 0
.../v66/CreateTablePluginsTest/empty.sql | 0
.../CreateTableProjectBranchesTest/empty.sql | 0
.../empty.sql | 0
.../empty.sql | 0
.../settings_and_projects.sql | 57 -
.../users.sql | 19 -
.../initial.sql | 17 -
.../initial.sql | 58 -
.../PurgeTablePropertiesTest/properties.sql | 11 -
.../initial.sql | 16 -
.../v67/CleanupDisabledUsersTest/users.sql | 19 -
.../CopyDeprecatedServerIdTest/properties.sql | 11 -
.../empty.sql | 0
.../v67/DropOldLicensesTest/properties.sql | 11 -
.../properties.sql | 11 -
.../initial.sql | 46 -
.../initial.sql | 17 -
.../organizations.sql | 18 -
.../v70/AddHomepageToUsersTest/initial.sql | 19 -
.../quality_gates.sql | 7 -
.../live_measures.sql | 14 -
.../AddSnapshotIsLastIndexTest/snapshots.sql | 28 -
.../quality_gates.sql | 8 -
.../org_quality_gates.sql | 46 -
.../quality_gates.sql | 9 -
.../CreateOrgQualityGatesTableTest/empty.sql | 0
.../v70/CreateTableLiveMeasuresTest/empty.sql | 0
.../empty.sql | 0
.../v70/DeleteFileMeasuresTest/initial.sql | 98 --
.../properties.sql | 11 -
.../initial.sql | 98 --
.../v70/DeletePersonMeasuresTest/initial.sql | 98 --
.../DropIndexOnPersonMeasuresTest/initial.sql | 21 -
.../loaded_templates.sql | 6 -
.../DropSnapshotIsLastIndexTest/snapshots.sql | 29 -
.../live_measures_p.sql | 4 -
.../quality_gates.sql | 10 -
.../quality_gates.sql | 8 -
.../quality_gates.sql | 9 -
.../organizations.sql | 29 -
.../v70/PopulateLiveMeasuresTest/initial.sql | 121 --
.../org_quality_gates.sql | 37 -
.../quality_gates.sql | 8 -
.../quality_gates.sql | 9 -
.../initial.sql | 58 -
.../loaded_templates.sql | 6 -
.../quality_gates.sql | 8 -
.../organizations.sql | 19 -
.../project_branches.sql | 11 -
.../project_branches.sql | 12 -
.../version/v71/AddRuleScopeTest/rules.sql | 24 -
.../webhook-deliveries.sql | 18 -
.../properties_and_quality_gates.sql | 21 -
.../ce_tables.sql | 69 -
.../empty.sql | 0
.../CreateTableProjectLinks2Test/empty.sql | 0
.../v71/CreateWebhooksTableTest/empty.sql | 0
.../initial.sql | 68 -
.../properties.sql | 11 -
.../project_links.sql | 7 -
.../project_branches.sql | 11 -
.../project_branches.sql | 12 -
.../MakeScopeNotNullableInRulesTest/rules.sql | 25 -
.../migrate_webhooks.sql | 76 -
.../project_links2.sql | 64 -
.../project_links2.sql | 9 -
.../project_branches.sql | 12 -
.../project_branches.sql | 12 -
.../v71/SetRuleScopeToMainTest/rules.sql | 25 -
.../templates.sql | 10 -
.../rules_and_qprofile_changes.sql | 34 -
.../v72/AddExternalIdToUsersTest/users.sql | 22 -
.../file_sources.sql | 16 -
.../AddHashMethodToUsersTableTest/users.sql | 21 -
.../fileSources.sql | 17 -
.../AddOrganizationUuidToUsersTest/users.sql | 26 -
.../version/v72/AddRuleExternalTest/rules.sql | 25 -
.../version/v72/AddUUIDtoUsers/users.sql | 22 -
.../rules_parameters.sql | 9 -
.../v72/AddUniqueIndexesOnUsersTest/users.sql | 23 -
.../CreateAlmAppInstallsTableTest/empty.sql | 0
.../CreateProjectMappingsTableTest/empty.sql | 0
.../organizations.sql | 19 -
.../users.sql | 23 -
.../IncreaseCryptedPasswordSizeTest/users.sql | 21 -
.../file_sources.sql | 17 -
.../users.sql | 23 -
.../file_sources.sql | 17 -
.../PopulateHashMethodOnUsersTest/users.sql | 22 -
.../schema.sql | 47 -
.../v72/PopulateUUIDOnUsersTest/users.sql | 23 -
.../rules_parameters_etc.sql | 18 -
.../version/v72/PurgeOrphansForCETest/ce.sql | 75 -
.../users.sql | 23 -
.../issues.sql | 37 -
.../user_tokens.sql | 9 -
.../rules_metadata.sql | 15 -
.../ce_activity.sql | 27 -
.../ce_queue.sql | 16 -
.../manual_measures.sql | 12 -
.../qprofile_changes.sql | 9 -
.../users.sql | 23 -
.../AddFromHotspotFlagToIssuesTest/issues.sql | 37 -
.../organization_members.sql | 6 -
.../AddSecurityStandardsToRulesTest/rules.sql | 26 -
.../organizations.sql | 19 -
.../empty.sql | 0
.../schema.sql | 59 -
.../group_roles.sql | 9 -
.../perm_tpl_characteristics.sql | 9 -
.../perm_templates_groups.sql | 8 -
.../perm_templates_users.sql | 8 -
.../user_roles.sql | 9 -
.../schema.sql | 61 -
.../schema.sql | 67 -
.../organizations.sql | 19 -
.../rules_metadata.sql | 16 -
.../group_roles_and_internal_properties.sql | 36 -
.../previous-organizations.sql | 20 -
.../v74/AddIsAdHocToRulesTest/rules.sql | 27 -
.../ce_activity.sql | 26 -
.../AddTmpColumnsToCeQueueTest/ce_queue.sql | 16 -
.../ce_activity.sql | 30 -
.../ce_tables.sql | 83 -
.../perm_templates_groups.sql | 49 -
.../v74/CreateCeTaskMessageTest/empty.sql | 0
.../organizations.sql | 22 -
.../ce_activity.sql | 38 -
.../ce_queue.sql | 20 -
.../ce_activity.sql | 36 -
.../organizations.sql | 20 -
.../organizations.sql | 22 -
.../v74/PopulateIsAdHocOnRulesTest/rules.sql | 28 -
.../rules.sql | 27 -
.../ce_activity.sql | 87 --
.../ce_queue.sql | 77 -
.../ce_activity.sql | 38 -
.../rules.sql | 28 -
.../AddEventComponentChangesTest/empty.sql | 0
.../almAppInstalls.sql | 12 -
.../almAppInstalls.sql | 13 -
.../almAppInstalls.sql | 15 -
.../user_properties.sql | 10 -
.../users.sql | 27 -
.../project_measures.sql | 67 -
.../properties.sql | 11 -
.../DeleteUselessPropertyTest/properties.sql | 11 -
.../v76/FixDirectionOfMetricsTest/metrics.sql | 19 -
.../MigrateModulePropertiesTest/schema.sql | 35 -
.../qg-schema.sql | 41 -
.../snapshots.sql | 29 -
.../user_tokens.sql | 9 -
.../users.sql | 28 -
.../initial.sql | 16 -
.../org_alm_binding.sql | 12 -
.../schema.sql | 59 -
.../schema.sql | 59 -
.../file_sources.sql | 18 -
.../file_sources.sql | 18 -
.../v77/TruncateEsQueueTest/es_queue.sql | 11 -
.../org_qprofiles.sql | 14 -
.../v78/AddSnapshotRevisionTest/snapshots.sql | 29 -
.../v78/AddWebhooksSecretTest/webhooks.sql | 13 -
.../schema.sql | 11 -
.../v78/MigrateRevisionTest/snapshots.sql | 45 -
.../project_and_project_branches.sql | 62 -
.../schema.sql | 81 -
.../CreateInitialSchemaTest/empty.sql | 0
.../properties.sql | 12 -
.../v79/PopulateInitialSchemaTest/v79.sql | 968 ++++++++++++
.../schema.sql | 39 -
.../quality_gate_conditions.sql | 31 -
.../ce_scanner_context.sql | 8 -
1198 files changed, 2927 insertions(+), 74426 deletions(-)
rename server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/{v63 => }/DefaultOrganizationUuidProvider.java (96%)
rename server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/{v63 => }/DefaultOrganizationUuidProviderImpl.java (97%)
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v56/CreateInitialSchema.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v56/DbVersion56.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v56/PopulateInitialSchema.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v56/package-info.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v561/DbVersion561.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v561/UpdateUsersExternalIdentityWhenEmpty.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v561/package-info.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/AddAnalysisUuidColumnToCeActivity.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/AddAnalysisUuidColumnToEvents.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/AddAnalysisUuidColumnToMeasures.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/AddBColumnsToProjects.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/AddComponentUuidAndAnalysisUuidColumnToDuplicationsIndex.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/AddComponentUuidColumnToMeasures.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/AddComponentUuidColumnsToSnapshots.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/AddIndexOnAnalysisUuidOfMeasures.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/AddIndexOnComponentUuidOfMeasures.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/AddLastUsedColumnToRulesProfiles.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/AddProfileKeyToActivities.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/AddUniqueIndexOnUuidOfSnapshots.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/AddUserUpdatedAtToRulesProfiles.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/AddUuidColumnToSnapshots.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/AddUuidColumnsToProjects.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/AddUuidPathColumnToProjects.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/CleanEventsWithoutAnalysisUuid.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/CleanEventsWithoutSnapshotId.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/CleanMeasuresWithNullAnalysisUuid.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/CleanOrphanRowsInProjects.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/CleanOrphanRowsInSnapshots.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/CleanUsurperRootComponents.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/CreatePermTemplatesCharacteristics.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/CreateTemporaryIndicesFor1211.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/DbVersion60.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/DeleteOrphanDuplicationsIndexRowsWithoutComponentOrAnalysis.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/DeleteOrphanMeasuresWithoutComponent.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/DropIdColumnsFromProjects.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/DropIdColumnsFromSnapshots.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/DropIndexDuplicationsIndexSidFromDuplicationsIndex.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/DropIndexEventsSnapshotIdFromEvents.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/DropIndexOnSnapshotIdOfMeasures.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/DropIndexProjectsRootIdFromProjects.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/DropIndexProjectsUuidFromProjects.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/DropIndicesOnTreeColumnsOfSnapshots.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/DropProjectIdColumnFromMeasures.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/DropRememberMeColumnsFromUsers.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/DropResourceIndexRidFromResourceIndex.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/DropSnapshotIdColumnFromCeActivity.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/DropSnapshotIdColumnFromEvents.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/DropSnapshotIdColumnFromMeasures.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/DropSnapshotIdColumnsFromDuplicationsIndex.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/DropSnapshotProjectIdFromSnapshots.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/DropTemporaryIndicesOf1210.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/DropTreeColumnsFromSnapshots.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/DropTreesOfSnapshots.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/DropUnusedMeasuresColumns.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/FixProjectUuidOfDeveloperProjects.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/MakeAnalysisUuidNotNullOnEvents.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/MakeAnalysisUuidNotNullOnMeasures.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/MakeComponentUuidAndAnalysisUuidNotNullOnDuplicationsIndex.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/MakeComponentUuidColumnsNotNullOnSnapshots.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/MakeComponentUuidNotNullOnMeasures.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/MakeProfileKeyNotNullOnActivities.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/MakeUuidColumnNotNullOnSnapshots.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/MakeUuidColumnsNotNullOnProjects.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/MakeUuidPathColumnNotNullOnProjects.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/Migration1223.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/PopulateAnalysisUuidColumnOnCeActivity.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/PopulateAnalysisUuidOnEvents.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/PopulateAnalysisUuidOnMeasures.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/PopulateComponentUuidAndAnalysisUuidOfDuplicationsIndex.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/PopulateComponentUuidColumnsOfSnapshots.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/PopulateComponentUuidOfMeasures.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/PopulateLastUsedColumnOfRulesProfiles.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/PopulateProfileKeyOfActivities.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/PopulateUserUpdatedAtOfRulesProfiles.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/PopulateUuidColumnOnSnapshots.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/PopulateUuidColumnsOfProjects.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/PopulateUuidPathColumnOnProjects.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/RecreateIndexProjectsUuidFromProjects.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/RemoveUsersPasswordWhenNotLocal.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/TemporarilyDropIndexOfAnalysisUuidOnMeasures.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/package-info.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v61/AddBUuidPathToProjects.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v61/AddErrorColumnsToCeActivity.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v61/CopyActivitiesToQprofileChanges.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v61/CreateTableCeTaskInput.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v61/CreateTableInternalProperties.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v61/CreateTableProperties2.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v61/CreateTableQprofileChanges.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v61/CreateTableRuleRepositories.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v61/CreateTableScannerContext.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v61/DbVersion61.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v61/DeleteProjectDashboards.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v61/DeleteReportsFromCeQueue.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v61/DropIsGlobalFromDashboards.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v61/DropTableActivities.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v61/DropTableProperties.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v61/Migration1304.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v61/PopulateTableProperties2.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v61/RemoveViewsDefinitionFromProperties.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v61/RenameTableProperties2ToProperties.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v61/ShrinkModuleUuidPathOfProjects.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v61/package-info.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v62/AddIsRootColumnOnTableUsers.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v62/AddOrganizationUuidToGroupRoles.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v62/AddOrganizationUuidToGroups.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v62/AddOrganizationUuidToPermissionTemplates.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v62/AddOrganizationUuidToUserRoles.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v62/CreateDefaultOrganization.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v62/CreateTableOrganizations.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v62/CreateTableWebhookDeliveries.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v62/DbVersion62.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v62/DeletePermissionShareDashboard.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v62/DropIssueFiltersTables.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v62/DropMeasureFiltersTables.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v62/DropRelatedDashboardTables.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v62/IncludeOrganizationUuidInUniqueIndexOfGroupRoles.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v62/MakeOrganizationUuidNotNullOnGroupRoles.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v62/MakeOrganizationUuidNotNullOnGroups.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v62/MakeOrganizationUuidNotNullOnPermissionTemplates.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v62/MakeOrganizationUuidNotNullOnUserRoles.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v62/MakeRootColumnNotNullOnTableUsers.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v62/PopulateIsRootColumnOnTableUsers.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v62/PopulateOrganizationUuidOfGroupRoles.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v62/PopulateOrganizationUuidOfGroups.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v62/PopulateOrganizationUuidOfPermissionTemplates.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v62/PopulateOrganizationUuidOfUserRoles.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v62/UpdateQualityGateConditionsOnCoverage.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v62/package-info.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v63/AddColumnGuardedToOrganizations.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v63/AddDefaultPermTemplateColumnsToOrganizations.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v63/AddIndexOnOrganizationUuidOfProjects.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v63/AddOrganizationUuidToProjects.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v63/AddUserIdToOrganizations.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v63/AddUuidToEvents.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v63/DbVersion63.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v63/DeleteMeasuresHavingNoValue.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v63/DeleteUselessProperties.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v63/DropTableResourceIndex.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v63/MakeColumnGuardedOfOrganizationsNotNullable.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v63/MakeDefaultOrganizationGuarded.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v63/MakeIndexOnOrganizationsKeeUnique.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v63/MakeOrganizationUuidOfProjectsNotNullable.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v63/MakeUuidNotNullOnEvents.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v63/PopulateColumnGuardedOfOrganizations.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v63/PopulateDefaultPermTemplateColumnsOfOrganizations.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v63/PopulateOrganizationUuidToProjects.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v63/PopulateUuidColumnOfEvents.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v63/UnsetUserRootFlags.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v63/package-info.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/AddCeActivityWorkerUuidAndExecutionCount.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/AddCeQueueWorkerUuidAndExecutionCount.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/AddColumnNewProjectPrivate.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/AddColumnProjectsPrivate.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/AddDefaultGroupIdToOrganizations.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/AddIndexLoadedTemplatesType.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/AddIndexOnActiveRuleParameters.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/AddQualityProfileOrganizationUuid.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/AddTagsToProjects.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/CleanLoadedTemplateOrphans.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/CleanOrphanRowsInGroupsUsers.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/CreateMembersGroupsInEachOrganization.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/CreateOrganizationMembersTable.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/CreateRulesMetadata.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/DbVersion64.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/DeleteDefaultGroupSetting.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/DeletePermissionTemplatesLinkedToRemovedUsers.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/DropMetadataColumnsFromRules.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/DropUniqueIndexOnQualityProfileKey.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/DropUniqueIndexOnQualityProfileOrganizationUuidAndKey.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/ExtendLoadedTemplateTypeColumn.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/MakeCeActivityExecutionCountNotNullable.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/MakeCeQueueExecutionCountNotNullable.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/MakeColumnNewProjectPrivateNotNullable.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/MakeColumnProjectsPrivateNotNullable.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/MakeComponentsPrivateBasedOnPermissions.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/MakeProjectUuidNotNullable.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/MakeQualityProfileKeyUnique.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/MakeQualityProfileOrganizationUuidAndKeyUnique.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/MakeQualityProfileOrganizationUuidNotNullable.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/PopulateColumnDefaultGroupIdOfOrganizations.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/PopulateColumnProjectsPrivate.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/PopulateOrganizationMembersTable.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/PopulateRulesMetadata.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/PurgeComponentsWithoutProjectUuid.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/RestoreSonarUsersGroups.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/SetAllUsersIntoSonarUsersGroup.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/SetCopyComponentUuidOnLocalViews.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/SetNewProjectPrivateToFalse.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/SetOrganizationMembersIntoMembersGroup.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/SetQualityProfileOrganizationUuidToDefault.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/SupportPrivateProjectInDefaultPermissionTemplate.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/SupportProjectVisibilityInTemplates.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/UpgradeQualityTemplateLoadedTemplates.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/package-info.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/AddBuiltInFlagToRulesProfiles.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/AddIndexOnEsQueueCreatedAt.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/AddIndexRulesProfileUuidOnQProfileChanges.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/AddUsersOnboarded.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/CleanOrphanRowsInGroupRoles.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/CleanOrphanRowsInManualMeasures.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/CleanOrphanRowsInProjectLinks.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/CleanOrphanRowsInProperties.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/CleanOrphanRowsInUserRoles.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/CreateEsQueueTable.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/CreateTableDefaultQProfiles.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/CreateTableOrgQProfiles.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/DbVersion65.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/DeleteCeWorkerCountSetting.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/DeleteLoadedTemplatesOnQProfiles.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/DeleteOrphansFromRulesProfiles.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/DropIndexEventsComponentUuid.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/DropIndexManualMeasuresComponentUuid.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/DropIsDefaultColumnFromRulesProfiles.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/DropOrgColumnsFromRulesProfiles.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/DropTableAuthors.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/EnsureIssueProjectUuidConsistencyOnIssues.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/MakeEventsComponentUuidNotNullable.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/MakeManualMeasuresComponentUuidNotNullable.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/MakeRulesProfilesIsBuiltInNotNullable.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/MakeUsersOnboardedNotNullable.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/PopulateEventsComponentUuid.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/PopulateOrgQProfiles.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/PopulateTableDefaultQProfiles.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/PopulateUsersOnboarded.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/PurgeDeveloperData.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/RecreateIndexEventsComponentUuid.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/RecreateIndexManualMeasuresComponentUuid.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/RenameQProfileKeyToRulesProfileUuidOnQProfileChanges.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/SetRulesProfilesIsBuiltInToFalse.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/SetRulesProfilesIsBuiltInToTrueForDefaultOrganization.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/UpdateOrgQProfilesToPointToBuiltInProfiles.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/package-info.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v66/AddBranchColumnToProjectsTable.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v66/AddErrorTypeColumnToCeActivityTable.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v66/AddIndexOnProjectBranchesKey.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v66/AddPluginKeyToRules.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v66/CreateTableCeTaskCharacteristics.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v66/CreateTablePlugins.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v66/CreateTableProjectBranches.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v66/CreateTableQProfileEditGroups.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v66/CreateTableQProfileEditUsers.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v66/DbVersion66.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v66/DeleteLeakSettingsOnViews.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v66/FixEmptyIdentityProviderInUsers.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v66/PopulateMainProjectBranches.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v66/PurgeTableProperties.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v66/package-info.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v67/AddAnalysisUuidToWebhookDeliveries.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v67/CleanupDisabledUsers.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v67/CopyDeprecatedServerId.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v67/CreateTableAnalysisProperties.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v67/DbVersion67.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v67/DropOldLicenses.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v67/MigratePreviousAnalysisToPreviousVersion.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v67/PopulateAnalysisUuidColumnOnWebhookDeliveries.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v67/UpdateCeTaskUuidColumnToNullableOnWebhookDeliveries.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v67/package-info.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/AddDefaultQualityGateUuidToOrganizations.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/AddHomepageToUsers.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/AddIsBuiltInToQualityGates.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/AddLiveMeasuresMetricIndex.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/AddSnapshotIsLastIndex.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/AddUuidToQualityGates.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/AssociateQualityGatesToDefaultOrganization.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/CreateBuiltInQualityGate.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/CreateOrgQualityGatesTable.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/CreateTableLiveMeasures.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/CreateTempTableLiveMeasuresP.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/DbVersion70.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/DeleteFileMeasures.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/DeleteGlobalSonarQualityGateSetting.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/DeletePersonMeasures.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/DropIndexOnPersonMeasures.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/DropLoadedTemplatesTable.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/DropSnapshotIsLastIndex.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/DropTempTableLiveMeasuresP.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/DropUniqueIndexOnQualityGatesName.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/MakeQualityGatesIsBuiltInNotNullable.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/MakeUuidNotNullableOnQualityGates.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/PopulateDefaultQualityGate.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/PopulateLiveMeasures.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/PopulateOrgQualityGates.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/PopulateQualityGatesIsBuiltIn.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/PopulateUuidOnQualityGates.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/ReadGlobalSonarQualityGateSettingToDefaultOrg.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/RemoveQualityGateLoadedTemplates.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/RenameOldSonarQubeWayQualityGate.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/SetDefaultQualityGateUuidAsNotNullableInOrganizations.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/package-info.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v71/AddKeyTypeInProjectBranches.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v71/AddPullRequestBinaryInProjectBranches.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v71/AddRuleScope.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v71/AddWebhookKeyToWebhookDeliveriesTable.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v71/CleanBrokenProjectToQGReferences.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v71/CleanCeChildTablesOrphans.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v71/CreateDeprecatedRuleKeysTable.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v71/CreateTableProjectLinks2.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v71/CreateWebhooksTable.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v71/DbVersion71.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v71/DeleteMeasuresOfProjectCopies.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v71/DeleteSettingsDefinedInSonarDotProperties.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v71/DropTableProjectLinks.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v71/IncreaseBranchTypeSizeForPullRequest.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v71/MakeKeyTypeNotNullableInProjectBranches.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v71/MakeScopeNotNullableInRules.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v71/MigrateWebhooksToWebhooksTable.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v71/PopulateTableProjectLinks2.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v71/RenameTableProjectLinks2ToProjectLinks.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v71/ReplaceIndexInProjectBranches.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v71/SetKeyTypeToBranchInProjectBranches.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v71/SetRuleScopeToMain.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v71/UpdatePermissionTooLongTemplateKeys.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v71/UseRuleIdInQPChangesData.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v71/package-info.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/AddExternalIdToUsers.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/AddFileSourceLineCount.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/AddHashMethodToUsersTable.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/AddLineHashesVersionToFileSources.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/AddOrganizationUuidToUsers.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/AddRuleExternal.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/AddUUIDtoUsers.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/AddUniqueIndexOnRulesParameters.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/AddUniqueIndexesOnUsers.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/CreateAlmAppInstallsTable.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/CreateProjectMappingsTable.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/DbVersion72.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/DropUserIdFromOrganizations.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/FixDuplicationInExternalLoginOnUsers.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/IncreaseCryptedPasswordSize.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/MakeFileSourceLineCountNotNullable.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/MakeSomeColumnsOfUsersNotNullable.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/PopulateFileSourceLineCount.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/PopulateHashMethodOnUsers.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/PopulateOrganizationUuidOnUsers.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/PopulateUUIDOnUsers.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/PurgeDuplicateRulesParameters.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/PurgeOrphansForCE.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/RenameExternalIdentityToExternalLoginOnUsers.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/RenameLoginToUserUuidOnTableUserTokens.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/RenameNoteUserLoginToNoteUserUuidOnTableRulesMetadata.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/RenameSubmitterLoginToSubmitterUuidOnTableCeActivity.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/RenameSubmitterLoginToSubmitterUuidOnTableCeQueue.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/RenameUserLoginToUserUuidOnTableManualMeasures.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/RenameUserLoginToUserUuidOnTableQProfileChanges.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/UpdateNullValuesFromExternalColumnsAndLoginOfUsers.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/package-info.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v73/AddFromHotspotFlagToIssues.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v73/AddIndexOnOrganizationMembers.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v73/AddSecurityStandardsToRules.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v73/AddSubscriptionToOrganizations.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v73/CreateProjectAlmBindingsTable.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v73/DbVersion73.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v73/FixMissingQualityProfilesOnOrganizations.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v73/PopulateHotspotAdminPermissionOnGroups.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v73/PopulateHotspotAdminPermissionOnTemplatesCharacteristics.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v73/PopulateHotspotAdminPermissionOnTemplatesGroups.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v73/PopulateHotspotAdminPermissionOnTemplatesUsers.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v73/PopulateHotspotAdminPermissionOnUsers.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v73/PopulateMainApplicationBranches.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v73/PopulateSubscriptionOnOrganizations.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v73/SetSubscriptionOnOrganizationsNotNullable.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v73/package-info.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v74/AddAdHocColumnsInInRulesMetadata.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v74/AddApplicationCreatorAndPortfolioCreatorToSonarAdministrator.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v74/AddDefaultPermTemplateColumnsToOrganizations.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v74/AddIsAdHocToRules.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v74/AddTmpColumnsToCeActivity.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v74/AddTmpColumnsToCeQueue.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v74/AddTmpColumnsToCeTable.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v74/AddTmpLastKeyColumnsToCeActivity.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v74/CleanOrphanRowsInCeTables.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v74/CreateApplicationsAndPortfoliosCreatorPermissions.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v74/CreateCeTaskMessage.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v74/DbVersion74.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v74/DropDefaultPermTemplateViewFromOrganizations.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v74/FinalizeMainComponentUuidColumnsToCeActivity.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v74/FinalizeMainComponentUuidColumnsToCeQueue.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v74/FinalizeMainComponentUuidColumnsToCeTable.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v74/FinalizeMainLastKeyColumnsToCeActivity.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v74/IncreaseOrganizationsKeeAndNameLength.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v74/PopulateDefaultPermTemplateOnOrganizations.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v74/PopulateIsAdHocOnRules.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v74/PopulateNullValuesOfIsExternalOnRules.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v74/PopulateTmpColumnsToCeActivity.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v74/PopulateTmpColumnsToCeQueue.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v74/PopulateTmpLastKeyColumnsToCeActivity.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v74/SetIsExternalAndIsAdHocNotNullableInRules.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v74/package-info.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v75/AddEventComponentChanges.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v75/AddIsOwnerUserColumnInAlmAppInstall.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v75/AddUserExternalIdColumnInAlmAppInstall.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v75/CreateOrganizationsAlmBindingsTable.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v75/DbVersion75.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v75/SetIsOwnerUserNotNullableInAlmAppInstalls.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v75/package-info.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v76/AddUniqueIndexInUserPropertiesTable.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v76/AddUniqueIndexOnExternalLoginInUsersTable.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v76/CreateUserPropertiesTable.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v76/DbVersion76.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v76/DeleteModuleAndFolderMeasures.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v76/DeleteUselessOnboardingSetting.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v76/DeleteUselessProperty.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v76/FixDirectionOfMetrics.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v76/MigrateModuleProperties.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v76/MigrateNoMoreUsedQualityGateConditions.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v76/package-info.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v77/AddBuildStringToSnapshot.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v77/AddLastConnectionDateToUserTokens.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v77/AddLastConnectionDateToUsers.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v77/AddManualBaselineToProjectBranches.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v77/AddMembersSyncFlagToOrgAlmBinding.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v77/DbVersion77.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v77/DeleteFavoritesExceedingOneHundred.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v77/DeleteFavouritesOnNotSupportedComponentQualifiers.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v77/DeleteTestDataTypeFromFileSources.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v77/DropDataTypeFromFileSources.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v77/DropElasticsearchIndexTests.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v77/TruncateEsQueue.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v77/package-info.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v78/AddIndexToOrgQProfileParentUuid.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v78/AddSecurityFieldsToElasticsearchIndices.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v78/AddSnapshotRevision.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v78/AddWebhooksSecret.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v78/CreateInternalComponentPropertiesTable.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v78/DbVersion78.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v78/DeleteOverallSubscriptionsOnNewAndResolvedIssuesNotifications.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v78/MigrateRevision.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v78/RemoveOrphansFromProjectBranches.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v78/UpdateSecurityHotspotsStatuses.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v78/package-info.java
create mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v79/CreateInitialSchema.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v79/MigrateVstsProviderToAzureDevOps.java
create mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v79/PopulateInitialSchema.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v79/PopulateInstallDateAndVersion.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v79/ReindexIssuesAndRules.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v79/RemoveQGConditionsOnSecurityReviewRating.java
delete mode 100644 server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v79/TruncateEnvAndSystemVarsFromScannerContext.java
rename server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/{v63 => }/DefaultOrganizationUuidProviderImplTest.java (97%)
rename server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/{v63 => }/TestDefaultOrganizationUuidProvider.java (94%)
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v56/DbVersion56Test.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v56/PopulateInitialSchemaTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v561/DbVersion561Test.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v561/UpdateUsersExternalIdentityWhenEmptyTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v60/AddAnalysisUuidColumnToCeActivityTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v60/AddAnalysisUuidColumnToEventsTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v60/AddAnalysisUuidColumnToMeasuresTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v60/AddBColumnsToProjectsTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v60/AddComponentUuidAndAnalysisUuidColumnToDuplicationsIndexTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v60/AddComponentUuidColumnToMeasuresTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v60/AddComponentUuidColumnsToSnapshotsTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v60/AddIndexOnComponentUuidOfMeasuresTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v60/AddLastUsedColumnToRulesProfilesTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v60/AddProfileKeyToActivitiesTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v60/AddUniqueIndexOnUuidOfSnapshotsTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v60/AddUserUpdatedAtToRulesProfilesTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v60/AddUuidColumnToSnapshotsTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v60/AddUuidColumnsToProjectsTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v60/CleanEventsWithoutAnalysisUuidTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v60/CleanEventsWithoutSnapshotIdTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v60/CleanMeasuresWithNullAnalysisUuidTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v60/CleanOrphanRowsInSnapshotsTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v60/CleanUsurperRootComponentsTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v60/CreatePermTemplatesCharacteristicsTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v60/CreateTemporaryIndicesFor1211Test.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v60/DbVersion60Test.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v60/DeleteOrphanMeasuresWithoutComponentTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v60/DropIdColumnsFromProjectsTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v60/DropIdColumnsFromSnapshotsTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v60/DropIndexDuplicationsIndexSidFromDuplicationsIndexTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v60/DropIndexProjectsRootIdFromProjectsTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v60/DropIndexProjectsUuidFromProjectsTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v60/DropProjectIdColumnFromMeasuresTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v60/DropRememberMeColumnsFromUsersTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v60/DropResourceIndexRidFromResourceIndexTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v60/DropSnapshotIdColumnFromCeActivityTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v60/DropSnapshotIdColumnFromEventsTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v60/DropSnapshotIdColumnFromMeasuresTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v60/DropSnapshotProjectIdFromSnapshotsTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v60/DropTemporaryIndicesOf1210Test.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v60/DropTreeColumnsFromSnapshotsTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v60/DropTreesOfSnapshotsTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v60/DropUnusedMeasuresColumnsTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v60/FixProjectUuidOfDeveloperProjectsTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v60/MakeAnalysisUuidNotNullOnMeasuresTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v60/MakeComponentUuidAndAnalysisUuidNotNullOnDuplicationsIndexTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v60/MakeComponentUuidColumnsNotNullOnSnapshotsTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v60/MakeComponentUuidNotNullOnMeasuresTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v60/MakeProfileKeyNotNullOnActivitiesTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v60/MakeUuidColumnNotNullOnSnapshotsTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v60/MakeUuidColumnsNotNullOnProjectsTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v60/Migration1223Test.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v60/PopulateAnalysisUuidColumnOnCeActivityTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v60/PopulateAnalysisUuidOnEventsTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v60/PopulateAnalysisUuidOnMeasuresTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v60/PopulateComponentUuidAndAnalysisUuidOfDuplicationsIndexTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v60/PopulateComponentUuidColumnsOfSnapshotsTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v60/PopulateComponentUuidOfMeasuresTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v60/PopulateLastUsedColumnOfRulesProfilesTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v60/PopulateProfileKeyOfActivitiesTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v60/PopulateUserUpdatedAtOfRulesProfilesTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v60/PopulateUuidColumnOnSnapshotsTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v60/PopulateUuidColumnsOfProjectsTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v60/PopulateUuidPathColumnOnProjectsTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v60/RecreateIndexProjectsUuidFromProjectsTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v60/RemoveUsersPasswordWhenNotLocalTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v61/AddErrorColumnsToCeActivityTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v61/CopyActivitiesToQprofileChangesTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v61/CreateTableCeTaskInputTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v61/CreateTableInternalPropertiesTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v61/CreateTableProperties2Test.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v61/CreateTableQprofileChangesTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v61/CreateTableRuleRepositoriesTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v61/CreateTableScannerContextTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v61/DbVersion61Test.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v61/DeleteProjectDashboardsTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v61/DeleteReportsFromCeQueueTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v61/DropIsGlobalFromDashboardsTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v61/Migration1304Test.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v61/PopulateTableProperties2Test.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v61/RemoveViewsDefinitionFromPropertiesTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v62/AddIsRootColumnOnTableUsersTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v62/AddOrganizationUuidToGroupRolesTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v62/AddOrganizationUuidToGroupsTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v62/AddOrganizationUuidToPermissionTemplatesTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v62/AddOrganizationUuidToUserRolesTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v62/CreateDefaultOrganizationTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v62/CreateTableOrganizationsTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v62/CreateTableWebhookDeliveriesTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v62/DbVersion62Test.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v62/DeletePermissionShareDashboardTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v62/DropIssueFiltersTableTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v62/DropMeasureFiltersTableTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v62/DropRelatedDashboardTablesTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v62/MakeOrganizationUuidNotNullOnGroupRolesTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v62/MakeOrganizationUuidNotNullOnGroupsTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v62/MakeOrganizationUuidNotNullOnPermissionTemplatesTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v62/MakeOrganizationUuidNotNullOnUserRolesTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v62/MakeRootColumnNotNullOnTableUsersTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v62/PopulateIsRootColumnOnTableUsersTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v62/PopulateOrganizationUuidOfGroupRolesTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v62/PopulateOrganizationUuidOfGroupsTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v62/PopulateOrganizationUuidOfPermissionTemplatesTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v62/PopulateOrganizationUuidOfUserRolesTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v62/UpdateQualityGateConditionsOnCoverageTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v63/AddColumnGuardedToOrganizationsTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v63/AddDefaultPermTemplateColumnsToOrganizationsTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v63/AddIndexOnOrganizationUuidOfProjectsTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v63/AddOrganizationUuidToProjectsTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v63/AddUserIdToOrganizationsTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v63/AddUuidToEventsTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v63/DbVersion63Test.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v63/DeleteMeasuresHavingNoValueTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v63/DeleteUselessPropertiesTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v63/DropTableResourceIndexTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v63/MakeColumnGuardedOfOrganizationsNotNullableTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v63/MakeDefaultOrganizationGuardedTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v63/MakeIndexOnOrganizationsKeeUniqueReentranceTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v63/MakeIndexOnOrganizationsKeeUniqueTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v63/MakeOrganizationUuidOfProjectsNotNullableTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v63/MakeUuidNotNullOnEventsTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v63/PopulateColumnGuardedOfOrganizationsTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v63/PopulateDefaultPermTemplateColumnsOfOrganizationsTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v63/PopulateOrganizationUuidToProjectsTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v63/PopulateUuidColumnOfEventsTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v63/UnsetUserRootFlagsTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v64/AddCeActivityWorkerUuidAndExecutionCountTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v64/AddCeQueueWorkerUuidAndExecutionCountTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v64/AddColumnNewProjectPrivateTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v64/AddColumnProjectsPrivateTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v64/AddDefaultGroupIdToOrganizationsTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v64/AddIndexLoadedTemplatesTypeTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v64/AddIndexOnActiveRuleParametersTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v64/AddQualityProfileOrganizationUuidTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v64/AddTagsToProjectsTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v64/CleanLoadedTemplateOrphansTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v64/CleanOrphanRowsInGroupsUsersTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v64/CreateMembersGroupsInEachOrganizationTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v64/CreateOrganizationMembersTableTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v64/CreateRulesMetadataTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v64/DbVersion64Test.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v64/DeleteDefaultGroupSettingTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v64/DeletePermissionTemplatesLinkedToRemovedUsersTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v64/DropMetadataColumnsFromRulesTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v64/DropUniqueIndexOnQualityProfileKeyTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v64/DropUniqueIndexOnQualityProfileOrganizationUuidAndKeyTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v64/ExtendLoadedTemplateTypeColumnTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v64/MakeCeActivityExecutionCountNotNullableTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v64/MakeCeQueueExecutionCountNotNullableTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v64/MakeColumnNewProjectPrivateNotNullableTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v64/MakeColumnProjectsPrivateNotNullableTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v64/MakeComponentsPrivateBasedOnPermissionsTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v64/MakeProjectUuidNotNullableTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v64/MakeQualityProfileKeyUniqueTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v64/MakeQualityProfileOrganizationUuidAndKeyUniqueTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v64/PopulateColumnDefaultGroupIdOfOrganizationsTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v64/PopulateColumnProjectsPrivateTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v64/PopulateOrganizationMembersTableTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v64/PopulateRulesMetadataTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v64/PurgeComponentsWithoutProjectUuidTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v64/RestoreSonarUsersGroupsTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v64/SetAllUsersIntoSonarUsersGroupTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v64/SetCopyComponentUuidOnLocalViewsTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v64/SetNewProjectPrivateToFalseTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v64/SetOrganizationMembersIntoMembersGroupTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v64/SetQualityProfileOrganizationUuidToDefaultTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v64/SetQualityProfileOrganizationUuidToNotNullableTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v64/SupportPrivateProjectInDefaultPermissionTemplateTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v64/SupportProjectVisibilityInTemplatesTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v64/UpgradeQualityTemplateLoadedTemplatesTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v65/AddBuiltInFlagToRulesProfilesTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v65/AddIndexOnEsQueueCreatedAtTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v65/AddIndexRulesProfileUuidOnQProfileChangesTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v65/AddUsersOnboardedTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v65/CleanOrphanRowsInGroupRolesTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v65/CleanOrphanRowsInManualMeasuresTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v65/CleanOrphanRowsInProjectLinksTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v65/CleanOrphanRowsInPropertiesTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v65/CleanOrphanRowsInUserRolesTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v65/CreateEsQueueTableTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v65/CreateTableDefaultQProfilesTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v65/CreateTableOrgQProfilesTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v65/DbVersion65Test.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v65/DeleteCeWorkerCountSettingTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v65/DeleteLoadedTemplatesOnQProfilesTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v65/DeleteOrphansFromRulesProfilesTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v65/DropIndexEventsComponentUuidTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v65/DropIndexManualMeasuresComponentUuidTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v65/DropIsDefaultColumnFromRulesProfilesTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v65/DropOrgColumnsFromRulesProfilesTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v65/DropTableAuthorsTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v65/EnsureIssueProjectUuidConsistencyOnIssuesTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v65/MakeEventsComponentUuidNotNullableTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v65/MakeManualMeasuresComponentUuidNotNullableTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v65/MakeRulesProfilesIsBuiltInNotNullableTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v65/MakeUsersOnboardedNotNullableTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v65/PopulateEventsComponentUuidTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v65/PopulateOrgQProfilesTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v65/PopulateTableDefaultQProfilesTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v65/PopulateUsersOnboardedTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v65/PurgeDeveloperDataTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v65/RecreateIndexEventsComponentUuidTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v65/RecreateIndexManualMeasuresComponentUuidTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v65/RenameQProfileKeyToRulesProfileUuidOnQProfileChangesTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v65/SetRulesProfilesIsBuiltInToFalseTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v65/SetRulesProfilesIsBuiltInToTrueForDefaultOrganizationTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v65/UpdateOrgQProfilesToPointToBuiltInProfilesTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v66/AddErrorTypeColumnToCeActivityTableTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v66/AddPluginKeyToRulesTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v66/CreateTableCeTaskCharacteristicsTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v66/CreateTablePluginsTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v66/CreateTableProjectBranchesTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v66/CreateTableQProfileEditGroupsTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v66/CreateTableQProfileEditUsersTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v66/DbVersion66Test.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v66/DeleteLeakSettingsOnViewsTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v66/FixEmptyIdentityProviderInUsersTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v66/PopulateMainProjectBranchesTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v66/PurgeTablePropertiesTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v67/AddAnalysisUuidToWebhookDeliveriesTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v67/CleanupDisabledUsersTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v67/CopyDeprecatedServerIdTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v67/CreateTableAnalysisPropertiesTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v67/DbVersion67Test.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v67/DropOldLicensesTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v67/MigratePreviousAnalysisToPreviousVersionTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v67/PopulateAnalysisUuidColumnOnWebhookDeliveriesTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v67/UpdateCeTaskUuidColumnToNullableOnWebhookDeliveriesTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v70/AddDefaultQualityGateUuidToOrganizationsTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v70/AddHomepageToUsersTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v70/AddIsBuiltInToQualityGatesTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v70/AddLiveMeasuresMetricIndexTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v70/AddSnapshotIsLastIndexTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v70/AddUuidToQualityGatesTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v70/AssociateQualityGatesToDefaultOrganizationTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v70/CreateBuiltInQualityGateTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v70/CreateOrgQualityGatesTableTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v70/CreateTableLiveMeasuresTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v70/CreateTempTableLiveMeasuresPTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v70/DbVersion70Test.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v70/DeleteFileMeasuresTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v70/DeleteGlobalSonarQualityGateSettingTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v70/DeletePersonMeasuresTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v70/DropIndexOnPersonMeasuresTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v70/DropLoadedTemplatesTableTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v70/DropSnapshotIsLastIndexTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v70/DropTempTableLiveMeasuresPTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v70/DropUniqueIndexOnQualityGatesNameTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v70/MakeQualityGatesIsBuiltInNotNullableTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v70/MakeUuidNotNullableOnQualityGatesTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v70/PopulateDefaultQualityGateTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v70/PopulateLiveMeasuresTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v70/PopulateOrgQualityGatesTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v70/PopulateQualityGatesIsBuiltInTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v70/PopulateUuidOnQualityGatesTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v70/ReadGlobalSonarQualityGateSettingToDefaultOrgTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v70/RemoveQualityGateLoadedTemplatesTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v70/RenameOldSonarQubeWayQualityGateTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v70/SetDefaultQualityGateUuidAsNotNullableInOrganizationsTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v71/AddKeyTypeInProjectBranchesTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v71/AddPullRequestBinaryInProjectBranchesTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v71/AddRuleScopeTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v71/AddWebhookKeyToWebhookDeliveriesTableTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v71/CleanBrokenProjectToQGReferencesTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v71/CleanCeChildTablesOrphansTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v71/CreateDeprecatedRuleKeysTableTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v71/CreateTableProjectLinks2Test.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v71/CreateWebhooksTableTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v71/DbVersion71Test.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v71/DeleteMeasuresOfProjectCopiesTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v71/DeleteSettingsDefinedInSonarDotPropertiesTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v71/DropTableProjectLinksTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v71/IncreaseBranchTypeSizeForPullRequestTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v71/MakeKeyTypeNotNullableInProjectBranchesTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v71/MakeScopeNotNullableInRulesTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v71/MigrateWebhooksToWebhooksTableTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v71/PopulateTableProjectLinks2Test.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v71/RenameTableProjectLinks2ToProjectLinksTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v71/ReplaceIndexInProjectBranchesTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v71/SetKeyTypeToBranchInProjectBranchesTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v71/SetRuleScopeToMainTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v71/UpdatePermissionTooLongTemplateKeysTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v71/UseRuleIdInQPChangesDataTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v72/AddExternalIdToUsersTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v72/AddFileSourceLineCountTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v72/AddHashMethodToUsersTableTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v72/AddLineHashesVersionToFileSourcesTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v72/AddOrganizationUuidToUsersTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v72/AddRuleExternalTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v72/AddUUIDtoUsersTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v72/AddUniqueIndexOnRulesParametersTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v72/AddUniqueIndexesOnUsersTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v72/CreateAlmAppInstallsTableTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v72/CreateProjectMappingsTableTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v72/DbVersion72Test.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v72/DropUserIdFromOrganizationsTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v72/FixDuplicationInExternalLoginOnUsersTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v72/IncreaseCryptedPasswordSizeTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v72/MakeFileSourceLineCountNotNullableTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v72/MakeSomeColumnsOfUsersNotNullableTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v72/PopulateFileSourceLineCountTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v72/PopulateHashMethodOnUsersTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v72/PopulateOrganizationUuidOnUsersTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v72/PopulateUUIDOnUsersTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v72/PurgeDuplicateRulesParametersTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v72/PurgeOrphansForCETest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v72/RenameExternalIdentityToExternalLoginOnUsersTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v72/RenameLoginToUserUuidOnTableUserTokensTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v72/RenameNoteUserLoginToNoteUserUuidOnTableRulesMetadataTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v72/RenameSubmitterLoginToSubmitterUuidOnTableCeActivityTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v72/RenameSubmitterLoginToSubmitterUuidOnTableCeQueueTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v72/RenameUserLoginToUserUuidOnTableManualMeasuresTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v72/RenameUserLoginToUserUuidOnTableQProfileChangesTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v72/UpdateNullValuesFromExternalColumnsAndLoginOfUsersTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v73/AddFromHotspotFlagToIssuesTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v73/AddIndexOnOrganizationMembersTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v73/AddSecurityStandardsToRulesTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v73/AddSubscriptionToOrganizationsTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v73/CreateProjectAlmBindingsTableTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v73/DbVersion73Test.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v73/FixMissingQualityProfilesOnOrganizationsTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v73/PopulateHotspotAdminPermissionOnGroupsTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v73/PopulateHotspotAdminPermissionOnTemplatesCharacteristicsTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v73/PopulateHotspotAdminPermissionOnTemplatesGroupsTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v73/PopulateHotspotAdminPermissionOnTemplatesUsersTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v73/PopulateHotspotAdminPermissionOnUsersTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v73/PopulateMainApplicationBranchesTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v73/PopulateSubscriptionOnOrganizationsTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v73/SetSubscriptionOnOrganizationsNotNullableTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v74/AddAdHocColumnsInInRulesMetadataTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v74/AddApplicationCreatorAndPortfolioCreatorToSonarAdministratorTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v74/AddDefaultPermTemplateColumnsToOrganizationsTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v74/AddIsAdHocToRulesTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v74/AddTmpColumnsToCeActivityTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v74/AddTmpColumnsToCeQueueTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v74/AddTmpLastKeyColumnsToCeActivityTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v74/CleanOrphanRowsInCeTablesTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v74/CreateApplicationsAndPortfoliosCreatorPermissionsTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v74/CreateCeTaskMessageTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v74/DbVersion74Test.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v74/DropDefaultPermTemplateViewFromOrganizationsTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v74/FinalizeMainComponentUuidColumnsToCeActivityTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v74/FinalizeMainComponentUuidColumnsToCeQueueTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v74/FinalizeMainLastKeyColumnsToCeActivityTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v74/IncreaseOrganizationsKeeAndNameLengthTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v74/PopulateDefaultPermTemplateOnOrganizationsTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v74/PopulateIsAdHocOnRulesTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v74/PopulateNullValuesOfIsExternalOnRulesTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v74/PopulateTmpColumnsToCeActivityTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v74/PopulateTmpColumnsToCeQueueTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v74/PopulateTmpLastKeyColumnsToCeActivityTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v74/Row.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v74/SetIsExternalAndIsAdHocNotNullableInRulesTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v75/AddEventComponentChangesTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v75/AddIsOwnerUserColumnInAlmAppInstallTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v75/AddUserExternalIdColumnInAlmAppInstallTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v75/CreateOrganizationsAlmBindingsTableTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v75/DbVersion75Test.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v75/SetIsOwnerUserNotNullableInAlmAppInstallsTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v76/AddUniqueIndexInUserPropertiesTableTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v76/AddUniqueIndexOnExternalLoginInUsersTableTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v76/CreateUserPropertiesTableTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v76/DbVersion76Test.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v76/DeleteModuleAndFolderMeasuresTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v76/DeleteUselessOnboardingSettingTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v76/DeleteUselessPropertyTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v76/FixDirectionOfMetricsTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v76/MigrateModulePropertiesTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v76/MigrateNoMoreUsedQualityGateConditionsTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v77/AddBuildStringToSnapshotTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v77/AddLastConnectionDateToUserTokensTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v77/AddLastConnectionDateToUsersTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v77/AddManualBaselineToProjectBranchesTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v77/AddMembersSyncFlagToOrgAlmBindingTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v77/DbVersion77Test.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v77/DeleteFavoritesExceedingOneHundredTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v77/DeleteFavouritesOnNotSupportedComponentQualifiersTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v77/DeleteTestDataTypeFromFileSourcesTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v77/DropDataTypeFromFileSourcesTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v77/DropElasticsearchIndexTestsTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v77/TruncateEsQueueTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v78/AddIndexToOrgQProfileParentUuidTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v78/AddSecurityFieldsToElasticsearchIndicesTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v78/AddSnapshotRevisionTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v78/AddWebhooksSecretTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v78/CreateInternalComponentPropertiesTableTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v78/DbVersion78Test.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v78/DeleteOverallSubscriptionsOnNewAndResolvedIssuesNotificationsTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v78/MigrateRevisionTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v78/RemoveOrphansFromProjectBranchesTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v78/UpdateSecurityHotspotsStatusesTest.java
rename server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/{v56 => v79}/CreateInitialSchemaTest.java (73%)
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v79/MigrateVstsProviderToAzureDevOpsTest.java
create mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v79/PopulateInitialSchemaTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v79/PopulateInstallDateAndVersionTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v79/ReindexIssuesAndRulesTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v79/RemoveQGConditionsOnSecurityReviewRatingTest.java
delete mode 100644 server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v79/TruncateEnvAndSystemVarsFromScannerContextTest.java
rename server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/{v63 => }/DefaultOrganizationUuidProviderImplTest/internal_properties.sql (100%)
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v56/PopulateInitialSchemaTest/v56.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v561/UpdateUsersExternalIdentityWhenEmptyTest/schema.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v60/AddAnalysisUuidColumnToCeActivityTest/old_ce_activity.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v60/AddAnalysisUuidColumnToEventsTest/events_before_6-0.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v60/AddAnalysisUuidColumnToMeasuresTest/old_measures.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v60/AddBColumnsToProjectsTest/old_projects.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v60/AddComponentUuidAndAnalysisUuidColumnToDuplicationsIndexTest/duplications_index_5.6.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v60/AddComponentUuidColumnToMeasuresTest/project_measures_5.6.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v60/AddComponentUuidColumnsToSnapshotsTest/old_snapshots.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v60/AddLastUsedColumnToRulesProfilesTest/rules_profiles.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v60/AddProfileKeyToActivitiesTest/activities.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v60/AddUserUpdatedAtToRulesProfilesTest/rules_profiles.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v60/AddUuidColumnToSnapshotsTest/old_snapshots.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v60/AddUuidColumnsToProjectsTest/old_projects.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v60/CleanEventsWithoutAnalysisUuidTest/in_progress_events.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v60/CleanEventsWithoutSnapshotIdTest/in_progress_events.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v60/CleanMeasuresWithNullAnalysisUuidTest/in_progress_measures.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v60/CleanOrphanRowsInSnapshotsTest/in_progress_snapshots_and_children_tables.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v60/CleanUsurperRootComponentsTest/complete_schema.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v60/CreatePermTemplatesCharacteristicsTest/empty.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v60/DeleteOrphanMeasuresWithoutComponentTest/in_progress_project_measures.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v60/DropTreesOfSnapshotsTest/in_progress_snapshots.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v60/FixProjectUuidOfDeveloperProjectsTest/projects_5.6.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v60/MakeAnalysisUuidNotNullOnMeasuresTest/in_progress_measures.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v60/MakeComponentUuidAndAnalysisUuidNotNullOnDuplicationsIndexTest/in_progress_duplications_index.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v60/MakeComponentUuidColumnsNotNullOnSnapshotsTest/in_progress_snapshots.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v60/MakeComponentUuidNotNullOnMeasuresTest/in_progress_project_measures.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v60/MakeProfileKeyNotNullOnActivitiesTest/activities.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v60/MakeUuidColumnNotNullOnSnapshotsTest/in_progress_snapshots.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v60/MakeUuidColumnsNotNullOnProjectsTest/in_progress_projects.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v60/PopulateAnalysisUuidColumnOnCeActivityTest/in_progress_ce_activity.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v60/PopulateAnalysisUuidOnEventsTest/in_progress_events_with_snapshots.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v60/PopulateAnalysisUuidOnMeasuresTest/old_measures.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v60/PopulateComponentUuidAndAnalysisUuidOfDuplicationsIndexTest/in_progress_measures_with_snapshots.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v60/PopulateComponentUuidColumnsOfSnapshotsTest/in_progress_snapshots_with_projects.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v60/PopulateComponentUuidOfMeasuresTest/in_progress_measures_with_projects.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v60/PopulateLastUsedColumnOfRulesProfilesTest/rules_profiles.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v60/PopulateProfileKeyOfActivitiesTest/activities.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v60/PopulateUserUpdatedAtOfRulesProfilesTest/schema.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v60/PopulateUuidColumnOnSnapshotsTest/in_progress_snapshots.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v60/PopulateUuidColumnsOfProjectsTest/in_progress_projects.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v60/PopulateUuidPathColumnOnProjectsTest/in_progress_projects_and_snapshots.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v60/RemoveUsersPasswordWhenNotLocalTest/schema.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v61/AddErrorColumnsToCeActivityTest/old_ce_activity.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v61/CopyActivitiesToQprofileChangesTest/schema.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v61/CreateTableCeTaskInputTest/empty.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v61/CreateTableInternalPropertiesTest/empty.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v61/CreateTableProperties2Test/empty.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v61/CreateTableQprofileChangesTest/empty.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v61/CreateTableRuleRepositoriesTest/empty.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v61/DeleteProjectDashboardsTest/schema.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v61/DeleteReportsFromCeQueueTest/schema.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v61/PopulateTableProperties2Test/properties_and_properties_2_tables.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v61/RemoveViewsDefinitionFromPropertiesTest/properties_and_internal_properties.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v62/AddIsRootColumnOnTableUsersTest/table_users.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v62/AddOrganizationUuidToGroupRolesTest/previous-group_roles.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v62/AddOrganizationUuidToGroupsTest/previous-groups.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v62/AddOrganizationUuidToPermissionTemplatesTest/previous-permission_templates.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v62/AddOrganizationUuidToUserRolesTest/previous-user_roles.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v62/CreateDefaultOrganizationTest/organizations_and_internal_properties.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v62/CreateTableOrganizationsTest/empty.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v62/CreateTableWebhookDeliveriesTest/empty.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v62/DeletePermissionShareDashboardTest/roles.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v62/DropIssueFiltersTableTest/schema.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v62/DropMeasureFiltersTableTest/schema.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v62/DropRelatedDashboardTablesTest/schema.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v62/MakeOrganizationUuidNotNullOnGroupRolesTest/in_progress_group_roles.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v62/MakeOrganizationUuidNotNullOnGroupsTest/in_progress_groups.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v62/MakeOrganizationUuidNotNullOnPermissionTemplatesTest/in_progress_permission_templates.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v62/MakeOrganizationUuidNotNullOnUserRolesTest/in_progress_user_roles.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v62/MakeRootColumnNotNullOnTableUsersTest/users_with_nullable_root.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v62/PopulateIsRootColumnOnTableUsersTest/users_and_permissions_tables.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v62/PopulateOrganizationUuidOfGroupRolesTest/group_roles.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v62/PopulateOrganizationUuidOfGroupsTest/user_groups.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v62/PopulateOrganizationUuidOfPermissionTemplatesTest/permission_templates.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v62/PopulateOrganizationUuidOfUserRolesTest/user_roles.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v62/UpdateQualityGateConditionsOnCoverageTest/schema.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v63/AddColumnGuardedToOrganizationsTest/previous-organizations.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v63/AddDefaultPermTemplateColumnsToOrganizationsTest/previous-organizations.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v63/AddIndexOnOrganizationUuidOfProjectsTest/projects.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v63/AddOrganizationUuidToProjectsTest/previous-projects.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v63/AddUserIdToOrganizationsTest/previous-organizations.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v63/AddUuidToEventsTest/previous-events.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v63/DeleteMeasuresHavingNoValueTest/project_measures.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v63/DeleteUselessPropertiesTest/properties.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v63/DropTableResourceIndexTest/schema.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v63/MakeColumnGuardedOfOrganizationsNotNullableTest/organizations_with_nullable_guarded.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v63/MakeDefaultOrganizationGuardedTest/organizations_and_internal_properties.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v63/MakeIndexOnOrganizationsKeeUniqueReentranceTest/organizations_with_unique_index.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v63/MakeIndexOnOrganizationsKeeUniqueTest/organizations_with_non_unique_index.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v63/MakeOrganizationUuidOfProjectsNotNullableTest/projects_with_nullable_organization.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v63/MakeUuidNotNullOnEventsTest/in_progress_events.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v63/PopulateColumnGuardedOfOrganizationsTest/organizations.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v63/PopulateDefaultPermTemplateColumnsOfOrganizationsTest/properties_and_organizations.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v63/PopulateOrganizationUuidToProjectsTest/projects_with_nullable_organization.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v63/PopulateUuidColumnOfEventsTest/in_progress_events.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v63/UnsetUserRootFlagsTest/in_progress_users.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v64/AddCeActivityWorkerUuidAndExecutionCountTest/ce_activity.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v64/AddCeQueueWorkerUuidAndExecutionCountTest/ce_queue.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v64/AddColumnNewProjectPrivateTest/organizations_without_new_project_private_column.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v64/AddColumnProjectsPrivateTest/projects_without_private_column.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v64/AddDefaultGroupIdToOrganizationsTest/previous-organizations.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v64/AddIndexLoadedTemplatesTypeTest/loaded_templates_without_index.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v64/AddIndexOnActiveRuleParametersTest/active_rule_parameters_without_index.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v64/AddQualityProfileOrganizationUuidTest/initial.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v64/AddTagsToProjectsTest/previous-projects.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v64/CleanLoadedTemplateOrphansTest/loaded-templates.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v64/CleanOrphanRowsInGroupsUsersTest/initial.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v64/CreateMembersGroupsInEachOrganizationTest/initial.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v64/CreateOrganizationMembersTableTest/empty.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v64/CreateRulesMetadataTest/empty.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v64/DeleteDefaultGroupSettingTest/initial.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v64/DeletePermissionTemplatesLinkedToRemovedUsersTest/initial.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v64/DropMetadataColumnsFromRulesTest/rules.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v64/DropUniqueIndexOnQualityProfileKeyTest/initial.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v64/DropUniqueIndexOnQualityProfileOrganizationUuidAndKeyTest/initial.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v64/ExtendLoadedTemplateTypeColumnTest/loaded-templates.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v64/MakeCeActivityExecutionCountNotNullableTest/ce_activity.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v64/MakeCeQueueExecutionCountNotNullableTest/ce_queue.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v64/MakeColumnNewProjectPrivateNotNullableTest/organizations_with_nullable_new_project_private_column.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v64/MakeColumnProjectsPrivateNotNullableTest/projects_with_nullable_private_column.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v64/MakeComponentsPrivateBasedOnPermissionsTest/projects_and_group_roles_and_user_roles.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v64/MakeProjectUuidNotNullableTest/projects_with_nullable_project_uuid.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v64/MakeQualityProfileKeyUniqueTest/initial.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v64/MakeQualityProfileOrganizationUuidAndKeyUniqueTest/initial.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v64/PopulateColumnDefaultGroupIdOfOrganizationsTest/initial.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v64/PopulateColumnProjectsPrivateTest/projects_with_nullable_private_column.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v64/PopulateOrganizationMembersTableTest/initial.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v64/PopulateRulesMetadataTest/rules_and_rules_metadata_and_organization_and_internal_properties.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v64/PurgeComponentsWithoutProjectUuidTest/projects_and_children_tables.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v64/RestoreSonarUsersGroupsTest/initial.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v64/SetAllUsersIntoSonarUsersGroupTest/initial.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v64/SetCopyComponentUuidOnLocalViewsTest/in_progress_projects.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v64/SetNewProjectPrivateToFalseTest/initial.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v64/SetOrganizationMembersIntoMembersGroupTest/initial.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v64/SetQualityProfileOrganizationUuidToDefaultTest/initial.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v64/SetQualityProfileOrganizationUuidToNotNullableTest/initial.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v64/SupportPrivateProjectInDefaultPermissionTemplateTest/organizations_and_groups_and_permission_templates.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v64/SupportProjectVisibilityInTemplatesTest/permission_templates_and_groups.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v64/UpgradeQualityTemplateLoadedTemplatesTest/organizations_internal_properties_and_loaded_templates.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v65/AddBuiltInFlagToRulesProfilesTest/rules_profiles_6_4.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v65/AddIndexOnEsQueueCreatedAtTest/initial.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v65/AddIndexRulesProfileUuidOnQProfileChangesTest/initial.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v65/AddUsersOnboardedTest/users_without_onboarded_column.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v65/CleanOrphanRowsInGroupRolesTest/group_roles_and_projects.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v65/CleanOrphanRowsInManualMeasuresTest/manual_measures_and_projects.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v65/CleanOrphanRowsInProjectLinksTest/project_links_and_projects.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v65/CleanOrphanRowsInPropertiesTest/properties_and_projects.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v65/CleanOrphanRowsInUserRolesTest/user_roles_and_projects.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v65/CreateEsQueueTableTest/empty.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v65/CreateTableDefaultQProfilesTest/empty.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v65/CreateTableOrgQProfilesTest/empty.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v65/DeleteCeWorkerCountSettingTest/properties.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v65/DeleteLoadedTemplatesOnQProfilesTest/initial.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v65/DeleteOrphansFromRulesProfilesTest/initial.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v65/DropIndexEventsComponentUuidTest/events.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v65/DropIndexManualMeasuresComponentUuidTest/manual_measures.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v65/DropIsDefaultColumnFromRulesProfilesTest/initial.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v65/DropOrgColumnsFromRulesProfilesTest/initial.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v65/DropTableAuthorsTest/authors.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v65/EnsureIssueProjectUuidConsistencyOnIssuesTest/issues_and_projects.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v65/MakeEventsComponentUuidNotNullableTest/events.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v65/MakeManualMeasuresComponentUuidNotNullableTest/manual_measures.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v65/MakeRulesProfilesIsBuiltInNotNullableTest/initial.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v65/MakeUsersOnboardedNotNullableTest/users_with_nullable_onboarded_column.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v65/PopulateEventsComponentUuidTest/events_and_snapshots.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v65/PopulateOrgQProfilesTest/initial.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v65/PopulateTableDefaultQProfilesTest/initial.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v65/PopulateUsersOnboardedTest/users_with_onboarded_column.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v65/PurgeDeveloperDataTest/projects_and_child_tables.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v65/RecreateIndexEventsComponentUuidTest/events.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v65/RecreateIndexManualMeasuresComponentUuidTest/manual_measures.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v65/RenameQProfileKeyToRulesProfileUuidOnQProfileChangesTest/initial.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v65/SetRulesProfilesIsBuiltInToFalseTest/initial.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v65/SetRulesProfilesIsBuiltInToTrueForDefaultOrganizationTest/initial.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v65/UpdateOrgQProfilesToPointToBuiltInProfilesTest/initial.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v66/AddErrorTypeColumnToCeActivityTableTest/ce_activity_6_5.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v66/AddIncrementalColumnToSnapshotsTableTest/old_snapshots.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v66/AddPluginKeyToRulesTest/rules_6_5.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v66/CreateTableCeTaskCharacteristicsTest/empty.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v66/CreateTablePluginsTest/empty.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v66/CreateTableProjectBranchesTest/empty.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v66/CreateTableQProfileEditGroupsTest/empty.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v66/CreateTableQProfileEditUsersTest/empty.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v66/DeleteLeakSettingsOnViewsTest/settings_and_projects.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v66/FixEmptyIdentityProviderInUsersTest/users.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v66/MakeAnalysisUuidNotNullOnWebhookDeliveriesTest/initial.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v66/PopulateMainProjectBranchesTest/initial.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v66/PurgeTablePropertiesTest/properties.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v67/AddAnalysisUuidToWebhookDeliveriesTest/initial.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v67/CleanupDisabledUsersTest/users.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v67/CopyDeprecatedServerIdTest/properties.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v67/CreateTableAnalysisPropertiesTest/empty.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v67/DropOldLicensesTest/properties.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v67/MigratePreviousAnalysisToPreviousVersionTest/properties.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v67/PopulateAnalysisUuidColumnOnWebhookDeliveriesTest/initial.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v67/UpdateCeTaskUuidColumnToNullableOnWebhookDeliveriesTest/initial.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v70/AddDefaultQualityGateUuidToOrganizationsTest/organizations.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v70/AddHomepageToUsersTest/initial.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v70/AddIsBuiltInToQualityGatesTest/quality_gates.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v70/AddLiveMeasuresMetricIndexTest/live_measures.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v70/AddSnapshotIsLastIndexTest/snapshots.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v70/AddUuidToQualityGatesTest/quality_gates.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v70/AssociateQualityGatesToDefaultOrganizationTest/org_quality_gates.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v70/CreateBuiltInQualityGateTest/quality_gates.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v70/CreateOrgQualityGatesTableTest/empty.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v70/CreateTableLiveMeasuresTest/empty.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v70/CreateTempTableLiveMeasuresPTest/empty.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v70/DeleteFileMeasuresTest/initial.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v70/DeleteGlobalSonarQualityGateSettingTest/properties.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v70/DeletePersonAndFileMeasuresTest/initial.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v70/DeletePersonMeasuresTest/initial.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v70/DropIndexOnPersonMeasuresTest/initial.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v70/DropLoadedTemplatesTableTest/loaded_templates.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v70/DropSnapshotIsLastIndexTest/snapshots.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v70/DropTempTableLiveMeasuresPTest/live_measures_p.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v70/DropUniqueIndexOnQualityGatesNameTest/quality_gates.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v70/MakeQualityGatesIsBuiltInNotNullableTest/quality_gates.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v70/MakeUuidNotNullableOnQualityGatesTest/quality_gates.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v70/PopulateDefaultQualityGateTest/organizations.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v70/PopulateLiveMeasuresTest/initial.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v70/PopulateOrgQualityGates/org_quality_gates.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v70/PopulateQualityGatesIsBuiltInTest/quality_gates.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v70/PopulateUuidOnQualityGatesTest/quality_gates.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v70/ReadGlobalSonarQualityGateSettingToDefaultOrgTest/initial.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v70/RemoveQualityGateLoadedTemplatesTest/loaded_templates.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v70/RenameOldSonarQubeWayQualityGateTest/quality_gates.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v70/SetDefaultQualityGateUuidAsNotNullableInOrganizationsTest/organizations.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v71/AddKeyTypeInProjectBranchesTest/project_branches.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v71/AddPullRequestBinaryInProjectBranchesTest/project_branches.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v71/AddRuleScopeTest/rules.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v71/AddWebhookKeyToWebhookDeliveriesTableTest/webhook-deliveries.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v71/CleanBrokenProjectToQGReferencesTest/properties_and_quality_gates.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v71/CleanCeChildTablesOrphansTest/ce_tables.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v71/CreateDeprecatedRuleKeysTableTest/empty.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v71/CreateTableProjectLinks2Test/empty.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v71/CreateWebhooksTableTest/empty.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v71/DeleteMeasuresOfProjectCopiesTest/initial.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v71/DeleteSettingsDefinedInSonarDotPropertiesTest/properties.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v71/DropTableProjectLinksTest/project_links.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v71/IncreaseBranchTypeSizeForPullRequestTest/project_branches.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v71/MakeKeyTypeNotNullableInProjectBranchesTest/project_branches.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v71/MakeScopeNotNullableInRulesTest/rules.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v71/MigrateWebhooksToWebhooksTableTest/migrate_webhooks.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v71/PopulateTableProjectLinks2Test/project_links2.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v71/RenameTableProjectLinks2ToProjectLinksTest/project_links2.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v71/ReplaceIndexInProjectBranchesTest/project_branches.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v71/SetKeyTypeToBranchInProjectBranchesTest/project_branches.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v71/SetRuleScopeToMainTest/rules.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v71/UpdatePermissionTooLongTemplateKeysTest/templates.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v71/UseRuleIdInQPChangesDataTest/rules_and_qprofile_changes.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v72/AddExternalIdToUsersTest/users.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v72/AddFileSourceLineCountTest/file_sources.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v72/AddHashMethodToUsersTableTest/users.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v72/AddLineHashesVersionToFileSourcesTest/fileSources.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v72/AddOrganizationUuidToUsersTest/users.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v72/AddRuleExternalTest/rules.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v72/AddUUIDtoUsers/users.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v72/AddUniqueIndexOnRulesParametersTest/rules_parameters.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v72/AddUniqueIndexesOnUsersTest/users.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v72/CreateAlmAppInstallsTableTest/empty.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v72/CreateProjectMappingsTableTest/empty.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v72/DropUserIdFromOrganizationsTest/organizations.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v72/FixDuplicationInExternalLoginOnUsersTest/users.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v72/IncreaseCryptedPasswordSizeTest/users.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v72/MakeFileSourceLineCountNotNullableTest/file_sources.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v72/MakeSomeColumnsOfUsersNotNullableTest/users.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v72/PopulateFileSourceLineCountTest/file_sources.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v72/PopulateHashMethodOnUsersTest/users.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v72/PopulateOrganizationUuidOnUsersTest/schema.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v72/PopulateUUIDOnUsersTest/users.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v72/PurgeDuplicateRulesParametersTest/rules_parameters_etc.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v72/PurgeOrphansForCETest/ce.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v72/RenameExternalIdentityToExternalLoginOnUsersTest/users.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v72/RenameIssuesAssigneeToAssigneeUuidTest/issues.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v72/RenameLoginToUserUuidOnTableUserTokensTest/user_tokens.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v72/RenameNoteUserLoginToNoteUserUuidOnTableRulesMetadataTest/rules_metadata.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v72/RenameSubmitterLoginToSubmitterUuidOnTableCeActivityTest/ce_activity.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v72/RenameSubmitterLoginToSubmitterUuidOnTableCeQueueTest/ce_queue.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v72/RenameUserLoginToUserUuidOnTableManualMeasuresTest/manual_measures.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v72/RenameUserLoginToUserUuidOnTableQProfileChangesTest/qprofile_changes.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v72/UpdateNullValuesFromExternalColumnsAndLoginOfUsersTest/users.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v73/AddFromHotspotFlagToIssuesTest/issues.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v73/AddIndexOnOrganizationMembersTest/organization_members.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v73/AddSecurityStandardsToRulesTest/rules.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v73/AddSubscriptionToOrganizationsTest/organizations.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v73/CreateProjectAlmBindingsTableTest/empty.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v73/FixMissingQualityProfilesOnOrganizationsTest/schema.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v73/PopulateHotspotAdminPermissionOnGroupsTest/group_roles.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v73/PopulateHotspotAdminPermissionOnTemplatesCharacteristicsTest/perm_tpl_characteristics.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v73/PopulateHotspotAdminPermissionOnTemplatesGroupsTest/perm_templates_groups.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v73/PopulateHotspotAdminPermissionOnTemplatesUsersTest/perm_templates_users.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v73/PopulateHotspotAdminPermissionOnUsersTest/user_roles.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v73/PopulateMainApplicationBranchesTest/schema.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v73/PopulateSubscriptionOnOrganizationsTest/schema.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v73/SetSubscriptionOnOrganizationsNotNullableTest/organizations.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v74/AddAdHocColumnsInInRulesMetadataTest/rules_metadata.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v74/AddApplicationCreatorAndPortfolioCreatorToSonarAdministratorTest/group_roles_and_internal_properties.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v74/AddDefaultPermTemplateColumnsToOrganizationsTest/previous-organizations.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v74/AddIsAdHocToRulesTest/rules.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v74/AddTmpColumnsToCeActivityTest/ce_activity.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v74/AddTmpColumnsToCeQueueTest/ce_queue.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v74/AddTmpLastKeyColumnsToCeActivityTest/ce_activity.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v74/CleanOrphanRowsInCeTablesTest/ce_tables.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v74/CreateApplicationsAndPortfoliosCreatorPermissionsTest/perm_templates_groups.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v74/CreateCeTaskMessageTest/empty.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v74/DropDefaultPermTemplateViewFromOrganizationsTest/organizations.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v74/FinalizeMainComponentUuidColumnsToCeActivityTest/ce_activity.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v74/FinalizeMainComponentUuidColumnsToCeQueueTest/ce_queue.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v74/FinalizeMainLastKeyColumnsToCeActivityTest/ce_activity.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v74/IncreaseOrganizationsKeeAndNameLengthTest/organizations.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v74/PopulateDefaultPermTemplateOnOrganizationsTest/organizations.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v74/PopulateIsAdHocOnRulesTest/rules.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v74/PopulateNullValuesOfIsExternalOnRulesTest/rules.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v74/PopulateTmpColumnsToCeActivityTest/ce_activity.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v74/PopulateTmpColumnsToCeQueueTest/ce_queue.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v74/PopulateTmpLastKeyColumnsToCeActivityTest/ce_activity.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v74/SetIsExternalAndIsAdHocNotNullableInRulesTest/rules.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v75/AddEventComponentChangesTest/empty.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v75/AddIsOwnerUserColumnInAlmAppInstallTest/almAppInstalls.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v75/AddUserExternalIdColumnInAlmAppInstallTest/almAppInstalls.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v75/SetIsOwnerUserNotNullableInAlmAppInstallsTest/almAppInstalls.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v76/AddUniqueIndexInUserPropertiesTableTest/user_properties.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v76/AddUniqueIndexOnExternalLoginInUsersTableTest/users.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v76/DeleteModuleAndFolderMeasuresTest/project_measures.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v76/DeleteUselessOnboardingSettingTest/properties.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v76/DeleteUselessPropertyTest/properties.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v76/FixDirectionOfMetricsTest/metrics.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v76/MigrateModulePropertiesTest/schema.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v76/MigrateNoMoreUsedQualityGateConditionsTest/qg-schema.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v77/AddBuildStringToSnapshotTest/snapshots.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v77/AddLastConnectionDateToUserTokensTest/user_tokens.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v77/AddLastConnectionDateToUsersTest/users.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v77/AddManualBaselineToProjectBranchesTest/initial.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v77/AddMembersSyncFlagToOrgAlmBindingTest/org_alm_binding.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v77/DeleteFavoritesExceedingOneHundredTest/schema.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v77/DeleteFavouritesOnNotSupportedComponentQualifiersTest/schema.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v77/DeleteTestDataTypeFromFileSourcesTest/file_sources.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v77/DropDataTypeFromFileSourcesTest/file_sources.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v77/TruncateEsQueueTest/es_queue.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v78/AddIndexToOrgQProfileParentUuidTest/org_qprofiles.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v78/AddSnapshotRevisionTest/snapshots.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v78/AddWebhooksSecretTest/webhooks.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v78/DeleteOverallSubscriptionsOnNewAndResolvedIssuesNotificationsTest/schema.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v78/MigrateRevisionTest/snapshots.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v78/RemoveOrphansFromProjectBranchesTest/project_and_project_branches.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v78/UpdateSecurityHotspotsStatusesTest/schema.sql
rename server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/{v56 => v79}/CreateInitialSchemaTest/empty.sql (100%)
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v79/MigrateVstsProviderToAzureDevOpsTest/properties.sql
create mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v79/PopulateInitialSchemaTest/v79.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v79/PopulateInstallDateAndVersionTest/schema.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v79/RemoveQGConditionsOnSecurityReviewRatingTest/quality_gate_conditions.sql
delete mode 100644 server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v79/TruncateEnvAndSystemVarsFromScannerContextTest/ce_scanner_context.sql
diff --git a/server/sonar-ce/src/test/java/org/sonar/ce/container/ComputeEngineContainerImplTest.java b/server/sonar-ce/src/test/java/org/sonar/ce/container/ComputeEngineContainerImplTest.java
index 68361fe5b64..4de5acb9b21 100644
--- a/server/sonar-ce/src/test/java/org/sonar/ce/container/ComputeEngineContainerImplTest.java
+++ b/server/sonar-ce/src/test/java/org/sonar/ce/container/ComputeEngineContainerImplTest.java
@@ -122,7 +122,7 @@ public class ComputeEngineContainerImplTest {
);
assertThat(picoContainer.getParent().getParent().getComponentAdapters()).hasSize(
CONTAINER_ITSELF
- + 25 // MigrationConfigurationModule
+ + 6 // MigrationConfigurationModule
+ 16 // level 2
);
assertThat(picoContainer.getParent().getParent().getParent().getComponentAdapters()).hasSize(
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 7bd362aaf87..fc1127987c3 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
@@ -24,25 +24,6 @@ import org.sonar.server.platform.db.migration.history.MigrationHistoryImpl;
import org.sonar.server.platform.db.migration.history.MigrationHistoryMeddler;
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.v56.DbVersion56;
-import org.sonar.server.platform.db.migration.version.v561.DbVersion561;
-import org.sonar.server.platform.db.migration.version.v60.DbVersion60;
-import org.sonar.server.platform.db.migration.version.v61.DbVersion61;
-import org.sonar.server.platform.db.migration.version.v62.DbVersion62;
-import org.sonar.server.platform.db.migration.version.v63.DbVersion63;
-import org.sonar.server.platform.db.migration.version.v64.DbVersion64;
-import org.sonar.server.platform.db.migration.version.v65.DbVersion65;
-import org.sonar.server.platform.db.migration.version.v66.DbVersion66;
-import org.sonar.server.platform.db.migration.version.v67.DbVersion67;
-import org.sonar.server.platform.db.migration.version.v70.DbVersion70;
-import org.sonar.server.platform.db.migration.version.v71.DbVersion71;
-import org.sonar.server.platform.db.migration.version.v72.DbVersion72;
-import org.sonar.server.platform.db.migration.version.v73.DbVersion73;
-import org.sonar.server.platform.db.migration.version.v74.DbVersion74;
-import org.sonar.server.platform.db.migration.version.v75.DbVersion75;
-import org.sonar.server.platform.db.migration.version.v76.DbVersion76;
-import org.sonar.server.platform.db.migration.version.v77.DbVersion77;
-import org.sonar.server.platform.db.migration.version.v78.DbVersion78;
import org.sonar.server.platform.db.migration.version.v79.DbVersion79;
import org.sonar.server.platform.db.migration.version.v80.DbVersion80;
@@ -51,25 +32,6 @@ public class MigrationConfigurationModule extends Module {
protected void configureModule() {
add(
// DbVersion implementations
- DbVersion56.class,
- DbVersion561.class,
- DbVersion60.class,
- DbVersion61.class,
- DbVersion62.class,
- DbVersion63.class,
- DbVersion64.class,
- DbVersion65.class,
- DbVersion66.class,
- DbVersion67.class,
- DbVersion70.class,
- DbVersion71.class,
- DbVersion72.class,
- DbVersion73.class,
- DbVersion74.class,
- DbVersion75.class,
- DbVersion76.class,
- DbVersion77.class,
- DbVersion78.class,
DbVersion79.class,
DbVersion80.class,
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v63/DefaultOrganizationUuidProvider.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/DefaultOrganizationUuidProvider.java
similarity index 96%
rename from server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v63/DefaultOrganizationUuidProvider.java
rename to server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/DefaultOrganizationUuidProvider.java
index 680300c382c..744d1fd6d4d 100644
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v63/DefaultOrganizationUuidProvider.java
+++ b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/DefaultOrganizationUuidProvider.java
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-package org.sonar.server.platform.db.migration.version.v63;
+package org.sonar.server.platform.db.migration.version;
import java.sql.SQLException;
import org.sonar.server.platform.db.migration.step.DataChange;
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v63/DefaultOrganizationUuidProviderImpl.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/DefaultOrganizationUuidProviderImpl.java
similarity index 97%
rename from server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v63/DefaultOrganizationUuidProviderImpl.java
rename to server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/DefaultOrganizationUuidProviderImpl.java
index bb4ecc426ca..361d0f472cb 100644
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v63/DefaultOrganizationUuidProviderImpl.java
+++ b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/DefaultOrganizationUuidProviderImpl.java
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-package org.sonar.server.platform.db.migration.version.v63;
+package org.sonar.server.platform.db.migration.version;
import java.sql.SQLException;
import org.sonar.server.platform.db.migration.step.DataChange;
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v56/CreateInitialSchema.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v56/CreateInitialSchema.java
deleted file mode 100644
index 54e7faf925f..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v56/CreateInitialSchema.java
+++ /dev/null
@@ -1,924 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v56;
-
-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.ColumnDef;
-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.def.IntegerColumnDef;
-import org.sonar.server.platform.db.migration.def.TinyIntColumnDef;
-import org.sonar.server.platform.db.migration.def.VarcharColumnDef;
-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.ClobColumnDef.newClobColumnDefBuilder;
-import static org.sonar.server.platform.db.migration.sql.CreateTableBuilder.ColumnFlag.AUTO_INCREMENT;
-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.TimestampColumnDef.newTimestampColumnDefBuilder;
-
-public class CreateInitialSchema extends DdlChange {
-
- public CreateInitialSchema(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- createActiveDashboards(context);
- createActiveRuleParameters(context);
- createActiveRules(context);
- createActivities(context);
- createAuthors(context);
- createCeActivity(context);
- createCeQueue(context);
- createDashboards(context);
- createDuplicationsIndex(context);
- createEvents(context);
- createFileSources(context);
- createGroupRoles(context);
- createGroups(context);
- createGroupsUsers(context);
- createIssueChanges(context);
- createIssueFilterFavourites(context);
- createIssueFilters(context);
- createIssues(context);
- createLoadedTemplates(context);
- createManualMeasures(context);
- createMeasureFilterFavourites(context);
- createMeasureFilters(context);
- createMetrics(context);
- createNotifications(context);
- createPermissionTemplates(context);
- createPermTemplatesGroups(context);
- createPermTemplatesUsers(context);
- createProjectLinks(context);
- createProjectMeasures(context);
- createProjectQprofiles(context);
- createProjects(context);
- createProperties(context);
- createQualityGateConditions(context);
- createQualityGates(context);
- createResourceIndex(context);
- createRules(context);
- createRulesParameters(context);
- createRulesProfiles(context);
- createSnapshots(context);
- createUserRoles(context);
- createUserTokens(context);
- createUsers(context);
- createWidgetProperties(context);
- createWidgets(context);
- }
-
- private void createUserTokens(Context context) throws SQLException {
- VarcharColumnDef loginCol = newLenientVarcharBuilder("login").setLimit(255).setIsNullable(false).build();
- VarcharColumnDef nameCol = newLenientVarcharBuilder("name").setLimit(100).setIsNullable(false).build();
- VarcharColumnDef tokenHashCol = newLenientVarcharBuilder("token_hash").setLimit(255).setIsNullable(false).build();
- context.execute(
- newTableBuilder("user_tokens")
- .addPkColumn(newIntegerColumnDefBuilder().setColumnName("id").setIsNullable(false).build(), AUTO_INCREMENT)
- .addColumn(loginCol)
- .addColumn(nameCol)
- .addColumn(tokenHashCol)
- .addColumn(newBigIntegerColumnDefBuilder().setColumnName("created_at").setIsNullable(false).build())
- .build());
- addIndex(context, "user_tokens", "user_tokens_login_name", true, loginCol, nameCol);
- addIndex(context, "user_tokens", "user_tokens_token_hash", true, tokenHashCol);
- }
-
- private void createCeActivity(Context context) throws SQLException {
- VarcharColumnDef uuidCol = newLenientVarcharBuilder("uuid").setLimit(40).setIsNullable(false).build();
- VarcharColumnDef isLastKeyCol = newLenientVarcharBuilder("is_last_key").setLimit(55).setIsNullable(false).build();
- BooleanColumnDef isLastCol = newBooleanColumnDefBuilder().setColumnName("is_last").setIsNullable(false).build();
- VarcharColumnDef statusCol = newLenientVarcharBuilder("status").setLimit(15).setIsNullable(false).build();
- VarcharColumnDef componentUuidCol = newLenientVarcharBuilder("component_uuid").setLimit(40).build();
- context.execute(
- newTableBuilder("ce_activity")
- .addPkColumn(newIntegerColumnDefBuilder().setColumnName("id").setIsNullable(false).build(), AUTO_INCREMENT)
- .addColumn(uuidCol)
- .addColumn(newLenientVarcharBuilder("task_type").setLimit(15).setIsNullable(false).build())
- .addColumn(componentUuidCol)
- .addColumn(statusCol)
- .addColumn(isLastCol)
- .addColumn(isLastKeyCol)
- .addColumn(newLenientVarcharBuilder("submitter_login").setLimit(255).build())
- .addColumn(newBigIntegerColumnDefBuilder().setColumnName("submitted_at").setIsNullable(false).build())
- .addColumn(newBigIntegerColumnDefBuilder().setColumnName("started_at").build())
- .addColumn(newBigIntegerColumnDefBuilder().setColumnName("executed_at").build())
- .addColumn(newBigIntegerColumnDefBuilder().setColumnName("created_at").setIsNullable(false).build())
- .addColumn(newBigIntegerColumnDefBuilder().setColumnName("updated_at").setIsNullable(false).build())
- .addColumn(newBigIntegerColumnDefBuilder().setColumnName("execution_time_ms").build())
- .addColumn(newBigIntegerColumnDefBuilder().setColumnName("snapshot_id").build())
- .build());
- addIndex(context, "ce_activity", "ce_activity_component_uuid", false, componentUuidCol);
- addIndex(context, "ce_activity", "ce_activity_islast_status", false, isLastCol, statusCol);
- addIndex(context, "ce_activity", "ce_activity_islastkey", false, isLastKeyCol);
- addIndex(context, "ce_activity", "ce_activity_uuid", true, uuidCol);
- }
-
- private void createCeQueue(Context context) throws SQLException {
- VarcharColumnDef uuidCol = newLenientVarcharBuilder("uuid").setLimit(40).setIsNullable(false).build();
- VarcharColumnDef componentUuidCol = newLenientVarcharBuilder("component_uuid").setLimit(40).build();
- context.execute(
- newTableBuilder("ce_queue")
- .addPkColumn(newIntegerColumnDefBuilder().setColumnName("id").setIsNullable(false).build(), AUTO_INCREMENT)
- .addColumn(uuidCol)
- .addColumn(newLenientVarcharBuilder("task_type").setLimit(15).setIsNullable(false).build())
- .addColumn(componentUuidCol)
- .addColumn(newLenientVarcharBuilder("status").setLimit(15).build())
- .addColumn(newLenientVarcharBuilder("submitter_login").setLimit(255).build())
- .addColumn(newBigIntegerColumnDefBuilder().setColumnName("started_at").build())
- .addColumn(newBigIntegerColumnDefBuilder().setColumnName("created_at").setIsNullable(false).build())
- .addColumn(newBigIntegerColumnDefBuilder().setColumnName("updated_at").setIsNullable(false).build())
- .build());
- addIndex(context, "ce_queue", "ce_queue_component_uuid", false, componentUuidCol);
- addIndex(context, "ce_queue", "ce_queue_uuid", true, uuidCol);
- }
-
- private void createFileSources(Context context) throws SQLException {
- VarcharColumnDef projectUuidCol = newLenientVarcharBuilder("project_uuid").setLimit(50).setIsNullable(false).build();
- BigIntegerColumnDef updatedAtCol = newBigIntegerColumnDefBuilder().setColumnName("updated_at").setIsNullable(false).build();
- VarcharColumnDef dataTypeCol = newLenientVarcharBuilder("data_type").setLimit(20).build();
- VarcharColumnDef fileUuidCol = newLenientVarcharBuilder("file_uuid").setLimit(50).setIsNullable(false).build();
- context.execute(
- newTableBuilder("file_sources")
- .addPkColumn(newIntegerColumnDefBuilder().setColumnName("id").setIsNullable(false).build(), AUTO_INCREMENT)
- .addColumn(projectUuidCol)
- .addColumn(fileUuidCol)
- .addColumn(newClobColumnDefBuilder().setColumnName("line_hashes").build())
- .addColumn(newLenientVarcharBuilder("data_hash").setLimit(50).build())
- .addColumn(newBigIntegerColumnDefBuilder().setColumnName("created_at").setIsNullable(false).build())
- .addColumn(updatedAtCol)
- .addColumn(newLenientVarcharBuilder("src_hash").setLimit(50).build())
- .addColumn(newBlobColumnDefBuilder().setColumnName("binary_data").build())
- .addColumn(dataTypeCol)
- .addColumn(newLenientVarcharBuilder("revision").setLimit(100).build())
- .build());
- addIndex(context, "file_sources", "file_sources_project_uuid", false, projectUuidCol);
- addIndex(context, "file_sources", "file_sources_updated_at", false, updatedAtCol);
- addIndex(context, "file_sources", "file_sources_uuid_type", true, fileUuidCol, dataTypeCol);
- }
-
- private void createActivities(Context context) throws SQLException {
- VarcharColumnDef keeCol = newLenientVarcharBuilder("log_key").setLimit(255).build();
- context.execute(
- newTableBuilder("activities")
- .addPkColumn(newIntegerColumnDefBuilder().setColumnName("id").setIsNullable(false).build(), AUTO_INCREMENT)
- .addColumn(newTimestampColumnDefBuilder().setColumnName("created_at").build())
- .addColumn(newLenientVarcharBuilder("user_login").setLimit(255).build())
- .addColumn(newClobColumnDefBuilder().setColumnName("data_field").build())
- .addColumn(newLenientVarcharBuilder("log_type").setLimit(50).build())
- .addColumn(newLenientVarcharBuilder("log_action").setLimit(50).build())
- .addColumn(newLenientVarcharBuilder("log_message").setLimit(4000).build())
- .addColumn(keeCol)
- .build());
-
- addIndex(context, "activities", "activities_log_key", true, keeCol);
- }
-
- private void createPermTemplatesGroups(Context context) throws SQLException {
- context.execute(
- newTableBuilder("perm_templates_groups")
- .addPkColumn(newIntegerColumnDefBuilder().setColumnName("id").setIsNullable(false).build(), AUTO_INCREMENT)
- .addColumn(newIntegerColumnDefBuilder().setColumnName("group_id").build())
- .addColumn(newIntegerColumnDefBuilder().setColumnName("template_id").setIsNullable(false).build())
- .addColumn(newLenientVarcharBuilder("permission_reference").setLimit(64).setIsNullable(false).build())
- .addColumn(newTimestampColumnDefBuilder().setColumnName("created_at").build())
- .addColumn(newTimestampColumnDefBuilder().setColumnName("updated_at").build())
- .build());
- }
-
- private void createPermTemplatesUsers(Context context) throws SQLException {
- context.execute(
- newTableBuilder("perm_templates_users")
- .addPkColumn(newIntegerColumnDefBuilder().setColumnName("id").setIsNullable(false).build(), AUTO_INCREMENT)
- .addColumn(newIntegerColumnDefBuilder().setColumnName("user_id").setIsNullable(false).build())
- .addColumn(newIntegerColumnDefBuilder().setColumnName("template_id").setIsNullable(false).build())
- .addColumn(newLenientVarcharBuilder("permission_reference").setLimit(64).setIsNullable(false).build())
- .addColumn(newTimestampColumnDefBuilder().setColumnName("created_at").build())
- .addColumn(newTimestampColumnDefBuilder().setColumnName("updated_at").build())
- .build());
- }
-
- private void createPermissionTemplates(Context context) throws SQLException {
- context.execute(
- newTableBuilder("permission_templates")
- .addPkColumn(newIntegerColumnDefBuilder().setColumnName("id").setIsNullable(false).build(), AUTO_INCREMENT)
- .addColumn(newLenientVarcharBuilder("name").setLimit(100).setIsNullable(false).build())
- .addColumn(newLenientVarcharBuilder("kee").setLimit(100).setIsNullable(false).build())
- .addColumn(newLenientVarcharBuilder("description").setLimit(4000).build())
- .addColumn(newTimestampColumnDefBuilder().setColumnName("created_at").build())
- .addColumn(newTimestampColumnDefBuilder().setColumnName("updated_at").build())
- .addColumn(newLenientVarcharBuilder("key_pattern").setLimit(500).build())
- .build());
- }
-
- private void createIssueFilterFavourites(Context context) throws SQLException {
- VarcharColumnDef loginCol = newLenientVarcharBuilder("user_login").setLimit(255).setIsNullable(false).build();
- context.execute(
- newTableBuilder("issue_filter_favourites")
- .addPkColumn(newIntegerColumnDefBuilder().setColumnName("id").setIsNullable(false).build(), AUTO_INCREMENT)
- .addColumn(loginCol)
- .addColumn(newIntegerColumnDefBuilder().setColumnName("issue_filter_id").setIsNullable(false).build())
- .addColumn(newTimestampColumnDefBuilder().setColumnName("created_at").build())
- .build());
- addIndex(context, "issue_filter_favourites", "issue_filter_favs_user", false, loginCol);
- }
-
- private void createIssueFilters(Context context) throws SQLException {
- VarcharColumnDef nameCol = newLenientVarcharBuilder("name").setLimit(100).setIsNullable(false).build();
- context.execute(
- newTableBuilder("issue_filters")
- .addPkColumn(newIntegerColumnDefBuilder().setColumnName("id").setIsNullable(false).build(), AUTO_INCREMENT)
- .addColumn(nameCol)
- .addColumn(newLenientVarcharBuilder("user_login").setLimit(255).build())
- .addColumn(newBooleanColumnDefBuilder().setColumnName("shared").setIsNullable(false).setDefaultValue(false).build())
- .addColumn(newLenientVarcharBuilder("description").setLimit(4000).build())
- .addColumn(newClobColumnDefBuilder().setColumnName("data").build())
- .addColumn(newTimestampColumnDefBuilder().setColumnName("created_at").build())
- .addColumn(newTimestampColumnDefBuilder().setColumnName("updated_at").build())
- .build());
- addIndex(context, "issue_filters", "issue_filters_name", false, nameCol);
- }
-
- private void createIssueChanges(Context context) throws SQLException {
- VarcharColumnDef issueKeyCol = newLenientVarcharBuilder("issue_key").setLimit(50).setIsNullable(false).build();
- VarcharColumnDef keeCol = newLenientVarcharBuilder("kee").setLimit(50).build();
- context.execute(
- newTableBuilder("issue_changes")
- .addPkColumn(newBigIntegerColumnDefBuilder().setColumnName("id").setIsNullable(false).build(), AUTO_INCREMENT)
- .addColumn(keeCol)
- .addColumn(issueKeyCol)
- .addColumn(newLenientVarcharBuilder("user_login").setLimit(255).build())
- .addColumn(newLenientVarcharBuilder("change_type").setLimit(20).build())
- .addColumn(newClobColumnDefBuilder().setColumnName("change_data").build())
- .addColumn(newBigIntegerColumnDefBuilder().setColumnName("created_at").build())
- .addColumn(newBigIntegerColumnDefBuilder().setColumnName("updated_at").build())
- .addColumn(newBigIntegerColumnDefBuilder().setColumnName("issue_change_creation_date").build())
- .build());
- addIndex(context, "issue_changes", "issue_changes_issue_key", false, issueKeyCol);
- addIndex(context, "issue_changes", "issue_changes_kee", false, keeCol);
- }
-
- private void createIssues(Context context) throws SQLException {
- VarcharColumnDef assigneeCol = newLenientVarcharBuilder("assignee").setLimit(255).build();
- VarcharColumnDef componentUuidCol = newLenientVarcharBuilder("component_uuid").setLimit(50).build();
- BigIntegerColumnDef issueCreationDateCol = newBigIntegerColumnDefBuilder().setColumnName("issue_creation_date").build();
- VarcharColumnDef keeCol = newLenientVarcharBuilder("kee").setLimit(50).setIsNullable(false).build();
- VarcharColumnDef projectUuidCol = newLenientVarcharBuilder("project_uuid").setLimit(50).build();
- VarcharColumnDef resolutionCol = newLenientVarcharBuilder("resolution").setLimit(20).build();
- IntegerColumnDef ruleIdCol = newIntegerColumnDefBuilder().setColumnName("rule_id").build();
- BigIntegerColumnDef updatedAtCol = newBigIntegerColumnDefBuilder().setColumnName("updated_at").build();
- context.execute(
- newTableBuilder("issues")
- .addPkColumn(newBigIntegerColumnDefBuilder().setColumnName("id").setIsNullable(false).build(), AUTO_INCREMENT)
- .addColumn(keeCol)
- .addColumn(ruleIdCol)
- .addColumn(newLenientVarcharBuilder("severity").setLimit(10).build())
- .addColumn(newBooleanColumnDefBuilder().setColumnName("manual_severity").setIsNullable(false).build())
- // unit has been fixed in SonarQube 5.6 (see migration 1151, SONAR-7493)
- .addColumn(newLenientVarcharBuilder("message").setIgnoreOracleUnit(false).setLimit(4000).build())
- .addColumn(newIntegerColumnDefBuilder().setColumnName("line").build())
- .addColumn(newDecimalColumnDefBuilder().setColumnName("gap").setPrecision(30).setScale(20).build())
- .addColumn(newLenientVarcharBuilder("status").setLimit(20).build())
- .addColumn(resolutionCol)
- .addColumn(newLenientVarcharBuilder("checksum").setLimit(1000).build())
- .addColumn(newLenientVarcharBuilder("reporter").setLimit(255).build())
- .addColumn(assigneeCol)
- .addColumn(newLenientVarcharBuilder("author_login").setLimit(255).build())
- .addColumn(newLenientVarcharBuilder("action_plan_key").setLimit(50).build())
- .addColumn(newLenientVarcharBuilder("issue_attributes").setLimit(4000).build())
- .addColumn(newIntegerColumnDefBuilder().setColumnName("effort").build())
- .addColumn(newBigIntegerColumnDefBuilder().setColumnName("created_at").build())
- .addColumn(updatedAtCol)
- .addColumn(issueCreationDateCol)
- .addColumn(newBigIntegerColumnDefBuilder().setColumnName("issue_update_date").build())
- .addColumn(newBigIntegerColumnDefBuilder().setColumnName("issue_close_date").build())
- .addColumn(newLenientVarcharBuilder("tags").setLimit(4000).build())
- .addColumn(componentUuidCol)
- .addColumn(projectUuidCol)
- .addColumn(newBlobColumnDefBuilder().setColumnName("locations").build())
- .addColumn(new TinyIntColumnDef.Builder().setColumnName("issue_type").build())
- .build());
- addIndex(context, "issues", "issues_assignee", false, assigneeCol);
- addIndex(context, "issues", "issues_component_uuid", false, componentUuidCol);
- addIndex(context, "issues", "issues_creation_date", false, issueCreationDateCol);
- addIndex(context, "issues", "issues_kee", true, keeCol);
- addIndex(context, "issues", "issues_project_uuid", false, projectUuidCol);
- addIndex(context, "issues", "issues_resolution", false, resolutionCol);
- addIndex(context, "issues", "issues_rule_id", false, ruleIdCol);
- addIndex(context, "issues", "issues_updated_at", false, updatedAtCol);
- }
-
- private void createMeasureFilterFavourites(Context context) throws SQLException {
- IntegerColumnDef userIdCol = newIntegerColumnDefBuilder().setColumnName("user_id").setIsNullable(false).build();
- context.execute(
- newTableBuilder("measure_filter_favourites")
- .addPkColumn(newIntegerColumnDefBuilder().setColumnName("id").setIsNullable(false).build(), AUTO_INCREMENT)
- .addColumn(userIdCol)
- .addColumn(newIntegerColumnDefBuilder().setColumnName("measure_filter_id").setIsNullable(false).build())
- .addColumn(newTimestampColumnDefBuilder().setColumnName("created_at").build())
- .build());
- addIndex(context, "measure_filter_favourites", "measure_filter_favs_userid", false, userIdCol);
- }
-
- private void createMeasureFilters(Context context) throws SQLException {
- VarcharColumnDef nameCol = newLenientVarcharBuilder("name").setLimit(100).setIsNullable(false).build();
- context.execute(
- newTableBuilder("measure_filters")
- .addPkColumn(newIntegerColumnDefBuilder().setColumnName("id").setIsNullable(false).build(), AUTO_INCREMENT)
- .addColumn(nameCol)
- .addColumn(newIntegerColumnDefBuilder().setColumnName("user_id").build())
- .addColumn(newBooleanColumnDefBuilder().setColumnName("shared").setDefaultValue(false).setIsNullable(false).build())
- .addColumn(newLenientVarcharBuilder("description").setLimit(4000).build())
- .addColumn(newClobColumnDefBuilder().setColumnName("data").build())
- .addColumn(newTimestampColumnDefBuilder().setColumnName("created_at").build())
- .addColumn(newTimestampColumnDefBuilder().setColumnName("updated_at").build())
- .build());
- addIndex(context, "measure_filters", "measure_filters_name", false, nameCol);
- }
-
- private void createAuthors(Context context) throws SQLException {
- VarcharColumnDef loginCol = newLenientVarcharBuilder("login").setLimit(255).build();
- context.execute(
- newTableBuilder("authors")
- .addPkColumn(newIntegerColumnDefBuilder().setColumnName("id").setIsNullable(false).build(), AUTO_INCREMENT)
- .addColumn(newIntegerColumnDefBuilder().setColumnName("person_id").setIsNullable(false).build())
- .addColumn(loginCol)
- .addColumn(newTimestampColumnDefBuilder().setColumnName("created_at").build())
- .addColumn(newTimestampColumnDefBuilder().setColumnName("updated_at").build())
- .build());
- addIndex(context, "authors", "uniq_author_logins", true, loginCol);
- }
-
- private void createResourceIndex(Context context) throws SQLException {
- VarcharColumnDef keeCol = newLenientVarcharBuilder("kee").setLimit(400).setIsNullable(false).build();
- IntegerColumnDef resourceIdCol = newIntegerColumnDefBuilder().setColumnName("resource_id").setIsNullable(false).build();
- context.execute(
- newTableBuilder("resource_index")
- .addPkColumn(newIntegerColumnDefBuilder().setColumnName("id").setIsNullable(false).build(), AUTO_INCREMENT)
- .addColumn(keeCol)
- .addColumn(newIntegerColumnDefBuilder().setColumnName("position").setIsNullable(false).build())
- .addColumn(newIntegerColumnDefBuilder().setColumnName("name_size").setIsNullable(false).build())
- .addColumn(resourceIdCol)
- .addColumn(newIntegerColumnDefBuilder().setColumnName("root_project_id").setIsNullable(false).build())
- .addColumn(newLenientVarcharBuilder("qualifier").setLimit(10).setIsNullable(false).build())
- .build());
- addIndex(context, "resource_index", "resource_index_key", false, keeCol);
- addIndex(context, "resource_index", "resource_index_rid", false, resourceIdCol);
- }
-
- private void createLoadedTemplates(Context context) throws SQLException {
- context.execute(
- newTableBuilder("loaded_templates")
- .addPkColumn(newIntegerColumnDefBuilder().setColumnName("id").setIsNullable(false).build(), AUTO_INCREMENT)
- .addColumn(newLenientVarcharBuilder("kee").setLimit(200).build())
- .addColumn(newLenientVarcharBuilder("template_type").setLimit(15).build())
- .build());
- }
-
- private void createMetrics(Context context) throws SQLException {
- VarcharColumnDef nameCol = newLenientVarcharBuilder("name").setLimit(64).setIsNullable(false).build();
- context.execute(
- newTableBuilder("metrics")
- .addPkColumn(newIntegerColumnDefBuilder().setColumnName("id").setIsNullable(false).build(), AUTO_INCREMENT)
- .addColumn(nameCol)
- .addColumn(newLenientVarcharBuilder("description").setLimit(255).build())
- .addColumn(newIntegerColumnDefBuilder().setColumnName("direction").setIsNullable(false).setDefaultValue(0).build())
- .addColumn(newLenientVarcharBuilder("domain").setLimit(64).build())
- .addColumn(newLenientVarcharBuilder("short_name").setLimit(64).build())
- .addColumn(newBooleanColumnDefBuilder().setColumnName("qualitative").setDefaultValue(false).setIsNullable(false).build())
- .addColumn(newLenientVarcharBuilder("val_type").setLimit(8).build())
- .addColumn(newBooleanColumnDefBuilder().setColumnName("user_managed").setDefaultValue(false).build())
- .addColumn(newBooleanColumnDefBuilder().setColumnName("enabled").setDefaultValue(true).build())
- .addColumn(newDecimalColumnDefBuilder().setColumnName("worst_value").setPrecision(38).setScale(20).build())
- .addColumn(newDecimalColumnDefBuilder().setColumnName("best_value").setPrecision(38).setScale(20).build())
- .addColumn(newBooleanColumnDefBuilder().setColumnName("optimized_best_value").build())
- .addColumn(newBooleanColumnDefBuilder().setColumnName("hidden").build())
- .addColumn(newBooleanColumnDefBuilder().setColumnName("delete_historical_data").build())
- .addColumn(newIntegerColumnDefBuilder().setColumnName("decimal_scale").build())
- .build());
- addIndex(context, "metrics", "metrics_unique_name", true, nameCol);
- }
-
- private void createDashboards(Context context) throws SQLException {
- context.execute(
- newTableBuilder("dashboards")
- .addPkColumn(newIntegerColumnDefBuilder().setColumnName("id").setIsNullable(false).build(), AUTO_INCREMENT)
- .addColumn(newIntegerColumnDefBuilder().setColumnName("user_id").build())
- .addColumn(newLenientVarcharBuilder("name").setLimit(256).build())
- .addColumn(newLenientVarcharBuilder("description").setLimit(1000).build())
- .addColumn(newLenientVarcharBuilder("column_layout").setLimit(20).build())
- .addColumn(newBooleanColumnDefBuilder().setColumnName("shared").build())
- .addColumn(newTimestampColumnDefBuilder().setColumnName("created_at").build())
- .addColumn(newTimestampColumnDefBuilder().setColumnName("updated_at").build())
- .addColumn(newBooleanColumnDefBuilder().setColumnName("is_global").build())
- .build());
- }
-
- private void createUsers(Context context) throws SQLException {
- VarcharColumnDef loginCol = newLenientVarcharBuilder("login").setLimit(255).build();
- BigIntegerColumnDef updatedAtCol = newBigIntegerColumnDefBuilder().setColumnName("updated_at").build();
- context.execute(
- newTableBuilder("users")
- .addPkColumn(newIntegerColumnDefBuilder().setColumnName("id").setIsNullable(false).build(), AUTO_INCREMENT)
- .addColumn(loginCol)
- .addColumn(newLenientVarcharBuilder("name").setLimit(200).build())
- .addColumn(newLenientVarcharBuilder("email").setLimit(100).build())
- .addColumn(newLenientVarcharBuilder("crypted_password").setLimit(40).build())
- .addColumn(newLenientVarcharBuilder("salt").setLimit(40).build())
- .addColumn(newLenientVarcharBuilder("remember_token").setLimit(500).build())
- .addColumn(newTimestampColumnDefBuilder().setColumnName("remember_token_expires_at").build())
- .addColumn(newBooleanColumnDefBuilder().setColumnName("active").setDefaultValue(true).build())
- .addColumn(newBigIntegerColumnDefBuilder().setColumnName("created_at").build())
- .addColumn(updatedAtCol)
- .addColumn(newLenientVarcharBuilder("scm_accounts").setLimit(4000).build())
- .addColumn(newLenientVarcharBuilder("external_identity").setLimit(255).build())
- .addColumn(newLenientVarcharBuilder("external_identity_provider").setLimit(100).build())
- .addColumn(newBooleanColumnDefBuilder().setColumnName("user_local").build())
- .build());
- addIndex(context, "users", "users_login", true, loginCol);
- addIndex(context, "users", "users_updated_at", false, updatedAtCol);
- }
-
- private void createActiveRuleParameters(Context context) throws SQLException {
- context.execute(
- newTableBuilder("active_rule_parameters")
- .addPkColumn(newIntegerColumnDefBuilder().setColumnName("id").setIsNullable(false).build(), AUTO_INCREMENT)
- .addColumn(newIntegerColumnDefBuilder().setColumnName("active_rule_id").setIsNullable(false).build())
- .addColumn(newIntegerColumnDefBuilder().setColumnName("rules_parameter_id").setIsNullable(false).build())
- .addColumn(newLenientVarcharBuilder("value").setLimit(4000).build())
- .addColumn(newLenientVarcharBuilder("rules_parameter_key").setLimit(128).build())
- .build());
- }
-
- private void createActiveRules(Context context) throws SQLException {
- IntegerColumnDef profileIdCol = newIntegerColumnDefBuilder().setColumnName("profile_id").setIsNullable(false).build();
- IntegerColumnDef ruleIdCol = newIntegerColumnDefBuilder().setColumnName("rule_id").setIsNullable(false).build();
- context.execute(
- newTableBuilder("active_rules")
- .addPkColumn(newIntegerColumnDefBuilder().setColumnName("id").setIsNullable(false).build(), AUTO_INCREMENT)
- .addColumn(profileIdCol)
- .addColumn(ruleIdCol)
- .addColumn(newIntegerColumnDefBuilder().setColumnName("failure_level").setIsNullable(false).build())
- .addColumn(newLenientVarcharBuilder("inheritance").setLimit(10).build())
- .addColumn(newBigIntegerColumnDefBuilder().setColumnName("created_at").build())
- .addColumn(newBigIntegerColumnDefBuilder().setColumnName("updated_at").build())
- .build());
- addIndex(context, "active_rules", "uniq_profile_rule_ids", true, profileIdCol, ruleIdCol);
- }
-
- private void createUserRoles(Context context) throws SQLException {
- IntegerColumnDef userIdCol = newIntegerColumnDefBuilder().setColumnName("user_id").build();
- IntegerColumnDef resourceIdCol = newIntegerColumnDefBuilder().setColumnName("resource_id").build();
- context.execute(
- newTableBuilder("user_roles")
- .addPkColumn(newIntegerColumnDefBuilder().setColumnName("id").setIsNullable(false).build(), AUTO_INCREMENT)
- .addColumn(userIdCol)
- .addColumn(resourceIdCol)
- .addColumn(newLenientVarcharBuilder("role").setLimit(64).setIsNullable(false).build())
- .build());
- addIndex(context, "user_roles", "user_roles_resource", false, resourceIdCol);
- addIndex(context, "user_roles", "user_roles_user", false, userIdCol);
- }
-
- private void createActiveDashboards(Context context) throws SQLException {
- IntegerColumnDef dashboardIdCol = newIntegerColumnDefBuilder().setColumnName("dashboard_id").setIsNullable(false).build();
- IntegerColumnDef userIdCol = newIntegerColumnDefBuilder().setColumnName("user_id").build();
- context.execute(
- newTableBuilder("active_dashboards")
- .addPkColumn(newIntegerColumnDefBuilder().setColumnName("id").setIsNullable(false).build(), AUTO_INCREMENT)
- .addColumn(dashboardIdCol)
- .addColumn(userIdCol)
- .addColumn(newIntegerColumnDefBuilder().setColumnName("order_index").build())
- .build());
- addIndex(context, "active_dashboards", "active_dashboards_dashboardid", false, dashboardIdCol);
- addIndex(context, "active_dashboards", "active_dashboards_userid", false, userIdCol);
- }
-
- private void createNotifications(Context context) throws SQLException {
- context.execute(
- newTableBuilder("notifications")
- .addPkColumn(newIntegerColumnDefBuilder().setColumnName("id").setIsNullable(false).build(), AUTO_INCREMENT)
- .addColumn(newBlobColumnDefBuilder().setColumnName("data").build())
- .build());
- }
-
- private void createSnapshots(Context context) throws SQLException {
- IntegerColumnDef projectIdCol = newIntegerColumnDefBuilder().setColumnName("project_id").setIsNullable(false).build();
- IntegerColumnDef rootProjectIdCol = newIntegerColumnDefBuilder().setColumnName("root_project_id").setIsNullable(true).build();
- IntegerColumnDef parentSnapshotIdCol = newIntegerColumnDefBuilder().setColumnName("parent_snapshot_id").setIsNullable(true).build();
- VarcharColumnDef qualifierCol = newLenientVarcharBuilder("qualifier").setLimit(10).setIsNullable(true).build();
- IntegerColumnDef rootSnapshotIdCol = newIntegerColumnDefBuilder().setColumnName("root_snapshot_id").setIsNullable(true).build();
- context.execute(
- newTableBuilder("snapshots")
- .addPkColumn(newIntegerColumnDefBuilder().setColumnName("id").setIsNullable(false).build(), AUTO_INCREMENT)
- .addColumn(projectIdCol)
- .addColumn(parentSnapshotIdCol)
- .addColumn(newLenientVarcharBuilder("status").setLimit(4).setIsNullable(false).setDefaultValue("U").build())
- .addColumn(newBooleanColumnDefBuilder().setColumnName("islast").setIsNullable(false).setDefaultValue(false).build())
- .addColumn(newLenientVarcharBuilder("scope").setLimit(3).setIsNullable(true).build())
- .addColumn(qualifierCol)
- .addColumn(rootSnapshotIdCol)
- .addColumn(newLenientVarcharBuilder("version").setLimit(500).setIsNullable(true).build())
- .addColumn(newLenientVarcharBuilder("path").setLimit(500).setIsNullable(true).build())
- .addColumn(newIntegerColumnDefBuilder().setColumnName("depth").setIsNullable(true).build())
- .addColumn(rootProjectIdCol)
- .addColumn(newIntegerColumnDefBuilder().setColumnName("purge_status").setIsNullable(true).build())
- .addColumn(newLenientVarcharBuilder("period1_mode").setLimit(100).setIsNullable(true).build())
- .addColumn(newLenientVarcharBuilder("period1_param").setLimit(100).setIsNullable(true).build())
- .addColumn(newLenientVarcharBuilder("period2_mode").setLimit(100).setIsNullable(true).build())
- .addColumn(newLenientVarcharBuilder("period2_param").setLimit(100).setIsNullable(true).build())
- .addColumn(newLenientVarcharBuilder("period3_mode").setLimit(100).setIsNullable(true).build())
- .addColumn(newLenientVarcharBuilder("period3_param").setLimit(100).setIsNullable(true).build())
- .addColumn(newLenientVarcharBuilder("period4_mode").setLimit(100).setIsNullable(true).build())
- .addColumn(newLenientVarcharBuilder("period4_param").setLimit(100).setIsNullable(true).build())
- .addColumn(newLenientVarcharBuilder("period5_mode").setLimit(100).setIsNullable(true).build())
- .addColumn(newLenientVarcharBuilder("period5_param").setLimit(100).setIsNullable(true).build())
- .addColumn(newBigIntegerColumnDefBuilder().setColumnName("created_at").setIsNullable(true).build())
- .addColumn(newBigIntegerColumnDefBuilder().setColumnName("build_date").setIsNullable(true).build())
- .addColumn(newBigIntegerColumnDefBuilder().setColumnName("period1_date").setIsNullable(true).build())
- .addColumn(newBigIntegerColumnDefBuilder().setColumnName("period2_date").setIsNullable(true).build())
- .addColumn(newBigIntegerColumnDefBuilder().setColumnName("period3_date").setIsNullable(true).build())
- .addColumn(newBigIntegerColumnDefBuilder().setColumnName("period4_date").setIsNullable(true).build())
- .addColumn(newBigIntegerColumnDefBuilder().setColumnName("period5_date").setIsNullable(true).build())
- .build());
- addIndex(context, "snapshots", "snapshot_project_id", false, projectIdCol);
- addIndex(context, "snapshots", "snapshots_parent", false, parentSnapshotIdCol);
- addIndex(context, "snapshots", "snapshots_qualifier", false, qualifierCol);
- addIndex(context, "snapshots", "snapshots_root", false, rootSnapshotIdCol);
- addIndex(context, "snapshots", "snapshots_root_project_id", false, rootProjectIdCol);
- }
-
- private void createGroups(Context context) throws SQLException {
- context.execute(
- newTableBuilder("groups")
- .addPkColumn(newIntegerColumnDefBuilder().setColumnName("id").setIsNullable(false).build(), AUTO_INCREMENT)
- .addColumn(newLenientVarcharBuilder("name").setLimit(500).setIsNullable(true).build())
- .addColumn(newLenientVarcharBuilder("description").setLimit(200).setIsNullable(true).build())
- .addColumn(newTimestampColumnDefBuilder().setColumnName("created_at").setIsNullable(true).build())
- .addColumn(newTimestampColumnDefBuilder().setColumnName("updated_at").setIsNullable(true).build())
- .build());
- }
-
- private void createWidgets(Context context) throws SQLException {
- IntegerColumnDef dashboardId = newIntegerColumnDefBuilder().setColumnName("dashboard_id").setIsNullable(false).build();
- VarcharColumnDef widgetKey = newLenientVarcharBuilder("widget_key").setLimit(256).setIsNullable(false).build();
- context.execute(
- newTableBuilder("widgets")
- .addPkColumn(newIntegerColumnDefBuilder().setColumnName("id").setIsNullable(false).build(), AUTO_INCREMENT)
- .addColumn(dashboardId)
- .addColumn(widgetKey)
- .addColumn(newLenientVarcharBuilder("name").setLimit(256).setIsNullable(true).build())
- .addColumn(newLenientVarcharBuilder("description").setLimit(1000).setIsNullable(true).build())
- .addColumn(newIntegerColumnDefBuilder().setColumnName("column_index").setIsNullable(true).build())
- .addColumn(newIntegerColumnDefBuilder().setColumnName("row_index").setIsNullable(true).build())
- .addColumn(newBooleanColumnDefBuilder().setColumnName("configured").setIsNullable(true).build())
- .addColumn(newTimestampColumnDefBuilder().setColumnName("created_at").setIsNullable(true).build())
- .addColumn(newTimestampColumnDefBuilder().setColumnName("updated_at").setIsNullable(true).build())
- .addColumn(newIntegerColumnDefBuilder().setColumnName("resource_id").setIsNullable(true).build())
- .build());
- addIndex(context, "widgets", "widgets_dashboards", false, dashboardId);
- addIndex(context, "widgets", "widgets_widgetkey", false, widgetKey);
- }
-
- private void createProjectQprofiles(Context context) throws SQLException {
- VarcharColumnDef projectUuid = newLenientVarcharBuilder("project_uuid").setLimit(50).setIsNullable(false).build();
- VarcharColumnDef profileKey = newLenientVarcharBuilder("profile_key").setLimit(50).setIsNullable(false).build();
- context.execute(
- newTableBuilder("project_qprofiles")
- .addPkColumn(newIntegerColumnDefBuilder().setColumnName("id").setIsNullable(false).build(), AUTO_INCREMENT)
- .addColumn(projectUuid)
- .addColumn(profileKey)
- .build());
- addIndex(context, "project_qprofiles", "uniq_project_qprofiles", true, projectUuid, profileKey);
- }
-
- private void createRulesProfiles(Context context) throws SQLException {
- VarcharColumnDef keeCol = newLenientVarcharBuilder("kee").setLimit(255).setIsNullable(false).build();
- context.execute(
- newTableBuilder("rules_profiles")
- .addPkColumn(newIntegerColumnDefBuilder().setColumnName("id").setIsNullable(false).build(), AUTO_INCREMENT)
- .addColumn(newLenientVarcharBuilder("name").setLimit(100).setIsNullable(false).build())
- .addColumn(newLenientVarcharBuilder("language").setLimit(20).setIsNullable(true).build())
- .addColumn(keeCol)
- .addColumn(newLenientVarcharBuilder("parent_kee").setLimit(255).setIsNullable(true).build())
- .addColumn(newLenientVarcharBuilder("rules_updated_at").setLimit(100).setIsNullable(true).build())
- .addColumn(newTimestampColumnDefBuilder().setColumnName("created_at").setIsNullable(true).build())
- .addColumn(newTimestampColumnDefBuilder().setColumnName("updated_at").setIsNullable(true).build())
- .addColumn(newBooleanColumnDefBuilder().setColumnName("is_default").setIsNullable(false).build())
- .build());
- addIndex(context, "rules_profiles", "uniq_qprof_key", true, keeCol);
- }
-
- private void createRulesParameters(Context context) throws SQLException {
- IntegerColumnDef ruleIdCol = newIntegerColumnDefBuilder().setColumnName("rule_id").setIsNullable(false).build();
- context.execute(
- newTableBuilder("rules_parameters")
- .addPkColumn(newIntegerColumnDefBuilder().setColumnName("id").setIsNullable(false).build(), AUTO_INCREMENT)
- .addColumn(ruleIdCol)
- .addColumn(newLenientVarcharBuilder("name").setLimit(128).setIsNullable(false).build())
- .addColumn(newLenientVarcharBuilder("description").setLimit(4000).setIsNullable(true).build())
- .addColumn(newLenientVarcharBuilder("param_type").setLimit(512).setIsNullable(false).build())
- .addColumn(newLenientVarcharBuilder("default_value").setLimit(4000).setIsNullable(true).build())
- .build());
- addIndex(context, "rules_parameters", "rules_parameters_rule_id", false, ruleIdCol);
- }
-
- private void createGroupsUsers(Context context) throws SQLException {
- BigIntegerColumnDef userIdCol = newBigIntegerColumnDefBuilder().setColumnName("user_id").setIsNullable(true).build();
- BigIntegerColumnDef groupIdCol = newBigIntegerColumnDefBuilder().setColumnName("group_id").setIsNullable(true).build();
- context.execute(
- newTableBuilder("groups_users")
- .addColumn(userIdCol)
- .addColumn(groupIdCol)
- .build());
- addIndex(context, "groups_users", "index_groups_users_on_user_id", false, userIdCol);
- addIndex(context, "groups_users", "index_groups_users_on_group_id", false, groupIdCol);
- addIndex(context, "groups_users", "groups_users_unique", true, groupIdCol, userIdCol);
- }
-
- private void createProjectMeasures(Context context) throws SQLException {
- IntegerColumnDef personIdCol = newIntegerColumnDefBuilder().setColumnName("person_id").build();
- IntegerColumnDef metricIdCol = newIntegerColumnDefBuilder().setColumnName("metric_id").setIsNullable(false).build();
- IntegerColumnDef snapshotIdCol = newIntegerColumnDefBuilder().setColumnName("snapshot_id").setIsNullable(true).build();
- context.execute(
- newTableBuilder("project_measures")
- .addPkColumn(newBigIntegerColumnDefBuilder().setColumnName("id").setIsNullable(false).build(), AUTO_INCREMENT)
- .addColumn(newDecimalColumnDefBuilder().setColumnName("value").setPrecision(38).setScale(20).build())
- .addColumn(metricIdCol)
- .addColumn(snapshotIdCol)
- .addColumn(newIntegerColumnDefBuilder().setColumnName("rule_id").setIsNullable(true).build())
- .addColumn(newIntegerColumnDefBuilder().setColumnName("rules_category_id").setIsNullable(true).build())
- .addColumn(newLenientVarcharBuilder("text_value").setLimit(4000).build())
- .addColumn(newIntegerColumnDefBuilder().setColumnName("tendency").build())
- .addColumn(newTimestampColumnDefBuilder().setColumnName("measure_date").build())
- .addColumn(newIntegerColumnDefBuilder().setColumnName("project_id").build())
- .addColumn(newLenientVarcharBuilder("alert_status").setLimit(5).build())
- .addColumn(newLenientVarcharBuilder("alert_text").setLimit(4000).build())
- .addColumn(newLenientVarcharBuilder("url").setLimit(2000).build())
- .addColumn(newLenientVarcharBuilder("description").setLimit(4000).build())
- .addColumn(newIntegerColumnDefBuilder().setColumnName("rule_priority").build())
- .addColumn(newIntegerColumnDefBuilder().setColumnName("characteristic_id").build())
- .addColumn(personIdCol)
- .addColumn(newDecimalColumnDefBuilder().setColumnName("variation_value_1").setPrecision(38).setScale(20).build())
- .addColumn(newDecimalColumnDefBuilder().setColumnName("variation_value_2").setPrecision(38).setScale(20).build())
- .addColumn(newDecimalColumnDefBuilder().setColumnName("variation_value_3").setPrecision(38).setScale(20).build())
- .addColumn(newDecimalColumnDefBuilder().setColumnName("variation_value_4").setPrecision(38).setScale(20).build())
- .addColumn(newDecimalColumnDefBuilder().setColumnName("variation_value_5").setPrecision(38).setScale(20).build())
- .addColumn(newBlobColumnDefBuilder().setColumnName("measure_data").build())
- .build());
- addIndex(context, "project_measures", "measures_sid_metric", false, snapshotIdCol, metricIdCol);
- addIndex(context, "project_measures", "measures_person", false, personIdCol);
- }
-
- private void createManualMeasures(Context context) throws SQLException {
- VarcharColumnDef componentUuidCol = newLenientVarcharBuilder("component_uuid").setLimit(50).build();
- context.execute(
- newTableBuilder("manual_measures")
- .addPkColumn(newBigIntegerColumnDefBuilder().setColumnName("id").setIsNullable(false).build(), AUTO_INCREMENT)
- .addColumn(newIntegerColumnDefBuilder().setColumnName("metric_id").setIsNullable(false).build())
- .addColumn(newDecimalColumnDefBuilder().setColumnName("value").setPrecision(38).setScale(20).build())
- .addColumn(newLenientVarcharBuilder("text_value").setLimit(4000).build())
- .addColumn(newLenientVarcharBuilder("user_login").setLimit(255).build())
- .addColumn(newLenientVarcharBuilder("description").setLimit(4000).build())
- .addColumn(newBigIntegerColumnDefBuilder().setColumnName("created_at").build())
- .addColumn(newBigIntegerColumnDefBuilder().setColumnName("updated_at").build())
- .addColumn(componentUuidCol)
- .build());
- addIndex(context, "manual_measures", "manual_measures_component_uuid", false, componentUuidCol);
- }
-
- private void createProjects(Context context) throws SQLException {
- VarcharColumnDef keeCol = newLenientVarcharBuilder("kee").setLimit(400).build();
- VarcharColumnDef moduleUuidCol = newLenientVarcharBuilder("module_uuid").setLimit(50).build();
- VarcharColumnDef projectUuidCol = newLenientVarcharBuilder("project_uuid").setLimit(50).build();
- VarcharColumnDef qualifierCol = newLenientVarcharBuilder("qualifier").setLimit(10).build();
- IntegerColumnDef rootIdCol = newIntegerColumnDefBuilder().setColumnName("root_id").build();
- VarcharColumnDef uuidCol = newLenientVarcharBuilder("uuid").setLimit(50).build();
- context.execute(
- newTableBuilder("projects")
- .addPkColumn(newIntegerColumnDefBuilder().setColumnName("id").setIsNullable(false).build(), AUTO_INCREMENT)
- .addColumn(newLenientVarcharBuilder("name").setLimit(2000).build())
- .addColumn(newLenientVarcharBuilder("description").setLimit(2000).build())
- .addColumn(newBooleanColumnDefBuilder().setColumnName("enabled").setDefaultValue(true).setIsNullable(false).build())
- .addColumn(newLenientVarcharBuilder("scope").setLimit(3).build())
- .addColumn(qualifierCol)
- .addColumn(keeCol)
- .addColumn(rootIdCol)
- .addColumn(newLenientVarcharBuilder("language").setLimit(20).build())
- .addColumn(newIntegerColumnDefBuilder().setColumnName("copy_resource_id").build())
- .addColumn(newLenientVarcharBuilder("long_name").setLimit(2000).build())
- .addColumn(newIntegerColumnDefBuilder().setColumnName("person_id").build())
- .addColumn(newTimestampColumnDefBuilder().setColumnName("created_at").build())
- .addColumn(newLenientVarcharBuilder("path").setLimit(2000).build())
- .addColumn(newLenientVarcharBuilder("deprecated_kee").setLimit(400).build())
- .addColumn(uuidCol)
- .addColumn(projectUuidCol)
- .addColumn(moduleUuidCol)
- .addColumn(newLenientVarcharBuilder("module_uuid_path").setLimit(4000).build())
- .addColumn(newBigIntegerColumnDefBuilder().setColumnName("authorization_updated_at").build())
- .build());
- addIndex(context, "projects", "projects_kee", true, keeCol);
- addIndex(context, "projects", "projects_module_uuid", false, moduleUuidCol);
- addIndex(context, "projects", "projects_project_uuid", false, projectUuidCol);
- addIndex(context, "projects", "projects_qualifier", false, qualifierCol);
- addIndex(context, "projects", "projects_root_id", false, rootIdCol);
- addIndex(context, "projects", "projects_uuid", true, uuidCol);
- }
-
- private void createGroupRoles(Context context) throws SQLException {
- IntegerColumnDef groupIdCol = newIntegerColumnDefBuilder().setColumnName("group_id").setIsNullable(true).build();
- IntegerColumnDef resourceIdCol = newIntegerColumnDefBuilder().setColumnName("resource_id").setIsNullable(true).build();
- VarcharColumnDef roleCol = newLenientVarcharBuilder("role").setLimit(64).setIsNullable(false).build();
- context.execute(
- newTableBuilder("group_roles")
- .addPkColumn(newIntegerColumnDefBuilder().setColumnName("id").setIsNullable(false).build(), AUTO_INCREMENT)
- .addColumn(groupIdCol)
- .addColumn(resourceIdCol)
- .addColumn(roleCol)
- .build());
- addIndex(context, "group_roles", "group_roles_resource", false, resourceIdCol);
- addIndex(context, "group_roles", "uniq_group_roles", true, groupIdCol, resourceIdCol, roleCol);
- }
-
- private void createRules(Context context) throws SQLException {
- VarcharColumnDef pluginRuleKeyCol = newLenientVarcharBuilder("plugin_rule_key").setLimit(200).setIsNullable(false).build();
- VarcharColumnDef pluginNameCol = newLenientVarcharBuilder("plugin_name").setLimit(255).setIsNullable(false).build();
- context.execute(
- newTableBuilder("rules")
- .addPkColumn(newIntegerColumnDefBuilder().setColumnName("id").setIsNullable(false).build(), AUTO_INCREMENT)
- .addColumn(newLenientVarcharBuilder("name").setLimit(200).setIsNullable(true).build())
- .addColumn(pluginRuleKeyCol)
- .addColumn(newLenientVarcharBuilder("plugin_config_key").setLimit(200).setIsNullable(true).build())
- .addColumn(pluginNameCol)
- .addColumn(newClobColumnDefBuilder().setColumnName("description").setIsNullable(true).build())
- .addColumn(newIntegerColumnDefBuilder().setColumnName("priority").setIsNullable(true).build())
- .addColumn(newIntegerColumnDefBuilder().setColumnName("template_id").setIsNullable(true).build())
- .addColumn(newLenientVarcharBuilder("status").setLimit(40).setIsNullable(true).build())
- .addColumn(newLenientVarcharBuilder("language").setLimit(20).setIsNullable(true).build())
- .addColumn(newTimestampColumnDefBuilder().setColumnName("note_created_at").setIsNullable(true).build())
- .addColumn(newTimestampColumnDefBuilder().setColumnName("note_updated_at").setIsNullable(true).build())
- .addColumn(newLenientVarcharBuilder("note_user_login").setLimit(255).setIsNullable(true).build())
- .addColumn(newClobColumnDefBuilder().setColumnName("note_data").setIsNullable(true).build())
- .addColumn(newLenientVarcharBuilder("remediation_function").setLimit(200).setIsNullable(true).build())
- .addColumn(newLenientVarcharBuilder("def_remediation_function").setLimit(20).setIsNullable(true).build())
- .addColumn(newLenientVarcharBuilder("remediation_gap_mult").setLimit(20).setIsNullable(true).build())
- .addColumn(newLenientVarcharBuilder("def_remediation_gap_mult").setLimit(20).setIsNullable(true).build())
- .addColumn(newLenientVarcharBuilder("remediation_base_effort").setLimit(20).setIsNullable(true).build())
- .addColumn(newLenientVarcharBuilder("def_remediation_base_effort").setLimit(20).setIsNullable(true).build())
- .addColumn(newLenientVarcharBuilder("gap_description").setLimit(4000).setIsNullable(true).build())
- .addColumn(newLenientVarcharBuilder("tags").setLimit(4000).setIsNullable(true).build())
- .addColumn(newLenientVarcharBuilder("system_tags").setLimit(4000).setIsNullable(true).build())
- .addColumn(newBooleanColumnDefBuilder().setColumnName("is_template").setIsNullable(false).setDefaultValue(false).build())
- .addColumn(newLenientVarcharBuilder("description_format").setLimit(20).setIsNullable(true).build())
- .addColumn(newBigIntegerColumnDefBuilder().setColumnName("created_at").setIsNullable(true).build())
- .addColumn(newBigIntegerColumnDefBuilder().setColumnName("updated_at").setIsNullable(true).build())
- .addColumn(new TinyIntColumnDef.Builder().setColumnName("rule_type").setIsNullable(true).build())
- .build());
- addIndex(context, "rules", "rules_repo_key", true, pluginRuleKeyCol, pluginNameCol);
- }
-
- private void createWidgetProperties(Context context) throws SQLException {
- IntegerColumnDef widgetIdCol = newIntegerColumnDefBuilder().setColumnName("widget_id").setIsNullable(false).build();
- context.execute(
- newTableBuilder("widget_properties")
- .addPkColumn(newIntegerColumnDefBuilder().setColumnName("id").setIsNullable(false).build(), AUTO_INCREMENT)
- .addColumn(widgetIdCol)
- .addColumn(newLenientVarcharBuilder("kee").setLimit(100).setIsNullable(true).build())
- .addColumn(newLenientVarcharBuilder("text_value").setLimit(4000).setIsNullable(true).build())
- .build());
- addIndex(context, "widget_properties", "widget_properties_widgets", false, widgetIdCol);
- }
-
- private void createEvents(Context context) throws SQLException {
- VarcharColumnDef componentUuid = newLenientVarcharBuilder("component_uuid").setLimit(50).setIsNullable(true).build();
- IntegerColumnDef snapshotId = newIntegerColumnDefBuilder().setColumnName("snapshot_id").setIsNullable(true).build();
- context.execute(
- newTableBuilder("events")
- .addPkColumn(newIntegerColumnDefBuilder().setColumnName("id").setIsNullable(false).build(), AUTO_INCREMENT)
- .addColumn(newLenientVarcharBuilder("name").setLimit(400).setIsNullable(true).build())
- .addColumn(snapshotId)
- .addColumn(newLenientVarcharBuilder("category").setLimit(50).build())
- .addColumn(newLenientVarcharBuilder("description").setLimit(4000).build())
- .addColumn(newLenientVarcharBuilder("event_data").setLimit(4000).build())
- .addColumn(newBigIntegerColumnDefBuilder().setColumnName("event_date").setIsNullable(false).build())
- .addColumn(newBigIntegerColumnDefBuilder().setColumnName("created_at").setIsNullable(false).build())
- .addColumn(componentUuid)
- .build());
- addIndex(context, "events", "events_component_uuid", false, componentUuid);
- addIndex(context, "events", "events_snapshot_id", false, snapshotId);
- }
-
- private void createQualityGates(Context context) throws SQLException {
- VarcharColumnDef nameCol = newLenientVarcharBuilder("name").setLimit(100).setIsNullable(false).build();
- context.execute(
- newTableBuilder("quality_gates")
- .addPkColumn(newIntegerColumnDefBuilder().setColumnName("id").setIsNullable(false).build(), AUTO_INCREMENT)
- .addColumn(nameCol)
- .addColumn(newTimestampColumnDefBuilder().setColumnName("created_at").setIsNullable(true).build())
- .addColumn(newTimestampColumnDefBuilder().setColumnName("updated_at").setIsNullable(true).build())
- .build());
- addIndex(context, "quality_gates", "uniq_quality_gates", true, nameCol);
- }
-
- private void createQualityGateConditions(Context context) throws SQLException {
- context.execute(
- newTableBuilder("quality_gate_conditions")
- .addPkColumn(newIntegerColumnDefBuilder().setColumnName("id").setIsNullable(false).build(), AUTO_INCREMENT)
- .addColumn(newIntegerColumnDefBuilder().setColumnName("qgate_id").setIsNullable(true).build())
- .addColumn(newIntegerColumnDefBuilder().setColumnName("metric_id").setIsNullable(true).build())
- .addColumn(newIntegerColumnDefBuilder().setColumnName("period").setIsNullable(true).build())
- .addColumn(newLenientVarcharBuilder("operator").setLimit(3).setIsNullable(true).build())
- .addColumn(newLenientVarcharBuilder("value_error").setLimit(64).setIsNullable(true).build())
- .addColumn(newLenientVarcharBuilder("value_warning").setLimit(64).setIsNullable(true).build())
- .addColumn(newTimestampColumnDefBuilder().setColumnName("created_at").setIsNullable(true).build())
- .addColumn(newTimestampColumnDefBuilder().setColumnName("updated_at").setIsNullable(true).build())
- .build());
- }
-
- private void createProperties(Context context) throws SQLException {
- VarcharColumnDef propKey = newLenientVarcharBuilder("prop_key").setLimit(512).setIsNullable(true).build();
- context.execute(
- newTableBuilder("properties")
- // do not define as primary key on purpose -> already set in org.sonar.db.version.v61.CreateTableProperties2
- .addColumn(newIntegerColumnDefBuilder().setColumnName("id").setIsNullable(false).build())
- .addColumn(propKey)
- .addColumn(newIntegerColumnDefBuilder().setColumnName("resource_id").setIsNullable(true).build())
- .addColumn(newClobColumnDefBuilder().setColumnName("text_value").setIsNullable(true).build())
- .addColumn(newIntegerColumnDefBuilder().setColumnName("user_id").setIsNullable(true).build())
- .build());
- addIndex(context, "properties", "properties_key", false, propKey);
- }
-
- private void createProjectLinks(Context context) throws SQLException {
- context.execute(
- newTableBuilder("project_links")
- .addPkColumn(newIntegerColumnDefBuilder().setColumnName("id").setIsNullable(false).build(), AUTO_INCREMENT)
- .addColumn(newLenientVarcharBuilder("link_type").setLimit(20).setIsNullable(true).build())
- .addColumn(newLenientVarcharBuilder("name").setLimit(128).setIsNullable(true).build())
- .addColumn(newLenientVarcharBuilder("href").setLimit(2048).setIsNullable(false).build())
- .addColumn(newLenientVarcharBuilder("component_uuid").setLimit(2048).setIsNullable(true).build())
- .build());
- }
-
- private void createDuplicationsIndex(Context context) throws SQLException {
- VarcharColumnDef hashCol = newLenientVarcharBuilder("hash").setLimit(50).setIsNullable(false).build();
- IntegerColumnDef snapshotIdCol = newIntegerColumnDefBuilder().setColumnName("snapshot_id").setIsNullable(false).build();
- context.execute(
- newTableBuilder("duplications_index")
- .addPkColumn(newBigIntegerColumnDefBuilder().setColumnName("id").setIsNullable(false).build(), AUTO_INCREMENT)
- .addColumn(newIntegerColumnDefBuilder().setColumnName("project_snapshot_id").setIsNullable(false).build())
- .addColumn(snapshotIdCol)
- .addColumn(hashCol)
- .addColumn(newIntegerColumnDefBuilder().setColumnName("index_in_file").setIsNullable(false).build())
- .addColumn(newIntegerColumnDefBuilder().setColumnName("start_line").setIsNullable(false).build())
- .addColumn(newIntegerColumnDefBuilder().setColumnName("end_line").setIsNullable(false).build())
- .build());
- addIndex(context, "duplications_index", "duplications_index_hash", false, hashCol);
- addIndex(context, "duplications_index", "duplications_index_sid", false, snapshotIdCol);
- }
-
- private void addIndex(Context context, String table, String index, boolean unique, ColumnDef... columns) throws SQLException {
- CreateIndexBuilder builder = new CreateIndexBuilder()
- .setTable(table)
- .setName(index)
- .setUnique(unique);
- for (ColumnDef column : columns) {
- builder.addColumn(column);
- }
- context.execute(builder.build());
- }
-
- private static VarcharColumnDef.Builder newLenientVarcharBuilder(String column) {
- return new VarcharColumnDef.Builder().setColumnName(column).setIgnoreOracleUnit(true);
- }
-
- private CreateTableBuilder newTableBuilder(String tableName) {
- return new CreateTableBuilder(getDialect(), tableName);
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v56/DbVersion56.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v56/DbVersion56.java
deleted file mode 100644
index 36db61c869e..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v56/DbVersion56.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v56;
-
-import org.sonar.server.platform.db.migration.step.MigrationStepRegistry;
-import org.sonar.server.platform.db.migration.version.DbVersion;
-
-public class DbVersion56 implements DbVersion {
- @Override
- public void addSteps(MigrationStepRegistry registry) {
- registry
- .add(1, "Create initial schema", CreateInitialSchema.class)
- .add(2, "Populate initial schema", PopulateInitialSchema.class);
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v56/PopulateInitialSchema.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v56/PopulateInitialSchema.java
deleted file mode 100644
index 0853c5313b9..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v56/PopulateInitialSchema.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v56;
-
-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.step.DataChange;
-import org.sonar.server.platform.db.migration.step.Upsert;
-
-public class PopulateInitialSchema extends DataChange {
-
- private static final String ADMINS_GROUP = "sonar-administrators";
- private static final String USERS_GROUP = "sonar-users";
- private static final String ADMIN_USER = "admin";
-
- private final System2 system2;
-
- public PopulateInitialSchema(Database db, System2 system2) {
- super(db);
- this.system2 = system2;
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- insertGroups(context);
- insertGroupRoles(context);
- insertAdminUser(context);
- insertGroupMemberships(context);
-
- }
-
- private void insertGroups(Context context) throws SQLException {
- truncateTable(context, "groups");
-
- Date now = new Date(system2.now());
- Upsert upsert = context.prepareUpsert("insert into groups (name, description, created_at, updated_at) values (?, ?, ?, ?)");
- upsert.setString(1, ADMINS_GROUP)
- .setString(2, "System administrators")
- .setDate(3, now)
- .setDate(4, now)
- .addBatch();
- upsert.setString(1, USERS_GROUP)
- .setString(2, "Any new users created will automatically join this group")
- .setDate(3, now)
- .setDate(4, now)
- .addBatch();
- upsert
- .execute()
- .commit();
- }
-
- private static void insertGroupRoles(Context context) throws SQLException {
- truncateTable(context, "group_roles");
-
- // admin group
- Upsert upsert = context.prepareUpsert("insert into group_roles (group_id, resource_id, role) values ((select id from groups where name='" + ADMINS_GROUP + "'), null, ?)");
- upsert.setString(1, "admin").addBatch();
- upsert.setString(1, "profileadmin").addBatch();
- upsert.setString(1, "gateadmin").addBatch();
- upsert.setString(1, "shareDashboard").addBatch();
- upsert.setString(1, "provisioning").addBatch();
- upsert
- .execute()
- .commit();
-
- // anyone
- upsert = context.prepareUpsert("insert into group_roles (group_id, resource_id, role) values (null, null, ?)");
- upsert.setString(1, "scan").addBatch();
- upsert.setString(1, "provisioning").addBatch();
- upsert
- .execute()
- .commit();
- }
-
- private void insertAdminUser(Context context) throws SQLException {
- truncateTable(context, "users");
-
- long now = system2.now();
- context.prepareUpsert("insert into users " +
- "(login, name, email, external_identity, external_identity_provider, user_local, crypted_password, salt, " +
- "created_at, updated_at, remember_token, remember_token_expires_at) " +
- "values ('" + ADMIN_USER + "', 'Administrator', null, 'admin', 'sonarqube', ?, " +
- "'a373a0e667abb2604c1fd571eb4ad47fe8cc0878', '48bc4b0d93179b5103fd3885ea9119498e9d161b', ?, ?, null, null)")
- .setBoolean(1, true)
- .setLong(2, now)
- .setLong(3, now)
- .execute()
- .commit();
- }
-
- private static void insertGroupMemberships(Context context) throws SQLException {
- truncateTable(context, "groups_users");
-
- Upsert upsert = context.prepareUpsert("insert into groups_users (user_id, group_id) values " +
- "((select id from users where login='" + ADMIN_USER + "'), (select id from groups where name=?))");
- upsert.setString(1, ADMINS_GROUP).addBatch();
- upsert.setString(1, USERS_GROUP).addBatch();
- upsert
- .execute()
- .commit();
- }
-
- private static void truncateTable(Context context, String table) throws SQLException {
- context.prepareUpsert("truncate table " + table).execute().commit();
- }
-
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v56/package-info.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v56/package-info.java
deleted file mode 100644
index 0783f643080..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v56/package-info.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public 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.v56;
-
-import javax.annotation.ParametersAreNonnullByDefault;
-
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v561/DbVersion561.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v561/DbVersion561.java
deleted file mode 100644
index 9624b1e9acc..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v561/DbVersion561.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v561;
-
-import org.sonar.server.platform.db.migration.step.MigrationStepRegistry;
-import org.sonar.server.platform.db.migration.version.DbVersion;
-
-public class DbVersion561 implements DbVersion {
- @Override
- public void addSteps(MigrationStepRegistry registry) {
- registry.add(1153, "Populate columns USERS.EXTERNAL_IDENTITY_*", UpdateUsersExternalIdentityWhenEmpty.class);
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v561/UpdateUsersExternalIdentityWhenEmpty.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v561/UpdateUsersExternalIdentityWhenEmpty.java
deleted file mode 100644
index 5a6cc319956..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v561/UpdateUsersExternalIdentityWhenEmpty.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v561;
-
-import java.sql.SQLException;
-import org.sonar.api.utils.System2;
-import org.sonar.db.Database;
-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.DataChange;
-
-/**
- * Update USERS.EXTERNAL_IDENTITY_PROVIDER to 'sonarqube' and USERS.EXTERNAL_IDENTITY to user's login when one of this 2 columns is null
- */
-public class UpdateUsersExternalIdentityWhenEmpty extends DataChange {
-
- private final System2 system2;
-
- public UpdateUsersExternalIdentityWhenEmpty(Database db, System2 system2) {
- super(db);
- this.system2 = system2;
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- MassUpdate massUpdate = context.prepareMassUpdate();
- massUpdate.select("SELECT u.id, u.login FROM users u WHERE external_identity_provider IS NULL OR external_identity IS NULL");
- massUpdate.update("UPDATE users SET external_identity_provider=?, external_identity=?, updated_at=? WHERE id=?");
- massUpdate.rowPluralName("users");
- massUpdate.execute(new MigrationHandler(system2.now()));
- }
-
- private static class MigrationHandler implements MassUpdate.Handler {
-
- private final long now;
-
- public MigrationHandler(long now) {
- this.now = now;
- }
-
- @Override
- public boolean handle(Select.Row row, SqlStatement update) throws SQLException {
- update.setString(1, "sonarqube");
- update.setString(2, row.getString(2));
- update.setLong(3, now);
- update.setLong(4, row.getLong(1));
- return true;
- }
- }
-
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v561/package-info.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v561/package-info.java
deleted file mode 100644
index ea10aa5cea9..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v561/package-info.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public 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.v561;
-
-import javax.annotation.ParametersAreNonnullByDefault;
-
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/AddAnalysisUuidColumnToCeActivity.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/AddAnalysisUuidColumnToCeActivity.java
deleted file mode 100644
index db9de2106b3..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/AddAnalysisUuidColumnToCeActivity.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v60;
-
-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.UUID_VARCHAR_SIZE;
-import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder;
-
-public class AddAnalysisUuidColumnToCeActivity extends DdlChange {
-
- private static final String TABLE_CE_ACTIVITY = "ce_activity";
-
- public AddAnalysisUuidColumnToCeActivity(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute(new AddColumnsBuilder(getDatabase().getDialect(), TABLE_CE_ACTIVITY)
- .addColumn(newVarcharColumnDefBuilder().setColumnName("analysis_uuid").setLimit(UUID_VARCHAR_SIZE).setIgnoreOracleUnit(true).build())
- .build());
- }
-
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/AddAnalysisUuidColumnToEvents.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/AddAnalysisUuidColumnToEvents.java
deleted file mode 100644
index 48a76bf0e83..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/AddAnalysisUuidColumnToEvents.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v60;
-
-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.UUID_VARCHAR_SIZE;
-import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder;
-
-public class AddAnalysisUuidColumnToEvents extends DdlChange {
-
- private static final String TABLE_EVENTS = "events";
-
- public AddAnalysisUuidColumnToEvents(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute(new AddColumnsBuilder(getDatabase().getDialect(), TABLE_EVENTS)
- .addColumn(newVarcharColumnDefBuilder().setColumnName("analysis_uuid").setLimit(UUID_VARCHAR_SIZE).setIgnoreOracleUnit(true).build())
- .build());
- }
-
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/AddAnalysisUuidColumnToMeasures.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/AddAnalysisUuidColumnToMeasures.java
deleted file mode 100644
index 81bb882d6dc..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/AddAnalysisUuidColumnToMeasures.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v60;
-
-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.UUID_VARCHAR_SIZE;
-import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder;
-
-public class AddAnalysisUuidColumnToMeasures extends DdlChange {
-
- private static final String TABLE_MEASURES = "project_measures";
-
- public AddAnalysisUuidColumnToMeasures(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute(new AddColumnsBuilder(getDatabase().getDialect(), TABLE_MEASURES)
- .addColumn(newVarcharColumnDefBuilder().setColumnName("analysis_uuid").setLimit(UUID_VARCHAR_SIZE).setIgnoreOracleUnit(true).build())
- .build());
- }
-
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/AddBColumnsToProjects.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/AddBColumnsToProjects.java
deleted file mode 100644
index efed8de66a3..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/AddBColumnsToProjects.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v60;
-
-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.BooleanColumnDef.newBooleanColumnDefBuilder;
-import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder;
-
-public class AddBColumnsToProjects extends DdlChange {
-
- private static final String TABLE_PROJECTS = "projects";
-
- public AddBColumnsToProjects(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute(new AddColumnsBuilder(getDatabase().getDialect(), TABLE_PROJECTS)
- .addColumn(newBooleanColumnDefBuilder().setColumnName("b_changed").build())
- .addColumn(newVarcharColumnDefBuilder().setColumnName("b_copy_component_uuid").setLimit(50).setIgnoreOracleUnit(true).build())
- .addColumn(newVarcharColumnDefBuilder().setColumnName("b_description").setLimit(2000).setIgnoreOracleUnit(true).build())
- .addColumn(newBooleanColumnDefBuilder().setColumnName("b_enabled").build())
- .addColumn(newVarcharColumnDefBuilder().setColumnName("b_language").setLimit(20).setIgnoreOracleUnit(true).build())
- .addColumn(newVarcharColumnDefBuilder().setColumnName("b_long_name").setLimit(500).setIgnoreOracleUnit(true).build())
- .addColumn(newVarcharColumnDefBuilder().setColumnName("b_module_uuid").setLimit(50).setIgnoreOracleUnit(true).build())
- .addColumn(newVarcharColumnDefBuilder().setColumnName("b_module_uuid_path").setLimit(1500).setIgnoreOracleUnit(true).build())
- .addColumn(newVarcharColumnDefBuilder().setColumnName("b_name").setLimit(500).setIgnoreOracleUnit(true).build())
- .addColumn(newVarcharColumnDefBuilder().setColumnName("b_path").setLimit(2000).setIgnoreOracleUnit(true).build())
- .addColumn(newVarcharColumnDefBuilder().setColumnName("b_qualifier").setLimit(10).setIgnoreOracleUnit(true).build())
- .build());
- }
-
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/AddComponentUuidAndAnalysisUuidColumnToDuplicationsIndex.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/AddComponentUuidAndAnalysisUuidColumnToDuplicationsIndex.java
deleted file mode 100644
index 78a525437a3..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/AddComponentUuidAndAnalysisUuidColumnToDuplicationsIndex.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v60;
-
-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.UUID_VARCHAR_SIZE;
-import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder;
-
-public class AddComponentUuidAndAnalysisUuidColumnToDuplicationsIndex extends DdlChange {
-
- private static final String TABLE_PUBLICATIONS_INDEX = "duplications_index";
-
- public AddComponentUuidAndAnalysisUuidColumnToDuplicationsIndex(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute(new AddColumnsBuilder(getDatabase().getDialect(), TABLE_PUBLICATIONS_INDEX)
- .addColumn(newVarcharColumnDefBuilder().setColumnName("component_uuid").setLimit(UUID_VARCHAR_SIZE).setIgnoreOracleUnit(true).build())
- .addColumn(newVarcharColumnDefBuilder().setColumnName("analysis_uuid").setLimit(UUID_VARCHAR_SIZE).setIgnoreOracleUnit(true).build())
- .build());
- }
-
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/AddComponentUuidColumnToMeasures.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/AddComponentUuidColumnToMeasures.java
deleted file mode 100644
index 3ed49bc4977..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/AddComponentUuidColumnToMeasures.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v60;
-
-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.UUID_VARCHAR_SIZE;
-import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder;
-
-public class AddComponentUuidColumnToMeasures extends DdlChange {
-
- private static final String TABLE_MEASURES = "project_measures";
-
- public AddComponentUuidColumnToMeasures(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute(new AddColumnsBuilder(getDatabase().getDialect(), TABLE_MEASURES)
- .addColumn(newVarcharColumnDefBuilder().setColumnName("component_uuid").setLimit(UUID_VARCHAR_SIZE).setIgnoreOracleUnit(true).build())
- .build());
- }
-
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/AddComponentUuidColumnsToSnapshots.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/AddComponentUuidColumnsToSnapshots.java
deleted file mode 100644
index 1629a530008..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/AddComponentUuidColumnsToSnapshots.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v60;
-
-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.UUID_VARCHAR_SIZE;
-import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder;
-
-public class AddComponentUuidColumnsToSnapshots extends DdlChange {
-
- private static final String TABLE_SNAPSHOTS = "snapshots";
-
- public AddComponentUuidColumnsToSnapshots(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute(new AddColumnsBuilder(getDatabase().getDialect(), TABLE_SNAPSHOTS)
- .addColumn(newVarcharColumnDefBuilder().setColumnName("component_uuid").setLimit(UUID_VARCHAR_SIZE).setIgnoreOracleUnit(true).build())
- .addColumn(newVarcharColumnDefBuilder().setColumnName("root_component_uuid").setLimit(UUID_VARCHAR_SIZE).setIgnoreOracleUnit(true).build())
- .build());
- }
-
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/AddIndexOnAnalysisUuidOfMeasures.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/AddIndexOnAnalysisUuidOfMeasures.java
deleted file mode 100644
index 343e78d4b4e..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/AddIndexOnAnalysisUuidOfMeasures.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v60;
-
-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;
-
-import static org.sonar.server.platform.db.migration.def.IntegerColumnDef.newIntegerColumnDefBuilder;
-import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder;
-
-public class AddIndexOnAnalysisUuidOfMeasures extends DdlChange {
-
- public AddIndexOnAnalysisUuidOfMeasures(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- // this index must be present for the performance of next migration
- context.execute(new CreateIndexBuilder()
- .setTable("project_measures")
- .setName("measures_analysis_metric")
- .addColumn(newVarcharColumnDefBuilder().setColumnName("analysis_uuid").setLimit(50).setIgnoreOracleUnit(true).build())
- .addColumn(newIntegerColumnDefBuilder().setColumnName("metric_id").build())
- .build());
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/AddIndexOnComponentUuidOfMeasures.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/AddIndexOnComponentUuidOfMeasures.java
deleted file mode 100644
index d56cc5a3c53..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/AddIndexOnComponentUuidOfMeasures.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v60;
-
-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;
-
-import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder;
-
-public class AddIndexOnComponentUuidOfMeasures extends DdlChange {
-
- public AddIndexOnComponentUuidOfMeasures(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute(new CreateIndexBuilder()
- .setTable("project_measures")
- .setName("measures_component_uuid")
- .addColumn(newVarcharColumnDefBuilder().setColumnName("component_uuid").setLimit(50).setIgnoreOracleUnit(true).build())
- .build());
- }
-
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/AddLastUsedColumnToRulesProfiles.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/AddLastUsedColumnToRulesProfiles.java
deleted file mode 100644
index 22212f422e8..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/AddLastUsedColumnToRulesProfiles.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v60;
-
-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.BigIntegerColumnDef.newBigIntegerColumnDefBuilder;
-
-public class AddLastUsedColumnToRulesProfiles extends DdlChange {
-
- private static final String TABLE_QUALITY_PROFILES = "rules_profiles";
-
- public AddLastUsedColumnToRulesProfiles(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute(new AddColumnsBuilder(getDatabase().getDialect(), TABLE_QUALITY_PROFILES)
- .addColumn(newBigIntegerColumnDefBuilder().setColumnName("last_used").setIsNullable(true).build())
- .build());
- }
-
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/AddProfileKeyToActivities.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/AddProfileKeyToActivities.java
deleted file mode 100644
index 6f3ba4f7abc..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/AddProfileKeyToActivities.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v60;
-
-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 AddProfileKeyToActivities extends DdlChange {
-
- private static final String TABLE_ACTIVITIES = "activities";
-
- public AddProfileKeyToActivities(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute(new AddColumnsBuilder(getDatabase().getDialect(), TABLE_ACTIVITIES)
- .addColumn(newVarcharColumnDefBuilder().setColumnName("profile_key").setLimit(255).setIgnoreOracleUnit(true).build())
- .build());
- }
-
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/AddUniqueIndexOnUuidOfSnapshots.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/AddUniqueIndexOnUuidOfSnapshots.java
deleted file mode 100644
index 6a1079e46a0..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/AddUniqueIndexOnUuidOfSnapshots.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v60;
-
-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;
-
-import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder;
-
-public class AddUniqueIndexOnUuidOfSnapshots extends DdlChange {
-
- public AddUniqueIndexOnUuidOfSnapshots(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute(new CreateIndexBuilder()
- .setTable("snapshots")
- .setName("analyses_uuid")
- .addColumn(newVarcharColumnDefBuilder().setColumnName("uuid").setLimit(50).setIgnoreOracleUnit(true).build())
- .setUnique(true)
- .build());
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/AddUserUpdatedAtToRulesProfiles.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/AddUserUpdatedAtToRulesProfiles.java
deleted file mode 100644
index d32c73414ff..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/AddUserUpdatedAtToRulesProfiles.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v60;
-
-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.BigIntegerColumnDef.newBigIntegerColumnDefBuilder;
-
-public class AddUserUpdatedAtToRulesProfiles extends DdlChange {
-
- private static final String TABLE_QUALITY_PROFILES = "rules_profiles";
-
- public AddUserUpdatedAtToRulesProfiles(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute(new AddColumnsBuilder(getDatabase().getDialect(), TABLE_QUALITY_PROFILES)
- .addColumn(newBigIntegerColumnDefBuilder().setColumnName("user_updated_at").setIsNullable(true).build())
- .build());
- }
-
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/AddUuidColumnToSnapshots.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/AddUuidColumnToSnapshots.java
deleted file mode 100644
index 378ed58516d..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/AddUuidColumnToSnapshots.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v60;
-
-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.UUID_VARCHAR_SIZE;
-import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder;
-
-public class AddUuidColumnToSnapshots extends DdlChange {
-
- private static final String TABLE_SNAPSHOTS = "snapshots";
-
- public AddUuidColumnToSnapshots(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute(new AddColumnsBuilder(getDialect(), TABLE_SNAPSHOTS)
- .addColumn(newVarcharColumnDefBuilder().setColumnName("uuid").setLimit(UUID_VARCHAR_SIZE).setIgnoreOracleUnit(true).build())
- .build());
- }
-
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/AddUuidColumnsToProjects.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/AddUuidColumnsToProjects.java
deleted file mode 100644
index f7d76b38a20..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/AddUuidColumnsToProjects.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v60;
-
-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.UUID_VARCHAR_SIZE;
-import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder;
-
-public class AddUuidColumnsToProjects extends DdlChange {
-
- private static final String TABLE_PROJECTS = "projects";
-
- public AddUuidColumnsToProjects(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute(new AddColumnsBuilder(getDialect(), TABLE_PROJECTS)
- .addColumn(newVarcharColumnDefBuilder().setColumnName("root_uuid").setLimit(UUID_VARCHAR_SIZE).setIgnoreOracleUnit(true).build())
- .addColumn(newVarcharColumnDefBuilder().setColumnName("copy_component_uuid").setLimit(UUID_VARCHAR_SIZE).setIgnoreOracleUnit(true).build())
- .addColumn(newVarcharColumnDefBuilder().setColumnName("developer_uuid").setLimit(UUID_VARCHAR_SIZE).setIgnoreOracleUnit(true).build())
- .build());
- }
-
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/AddUuidPathColumnToProjects.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/AddUuidPathColumnToProjects.java
deleted file mode 100644
index 8814010210f..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/AddUuidPathColumnToProjects.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v60;
-
-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 AddUuidPathColumnToProjects extends DdlChange {
-
- private static final String TABLE_PROJECTS = "projects";
-
- public AddUuidPathColumnToProjects(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute(new AddColumnsBuilder(getDialect(), TABLE_PROJECTS)
- .addColumn(newVarcharColumnDefBuilder().setColumnName("uuid_path").setLimit(1500).setIgnoreOracleUnit(true).build())
- .build());
- }
-
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/CleanEventsWithoutAnalysisUuid.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/CleanEventsWithoutAnalysisUuid.java
deleted file mode 100644
index 814ea122164..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/CleanEventsWithoutAnalysisUuid.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v60;
-
-import java.sql.SQLException;
-import org.sonar.db.Database;
-import org.sonar.server.platform.db.migration.step.MassUpdate;
-import org.sonar.server.platform.db.migration.step.DataChange;
-
-public class CleanEventsWithoutAnalysisUuid extends DataChange {
-
- public CleanEventsWithoutAnalysisUuid(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- MassUpdate massUpdate = context.prepareMassUpdate();
- massUpdate.select("SELECT distinct snapshot_id from events e where e.snapshot_id is not null and e.analysis_uuid is null");
- massUpdate.update("DELETE from events WHERE snapshot_id=?");
- massUpdate.rowPluralName("no analysis uuid events");
- massUpdate.execute((row, update) -> {
- update.setLong(1, row.getLong(1));
- return true;
- });
- }
-
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/CleanEventsWithoutSnapshotId.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/CleanEventsWithoutSnapshotId.java
deleted file mode 100644
index c9da31dbca0..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/CleanEventsWithoutSnapshotId.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v60;
-
-import java.sql.SQLException;
-import org.sonar.db.Database;
-import org.sonar.server.platform.db.migration.step.MassUpdate;
-import org.sonar.server.platform.db.migration.step.DataChange;
-
-public class CleanEventsWithoutSnapshotId extends DataChange {
-
- public CleanEventsWithoutSnapshotId(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- MassUpdate massUpdate = context.prepareMassUpdate();
- massUpdate.select("SELECT e.id from events e where e.snapshot_id is null");
- massUpdate.update("DELETE from events WHERE id=?");
- massUpdate.rowPluralName("no snapshot id events");
- massUpdate.execute((row, update) -> {
- update.setLong(1, row.getLong(1));
- return true;
- });
- }
-
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/CleanMeasuresWithNullAnalysisUuid.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/CleanMeasuresWithNullAnalysisUuid.java
deleted file mode 100644
index 2a9c60c7775..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/CleanMeasuresWithNullAnalysisUuid.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v60;
-
-import java.sql.SQLException;
-import org.sonar.db.Database;
-import org.sonar.server.platform.db.migration.step.MassUpdate;
-import org.sonar.server.platform.db.migration.step.DataChange;
-
-public class CleanMeasuresWithNullAnalysisUuid extends DataChange {
-
- public CleanMeasuresWithNullAnalysisUuid(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- MassUpdate massUpdate = context.prepareMassUpdate();
- massUpdate.select("select id from project_measures where analysis_uuid is null");
- massUpdate.update("delete from project_measures where id=?");
- massUpdate.rowPluralName("measures");
- massUpdate.execute((row, update) -> {
- update.setLong(1, row.getLong(1));
- return true;
- });
- }
-
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/CleanOrphanRowsInProjects.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/CleanOrphanRowsInProjects.java
deleted file mode 100644
index 20f65335652..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/CleanOrphanRowsInProjects.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v60;
-
-import java.sql.SQLException;
-import org.sonar.db.Database;
-import org.sonar.server.platform.db.migration.step.MassUpdate;
-import org.sonar.server.platform.db.migration.step.DataChange;
-
-public class CleanOrphanRowsInProjects extends DataChange {
-
- public CleanOrphanRowsInProjects(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- MassUpdate massUpdate = context.prepareMassUpdate();
- massUpdate.select("SELECT p.id from projects p where p.root_uuid is null" +
- " or (p.copy_resource_id is not null and p.copy_component_uuid is null)" +
- " or (p.person_id is not null and p.developer_uuid is null)");
- massUpdate.update("DELETE from projects WHERE id=?");
- massUpdate.rowPluralName("orphan projects");
- massUpdate.execute((row, update) -> {
- long projectId = row.getLong(1);
- update.setLong(1, projectId);
- return true;
- });
- }
-
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/CleanOrphanRowsInSnapshots.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/CleanOrphanRowsInSnapshots.java
deleted file mode 100644
index b29904f27dd..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/CleanOrphanRowsInSnapshots.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v60;
-
-import java.sql.SQLException;
-import org.sonar.db.Database;
-import org.sonar.server.platform.db.migration.step.MassUpdate;
-import org.sonar.server.platform.db.migration.step.DataChange;
-
-public class CleanOrphanRowsInSnapshots extends DataChange {
-
- public CleanOrphanRowsInSnapshots(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- MassUpdate massUpdate = context.prepareMassUpdate();
- massUpdate.select("SELECT sn.id, sn.project_id, sn.root_project_id from snapshots sn where sn.component_uuid is null or sn.root_component_uuid is null");
- massUpdate.update("DELETE from duplications_index WHERE snapshot_id=? or project_snapshot_id=?");
- massUpdate.update("DELETE from project_measures WHERE snapshot_id=?");
- massUpdate.update("DELETE from ce_activity WHERE snapshot_id=?");
- massUpdate.update("DELETE from events WHERE snapshot_id=?");
- massUpdate.update("DELETE from snapshots WHERE id=?");
- massUpdate.rowPluralName("snapshots");
- massUpdate.execute((row, update, updateIndex) -> {
- long snapshotId = row.getLong(1);
- switch (updateIndex) {
- case 0:
- update.setLong(1, snapshotId);
- update.setLong(2, snapshotId);
- return true;
- case 1:
- case 2:
- case 3:
- case 4:
- update.setLong(1, snapshotId);
- return true;
- default:
- throw new IllegalArgumentException("Unsupported update index " + updateIndex);
- }
- });
- }
-
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/CleanUsurperRootComponents.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/CleanUsurperRootComponents.java
deleted file mode 100644
index 7e5d12c37bd..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/CleanUsurperRootComponents.java
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v60;
-
-import java.sql.SQLException;
-import org.sonar.db.Database;
-import org.sonar.server.platform.db.migration.step.MassUpdate;
-import org.sonar.server.platform.db.migration.step.DataChange;
-
-public class CleanUsurperRootComponents extends DataChange {
-
- public CleanUsurperRootComponents(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- // fix snapshots which don't have the scope and/or qualifier of their associated component
- fixSnapshotScopeAndQualifier(context);
- // delete components declaring themselves as root in table PROJECTS but which don't have a root scope and/or qualifier
- cleanUsurperRootComponents(context);
- // components which has snapshots reference a component as root which is not a root
- cleanSnapshotWithIncorrectRoot(context);
- }
-
- private static void fixSnapshotScopeAndQualifier(Context context) throws SQLException {
- MassUpdate massUpdate = context.prepareMassUpdate();
- massUpdate.select("select" +
- " sn.id,p.scope,p.qualifier" +
- " from" +
- " snapshots sn, projects p" +
- " where" +
- " p.uuid = sn.component_uuid" +
- " and (p.qualifier<>sn.qualifier or p.scope<>sn.scope)");
- massUpdate.update("update snapshots set scope=?,qualifier=? where id=?");
- massUpdate.rowPluralName("snapshots with inconsistent scope or qualifier");
- massUpdate.execute((row, update) -> {
- long snapshotId = row.getLong(1);
- String scope = row.getString(2);
- String qualifier = row.getString(3);
-
- update.setString(1, scope);
- update.setString(2, qualifier);
- update.setLong(3, snapshotId);
-
- return true;
- });
- }
-
- private static void cleanUsurperRootComponents(Context context) throws SQLException {
- MassUpdate massUpdate = context.prepareMassUpdate();
- massUpdate.select("select p.id,p.uuid from projects p " +
- " where" +
- " p.project_uuid = p.uuid" +
- " and not (" +
- " p.scope = 'PRJ'" +
- " and p.qualifier in ('TRK', 'VW', 'DEV')" +
- " )");
- massUpdate.update("delete from duplications_index where snapshot_id in (select id from snapshots where component_uuid=?)");
- massUpdate.update("delete from project_measures where component_uuid=?");
- massUpdate.update("delete from ce_activity where component_uuid=?");
- massUpdate.update("delete from events where component_uuid=?");
- massUpdate.update("delete from project_links where component_uuid=?");
- massUpdate.update("delete from snapshots where component_uuid=? or root_component_uuid=?");
- massUpdate.update("delete from issues where component_uuid=? or project_uuid=?");
- massUpdate.update("delete from file_sources where file_uuid=? or project_uuid=?");
- massUpdate.update("delete from group_roles where resource_id=?");
- massUpdate.update("delete from user_roles where resource_id=?");
- massUpdate.update("delete from properties where resource_id=?");
- massUpdate.update("delete from widgets where resource_id=?");
- massUpdate.update("delete from projects where uuid=?");
- massUpdate.rowPluralName("usurper root components");
- massUpdate.execute((row, update, updateIndex) -> {
- long componentId = row.getLong(1);
- String componentUuid = row.getString(2);
- switch (updateIndex) {
- case 0:
- case 1:
- case 2:
- case 3:
- case 4:
- update.setString(1, componentUuid);
- return true;
- case 5:
- case 6:
- case 7:
- update.setString(1, componentUuid);
- update.setString(2, componentUuid);
- return true;
- case 8:
- case 9:
- case 10:
- case 11:
- update.setLong(1, componentId);
- return true;
- case 12:
- update.setString(1, componentUuid);
- return true;
- default:
- throw new IllegalArgumentException("Unsupported update index " + updateIndex);
- }
- });
- }
-
- private static void cleanSnapshotWithIncorrectRoot(Context context) throws SQLException {
- MassUpdate massUpdate = context.prepareMassUpdate();
- massUpdate.select("select" +
- " sn.id" +
- " from " +
- " projects p, snapshots sn" +
- " where" +
- " p.uuid = sn.root_component_uuid" +
- " and not (" +
- " p.scope = 'PRJ'" +
- " and p.qualifier in ('TRK', 'VW', 'DEV')" +
- " )");
- massUpdate.update("DELETE from ce_activity WHERE snapshot_id=?");
- massUpdate.update("DELETE from events WHERE snapshot_id=?");
- massUpdate.update("DELETE from project_measures WHERE snapshot_id=?");
- massUpdate.update("DELETE from duplications_index WHERE project_snapshot_id=?");
- massUpdate.update("DELETE from snapshots WHERE id=?");
- massUpdate.rowPluralName("snapshots with incorrect root");
- massUpdate.execute((row, update, updateIndex) -> {
- long snapshotId = row.getLong(1);
- switch (updateIndex) {
- case 0:
- case 1:
- case 2:
- case 3:
- case 4:
- update.setLong(1, snapshotId);
- return true;
- default:
- throw new IllegalArgumentException("Unsupported update index " + updateIndex);
- }
- });
- }
-
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/CreatePermTemplatesCharacteristics.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/CreatePermTemplatesCharacteristics.java
deleted file mode 100644
index 1ddc99ded10..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/CreatePermTemplatesCharacteristics.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v60;
-
-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.CreateTableBuilder;
-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.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.sql.CreateTableBuilder.ColumnFlag.AUTO_INCREMENT;
-import static org.sonar.server.platform.db.migration.def.IntegerColumnDef.newIntegerColumnDefBuilder;
-import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder;
-
-public class CreatePermTemplatesCharacteristics extends DdlChange {
-
- private static final String TABLE_NAME = "perm_tpl_characteristics";
-
- public CreatePermTemplatesCharacteristics(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- IntegerColumnDef templateIdColumn = newIntegerColumnDefBuilder().setColumnName("template_id").setIsNullable(false).build();
- VarcharColumnDef permissionKeyColumn = newVarcharColumnDefBuilder().setColumnName("permission_key").setLimit(64).setIsNullable(false).setIgnoreOracleUnit(true).build();
- context.execute(
- new CreateTableBuilder(getDialect(), TABLE_NAME)
- .addPkColumn(newIntegerColumnDefBuilder().setColumnName("id").setIsNullable(false).build(), AUTO_INCREMENT)
- .addColumn(templateIdColumn)
- .addColumn(permissionKeyColumn)
- .addColumn(newBooleanColumnDefBuilder().setColumnName("with_project_creator").setIsNullable(false).setDefaultValue(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("uniq_perm_tpl_charac")
- .setUnique(true)
- .addColumn(templateIdColumn)
- .addColumn(permissionKeyColumn)
- .build());
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/CreateTemporaryIndicesFor1211.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/CreateTemporaryIndicesFor1211.java
deleted file mode 100644
index ee02d2e885a..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/CreateTemporaryIndicesFor1211.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v60;
-
-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;
-
-import static org.sonar.server.platform.db.migration.def.IntegerColumnDef.newIntegerColumnDefBuilder;
-
-public class CreateTemporaryIndicesFor1211 extends DdlChange {
-
- static final String INDEX_ON_CE_ACTIVITY = "ce_activity_snapshot_id";
- static final String INDEX_ON_DUPLICATIONS_INDEX = "dup_index_psid";
-
- public CreateTemporaryIndicesFor1211(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute(new CreateIndexBuilder()
- .setTable("ce_activity")
- .setName(INDEX_ON_CE_ACTIVITY)
- .addColumn(newIntegerColumnDefBuilder().setColumnName("snapshot_id").build())
- .build());
- context.execute(new CreateIndexBuilder()
- .setTable("duplications_index")
- .setName(INDEX_ON_DUPLICATIONS_INDEX)
- .addColumn(newIntegerColumnDefBuilder().setColumnName("project_snapshot_id").build())
- .build());
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/DbVersion60.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/DbVersion60.java
deleted file mode 100644
index 510de2a2d11..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v60/DbVersion60.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v60;
-
-import java.util.stream.Stream;
-import org.sonar.server.platform.db.migration.step.MigrationStepRegistry;
-import org.sonar.server.platform.db.migration.version.DbVersion;
-
-public class DbVersion60 implements DbVersion {
- @Override
- public Stream
- */
-public class PopulateDefaultPermTemplateColumnsOfOrganizations extends DataChange {
- private static final String DEFAULT_TEMPLATE_PROPERTY = "sonar.permission.template.default";
- private static final String DEFAULT_PROJECT_TEMPLATE_PROPERTY = "sonar.permission.template.TRK.default";
- private static final String DEFAULT_VIEW_TEMPLATE_PROPERTY = "sonar.permission.template.VW.default";
- private static final String DEFAULT_DEV_TEMPLATE_PROPERTY = "sonar.permission.template.DEV.default";
-
- private final DefaultOrganizationUuidProvider defaultOrganizationUuid;
- private final UuidFactory uuidFactory;
-
- public PopulateDefaultPermTemplateColumnsOfOrganizations(Database db, DefaultOrganizationUuidProvider defaultOrganizationUuid, UuidFactory uuidFactory) {
- super(db);
- this.defaultOrganizationUuid = defaultOrganizationUuid;
- this.uuidFactory = uuidFactory;
- }
-
- @Override
- protected void execute(Context context) throws SQLException {
- String defaultOrganizationUuid = this.defaultOrganizationUuid.getAndCheck(context);
- ensureOnlyDefaultOrganizationExists(context, defaultOrganizationUuid);
-
- Map defaultTemplateProperties = retrieveDefaultTemplateProperties(context);
-
- String globalDefaultTemplate = defaultTemplateProperties.get(DEFAULT_TEMPLATE_PROPERTY);
- if (globalDefaultTemplate == null || globalDefaultTemplate.isEmpty()) {
- // DB has just been created, default template of default organization will be populated by a startup task
- return;
- }
- String projectDefaultTemplate = updateKeeIfRequired(context,
- firstNonNull(defaultTemplateProperties.get(DEFAULT_PROJECT_TEMPLATE_PROPERTY), globalDefaultTemplate));
- String viewDefaultTemplate = updateKeeIfRequired(context,
- defaultTemplateProperties.get(DEFAULT_VIEW_TEMPLATE_PROPERTY));
-
- Loggers.get(PopulateDefaultPermTemplateColumnsOfOrganizations.class)
- .debug("Setting default templates on default organization '{}': project='{}', view='{}'",
- defaultOrganizationUuid, projectDefaultTemplate, viewDefaultTemplate);
-
- context.prepareUpsert("update organizations set" +
- " default_perm_template_project=?," +
- " default_perm_template_view=?" +
- " where" +
- " uuid=?")
- .setString(1, projectDefaultTemplate)
- .setString(2, viewDefaultTemplate)
- .setString(3, defaultOrganizationUuid)
- .execute()
- .commit();
-
- // delete properties
- context.prepareUpsert("delete from properties where prop_key in (?,?,?,?)")
- .setString(1, DEFAULT_TEMPLATE_PROPERTY)
- .setString(2, DEFAULT_PROJECT_TEMPLATE_PROPERTY)
- .setString(3, DEFAULT_VIEW_TEMPLATE_PROPERTY)
- .setString(4, DEFAULT_DEV_TEMPLATE_PROPERTY)
- .execute()
- .commit();
- }
-
- /**
- * SONAR-10407 Ensure that the kee length is not greater than 40
- * In this case, we must update the kee to a UUID
- */
- private String updateKeeIfRequired(Context context, @Nullable String kee) throws SQLException {
- if (kee == null || kee.length() <= VarcharColumnDef.UUID_SIZE) {
- return kee;
- }
-
- String newKee = uuidFactory.create();
- context.prepareUpsert("update permission_templates set kee=? where kee=?")
- .setString(1, newKee)
- .setString(2, kee)
- .execute();
- return newKee;
- }
-
- private static void ensureOnlyDefaultOrganizationExists(Context context, String defaultOrganizationUuid) throws SQLException {
- Integer otherOrganizationCount = context.prepareSelect("select count(*) from organizations where uuid <> ?")
- .setString(1, defaultOrganizationUuid)
- .get(row -> row.getInt(1));
- checkState(otherOrganizationCount == 0,
- "Can not migrate DB if more than one organization exists. Remove all organizations but the default one which uuid is '%s'",
- defaultOrganizationUuid);
- }
-
- private static Map retrieveDefaultTemplateProperties(Context context) throws SQLException {
- Map templates = new HashMap<>(3);
- context.prepareSelect("select prop_key,is_empty,text_value from properties where prop_key in (?,?,?)")
- .setString(1, DEFAULT_TEMPLATE_PROPERTY)
- .setString(2, DEFAULT_PROJECT_TEMPLATE_PROPERTY)
- .setString(3, DEFAULT_VIEW_TEMPLATE_PROPERTY)
- .scroll(row -> {
- String key = row.getString(1);
- boolean isEmpty = row.getBoolean(2);
- String textValue = row.getString(3);
- if (!isEmpty) {
- templates.put(key, textValue);
- }
- });
- return templates;
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v63/PopulateOrganizationUuidToProjects.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v63/PopulateOrganizationUuidToProjects.java
deleted file mode 100644
index cc159a80dd6..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v63/PopulateOrganizationUuidToProjects.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v63;
-
-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 PopulateOrganizationUuidToProjects extends DataChange {
- private final DefaultOrganizationUuidProvider defaultOrganizationUuid;
-
- public PopulateOrganizationUuidToProjects(Database db, DefaultOrganizationUuidProvider defaultOrganizationUuid) {
- super(db);
- this.defaultOrganizationUuid = defaultOrganizationUuid;
- }
-
- @Override
- protected void execute(Context context) throws SQLException {
- String organizationUuid = defaultOrganizationUuid.get(context);
-
- // update rows by component tree
- MassUpdate massUpdate = context.prepareMassUpdate();
- massUpdate.select("select uuid from projects where organization_uuid is null and project_uuid = uuid");
- massUpdate.update("update projects set organization_uuid=? where project_uuid=?");
- massUpdate.rowPluralName("project trees");
- massUpdate.execute((row, update) -> {
- String uuid = row.getString(1);
- update.setString(1, organizationUuid);
- update.setString(2, uuid);
- return true;
- });
-
- // update rows lefts without organization_uuid, just in case we have orphan rows (aka. bad data) in DB
- massUpdate = context.prepareMassUpdate();
- massUpdate.select("select uuid from projects where organization_uuid is null");
- massUpdate.update("update projects set organization_uuid=? where uuid=?");
- massUpdate.rowPluralName("components");
- massUpdate.execute((row, update) -> {
- String uuid = row.getString(1);
- update.setString(1, organizationUuid);
- update.setString(2, uuid);
- return true;
- });
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v63/PopulateUuidColumnOfEvents.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v63/PopulateUuidColumnOfEvents.java
deleted file mode 100644
index 89aed698a1a..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v63/PopulateUuidColumnOfEvents.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v63;
-
-import java.sql.SQLException;
-import org.sonar.core.util.UuidFactory;
-import org.sonar.db.Database;
-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.DataChange;
-
-public class PopulateUuidColumnOfEvents extends DataChange {
-
- private final UuidFactory uuidFactory;
-
- public PopulateUuidColumnOfEvents(Database db, UuidFactory uuidFactory) {
- super(db);
- this.uuidFactory = uuidFactory;
- }
-
- @Override
- protected void execute(Context context) throws SQLException {
- MassUpdate massUpdate = context.prepareMassUpdate();
- massUpdate.select("SELECT e.id from events e where e.uuid is null");
- massUpdate.update("UPDATE events SET uuid=? WHERE id=?");
- massUpdate.rowPluralName("events");
- massUpdate.execute(this::handle);
- }
-
- private boolean handle(Select.Row row, SqlStatement update) throws SQLException {
- long id = row.getLong(1);
- update.setString(1, uuidFactory.create());
- update.setLong(2, id);
- return true;
- }
-
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v63/UnsetUserRootFlags.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v63/UnsetUserRootFlags.java
deleted file mode 100644
index f163016600e..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v63/UnsetUserRootFlags.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v63;
-
-import java.sql.SQLException;
-import org.sonar.api.utils.System2;
-import org.sonar.db.Database;
-import org.sonar.server.platform.db.migration.step.DataChange;
-
-/**
- * Organizations and root users were not production-ready
- * in versions prior to 6.3. For this reason they should not
- * be enabled. This migration unsets the root flag from
- * users.
- */
-public class UnsetUserRootFlags extends DataChange {
-
- private final System2 system2;
-
- public UnsetUserRootFlags(Database db, System2 system2) {
- super(db);
- this.system2 = system2;
- }
-
- @Override
- protected void execute(Context context) throws SQLException {
- context.prepareUpsert("update users set is_root=?, updated_at=? where is_root=?")
- .setBoolean(1, false)
- .setLong(2, system2.now())
- .setBoolean(3, true)
- .execute()
- .commit();
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v63/package-info.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v63/package-info.java
deleted file mode 100644
index 8309e598bbc..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v63/package-info.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public 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.v63;
-
-import javax.annotation.ParametersAreNonnullByDefault;
-
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/AddCeActivityWorkerUuidAndExecutionCount.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/AddCeActivityWorkerUuidAndExecutionCount.java
deleted file mode 100644
index b7097f09450..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/AddCeActivityWorkerUuidAndExecutionCount.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v64;
-
-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.IntegerColumnDef.newIntegerColumnDefBuilder;
-
-public class AddCeActivityWorkerUuidAndExecutionCount extends DdlChange {
-
- private static final String TABLE_CE_ACTIVITY = "ce_activity";
-
- public AddCeActivityWorkerUuidAndExecutionCount(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute(new AddColumnsBuilder(getDialect(), TABLE_CE_ACTIVITY)
- .addColumn(VarcharColumnDef.newVarcharColumnDefBuilder()
- .setColumnName("worker_uuid")
- .setLimit(VarcharColumnDef.UUID_SIZE)
- .setIsNullable(true)
- .build())
- .addColumn(newIntegerColumnDefBuilder()
- .setColumnName("execution_count")
- .setIsNullable(true)
- .build())
- .build());
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/AddCeQueueWorkerUuidAndExecutionCount.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/AddCeQueueWorkerUuidAndExecutionCount.java
deleted file mode 100644
index a55e4f3bce7..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/AddCeQueueWorkerUuidAndExecutionCount.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v64;
-
-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.IntegerColumnDef.newIntegerColumnDefBuilder;
-
-public class AddCeQueueWorkerUuidAndExecutionCount extends DdlChange {
-
- private static final String TABLE_CE_QUEUE = "ce_queue";
-
- public AddCeQueueWorkerUuidAndExecutionCount(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute(new AddColumnsBuilder(getDialect(), TABLE_CE_QUEUE)
- .addColumn(VarcharColumnDef.newVarcharColumnDefBuilder()
- .setColumnName("worker_uuid")
- .setLimit(VarcharColumnDef.UUID_SIZE)
- .setIsNullable(true)
- .build())
- .addColumn(newIntegerColumnDefBuilder()
- .setColumnName("execution_count")
- .setIsNullable(true)
- .build())
- .build());
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/AddColumnNewProjectPrivate.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/AddColumnNewProjectPrivate.java
deleted file mode 100644
index c24086badcd..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/AddColumnNewProjectPrivate.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v64;
-
-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.BooleanColumnDef.newBooleanColumnDefBuilder;
-
-public class AddColumnNewProjectPrivate extends DdlChange {
- public AddColumnNewProjectPrivate(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute(new AddColumnsBuilder(getDialect(), "organizations")
- .addColumn(newBooleanColumnDefBuilder()
- .setColumnName("new_project_private")
- .setIsNullable(true)
- .build())
- .build());
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/AddColumnProjectsPrivate.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/AddColumnProjectsPrivate.java
deleted file mode 100644
index 141194dce16..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/AddColumnProjectsPrivate.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v64;
-
-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.BooleanColumnDef.newBooleanColumnDefBuilder;
-
-public class AddColumnProjectsPrivate extends DdlChange {
- public AddColumnProjectsPrivate(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute(new AddColumnsBuilder(getDialect(), "projects")
- .addColumn(newBooleanColumnDefBuilder()
- .setColumnName("private")
- .setIsNullable(true)
- .build())
- .build());
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/AddDefaultGroupIdToOrganizations.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/AddDefaultGroupIdToOrganizations.java
deleted file mode 100644
index 23daecb144d..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/AddDefaultGroupIdToOrganizations.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v64;
-
-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.IntegerColumnDef.newIntegerColumnDefBuilder;
-
-public class AddDefaultGroupIdToOrganizations extends DdlChange {
-
- public AddDefaultGroupIdToOrganizations(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute(new AddColumnsBuilder(getDialect(), "organizations")
- .addColumn(newIntegerColumnDefBuilder()
- .setColumnName("default_group_id")
- .setIsNullable(true)
- .build())
- .build());
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/AddIndexLoadedTemplatesType.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/AddIndexLoadedTemplatesType.java
deleted file mode 100644
index ff1566d16a1..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/AddIndexLoadedTemplatesType.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v64;
-
-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 AddIndexLoadedTemplatesType extends DdlChange {
- public AddIndexLoadedTemplatesType(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute(
- new CreateIndexBuilder()
- .setTable("loaded_templates")
- .setName("ix_loaded_templates_type")
- .addColumn(VarcharColumnDef.newVarcharColumnDefBuilder()
- .setColumnName("template_type")
- .setIsNullable(false)
- .setLimit(64)
- .build())
- .build());
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/AddIndexOnActiveRuleParameters.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/AddIndexOnActiveRuleParameters.java
deleted file mode 100644
index 73eaef40ea9..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/AddIndexOnActiveRuleParameters.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v64;
-
-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;
-
-import static org.sonar.server.platform.db.migration.def.IntegerColumnDef.newIntegerColumnDefBuilder;
-
-public class AddIndexOnActiveRuleParameters extends DdlChange {
- public AddIndexOnActiveRuleParameters(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute(
- new CreateIndexBuilder()
- .setTable("active_rule_parameters")
- .setName("ix_arp_on_active_rule_id")
- .addColumn(newIntegerColumnDefBuilder().setColumnName("active_rule_id").setIsNullable(false).build())
- .build());
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/AddQualityProfileOrganizationUuid.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/AddQualityProfileOrganizationUuid.java
deleted file mode 100644
index e7d50c5f57b..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/AddQualityProfileOrganizationUuid.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v64;
-
-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.UUID_SIZE;
-import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder;
-
-public class AddQualityProfileOrganizationUuid extends DdlChange {
-
- public AddQualityProfileOrganizationUuid(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute(
- new AddColumnsBuilder(getDialect(), "rules_profiles")
- .addColumn(newVarcharColumnDefBuilder()
- .setColumnName("organization_uuid")
- .setIsNullable(true)
- .setLimit(UUID_SIZE)
- .build())
- .build());
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/AddTagsToProjects.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/AddTagsToProjects.java
deleted file mode 100644
index 7a3f7f08045..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/AddTagsToProjects.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v64;
-
-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 AddTagsToProjects extends DdlChange {
-
- public AddTagsToProjects(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- VarcharColumnDef column = newVarcharColumnDefBuilder()
- .setColumnName("tags")
- .setIsNullable(true)
- .setLimit(500)
- .build();
- context.execute(new AddColumnsBuilder(getDialect(), "projects").addColumn(column).build());
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/CleanLoadedTemplateOrphans.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/CleanLoadedTemplateOrphans.java
deleted file mode 100644
index 4d3e4464d98..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/CleanLoadedTemplateOrphans.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v64;
-
-import java.sql.SQLException;
-import org.sonar.db.Database;
-import org.sonar.server.platform.db.migration.step.DataChange;
-
-public class CleanLoadedTemplateOrphans extends DataChange {
- public CleanLoadedTemplateOrphans(Database db) {
- super(db);
- }
-
- @Override
- protected void execute(Context context) throws SQLException {
- context.prepareUpsert("delete from loaded_templates where template_type is null")
- .execute()
- .commit();
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/CleanOrphanRowsInGroupsUsers.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/CleanOrphanRowsInGroupsUsers.java
deleted file mode 100644
index 5a6f5bb8a73..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/CleanOrphanRowsInGroupsUsers.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v64;
-
-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 CleanOrphanRowsInGroupsUsers extends DataChange {
-
- public CleanOrphanRowsInGroupsUsers(Database db) {
- super(db);
- }
-
- @Override
- protected void execute(Context context) throws SQLException {
- MassUpdate massUpdate = context.prepareMassUpdate().rowPluralName("orphan user group membership");
- massUpdate.select("SELECT gu.user_id, gu.group_id FROM groups_users gu " +
- "LEFT OUTER JOIN users u ON u.id=gu.user_id " +
- "WHERE u.id IS NULL or u.active=?")
- .setBoolean(1, false);
- massUpdate.update("DELETE FROM groups_users WHERE user_id=? AND group_id=?");
- massUpdate.execute((row, update) -> {
- update.setLong(1, row.getLong(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/v64/CreateMembersGroupsInEachOrganization.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/CreateMembersGroupsInEachOrganization.java
deleted file mode 100644
index d319fe8bd8a..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/CreateMembersGroupsInEachOrganization.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v64;
-
-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.step.DataChange;
-import org.sonar.server.platform.db.migration.step.MassUpdate;
-
-public class CreateMembersGroupsInEachOrganization extends DataChange {
-
- private static final String GROUP_MEMBERS = "Members";
-
- private final System2 system2;
-
- public CreateMembersGroupsInEachOrganization(Database db, System2 system2) {
- super(db);
- this.system2 = system2;
- }
-
- @Override
- protected void execute(Context context) throws SQLException {
- Date now = new Date(system2.now());
- if (isOrganizationEnabled(context)) {
- createMembersGroup(context, now);
- createPermissionTemplateGroups(context, now);
- }
- }
-
- private static void createMembersGroup(Context context, Date now) throws SQLException {
- MassUpdate massUpdate = context.prepareMassUpdate().rowPluralName("groups");
- massUpdate.select("SELECT o.uuid FROM organizations o " +
- "WHERE NOT EXISTS (SELECT 1 FROM groups g WHERE g.organization_uuid=o.uuid AND g.name=?)").setString(1, GROUP_MEMBERS);
- massUpdate.update("INSERT INTO groups (organization_uuid, name, description, created_at, updated_at) values (?, ?, ?, ?, ?)");
- massUpdate.execute((row, update) -> {
- update
- .setString(1, row.getString(1))
- .setString(2, GROUP_MEMBERS)
- .setString(3, "All members of the organization")
- .setDate(4, now)
- .setDate(5, now);
- return true;
- });
- }
-
- private static void createPermissionTemplateGroups(Context context, Date now) throws SQLException {
- MassUpdate massUpdate = context.prepareMassUpdate().rowPluralName("permission templates on groups");
- massUpdate.select("SELECT g.id, pt.id FROM organizations o " +
- "INNER JOIN permission_templates pt ON pt.kee=o.default_perm_template_project " +
- "INNER JOiN groups g ON g.organization_uuid=o.uuid AND g.name=? " +
- "WHERE NOT EXISTS (SELECT 1 FROM perm_templates_groups ptg WHERE ptg.group_id=g.id AND ptg.template_id=pt.id)")
- .setString(1, GROUP_MEMBERS);
- massUpdate.update("INSERT INTO perm_templates_groups (group_id, template_id, permission_reference, created_at, updated_at) values (?, ?, ?, ?, ?)");
- massUpdate.update("INSERT INTO perm_templates_groups (group_id, template_id, permission_reference, created_at, updated_at) values (?, ?, ?, ?, ?)");
- massUpdate.execute((row, update, updateIndex) -> {
- update
- .setLong(1, row.getLong(1))
- .setLong(2, row.getLong(2))
- .setString(3, updateIndex == 0 ? "user" : "codeviewer")
- .setDate(4, now)
- .setDate(5, now);
- return true;
- });
- }
-
- private static boolean isOrganizationEnabled(Context context) throws SQLException {
- Boolean result = context.prepareSelect("SELECT text_value FROM internal_properties WHERE kee=?")
- .setString(1, "organization.enabled")
- .get(row -> "true".equals(row.getString(1)));
- return result != null ? result : false;
- }
-
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/CreateOrganizationMembersTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/CreateOrganizationMembersTable.java
deleted file mode 100644
index 50cbcbed78d..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/CreateOrganizationMembersTable.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v64;
-
-import java.sql.SQLException;
-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.IntegerColumnDef.newIntegerColumnDefBuilder;
-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 CreateOrganizationMembersTable extends DdlChange {
-
- private static final String TABLE_NAME = "organization_members";
-
- public CreateOrganizationMembersTable(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute(
- new CreateTableBuilder(getDialect(), TABLE_NAME)
- .addPkColumn(newVarcharColumnDefBuilder().setColumnName("organization_uuid").setLimit(UUID_SIZE).setIsNullable(false).build())
- .addPkColumn(newIntegerColumnDefBuilder().setColumnName("user_id").setIsNullable(false).build())
- .build());
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/CreateRulesMetadata.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/CreateRulesMetadata.java
deleted file mode 100644
index 4c93b7ea175..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/CreateRulesMetadata.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v64;
-
-import java.sql.SQLException;
-import org.sonar.db.Database;
-import org.sonar.server.platform.db.migration.def.ClobColumnDef;
-import org.sonar.server.platform.db.migration.def.VarcharColumnDef;
-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.IntegerColumnDef.newIntegerColumnDefBuilder;
-import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder;
-
-public class CreateRulesMetadata extends DdlChange {
-
- private static final String TABLE_NAME = "rules_metadata";
-
- public CreateRulesMetadata(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute(new CreateTableBuilder(getDialect(), TABLE_NAME)
- .addPkColumn(newIntegerColumnDefBuilder()
- .setColumnName("rule_id")
- .setIsNullable(false)
- .build())
- .addPkColumn(newVarcharColumnDefBuilder()
- .setColumnName("organization_uuid")
- .setLimit(VarcharColumnDef.UUID_SIZE)
- .setIsNullable(false)
- .build())
- .addColumn(ClobColumnDef.newClobColumnDefBuilder()
- .setColumnName("note_data")
- .setIsNullable(true)
- .build())
- .addColumn(newVarcharColumnDefBuilder()
- .setColumnName("note_user_login")
- .setLimit(255)
- .setIsNullable(true)
- .build())
- .addColumn(newBigIntegerColumnDefBuilder()
- .setColumnName("note_created_at")
- .setIsNullable(true)
- .build())
- .addColumn(newBigIntegerColumnDefBuilder()
- .setColumnName("note_updated_at")
- .setIsNullable(true)
- .build())
- .addColumn(newVarcharColumnDefBuilder()
- .setColumnName("remediation_function")
- .setLimit(20)
- .setIsNullable(true)
- .build())
- .addColumn(newVarcharColumnDefBuilder()
- .setColumnName("remediation_gap_mult")
- .setLimit(20)
- .setIsNullable(true)
- .build())
- .addColumn(newVarcharColumnDefBuilder()
- .setColumnName("remediation_base_effort")
- .setLimit(20)
- .setIsNullable(true)
- .build())
- .addColumn(newVarcharColumnDefBuilder()
- .setColumnName("tags")
- .setLimit(4000)
- .setIsNullable(true)
- .build())
- .addColumn(newBigIntegerColumnDefBuilder()
- .setColumnName("created_at")
- .setIsNullable(false)
- .build())
- .addColumn(newBigIntegerColumnDefBuilder()
- .setColumnName("updated_at")
- .setIsNullable(false)
- .build())
- .withPkConstraintName("pk_" + TABLE_NAME)
- .build());
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/DbVersion64.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/DbVersion64.java
deleted file mode 100644
index 21011461864..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/DbVersion64.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v64;
-
-import org.sonar.server.platform.db.migration.step.MigrationStepRegistry;
-import org.sonar.server.platform.db.migration.version.DbVersion;
-
-public class DbVersion64 implements DbVersion {
- @Override
- public void addSteps(MigrationStepRegistry registry) {
- registry
- .add(1600, "Add PROJECTS.TAGS", AddTagsToProjects.class)
- .add(1601, "Set PROJECTS.COPY_COMPONENT_UUID on local views", SetCopyComponentUuidOnLocalViews.class)
- .add(1602, "Add RULES_PROFILES.ORGANIZATION_UUID", AddQualityProfileOrganizationUuid.class)
- .add(1603, "Set RULES_PROFILES.ORGANIZATION_UUID to default", SetQualityProfileOrganizationUuidToDefault.class)
- .add(1604, "Make RULES_PROFILES.ORGANIZATION_UUID not nullable", MakeQualityProfileOrganizationUuidNotNullable.class)
- .add(1605, "Drop unique index on RULES_PROFILES.KEE", DropUniqueIndexOnQualityProfileKey.class)
- .add(1606, "Make RULES_PROFILES.ORGANIZATION_UUID and KEE unique", MakeQualityProfileOrganizationUuidAndKeyUnique.class)
- .add(1607, "Create ORGANIZATION_MEMBERS table", CreateOrganizationMembersTable.class)
- .add(1608, "Populate ORGANIZATION_MEMBERS table", PopulateOrganizationMembersTable.class)
- .add(1609, "Drop unique index on RULES_PROFILES.ORGANIZATION_UUID and KEE", DropUniqueIndexOnQualityProfileOrganizationUuidAndKey.class)
- .add(1610, "Make RULES_PROFILES.KEE unique", MakeQualityProfileKeyUnique.class)
- .add(1611, "Clean LOADED_TEMPLATES rows without type", CleanLoadedTemplateOrphans.class)
- .add(1612, "Extend size of column LOADED_TEMPLATES.TEMPLATE_TYPE", ExtendLoadedTemplateTypeColumn.class)
- .add(1613, "Add index LOADED_TEMPLATES_TYPE", AddIndexLoadedTemplatesType.class)
- .add(1614, "Upgrade loaded template entries for quality profiles", UpgradeQualityTemplateLoadedTemplates.class)
- .add(1615, "Create table RULES_METADATA", CreateRulesMetadata.class)
- .add(1616, "Populate table RULES_METADATA", PopulateRulesMetadata.class)
- .add(1617, "Drop metadata columns from RULES", DropMetadataColumnsFromRules.class)
- // ensure the index is made unique even on existing 6.4-SNAPSHOT instances (such as next or the developer machines)
- .add(1618, "Make index on ORGANIZATIONS.KEE unique", org.sonar.server.platform.db.migration.version.v63.MakeIndexOnOrganizationsKeeUnique.class)
- .add(1619, "Restore 'sonar-users' group", RestoreSonarUsersGroups.class)
- .add(1620, "Delete 'sonar.defaultGroup' setting", DeleteDefaultGroupSetting.class)
- .add(1621, "Set all users into 'sonar-users' group", SetAllUsersIntoSonarUsersGroup.class)
- .add(1622, "Create 'Members' group in each organization", CreateMembersGroupsInEachOrganization.class)
- .add(1623, "Set organization members into 'Members' group", SetOrganizationMembersIntoMembersGroup.class)
- .add(1624, "Add ORGANIZATIONS.DEFAULT_GROUP_ID", AddDefaultGroupIdToOrganizations.class)
- .add(1625, "Populate column ORGANIZATIONS.DEFAULT_GROUP_ID", PopulateColumnDefaultGroupIdOfOrganizations.class)
- .add(1626, "Clean orphan rows in table GROUPS_USERS", CleanOrphanRowsInGroupsUsers.class)
- .add(1627, "Delete permission templates linked to removed users", DeletePermissionTemplatesLinkedToRemovedUsers.class)
- .add(1628, "Add columns CE_QUEUE.WORKER_UUID and EXECUTION_COUNT", AddCeQueueWorkerUuidAndExecutionCount.class)
- .add(1629, "Make CE_QUEUE.EXECUTION_COUNT not nullable", MakeCeQueueExecutionCountNotNullable.class)
- .add(1630, "Add columns CE_ACTIVITY.WORKER_UUID and EXECUTION_COUNT", AddCeActivityWorkerUuidAndExecutionCount.class)
- .add(1631, "Make columns CE_ACTIVITY.EXECUTION_COUNT not nullable", MakeCeActivityExecutionCountNotNullable.class)
- .add(1632, "Make PROJECTS.PROJECT_UUID not nullable", MakeProjectUuidNotNullable.class)
- .add(1633, "Purge rows with null PROJECTS.PROJECT_UUID", PurgeComponentsWithoutProjectUuid.class)
- .add(1634, "Make PROJECTS.PROJECT_UUID not nullable", MakeProjectUuidNotNullable.class)
- .add(1635, "Add column PROJECTS.PRIVATE", AddColumnProjectsPrivate.class)
- .add(1636, "Populate column PROJECTS.PRIVATE", PopulateColumnProjectsPrivate.class)
- .add(1637, "Make column PROJECTS.PRIVATE not nullable", MakeColumnProjectsPrivateNotNullable.class)
- .add(1638, "Add column ORGANIZATIONS.NEW_PROJECT_PRIVATE", AddColumnNewProjectPrivate.class)
- .add(1639, "Set ORGANIZATIONS.NEW_PROJECT_PRIVATE to false", SetNewProjectPrivateToFalse.class)
- .add(1640, "Make column ORGANIZATIONS.NEW_PROJECT_PRIVATE not nullable", MakeColumnNewProjectPrivateNotNullable.class)
- .add(1641, "Make components private based on permissions", MakeComponentsPrivateBasedOnPermissions.class)
- .add(1642, "Support private project in default permission template", SupportPrivateProjectInDefaultPermissionTemplate.class)
- .add(1643, "Drop user and codeviewer perms to AnyOne in permission templates", SupportProjectVisibilityInTemplates.class)
- .add(1644, "Add index on active_rule_parameters.active_rule_id", AddIndexOnActiveRuleParameters.class);
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/DeleteDefaultGroupSetting.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/DeleteDefaultGroupSetting.java
deleted file mode 100644
index 0a2fb77bf54..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/DeleteDefaultGroupSetting.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v64;
-
-import java.sql.SQLException;
-import org.sonar.db.Database;
-import org.sonar.server.platform.db.migration.step.DataChange;
-
-public class DeleteDefaultGroupSetting extends DataChange {
-
- public DeleteDefaultGroupSetting(Database db) {
- super(db);
- }
-
- @Override
- protected void execute(Context context) throws SQLException {
- context.prepareUpsert("DELETE FROM properties WHERE prop_key=?")
- .setString(1, "sonar.defaultGroup")
- .execute().commit();
- }
-
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/DeletePermissionTemplatesLinkedToRemovedUsers.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/DeletePermissionTemplatesLinkedToRemovedUsers.java
deleted file mode 100644
index d43655c50fd..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/DeletePermissionTemplatesLinkedToRemovedUsers.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v64;
-
-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 DeletePermissionTemplatesLinkedToRemovedUsers extends DataChange {
-
- public DeletePermissionTemplatesLinkedToRemovedUsers(Database db) {
- super(db);
- }
-
- @Override
- protected void execute(Context context) throws SQLException {
- MassUpdate massUpdate = context.prepareMassUpdate().rowPluralName("permission templates linked to removed users");
- massUpdate.select("SELECT ptu.id FROM perm_templates_users ptu " +
- "LEFT OUTER JOIN users u ON u.id=ptu.user_id " +
- "WHERE u.id IS NULL or u.active=?")
- .setBoolean(1, false);
- massUpdate.update("DELETE FROM perm_templates_users WHERE id=?");
- massUpdate.execute((row, update) -> {
- update.setLong(1, row.getLong(1));
- return true;
- });
- }
-
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/DropMetadataColumnsFromRules.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/DropMetadataColumnsFromRules.java
deleted file mode 100644
index 2be5834563b..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/DropMetadataColumnsFromRules.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v64;
-
-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 DropMetadataColumnsFromRules extends DdlChange {
-
- private static final String TABLE_RULES = "rules";
-
- public DropMetadataColumnsFromRules(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute(new DropColumnsBuilder(
- getDialect(), TABLE_RULES,
- "note_data", "note_user_login", "note_created_at", "note_updated_at",
- "remediation_function", "remediation_gap_mult", "remediation_base_effort",
- "tags")
- .build());
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/DropUniqueIndexOnQualityProfileKey.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/DropUniqueIndexOnQualityProfileKey.java
deleted file mode 100644
index b525d400c39..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/DropUniqueIndexOnQualityProfileKey.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v64;
-
-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 DropUniqueIndexOnQualityProfileKey extends DdlChange {
-
- public DropUniqueIndexOnQualityProfileKey(Database db) {
- super(db);
- }
-
- @Override
- public void execute(DdlChange.Context context) throws SQLException {
- context.execute(
- new DropIndexBuilder(getDialect())
- .setTable("rules_profiles")
- .setName("uniq_qprof_key")
- .build());
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/DropUniqueIndexOnQualityProfileOrganizationUuidAndKey.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/DropUniqueIndexOnQualityProfileOrganizationUuidAndKey.java
deleted file mode 100644
index d80af3adb8b..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/DropUniqueIndexOnQualityProfileOrganizationUuidAndKey.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v64;
-
-import org.sonar.db.Database;
-import org.sonar.server.platform.db.migration.sql.DropIndexBuilder;
-import org.sonar.server.platform.db.migration.step.DdlChange;
-
-import java.sql.SQLException;
-
-public class DropUniqueIndexOnQualityProfileOrganizationUuidAndKey extends DdlChange {
-
- public DropUniqueIndexOnQualityProfileOrganizationUuidAndKey(Database db) {
- super(db);
- }
-
- @Override
- public void execute(DdlChange.Context context) throws SQLException {
- context.execute(
- new DropIndexBuilder(getDialect())
- .setTable("rules_profiles")
- .setName("uniq_qprof_org_and_key")
- .build());
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/ExtendLoadedTemplateTypeColumn.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/ExtendLoadedTemplateTypeColumn.java
deleted file mode 100644
index b8c5681565f..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/ExtendLoadedTemplateTypeColumn.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v64;
-
-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 ExtendLoadedTemplateTypeColumn extends DdlChange {
- public ExtendLoadedTemplateTypeColumn(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute(
- new AlterColumnsBuilder(getDialect(), "loaded_templates")
- .updateColumn(VarcharColumnDef.newVarcharColumnDefBuilder()
- .setColumnName("template_type")
- .setIsNullable(false)
- .setLimit(64)
- .build())
- .build());
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/MakeCeActivityExecutionCountNotNullable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/MakeCeActivityExecutionCountNotNullable.java
deleted file mode 100644
index 44276346d8a..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/MakeCeActivityExecutionCountNotNullable.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v64;
-
-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.IntegerColumnDef.newIntegerColumnDefBuilder;
-
-public class MakeCeActivityExecutionCountNotNullable extends DdlChange {
-
- private static final String TABLE_CE_ACTIVITY = "ce_activity";
-
- public MakeCeActivityExecutionCountNotNullable(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute("update ce_activity set execution_count = 0 where execution_count is null and status = 'CANCELED'");
- context.execute("update ce_activity set execution_count = 1 where execution_count is null and status in ('SUCCESS', 'FAILED')");
-
- context.execute(new AlterColumnsBuilder(getDialect(), TABLE_CE_ACTIVITY)
- .updateColumn(newIntegerColumnDefBuilder()
- .setColumnName("execution_count")
- .setIsNullable(false)
- .build())
- .build());
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/MakeCeQueueExecutionCountNotNullable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/MakeCeQueueExecutionCountNotNullable.java
deleted file mode 100644
index 4b5608c1c7d..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/MakeCeQueueExecutionCountNotNullable.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v64;
-
-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.IntegerColumnDef.newIntegerColumnDefBuilder;
-
-public class MakeCeQueueExecutionCountNotNullable extends DdlChange {
-
- private static final String TABLE_CE_QUEUE = "ce_queue";
-
- public MakeCeQueueExecutionCountNotNullable(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute("update ce_queue set execution_count = 0 where execution_count is null");
-
- context.execute(new AlterColumnsBuilder(getDialect(), TABLE_CE_QUEUE)
- .updateColumn(newIntegerColumnDefBuilder()
- .setColumnName("execution_count")
- .setIsNullable(false)
- .build())
- .build());
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/MakeColumnNewProjectPrivateNotNullable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/MakeColumnNewProjectPrivateNotNullable.java
deleted file mode 100644
index a78be329f23..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/MakeColumnNewProjectPrivateNotNullable.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v64;
-
-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.BooleanColumnDef.newBooleanColumnDefBuilder;
-
-public class MakeColumnNewProjectPrivateNotNullable extends DdlChange {
- public MakeColumnNewProjectPrivateNotNullable(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute(new AlterColumnsBuilder(getDialect(), "organizations")
- .updateColumn(newBooleanColumnDefBuilder()
- .setColumnName("new_project_private")
- .setIsNullable(false)
- .build())
- .build());
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/MakeColumnProjectsPrivateNotNullable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/MakeColumnProjectsPrivateNotNullable.java
deleted file mode 100644
index f46202d917b..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/MakeColumnProjectsPrivateNotNullable.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v64;
-
-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.BooleanColumnDef.newBooleanColumnDefBuilder;
-
-public class MakeColumnProjectsPrivateNotNullable extends DdlChange {
- public MakeColumnProjectsPrivateNotNullable(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute(new AlterColumnsBuilder(getDialect(), "projects")
- .updateColumn(newBooleanColumnDefBuilder()
- .setColumnName("private")
- .setIsNullable(false)
- .build())
- .build());
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/MakeComponentsPrivateBasedOnPermissions.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/MakeComponentsPrivateBasedOnPermissions.java
deleted file mode 100644
index 994f37bc3bb..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/MakeComponentsPrivateBasedOnPermissions.java
+++ /dev/null
@@ -1,282 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v64;
-
-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.step.Select;
-import org.sonar.server.platform.db.migration.step.SqlStatement;
-
-/**
- * This DB migration assumes the whole PROJECTS table contains only rows with private=false
- * (set by {@link PopulateColumnProjectsPrivate}) and performs the following:
- *
- *
set private=true for any tree of component which root has neither user nor codeviewer permission for group AnyOne
- * but defines at least one permission directly to a group or user
- *
removes any permission to group AnyOne for root components which are made private
- *
ensures any group or user with direct permission to a private root component also has both permissions
- * user and codeviewer
- *
deletes any permission user or codeviewer for root components which stays public
- *
- * This DB migration of course works if PROJECTS table contains rows with private=true, but it will assume they have
- * been set by a previous run of itself (ie. the DB migration is reentrant).
- */
-public class MakeComponentsPrivateBasedOnPermissions extends DataChange {
-
- private static final String SCOPE_PROJECT = "PRJ";
- private static final String QUALIFIER_PROJECT = "TRK";
- private static final String QUALIFIER_VIEW = "VW";
- private static final String PERMISSION_USER = "user";
- private static final String PERMISSION_CODEVIEWER = "codeviewer";
-
- public MakeComponentsPrivateBasedOnPermissions(Database db) {
- super(db);
- }
-
- @Override
- protected void execute(Context context) throws SQLException {
- makePrivateComponent(context);
- cleanPermissionsOfPublicComponents(context);
- insertUserPermissionOfPrivateRootComponent(context, PERMISSION_USER);
- insertUserPermissionOfPrivateRootComponent(context, PERMISSION_CODEVIEWER);
- insertGroupPermissionOfPrivateRootComponent(context, PERMISSION_USER);
- insertGroupPermissionOfPrivateRootComponent(context, PERMISSION_CODEVIEWER);
- }
-
- private static void makePrivateComponent(Context context) throws SQLException {
- MassUpdate massUpdate = context.prepareMassUpdate();
- massUpdate.select("select uuid, id from projects p where " +
- " p.scope = ?" +
- " and p.qualifier in (?, ?)" +
- " and p.private = ?" +
- " and (" +
- " not exists (" +
- " select" +
- " 1" +
- " from group_roles gr" +
- " where " +
- " gr.resource_id = p.id" +
- " and gr.group_id is null" +
- " and gr.role = ?" +
- " ) " +
- " or not exists (" +
- " select" +
- " 1" +
- " from group_roles gr" +
- " where " +
- " gr.resource_id = p.id" +
- " and gr.group_id is null" +
- " and gr.role = ?" +
- " )" +
- " )" +
- // trees with only permissions to group must not be made private
- " and (" +
- " exists (" +
- " select" +
- " 1" +
- " from " +
- " group_roles gr2" +
- " where" +
- " gr2.resource_id = p.id" +
- " and gr2.group_id is not null" +
- " )" +
- " or exists (" +
- " select" +
- " 1" +
- " from " +
- " user_roles ur" +
- " where" +
- " ur.resource_id = p.id" +
- " )" +
- ")")
- .setString(1, SCOPE_PROJECT)
- .setString(2, QUALIFIER_PROJECT)
- .setString(3, QUALIFIER_VIEW)
- .setBoolean(4, false)
- .setString(5, PERMISSION_USER)
- .setString(6, PERMISSION_CODEVIEWER);
- massUpdate.rowPluralName("component trees to be made private");
- // make project private
- massUpdate.update("update projects set private = ? where project_uuid = ?");
- // delete any permission given to group "Anyone"
- massUpdate.update("delete from group_roles where resource_id = ? and group_id is null");
- massUpdate.execute(MakeComponentsPrivateBasedOnPermissions::handleMakePrivateComponent);
- }
-
- private static boolean handleMakePrivateComponent(Select.Row row, SqlStatement update, int updateIndex) throws SQLException {
- String rootUuid = row.getString(1);
- long id = row.getLong(2);
- switch (updateIndex) {
- case 0:
- update.setBoolean(1, true);
- update.setString(2, rootUuid);
- return true;
- case 1:
- update.setLong(1, id);
- return true;
- default:
- throw new IllegalArgumentException("Unsupported update index " + updateIndex);
- }
- }
-
- private static void cleanPermissionsOfPublicComponents(Context context) throws SQLException {
- MassUpdate massUpdate = context.prepareMassUpdate();
- massUpdate.select("select id from projects p where " +
- " p.scope = ?" +
- " and p.qualifier in (?, ?)" +
- " and p.private = ?" +
- " and exists (" +
- " select" +
- " 1" +
- " from group_roles gr" +
- " where " +
- " gr.resource_id = p.id" +
- " and gr.role in (?, ?)" +
- " union" +
- " select" +
- " 1" +
- " from user_roles gr" +
- " where " +
- " gr.resource_id = p.id" +
- " and gr.role in (?, ?)" +
- ")")
- .setString(1, SCOPE_PROJECT)
- .setString(2, QUALIFIER_PROJECT)
- .setString(3, QUALIFIER_VIEW)
- .setBoolean(4, false)
- .setString(5, PERMISSION_USER)
- .setString(6, PERMISSION_CODEVIEWER)
- .setString(7, PERMISSION_USER)
- .setString(8, PERMISSION_CODEVIEWER);
- massUpdate.rowPluralName("public component trees to clean permissions of");
- massUpdate.update("delete from group_roles where resource_id = ? and role in ('user', 'codeviewer')");
- massUpdate.update("delete from user_roles where resource_id = ? and role in ('user', 'codeviewer')");
- massUpdate.execute(MakeComponentsPrivateBasedOnPermissions::handleCleanPermissionsOfPublicComponents);
- }
-
- private static boolean handleCleanPermissionsOfPublicComponents(Select.Row row, SqlStatement update, int updateIndex) throws SQLException {
- long id = row.getLong(1);
- switch (updateIndex) {
- case 0:
- case 1:
- update.setLong(1, id);
- return true;
- default:
- throw new IllegalArgumentException("Unsupported update index " + updateIndex);
- }
- }
-
- private static void insertUserPermissionOfPrivateRootComponent(Context context, String permission) throws SQLException {
- MassUpdate massUpdate = context.prepareMassUpdate();
- massUpdate.select("select" +
- " distinct r1.user_id, p.organization_uuid, p.id" +
- " from" +
- " user_roles r1" +
- " inner join projects p on" +
- " p.id = r1.resource_id" +
- " and p.scope = ?" +
- " and p.qualifier in (?, ?)" +
- " and p.private = ?" +
- " where" +
- " not exists (" +
- " select" +
- " 1" +
- " from" +
- " user_roles r2" +
- " where " +
- " r2.user_id = r1.user_id" +
- " and r2.resource_id = r1.resource_id" +
- " and r2.role = ?" +
- ")")
- .setString(1, SCOPE_PROJECT)
- .setString(2, QUALIFIER_PROJECT)
- .setString(3, QUALIFIER_VIEW)
- .setBoolean(4, true)
- .setString(5, permission);
- massUpdate.rowPluralName("users of private component tree without " + permission + " permission");
- massUpdate.update("insert into user_roles" +
- " (organization_uuid, user_id, resource_id, role)" +
- " values" +
- " (?, ?, ?, ?)");
- massUpdate.execute((row, update) -> insertUserPermission(row, update, permission));
- }
-
- private static boolean insertUserPermission(Select.Row row, SqlStatement update, String permission) throws SQLException {
- int userId = row.getInt(1);
- String organizationUuid = row.getString(2);
- int resourceId = row.getInt(3);
-
- update.setString(1, organizationUuid);
- update.setInt(2, userId);
- update.setInt(3, resourceId);
- update.setString(4, permission);
- return true;
- }
-
- private static void insertGroupPermissionOfPrivateRootComponent(Context context, String permission) throws SQLException {
- MassUpdate massUpdate = context.prepareMassUpdate();
- massUpdate.select("select" +
- " distinct g1.group_id, p.organization_uuid, p.id" +
- " from" +
- " group_roles g1" +
- " inner join projects p on" +
- " p.id = g1.resource_id" +
- " and p.scope = ?" +
- " and p.qualifier in (?, ?)" +
- " and p.private = ?" +
- " where" +
- " g1.group_id is not null" +
- " and not exists (" +
- " select" +
- " 1" +
- " from" +
- " group_roles g2" +
- " where " +
- " g2.group_id = g1.group_id" +
- " and g2.resource_id = g1.resource_id" +
- " and g2.role = ?" +
- ")")
- .setString(1, SCOPE_PROJECT)
- .setString(2, QUALIFIER_PROJECT)
- .setString(3, QUALIFIER_VIEW)
- .setBoolean(4, true)
- .setString(5, permission);
- massUpdate.rowPluralName("groups of private component tree without " + permission + " permission");
- massUpdate.update("insert into group_roles" +
- " (organization_uuid, group_id, resource_id, role)" +
- " values" +
- " (?, ?, ?, ?)");
- massUpdate.execute((row, update) -> insertGroupPermission(row, update, permission));
- }
-
- private static boolean insertGroupPermission(Select.Row row, SqlStatement update, String permission) throws SQLException {
- int groupId = row.getInt(1);
- String organizationUuid = row.getString(2);
- int resourceId = row.getInt(3);
-
- update.setString(1, organizationUuid);
- update.setInt(2, groupId);
- update.setInt(3, resourceId);
- update.setString(4, permission);
- return true;
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/MakeProjectUuidNotNullable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/MakeProjectUuidNotNullable.java
deleted file mode 100644
index 0fb21bb9a90..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/MakeProjectUuidNotNullable.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v64;
-
-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.sql.CreateIndexBuilder;
-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.VarcharColumnDef.newVarcharColumnDefBuilder;
-
-public class MakeProjectUuidNotNullable extends DdlChange {
-
- private static final String TABLE_PROJECTS = "projects";
- private static final String INDEX_PROJECTS_PROJECT_UUID = "projects_project_uuid";
-
- public MakeProjectUuidNotNullable(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- VarcharColumnDef projectUuidCol = newVarcharColumnDefBuilder()
- .setColumnName("project_uuid")
- .setLimit(50)
- .setIsNullable(false)
- .build();
-
- context.execute(new DropIndexBuilder(getDialect())
- .setTable(TABLE_PROJECTS)
- .setName(INDEX_PROJECTS_PROJECT_UUID)
- .build());
-
- context.execute(new AlterColumnsBuilder(getDialect(), TABLE_PROJECTS)
- .updateColumn(projectUuidCol)
- .build());
-
- context.execute(new CreateIndexBuilder()
- .setTable(TABLE_PROJECTS)
- .setName(INDEX_PROJECTS_PROJECT_UUID)
- .setUnique(false).addColumn(projectUuidCol)
- .build());
- }
-
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/MakeQualityProfileKeyUnique.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/MakeQualityProfileKeyUnique.java
deleted file mode 100644
index 3d791a406d8..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/MakeQualityProfileKeyUnique.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v64;
-
-import org.sonar.db.Database;
-import org.sonar.server.platform.db.migration.sql.CreateIndexBuilder;
-import org.sonar.server.platform.db.migration.step.DdlChange;
-
-import java.sql.SQLException;
-
-import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder;
-
-public class MakeQualityProfileKeyUnique extends DdlChange {
-
- public MakeQualityProfileKeyUnique(Database db) {
- super(db);
- }
-
- @Override
- public void execute(DdlChange.Context context) throws SQLException {
- context.execute(
- new CreateIndexBuilder()
- .setTable("rules_profiles")
- .setName("uniq_qprof_key")
- .addColumn(
- newVarcharColumnDefBuilder()
- .setColumnName("kee")
- .setLimit(255)
- .build())
- .setUnique(true)
- .build());
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/MakeQualityProfileOrganizationUuidAndKeyUnique.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/MakeQualityProfileOrganizationUuidAndKeyUnique.java
deleted file mode 100644
index 96e0d7f6883..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/MakeQualityProfileOrganizationUuidAndKeyUnique.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v64;
-
-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;
-
-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 MakeQualityProfileOrganizationUuidAndKeyUnique extends DdlChange {
-
- public MakeQualityProfileOrganizationUuidAndKeyUnique(Database db) {
- super(db);
- }
-
- @Override
- public void execute(DdlChange.Context context) throws SQLException {
- context.execute(
- new CreateIndexBuilder()
- .setTable("rules_profiles")
- .setName("uniq_qprof_org_and_key")
- .addColumn(
- newVarcharColumnDefBuilder()
- .setColumnName("organization_uuid")
- .setLimit(UUID_SIZE)
- .build())
- .addColumn(
- newVarcharColumnDefBuilder()
- .setColumnName("kee")
- .setLimit(255)
- .build())
- .setUnique(true)
- .build());
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/MakeQualityProfileOrganizationUuidNotNullable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/MakeQualityProfileOrganizationUuidNotNullable.java
deleted file mode 100644
index 5771f423301..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/MakeQualityProfileOrganizationUuidNotNullable.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v64;
-
-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.UUID_SIZE;
-import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder;
-
-public class MakeQualityProfileOrganizationUuidNotNullable extends DdlChange {
-
- public MakeQualityProfileOrganizationUuidNotNullable(Database db) {
- super(db);
- }
-
- @Override
- public void execute(DdlChange.Context context) throws SQLException {
- context.execute(
- new AlterColumnsBuilder(getDatabase().getDialect(), "rules_profiles")
- .updateColumn(newVarcharColumnDefBuilder()
- .setColumnName("organization_uuid")
- .setLimit(UUID_SIZE)
- .setIsNullable(false)
- .build())
- .build());
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/PopulateColumnDefaultGroupIdOfOrganizations.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/PopulateColumnDefaultGroupIdOfOrganizations.java
deleted file mode 100644
index a4b24a66885..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/PopulateColumnDefaultGroupIdOfOrganizations.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v64;
-
-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 PopulateColumnDefaultGroupIdOfOrganizations extends DataChange {
-
- private final System2 system2;
-
- public PopulateColumnDefaultGroupIdOfOrganizations(Database db, System2 system2) {
- super(db);
- this.system2 = system2;
- }
-
- @Override
- protected void execute(Context context) throws SQLException {
- populateDefaultGroupId(context, isOrganizationEnabled(context) ? "Members" : "sonar-users");
- }
-
- private void populateDefaultGroupId(Context context, String groupName) throws SQLException {
- MassUpdate massUpdate = context.prepareMassUpdate().rowPluralName("organizations");
- massUpdate.select("SELECT o.uuid, g.id FROM organizations o " +
- "INNER JOIN groups g ON g.organization_uuid=o.uuid AND g.name=? " +
- "WHERE o.default_group_id IS NULL")
- .setString(1, groupName);
- massUpdate.update("UPDATE organizations SET default_group_id=?,updated_at=? WHERE uuid=?");
- massUpdate.execute((row, update) -> {
- update.setLong(1, row.getLong(2));
- update.setLong(2, system2.now());
- update.setString(3, row.getString(1));
- return true;
- });
- }
-
- private static boolean isOrganizationEnabled(Context context) throws SQLException {
- Boolean result = context.prepareSelect("SELECT text_value FROM internal_properties WHERE kee=?")
- .setString(1, "organization.enabled")
- .get(row -> "true".equals(row.getString(1)));
- return result != null ? result : false;
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/PopulateColumnProjectsPrivate.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/PopulateColumnProjectsPrivate.java
deleted file mode 100644
index 785cf9f1d27..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/PopulateColumnProjectsPrivate.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v64;
-
-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.step.Select;
-import org.sonar.server.platform.db.migration.step.SqlStatement;
-
-public class PopulateColumnProjectsPrivate extends DataChange {
- public PopulateColumnProjectsPrivate(Database db) {
- super(db);
- }
-
- @Override
- protected void execute(Context context) throws SQLException {
- MassUpdate massUpdate = context.prepareMassUpdate();
- massUpdate.select("select distinct root_uuid from projects where private is null");
- massUpdate.update("update projects set private = ? where root_uuid = ?");
- massUpdate.rowPluralName("component tree without private flag");
- massUpdate.execute(PopulateColumnProjectsPrivate::handle);
- }
-
- private static boolean handle(Select.Row row, SqlStatement update) throws SQLException {
- String rootUuid = row.getString(1);
-
- update.setBoolean(1, false);
- update.setString(2, rootUuid);
-
- return true;
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/PopulateOrganizationMembersTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/PopulateOrganizationMembersTable.java
deleted file mode 100644
index 58150227f09..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/PopulateOrganizationMembersTable.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v64;
-
-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.v63.DefaultOrganizationUuidProvider;
-
-public class PopulateOrganizationMembersTable extends DataChange {
-
- private static final String INSERT_ORGANIZATION_MEMBERS_SQL = "INSERT INTO organization_members (user_id, organization_uuid) VALUES (?, ?)";
-
- private final DefaultOrganizationUuidProvider defaultOrganizationUuid;
-
- public PopulateOrganizationMembersTable(Database db, DefaultOrganizationUuidProvider defaultOrganizationUuid) {
- super(db);
- this.defaultOrganizationUuid = defaultOrganizationUuid;
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- associateUsersToDefaultOrganization(context);
- associateUsersToOrganizationBasedOnPermission(context);
- }
-
- private void associateUsersToDefaultOrganization(Context context) throws SQLException {
- String organizationUuid = defaultOrganizationUuid.getAndCheck(context);
- MassUpdate massUpdate = context.prepareMassUpdate().rowPluralName("default organization members");
- massUpdate.select(
- "SELECT u.id FROM users u " +
- "WHERE u.active=? AND " +
- "NOT EXISTS (SELECT 1 FROM organization_members om WHERE om.user_id=u.id AND om.organization_uuid=?) ")
- .setBoolean(1, true)
- .setString(2, organizationUuid);
- massUpdate.update(INSERT_ORGANIZATION_MEMBERS_SQL);
- massUpdate.execute((row, update) -> {
- update.setInt(1, row.getInt(1));
- update.setString(2, organizationUuid);
- return true;
- });
- }
-
- private static void associateUsersToOrganizationBasedOnPermission(Context context) throws SQLException {
- MassUpdate massUpdate = context.prepareMassUpdate().rowPluralName("non default organization members");
- massUpdate.select(
- "SELECT distinct ur.organization_uuid, ur.user_id FROM user_roles ur " +
- "INNER JOIN users u ON u.id=ur.user_id AND u.active=? " +
- "WHERE NOT EXISTS (SELECT 1 FROM organization_members om WHERE om.user_id=ur.user_id AND om.organization_uuid=ur.organization_uuid) " +
- "UNION " +
- "SELECT distinct g.organization_uuid, gu.user_id FROM groups_users gu " +
- "INNER JOIN users u ON u.id=gu.user_id AND u.active=? " +
- "INNER JOIN groups g ON g.id=gu.group_id " +
- "WHERE NOT EXISTS (SELECT 1 FROM organization_members om WHERE om.user_id=gu.user_id AND om.organization_uuid=g.organization_uuid)")
- .setBoolean(1, true)
- .setBoolean(2, true);
- massUpdate.update(INSERT_ORGANIZATION_MEMBERS_SQL);
- massUpdate.execute((row, update) -> {
- update.setInt(1, row.getInt(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/v64/PopulateRulesMetadata.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/PopulateRulesMetadata.java
deleted file mode 100644
index 7f933869e0a..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/PopulateRulesMetadata.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v64;
-
-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.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.version.v63.DefaultOrganizationUuidProvider;
-
-import static java.util.Optional.ofNullable;
-
-public class PopulateRulesMetadata extends DataChange {
- private final DefaultOrganizationUuidProvider defaultOrganizationUuid;
- private final System2 system2;
-
- public PopulateRulesMetadata(Database db, DefaultOrganizationUuidProvider defaultOrganizationUuid, System2 system2) {
- super(db);
- this.defaultOrganizationUuid = defaultOrganizationUuid;
- this.system2 = system2;
- }
-
- @Override
- protected void execute(Context context) throws SQLException {
- String defaultOrganizationUuid = this.defaultOrganizationUuid.getAndCheck(context);
-
- MassUpdate massUpdate = context.prepareMassUpdate();
- massUpdate.select("select" +
- " id," +
- " note_data," +
- " note_user_login," +
- " note_created_at," +
- " note_updated_at," +
- " remediation_function," +
- " remediation_gap_mult," +
- " remediation_base_effort," +
- " tags," +
- " created_at," +
- " updated_at" +
- " from" +
- " rules r" +
- " where" +
- " not exists (select 1 from rules_metadata rm where rm.rule_id = r.id)");
- massUpdate.rowPluralName("rules metadata");
- massUpdate.update("insert into rules_metadata" +
- " (" +
- " rule_id," +
- " organization_uuid," +
- " note_data," +
- " note_user_login," +
- " note_created_at," +
- " note_updated_at," +
- " remediation_function," +
- " remediation_gap_mult," +
- " remediation_base_effort," +
- " tags," +
- " created_at," +
- " updated_at" +
- ")" +
- "values" +
- "(" +
- " ?," +
- " ?," +
- " ?," +
- " ?," +
- " ?," +
- " ?," +
- " ?," +
- " ?," +
- " ?," +
- " ?," +
- " ?," +
- " ?" +
- ")");
- massUpdate.execute((row, update) -> handle(defaultOrganizationUuid, row, update));
- }
-
- private boolean handle(String defaultOrganizationUuid, Select.Row row, SqlStatement update) throws SQLException {
- long now = system2.now();
- int ruleId = row.getInt(1);
- String noteData = row.getNullableString(2);
- String noteUserLogin = row.getNullableString(3);
- Date noteCreatedAt = row.getNullableDate(4);
- Date noteUpdatedAt = row.getNullableDate(5);
- String remediationFunction = row.getNullableString(6);
- String remediationGapMultiplier = row.getNullableString(7);
- String remediationBaseEffort = row.getNullableString(8);
- String tags = row.getNullableString(9);
- Long createdAt = row.getNullableLong(10);
- Long updatedAt = row.getNullableLong(11);
-
- update
- .setInt(1, ruleId)
- .setString(2, defaultOrganizationUuid)
- .setString(3, noteData)
- .setString(4, noteUserLogin)
- .setLong(5, ofNullable(noteCreatedAt).map(Date::getTime).orElse(null))
- .setLong(6, ofNullable(noteUpdatedAt).map(Date::getTime).orElse(null))
- .setString(7, remediationFunction)
- .setString(8, remediationGapMultiplier)
- .setString(9, remediationBaseEffort)
- .setString(10, tags)
- .setLong(11, ofNullable(createdAt).orElse(now))
- .setLong(12, ofNullable(updatedAt).orElse(now));
- return true;
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/PurgeComponentsWithoutProjectUuid.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/PurgeComponentsWithoutProjectUuid.java
deleted file mode 100644
index f3e9c8d6836..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/PurgeComponentsWithoutProjectUuid.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v64;
-
-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 PurgeComponentsWithoutProjectUuid extends DataChange {
- public PurgeComponentsWithoutProjectUuid(Database db) {
- super(db);
- }
-
- @Override
- protected void execute(Context context) throws SQLException {
- MassUpdate massUpdate = context.prepareMassUpdate();
- massUpdate.select("select id,uuid from projects where project_uuid is null");
- massUpdate.rowPluralName("rows in projects without project_uuid");
- massUpdate.update("delete from duplications_index where analysis_uuid in (select uuid from snapshots where component_uuid=?)");
- massUpdate.update("delete from project_measures where component_uuid=?");
- massUpdate.update("delete from ce_activity where component_uuid=?");
- massUpdate.update("delete from events where component_uuid=?");
- massUpdate.update("delete from events where analysis_uuid in (select uuid from snapshots where component_uuid=?)");
- massUpdate.update("delete from project_links where component_uuid=?");
- massUpdate.update("delete from snapshots where component_uuid=?");
- massUpdate.update("delete from issues where component_uuid=? or project_uuid=?");
- massUpdate.update("delete from file_sources where file_uuid=? or project_uuid=?");
- massUpdate.update("delete from group_roles where resource_id=?");
- massUpdate.update("delete from user_roles where resource_id=?");
- massUpdate.update("delete from properties where resource_id=?");
- massUpdate.update("delete from projects where uuid=?");
- massUpdate.execute((row, update, updateIndex) -> {
- long componentId = row.getLong(1);
- String componentUuid = row.getString(2);
- switch (updateIndex) {
- case 0:
- case 1:
- case 2:
- case 3:
- case 4:
- case 5:
- case 6:
- update.setString(1, componentUuid);
- return true;
- case 7:
- case 8:
- update.setString(1, componentUuid);
- update.setString(2, componentUuid);
- return true;
- case 9:
- case 10:
- case 11:
- update.setLong(1, componentId);
- return true;
- case 12:
- update.setString(1, componentUuid);
- return true;
- default:
- throw new IllegalArgumentException("Unsupported update index " + updateIndex);
- }
- });
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/RestoreSonarUsersGroups.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/RestoreSonarUsersGroups.java
deleted file mode 100644
index 9e73731efa3..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/RestoreSonarUsersGroups.java
+++ /dev/null
@@ -1,211 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v64;
-
-import java.sql.SQLException;
-import java.util.Date;
-import javax.annotation.CheckForNull;
-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.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.version.v63.DefaultOrganizationUuidProvider;
-
-import static com.google.common.base.Preconditions.checkState;
-import static java.lang.String.format;
-import static java.util.Objects.requireNonNull;
-
-/**
- * If sonar-users doesn't exist, create it and copy permissions from existing default group
- * If it already exists, only update description if it's the wrong one
- */
-public class RestoreSonarUsersGroups extends DataChange {
-
- private static final Logger LOG = Loggers.get(RestoreSonarUsersGroups.class);
-
- private static final String SONAR_USERS_NAME = "sonar-users";
- private static final String SONAR_USERS_PENDING_DESCRIPTION = "";
- private static final String SONAR_USERS_FINAL_DESCRIPTION = "Any new users created will automatically join this group";
- private static final String DEFAULT_GROUP_SETTING = "sonar.defaultGroup";
-
- private final System2 system2;
- private final DefaultOrganizationUuidProvider defaultOrganizationUuid;
-
- public RestoreSonarUsersGroups(Database db, System2 system2, DefaultOrganizationUuidProvider defaultOrganizationUuid) {
- super(db);
- this.system2 = system2;
- this.defaultOrganizationUuid = defaultOrganizationUuid;
- }
-
- @Override
- protected void execute(Context context) throws SQLException {
- Date now = new Date(system2.now());
- Group sonarUsersGroup = selectSonarUsersGroup(context);
- Group defaultGroup = searchDefaultGroup(context);
- if (sonarUsersGroup == null) {
- createSonarUsersGroupAndCopyPermissionsFromDefaultGroup(context, defaultGroup, now);
- displayWarnLog(defaultGroup);
- } else {
- if (SONAR_USERS_PENDING_DESCRIPTION.equals(sonarUsersGroup.getDescription())) {
- copyAllPermissionsFromDefaultGroupToSonarUsers(context, sonarUsersGroup, defaultGroup, now);
- } else if (!SONAR_USERS_FINAL_DESCRIPTION.equals(sonarUsersGroup.getDescription())) {
- updateSonarUsersGroupDescription(context, SONAR_USERS_FINAL_DESCRIPTION, sonarUsersGroup.getId(), now);
- }
- if (sonarUsersGroup.getId() != defaultGroup.getId()) {
- displayWarnLog(defaultGroup);
- }
- }
- }
-
- private void createSonarUsersGroupAndCopyPermissionsFromDefaultGroup(Context context, Group defaultGroup, Date now) throws SQLException {
- insertSonarUsersGroupWithPendingDescription(context, defaultOrganizationUuid.get(context), now);
- Group sonarUsersGroupId = requireNonNull(selectSonarUsersGroup(context), format("Creation of '%s' group has failed", SONAR_USERS_NAME));
- copyAllPermissionsFromDefaultGroupToSonarUsers(context, sonarUsersGroupId, defaultGroup, now);
- }
-
- private static void copyAllPermissionsFromDefaultGroupToSonarUsers(Context context, Group sonarUsersGroup, Group defaultGroupId, Date now) throws SQLException {
- copyGlobalAndProjectPermissionsFromDefaultGroupToSonarUsers(context, defaultGroupId, sonarUsersGroup);
- copyPermissionTemplatesFromDefaultGroupToSonarUsers(context, defaultGroupId, sonarUsersGroup, now);
- updateSonarUsersGroupDescription(context, SONAR_USERS_FINAL_DESCRIPTION, sonarUsersGroup.getId(), now);
- }
-
- private static void copyGlobalAndProjectPermissionsFromDefaultGroupToSonarUsers(Context context, Group defaultGroupId, Group sonarUsersGroupId) throws SQLException {
- MassUpdate massUpdate = context.prepareMassUpdate().rowPluralName("global and project permissions");
- massUpdate.select("SELECT gr.resource_id, gr.role, gr.organization_uuid FROM group_roles gr " +
- "WHERE gr.group_id=? AND NOT EXISTS " +
- "(SELECT 1 FROM group_roles gr2 WHERE gr2.resource_id=gr.resource_id AND gr2.role=gr.role AND gr2.organization_uuid=gr.organization_uuid AND gr2.group_id=?)")
- .setLong(1, defaultGroupId.getId())
- .setLong(2, sonarUsersGroupId.getId());
- massUpdate.update("INSERT INTO group_roles (group_id, resource_id, role, organization_uuid) values (?, ?, ?, ?)");
- massUpdate.execute((row, update) -> {
- update.setLong(1, sonarUsersGroupId.getId());
- update.setLong(2, row.getNullableLong(1));
- update.setString(3, row.getString(2));
- update.setString(4, row.getString(3));
- return true;
- });
- }
-
- private static void copyPermissionTemplatesFromDefaultGroupToSonarUsers(Context context, Group defaultGroupId, Group sonarUsersGroupId, Date now) throws SQLException {
- MassUpdate massUpdate = context.prepareMassUpdate().rowPluralName("permission templates");
- massUpdate.select("SELECT ptg.template_id, ptg.permission_reference FROM perm_templates_groups ptg " +
- "WHERE ptg.group_id=? AND NOT EXISTS " +
- "(SELECT 1 FROM perm_templates_groups ptg2 WHERE ptg2.template_id=ptg.template_id AND ptg2.permission_reference=ptg.permission_reference AND ptg2.group_id=?)")
- .setLong(1, defaultGroupId.getId())
- .setLong(2, sonarUsersGroupId.getId());
- massUpdate.update("INSERT INTO perm_templates_groups (group_id, template_id, permission_reference, created_at, updated_at) values (?, ?, ?, ?, ?)");
- massUpdate.execute((row, update) -> {
- update
- .setLong(1, sonarUsersGroupId.getId())
- .setLong(2, row.getLong(1))
- .setString(3, row.getString(2))
- .setDate(4, now)
- .setDate(5, now);
- return true;
- });
- }
-
- private static void insertSonarUsersGroupWithPendingDescription(Context context, String organizationUuid, Date now) throws SQLException {
- context.prepareUpsert("INSERT into groups (name, description, organization_uuid, created_at, updated_at) values (?, ?, ?, ?, ?)")
- .setString(1, SONAR_USERS_NAME)
- .setString(2, SONAR_USERS_PENDING_DESCRIPTION)
- .setString(3, organizationUuid)
- .setDate(4, now)
- .setDate(5, now)
- .execute()
- .commit();
- }
-
- private static void updateSonarUsersGroupDescription(Context context, String description, long sonarUsersGroupId, Date now) throws SQLException {
- context.prepareUpsert("UPDATE groups SET description=?, updated_at=? WHERE id=?")
- .setString(1, description)
- .setDate(2, now)
- .setLong(3, sonarUsersGroupId)
- .execute()
- .commit();
- }
-
- private static Group searchDefaultGroup(Context context) throws SQLException {
- String defaultGroupName = selectDefaultGroupNameFromProperties(context);
- if (defaultGroupName == null) {
- Group sonarUsersGroup = selectSonarUsersGroup(context);
- checkState(sonarUsersGroup != null, "Default group setting %s is defined to a 'sonar-users' group but it doesn't exist.", DEFAULT_GROUP_SETTING);
- return sonarUsersGroup;
- }
- Group defaultGroup = selectGroupByName(context, defaultGroupName);
- checkState(defaultGroup != null, "Default group setting %s is defined to an unknown group.", DEFAULT_GROUP_SETTING);
- return defaultGroup;
- }
-
- @CheckForNull
- private static Group selectSonarUsersGroup(Context context) throws SQLException {
- return selectGroupByName(context, SONAR_USERS_NAME);
- }
-
- @CheckForNull
- private static String selectDefaultGroupNameFromProperties(Context context) throws SQLException {
- return context.prepareSelect("SELECT is_empty,text_value FROM properties WHERE prop_key=? AND is_empty=?")
- .setString(1, DEFAULT_GROUP_SETTING)
- .setBoolean(2, false)
- .get(row -> {
- boolean isEmpty = row.getBoolean(1);
- return isEmpty ? null : row.getString(2);
- });
- }
-
- @CheckForNull
- private static Group selectGroupByName(Context context, String name) throws SQLException {
- return context.prepareSelect("SELECT id, name, description FROM groups WHERE name=?")
- .setString(1, name)
- .get(Group::new);
- }
-
- private static void displayWarnLog(Group defaultGroup) {
- LOG.warn("The default group has been updated from '{}' to '{}'. Please verify your permission schema that everything is in order",
- defaultGroup.getName(), SONAR_USERS_NAME);
- }
-
- private static class Group {
- private final long id;
- private final String name;
- private final String description;
-
- Group(Select.Row row) throws SQLException {
- this.id = row.getLong(1);
- this.name = row.getString(2);
- this.description = row.getString(3);
- }
-
- long getId() {
- return id;
- }
-
- String getName() {
- return name;
- }
-
- public String getDescription() {
- return description;
- }
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/SetAllUsersIntoSonarUsersGroup.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/SetAllUsersIntoSonarUsersGroup.java
deleted file mode 100644
index afe1bc5a517..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/SetAllUsersIntoSonarUsersGroup.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v64;
-
-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 SetAllUsersIntoSonarUsersGroup extends DataChange {
-
- public SetAllUsersIntoSonarUsersGroup(Database db) {
- super(db);
- }
-
- @Override
- protected void execute(Context context) throws SQLException {
- long sonarUsersGroupId = selectSonarUsersGroup(context);
- MassUpdate massUpdate = context.prepareMassUpdate().rowPluralName("users");
- massUpdate.select("SELECT u.id FROM users u " +
- "WHERE u.active=? AND NOT EXISTS " +
- "(SELECT 1 FROM groups_users gu WHERE gu.user_id=u.id AND gu.group_id=?)")
- .setBoolean(1, true)
- .setLong(2, sonarUsersGroupId);
- massUpdate.update("INSERT INTO groups_users (user_id, group_id) values (?, ?)");
- massUpdate.execute((row, update) -> {
- update.setLong(1, row.getLong(1));
- update.setLong(2, sonarUsersGroupId);
- return true;
- });
- }
-
- private static long selectSonarUsersGroup(Context context) throws SQLException {
- return context.prepareSelect("SELECT id FROM groups WHERE name=?")
- .setString(1, "sonar-users")
- .get(row -> row.getLong(1));
- }
-
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/SetCopyComponentUuidOnLocalViews.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/SetCopyComponentUuidOnLocalViews.java
deleted file mode 100644
index b3e235dd040..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/SetCopyComponentUuidOnLocalViews.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v64;
-
-import java.sql.SQLException;
-import java.util.HashMap;
-import java.util.Map;
-import org.sonar.db.Database;
-import org.sonar.server.platform.db.migration.step.DataChange;
-import org.sonar.server.platform.db.migration.step.MassUpdate;
-
-/**
- * Set PROJECTS#COPY_COMPONENT_UUID on local views.
- *
- * Here's how local sub views are detected :
- *
- *
Load all root views
- *
Load all sub views not having COPY_COMPONENT_UUID set
- *
Extract last part of the sub view key and if it matches a root view key then set the COPY_COMPONENT_UUID to the matching root view uuid
- *
- */
-public class SetCopyComponentUuidOnLocalViews extends DataChange {
-
- private static final String QUALIFIER_SUB_VIEW = "SVW";
- private static final String QUALIFIER_VIEW = "VW";
- private static final String SCOPE_PROJECT = "PRJ";
-
- public SetCopyComponentUuidOnLocalViews(Database db) {
- super(db);
- }
-
- @Override
- protected void execute(Context context) throws SQLException {
- Map rootUuidsByKeys = selectRootUuidsByKeys(context);
-
- MassUpdate massUpdate = context.prepareMassUpdate();
- massUpdate.select("SELECT p.kee, p.uuid FROM projects p " +
- "WHERE p.qualifier = ? " +
- "AND p.scope = ? " +
- "AND p.copy_component_uuid IS NULL " +
- "AND p.enabled = ? ")
- .setString(1, QUALIFIER_SUB_VIEW)
- .setString(2, SCOPE_PROJECT)
- .setBoolean(3, true);
-
- massUpdate.update("UPDATE projects set " +
- "copy_component_uuid=? " +
- "WHERE uuid=?");
- massUpdate.execute((row, update) -> {
- String subViewKey = row.getString(1);
- int lastViewKeyIndex = subViewKey.lastIndexOf(':');
- if (lastViewKeyIndex < 0) {
- return false;
- }
- String possibleRootViewUuid = subViewKey.substring(lastViewKeyIndex + 1);
- String rootUuid = rootUuidsByKeys.get(possibleRootViewUuid);
- if (rootUuid == null) {
- return false;
- }
- update.setString(1, rootUuid);
- update.setString(2, row.getString(2));
- return true;
- });
- }
-
- private static Map selectRootUuidsByKeys(Context context) throws SQLException {
- Map rootUuids = new HashMap<>();
- context.prepareSelect("SELECT p.kee, p.uuid FROM projects p " +
- "WHERE p.qualifier = ? " +
- "AND p.scope = ? " +
- "AND p.enabled = ? ")
- .setString(1, QUALIFIER_VIEW)
- .setString(2, SCOPE_PROJECT)
- .setBoolean(3, true)
- .scroll(row -> {
- String key = row.getString(1);
- String uuid = row.getString(2);
- rootUuids.put(key, uuid);
- });
- return rootUuids;
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/SetNewProjectPrivateToFalse.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/SetNewProjectPrivateToFalse.java
deleted file mode 100644
index b2c78eff6b9..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/SetNewProjectPrivateToFalse.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v64;
-
-import java.sql.SQLException;
-import org.sonar.db.Database;
-import org.sonar.server.platform.db.migration.step.DataChange;
-
-public class SetNewProjectPrivateToFalse extends DataChange {
- public SetNewProjectPrivateToFalse(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.prepareUpsert("update organizations set new_project_private=?")
- .setBoolean(1, false)
- .execute()
- .commit();
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/SetOrganizationMembersIntoMembersGroup.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/SetOrganizationMembersIntoMembersGroup.java
deleted file mode 100644
index ccdfef403f8..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/SetOrganizationMembersIntoMembersGroup.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v64;
-
-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 SetOrganizationMembersIntoMembersGroup extends DataChange {
-
- private static final String MEMBERS_NAME = "Members";
-
- public SetOrganizationMembersIntoMembersGroup(Database db) {
- super(db);
- }
-
- @Override
- protected void execute(Context context) throws SQLException {
- MassUpdate massUpdate = context.prepareMassUpdate().rowPluralName("users not belonging to 'members' group");
- massUpdate.select("SELECT u.id, g.id FROM users u " +
- "INNER JOIN organization_members om ON om.user_id=u.id " +
- "INNER JOIN groups g ON g.organization_uuid=om.organization_uuid AND g.name=? " +
- "WHERE u.active=? AND NOT EXISTS " +
- "(SELECT 1 FROM groups_users gu " +
- "INNER JOIN groups g on g.id=gu.group_id AND g.name=? " +
- "WHERE gu.user_id=u.id)")
- .setString(1, MEMBERS_NAME)
- .setBoolean(2, true)
- .setString(3, MEMBERS_NAME);
- massUpdate.update("INSERT INTO groups_users (user_id, group_id) values (?, ?)");
- massUpdate.execute((row, update) -> {
- update.setLong(1, row.getLong(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/v64/SetQualityProfileOrganizationUuidToDefault.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/SetQualityProfileOrganizationUuidToDefault.java
deleted file mode 100644
index ff8b7ef084f..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/SetQualityProfileOrganizationUuidToDefault.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v64;
-
-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.version.v63.DefaultOrganizationUuidProvider;
-
-public class SetQualityProfileOrganizationUuidToDefault extends DataChange {
-
- private final DefaultOrganizationUuidProvider defaultOrganizationUuid;
-
- public SetQualityProfileOrganizationUuidToDefault(Database db, DefaultOrganizationUuidProvider defaultOrganizationUuid) {
- super(db);
- this.defaultOrganizationUuid = defaultOrganizationUuid;
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.prepareUpsert("update rules_profiles set organization_uuid=? where organization_uuid is null")
- .setString(1, defaultOrganizationUuid.get(context))
- .execute()
- .commit();
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/SupportPrivateProjectInDefaultPermissionTemplate.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/SupportPrivateProjectInDefaultPermissionTemplate.java
deleted file mode 100644
index 8955dc6433e..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/SupportPrivateProjectInDefaultPermissionTemplate.java
+++ /dev/null
@@ -1,188 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v64;
-
-import java.sql.SQLException;
-import java.util.Arrays;
-import java.util.Date;
-import java.util.List;
-import javax.annotation.CheckForNull;
-import javax.annotation.Nullable;
-import org.sonar.api.utils.log.Loggers;
-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.version.v63.DefaultOrganizationUuidProvider;
-
-import static com.google.common.base.Preconditions.checkState;
-
-public class SupportPrivateProjectInDefaultPermissionTemplate extends DataChange {
- private static final String PERMISSION_USER = "user";
- private static final String PERMISSION_CODEVIEWER = "codeviewer";
-
- private DefaultOrganizationUuidProvider defaultOrganizationUuidProvider;
-
- public SupportPrivateProjectInDefaultPermissionTemplate(Database db, DefaultOrganizationUuidProvider defaultOrganizationUuidProvider) {
- super(db);
- this.defaultOrganizationUuidProvider = defaultOrganizationUuidProvider;
- }
-
- @Override
- protected void execute(Context context) throws SQLException {
- String defaultOrganizationUuid = this.defaultOrganizationUuidProvider.get(context);
-
- ResolvedOrganizationProperties organizationProperties = readOrganizationProperties(context, defaultOrganizationUuid);
-
- int defaultGroupId = organizationProperties.defaultGroupId;
- for (Integer groupId : Arrays.asList(organizationProperties.getProjectId(), organizationProperties.getViewId())) {
- if (groupId != null) {
- insertGroupPermissionIfNotPresent(context, defaultGroupId, groupId, PERMISSION_USER);
- insertGroupPermissionIfNotPresent(context, defaultGroupId, groupId, PERMISSION_CODEVIEWER);
- }
- }
- }
-
- private static void insertGroupPermissionIfNotPresent(Context context, int groupId, int templateId, String permission) throws SQLException {
- if (!groupHasPermissionInTemplate(context, templateId, groupId, permission)) {
- insertGroupPermission(context, templateId, groupId, permission);
- }
- }
-
- private static boolean groupHasPermissionInTemplate(Context context, int templateId, int groupId, String permission) throws SQLException {
- List rows = context.prepareSelect("select 1 from perm_templates_groups where" +
- " template_id = ?" +
- " and group_id=?" +
- " and permission_reference=?")
- .setInt(1, templateId)
- .setInt(2, groupId)
- .setString(3, permission)
- .list(row -> row.getInt(1));
- return !rows.isEmpty();
- }
-
- private static void insertGroupPermission(Context context, int templateId, int groupId, String permission) throws SQLException {
- Date now = new Date();
- context.prepareUpsert("insert into perm_templates_groups (group_id, template_id, permission_reference, created_at, updated_at) values (?,?,?,?,?)")
- .setInt(1, groupId)
- .setInt(2, templateId)
- .setString(3, permission)
- .setDate(4, now)
- .setDate(5, now)
- .execute()
- .commit();
- }
-
- private static ResolvedOrganizationProperties readOrganizationProperties(Context context, String defaultOrganizationUuid) throws SQLException {
- Select select = context.prepareSelect("select default_group_id, default_perm_template_project, default_perm_template_view from organizations where uuid=?")
- .setString(1, defaultOrganizationUuid);
- List rows = select
- .list(row -> new OrganizationProperties(row.getNullableInt(1), row.getNullableString(2), row.getNullableString(3)));
- checkState(!rows.isEmpty(), "Default organization with uuid '%s' does not exist in table ORGANIZATIONS", defaultOrganizationUuid);
- OrganizationProperties rawProperties = rows.iterator().next();
- checkState(rawProperties.defaultGroupId != null, "No default group id is defined for default organization (uuid=%s)", defaultOrganizationUuid);
- checkState(rawProperties.projectUuid != null || rawProperties.viewUuid == null,
- "Inconsistent state for default organization (uuid=%s): no project default template is defined but view default template is", defaultOrganizationUuid);
- Integer projectTemplateId = getPermTemplateId(context, rawProperties.projectUuid);
- Integer viewTemplateId = getViewTemplateIdOrClearReference(context, rawProperties.viewUuid, defaultOrganizationUuid);
- return new ResolvedOrganizationProperties(
- rawProperties.defaultGroupId,
- projectTemplateId,
- viewTemplateId);
- }
-
- @CheckForNull
- private static Integer getPermTemplateId(Context context, @Nullable String permissionTemplateUuid) throws SQLException {
- if (permissionTemplateUuid == null) {
- return null;
- }
- List ids = getTemplateIds(context, permissionTemplateUuid);
- checkState(!ids.isEmpty(), "Permission template with uuid %s not found", permissionTemplateUuid);
- checkState(ids.size() == 1, "Multiple permission templates found with uuid %s", permissionTemplateUuid);
- return ids.iterator().next();
- }
-
- @CheckForNull
- private static Integer getViewTemplateIdOrClearReference(Context context, @Nullable String permissionTemplateUuid,
- String defaultOrganizationUuid) throws SQLException {
- if (permissionTemplateUuid == null) {
- return null;
- }
- List ids = getTemplateIds(context, permissionTemplateUuid);
- if (ids.isEmpty()) {
- clearViewTemplateReference(context, defaultOrganizationUuid);
- return null;
- }
- checkState(ids.size() == 1, "Multiple permission templates found with uuid %s", permissionTemplateUuid);
- return ids.iterator().next();
- }
-
- private static void clearViewTemplateReference(Context context, String defaultOrganizationUuid) throws SQLException {
- context.prepareUpsert("update organizations set default_perm_template_view = null where uuid=?")
- .setString(1, defaultOrganizationUuid)
- .execute()
- .commit();
- Loggers.get(SupportPrivateProjectInDefaultPermissionTemplate.class)
- .info("Permission template with uuid %s referenced as default permission template for view does not exist. Reference cleared.");
- }
-
- private static List getTemplateIds(Context context, @Nullable String permissionTemplateUuid) throws SQLException {
- return context.prepareSelect("select id from permission_templates where kee=?")
- .setString(1, permissionTemplateUuid)
- .list(row -> row.getInt(1));
- }
-
- private static final class OrganizationProperties {
- private final Integer defaultGroupId;
- private final String projectUuid;
- private final String viewUuid;
-
- private OrganizationProperties(@Nullable Integer defaultGroupId, @Nullable String projectUuid, @Nullable String viewUuid) {
- this.defaultGroupId = defaultGroupId;
- this.projectUuid = projectUuid;
- this.viewUuid = viewUuid;
- }
- }
-
- private static final class ResolvedOrganizationProperties {
- private final int defaultGroupId;
- private final Integer projectId;
- private final Integer viewId;
-
- private ResolvedOrganizationProperties(int defaultGroupId, @Nullable Integer projectId, @Nullable Integer viewId) {
- this.defaultGroupId = defaultGroupId;
- this.projectId = projectId;
- this.viewId = viewId;
- }
-
- int getDefaultGroupId() {
- return defaultGroupId;
- }
-
- Integer getProjectId() {
- return projectId;
- }
-
- @CheckForNull
-
- Integer getViewId() {
- return viewId;
- }
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/SupportProjectVisibilityInTemplates.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/SupportProjectVisibilityInTemplates.java
deleted file mode 100644
index 45ff721dbe5..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/SupportProjectVisibilityInTemplates.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v64;
-
-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.step.Select;
-import org.sonar.server.platform.db.migration.step.SqlStatement;
-
-public class SupportProjectVisibilityInTemplates extends DataChange {
- public SupportProjectVisibilityInTemplates(Database db) {
- super(db);
- }
-
- @Override
- protected void execute(Context context) throws SQLException {
- MassUpdate massUpdate = context.prepareMassUpdate();
- massUpdate.select("select distinct template_id from perm_templates_groups" +
- " where" +
- " group_id is null" +
- " and (permission_reference='user' or permission_reference='codeviewer')");
- massUpdate.update("delete from perm_templates_groups where" +
- " template_id = ?" +
- " and group_id is null" +
- " and (permission_reference='user' or permission_reference='codeviewer')");
- massUpdate.rowPluralName("permission templates with useless permissions to group AnyOne");
- massUpdate.execute(SupportProjectVisibilityInTemplates::handle);
- }
-
- private static boolean handle(Select.Row row, SqlStatement update) throws SQLException {
- int templateId = row.getInt(1);
-
- update.setInt(1, templateId);
- return true;
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/UpgradeQualityTemplateLoadedTemplates.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/UpgradeQualityTemplateLoadedTemplates.java
deleted file mode 100644
index 15485d6c84a..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/UpgradeQualityTemplateLoadedTemplates.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v64;
-
-import java.security.MessageDigest;
-import java.sql.SQLException;
-import org.apache.commons.codec.digest.DigestUtils;
-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.v63.DefaultOrganizationUuidProvider;
-
-import static java.lang.String.format;
-import static java.nio.charset.StandardCharsets.UTF_8;
-import static org.apache.commons.codec.binary.Hex.encodeHexString;
-
-public class UpgradeQualityTemplateLoadedTemplates extends DataChange {
- private static final String QUALITY_PROFILE_TYPE = "QUALITY_PROFILE";
-
- private final DefaultOrganizationUuidProvider defaultOrganizationUuid;
-
- public UpgradeQualityTemplateLoadedTemplates(Database db, DefaultOrganizationUuidProvider defaultOrganizationUuid) {
- super(db);
- this.defaultOrganizationUuid = defaultOrganizationUuid;
- }
-
- @Override
- protected void execute(Context context) throws SQLException {
- String defaultOrganizationUuid = this.defaultOrganizationUuid.getAndCheck(context);
-
- MassUpdate massUpdate = context.prepareMassUpdate();
- massUpdate
- .select("select id,kee from loaded_templates where template_type=?")
- .setString(1, QUALITY_PROFILE_TYPE);
- massUpdate.rowPluralName("loaded templates for quality profiles");
- massUpdate.update("update loaded_templates set template_type=?,kee=? where id=?");
- MessageDigest md5Digest = DigestUtils.getMd5Digest();
- massUpdate.execute((row, update) -> {
- int id = row.getInt(1);
- String key = row.getString(2);
-
- update.setString(1, computeLoadedTemplateType(key, md5Digest));
- update.setString(2, defaultOrganizationUuid);
- update.setInt(3, id);
- return true;
- });
- }
-
- private static String computeLoadedTemplateType(String currentKey, MessageDigest messageDigest) {
- return format("%s.%s", QUALITY_PROFILE_TYPE, encodeHexString(messageDigest.digest(currentKey.getBytes(UTF_8))));
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/package-info.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/package-info.java
deleted file mode 100644
index ca4666543eb..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v64/package-info.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public 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.v64;
-
-import javax.annotation.ParametersAreNonnullByDefault;
-
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/AddBuiltInFlagToRulesProfiles.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/AddBuiltInFlagToRulesProfiles.java
deleted file mode 100644
index baaa1534ec0..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/AddBuiltInFlagToRulesProfiles.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v65;
-
-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.BooleanColumnDef.newBooleanColumnDefBuilder;
-
-public class AddBuiltInFlagToRulesProfiles extends DdlChange {
-
- public AddBuiltInFlagToRulesProfiles(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute(new AddColumnsBuilder(getDialect(), "rules_profiles")
- .addColumn(newBooleanColumnDefBuilder()
- .setColumnName("is_built_in")
- .setIsNullable(true)
- .build())
- .build());
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/AddIndexOnEsQueueCreatedAt.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/AddIndexOnEsQueueCreatedAt.java
deleted file mode 100644
index 36c9401f968..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/AddIndexOnEsQueueCreatedAt.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v65;
-
-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.CreateIndexBuilder;
-import org.sonar.server.platform.db.migration.step.DdlChange;
-
-public class AddIndexOnEsQueueCreatedAt extends DdlChange {
-
- public AddIndexOnEsQueueCreatedAt(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- BigIntegerColumnDef column = BigIntegerColumnDef.newBigIntegerColumnDefBuilder()
- .setColumnName("created_at")
- .setIsNullable(false)
- .build();
-
- context.execute(new CreateIndexBuilder()
- .setName("es_queue_created_at")
- .setTable("es_queue")
- .addColumn(column)
- .build());
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/AddIndexRulesProfileUuidOnQProfileChanges.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/AddIndexRulesProfileUuidOnQProfileChanges.java
deleted file mode 100644
index 5bb7864dfb7..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/AddIndexRulesProfileUuidOnQProfileChanges.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v65;
-
-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 AddIndexRulesProfileUuidOnQProfileChanges extends DdlChange {
-
- private static final String TABLE_NAME = "qprofile_changes";
- private static final String COLUMN_NAME = "rules_profile_uuid";
- private static final String NEW_INDEX_NAME = "qp_changes_rules_profile_uuid";
-
- public AddIndexRulesProfileUuidOnQProfileChanges(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- VarcharColumnDef rulesProfileUuid = VarcharColumnDef.newVarcharColumnDefBuilder()
- .setColumnName(COLUMN_NAME)
- .setLimit(255)
- .setIsNullable(false)
- .build();
-
- context.execute(new CreateIndexBuilder()
- .setName(NEW_INDEX_NAME)
- .setTable(TABLE_NAME)
- .addColumn(rulesProfileUuid)
- .build()
- );
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/AddUsersOnboarded.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/AddUsersOnboarded.java
deleted file mode 100644
index bf3463854e5..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/AddUsersOnboarded.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v65;
-
-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.BooleanColumnDef.newBooleanColumnDefBuilder;
-
-public class AddUsersOnboarded extends DdlChange {
- public AddUsersOnboarded(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute(new AddColumnsBuilder(getDialect(), "users")
- .addColumn(newBooleanColumnDefBuilder()
- .setColumnName("onboarded")
- .setIsNullable(true)
- .build())
- .build());
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/CleanOrphanRowsInGroupRoles.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/CleanOrphanRowsInGroupRoles.java
deleted file mode 100644
index e17883f221f..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/CleanOrphanRowsInGroupRoles.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v65;
-
-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.step.Select;
-import org.sonar.server.platform.db.migration.step.SqlStatement;
-
-public class CleanOrphanRowsInGroupRoles extends DataChange {
- public CleanOrphanRowsInGroupRoles(Database db) {
- super(db);
- }
-
- @Override
- protected void execute(Context context) throws SQLException {
- deleteRowsWithoutComponent(context);
- deleteRowsForNonRootComponent(context);
- }
-
- private static void deleteRowsWithoutComponent(Context context) throws SQLException {
- MassUpdate massUpdate = context.prepareMassUpdate();
- massUpdate.select("select distinct gr.resource_id from group_roles gr where" +
- " gr.resource_id is not null" +
- " and not exists (select id from projects p where p.id = gr.resource_id)");
- massUpdate.rowPluralName("rows without component");
- massUpdate.update("delete from group_roles where resource_id = ?");
- massUpdate.execute(CleanOrphanRowsInGroupRoles::handle);
- }
-
- private static void deleteRowsForNonRootComponent(Context context) throws SQLException {
- MassUpdate massUpdate = context.prepareMassUpdate();
- massUpdate.select("select distinct gr.resource_id from group_roles gr" +
- " inner join projects p on p.id = gr.resource_id" +
- " where" +
- " p.scope <> ?" +
- " or (p.qualifier <> ? and p.qualifier <> ?)")
- .setString(1, "PRJ")
- .setString(2, "TRK")
- .setString(3, "VW");
- massUpdate.rowPluralName("rows for non-root component");
- massUpdate.update("delete from group_roles where resource_id = ?");
- massUpdate.execute(CleanOrphanRowsInGroupRoles::handle);
- }
-
- private static boolean handle(Select.Row row, SqlStatement update) throws SQLException {
- long resourceId = row.getLong(1);
-
- update.setLong(1, resourceId);
- return true;
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/CleanOrphanRowsInManualMeasures.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/CleanOrphanRowsInManualMeasures.java
deleted file mode 100644
index b7eaf9ac72a..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/CleanOrphanRowsInManualMeasures.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v65;
-
-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.step.Select;
-import org.sonar.server.platform.db.migration.step.SqlStatement;
-
-/**
- * Deletes rows from table MANUAL_MEASURES which:
- *
- *
has no component uuid
- *
or reference a non existing component
- *
or reference a disabled component
- *
or reference a component which is neither a project, nor a view, nor a module nor a subview
- *
- */
-public class CleanOrphanRowsInManualMeasures extends DataChange {
-
- private static final String SCOPE_PROJECT = "PRJ";
- private static final String QUALIFIER_PROJECT = "TRK";
- private static final String QUALIFIER_VIEW = "VW";
- private static final String QUALIFIER_MODULE = "BRC";
- private static final String QUALIFIER_SUBVIEW = "SVW";
-
- public CleanOrphanRowsInManualMeasures(Database db) {
- super(db);
- }
-
- @Override
- protected void execute(Context context) throws SQLException {
- MassUpdate massUpdate = context.prepareMassUpdate();
- massUpdate.select("select" +
- " mm.id" +
- " from manual_measures mm" +
- " where" +
- " mm.component_uuid is null" +
- " or not exists (" +
- " select" +
- " 1" +
- " from projects p" +
- " where" +
- " p.uuid = mm.component_uuid" +
- " and p.scope = ?" +
- " and p.qualifier in (?,?,?,?)" +
- " and p.enabled = ?" +
- " )")
- .setString(1, SCOPE_PROJECT)
- .setString(2, QUALIFIER_PROJECT)
- .setString(3, QUALIFIER_VIEW)
- .setString(4, QUALIFIER_MODULE)
- .setString(5, QUALIFIER_SUBVIEW)
- .setBoolean(6, true);
- massUpdate.update("delete from manual_measures where id = ?");
- massUpdate.rowPluralName("orphan properties");
- massUpdate.execute(CleanOrphanRowsInManualMeasures::handle);
- }
-
- private static boolean handle(Select.Row row, SqlStatement update) throws SQLException {
- long id = row.getLong(1);
-
- update.setLong(1, id);
-
- return true;
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/CleanOrphanRowsInProjectLinks.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/CleanOrphanRowsInProjectLinks.java
deleted file mode 100644
index 90a982fcca9..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/CleanOrphanRowsInProjectLinks.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v65;
-
-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.step.Select;
-import org.sonar.server.platform.db.migration.step.SqlStatement;
-
-/**
- * Delete rows from table PROJECT_LINKS which either:
- *
- *
references a non existing component
- *
references a disabled component
- *
references a component which is neither a project nor a view
- *
- */
-public class CleanOrphanRowsInProjectLinks extends DataChange {
- public CleanOrphanRowsInProjectLinks(Database db) {
- super(db);
- }
-
- @Override
- protected void execute(Context context) throws SQLException {
- MassUpdate massUpdate = context.prepareMassUpdate();
- massUpdate.select("select" +
- " pl.id" +
- " from project_links pl" +
- " where" +
- " not exists (" +
- " select" +
- " 1" +
- " from projects" +
- " p" +
- " where" +
- " p.uuid = pl.component_uuid" +
- " and p.scope = ?" +
- " and p.qualifier in (?,?)" +
- " and p.enabled = ?" +
- " )")
- .setString(1, "PRJ")
- .setString(2, "TRK")
- .setString(3, "VW")
- .setBoolean(4, true);
- massUpdate.update("delete from project_links where id = ?");
- massUpdate.rowPluralName("orphan project links");
- massUpdate.execute(CleanOrphanRowsInProjectLinks::handle);
- }
-
- private static boolean handle(Select.Row row, SqlStatement update) throws SQLException {
- long id = row.getLong(1);
-
- update.setLong(1, id);
-
- return true;
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/CleanOrphanRowsInProperties.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/CleanOrphanRowsInProperties.java
deleted file mode 100644
index da7d3e91ac2..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/CleanOrphanRowsInProperties.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v65;
-
-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.step.Select;
-import org.sonar.server.platform.db.migration.step.SqlStatement;
-
-/**
- * Deletes from table PROPERTIES any row which has a non null resource_id and which either:
- *
- *
references to a non existing component
- *
or references to a disabled component
- *
or references a component which is neither a project, nor a view, nor a module nor a subview
- *
- */
-public class CleanOrphanRowsInProperties extends DataChange {
-
- private static final String SCOPE_PROJECT = "PRJ";
- private static final String QUALIFIER_PROJECT = "TRK";
- private static final String QUALIFIER_VIEW = "VW";
- private static final String QUALIFIER_MODULE = "BRC";
- private static final String QUALIFIER_SUBVIEW = "SVW";
-
- public CleanOrphanRowsInProperties(Database db) {
- super(db);
- }
-
- @Override
- protected void execute(Context context) throws SQLException {
- MassUpdate massUpdate = context.prepareMassUpdate();
- massUpdate.select("select" +
- " s.id" +
- " from properties s" +
- " where" +
- " s.resource_id is not null" +
- " and not exists (" +
- " select" +
- " 1" +
- " from projects p" +
- " where" +
- " p.id = s.resource_id" +
- " and p.scope = ?" +
- " and p.qualifier in (?,?,?,?)" +
- " and p.enabled = ?" +
- " )")
- .setString(1, SCOPE_PROJECT)
- .setString(2, QUALIFIER_PROJECT)
- .setString(3, QUALIFIER_VIEW)
- .setString(4, QUALIFIER_MODULE)
- .setString(5, QUALIFIER_SUBVIEW)
- .setBoolean(6, true);
- massUpdate.update("delete from properties where id = ?");
- massUpdate.rowPluralName("orphan properties");
- massUpdate.execute(CleanOrphanRowsInProperties::handle);
- }
-
- private static boolean handle(Select.Row row, SqlStatement update) throws SQLException {
- long id = row.getLong(1);
-
- update.setLong(1, id);
-
- return true;
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/CleanOrphanRowsInUserRoles.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/CleanOrphanRowsInUserRoles.java
deleted file mode 100644
index efa3ebf1f76..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/CleanOrphanRowsInUserRoles.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v65;
-
-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.step.Select;
-import org.sonar.server.platform.db.migration.step.SqlStatement;
-
-public class CleanOrphanRowsInUserRoles extends DataChange {
- public CleanOrphanRowsInUserRoles(Database db) {
- super(db);
- }
-
- @Override
- protected void execute(Context context) throws SQLException {
- deleteRowsWithoutComponent(context);
- deleteRowsForNonRootComponent(context);
- }
-
- private static void deleteRowsWithoutComponent(Context context) throws SQLException {
- MassUpdate massUpdate = context.prepareMassUpdate();
- massUpdate.select("select distinct ur.resource_id from user_roles ur where" +
- " ur.resource_id is not null" +
- " and not exists (select id from projects p where p.id = ur.resource_id)");
- massUpdate.rowPluralName("rows without component");
- massUpdate.update("delete from user_roles where resource_id = ?");
- massUpdate.execute(CleanOrphanRowsInUserRoles::handle);
- }
-
- private static void deleteRowsForNonRootComponent(Context context) throws SQLException {
- MassUpdate massUpdate = context.prepareMassUpdate();
- massUpdate.select("select distinct ur.resource_id from user_roles ur" +
- " inner join projects p on p.id = ur.resource_id" +
- " where" +
- " p.scope <> ?" +
- " or (p.qualifier <> ? and p.qualifier <> ?)")
- .setString(1, "PRJ")
- .setString(2, "TRK")
- .setString(3, "VW");
- massUpdate.rowPluralName("rows for non-root component");
- massUpdate.update("delete from user_roles where resource_id = ?");
- massUpdate.execute(CleanOrphanRowsInUserRoles::handle);
- }
-
- private static boolean handle(Select.Row row, SqlStatement update) throws SQLException {
- long resourceId = row.getLong(1);
-
- update.setLong(1, resourceId);
- return true;
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/CreateEsQueueTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/CreateEsQueueTable.java
deleted file mode 100644
index 6d74aa3d0dc..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/CreateEsQueueTable.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v65;
-
-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.CreateTableBuilder;
-import org.sonar.server.platform.db.migration.step.DdlChange;
-
-public class CreateEsQueueTable extends DdlChange {
-
- private static final String TABLE_NAME = "es_queue";
-
- public CreateEsQueueTable(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute(new CreateTableBuilder(getDialect(), TABLE_NAME)
- .addPkColumn(VarcharColumnDef.newVarcharColumnDefBuilder()
- .setColumnName("uuid")
- .setIsNullable(false)
- .setLimit(40)
- .build())
- .addColumn(VarcharColumnDef.newVarcharColumnDefBuilder()
- .setColumnName("doc_type")
- .setIsNullable(false)
- .setLimit(40)
- .build())
- .addColumn(VarcharColumnDef.newVarcharColumnDefBuilder()
- .setColumnName("doc_id")
- .setIsNullable(false)
- .setLimit(4000)
- .build())
- .addColumn(VarcharColumnDef.newVarcharColumnDefBuilder()
- .setColumnName("doc_id_type")
- .setIsNullable(true)
- .setLimit(20)
- .build())
- .addColumn(VarcharColumnDef.newVarcharColumnDefBuilder()
- .setColumnName("doc_routing")
- .setIsNullable(true)
- .setLimit(4000)
- .build())
- .addColumn(BigIntegerColumnDef.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/v65/CreateTableDefaultQProfiles.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/CreateTableDefaultQProfiles.java
deleted file mode 100644
index a9fa08e2ee3..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/CreateTableDefaultQProfiles.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v65;
-
-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 CreateTableDefaultQProfiles extends DdlChange {
- private static final int QUALITY_PROFILE_UUID_SIZE = 255;
-
- public CreateTableDefaultQProfiles(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- VarcharColumnDef profileUuidColumn = newVarcharColumnDefBuilder()
- .setColumnName("qprofile_uuid")
- .setLimit(QUALITY_PROFILE_UUID_SIZE)
- .setIsNullable(false)
- .setIgnoreOracleUnit(true)
- .build();
- context.execute(
- new CreateTableBuilder(getDialect(), "default_qprofiles")
- .addPkColumn(newVarcharColumnDefBuilder()
- .setColumnName("organization_uuid")
- .setLimit(UUID_SIZE)
- .setIsNullable(false)
- .setIgnoreOracleUnit(true)
- .build())
- .addPkColumn(newVarcharColumnDefBuilder()
- .setColumnName("language")
- .setLimit(20)
- .setIsNullable(false)
- .setIgnoreOracleUnit(true)
- .build())
- .addColumn(profileUuidColumn)
- .addColumn(newBigIntegerColumnDefBuilder()
- .setColumnName("created_at")
- .setIsNullable(false)
- .build())
- .addColumn(newBigIntegerColumnDefBuilder()
- .setColumnName("updated_at")
- .setIsNullable(false)
- .build())
- .build());
-
- context.execute(
- new CreateIndexBuilder()
- .setTable("default_qprofiles")
- .setName("uniq_default_qprofiles_uuid")
- .addColumn(profileUuidColumn)
- .setUnique(true)
- .build());
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/CreateTableOrgQProfiles.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/CreateTableOrgQProfiles.java
deleted file mode 100644
index c3998fa31d5..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/CreateTableOrgQProfiles.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v65;
-
-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 CreateTableOrgQProfiles extends DdlChange {
-
- private static final String TABLE_NAME = "org_qprofiles";
- private static final int QUALITY_PROFILE_UUID_SIZE = 255;
-
- public CreateTableOrgQProfiles(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- VarcharColumnDef organizationColumn = newVarcharColumnDefBuilder()
- .setColumnName("organization_uuid")
- .setLimit(UUID_SIZE)
- .setIsNullable(false)
- .setIgnoreOracleUnit(true)
- .build();
- VarcharColumnDef rulesProfileUuid = newVarcharColumnDefBuilder()
- .setColumnName("rules_profile_uuid")
- .setLimit(QUALITY_PROFILE_UUID_SIZE)
- .setIsNullable(false)
- .setIgnoreOracleUnit(true)
- .build();
- context.execute(
- new CreateTableBuilder(getDialect(), TABLE_NAME)
- .addPkColumn(newVarcharColumnDefBuilder()
- .setColumnName("uuid")
- .setLimit(QUALITY_PROFILE_UUID_SIZE)
- .setIsNullable(false)
- .build())
- .addColumn(organizationColumn)
- .addColumn(rulesProfileUuid)
- .addColumn(newVarcharColumnDefBuilder()
- .setColumnName("parent_uuid")
- .setLimit(QUALITY_PROFILE_UUID_SIZE)
- .setIsNullable(true)
- .setIgnoreOracleUnit(true)
- .build())
- .addColumn(newBigIntegerColumnDefBuilder()
- .setColumnName("last_used")
- .setIsNullable(true)
- .build())
- .addColumn(newBigIntegerColumnDefBuilder()
- .setColumnName("user_updated_at")
- .setIsNullable(true)
- .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("qprofiles_org_uuid")
- .addColumn(organizationColumn)
- .build());
-
- context.execute(
- new CreateIndexBuilder()
- .setTable(TABLE_NAME)
- .setName("qprofiles_rp_uuid")
- .addColumn(rulesProfileUuid)
- .build());
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/DbVersion65.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/DbVersion65.java
deleted file mode 100644
index 61cf60f838f..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/DbVersion65.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v65;
-
-import org.sonar.server.platform.db.migration.step.MigrationStepRegistry;
-import org.sonar.server.platform.db.migration.version.DbVersion;
-
-public class DbVersion65 implements DbVersion {
- @Override
- public void addSteps(MigrationStepRegistry registry) {
- registry
- .add(1700, "Drop table AUTHORS", DropTableAuthors.class)
- .add(1701, "Clean orphans from USER_ROLES", CleanOrphanRowsInUserRoles.class)
- .add(1702, "Clean orphans from GROUP_ROLES", CleanOrphanRowsInGroupRoles.class)
- .add(1703, "Populate EVENTS.COMPONENT_UUID", PopulateEventsComponentUuid.class)
- .add(1704, "Drop index EVENTS_COMPONENT_UUID", DropIndexEventsComponentUuid.class)
- .add(1705, "Make EVENTS.COMPONENT_UUID not nullable", MakeEventsComponentUuidNotNullable.class)
- .add(1706, "Recreate index EVENTS_COMPONENT_UUID", RecreateIndexEventsComponentUuid.class)
- .add(1707, "Ensure ISSUE.PROJECT_UUID is consistent", EnsureIssueProjectUuidConsistencyOnIssues.class)
- .add(1708, "Clean orphans from PROJECT_LINKS", CleanOrphanRowsInProjectLinks.class)
- .add(1709, "Clean orphans from SETTINGS", CleanOrphanRowsInProperties.class)
- .add(1710, "Clean orphans from MANUAL_MEASURES", CleanOrphanRowsInManualMeasures.class)
- .add(1711, "Drop index MANUAL_MEASURES.COMPONENT_UUID", DropIndexManualMeasuresComponentUuid.class)
- .add(1712, "Make MANUAL_MEASURES.COMPONENT_UUID not nullable", MakeManualMeasuresComponentUuidNotNullable.class)
- .add(1713, "Recreate index MANUAL_MEASURES.COMPONENT_UUID", RecreateIndexManualMeasuresComponentUuid.class)
- .add(1714, "Purge developer data", PurgeDeveloperData.class)
- .add(1715, "Add rules_profiles.is_built_in", AddBuiltInFlagToRulesProfiles.class)
- .add(1716, "Set rules_profiles.is_built_in to false", SetRulesProfilesIsBuiltInToFalse.class)
- .add(1717, "Make rules_profiles.is_built_in not null", MakeRulesProfilesIsBuiltInNotNullable.class)
- .add(1718, "Delete unused loaded_templates on quality profiles", DeleteLoadedTemplatesOnQProfiles.class)
- .add(1719, "Create table default_qprofiles", CreateTableDefaultQProfiles.class)
- .add(1720, "Populate table default_qprofiles", PopulateTableDefaultQProfiles.class)
- .add(1721, "Drop rules_profiles.is_default", DropIsDefaultColumnFromRulesProfiles.class)
- .add(1722, "Create table qprofiles", CreateTableOrgQProfiles.class)
- .add(1723, "Populate table qprofiles", PopulateOrgQProfiles.class)
- .add(1724, "Drop columns organization_uuid and parent_kee from rules_profiles", DropOrgColumnsFromRulesProfiles.class)
- .add(1725, "Mark rules_profiles.is_built_in to true for default organization", SetRulesProfilesIsBuiltInToTrueForDefaultOrganization.class)
- .add(1726, "Update org_qprofiles to reference built-in profiles", UpdateOrgQProfilesToPointToBuiltInProfiles.class)
- .add(1727, "Delete rules_profiles orphans", DeleteOrphansFromRulesProfiles.class)
- .add(1728, "Rename column qprofile_changes.qprofile_key to qprofile_changes.rules_profile_uuid", RenameQProfileKeyToRulesProfileUuidOnQProfileChanges.class)
- .add(1729, "Add index on qprofile_changes.rules_profile_uuid", AddIndexRulesProfileUuidOnQProfileChanges.class)
- .add(1730, "Add USERS.ONBOARDED", AddUsersOnboarded.class)
- .add(1731, "Populate USERS.ONBOARDED", PopulateUsersOnboarded.class)
- .add(1732, "Make USERS.ONBOARDED not nullable", MakeUsersOnboardedNotNullable.class)
- .add(1733, "Create table es_queue", CreateEsQueueTable.class)
- .add(1734, "Add index on es_queue.created_at", AddIndexOnEsQueueCreatedAt.class)
- .add(1735, "Delete sonar.ce.workerCount setting", DeleteCeWorkerCountSetting.class)
- ;
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/DeleteCeWorkerCountSetting.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/DeleteCeWorkerCountSetting.java
deleted file mode 100644
index 21e1f3c3de2..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/DeleteCeWorkerCountSetting.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v65;
-
-import java.sql.SQLException;
-import org.sonar.db.Database;
-import org.sonar.server.platform.db.migration.step.DataChange;
-
-public class DeleteCeWorkerCountSetting extends DataChange {
- public DeleteCeWorkerCountSetting(Database db) {
- super(db);
- }
-
- @Override
- protected void execute(Context context) throws SQLException {
- context.prepareUpsert("delete from properties where prop_key=?")
- .setString(1, "sonar.ce.workerCount")
- .execute()
- .commit();
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/DeleteLoadedTemplatesOnQProfiles.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/DeleteLoadedTemplatesOnQProfiles.java
deleted file mode 100644
index 41c79e685b8..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/DeleteLoadedTemplatesOnQProfiles.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v65;
-
-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 DeleteLoadedTemplatesOnQProfiles extends DataChange {
-
- public DeleteLoadedTemplatesOnQProfiles(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- MassUpdate massUpdate = context.prepareMassUpdate();
- massUpdate.select("select id from loaded_templates where template_type like 'QUALITY_PROFILE.%'");
- massUpdate.rowPluralName("loaded_templates");
- massUpdate.update("delete from loaded_templates where id=?");
- massUpdate.execute((row, update) -> {
- update.setLong(1, row.getLong(1));
- return true;
- });
- }
-
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/DeleteOrphansFromRulesProfiles.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/DeleteOrphansFromRulesProfiles.java
deleted file mode 100644
index 8503d03023c..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/DeleteOrphansFromRulesProfiles.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v65;
-
-import java.sql.SQLException;
-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.step.DataChange;
-
-public class DeleteOrphansFromRulesProfiles extends DataChange {
-
- private static final Logger LOG = Loggers.get(DeleteOrphansFromRulesProfiles.class);
-
- public DeleteOrphansFromRulesProfiles(Database db) {
- super(db);
- }
-
- @Override
- protected void execute(Context context) throws SQLException {
- execute(context, "rules_profiles", "delete from rules_profiles where not exists( select 1 from org_qprofiles oqp where oqp.rules_profile_uuid = kee)");
- execute(context, "active_rules", "delete from active_rules where not exists ( select 1 from rules_profiles rp where rp.id = profile_id)");
- execute(context, "active_rule_parameters", "delete from active_rule_parameters where not exists ( select 1 from active_rules ar where ar.id = active_rule_id)");
- execute(context, "qprofile_changes", "delete from qprofile_changes where not exists ( select 1 from rules_profiles rp where rp.kee = qprofile_key)");
- }
-
- private static void execute(Context context, String tableName, String sql) throws SQLException {
- LOG.info("Deleting orphans from " + tableName);
- context
- .prepareUpsert(sql)
- .execute()
- .commit();
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/DropIndexEventsComponentUuid.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/DropIndexEventsComponentUuid.java
deleted file mode 100644
index adb37115847..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/DropIndexEventsComponentUuid.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v65;
-
-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 DropIndexEventsComponentUuid extends DdlChange {
-
- public DropIndexEventsComponentUuid(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute(new DropIndexBuilder(getDialect())
- .setTable("events")
- .setName("events_component_uuid")
- .build());
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/DropIndexManualMeasuresComponentUuid.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/DropIndexManualMeasuresComponentUuid.java
deleted file mode 100644
index cb472c9953e..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/DropIndexManualMeasuresComponentUuid.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v65;
-
-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 DropIndexManualMeasuresComponentUuid extends DdlChange {
-
- public DropIndexManualMeasuresComponentUuid(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute(new DropIndexBuilder(getDialect())
- .setTable("manual_measures")
- .setName("manual_measures_component_uuid")
- .build());
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/DropIsDefaultColumnFromRulesProfiles.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/DropIsDefaultColumnFromRulesProfiles.java
deleted file mode 100644
index c764db60eb6..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/DropIsDefaultColumnFromRulesProfiles.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v65;
-
-import java.sql.Connection;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.Statement;
-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 static java.lang.String.format;
-
-public class DropIsDefaultColumnFromRulesProfiles extends DdlChange {
-
- private static final String TABLE_NAME = "rules_profiles";
- private static final String COLUMN_NAME = "is_default";
-
- public DropIsDefaultColumnFromRulesProfiles(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- if (getDialect().getId().equals(MsSql.ID)) {
- // this should be handled automatically by DropColumnsBuilder
- dropMssqlConstraints();
- }
-
- context.execute(new DropColumnsBuilder(getDialect(), TABLE_NAME, COLUMN_NAME).build());
- }
-
- private void dropMssqlConstraints() throws SQLException {
- try (Connection connection = getDatabase().getDataSource().getConnection();
- PreparedStatement pstmt = connection
- .prepareStatement(format("SELECT d.name " +
- "FROM sys.default_constraints d " +
- "INNER JOIN sys.columns AS c ON d.parent_column_id = c.column_id " +
- "WHERE OBJECT_NAME(d.parent_object_id)='%s' AND c.name='%s'", TABLE_NAME, COLUMN_NAME));
- ResultSet rs = pstmt.executeQuery()) {
- while (rs.next()) {
- String constraintName = rs.getString(1);
- dropMssqlConstraint(connection, constraintName);
- }
- }
- }
-
- private static void dropMssqlConstraint(Connection connection, String constraintName) throws SQLException {
- try (Statement stmt = connection.createStatement()) {
- stmt.executeUpdate(format("ALTER TABLE %s DROP CONSTRAINT %s", TABLE_NAME, constraintName));
- }
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/DropOrgColumnsFromRulesProfiles.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/DropOrgColumnsFromRulesProfiles.java
deleted file mode 100644
index e6e31233e5e..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/DropOrgColumnsFromRulesProfiles.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v65;
-
-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 DropOrgColumnsFromRulesProfiles extends DdlChange {
-
- private static final String TABLE_NAME = "rules_profiles";
-
- public DropOrgColumnsFromRulesProfiles(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute(new DropColumnsBuilder(getDialect(), TABLE_NAME, "organization_uuid").build());
- context.execute(new DropColumnsBuilder(getDialect(), TABLE_NAME, "parent_kee").build());
- context.execute(new DropColumnsBuilder(getDialect(), TABLE_NAME, "last_used").build());
- context.execute(new DropColumnsBuilder(getDialect(), TABLE_NAME, "user_updated_at").build());
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/DropTableAuthors.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/DropTableAuthors.java
deleted file mode 100644
index de6f91d50d0..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/DropTableAuthors.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v65;
-
-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 DropTableAuthors extends DdlChange {
- public DropTableAuthors(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute(new DropIndexBuilder(getDialect()).setTable("authors").setName("uniq_author_logins").build());
- context.execute(new DropTableBuilder(getDialect(), "authors").build());
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/EnsureIssueProjectUuidConsistencyOnIssues.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/EnsureIssueProjectUuidConsistencyOnIssues.java
deleted file mode 100644
index f0483688989..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/EnsureIssueProjectUuidConsistencyOnIssues.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v65;
-
-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.step.Select;
-import org.sonar.server.platform.db.migration.step.SqlStatement;
-
-public class EnsureIssueProjectUuidConsistencyOnIssues extends DataChange {
- public EnsureIssueProjectUuidConsistencyOnIssues(Database db) {
- super(db);
- }
-
- @Override
- protected void execute(Context context) throws SQLException {
- MassUpdate massUpdate = context.prepareMassUpdate();
- massUpdate.select("select" +
- " i.id, p.project_uuid" +
- " from issues i" +
- " inner join projects p on" +
- " p.uuid = i.component_uuid" +
- " and i.project_uuid <> p.project_uuid");
- massUpdate.update("update issues set project_uuid = ? where id = ?");
- massUpdate.rowPluralName("issues with inconsistent project_uuid");
- massUpdate.execute(EnsureIssueProjectUuidConsistencyOnIssues::handle);
- }
-
- private static boolean handle(Select.Row row, SqlStatement update) throws SQLException {
- long issueId = row.getLong(1);
- String projectUuid = row.getString(2);
-
- update.setString(1, projectUuid);
- update.setLong(2, issueId);
-
- return true;
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/MakeEventsComponentUuidNotNullable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/MakeEventsComponentUuidNotNullable.java
deleted file mode 100644
index f51639e6263..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/MakeEventsComponentUuidNotNullable.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v65;
-
-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 MakeEventsComponentUuidNotNullable extends DdlChange {
-
- public MakeEventsComponentUuidNotNullable(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute(new AlterColumnsBuilder(getDialect(), "events")
- .updateColumn(newVarcharColumnDefBuilder()
- .setColumnName("component_uuid")
- .setLimit(VarcharColumnDef.UUID_VARCHAR_SIZE)
- .setIsNullable(false)
- .build())
- .build());
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/MakeManualMeasuresComponentUuidNotNullable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/MakeManualMeasuresComponentUuidNotNullable.java
deleted file mode 100644
index ece5426070f..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/MakeManualMeasuresComponentUuidNotNullable.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v65;
-
-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 MakeManualMeasuresComponentUuidNotNullable extends DdlChange {
-
- public MakeManualMeasuresComponentUuidNotNullable(Database db) {
- super(db);
- }
-
- @Override
- public void execute(DdlChange.Context context) throws SQLException {
- context.execute(new AlterColumnsBuilder(getDialect(), "manual_measures")
- .updateColumn(newVarcharColumnDefBuilder()
- .setColumnName("component_uuid")
- .setLimit(VarcharColumnDef.UUID_VARCHAR_SIZE)
- .setIsNullable(false)
- .build())
- .build());
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/MakeRulesProfilesIsBuiltInNotNullable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/MakeRulesProfilesIsBuiltInNotNullable.java
deleted file mode 100644
index 56111ec8116..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/MakeRulesProfilesIsBuiltInNotNullable.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v65;
-
-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 MakeRulesProfilesIsBuiltInNotNullable extends DdlChange {
-
- public MakeRulesProfilesIsBuiltInNotNullable(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- BooleanColumnDef column = newBooleanColumnDefBuilder()
- .setColumnName("is_built_in")
- .setIsNullable(false)
- .build();
-
- context.execute(new AlterColumnsBuilder(getDialect(), "rules_profiles")
- .updateColumn(column)
- .build());
- }
-
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/MakeUsersOnboardedNotNullable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/MakeUsersOnboardedNotNullable.java
deleted file mode 100644
index d1a6273f04c..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/MakeUsersOnboardedNotNullable.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v65;
-
-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 MakeUsersOnboardedNotNullable extends DdlChange {
-
- public MakeUsersOnboardedNotNullable(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- BooleanColumnDef column = newBooleanColumnDefBuilder()
- .setColumnName("onboarded")
- .setIsNullable(false)
- .build();
- context.execute(new AlterColumnsBuilder(getDialect(), "users")
- .updateColumn(column)
- .build());
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/PopulateEventsComponentUuid.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/PopulateEventsComponentUuid.java
deleted file mode 100644
index 9e2c7d7b057..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/PopulateEventsComponentUuid.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v65;
-
-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.step.Select;
-import org.sonar.server.platform.db.migration.step.SqlStatement;
-
-public class PopulateEventsComponentUuid extends DataChange {
- public PopulateEventsComponentUuid(Database db) {
- super(db);
- }
-
- @Override
- protected void execute(Context context) throws SQLException {
- populateColumnOrFixInconsistencies(context);
-
- deleteOrphans(context);
- }
-
- private static void populateColumnOrFixInconsistencies(Context context) throws SQLException {
- MassUpdate massUpdate = context.prepareMassUpdate();
- massUpdate.select("select" +
- " e.id, s.component_uuid" +
- " from events e" +
- " inner join snapshots s on" +
- " s.uuid = e.analysis_uuid" +
- " where" +
- " e.component_uuid is null" +
- " or e.component_uuid <> s.uuid");
- massUpdate.update("update events set component_uuid = ? where id = ?");
- massUpdate.rowPluralName("events without component_uuid");
- massUpdate.execute(PopulateEventsComponentUuid::handlePopulate);
- }
-
- private static boolean handlePopulate(Select.Row row, SqlStatement update) throws SQLException {
- long id = row.getLong(1);
- String projectUuid = row.getString(2);
-
- update.setString(1, projectUuid);
- update.setLong(2, id);
-
- return true;
- }
-
- private static void deleteOrphans(Context context) throws SQLException {
- MassUpdate massUpdate = context.prepareMassUpdate();
- massUpdate.select("select id from events e where" +
- " e.component_uuid is null" +
- " or not exists (select id from snapshots s where s.uuid = e.analysis_uuid)");
- massUpdate.update("delete from events where id = ?");
- massUpdate.rowPluralName("delete orphan events");
- massUpdate.execute(PopulateEventsComponentUuid::handleDelete);
- }
-
- private static boolean handleDelete(Select.Row row, SqlStatement update) throws SQLException {
- long id = row.getLong(1);
-
- update.setLong(1, id);
-
- return true;
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/PopulateOrgQProfiles.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/PopulateOrgQProfiles.java
deleted file mode 100644
index e18edac2283..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/PopulateOrgQProfiles.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v65;
-
-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 PopulateOrgQProfiles extends DataChange {
-
- private final System2 system2;
-
- public PopulateOrgQProfiles(Database db, System2 system2) {
- super(db);
- this.system2 = system2;
- }
-
- @Override
- protected void execute(Context context) throws SQLException {
- long now = system2.now();
-
- MassUpdate massUpdate = context.prepareMassUpdate();
- massUpdate.select("select p.kee, p.organization_uuid, p.parent_kee, p.last_used, p.user_updated_at from rules_profiles p " +
- "where not exists ( select qp.uuid from org_qprofiles qp where qp.uuid = p.kee and qp.organization_uuid = p.organization_uuid )");
- massUpdate.update("insert into org_qprofiles" +
- " (uuid, organization_uuid, rules_profile_uuid, parent_uuid, last_used, user_updated_at, created_at, updated_at) values (?, ?, ?, ?, ?, ?, ?, ?)");
- massUpdate.rowPluralName("org_qprofiles");
- massUpdate.execute((row, update) -> {
- String uuid = row.getString(1);
- String organizationUuid = row.getString(2);
- String parentUuid = row.getString(3);
- Long lastUsed = row.getNullableLong(4);
- Long userUpdatedAt = row.getNullableLong(5);
-
- update.setString(1, uuid);
- update.setString(2, organizationUuid);
- update.setString(3, uuid);
- update.setString(4, parentUuid);
- update.setLong(5, lastUsed);
- update.setLong(6, userUpdatedAt);
- update.setLong(7, now);
- update.setLong(8, now);
- return true;
- });
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/PopulateTableDefaultQProfiles.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/PopulateTableDefaultQProfiles.java
deleted file mode 100644
index f6fae44f30f..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/PopulateTableDefaultQProfiles.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v65;
-
-import java.sql.SQLException;
-import java.util.HashSet;
-import java.util.Set;
-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 org.sonar.server.platform.db.migration.step.Select;
-
-/**
- * Move the list of profiles marked as "default" from rules_profiles.is_default
- * to the table default_qprofiles.
- */
-public class PopulateTableDefaultQProfiles extends DataChange {
-
- private final System2 system2;
-
- public PopulateTableDefaultQProfiles(Database db, System2 system2) {
- super(db);
- this.system2 = system2;
- }
-
- @Override
- protected void execute(Context context) throws SQLException {
- Set buggyOrgs = selectOrgsWithMultipleDefaultProfiles(context);
- Set processedBuggyOrgs = new HashSet<>();
- long now = system2.now();
-
- MassUpdate massUpdate = context.prepareMassUpdate();
- massUpdate.select("select p.organization_uuid, p.language, p.kee from rules_profiles p " +
- " where p.is_default = ? " +
- " and not exists (select 1 from default_qprofiles dp where dp.organization_uuid = p.organization_uuid and dp.language = p.language)" +
- " order by id")
- .setBoolean(1, true);
- massUpdate.update("insert into default_qprofiles" +
- " (organization_uuid, language, qprofile_uuid, created_at, updated_at) values (?, ?, ?, ?, ?)");
- massUpdate.rowPluralName("default_qprofiles");
- massUpdate.execute((row, update) -> {
- OrgLang pk = new OrgLang(row.getString(1), row.getString(2));
- String profileUuid = row.getString(3);
-
- boolean isBuggy = buggyOrgs.contains(pk);
- if (isBuggy && processedBuggyOrgs.contains(pk)) {
- // profile is ignored. There's already one marked as default.
- return false;
- }
- update.setString(1, pk.orgUuid);
- update.setString(2, pk.language);
- update.setString(3, profileUuid);
- update.setLong(4, now);
- update.setLong(5, now);
- if (isBuggy) {
- processedBuggyOrgs.add(pk);
- }
- return true;
- });
- }
-
- /**
- * By design the table rules_profiles does not enforce to have a single
- * profile marked as default for an organization and language.
- * This method returns the buggy rows.
- */
- private static Set selectOrgsWithMultipleDefaultProfiles(Context context) throws SQLException {
- Select rows = context.prepareSelect("select organization_uuid, language from rules_profiles " +
- " where is_default = ? " +
- " group by organization_uuid, language " +
- " having count(kee) > 1 ")
- .setBoolean(1, true);
- return new HashSet<>(rows.list(row -> new OrgLang(row.getString(1), row.getString(2))));
- }
-
- private static class OrgLang {
- private final String orgUuid;
- private final String language;
-
- private OrgLang(String orgUuid, String language) {
- this.orgUuid = orgUuid;
- this.language = language;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) {
- return true;
- }
- if (o == null || getClass() != o.getClass()) {
- return false;
- }
-
- OrgLang orgLang = (OrgLang) o;
- if (!orgUuid.equals(orgLang.orgUuid)) {
- return false;
- }
- return language.equals(orgLang.language);
- }
-
- @Override
- public int hashCode() {
- int result = orgUuid.hashCode();
- result = 31 * result + language.hashCode();
- return result;
- }
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/PopulateUsersOnboarded.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/PopulateUsersOnboarded.java
deleted file mode 100644
index 0120cef7707..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/PopulateUsersOnboarded.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v65;
-
-import java.sql.SQLException;
-import org.sonar.api.utils.System2;
-import org.sonar.db.Database;
-import org.sonar.server.platform.db.migration.step.DataChange;
-
-public class PopulateUsersOnboarded extends DataChange {
-
- private final System2 system2;
-
- public PopulateUsersOnboarded(Database db, System2 system2) {
- super(db);
- this.system2 = system2;
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.prepareUpsert("update users set onboarded=?, updated_at=?")
- .setBoolean(1, true)
- .setLong(2, system2.now())
- .execute()
- .commit();
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/PurgeDeveloperData.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/PurgeDeveloperData.java
deleted file mode 100644
index 33bc1ff88a1..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/PurgeDeveloperData.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v65;
-
-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.step.Select;
-import org.sonar.server.platform.db.migration.step.SqlStatement;
-
-public class PurgeDeveloperData extends DataChange {
- public PurgeDeveloperData(Database db) {
- super(db);
- }
-
- @Override
- protected void execute(Context context) throws SQLException {
- purgeProjectCopies(context);
-
- purgeDevelopers(context);
- }
-
- private void purgeProjectCopies(Context context) throws SQLException {
- MassUpdate massUpdate = context.prepareMassUpdate();
- massUpdate.select("select" +
- " child.id, child.uuid" +
- " from projects child" +
- " inner join projects root on" +
- " root.uuid = child.project_uuid" +
- " and root.scope=?" +
- " and root.qualifier=?" +
- " where" +
- " child.uuid <> child.project_uuid")
- .setString(1, "PRJ")
- .setString(2, "DEV");
- massUpdate.rowPluralName("purged project copies");
- massUpdate.update("delete from project_measures where component_uuid=?");
- massUpdate.update("delete from projects where uuid=?");
- massUpdate.execute(PurgeDeveloperData::handlePurgeProjectCopies);
- }
-
- private static boolean handlePurgeProjectCopies(Select.Row row, SqlStatement update, int updateIndex) throws SQLException {
- if (updateIndex < 0 || updateIndex > 1) {
- throw new IllegalArgumentException("Unsupported updateIndex " + updateIndex);
- }
- String uuid = row.getString(2);
- update.setString(1, uuid);
- return true;
- }
-
- private void purgeDevelopers(Context context) throws SQLException {
- MassUpdate massUpdate = context.prepareMassUpdate();
- massUpdate.select("select" +
- " id, uuid" +
- " from projects" +
- " where" +
- " scope=?" +
- " and qualifier=?")
- .setString(1, "PRJ")
- .setString(2, "DEV");
- massUpdate.update("delete from project_measures where component_uuid=?");
- massUpdate.update("delete from ce_activity where component_uuid=?");
- massUpdate.update("delete from snapshots where component_uuid=?");
- massUpdate.update("delete from group_roles where resource_id=?");
- massUpdate.update("delete from user_roles where resource_id=?");
- massUpdate.update("delete from projects where project_uuid=?");
- massUpdate.rowPluralName("purged developers");
- massUpdate.execute(PurgeDeveloperData::handlePurgeDevelopers);
- }
-
- private static boolean handlePurgeDevelopers(Select.Row row, SqlStatement update, int updateIndex) throws SQLException {
- long id = row.getLong(1);
- String uuid = row.getString(2);
- switch (updateIndex) {
- case 0:
- case 1:
- case 2:
- update.setString(1, uuid);
- return true;
- case 3:
- case 4:
- update.setLong(1, id);
- return true;
- case 5:
- update.setString(1, uuid);
- return true;
- default:
- throw new IllegalArgumentException("Unsupported updateIndex " + updateIndex);
- }
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/RecreateIndexEventsComponentUuid.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/RecreateIndexEventsComponentUuid.java
deleted file mode 100644
index 7f0cb6f23cc..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/RecreateIndexEventsComponentUuid.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v65;
-
-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;
-
-import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder;
-
-public class RecreateIndexEventsComponentUuid extends DdlChange {
-
- public RecreateIndexEventsComponentUuid(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute(new CreateIndexBuilder()
- .setTable("events")
- .setName("events_component_uuid")
- .setUnique(false)
- .addColumn(newVarcharColumnDefBuilder()
- .setColumnName("component_uuid")
- .setLimit(VarcharColumnDef.UUID_VARCHAR_SIZE)
- .setIsNullable(false)
- .build())
- .build());
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/RecreateIndexManualMeasuresComponentUuid.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/RecreateIndexManualMeasuresComponentUuid.java
deleted file mode 100644
index 5ef0672dc95..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/RecreateIndexManualMeasuresComponentUuid.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v65;
-
-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;
-
-import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder;
-
-public class RecreateIndexManualMeasuresComponentUuid extends DdlChange {
-
- public RecreateIndexManualMeasuresComponentUuid(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute(new CreateIndexBuilder()
- .setTable("manual_measures")
- .setName("manual_measures_component_uuid")
- .setUnique(false)
- .addColumn(newVarcharColumnDefBuilder()
- .setColumnName("component_uuid")
- .setLimit(VarcharColumnDef.UUID_VARCHAR_SIZE)
- .setIsNullable(false)
- .build())
- .build());
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/RenameQProfileKeyToRulesProfileUuidOnQProfileChanges.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/RenameQProfileKeyToRulesProfileUuidOnQProfileChanges.java
deleted file mode 100644
index 431a784e0ad..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/RenameQProfileKeyToRulesProfileUuidOnQProfileChanges.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v65;
-
-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.RenameColumnsBuilder;
-import org.sonar.server.platform.db.migration.step.DdlChange;
-
-public class RenameQProfileKeyToRulesProfileUuidOnQProfileChanges extends DdlChange {
-
- private static final String TABLE_NAME = "qprofile_changes";
- private static final String OLD_COLUMN = "qprofile_key";
- private static final String NEW_COLUMN = "rules_profile_uuid";
-
- public RenameQProfileKeyToRulesProfileUuidOnQProfileChanges(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- VarcharColumnDef newColumn = VarcharColumnDef.newVarcharColumnDefBuilder()
- .setColumnName(NEW_COLUMN)
- .setLimit(255)
- .setIsNullable(false)
- .build();
-
- context.execute(
- new RenameColumnsBuilder(getDialect(), TABLE_NAME)
- .renameColumn(OLD_COLUMN, newColumn)
- .build());
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/SetRulesProfilesIsBuiltInToFalse.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/SetRulesProfilesIsBuiltInToFalse.java
deleted file mode 100644
index 0d84f1eb724..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/SetRulesProfilesIsBuiltInToFalse.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v65;
-
-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 SetRulesProfilesIsBuiltInToFalse extends DataChange {
-
- public SetRulesProfilesIsBuiltInToFalse(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- MassUpdate massUpdate = context.prepareMassUpdate();
- massUpdate.select("select id from rules_profiles where is_built_in is null");
- massUpdate.rowPluralName("rules_profiles");
- massUpdate.update("update rules_profiles set is_built_in=? where id=?");
- massUpdate.execute((row, update) -> {
- update.setBoolean(1, false);
- 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/v65/SetRulesProfilesIsBuiltInToTrueForDefaultOrganization.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/SetRulesProfilesIsBuiltInToTrueForDefaultOrganization.java
deleted file mode 100644
index 4a57637654f..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/SetRulesProfilesIsBuiltInToTrueForDefaultOrganization.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v65;
-
-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 static com.google.common.base.Preconditions.checkState;
-
-public class SetRulesProfilesIsBuiltInToTrueForDefaultOrganization extends DataChange {
- private static final String PROP_DEFAULT_ORGANIZATION_UUID = "organization.default";
- private static final String PROP_ORGANIZATION_ENABLED = "organization.enabled";
-
- public SetRulesProfilesIsBuiltInToTrueForDefaultOrganization(Database db) {
- super(db);
- }
-
- @Override
- protected void execute(Context context) throws SQLException {
- if (!isOrganizationEnabled(context)) {
- return;
- }
-
- String defaultOrganizationUuid = getDefaultOrganizationUuid(context);
- checkState(defaultOrganizationUuid!=null, "Missing internal property: '%s'", PROP_DEFAULT_ORGANIZATION_UUID);
-
- MassUpdate massUpdate = context.prepareMassUpdate()
- .rowPluralName("rules profiles");
- massUpdate.select("select rp.kee " +
- "from rules_profiles rp " +
- "inner join org_qprofiles oqp on rp.kee = oqp.rules_profile_uuid " +
- "where oqp.organization_uuid = ? ")
- .setString(1, defaultOrganizationUuid);
- massUpdate.update("update rules_profiles " +
- "set is_built_in=? " +
- "where kee=?");
- massUpdate.execute((row, update) -> {
- String rulesProfilesUuid = row.getString(1);
- update.setBoolean(1, true);
- update.setString(2, rulesProfilesUuid);
- return true;
- });
- }
-
- private static String getDefaultOrganizationUuid(Context context) throws SQLException {
- return context.prepareSelect("select text_value from internal_properties where kee=?")
- .setString(1, PROP_DEFAULT_ORGANIZATION_UUID)
- .get(row -> row.getString(1));
- }
-
- private static boolean isOrganizationEnabled(Context context) throws SQLException {
- String value = context.prepareSelect("select text_value from internal_properties where kee=?")
- .setString(1, PROP_ORGANIZATION_ENABLED)
- .get(row -> row.getNullableString(1));
-
- return "true".equals(value);
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/UpdateOrgQProfilesToPointToBuiltInProfiles.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/UpdateOrgQProfilesToPointToBuiltInProfiles.java
deleted file mode 100644
index 107853e8356..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/UpdateOrgQProfilesToPointToBuiltInProfiles.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v65;
-
-import com.google.common.collect.HashBasedTable;
-import com.google.common.collect.Table;
-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 static com.google.common.base.Preconditions.checkState;
-
-public class UpdateOrgQProfilesToPointToBuiltInProfiles extends DataChange {
- private static final String PROP_DEFAULT_ORGANIZATION_UUID = "organization.default";
- private static final String PROP_ORGANIZATION_ENABLED = "organization.enabled";
-
- public UpdateOrgQProfilesToPointToBuiltInProfiles(Database db) {
- super(db);
- }
-
- @Override
- protected void execute(Context context) throws SQLException {
- if (!isOrganizationEnabled(context)) {
- return;
- }
-
- String defaultOrganizationUuid = getDefaultOrganizationUuid(context);
- BuiltInRulesProfiles builtInRulesProfiles = retrieveBuiltInRulesProfiles(context);
-
- MassUpdate massUpdate = context.prepareMassUpdate()
- .rowPluralName("org qprofiles");
-
- massUpdate.select("select oqp.uuid, rp.language, rp.name " +
- " from org_qprofiles oqp " +
- " inner join rules_profiles rp on rp.kee = oqp.rules_profile_uuid " +
- " where oqp.organization_uuid <> ? " +
- " and rp.is_built_in = ? " +
- " and oqp.user_updated_at is null")
- .setString(1, defaultOrganizationUuid)
- .setBoolean(2, false);
-
- massUpdate.update("update org_qprofiles " +
- "set rules_profile_uuid = ? " +
- "where uuid=?");
-
- massUpdate.execute((row, update) -> {
- String orgQProfileUuid = row.getString(1);
- String language = row.getString(2);
- String name = row.getString(3);
- if (!builtInRulesProfiles.contains(name, language)) {
- return false;
- }
-
- update.setString(1, builtInRulesProfiles.get(name, language));
- update.setString(2, orgQProfileUuid);
- return true;
- });
- }
-
- private static String getDefaultOrganizationUuid(Context context) throws SQLException {
- String defaultOrganizationUuid = context.prepareSelect("select text_value from internal_properties where kee=?")
- .setString(1, PROP_DEFAULT_ORGANIZATION_UUID)
- .get(row -> row.getString(1));
-
- checkState(defaultOrganizationUuid != null, "Missing internal property: '%s'", PROP_DEFAULT_ORGANIZATION_UUID);
-
- return defaultOrganizationUuid;
- }
-
- private static boolean isOrganizationEnabled(Context context) throws SQLException {
- String value = context.prepareSelect("select text_value from internal_properties where kee=?")
- .setString(1, PROP_ORGANIZATION_ENABLED)
- .get(row -> row.getNullableString(1));
-
- return "true".equals(value);
- }
-
- private static BuiltInRulesProfiles retrieveBuiltInRulesProfiles(Context context) throws SQLException {
- BuiltInRulesProfiles result = new BuiltInRulesProfiles();
-
- context.prepareSelect("select name, language, kee" +
- " from rules_profiles " +
- " where is_built_in = ? ")
- .setBoolean(1, true)
- .list(row -> result.put(row.getString(1), row.getString(2), row.getString(3)));
-
- return result;
- }
-
- private static class BuiltInRulesProfiles {
- private Table table = HashBasedTable.create();
-
- private String put(String name, String language, String rulesProfileUuid) {
- return table.put(name, language, rulesProfileUuid);
- }
-
- private boolean contains(String name, String language) {
- return table.contains(name, language);
- }
-
- private String get(String name, String language) {
- return table.get(name, language);
- }
- }
-
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/package-info.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/package-info.java
deleted file mode 100644
index 7d3f43d407c..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/package-info.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public 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.v65;
-
-import javax.annotation.ParametersAreNonnullByDefault;
-
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v66/AddBranchColumnToProjectsTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v66/AddBranchColumnToProjectsTable.java
deleted file mode 100644
index 4cbc35625fe..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v66/AddBranchColumnToProjectsTable.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v66;
-
-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 AddBranchColumnToProjectsTable extends DdlChange {
-
- public AddBranchColumnToProjectsTable(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute(new AddColumnsBuilder(getDialect(), "projects")
- .addColumn(VarcharColumnDef.newVarcharColumnDefBuilder()
- .setColumnName("main_branch_project_uuid")
- .setLimit(50)
- .setIsNullable(true)
- .build())
- .build());
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v66/AddErrorTypeColumnToCeActivityTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v66/AddErrorTypeColumnToCeActivityTable.java
deleted file mode 100644
index 89f18a32ac0..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v66/AddErrorTypeColumnToCeActivityTable.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v66;
-
-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 AddErrorTypeColumnToCeActivityTable extends DdlChange {
-
- public AddErrorTypeColumnToCeActivityTable(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute(new AddColumnsBuilder(getDialect(), "ce_activity")
- .addColumn(VarcharColumnDef.newVarcharColumnDefBuilder()
- .setColumnName("error_type")
- .setLimit(20)
- .setIsNullable(true)
- .build())
- .build());
- }
-}
-
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v66/AddIndexOnProjectBranchesKey.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v66/AddIndexOnProjectBranchesKey.java
deleted file mode 100644
index a4dee131644..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v66/AddIndexOnProjectBranchesKey.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v66;
-
-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 AddIndexOnProjectBranchesKey extends DdlChange {
- public AddIndexOnProjectBranchesKey(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute(
- new CreateIndexBuilder()
- .setTable("project_branches")
- .setName("project_branches_kee")
- .setUnique(true)
- .addColumn(VarcharColumnDef.newVarcharColumnDefBuilder()
- .setColumnName("project_uuid")
- .setIsNullable(false)
- .setLimit(50)
- .build())
- .addColumn(VarcharColumnDef.newVarcharColumnDefBuilder()
- .setColumnName("kee")
- .setIsNullable(false)
- .setLimit(255)
- .build())
- .build());
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v66/AddPluginKeyToRules.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v66/AddPluginKeyToRules.java
deleted file mode 100644
index bfe1921359e..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v66/AddPluginKeyToRules.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v66;
-
-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 AddPluginKeyToRules extends DdlChange {
-
- public AddPluginKeyToRules(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute(new AddColumnsBuilder(getDialect(), "rules")
- .addColumn(newVarcharColumnDefBuilder()
- .setColumnName("plugin_key")
- .setLimit(CreateTablePlugins.PLUGIN_KEY_MAX_SIZE)
- .setIsNullable(true)
- .build())
- .build());
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v66/CreateTableCeTaskCharacteristics.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v66/CreateTableCeTaskCharacteristics.java
deleted file mode 100644
index 0ee0110fad2..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v66/CreateTableCeTaskCharacteristics.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v66;
-
-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.VarcharColumnDef.UUID_SIZE;
-import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder;
-
-public class CreateTableCeTaskCharacteristics extends DdlChange {
- private static final String TABLE_NAME = "ce_task_characteristics";
-
- public CreateTableCeTaskCharacteristics(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- VarcharColumnDef uuidColumn = newVarcharColumnDefBuilder()
- .setColumnName("uuid")
- .setLimit(UUID_SIZE)
- .setIsNullable(false)
- .setIgnoreOracleUnit(true)
- .build();
- VarcharColumnDef ceTaskUuidColumn = newVarcharColumnDefBuilder()
- .setColumnName("task_uuid")
- .setLimit(UUID_SIZE)
- .setIsNullable(false)
- .setIgnoreOracleUnit(true)
- .build();
- VarcharColumnDef keyColumn = newVarcharColumnDefBuilder()
- .setColumnName("kee")
- .setLimit(512)
- .setIsNullable(false)
- .setIgnoreOracleUnit(true)
- .build();
- VarcharColumnDef valueColumn = newVarcharColumnDefBuilder()
- .setColumnName("text_value")
- .setLimit(512)
- .setIsNullable(true)
- .setIgnoreOracleUnit(true)
- .build();
-
- context.execute(
- new CreateTableBuilder(getDialect(), TABLE_NAME)
- .addPkColumn(uuidColumn)
- .addColumn(ceTaskUuidColumn)
- .addColumn(keyColumn)
- .addColumn(valueColumn)
- .build());
-
- context.execute(
- new CreateIndexBuilder()
- .setTable(TABLE_NAME)
- .setName("ce_characteristics_" + ceTaskUuidColumn.getName())
- .addColumn(ceTaskUuidColumn)
- .setUnique(false)
- .build());
- }
-
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v66/CreateTablePlugins.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v66/CreateTablePlugins.java
deleted file mode 100644
index 8d01c12442c..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v66/CreateTablePlugins.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v66;
-
-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 CreateTablePlugins extends DdlChange {
-
- static final int PLUGIN_KEY_MAX_SIZE = 200;
- private static final String TABLE_NAME = "plugins";
-
- public CreateTablePlugins(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- VarcharColumnDef keyColumn = newVarcharColumnDefBuilder()
- .setColumnName("kee")
- .setLimit(PLUGIN_KEY_MAX_SIZE)
- .setIsNullable(false)
- .build();
- context.execute(
- new CreateTableBuilder(getDialect(), TABLE_NAME)
- .addPkColumn(newVarcharColumnDefBuilder().setColumnName("uuid").setLimit(UUID_SIZE).setIsNullable(false).setIgnoreOracleUnit(true).build())
- .addColumn(keyColumn)
- .addColumn(newVarcharColumnDefBuilder()
- .setColumnName("base_plugin_key")
- .setLimit(PLUGIN_KEY_MAX_SIZE)
- .setIsNullable(true)
- .build())
- .addColumn(newVarcharColumnDefBuilder()
- .setColumnName("file_hash")
- .setLimit(200)
- .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("plugins_key")
- .addColumn(keyColumn)
- .setUnique(true)
- .build());
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v66/CreateTableProjectBranches.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v66/CreateTableProjectBranches.java
deleted file mode 100644
index 811659f8014..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v66/CreateTableProjectBranches.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v66;
-
-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.CreateTableBuilder;
-import org.sonar.server.platform.db.migration.step.DdlChange;
-
-public class CreateTableProjectBranches extends DdlChange {
-
- private static final String TABLE_NAME = "project_branches";
-
- public CreateTableProjectBranches(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute(new CreateTableBuilder(getDialect(), TABLE_NAME)
- .addPkColumn(VarcharColumnDef.newVarcharColumnDefBuilder()
- .setColumnName("uuid")
- .setIsNullable(false)
- .setLimit(50)
- .build())
- .addColumn(VarcharColumnDef.newVarcharColumnDefBuilder()
- .setColumnName("project_uuid")
- .setIsNullable(false)
- .setLimit(50)
- .build())
- .addColumn(VarcharColumnDef.newVarcharColumnDefBuilder()
- .setColumnName("kee")
- .setIsNullable(false)
- .setLimit(255)
- .build())
- .addColumn(VarcharColumnDef.newVarcharColumnDefBuilder()
- .setColumnName("branch_type")
- .setIsNullable(true)
- .setLimit(5)
- .build())
- .addColumn(VarcharColumnDef.newVarcharColumnDefBuilder()
- .setColumnName("merge_branch_uuid")
- .setIsNullable(true)
- .setLimit(50)
- .build())
- .addColumn(BigIntegerColumnDef.newBigIntegerColumnDefBuilder()
- .setColumnName("created_at")
- .setIsNullable(false)
- .build())
- .addColumn(BigIntegerColumnDef.newBigIntegerColumnDefBuilder()
- .setColumnName("updated_at")
- .setIsNullable(false)
- .build())
- .build()
- );
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v66/CreateTableQProfileEditGroups.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v66/CreateTableQProfileEditGroups.java
deleted file mode 100644
index 343b5503089..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v66/CreateTableQProfileEditGroups.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v66;
-
-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.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;
-
-public class CreateTableQProfileEditGroups extends DdlChange {
-
- private static final String TABLE_NAME = "qprofile_edit_groups";
-
- public CreateTableQProfileEditGroups(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- IntegerColumnDef groupColumn = IntegerColumnDef.newIntegerColumnDefBuilder()
- .setColumnName("group_id")
- .setIsNullable(false)
- .build();
- VarcharColumnDef qProfileUuidColumn = VarcharColumnDef.newVarcharColumnDefBuilder()
- .setColumnName("qprofile_uuid")
- .setIsNullable(false)
- .setLimit(255)
- .build();
- context.execute(new CreateTableBuilder(getDialect(), TABLE_NAME)
- .addPkColumn(VarcharColumnDef.newVarcharColumnDefBuilder()
- .setColumnName("uuid")
- .setIsNullable(false)
- .setLimit(40)
- .build())
- .addColumn(groupColumn)
- .addColumn(qProfileUuidColumn)
- .addColumn(newBigIntegerColumnDefBuilder()
- .setColumnName("created_at")
- .setIsNullable(false)
- .build())
- .build()
- );
-
- context.execute(
- new CreateIndexBuilder()
- .setTable(TABLE_NAME)
- .setName(TABLE_NAME + "_qprofile")
- .addColumn(qProfileUuidColumn)
- .setUnique(false)
- .build());
- context.execute(
- new CreateIndexBuilder()
- .setTable(TABLE_NAME)
- .setName(TABLE_NAME + "_unique")
- .addColumn(groupColumn)
- .addColumn(qProfileUuidColumn)
- .setUnique(true)
- .build());
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v66/CreateTableQProfileEditUsers.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v66/CreateTableQProfileEditUsers.java
deleted file mode 100644
index e4a30279042..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v66/CreateTableQProfileEditUsers.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v66;
-
-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.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;
-
-public class CreateTableQProfileEditUsers extends DdlChange {
-
- private static final String TABLE_NAME = "qprofile_edit_users";
-
- public CreateTableQProfileEditUsers(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- IntegerColumnDef userLoginColumn = IntegerColumnDef.newIntegerColumnDefBuilder()
- .setColumnName("user_id")
- .setIsNullable(false)
- .build();
- VarcharColumnDef qProfileUuidColumn = VarcharColumnDef.newVarcharColumnDefBuilder()
- .setColumnName("qprofile_uuid")
- .setIsNullable(false)
- .setLimit(255)
- .build();
- context.execute(new CreateTableBuilder(getDialect(), TABLE_NAME)
- .addPkColumn(VarcharColumnDef.newVarcharColumnDefBuilder()
- .setColumnName("uuid")
- .setIsNullable(false)
- .setLimit(40)
- .build())
- .addColumn(userLoginColumn)
- .addColumn(qProfileUuidColumn)
- .addColumn(newBigIntegerColumnDefBuilder()
- .setColumnName("created_at")
- .setIsNullable(false)
- .build())
- .build()
- );
-
- context.execute(
- new CreateIndexBuilder()
- .setTable(TABLE_NAME)
- .setName(TABLE_NAME + "_qprofile")
- .addColumn(qProfileUuidColumn)
- .setUnique(false)
- .build());
- context.execute(
- new CreateIndexBuilder()
- .setTable(TABLE_NAME)
- .setName(TABLE_NAME + "_unique")
- .addColumn(userLoginColumn)
- .addColumn(qProfileUuidColumn)
- .setUnique(true)
- .build());
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v66/DbVersion66.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v66/DbVersion66.java
deleted file mode 100644
index 4fc07e12a55..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v66/DbVersion66.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v66;
-
-import org.sonar.server.platform.db.migration.step.MigrationStepRegistry;
-import org.sonar.server.platform.db.migration.version.DbVersion;
-
-public class DbVersion66 implements DbVersion {
- @Override
- public void addSteps(MigrationStepRegistry registry) {
- registry
- .add(1801, "Create table CE task characteristics", CreateTableCeTaskCharacteristics.class)
- .add(1802, "Delete leak settings on views", DeleteLeakSettingsOnViews.class)
- .add(1803, "Fix empty USERS.EXTERNAL_IDENTITY and USERS.EXTERNAL_IDENTITY_PROVIDER", FixEmptyIdentityProviderInUsers.class)
- .add(1804, "Add rules.plugin_key", AddPluginKeyToRules.class)
- .add(1805, "Create table plugins", CreateTablePlugins.class)
- .add(1806, "Create table project_branches", CreateTableProjectBranches.class)
- .add(1807, "Add on project_branches key", AddIndexOnProjectBranchesKey.class)
- .add(1808, "Add branch column to projects table", AddBranchColumnToProjectsTable.class)
- .add(1809, "Populate project_branches with existing main branches", PopulateMainProjectBranches.class)
- .add(1810, "Add ce_activity.error_type", AddErrorTypeColumnToCeActivityTable.class)
- .add(1811, "Create table qprofile_edit_users", CreateTableQProfileEditUsers.class)
- .add(1812, "Create table qprofile_edit_groups", CreateTableQProfileEditGroups.class)
- .add(1814, "Purge table properties", PurgeTableProperties.class)
- ;
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v66/DeleteLeakSettingsOnViews.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v66/DeleteLeakSettingsOnViews.java
deleted file mode 100644
index 6b4bacfd3d9..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v66/DeleteLeakSettingsOnViews.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v66;
-
-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 DeleteLeakSettingsOnViews extends DataChange {
-
- public DeleteLeakSettingsOnViews(Database db) {
- super(db);
- }
-
- @Override
- protected void execute(Context context) throws SQLException {
- MassUpdate massUpdate = context.prepareMassUpdate();
- massUpdate.select("SELECT prop.id FROM properties prop " +
- "INNER JOIN projects p ON p.id=prop.resource_id AND p.qualifier NOT IN ('TRK') " +
- "WHERE prop.prop_key='sonar.leak.period' or prop.prop_key='sonar.timemachine.period1' ");
- massUpdate.update("DELETE FROM properties WHERE id=?");
- massUpdate.rowPluralName("properties");
- massUpdate.execute((row, update) -> {
- update.setLong(1, row.getLong(1));
- return true;
- });
- }
-
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v66/FixEmptyIdentityProviderInUsers.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v66/FixEmptyIdentityProviderInUsers.java
deleted file mode 100644
index 0d369869044..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v66/FixEmptyIdentityProviderInUsers.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v66;
-
-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 FixEmptyIdentityProviderInUsers extends DataChange {
-
- private static final String SQ_AUTHORITY = "sonarqube";
-
- private final System2 system2;
-
- public FixEmptyIdentityProviderInUsers(Database db, System2 system2) {
- super(db);
- this.system2 = system2;
- }
-
- @Override
- protected void execute(Context context) throws SQLException {
- long now = system2.now();
- MassUpdate massUpdate = context.prepareMassUpdate();
- massUpdate.select("select u.id, u.login from users u " +
- "where u.external_identity is null or u.external_identity_provider is null");
- massUpdate.update("update users set external_identity = ?, external_identity_provider = ?, updated_at = ? where id = ?");
- massUpdate.rowPluralName("users without external identity information");
- massUpdate.execute((row, update) -> {
- update.setString(1, row.getString(2));
- update.setString(2, SQ_AUTHORITY);
- update.setLong(3, now);
- update.setLong(4, row.getLong(1));
- return true;
- });
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v66/PopulateMainProjectBranches.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v66/PopulateMainProjectBranches.java
deleted file mode 100644
index 7f4df2982ee..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v66/PopulateMainProjectBranches.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v66;
-
-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 PopulateMainProjectBranches extends DataChange {
-
- private static final String MAIN_BRANCH_NAME = "master";
-
- private final System2 system2;
-
- public PopulateMainProjectBranches(Database db, System2 system2) {
- super(db);
- this.system2 = system2;
- }
-
- @Override
- protected void execute(Context context) throws SQLException {
- long now = system2.now();
- MassUpdate massUpdate = context.prepareMassUpdate();
- massUpdate.select("SELECT uuid FROM projects p "
- + "WHERE p.scope='PRJ' AND p.qualifier='TRK' AND p.main_branch_project_uuid IS NULL "
- + "AND NOT EXISTS (SELECT uuid FROM project_branches b WHERE b.uuid = p.uuid)");
- massUpdate.update("INSERT INTO project_branches (uuid, project_uuid, kee, branch_type, "
- + "merge_branch_uuid, created_at, updated_at) VALUES (?, ?, ?, ?, ?, ?, ?)");
- massUpdate.rowPluralName("projects");
- massUpdate.execute((row, update) -> {
- String uuid = row.getString(1);
- update.setString(1, uuid);
- update.setString(2, uuid);
- update.setString(3, MAIN_BRANCH_NAME);
- update.setString(4, "LONG");
- update.setString(5, null);
- update.setLong(6, now);
- update.setLong(7, now);
- return true;
- });
- }
-
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v66/PurgeTableProperties.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v66/PurgeTableProperties.java
deleted file mode 100644
index 94330a912ec..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v66/PurgeTableProperties.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v66;
-
-import java.sql.SQLException;
-import org.sonar.db.Database;
-import org.sonar.server.platform.db.migration.step.DataChange;
-
-public class PurgeTableProperties extends DataChange {
-
- public PurgeTableProperties(Database db) {
- super(db);
- }
-
- @Override
- protected void execute(Context context) throws SQLException {
- deleteByKey(context, "views.analysisDelayingInMinutes");
- deleteByKey(context, "views.status");
- deleteByKeyPrefix(context, "sonar.views.license");
- deleteByKeyPrefix(context, "views.license");
- deleteByKeyPrefix(context, "masterproject.");
-
- deleteByKeyPrefix(context, "sonar.sqale.");
- deleteByKeyPrefix(context, "sqale.license");
- deleteByKeyPrefix(context, "devcockpit.");
- deleteByKeyPrefix(context, "sonar.devcockpit.");
-
- deleteByKey(context, "sonar.core.version");
- deleteByKey(context, "sonar.issuesdensity.weight");
- deleteByKeyPrefix(context, "sonar.reports.");
- deleteByKeyPrefix(context, "sonar.report.license");
- deleteByKeyPrefix(context, "sonar.natural.");
- deleteByKeyPrefix(context, "sonarsource.natural.");
- deleteByKeyPrefix(context, "sonarsource.identity.");
- deleteByKeyPrefix(context, "sonar.build-stability.");
- }
-
- private static void deleteByKey(Context context, String key) throws SQLException {
- context.prepareUpsert("delete from properties where prop_key = ?")
- .setString(1, key)
- .execute()
- .commit();
- }
-
- private static void deleteByKeyPrefix(Context context, String key) throws SQLException {
- context.prepareUpsert("delete from properties where prop_key like ?")
- .setString(1, key + "%")
- .execute()
- .commit();
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v66/package-info.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v66/package-info.java
deleted file mode 100644
index 51d633b960a..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v66/package-info.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public 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.v66;
-
-import javax.annotation.ParametersAreNonnullByDefault;
-
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v67/AddAnalysisUuidToWebhookDeliveries.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v67/AddAnalysisUuidToWebhookDeliveries.java
deleted file mode 100644
index d0e98d93799..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v67/AddAnalysisUuidToWebhookDeliveries.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v67;
-
-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 AddAnalysisUuidToWebhookDeliveries extends DdlChange {
-
- public static final String TABLE = "webhook_deliveries";
-
- public static final VarcharColumnDef ANALYSIS_UUID_COLUMN = VarcharColumnDef.newVarcharColumnDefBuilder()
- .setColumnName("analysis_uuid")
- .setLimit(40)
- .setIsNullable(true)
- .build();
-
- public AddAnalysisUuidToWebhookDeliveries(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute(new AddColumnsBuilder(getDialect(), TABLE)
- .addColumn(ANALYSIS_UUID_COLUMN)
- .build());
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v67/CleanupDisabledUsers.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v67/CleanupDisabledUsers.java
deleted file mode 100644
index 120f0d93b90..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v67/CleanupDisabledUsers.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v67;
-
-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 CleanupDisabledUsers extends DataChange {
-
- private final System2 system2;
- private final String falseValue;
-
- public CleanupDisabledUsers(Database db, System2 system2) {
- super(db);
- this.falseValue = db.getDialect().getFalseSqlValue();
- this.system2 = system2;
- }
-
- @Override
- protected void execute(Context context) throws SQLException {
- long now = system2.now();
-
- MassUpdate massUpdate = context.prepareMassUpdate();
- massUpdate.select("select u.id from users u " +
- "where u.active = " + falseValue + " and " +
- "( email is not null or " +
- " crypted_password is not null or " +
- " salt is not null or " +
- " external_identity is not null or " +
- " external_identity_provider is not null ) ");
- massUpdate.update("update users set " +
- " email = null, " +
- " crypted_password = null, " +
- " salt = null, " +
- " external_identity = null, " +
- " external_identity_provider = null, " +
- " updated_at = ? " +
- " where id = ?");
- massUpdate.rowPluralName("deactivated users");
- massUpdate.execute((row, update) -> {
- update.setLong(1, now);
- 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/v67/CopyDeprecatedServerId.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v67/CopyDeprecatedServerId.java
deleted file mode 100644
index 3768c4bc1fc..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v67/CopyDeprecatedServerId.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v67;
-
-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.Select;
-
-public class CopyDeprecatedServerId extends DataChange {
-
- private static final String DEPRECATED_KEY = "sonar.server_id";
- private static final String NEW_KEY = "sonar.core.id";
-
- public CopyDeprecatedServerId(Database db) {
- super(db);
- }
-
- @Override
- protected void execute(Context context) throws SQLException {
- String deprecatedValue = context
- .prepareSelect("select text_value from properties where prop_key = '" + DEPRECATED_KEY + "'")
- .get(new Select.StringReader());
- if (deprecatedValue != null && !deprecatedValue.isEmpty()) {
- deleteProperty(context, NEW_KEY);
- context.prepareUpsert("insert into properties" +
- " (prop_key, is_empty, text_value, created_at)" +
- " values " +
- " (?, ?, ?, ?)")
- .setString(1, NEW_KEY)
- .setBoolean(2, false)
- .setString(3, deprecatedValue)
- .setLong(4, System.currentTimeMillis())
- .execute()
- .commit();
- }
- deleteProperty(context, DEPRECATED_KEY);
- }
-
- private static void deleteProperty(Context context, String key) throws SQLException {
- context.prepareUpsert("delete from properties where prop_key = '" + key + "'")
- .execute()
- .commit();
- }
-
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v67/CreateTableAnalysisProperties.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v67/CreateTableAnalysisProperties.java
deleted file mode 100644
index dc07ef8a224..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v67/CreateTableAnalysisProperties.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v67;
-
-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.ClobColumnDef;
-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;
-
-public class CreateTableAnalysisProperties extends DdlChange {
- private static final String TABLE_NAME = "analysis_properties";
- private static final String SNAPSHOT_UUID = "snapshot_uuid";
- private static final VarcharColumnDef SNAPSHOT_UUID_COLUMN = VarcharColumnDef.newVarcharColumnDefBuilder()
- .setColumnName(SNAPSHOT_UUID)
- .setIsNullable(false)
- .setLimit(VarcharColumnDef.UUID_SIZE)
- .build();
-
- public CreateTableAnalysisProperties(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute(new CreateTableBuilder(getDialect(), TABLE_NAME)
- .addPkColumn(VarcharColumnDef.newVarcharColumnDefBuilder()
- .setColumnName("uuid")
- .setIsNullable(false)
- .setLimit(VarcharColumnDef.UUID_SIZE)
- .build())
- .addColumn(SNAPSHOT_UUID_COLUMN)
- .addColumn(VarcharColumnDef.newVarcharColumnDefBuilder()
- .setColumnName("kee")
- .setIsNullable(false)
- .setLimit(512)
- .build())
- .addColumn(VarcharColumnDef.newVarcharColumnDefBuilder()
- .setColumnName("text_value")
- .setIsNullable(true)
- .setLimit(VarcharColumnDef.MAX_SIZE)
- .build())
- .addColumn(ClobColumnDef.newClobColumnDefBuilder()
- .setColumnName("clob_value")
- .setIsNullable(true)
- .build())
- .addColumn(BooleanColumnDef.newBooleanColumnDefBuilder()
- .setColumnName("is_empty")
- .setIsNullable(false)
- .build())
- .addColumn(BigIntegerColumnDef.newBigIntegerColumnDefBuilder()
- .setColumnName("created_at")
- .setIsNullable(false)
- .build())
- .build()
- );
-
- context.execute(new CreateIndexBuilder()
- .addColumn(SNAPSHOT_UUID_COLUMN)
- .setUnique(false)
- .setTable(TABLE_NAME)
- .setName("ix_snapshot_uuid")
- .build()
- );
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v67/DbVersion67.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v67/DbVersion67.java
deleted file mode 100644
index 3aed8788581..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v67/DbVersion67.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v67;
-
-import org.sonar.server.platform.db.migration.step.MigrationStepRegistry;
-import org.sonar.server.platform.db.migration.version.DbVersion;
-
-public class DbVersion67 implements DbVersion {
- @Override
- public void addSteps(MigrationStepRegistry registry) {
- registry
- .add(1830, "Copy deprecated server ID", CopyDeprecatedServerId.class)
- .add(1831, "Add webhook_deliveries.analysis_uuid", AddAnalysisUuidToWebhookDeliveries.class)
- .add(1832, "Create table ANALYSIS_PROPERTIES", CreateTableAnalysisProperties.class)
- .add(1833, "Cleanup disabled users", CleanupDisabledUsers.class)
- .add(1834, "Set WEBHOOK_DELIVERIES.CE_TASK_UUID as nullable", UpdateCeTaskUuidColumnToNullableOnWebhookDeliveries.class)
- .add(1835, "Populate WEBHOOK_DELIVERIES.ANALYSIS_UUID", PopulateAnalysisUuidColumnOnWebhookDeliveries.class)
- .add(1836, "Migrate 'previous_analysis' leak periods to 'previous_version'", MigratePreviousAnalysisToPreviousVersion.class)
- .add(1837, "Drop old licenses", DropOldLicenses.class)
- ;
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v67/DropOldLicenses.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v67/DropOldLicenses.java
deleted file mode 100644
index e429af9d0ae..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v67/DropOldLicenses.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v67;
-
-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 DropOldLicenses extends DataChange {
-
- private static final String LICENSE_HASH_SECURED_SUFFIX = ".licenseHash.secured";
- private static final String LICENSE_SECURED_SUFFIX = ".license.secured";
-
- public DropOldLicenses(Database db) {
- super(db);
- }
-
- @Override
- protected void execute(Context context) throws SQLException {
- MassUpdate massUpdate = context.prepareMassUpdate();
- massUpdate.select("select prop_key from properties where prop_key like ?")
- .setString(1, "%" + LICENSE_HASH_SECURED_SUFFIX);
- massUpdate.update("delete from properties where prop_key = ? or prop_key = ?");
- massUpdate.rowPluralName("old license properties");
- massUpdate.execute((row, update) -> {
- String licenseHashKey = row.getString(1);
- String licenseKey = licenseHashKey.replace(LICENSE_HASH_SECURED_SUFFIX, "") + LICENSE_SECURED_SUFFIX;
- update.setString(1, licenseHashKey);
- update.setString(2, licenseKey);
- return true;
- });
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v67/MigratePreviousAnalysisToPreviousVersion.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v67/MigratePreviousAnalysisToPreviousVersion.java
deleted file mode 100644
index b7e0dc901a3..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v67/MigratePreviousAnalysisToPreviousVersion.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v67;
-
-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 MigratePreviousAnalysisToPreviousVersion extends DataChange {
-
- public MigratePreviousAnalysisToPreviousVersion(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 = 'sonar.leak.period' and text_value='previous_analysis'");
- massUpdate.update("update properties " +
- " set text_value='previous_version', " +
- " clob_value = null " +
- " where id = ?");
- massUpdate.rowPluralName("leak periods");
- massUpdate.execute((row, update) -> {
- update.setLong(1, row.getLong(1));
- return true;
- });
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v67/PopulateAnalysisUuidColumnOnWebhookDeliveries.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v67/PopulateAnalysisUuidColumnOnWebhookDeliveries.java
deleted file mode 100644
index afdf06b5042..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v67/PopulateAnalysisUuidColumnOnWebhookDeliveries.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v67;
-
-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.step.Select;
-import org.sonar.server.platform.db.migration.step.SqlStatement;
-
-public class PopulateAnalysisUuidColumnOnWebhookDeliveries extends DataChange {
-
- public PopulateAnalysisUuidColumnOnWebhookDeliveries(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- MassUpdate massUpdate = context.prepareMassUpdate();
- massUpdate.select("SELECT wd.uuid, ca.analysis_uuid " +
- " FROM webhook_deliveries wd " +
- " INNER JOIN ce_activity ca ON ca.uuid=wd.ce_task_uuid " +
- " WHERE wd.analysis_uuid IS NULL AND ca.analysis_uuid IS NOT NULL");
- massUpdate.update("UPDATE webhook_deliveries SET analysis_uuid=? WHERE uuid=?");
- massUpdate.rowPluralName("webhook_deliveries");
- massUpdate.execute(PopulateAnalysisUuidColumnOnWebhookDeliveries::handle);
- }
-
- private static boolean handle(Select.Row row, SqlStatement update) throws SQLException {
- String uuid = row.getString(1);
- String analysisUuid = row.getString(2);
-
- update.setString(1, analysisUuid);
- update.setString(2, uuid);
-
- return true;
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v67/UpdateCeTaskUuidColumnToNullableOnWebhookDeliveries.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v67/UpdateCeTaskUuidColumnToNullableOnWebhookDeliveries.java
deleted file mode 100644
index 5ca3cb6e185..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v67/UpdateCeTaskUuidColumnToNullableOnWebhookDeliveries.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v67;
-
-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 UpdateCeTaskUuidColumnToNullableOnWebhookDeliveries extends DdlChange {
-
- public static final String TABLE_WEBHOOK_DELIVERIES = "webhook_deliveries";
-
- public UpdateCeTaskUuidColumnToNullableOnWebhookDeliveries(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute(new AlterColumnsBuilder(getDialect(), TABLE_WEBHOOK_DELIVERIES)
- .updateColumn(VarcharColumnDef.newVarcharColumnDefBuilder()
- .setColumnName("ce_task_uuid")
- .setLimit(40)
- .setIsNullable(true)
- .build())
- .build());
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v67/package-info.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v67/package-info.java
deleted file mode 100644
index 0cac353ade8..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v67/package-info.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public 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.v67;
-
-import javax.annotation.ParametersAreNonnullByDefault;
-
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/AddDefaultQualityGateUuidToOrganizations.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/AddDefaultQualityGateUuidToOrganizations.java
deleted file mode 100644
index 2a6570b682b..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/AddDefaultQualityGateUuidToOrganizations.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v70;
-
-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 AddDefaultQualityGateUuidToOrganizations extends DdlChange {
- public AddDefaultQualityGateUuidToOrganizations(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute(new AddColumnsBuilder(getDialect(), "organizations")
- .addColumn(newVarcharColumnDefBuilder()
- .setColumnName("default_quality_gate_uuid")
- .setIsNullable(true)
- .setLimit(VarcharColumnDef.UUID_SIZE)
- .build())
- .build());
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/AddHomepageToUsers.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/AddHomepageToUsers.java
deleted file mode 100644
index def7b2374ed..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/AddHomepageToUsers.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v70;
-
-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 AddHomepageToUsers extends DdlChange {
-
- public AddHomepageToUsers(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute(new AddColumnsBuilder(getDialect(), "users")
- .addColumn(newVarcharColumnDefBuilder()
- .setColumnName("homepage_type")
- .setIsNullable(true)
- .setLimit(40)
- .build())
- .addColumn(newVarcharColumnDefBuilder()
- .setColumnName("homepage_parameter")
- .setIsNullable(true)
- .setLimit(40)
- .build())
- .build());
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/AddIsBuiltInToQualityGates.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/AddIsBuiltInToQualityGates.java
deleted file mode 100644
index 6235a3fbca3..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/AddIsBuiltInToQualityGates.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v70;
-
-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.BooleanColumnDef.newBooleanColumnDefBuilder;
-
-public class AddIsBuiltInToQualityGates extends DdlChange {
-
- public AddIsBuiltInToQualityGates(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute(new AddColumnsBuilder(getDialect(), "quality_gates")
- .addColumn(newBooleanColumnDefBuilder()
- .setColumnName("is_built_in")
- .setIsNullable(true)
- .build())
- .build());
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/AddLiveMeasuresMetricIndex.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/AddLiveMeasuresMetricIndex.java
deleted file mode 100644
index e2de5885439..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/AddLiveMeasuresMetricIndex.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v70;
-
-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;
-
-import static org.sonar.server.platform.db.migration.def.IntegerColumnDef.newIntegerColumnDefBuilder;
-import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.UUID_VARCHAR_SIZE;
-import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder;
-
-/**
- * Add this index only once table is populated to improve efficiency of populating the table.
- */
-public class AddLiveMeasuresMetricIndex extends DdlChange {
-
- private static final String TABLE_NAME = "live_measures";
-
- public AddLiveMeasuresMetricIndex(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute(new CreateIndexBuilder()
- .addColumn(newVarcharColumnDefBuilder()
- .setColumnName("component_uuid")
- .setIsNullable(false)
- .setLimit(UUID_VARCHAR_SIZE)
- .build())
- .addColumn(newIntegerColumnDefBuilder()
- .setColumnName("metric_id")
- .setIsNullable(false)
- .build())
- .setUnique(true)
- .setTable(TABLE_NAME)
- .setName("live_measures_component")
- .build());
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/AddSnapshotIsLastIndex.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/AddSnapshotIsLastIndex.java
deleted file mode 100644
index 6402e262a32..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/AddSnapshotIsLastIndex.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v70;
-
-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;
-
-import static org.sonar.server.platform.db.migration.def.BooleanColumnDef.newBooleanColumnDefBuilder;
-
-public class AddSnapshotIsLastIndex extends DdlChange {
- static final String TABLE_NAME = "snapshots";
- static final String INDEX_NAME = "ix_snapshot_is_last";
-
- public AddSnapshotIsLastIndex(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute(
- new CreateIndexBuilder()
- .setTable(TABLE_NAME)
- .setName(INDEX_NAME)
- .setUnique(false)
- .addColumn(newBooleanColumnDefBuilder().setColumnName("islast").setIsNullable(false).setDefaultValue(false).build())
- .build());
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/AddUuidToQualityGates.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/AddUuidToQualityGates.java
deleted file mode 100644
index b0664802232..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/AddUuidToQualityGates.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v70;
-
-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 AddUuidToQualityGates extends DdlChange {
-
- public AddUuidToQualityGates(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute(new AddColumnsBuilder(getDialect(), "quality_gates")
- .addColumn(VarcharColumnDef.newVarcharColumnDefBuilder()
- .setColumnName("uuid")
- .setIsNullable(true)
- .setLimit(VarcharColumnDef.UUID_SIZE)
- .build())
- .build());
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/AssociateQualityGatesToDefaultOrganization.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/AssociateQualityGatesToDefaultOrganization.java
deleted file mode 100644
index 1cf35fdfac1..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/AssociateQualityGatesToDefaultOrganization.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v70;
-
-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;
-
-import static com.google.common.base.Preconditions.checkState;
-
-public class AssociateQualityGatesToDefaultOrganization extends DataChange {
-
- private final UuidFactory uuidFactory;
-
- public AssociateQualityGatesToDefaultOrganization(Database db, UuidFactory uuidFactory) {
- super(db);
- this.uuidFactory = uuidFactory;
- }
-
- @Override
- protected void execute(Context context) throws SQLException {
- String defaultOrgUuid = context.prepareSelect("select text_value from internal_properties where kee = 'organization.default'")
- .get(row -> row.getString(1));
-
- checkState(defaultOrgUuid != null, "Default organization uuid is missing");
-
- MassUpdate massUpdate = context.prepareMassUpdate();
- massUpdate.select("SELECT qg.uuid from quality_gates qg " +
- " WHERE qg.is_built_in = ? " +
- " AND NOT EXISTS (SELECT 1 FROM org_quality_gates oqg WHERE oqg.quality_gate_uuid = qg.uuid AND oqg.organization_uuid = ?)")
- .setBoolean(1, false)
- .setString(2, defaultOrgUuid);
- massUpdate.rowPluralName("quality gates");
- massUpdate.update("insert into org_quality_gates (uuid, quality_gate_uuid, organization_uuid) values(?, ?, ?)");
- massUpdate.execute((row, update) -> {
- update.setString(1, uuidFactory.create());
- update.setString(2, row.getString(1));
- update.setString(3, defaultOrgUuid);
- return true;
- });
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/CreateBuiltInQualityGate.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/CreateBuiltInQualityGate.java
deleted file mode 100644
index 4ae58f41d86..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/CreateBuiltInQualityGate.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v70;
-
-import java.sql.SQLException;
-import java.util.Date;
-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 CreateBuiltInQualityGate extends DataChange {
-
- private static final String SONAR_WAY_QUALITY_GATE = "Sonar way";
-
- private final System2 system2;
- private final UuidFactory uuidFactory;
-
- public CreateBuiltInQualityGate(Database db, System2 system2, UuidFactory uuidFactory) {
- super(db);
- this.system2 = system2;
- this.uuidFactory = uuidFactory;
- }
-
-
- @Override
- protected void execute(Context context) throws SQLException {
- Long nbOfBuiltInQualityGates = context.prepareSelect("select count(uuid) from quality_gates where is_built_in = ?")
- .setBoolean(1, true)
- .get(row -> row.getLong(1));
-
-
- if (nbOfBuiltInQualityGates == 0) {
- final Date now = new Date(system2.now());
-
- context.prepareUpsert("insert into quality_gates (uuid, name, is_built_in, created_at) values (?,?,?,?)")
- .setString(1, uuidFactory.create())
- .setString(2, SONAR_WAY_QUALITY_GATE)
- .setBoolean(3, true)
- .setDate(4, now)
- .execute()
- .commit();
- }
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/CreateOrgQualityGatesTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/CreateOrgQualityGatesTable.java
deleted file mode 100644
index 0db787715c0..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/CreateOrgQualityGatesTable.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v70;
-
-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.sql.CreateTableBuilder;
-import org.sonar.server.platform.db.migration.step.DdlChange;
-
-public class CreateOrgQualityGatesTable extends DdlChange {
-
- private static final String ORG_QUALITY_GATES = "org_quality_gates";
- private static final VarcharColumnDef ORGANIZATION_UUID_COLUMN = VarcharColumnDef.newVarcharColumnDefBuilder()
- .setColumnName("organization_uuid")
- .setIsNullable(false)
- .setLimit(VarcharColumnDef.UUID_SIZE)
- .build();
- private static final VarcharColumnDef QUALITY_GATE_UUID_COLUMN = VarcharColumnDef.newVarcharColumnDefBuilder()
- .setColumnName("quality_gate_uuid")
- .setIsNullable(false)
- .setLimit(VarcharColumnDef.UUID_SIZE)
- .build();
-
- private Database db;
-
- public CreateOrgQualityGatesTable(Database db) {
- super(db);
- this.db = db;
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- if (!tableExists()) {
- context.execute(new CreateTableBuilder(getDialect(), ORG_QUALITY_GATES)
- .addPkColumn(VarcharColumnDef.newVarcharColumnDefBuilder()
- .setColumnName("uuid")
- .setIsNullable(false)
- .setLimit(VarcharColumnDef.UUID_SIZE)
- .build())
- .addColumn(ORGANIZATION_UUID_COLUMN)
- .addColumn(QUALITY_GATE_UUID_COLUMN)
- .build()
- );
-
- context.execute(new CreateIndexBuilder()
- .addColumn(ORGANIZATION_UUID_COLUMN)
- .addColumn(QUALITY_GATE_UUID_COLUMN)
- .setUnique(true)
- .setTable(ORG_QUALITY_GATES)
- .setName("uniq_org_quality_gates")
- .build()
- );
- }
- }
-
- private boolean tableExists() throws SQLException {
- try (Connection connection = db.getDataSource().getConnection()) {
- return DatabaseUtils.tableExists(ORG_QUALITY_GATES, connection);
- }
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/CreateTableLiveMeasures.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/CreateTableLiveMeasures.java
deleted file mode 100644
index eb653275655..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/CreateTableLiveMeasures.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v70;
-
-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.BlobColumnDef.newBlobColumnDefBuilder;
-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.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 CreateTableLiveMeasures extends DdlChange {
-
- private static final String TABLE_NAME = "live_measures";
-
- public CreateTableLiveMeasures(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- VarcharColumnDef projectUuidCol = newVarcharColumnDefBuilder()
- .setColumnName("project_uuid")
- .setIsNullable(false)
- .setLimit(UUID_VARCHAR_SIZE)
- .build();
-
- context.execute(new CreateTableBuilder(getDialect(), TABLE_NAME)
- .addPkColumn(newVarcharColumnDefBuilder()
- .setColumnName("uuid")
- .setIsNullable(false)
- .setLimit(VarcharColumnDef.UUID_SIZE)
- .build())
- .addColumn(projectUuidCol)
- .addColumn(newVarcharColumnDefBuilder()
- .setColumnName("component_uuid")
- .setIsNullable(false)
- .setLimit(UUID_VARCHAR_SIZE)
- .build())
- .addColumn(newIntegerColumnDefBuilder()
- .setColumnName("metric_id")
- .setIsNullable(false)
- .build())
- .addColumn(newDecimalColumnDefBuilder()
- .setColumnName("value")
- .setPrecision(38)
- .setScale(20)
- .build())
- .addColumn(newVarcharColumnDefBuilder()
- .setColumnName("text_value")
- .setIsNullable(true)
- .setLimit(4_000)
- .build())
- .addColumn(newDecimalColumnDefBuilder()
- .setColumnName("variation")
- .setPrecision(38)
- .setScale(20)
- .build())
- .addColumn(newBlobColumnDefBuilder()
- .setColumnName("measure_data")
- .build())
- .addColumn(newVarcharColumnDefBuilder()
- .setColumnName("update_marker")
- .setIsNullable(true)
- .setLimit(UUID_SIZE)
- .build())
- .addColumn(newBigIntegerColumnDefBuilder()
- .setColumnName("created_at")
- .setIsNullable(false)
- .build())
- .addColumn(newBigIntegerColumnDefBuilder()
- .setColumnName("updated_at")
- .setIsNullable(false)
- .build())
- .build());
-
- context.execute(new CreateIndexBuilder()
- .addColumn(projectUuidCol)
- .setUnique(false)
- .setTable(TABLE_NAME)
- .setName("live_measures_project")
- .build());
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/CreateTempTableLiveMeasuresP.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/CreateTempTableLiveMeasuresP.java
deleted file mode 100644
index faf4bb4fe12..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/CreateTempTableLiveMeasuresP.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v70;
-
-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.CreateTableBuilder;
-import org.sonar.server.platform.db.migration.step.DdlChange;
-
-import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.UUID_VARCHAR_SIZE;
-
-public class CreateTempTableLiveMeasuresP extends DdlChange {
-
- static final String TABLE_NAME = "live_measures_p";
-
- public CreateTempTableLiveMeasuresP(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- CreateTableBuilder builder = new CreateTableBuilder(getDialect(), TABLE_NAME);
- if (!builder.tableExists(getDatabase())) {
- context.execute(builder
- .addPkColumn(new VarcharColumnDef.Builder()
- .setColumnName("project_uuid")
- .setLimit(UUID_VARCHAR_SIZE)
- .setIsNullable(false)
- .setIgnoreOracleUnit(true)
- .build())
- .build());
- }
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/DbVersion70.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/DbVersion70.java
deleted file mode 100644
index 7f080c3243d..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/DbVersion70.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v70;
-
-import org.sonar.server.platform.db.migration.step.MigrationStepRegistry;
-import org.sonar.server.platform.db.migration.version.DbVersion;
-
-public class DbVersion70 implements DbVersion {
-
- @Override
- public void addSteps(MigrationStepRegistry registry) {
- registry
- .add(1930, "Add QUALITY_GATES.IS_BUILT_IN", AddIsBuiltInToQualityGates.class)
- .add(1931, "Populate QUALITY_GATES.IS_BUILT_IN", PopulateQualityGatesIsBuiltIn.class)
- .add(1932, "Make QUALITY_GATES.IS_BUILT_IN not null", MakeQualityGatesIsBuiltInNotNullable.class)
- .add(1933, "Remove quality gates loaded templates", RemoveQualityGateLoadedTemplates.class)
- .add(1934, "Rename quality gate \"SonarQube way\" to \"Sonar way\"", RenameOldSonarQubeWayQualityGate.class)
- .add(1935, "Drop LOADED_TEMPLATES table", DropLoadedTemplatesTable.class)
-
- // optimizations of migrations from 7.0 on project_measures and live_measures
- .add(1936, "Delete person measures", DeletePersonMeasures.class)
- .add(1937, "Drop index on project_measures.person_id", DropIndexOnPersonMeasures.class)
- .add(1938, "Create table live_measures", CreateTableLiveMeasures.class)
- .add(1939, "Add temporary index on SNAPSHOTS.ISLAST", AddSnapshotIsLastIndex.class)
- .add(1940," Create temporary table LIVE_MEASURES_P", CreateTempTableLiveMeasuresP.class)
- .add(1941, "Populate table live_measures", PopulateLiveMeasures.class)
- .add(1942, "Add live_measures.metric_id index", AddLiveMeasuresMetricIndex.class)
- .add(1943, "Drop temporary table LIVE_MEASURES_P", DropTempTableLiveMeasuresP.class)
- .add(1944, "Drop temporary index on SNAPSHOTS.ISLAST", DropSnapshotIsLastIndex.class)
- .add(1945, "Delete file measures", DeleteFileMeasures.class)
-
- .add(1946, "Create ORG_QUALITY_GATES table", CreateOrgQualityGatesTable.class)
- .add(1947, "Add ORGANIZATIONS.DEFAULT_QUALITY_GATE_UUID", AddDefaultQualityGateUuidToOrganizations.class)
- .add(1948, "Create QUALITY_GATES.UUID", AddUuidToQualityGates.class)
- .add(1949, "Populate QUALITY_GATES.UUID", PopulateUuidOnQualityGates.class)
- .add(1950, "Make QUALITY_GATES.UUID not nullable", MakeUuidNotNullableOnQualityGates.class)
- .add(1951, "Drop unique index on QUALITY_GATES.NAME", DropUniqueIndexOnQualityGatesName.class)
- .add(1952, "Create builtin quality gate if required", CreateBuiltInQualityGate.class)
- .add(1953, "Populate ORG_QUALITY_GATES table", PopulateOrgQualityGates.class)
- .add(1954, "Populate default quality gate on organization", PopulateDefaultQualityGate.class)
- .add(1955, "Associate existing quality gates to default organization", AssociateQualityGatesToDefaultOrganization.class)
- .add(1956, "Read 'sonar.qualitygate' setting and set the value to default organization", ReadGlobalSonarQualityGateSettingToDefaultOrg.class)
- .add(1957, "Delete 'sonar.qualitygate' setting at global level", DeleteGlobalSonarQualityGateSetting.class)
- .add(1958, "Make ORGANIZATIONS.DEFAULT_QUALITY_GATE_UUID not nullable", SetDefaultQualityGateUuidAsNotNullableInOrganizations.class)
- .add(1959, "Add users.homepage_type and users.homepage_parameter", AddHomepageToUsers.class)
- ;
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/DeleteFileMeasures.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/DeleteFileMeasures.java
deleted file mode 100644
index 3ca285aee16..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/DeleteFileMeasures.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v70;
-
-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 DeleteFileMeasures extends DataChange {
-
- public DeleteFileMeasures(Database db) {
- super(db);
- }
-
- @Override
- protected void execute(Context context) throws SQLException {
- MassUpdate massUpdate = context.prepareMassUpdate();
- massUpdate.select("select c.uuid from projects c where c.qualifier = 'UTS' or c.qualifier = 'FIL'");
- massUpdate.rowPluralName("files");
- massUpdate.update("delete from project_measures where component_uuid=?")
- .setBatchSize(10);
-
- massUpdate.execute((row, update) -> {
- String componentUuid = row.getString(1);
- update.setString(1, componentUuid);
- return true;
- });
- }
-
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/DeleteGlobalSonarQualityGateSetting.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/DeleteGlobalSonarQualityGateSetting.java
deleted file mode 100644
index 9684c353db5..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/DeleteGlobalSonarQualityGateSetting.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v70;
-
-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 DeleteGlobalSonarQualityGateSetting extends DataChange {
-
- public DeleteGlobalSonarQualityGateSetting(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=? and resource_id is null")
- .setString(1, "sonar.qualitygate");
- massUpdate.update("delete from properties where id=?");
- massUpdate.execute((row, update) -> {
- update.setLong(1, row.getLong(1));
- return true;
- });
- }
-
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/DeletePersonMeasures.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/DeletePersonMeasures.java
deleted file mode 100644
index d50440ad9f5..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/DeletePersonMeasures.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v70;
-
-import java.sql.SQLException;
-import org.sonar.db.Database;
-import org.sonar.db.dialect.H2;
-import org.sonar.db.dialect.MsSql;
-import org.sonar.db.dialect.Oracle;
-import org.sonar.db.dialect.PostgreSql;
-import org.sonar.server.platform.db.migration.step.DataChange;
-import org.sonar.server.platform.db.migration.step.MassUpdate;
-
-public class DeletePersonMeasures extends DataChange {
-
- public DeletePersonMeasures(Database db) {
- super(db);
- }
-
- @Override
- protected void execute(Context context) throws SQLException {
- MassUpdate massUpdate = context.prepareMassUpdate();
- massUpdate.select("select uuid from snapshots");
- massUpdate.rowPluralName("snapshots");
- massUpdate.update(getDeleteSql()).setBatchSize(1);
-
- massUpdate.execute((row, update) -> {
- String analysisUuid = row.getString(1);
- update.setString(1, analysisUuid);
- if (getDialect().getId().equals(Oracle.ID)) {
- update.setString(2, analysisUuid);
- }
- return true;
- });
- }
-
- private String getDeleteSql() {
- switch (getDialect().getId()) {
- case MsSql.ID:
- return "delete pm from project_measures pm " +
- "inner join projects c on c.uuid = pm.component_uuid " +
- "where pm.analysis_uuid = ? " +
- "and pm.person_id is not null";
- case H2.ID:
- return "delete from project_measures " +
- "where id in ( " +
- " select pm.id from project_measures pm " +
- " inner join projects c on c.uuid = pm.component_uuid " +
- " where pm.analysis_uuid = ? " +
- " and pm.person_id is not null" +
- ")";
- case PostgreSql.ID:
- return "delete from project_measures pm " +
- "using projects c " +
- "where pm.analysis_uuid = ? " +
- "and c.uuid = pm.component_uuid " +
- "and pm.person_id is not null";
- case Oracle.ID:
- return "delete from project_measures pm where exists (" +
- " select 1 from project_measures pm2 " +
- " inner join projects c on c.uuid = pm2.component_uuid " +
- " where pm2.analysis_uuid = ? " +
- " and pm.person_id is not null " +
- " and pm.id = pm2.id" +
- ") and pm.analysis_uuid = ?";
- default:
- throw new IllegalStateException("Unsupported DB dialect: " + getDialect());
- }
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/DropIndexOnPersonMeasures.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/DropIndexOnPersonMeasures.java
deleted file mode 100644
index 4d9d201d4e6..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/DropIndexOnPersonMeasures.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v70;
-
-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 DropIndexOnPersonMeasures extends DdlChange {
-
- public DropIndexOnPersonMeasures(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute(new DropIndexBuilder(getDialect())
- .setTable("project_measures")
- .setName("measures_person")
- .build());
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/DropLoadedTemplatesTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/DropLoadedTemplatesTable.java
deleted file mode 100644
index 4b3d9f63edf..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/DropLoadedTemplatesTable.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v70;
-
-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 DropLoadedTemplatesTable extends DdlChange {
-
- public DropLoadedTemplatesTable(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute(new DropTableBuilder(getDialect(), "loaded_templates").build());
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/DropSnapshotIsLastIndex.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/DropSnapshotIsLastIndex.java
deleted file mode 100644
index 554a084cc5c..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/DropSnapshotIsLastIndex.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v70;
-
-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 DropSnapshotIsLastIndex extends DdlChange {
- public DropSnapshotIsLastIndex(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute(
- new DropIndexBuilder(getDialect())
- .setTable(AddSnapshotIsLastIndex.TABLE_NAME)
- .setName(AddSnapshotIsLastIndex.INDEX_NAME)
- .build());
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/DropTempTableLiveMeasuresP.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/DropTempTableLiveMeasuresP.java
deleted file mode 100644
index acec9071aae..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/DropTempTableLiveMeasuresP.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v70;
-
-import java.sql.SQLException;
-import org.sonar.db.Database;
-import org.sonar.server.platform.db.migration.sql.CreateTableBuilder;
-import org.sonar.server.platform.db.migration.sql.DropTableBuilder;
-import org.sonar.server.platform.db.migration.step.DdlChange;
-
-public class DropTempTableLiveMeasuresP extends DdlChange {
- public DropTempTableLiveMeasuresP(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- if (new CreateTableBuilder(getDialect(), CreateTempTableLiveMeasuresP.TABLE_NAME).tableExists(getDatabase())) {
- DropTableBuilder builder = new DropTableBuilder(getDialect(), CreateTempTableLiveMeasuresP.TABLE_NAME);
- context.execute(builder.build());
- }
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/DropUniqueIndexOnQualityGatesName.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/DropUniqueIndexOnQualityGatesName.java
deleted file mode 100644
index d3193abfcc1..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/DropUniqueIndexOnQualityGatesName.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v70;
-
-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 DropUniqueIndexOnQualityGatesName extends DdlChange {
-
- public DropUniqueIndexOnQualityGatesName(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute(new DropIndexBuilder(getDialect())
- .setTable("quality_gates")
- .setName("uniq_quality_gates")
- .build());
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/MakeQualityGatesIsBuiltInNotNullable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/MakeQualityGatesIsBuiltInNotNullable.java
deleted file mode 100644
index 57833bd0690..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/MakeQualityGatesIsBuiltInNotNullable.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v70;
-
-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 MakeQualityGatesIsBuiltInNotNullable extends DdlChange {
-
- public MakeQualityGatesIsBuiltInNotNullable(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- BooleanColumnDef column = newBooleanColumnDefBuilder()
- .setColumnName("is_built_in")
- .setIsNullable(false)
- .build();
-
- context.execute(new AlterColumnsBuilder(getDialect(), "quality_gates")
- .updateColumn(column)
- .build());
- }
-
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/MakeUuidNotNullableOnQualityGates.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/MakeUuidNotNullableOnQualityGates.java
deleted file mode 100644
index 4267dc1531b..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/MakeUuidNotNullableOnQualityGates.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v70;
-
-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.sql.CreateIndexBuilder;
-import org.sonar.server.platform.db.migration.step.DdlChange;
-
-public class MakeUuidNotNullableOnQualityGates extends DdlChange {
-
- private static final VarcharColumnDef UUID_COLUMN = VarcharColumnDef.newVarcharColumnDefBuilder()
- .setColumnName("uuid")
- .setIsNullable(false)
- .setLimit(VarcharColumnDef.UUID_SIZE)
- .build();
- private static final String TABLE_NAME = "quality_gates";
-
- public MakeUuidNotNullableOnQualityGates(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute(new AlterColumnsBuilder(getDialect(), TABLE_NAME)
- .updateColumn(UUID_COLUMN)
- .build());
-
- context.execute(new CreateIndexBuilder()
- .addColumn(UUID_COLUMN)
- .setUnique(true)
- .setTable(TABLE_NAME)
- .setName("uniq_quality_gates_uuid")
- .build()
- );
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/PopulateDefaultQualityGate.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/PopulateDefaultQualityGate.java
deleted file mode 100644
index f9987124a46..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/PopulateDefaultQualityGate.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v70;
-
-import java.sql.SQLException;
-import java.util.List;
-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 com.google.common.base.Preconditions.checkState;
-
-public class PopulateDefaultQualityGate extends DataChange {
-
- private final System2 system2;
-
- public PopulateDefaultQualityGate(Database db, System2 system2) {
- super(db);
- this.system2 = system2;
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- List builtInQGUuids = context.prepareSelect("select uuid from quality_gates where is_built_in = ?")
- .setBoolean(1, true)
- .list(row -> row.getString(1));
-
- checkState(!builtInQGUuids.isEmpty(), "Unable to find the builtin quality gate");
- checkState(builtInQGUuids.size() == 1, "There are too many built in quality gates, one and only one is expected");
-
- final long now = system2.now();
- MassUpdate massUpdate = context.prepareMassUpdate();
- massUpdate.select("select uuid from organizations " +
- " where default_quality_gate_uuid is null");
- massUpdate.rowPluralName("organizations");
- massUpdate.update("update organizations set default_quality_gate_uuid = ?, updated_at=? where uuid = ?");
- massUpdate.execute((row, update) -> {
- update.setString(1, builtInQGUuids.get(0));
- update.setLong(2, now);
- update.setString(3, row.getString(1));
- return true;
- });
-
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/PopulateLiveMeasures.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/PopulateLiveMeasures.java
deleted file mode 100644
index 76405c389eb..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/PopulateLiveMeasures.java
+++ /dev/null
@@ -1,255 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v70;
-
-import java.sql.Connection;
-import java.sql.SQLException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Set;
-import java.util.stream.Collectors;
-import javax.annotation.concurrent.Immutable;
-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.Uuids;
-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.SelectImpl;
-import org.sonar.server.platform.db.migration.step.SqlStatement;
-import org.sonar.server.platform.db.migration.step.Upsert;
-
-import static java.util.stream.Collectors.joining;
-
-public class PopulateLiveMeasures extends DataChange {
- private static final Logger LOG = Loggers.get(PopulateLiveMeasures.class);
-
- private final System2 system2;
- private final Database db;
-
- public PopulateLiveMeasures(Database db, System2 system2) {
- super(db);
- this.db = db;
- this.system2 = system2;
- }
-
- @Override
- protected void execute(Context context) throws SQLException {
- ATTEMPT attempt = isFirstAttempt(context);
- if (attempt != ATTEMPT.FIRST) {
- LOG.info("Retry detected (non empty table live_measures_p or live_measures). Handling it");
- }
-
- long now = system2.now();
- int projectBatchSize = 10;
- String statement = "" +
- " select" +
- " s.uuid, s.component_uuid" +
- " from snapshots s" +
- " where" +
- " s.islast = ?" +
- (attempt == ATTEMPT.ONE_PROJECT_OR_MORE ? " and not exists (select 1 from live_measures_p lmp where lmp.project_uuid=s.component_uuid)" : "");
- try (Connection connection = createReadUncommittedConnection();
- Select select = SelectImpl.create(db, connection, statement).setBoolean(1, true)) {
- List rows = new ArrayList<>(projectBatchSize);
- select.scroll(t -> {
- rows.add(new Row(t.getString(1), t.getString(2)));
- if (rows.size() == projectBatchSize) {
- processProjectBatch(context, rows, attempt, now);
-
- rows.clear();
- }
- });
-
- if (!rows.isEmpty()) {
- processProjectBatch(context, rows, attempt, now);
- }
- }
- }
-
- private static ATTEMPT isFirstAttempt(Context context) throws SQLException {
- try (
- Select selectFromTempTable = context.prepareSelect("select count(1) from live_measures_p");
- Select selectFromLiveMeasures = context.prepareSelect("select count(1) from live_measures")
- ) {
- boolean projectsProcessed = selectFromTempTable.get(t -> t.getLong(1)) > 0;
- if (projectsProcessed) {
- return ATTEMPT.ONE_PROJECT_OR_MORE;
- }
- // we will count at most the data of one project => table should have little content => bad performance risk is low
- return selectFromLiveMeasures.get(t -> t.getLong(1)) == 0 ? ATTEMPT.FIRST : ATTEMPT.PARTIAL;
- }
- }
-
- private enum ATTEMPT {
- FIRST, PARTIAL, ONE_PROJECT_OR_MORE
- }
-
- private static void processProjectBatch(Context context, List rows, ATTEMPT attempt, long now) throws SQLException {
- MassUpdate massUpdate = context.prepareMassUpdate();
- massUpdate.rowPluralName("live measures");
- setSelect(rows, massUpdate);
- massUpdate.update("delete from live_measures where project_uuid=?");
- massUpdate.update(" insert into live_measures" +
- " (uuid, component_uuid, project_uuid, metric_id, value, text_value, variation, measure_data, created_at, updated_at)" +
- " values" +
- " (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
- massUpdate.update("insert into live_measures_p (project_uuid) values (?)")
- // we want to commit each project finished asap to avoid restarting them over in case of interruption
- .setBatchSize(1);
- LiveMeasurePopulationMultiHandler handler = new LiveMeasurePopulationMultiHandler(attempt == ATTEMPT.FIRST, rows, now);
- massUpdate.execute(handler);
-
- Set notCommittedProjectUuids = handler.notCommittedProjectUuids;
- if (!notCommittedProjectUuids.isEmpty()) {
- Upsert upsert = context.prepareUpsert("insert into live_measures_p (project_uuid) values (?)");
- for (String projectUuid : notCommittedProjectUuids) {
- upsert.setString(1, projectUuid);
- upsert.execute();
- }
- upsert.commit();
- }
- }
-
- private static void setSelect(List rows, MassUpdate massUpdate) throws SQLException {
- String questionMarks = rows.stream().map(t -> "?").collect(joining(",", "(", ")"));
- SqlStatement select = massUpdate.select("" +
- " select" +
- " p.project_uuid, pm.component_uuid, pm.metric_id, pm.value, pm.text_value, pm.variation_value_1, pm.measure_data" +
- " from project_measures pm" +
- " inner join projects p on p.uuid = pm.component_uuid and p.project_uuid in " + questionMarks +
- " where" +
- " pm.analysis_uuid in " + questionMarks +
- " order by" +
- " p.project_uuid");
- int i = 1;
- for (Row row : rows) {
- select.setString(i, row.getProjectUuid());
- i++;
- }
- for (Row row : rows) {
- select.setString(i, row.getAnalysisUuid());
- i++;
- }
- }
-
- private static class LiveMeasurePopulationMultiHandler implements MassUpdate.MultiHandler {
- private final boolean firstAttempt;
- private final long now;
- private final Set notCommittedProjectUuids;
- private String deletePreviousProjectUuid = null;
- private String currentProjectUuid = null;
-
- private LiveMeasurePopulationMultiHandler(boolean firstAttempt, List rows, long now) {
- this.firstAttempt = firstAttempt;
- this.now = now;
- this.notCommittedProjectUuids = rows.stream().map(Row::getProjectUuid).collect(Collectors.toSet());
- }
-
- @Override
- public boolean handle(Select.Row row, SqlStatement update, int updateIndex) throws SQLException {
- String projectUuid = row.getString(1);
- switch (updateIndex) {
- case 0:
- return doRentranceDelete(update, projectUuid);
- case 1:
- return doLiveMeasureInsert(row, update, projectUuid);
- case 2:
- return doComponentDoneInsert(update, projectUuid);
- default:
- throw new IllegalStateException("Unsupported update index" + updateIndex);
- }
- }
-
- private boolean doRentranceDelete(SqlStatement update, String projectUuid) throws SQLException {
- if (firstAttempt) {
- return false;
- }
-
- if (deletePreviousProjectUuid == null || !deletePreviousProjectUuid.equals(projectUuid)) {
- update.setString(1, projectUuid);
- deletePreviousProjectUuid = projectUuid;
- return true;
- }
- return false;
- }
-
- private boolean doLiveMeasureInsert(Select.Row row, SqlStatement update, String projectUuid) throws SQLException {
- update.setString(1, Uuids.create());
- update.setString(2, row.getString(2));
- update.setString(3, projectUuid);
- update.setInt(4, row.getInt(3));
- update.setDouble(5, row.getNullableDouble(4));
- update.setString(6, row.getNullableString(5));
- update.setDouble(7, row.getNullableDouble(6));
- update.setBytes(8, row.getNullableBytes(7));
- update.setLong(9, now);
- update.setLong(10, now);
- return true;
- }
-
- /**
- * When currentProjectUuid changes, we know we are done will all the measures for this component and therefor
- * can insert it into live_measures_p.
- *
- * This requires statement selecting measures to be sorted by project_uuid and then component_uuid.
- */
- private boolean doComponentDoneInsert(SqlStatement update, String projectUuid) throws SQLException {
- if (currentProjectUuid == null || currentProjectUuid.equals(projectUuid)) {
- this.currentProjectUuid = projectUuid;
- return false;
- }
- update.setString(1, currentProjectUuid);
- this.notCommittedProjectUuids.remove(currentProjectUuid);
- this.currentProjectUuid = projectUuid;
- return true;
- }
-
- }
-
- @Immutable
- private static final class Row {
- private final String analysisUuid;
- private final String projectUuid;
-
- private Row(String analysisUuid, String projectUuid) {
- this.analysisUuid = analysisUuid;
- this.projectUuid = projectUuid;
- }
-
- public String getAnalysisUuid() {
- return analysisUuid;
- }
-
- public String getProjectUuid() {
- return projectUuid;
- }
-
- @Override
- public String toString() {
- return "Row{" +
- "analysisUuid='" + analysisUuid + '\'' +
- ", projectUuid='" + projectUuid + '\'' +
- '}';
- }
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/PopulateOrgQualityGates.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/PopulateOrgQualityGates.java
deleted file mode 100644
index b412cbff3f3..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/PopulateOrgQualityGates.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v70;
-
-import java.sql.SQLException;
-import java.util.List;
-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 static com.google.common.base.Preconditions.checkState;
-
-public class PopulateOrgQualityGates extends DataChange {
-
- private final UuidFactory uuidFactory;
-
- public PopulateOrgQualityGates(Database db, UuidFactory uuidFactory) {
- super(db);
- this.uuidFactory = uuidFactory;
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- Long nbOfOrganizations = context.prepareSelect("select count(uuid) from organizations")
- .get(row -> row.getLong(1));
- if (nbOfOrganizations == 0) {
- // No need for a migration
- return;
- }
-
- List builtInQGUuids = context.prepareSelect("select uuid from quality_gates where is_built_in = ?")
- .setBoolean(1, true)
- .list(row -> row.getString(1));
-
- checkState(!builtInQGUuids.isEmpty(), "Unable to find the builtin quality gate");
- checkState(builtInQGUuids.size() == 1, "There are too many built in quality gates, one and only one is expected");
-
- MassUpdate massUpdate = context.prepareMassUpdate();
- massUpdate.select("select uuid from organizations o " +
- " where " +
- " not exists (select 1 from org_quality_gates oqg where oqg.quality_gate_uuid = ? and oqg.organization_uuid = o.uuid)")
- .setString(1, builtInQGUuids.get(0));
-
- massUpdate.rowPluralName("organizations");
- massUpdate.update("insert into org_quality_gates (uuid, quality_gate_uuid, organization_uuid) values(?, ?, ?)");
- massUpdate.execute((row, update) -> {
- update.setString(1, uuidFactory.create());
- update.setString(2, builtInQGUuids.get(0));
- update.setString(3, row.getString(1));
- return true;
- });
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/PopulateQualityGatesIsBuiltIn.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/PopulateQualityGatesIsBuiltIn.java
deleted file mode 100644
index 909b3c618a5..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/PopulateQualityGatesIsBuiltIn.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v70;
-
-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.step.DataChange;
-import org.sonar.server.platform.db.migration.step.MassUpdate;
-
-public class PopulateQualityGatesIsBuiltIn extends DataChange {
-
- private static final String SONARQUBE_WAY_QUALITY_GATE = "SonarQube way";
-
- private final System2 system2;
-
- public PopulateQualityGatesIsBuiltIn(Database db, System2 system2) {
- super(db);
- this.system2 = system2;
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- MassUpdate massUpdate = context.prepareMassUpdate();
- massUpdate.select("select id, name from quality_gates where is_built_in is null");
- massUpdate.rowPluralName("quality_gates");
- massUpdate.update("update quality_gates set is_built_in=?, updated_at=? where id=?");
- massUpdate.execute((row, update) -> {
- String name = row.getString(2);
- update.setBoolean(1, SONARQUBE_WAY_QUALITY_GATE.equals(name));
- update.setDate(2, new Date(system2.now()));
- update.setLong(3, row.getLong(1));
- return true;
- });
- }
-
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/PopulateUuidOnQualityGates.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/PopulateUuidOnQualityGates.java
deleted file mode 100644
index 6c9171a88ef..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/PopulateUuidOnQualityGates.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v70;
-
-import java.sql.SQLException;
-import java.util.Date;
-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 PopulateUuidOnQualityGates extends DataChange {
-
- private final System2 system2;
- private final UuidFactory uuidFactory;
-
- public PopulateUuidOnQualityGates(Database db, System2 system2, UuidFactory uuidFactory) {
- super(db);
- this.system2 = system2;
- this.uuidFactory = uuidFactory;
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- MassUpdate massUpdate = context.prepareMassUpdate();
- massUpdate.select("select id, name from quality_gates where uuid is null");
- massUpdate.rowPluralName("quality gates");
- massUpdate.update("update quality_gates set uuid=?, updated_at=? where id=?");
- massUpdate.execute((row, update) -> {
- update.setString(1, uuidFactory.create());
- update.setDate(2, new Date(system2.now()));
- update.setLong(3, row.getLong(1));
- return true;
- });
- }
-
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/ReadGlobalSonarQualityGateSettingToDefaultOrg.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/ReadGlobalSonarQualityGateSettingToDefaultOrg.java
deleted file mode 100644
index 9f6f23b13d0..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/ReadGlobalSonarQualityGateSettingToDefaultOrg.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v70;
-
-import java.sql.SQLException;
-import javax.annotation.CheckForNull;
-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.step.DataChange;
-import org.sonar.server.platform.db.migration.step.MassUpdate;
-
-import static com.google.common.base.Preconditions.checkState;
-import static java.lang.Long.parseLong;
-
-public class ReadGlobalSonarQualityGateSettingToDefaultOrg extends DataChange {
-
- private static final Logger LOGGER = Loggers.get(ReadGlobalSonarQualityGateSettingToDefaultOrg.class);
- private final System2 system2;
-
- public ReadGlobalSonarQualityGateSettingToDefaultOrg(Database db, System2 system2) {
- super(db);
- this.system2 = system2;
- }
-
- @Override
- protected void execute(Context context) throws SQLException {
- String defaultOrgUuid = getDefaultOrgUuid(context);
- String defaultQualityGate = getDefaultQualityGate(context);
- if (defaultQualityGate == null) {
- LOGGER.info("No default quality gate set");
- return;
- }
-
- MassUpdate massUpdate = context.prepareMassUpdate();
- massUpdate.select("select uuid from quality_gates where id=?")
- .setLong(1, parseLong(defaultQualityGate));
- massUpdate.update("update organizations set default_quality_gate_uuid = ?, updated_at = ? where uuid=?");
- massUpdate.execute((row, update) -> {
- update.setString(1, row.getString(1));
- update.setLong(2, system2.now());
- update.setString(3, defaultOrgUuid);
- return true;
- });
- }
-
- private static String getDefaultOrgUuid(Context context) throws SQLException {
- String defaultOrgUuid = context.prepareSelect("select text_value from internal_properties where kee = 'organization.default'")
- .get(row -> row.getString(1));
- checkState(defaultOrgUuid != null, "Default organization uuid is missing");
- return defaultOrgUuid;
- }
-
- @CheckForNull
- private static String getDefaultQualityGate(Context context) throws SQLException {
- return context.prepareSelect("select text_value from properties where prop_key=? and resource_id is null")
- .setString(1, "sonar.qualitygate")
- .get(row -> row.getNullableString(1));
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/RemoveQualityGateLoadedTemplates.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/RemoveQualityGateLoadedTemplates.java
deleted file mode 100644
index fcc5df9e4a8..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/RemoveQualityGateLoadedTemplates.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v70;
-
-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 RemoveQualityGateLoadedTemplates extends DataChange {
-
- public RemoveQualityGateLoadedTemplates(Database db) {
- super(db);
- }
-
- @Override
- protected void execute(Context context) throws SQLException {
- MassUpdate massUpdate = context.prepareMassUpdate();
- massUpdate.select("SELECT id " +
- "FROM loaded_templates " +
- "WHERE template_type = ?")
- .setString(1, "QUALITY_GATE");
- massUpdate.update("DELETE from loaded_templates WHERE id=?");
- massUpdate.rowPluralName("delete loaded templates for quality gate");
- massUpdate.execute((row, update) -> {
- update.setLong(1, row.getLong(1));
- return true;
- });
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/RenameOldSonarQubeWayQualityGate.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/RenameOldSonarQubeWayQualityGate.java
deleted file mode 100644
index ee86399eafb..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/RenameOldSonarQubeWayQualityGate.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v70;
-
-import java.sql.SQLException;
-import java.util.Date;
-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.step.DataChange;
-import org.sonar.server.platform.db.migration.step.MassUpdate;
-
-public class RenameOldSonarQubeWayQualityGate extends DataChange {
-
- private static final Logger LOG = Loggers.get(RenameOldSonarQubeWayQualityGate.class);
- private static final String SONARQUBE_WAY_QUALITY_GATE = "SonarQube way";
- private static final String SONARQUBE_WAY_QUALITY_GATE_OUTDATED = "Sonar way (outdated copy)";
- private final System2 system2;
-
- public RenameOldSonarQubeWayQualityGate(Database db, System2 system2) {
- super(db);
- this.system2 = system2;
- }
-
- @Override
- protected void execute(Context context) throws SQLException {
- try {
- MassUpdate massUpdate = context.prepareMassUpdate();
- massUpdate.select("SELECT id FROM quality_gates WHERE name = ?")
- .setString(1, SONARQUBE_WAY_QUALITY_GATE);
- massUpdate.rowPluralName("quality gates");
- massUpdate.update("UPDATE quality_gates SET name=?, is_built_in=?, updated_at=? WHERE id=?");
- massUpdate.execute((row, update) -> {
- update.setString(1, SONARQUBE_WAY_QUALITY_GATE_OUTDATED);
- update.setBoolean(2, false);
- update.setDate(3, new Date(system2.now()));
- update.setLong(4, row.getLong(1));
- return true;
- });
- } catch(Exception ex) {
- LOG.error("There is already a quality profile with name [{}]", SONARQUBE_WAY_QUALITY_GATE_OUTDATED);
- throw ex;
- }
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/SetDefaultQualityGateUuidAsNotNullableInOrganizations.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/SetDefaultQualityGateUuidAsNotNullableInOrganizations.java
deleted file mode 100644
index 375f55ba439..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/SetDefaultQualityGateUuidAsNotNullableInOrganizations.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v70;
-
-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 SetDefaultQualityGateUuidAsNotNullableInOrganizations extends DdlChange {
-
- public SetDefaultQualityGateUuidAsNotNullableInOrganizations(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute(new AlterColumnsBuilder(getDialect(), "organizations")
- .updateColumn(newVarcharColumnDefBuilder()
- .setColumnName("default_quality_gate_uuid")
- .setIsNullable(false)
- .setLimit(VarcharColumnDef.UUID_SIZE)
- .build())
- .build());
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/package-info.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/package-info.java
deleted file mode 100644
index 1af22bde23f..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/package-info.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public 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.v70;
-
-import javax.annotation.ParametersAreNonnullByDefault;
-
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v71/AddKeyTypeInProjectBranches.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v71/AddKeyTypeInProjectBranches.java
deleted file mode 100644
index ed088a806e3..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v71/AddKeyTypeInProjectBranches.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v71;
-
-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 AddKeyTypeInProjectBranches extends DdlChange {
-
- public static final String TABLE_NAME = "project_branches";
-
- public AddKeyTypeInProjectBranches(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute(new AddColumnsBuilder(getDialect(), TABLE_NAME)
- .addColumn(VarcharColumnDef.newVarcharColumnDefBuilder()
- .setColumnName("key_type")
- .setIsNullable(true)
- .setLimit(12)
- .build())
- .build());
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v71/AddPullRequestBinaryInProjectBranches.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v71/AddPullRequestBinaryInProjectBranches.java
deleted file mode 100644
index 64f8be9719e..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v71/AddPullRequestBinaryInProjectBranches.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v71;
-
-import java.sql.SQLException;
-import org.sonar.db.Database;
-import org.sonar.server.platform.db.migration.def.BlobColumnDef;
-import org.sonar.server.platform.db.migration.sql.AddColumnsBuilder;
-import org.sonar.server.platform.db.migration.step.DdlChange;
-
-public class AddPullRequestBinaryInProjectBranches extends DdlChange {
-
- static final String TABLE_NAME = "project_branches";
- static final String COLUMN_NAME = "pull_request_binary";
-
- public AddPullRequestBinaryInProjectBranches(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute(new AddColumnsBuilder(getDialect(), TABLE_NAME)
- .addColumn(BlobColumnDef.newBlobColumnDefBuilder()
- .setColumnName(COLUMN_NAME)
- .setIsNullable(true)
- .build())
- .build());
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v71/AddRuleScope.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v71/AddRuleScope.java
deleted file mode 100644
index b12583536af..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v71/AddRuleScope.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v71;
-
-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 AddRuleScope extends DdlChange {
-
- public AddRuleScope(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute(new AddColumnsBuilder(getDialect(), "rules")
- .addColumn(VarcharColumnDef.newVarcharColumnDefBuilder()
- .setColumnName("scope")
- .setIsNullable(true)
- .setLimit(20)
- .build())
- .build());
- }
-
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v71/AddWebhookKeyToWebhookDeliveriesTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v71/AddWebhookKeyToWebhookDeliveriesTable.java
deleted file mode 100644
index f4c0ed88d83..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v71/AddWebhookKeyToWebhookDeliveriesTable.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v71;
-
-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.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 AddWebhookKeyToWebhookDeliveriesTable extends DdlChange {
-
- public AddWebhookKeyToWebhookDeliveriesTable(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
-
- context.execute("delete from webhook_deliveries");
-
- context.execute(new AddColumnsBuilder(getDialect(), "webhook_deliveries")
- .addColumn(newVarcharColumnDefBuilder()
- .setColumnName("webhook_uuid")
- .setIsNullable(false)
- .setLimit(40)
- .build())
- .build());
-
- context.execute(new AlterColumnsBuilder(getDialect(), "webhook_deliveries")
- .updateColumn(newBigIntegerColumnDefBuilder()
- .setColumnName("duration_ms")
- .setIsNullable(false)
- .build())
- .build());
- }
-
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v71/CleanBrokenProjectToQGReferences.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v71/CleanBrokenProjectToQGReferences.java
deleted file mode 100644
index b7b9ff47b6e..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v71/CleanBrokenProjectToQGReferences.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v71;
-
-import java.sql.SQLException;
-import java.util.HashSet;
-import java.util.Set;
-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 CleanBrokenProjectToQGReferences extends DataChange {
-
- private static final String PROPERTY_SONAR_QUALITYGATE = "sonar.qualitygate";
-
- public CleanBrokenProjectToQGReferences(Database db) {
- super(db);
- }
-
- @Override
- protected void execute(Context context) throws SQLException {
- Set qualityGateIds = new HashSet<>();
- context.prepareSelect("select id from quality_gates")
- .scroll(s -> qualityGateIds.add(String.valueOf(s.getInt(1))));
-
- MassUpdate massUpdate = context.prepareMassUpdate();
- massUpdate.select("select" +
- " distinct text_value" +
- " from properties" +
- " where" +
- " prop_key=?" +
- " and text_value is not null" +
- " and resource_id is not null")
- .setString(1, PROPERTY_SONAR_QUALITYGATE);
- massUpdate.update("delete from properties" +
- " where" +
- " prop_key=?" +
- " and resource_id is not null" +
- " and text_value=?");
- massUpdate.execute((row, update) -> handle(row, update, qualityGateIds));
- }
-
- private static boolean handle(Select.Row row, SqlStatement update, Set qualityGateIds) throws SQLException {
- String qgId = row.getString(1);
- if (qualityGateIds.contains(qgId)) {
- return false;
- }
-
- update.setString(1, PROPERTY_SONAR_QUALITYGATE);
- update.setString(2, qgId);
- return true;
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v71/CleanCeChildTablesOrphans.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v71/CleanCeChildTablesOrphans.java
deleted file mode 100644
index fddd2095778..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v71/CleanCeChildTablesOrphans.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v71;
-
-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.step.Select;
-import org.sonar.server.platform.db.migration.step.SqlStatement;
-
-public class CleanCeChildTablesOrphans extends DataChange {
- public CleanCeChildTablesOrphans(Database db) {
- super(db);
- }
-
- @Override
- protected void execute(Context context) throws SQLException {
- deleteOrphansInCeChildTable(context, "ce_task_input");
- deleteOrphansInCeChildTable(context, "ce_scanner_context");
- deleteOrphansInCeChildTable(context, "ce_task_characteristics");
- }
-
- private static void deleteOrphansInCeChildTable(Context context, String childTableName) throws SQLException {
- MassUpdate massUpdate = context.prepareMassUpdate();
- massUpdate.select("select task_uuid from " + childTableName + " child where" +
- " not exists (select 1 from ce_activity a where a.uuid = child.task_uuid)" +
- " and not exists (select 1 from ce_queue q where q.uuid = child.task_uuid)");
- massUpdate.rowPluralName("orphans rows in " + childTableName);
- massUpdate.update("delete from " + childTableName + " where task_uuid=?");
- massUpdate.execute(CleanCeChildTablesOrphans::deleteByTaskUuid);
- }
-
- private static boolean deleteByTaskUuid(Select.Row row, SqlStatement update) throws SQLException {
- String taskUuid = row.getString(1);
- update.setString(1, taskUuid);
- return true;
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v71/CreateDeprecatedRuleKeysTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v71/CreateDeprecatedRuleKeysTable.java
deleted file mode 100644
index 0d5637b1d9c..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v71/CreateDeprecatedRuleKeysTable.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v71;
-
-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.BigIntegerColumnDef;
-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.sql.CreateTableBuilder;
-import org.sonar.server.platform.db.migration.step.DdlChange;
-
-public class CreateDeprecatedRuleKeysTable extends DdlChange {
-
- private static final String DEPRECATED_RULE_KEYS = "deprecated_rule_keys";
- private static final VarcharColumnDef UUID_COLUMN = VarcharColumnDef.newVarcharColumnDefBuilder()
- .setColumnName("uuid")
- .setIsNullable(false)
- .setLimit(VarcharColumnDef.UUID_SIZE)
- .build();
- private static final IntegerColumnDef RULE_ID_COLUMN = IntegerColumnDef.newIntegerColumnDefBuilder()
- .setColumnName("rule_id")
- .setIsNullable(false)
- .build();
- private static final VarcharColumnDef OLD_REPOSITORY_KEY_COLUMN = VarcharColumnDef.newVarcharColumnDefBuilder()
- .setColumnName("old_repository_key")
- .setIsNullable(false)
- .setLimit(255)
- .build();
- private static final VarcharColumnDef OLD_RULE_KEY_COLUMN = VarcharColumnDef.newVarcharColumnDefBuilder()
- .setColumnName("old_rule_key")
- .setIsNullable(false)
- .setLimit(200)
- .build();
- private static final BigIntegerColumnDef CREATED_AT_COLUMN = BigIntegerColumnDef.newBigIntegerColumnDefBuilder()
- .setColumnName("created_at")
- .setIsNullable(false)
- .build();
-
- private Database db;
-
- public CreateDeprecatedRuleKeysTable(Database db) {
- super(db);
- this.db = db;
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- if (!tableExists()) {
- context.execute(new CreateTableBuilder(getDialect(), DEPRECATED_RULE_KEYS)
- .addPkColumn(UUID_COLUMN)
- .addColumn(RULE_ID_COLUMN)
- .addColumn(OLD_REPOSITORY_KEY_COLUMN)
- .addColumn(OLD_RULE_KEY_COLUMN)
- .addColumn(CREATED_AT_COLUMN)
- .build()
- );
-
- context.execute(new CreateIndexBuilder()
- .setTable(DEPRECATED_RULE_KEYS)
- .addColumn(OLD_REPOSITORY_KEY_COLUMN)
- .addColumn(OLD_RULE_KEY_COLUMN)
- .setUnique(true)
- .setName("uniq_deprecated_rule_keys")
- .build()
- );
-
- context.execute(new CreateIndexBuilder()
- .setTable(DEPRECATED_RULE_KEYS)
- .addColumn(RULE_ID_COLUMN)
- .setUnique(true)
- .setName("rule_id_deprecated_rule_keys")
- .build()
- );
- }
- }
-
- private boolean tableExists() throws SQLException {
- try (Connection connection = db.getDataSource().getConnection()) {
- return DatabaseUtils.tableExists(DEPRECATED_RULE_KEYS, connection);
- }
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v71/CreateTableProjectLinks2.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v71/CreateTableProjectLinks2.java
deleted file mode 100644
index 203661ef96e..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v71/CreateTableProjectLinks2.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v71;
-
-import java.sql.SQLException;
-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.UUID_SIZE;
-import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder;
-
-public class CreateTableProjectLinks2 extends DdlChange {
-
- private static final String TABLE_NAME = "project_links2";
-
- public CreateTableProjectLinks2(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute(new CreateTableBuilder(getDialect(), TABLE_NAME)
- .addPkColumn(newVarcharColumnDefBuilder()
- .setColumnName("uuid")
- .setLimit(UUID_SIZE)
- .setIsNullable(false)
- .build())
- .addColumn(newVarcharColumnDefBuilder()
- .setColumnName("project_uuid")
- .setLimit(UUID_SIZE)
- .setIsNullable(false)
- .build())
- .addColumn(newVarcharColumnDefBuilder()
- .setColumnName("link_type")
- .setLimit(20)
- .setIsNullable(false)
- .build())
- .addColumn(newVarcharColumnDefBuilder()
- .setColumnName("name")
- .setLimit(128)
- .setIsNullable(true)
- .build())
- .addColumn(newVarcharColumnDefBuilder()
- .setColumnName("href")
- .setLimit(2048)
- .setIsNullable(false)
- .build())
- .addColumn(newBigIntegerColumnDefBuilder()
- .setColumnName("created_at")
- .setIsNullable(false)
- .build())
- .addColumn(newBigIntegerColumnDefBuilder()
- .setColumnName("updated_at")
- .setIsNullable(false)
- .build())
- .build());
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v71/CreateWebhooksTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v71/CreateWebhooksTable.java
deleted file mode 100644
index 91d887eddd4..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v71/CreateWebhooksTable.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v71;
-
-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.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 CreateWebhooksTable extends DdlChange {
-
- private static final String TABLE_NAME = "webhooks";
-
- private static final String ORGANIZATION_WEBHOOK_INDEX_NAME = "organization_webhook";
- private static final String PROJECT_WEBHOOK_INDEX_NAME = "project_webhook";
-
- private static final VarcharColumnDef UUID_COLUMN = newVarcharColumnDefBuilder()
- .setColumnName("uuid")
- .setIsNullable(false)
- .setLimit(UUID_SIZE)
- .build();
- private static final VarcharColumnDef NAME_COLUMN = newVarcharColumnDefBuilder()
- .setColumnName("name")
- .setIsNullable(false)
- .setLimit(100)
- .build();
- private static final VarcharColumnDef URL_COLUMN = newVarcharColumnDefBuilder()
- .setColumnName("url")
- .setIsNullable(false)
- .setLimit(2000)
- .build();
- private static final VarcharColumnDef ORGANIZATION_UUID_COLUMN = newVarcharColumnDefBuilder()
- .setColumnName("organization_uuid")
- .setIsNullable(true)
- .setLimit(UUID_SIZE)
- .build();
- private static final VarcharColumnDef PROJECT_UUID_COLUMN = newVarcharColumnDefBuilder()
- .setColumnName("project_uuid")
- .setIsNullable(true)
- .setLimit(UUID_SIZE)
- .build();
- private static final BigIntegerColumnDef CREATED_AT_COLUMN = newBigIntegerColumnDefBuilder()
- .setColumnName("created_at")
- .setIsNullable(false)
- .build();
- private static final BigIntegerColumnDef UPDATED_AT_COLUMN = newBigIntegerColumnDefBuilder()
- .setColumnName("updated_at")
- .setIsNullable(true)
- .build();
-
- public CreateWebhooksTable(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
-
- if (!tableExists()) {
- context.execute(new CreateTableBuilder(getDialect(), TABLE_NAME)
- .addPkColumn(UUID_COLUMN)
- .addColumn(NAME_COLUMN)
- .addColumn(URL_COLUMN)
- .addColumn(ORGANIZATION_UUID_COLUMN)
- .addColumn(PROJECT_UUID_COLUMN)
- .addColumn(CREATED_AT_COLUMN)
- .addColumn(UPDATED_AT_COLUMN)
- .build()
- );
-
- context.execute(new CreateIndexBuilder()
- .addColumn(ORGANIZATION_UUID_COLUMN)
- .setUnique(false)
- .setTable(TABLE_NAME)
- .setName(ORGANIZATION_WEBHOOK_INDEX_NAME)
- .build()
- );
-
- context.execute(new CreateIndexBuilder()
- .addColumn(PROJECT_UUID_COLUMN)
- .setUnique(false)
- .setTable(TABLE_NAME)
- .setName(PROJECT_WEBHOOK_INDEX_NAME)
- .build()
- );
-
- }
-
- }
-
- private boolean tableExists() throws SQLException {
- try (Connection connection = getDatabase().getDataSource().getConnection()) {
- return DatabaseUtils.tableExists(TABLE_NAME, connection);
- }
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v71/DbVersion71.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v71/DbVersion71.java
deleted file mode 100644
index 1abc490c34f..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v71/DbVersion71.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v71;
-
-import org.sonar.server.platform.db.migration.step.MigrationStepRegistry;
-import org.sonar.server.platform.db.migration.version.DbVersion;
-
-public class DbVersion71 implements DbVersion {
-
- @Override
- public void addSteps(MigrationStepRegistry registry) {
- registry
- .add(2000, "Delete settings defined in sonar.properties from PROPERTIES table", DeleteSettingsDefinedInSonarDotProperties.class)
- .add(2001, "Add scope to rules", AddRuleScope.class)
- .add(2002, "Set rules scope to MAIN", SetRuleScopeToMain.class)
- .add(2003, "Make scope not nullable in rules", MakeScopeNotNullableInRules.class)
- .add(2004, "Use rule id in QPROFILE_CHANGES", UseRuleIdInQPChangesData.class)
- .add(2005, "Create table DEPRECATED_RULE_KEYS", CreateDeprecatedRuleKeysTable.class)
- .add(2006, "Clean orphans in Compute Engine child tables", CleanCeChildTablesOrphans.class)
- .add(2007, "Update PERMISSION_TEMPLATES.KEYS ", UpdatePermissionTooLongTemplateKeys.class)
- .add(2008, "Make scope not nullable in rules", MakeScopeNotNullableInRules.class)
- .add(2009, "Create table PROJECT_LINKS2", CreateTableProjectLinks2.class)
- .add(2010, "Populate table PROJECT_LINKS2", PopulateTableProjectLinks2.class)
- .add(2011, "Drop table PROJECT_LINKS", DropTableProjectLinks.class)
- .add(2012, "Rename table PROJECT_LINKS2 to PROJECT_LINKS", RenameTableProjectLinks2ToProjectLinks.class)
- .add(2013, "Create WEBHOOKS Table", CreateWebhooksTable.class)
- .add(2014, "Migrate webhooks from SETTINGS table to WEBHOOKS table", MigrateWebhooksToWebhooksTable.class)
- .add(2015, "Add webhook key to WEBHOOK_DELIVERIES table", AddWebhookKeyToWebhookDeliveriesTable.class)
- .add(2016, "Increase branch type size in PROJECT_BRANCHES", IncreaseBranchTypeSizeForPullRequest.class)
- .add(2017, "Add key_type column in PROJECT_BRANCHES", AddKeyTypeInProjectBranches.class)
- .add(2018, "Fill key_type column in PROJECT_BRANCHES", SetKeyTypeToBranchInProjectBranches.class)
- .add(2019, "Make key_type not nullable in PROJECT_BRANCHES", MakeKeyTypeNotNullableInProjectBranches.class)
- .add(2020, "Replace index in PROJECT_BRANCHES", ReplaceIndexInProjectBranches.class)
- .add(2021, "Add pull_request_data in PROJECT_BRANCHES", AddPullRequestBinaryInProjectBranches.class)
- .add(2022, "Clean broken project to QG references", CleanBrokenProjectToQGReferences.class)
- .add(2023, "Delete measures of project copies", DeleteMeasuresOfProjectCopies.class)
- ;
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v71/DeleteMeasuresOfProjectCopies.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v71/DeleteMeasuresOfProjectCopies.java
deleted file mode 100644
index 70dc926fd03..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v71/DeleteMeasuresOfProjectCopies.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v71;
-
-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 DeleteMeasuresOfProjectCopies extends DataChange {
-
- public DeleteMeasuresOfProjectCopies(Database db) {
- super(db);
- }
-
- @Override
- protected void execute(DataChange.Context context) throws SQLException {
- MassUpdate massUpdate = context.prepareMassUpdate();
- massUpdate.select("select distinct uuid from projects where copy_component_uuid is not null");
- massUpdate.update("delete from project_measures where component_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/v71/DeleteSettingsDefinedInSonarDotProperties.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v71/DeleteSettingsDefinedInSonarDotProperties.java
deleted file mode 100644
index ca6c1f40a52..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v71/DeleteSettingsDefinedInSonarDotProperties.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v71;
-
-import com.google.common.base.Joiner;
-import java.sql.SQLException;
-import java.util.List;
-import org.sonar.api.utils.log.Logger;
-import org.sonar.api.utils.log.Loggers;
-import org.sonar.core.util.stream.MoreCollectors;
-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.SqlStatement;
-
-import static java.util.Arrays.asList;
-
-public class DeleteSettingsDefinedInSonarDotProperties extends DataChange {
-
- private static final Logger LOG = Loggers.get(DeleteSettingsDefinedInSonarDotProperties.class);
-
- private static final List SONAR_PROPERTIES = asList(
- "sonar.jdbc.url",
- "sonar.jdbc.username",
- "sonar.jdbc.password",
- "sonar.jdbc.driverPath",
- "sonar.jdbc.maxActive",
- "sonar.jdbc.maxIdle",
- "sonar.jdbc.minIdle",
- "sonar.jdbc.maxWait",
- "sonar.jdbc.minEvictableIdleTimeMillis",
- "sonar.jdbc.timeBetweenEvictionRunsMillis",
- "sonar.embeddedDatabase.port",
- "sonar.path.data",
- "sonar.path.home",
- "sonar.path.logs",
- "sonar.path.temp",
- "sonar.path.web",
- "sonar.search.host",
- "sonar.search.port",
- "sonar.search.httpPort",
- "sonar.search.javaOpts",
- "sonar.search.javaAdditionalOpts",
- "sonar.search.replicas",
- "sonar.search.minimumMasterNodes",
- "sonar.search.initialStateTimeout",
- "sonar.web.javaOpts",
- "sonar.web.javaAdditionalOpts",
- "sonar.web.port",
- "sonar.auth.jwtBase64Hs256Secret",
- "sonar.ce.javaOpts",
- "sonar.ce.javaAdditionalOpts",
- "sonar.enableStopCommand",
- "http.proxyHost",
- "https.proxyHost",
- "http.proxyPort",
- "https.proxyPort",
- "http.proxyUser",
- "http.proxyPassword",
- "sonar.cluster.enabled",
- "sonar.cluster.node.type",
- "sonar.cluster.search.hosts",
- "sonar.cluster.hosts",
- "sonar.cluster.node.port",
- "sonar.cluster.node.host",
- "sonar.cluster.node.name",
- "sonar.cluster.name",
- "sonar.cluster.web.startupLeader",
- "sonar.sonarcloud.enabled",
- "sonar.updatecenter.activate",
- "http.nonProxyHosts",
- "http.auth.ntlm.domain",
- "socksProxyHost",
- "socksProxyPort",
- "sonar.web.sso.enable",
- "sonar.web.sso.loginHeader",
- "sonar.web.sso.nameHeader",
- "sonar.web.sso.emailHeader",
- "sonar.web.sso.groupsHeader",
- "sonar.web.sso.refreshIntervalInMinutes",
- "sonar.security.realm",
- "sonar.authenticator.ignoreStartupFailure",
- "sonar.telemetry.enable",
- "sonar.telemetry.url",
- "sonar.telemetry.frequencyInSeconds");
-
- private static final Joiner COMMA_JOINER = Joiner.on(",");
-
- public DeleteSettingsDefinedInSonarDotProperties(Database db) {
- super(db);
- }
-
- @Override
- protected void execute(DataChange.Context context) throws SQLException {
- MassUpdate massUpdate = context.prepareMassUpdate();
- String selectSql = "select id, prop_key from properties where prop_key in (";
- selectSql += SONAR_PROPERTIES.stream().map(p -> "?").collect(MoreCollectors.join(COMMA_JOINER));
- selectSql += ")";
- SqlStatement selectStatement = massUpdate.select(selectSql);
- for (int i = 1; i <= SONAR_PROPERTIES.size(); i++) {
- selectStatement.setString(i, SONAR_PROPERTIES.get(i - 1));
- }
- massUpdate.update("delete from properties where id=?");
- massUpdate.execute((row, update) -> {
- update.setLong(1, row.getLong(1));
- LOG.warn("System setting '{}' was defined in database, it has been removed", row.getString(2));
- return true;
- });
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v71/DropTableProjectLinks.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v71/DropTableProjectLinks.java
deleted file mode 100644
index 90e4faa0075..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v71/DropTableProjectLinks.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v71;
-
-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 DropTableProjectLinks extends DdlChange {
-
- public DropTableProjectLinks(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute(new DropTableBuilder(getDialect(), "project_links").build());
- }
-
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v71/IncreaseBranchTypeSizeForPullRequest.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v71/IncreaseBranchTypeSizeForPullRequest.java
deleted file mode 100644
index 042c7929c5b..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v71/IncreaseBranchTypeSizeForPullRequest.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v71;
-
-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 IncreaseBranchTypeSizeForPullRequest extends DdlChange {
- private static final String TABLE_NAME = "project_branches";
-
- public IncreaseBranchTypeSizeForPullRequest(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute(new AlterColumnsBuilder(getDialect(), TABLE_NAME)
- .updateColumn(newVarcharColumnDefBuilder()
- .setColumnName("branch_type")
- .setLimit(12)
- .build())
- .build());
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v71/MakeKeyTypeNotNullableInProjectBranches.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v71/MakeKeyTypeNotNullableInProjectBranches.java
deleted file mode 100644
index a58c709f5d3..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v71/MakeKeyTypeNotNullableInProjectBranches.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v71;
-
-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 MakeKeyTypeNotNullableInProjectBranches extends DdlChange {
- static final String TABLE_NAME = "project_branches";
-
- public MakeKeyTypeNotNullableInProjectBranches(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute(new AlterColumnsBuilder(getDialect(), TABLE_NAME)
- .updateColumn(newVarcharColumnDefBuilder()
- .setColumnName("key_type")
- .setLimit(12)
- .setIsNullable(false)
- .build())
- .build());
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v71/MakeScopeNotNullableInRules.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v71/MakeScopeNotNullableInRules.java
deleted file mode 100644
index 3966ece4bd6..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v71/MakeScopeNotNullableInRules.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v71;
-
-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 MakeScopeNotNullableInRules extends DdlChange {
- private static final String TABLE_NAME = "rules";
-
- public MakeScopeNotNullableInRules(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute(new AlterColumnsBuilder(getDialect(), TABLE_NAME)
- .updateColumn(newVarcharColumnDefBuilder()
- .setColumnName("scope")
- .setLimit(20)
- .setIsNullable(false)
- .build())
- .build());
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v71/MigrateWebhooksToWebhooksTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v71/MigrateWebhooksToWebhooksTable.java
deleted file mode 100644
index 82d31b594af..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v71/MigrateWebhooksToWebhooksTable.java
+++ /dev/null
@@ -1,292 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v71;
-
-import com.google.common.collect.Multimap;
-import java.sql.SQLException;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-import java.util.Optional;
-import java.util.function.Function;
-import javax.annotation.CheckForNull;
-import javax.annotation.Nullable;
-import org.sonar.api.utils.log.Logger;
-import org.sonar.api.utils.log.Loggers;
-import org.sonar.core.util.UuidFactory;
-import org.sonar.core.util.stream.MoreCollectors;
-import org.sonar.db.Database;
-import org.sonar.server.platform.db.migration.step.DataChange;
-import org.sonar.server.platform.db.migration.version.v63.DefaultOrganizationUuidProvider;
-
-import static java.util.stream.Collectors.toList;
-
-public class MigrateWebhooksToWebhooksTable extends DataChange {
-
- private static final long NO_RESOURCE_ID = -8_435_121;
- private static final Logger LOGGER = Loggers.get(MigrateWebhooksToWebhooksTable.class);
-
- private DefaultOrganizationUuidProvider defaultOrganizationUuidProvider;
- private UuidFactory uuidFactory;
-
- public MigrateWebhooksToWebhooksTable(Database db, DefaultOrganizationUuidProvider defaultOrganizationUuidProvider, UuidFactory uuidFactory) {
- super(db);
- this.defaultOrganizationUuidProvider = defaultOrganizationUuidProvider;
- this.uuidFactory = uuidFactory;
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- Multimap rows = context
- .prepareSelect("select" +
- " props.id, props.prop_key, props.resource_id, prj.uuid, props.text_value, props.created_at" +
- " from properties props" +
- " left join projects prj on prj.id = props.resource_id and prj.scope = ? and prj.qualifier = ? and prj.enabled = ?" +
- " where" +
- " props.prop_key like 'sonar.webhooks%'" +
- " and props.text_value is not null")
- .setString(1, "PRJ")
- .setString(2, "TRK")
- .setBoolean(3, true)
- .list(row -> new PropertyRow(
- row.getLong(1),
- row.getString(2),
- row.getNullableLong(3),
- row.getNullableString(4),
- row.getString(5),
- row.getLong(6)))
- .stream()
- .collect(MoreCollectors.index(PropertyRow::getResourceId, Function.identity()));
-
- for (Map.Entry> entry : rows.asMap().entrySet()) {
- long projectId = entry.getKey();
- if (projectId == NO_RESOURCE_ID) {
- migrateGlobalWebhooks(context, entry.getValue());
- } else {
- migrateProjectsWebhooks(context, entry.getValue());
- }
- deleteAllWebhookProperties(context);
- }
- }
-
- private static void deleteAllWebhookProperties(Context context) throws SQLException {
- context
- .prepareUpsert("delete from properties where prop_key like 'sonar.webhooks.global%' or prop_key like 'sonar.webhooks.project%'")
- .execute()
- .commit();
- }
-
- private void migrateGlobalWebhooks(Context context, Collection rows) throws SQLException {
- Multimap rowsByPropertyKey = rows.stream()
- .collect(MoreCollectors.index(PropertyRow::getPropertyKey));
- Optional rootProperty = rowsByPropertyKey.get("sonar.webhooks.global").stream().findFirst();
- if (rootProperty.isPresent()) {
- PropertyRow row = rootProperty.get();
- // can't lambda due to checked exception.
- for (Webhook webhook : extractGlobalWebhooksFrom(context, rowsByPropertyKey, row.value().split(","))) {
- insert(context, webhook);
- }
- }
- }
-
- private List extractGlobalWebhooksFrom(Context context, Multimap rowsByPropertyKey, String[] values) throws SQLException {
- String defaultOrganizationUuid = defaultOrganizationUuidProvider.get(context);
- return Arrays.stream(values)
- .map(value -> {
- Optional name = rowsByPropertyKey.get("sonar.webhooks.global." + value + ".name").stream().findFirst();
- Optional url = rowsByPropertyKey.get("sonar.webhooks.global." + value + ".url").stream().findFirst();
- if (name.isPresent() && url.isPresent()) {
- return new Webhook(
- name.get(),
- url.get(),
- defaultOrganizationUuid,
- null);
- }
- LOGGER.warn(
- "Global webhook missing name and/or url will be deleted (name='{}', url='{}')",
- name.map(PropertyRow::value).orElse(null),
- url.map(PropertyRow::value).orElse(null));
- return null;
- })
- .filter(Objects::nonNull)
- .collect(toList());
- }
-
- private void migrateProjectsWebhooks(Context context, Collection rows) throws SQLException {
- Multimap rowsByPropertyKey = rows.stream()
- .collect(MoreCollectors.index(PropertyRow::getPropertyKey));
- Optional rootProperty = rowsByPropertyKey.get("sonar.webhooks.project").stream().findFirst();
- if (rootProperty.isPresent()) {
- PropertyRow row = rootProperty.get();
- if (row.getProjectUuid() == null) {
- LOGGER.warn("At least one webhook referenced missing or non project resource '{}' and will be deleted", row.getResourceId());
- } else {
- for (Webhook webhook : extractProjectWebhooksFrom(row, rowsByPropertyKey, row.value().split(","))) {
- insert(context, webhook);
- }
- }
- }
- }
-
- private static List extractProjectWebhooksFrom(PropertyRow row, Multimap properties, String[] values) {
- return Arrays.stream(values)
- .map(value -> {
- Optional name = properties.get("sonar.webhooks.project." + value + ".name").stream().findFirst();
- Optional url = properties.get("sonar.webhooks.project." + value + ".url").stream().findFirst();
- if (name.isPresent() && url.isPresent()) {
- return new Webhook(name.get(), url.get(), null, row.projectUuid);
- }
- LOGGER.warn("Project webhook for project {} (id={}) missing name and/or url will be deleted (name='{}', url='{}')",
- row.getProjectUuid(), row.getResourceId(), name.map(PropertyRow::value).orElse(null), url.map(PropertyRow::value).orElse(null));
- return null;
- })
- .filter(Objects::nonNull)
- .collect(MoreCollectors.toList());
- }
-
- private void insert(Context context, Webhook webhook) throws SQLException {
- if (webhook.isValid()) {
- context.prepareUpsert("insert into webhooks (uuid, name, url, organization_uuid, project_uuid, created_at, updated_at) values (?, ?, ?, ?, ?, ?, ?)")
- .setString(1, uuidFactory.create())
- .setString(2, webhook.name())
- .setString(3, webhook.url())
- .setString(4, webhook.organisationUuid())
- .setString(5, webhook.projectUuid())
- .setLong(6, webhook.createdAt())
- .setLong(7, webhook.createdAt())
- .execute()
- .commit();
- } else {
- LOGGER.info("Unable to migrate inconsistent webhook (entry deleted from PROPERTIES) : " + webhook);
- }
- }
-
- private static class PropertyRow {
- private final Long id;
- private final String propertyKey;
- private final Long resourceId;
- private final String projectUuid;
- private final String value;
- private final Long createdAt;
-
- private PropertyRow(long id, String propertyKey, @Nullable Long resourceId, @Nullable String projectUuid, String value, Long createdAt) {
- this.id = id;
- this.propertyKey = propertyKey;
- this.resourceId = resourceId;
- this.projectUuid = projectUuid;
- this.value = value;
- this.createdAt = createdAt;
- }
-
- public Long id() {
- return id;
- }
-
- public String getPropertyKey() {
- return propertyKey;
- }
-
- public long getResourceId() {
- return resourceId == null ? NO_RESOURCE_ID : resourceId;
- }
-
- @CheckForNull
- public String getProjectUuid() {
- return projectUuid;
- }
-
- public String value() {
- return value;
- }
-
- public Long createdAt() {
- return createdAt;
- }
-
- @Override
- public String toString() {
- return "{" +
- "id=" + id +
- ", propertyKey='" + propertyKey + '\'' +
- ", resourceId=" + resourceId +
- ", projectUuid=" + projectUuid +
- ", value='" + value + '\'' +
- ", createdAt=" + createdAt +
- '}';
- }
- }
-
- private static class Webhook {
-
- private final PropertyRow name;
- private final PropertyRow url;
- private String organisationUuid;
- private String projectUuid;
-
- public Webhook(@Nullable PropertyRow name, @Nullable PropertyRow url, @Nullable String organisationUuid, @Nullable String projectUuid) {
- this.name = name;
- this.url = url;
- this.organisationUuid = organisationUuid;
- this.projectUuid = projectUuid;
- }
-
- public String name() {
- return name.value();
- }
-
- public String url() {
- return url.value();
- }
-
- public String organisationUuid() {
- return organisationUuid;
- }
-
- public String projectUuid() {
- return projectUuid;
- }
-
- public Long createdAt() {
- return name.createdAt();
- }
-
- public boolean isValid() {
- return name != null && url != null && name() != null && url() != null && (organisationUuid() != null || projectUuid() != null) && createdAt() != null;
- }
-
- @Override
- public String toString() {
- final StringBuilder s = new StringBuilder().append("Webhook{").append("name=").append(name);
- if (name != null) {
- s.append(name.toString());
- }
- s.append(", url=").append(url);
- if (url != null) {
- s.append(url.toString());
- }
- s.append(", organisationUuid='").append(organisationUuid).append('\'')
- .append(", projectUuid='").append(projectUuid).append('\'').append('}');
- return s.toString();
- }
- }
-
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v71/PopulateTableProjectLinks2.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v71/PopulateTableProjectLinks2.java
deleted file mode 100644
index c4674428896..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v71/PopulateTableProjectLinks2.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v71;
-
-import com.google.common.collect.ImmutableList;
-import java.sql.SQLException;
-import java.util.List;
-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;
-
-/**
- * Populate PROJECT_LINK2 data from PROJECT_LINK table and take the opportunity to do some cleanup :
- * - Ignore link that are not set on project (only take component with qualifier TRK and scope PRJ)
- * - Do not set a name on provided links (SONAR-10411)
- * - Do not copy link on Developer Connection (SONAR-10299)
- */
-public class PopulateTableProjectLinks2 extends DataChange {
-
- private static final String TYPE_HOME_PAGE = "homepage";
- private static final String TYPE_CI = "ci";
- private static final String TYPE_ISSUE_TRACKER = "issue";
- private static final String TYPE_SOURCES = "scm";
- private static final String TYPE_SOURCES_DEV = "scm_dev";
- private static final List PROVIDED_TYPES = ImmutableList.of(TYPE_HOME_PAGE, TYPE_CI, TYPE_ISSUE_TRACKER, TYPE_SOURCES);
-
- private static final String SCOPE_PROJECT = "PRJ";
- private static final String QUALIFIER_PROJECT = "TRK";
-
- private final UuidFactory uuidFactory;
- private final System2 system2;
-
- public PopulateTableProjectLinks2(Database db, UuidFactory uuidFactory, System2 system2) {
- super(db);
- this.uuidFactory = uuidFactory;
- this.system2 = system2;
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- long now = system2.now();
- MassUpdate massUpdate = context.prepareMassUpdate();
- massUpdate.select("SELECT" +
- " p.component_uuid, p.link_type, p.name, p.href" +
- " from project_links p" +
- // Join on projects in order to sanitize orphans (if any)
- " inner join projects prj on prj.uuid=p.component_uuid and prj.scope=? and prj.qualifier=? " +
- " left outer join project_links2 p2" +
- " on p2.project_uuid=p.component_uuid " +
- " and p2.href=p.href" +
- " and p2.link_type=p.link_type" +
- " and (p2.name=p.name or (p2.name is null and p.link_type in (?, ?, ?, ?)))" +
- " where" +
- " p2.uuid is null" +
- " order by p.id")
- .setString(1, SCOPE_PROJECT)
- .setString(2, QUALIFIER_PROJECT)
- .setString(3, TYPE_HOME_PAGE)
- .setString(4, TYPE_CI)
- .setString(5, TYPE_ISSUE_TRACKER)
- .setString(6, TYPE_SOURCES);
- massUpdate.update("insert into project_links2" +
- " (uuid, project_uuid, link_type, name, href, created_at, updated_at)" +
- " values " +
- " (?, ?, ?, ?, ?, ?, ?)");
- massUpdate.rowPluralName("project links");
- massUpdate.execute((row, update) -> {
- String componentUuid = row.getString(1);
- String linkType = row.getString(2);
- String name = row.getString(3);
- String href = row.getString(4);
-
- // project link "developer connection" are removed
- if (linkType.equals(TYPE_SOURCES_DEV)) {
- return false;
- }
-
- update.setString(1, uuidFactory.create());
- update.setString(2, componentUuid);
- update.setString(3, linkType);
- // provided type don't need anymore a name, the UI will display it by getting the i18 bundle of the link_type value
- if (PROVIDED_TYPES.contains(linkType)) {
- update.setString(4, null);
- } else {
- update.setString(4, name);
- }
- update.setString(5, href);
- update.setLong(6, now);
- update.setLong(7, now);
- return true;
- });
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v71/RenameTableProjectLinks2ToProjectLinks.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v71/RenameTableProjectLinks2ToProjectLinks.java
deleted file mode 100644
index 4aa10c6e4c2..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v71/RenameTableProjectLinks2ToProjectLinks.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v71;
-
-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.RenameTableBuilder;
-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 RenameTableProjectLinks2ToProjectLinks extends DdlChange {
-
- public RenameTableProjectLinks2ToProjectLinks(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute(new RenameTableBuilder(getDialect())
- .setName("project_links2")
- .setNewName("project_links")
- .setAutoGeneratedId(false)
- .build());
-
- context.execute(new CreateIndexBuilder()
- .setTable("project_links")
- .setName("project_links_project")
- .addColumn(newVarcharColumnDefBuilder()
- .setColumnName("project_uuid")
- .setLimit(UUID_SIZE)
- .setIsNullable(false)
- .build())
- .build());
- }
-
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v71/ReplaceIndexInProjectBranches.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v71/ReplaceIndexInProjectBranches.java
deleted file mode 100644
index 790abeb3e86..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v71/ReplaceIndexInProjectBranches.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v71;
-
-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.step.DdlChange;
-
-public class ReplaceIndexInProjectBranches extends DdlChange {
-
- static final String TABLE_NAME = "project_branches";
- private static final String OLD_INDEX_NAME = "project_branches_kee";
- static final String NEW_INDEX_NAME = "project_branches_kee_key_type";
-
- static final VarcharColumnDef PROJECT_UUID_COLUMN = VarcharColumnDef.newVarcharColumnDefBuilder()
- .setColumnName("project_uuid")
- .setIsNullable(false)
- .setLimit(50)
- .build();
-
- static final VarcharColumnDef KEE_COLUMN = VarcharColumnDef.newVarcharColumnDefBuilder()
- .setColumnName("kee")
- .setIsNullable(false)
- .setLimit(255)
- .build();
-
- static final VarcharColumnDef KEY_TYPE_COLUMN = VarcharColumnDef.newVarcharColumnDefBuilder()
- .setColumnName("key_type")
- .setIsNullable(false)
- .setLimit(12)
- .build();
-
- public ReplaceIndexInProjectBranches(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute(new DropIndexBuilder(getDialect())
- .setTable(TABLE_NAME)
- .setName(OLD_INDEX_NAME)
- .build());
-
- context.execute(new CreateIndexBuilder()
- .addColumn(PROJECT_UUID_COLUMN)
- .addColumn(KEE_COLUMN)
- .addColumn(KEY_TYPE_COLUMN)
- .setUnique(true)
- .setTable(TABLE_NAME)
- .setName(NEW_INDEX_NAME)
- .build()
- );
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v71/SetKeyTypeToBranchInProjectBranches.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v71/SetKeyTypeToBranchInProjectBranches.java
deleted file mode 100644
index 16d70f128a4..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v71/SetKeyTypeToBranchInProjectBranches.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v71;
-
-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 SetKeyTypeToBranchInProjectBranches extends DataChange {
- static final String TABLE_NAME = "project_branches";
- static final String DEFAULT_KEY_TYPE = "BRANCH";
-
- private final System2 system2;
-
- public SetKeyTypeToBranchInProjectBranches(Database db, System2 system2) {
- super(db);
- this.system2 = system2;
- }
-
- @Override
- protected void execute(Context context) throws SQLException {
- long now = system2.now();
- MassUpdate massUpdate = context.prepareMassUpdate();
- massUpdate.rowPluralName("branches");
- massUpdate.select("select uuid from " + TABLE_NAME + " where key_type is null");
- massUpdate.update("update " + TABLE_NAME + " set key_type=?, updated_at=? where uuid = ?");
- massUpdate.execute((row, update) -> {
- update.setString(1, DEFAULT_KEY_TYPE);
- update.setLong(2, now);
- update.setString(3, row.getString(1));
- return true;
- });
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v71/SetRuleScopeToMain.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v71/SetRuleScopeToMain.java
deleted file mode 100644
index 85376012c87..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v71/SetRuleScopeToMain.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v71;
-
-import java.sql.SQLException;
-import org.sonar.api.rule.RuleScope;
-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 SetRuleScopeToMain extends DataChange {
- private final System2 system2;
-
- public SetRuleScopeToMain(Database db, System2 system2) {
- super(db);
- this.system2 = system2;
- }
-
- @Override
- protected void execute(Context context) throws SQLException {
- long now = system2.now();
- MassUpdate massUpdate = context.prepareMassUpdate();
- massUpdate.select("select id from rules where scope is NULL");
- massUpdate.rowPluralName("rules");
- massUpdate.update("update rules set scope=?, updated_at=? where scope is NULL");
- massUpdate.execute((row, update) -> {
- update.setString(1, RuleScope.MAIN.name());
- update.setLong(2, now);
- return true;
- });
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v71/UpdatePermissionTooLongTemplateKeys.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v71/UpdatePermissionTooLongTemplateKeys.java
deleted file mode 100644
index c5562d269e4..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v71/UpdatePermissionTooLongTemplateKeys.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v71;
-
-import java.sql.SQLException;
-import org.sonar.core.util.UuidFactory;
-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.step.DataChange;
-import org.sonar.server.platform.db.migration.step.MassUpdate;
-
-/**
- * SONAR-10409
- *
- * Update keys of PERMISSION_TEMPLATES that are longer than 40 characters
- */
-public class UpdatePermissionTooLongTemplateKeys extends DataChange {
-
- private final String lengthFunction;
- private final UuidFactory uuidFactory;
-
- public UpdatePermissionTooLongTemplateKeys(Database db, UuidFactory uuidFactory) {
- super(db);
- this.uuidFactory = uuidFactory;
- if (db.getDialect().getId().equals(MsSql.ID)) {
- lengthFunction = "len";
- } else {
- lengthFunction = "length";
- }
- }
-
- @Override
- protected void execute(Context context) throws SQLException {
- MassUpdate massUpdate = context.prepareMassUpdate();
- massUpdate.select("select kee from permission_templates where " + lengthFunction + "(kee) > ?").setInt(1, VarcharColumnDef.UUID_SIZE);
- massUpdate.update("update permission_templates set kee=? where kee=?");
- massUpdate.rowPluralName("permission templates");
-
- massUpdate.execute((row, update) -> {
- String oldKey = row.getString(1);
- String newKey = uuidFactory.create();
-
- update.setString(1, newKey);
- update.setString(2, oldKey);
- return true;
- });
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v71/UseRuleIdInQPChangesData.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v71/UseRuleIdInQPChangesData.java
deleted file mode 100644
index 5edfa913685..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v71/UseRuleIdInQPChangesData.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v71;
-
-import java.sql.SQLException;
-import java.util.Map;
-import java.util.stream.Collectors;
-import org.sonar.api.rule.RuleKey;
-import org.sonar.api.utils.KeyValueFormat;
-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 UseRuleIdInQPChangesData extends DataChange {
-
- private static final String RULE_KEY_DATA_FIELD = "ruleKey";
- private static final String RULE_ID_DATA_FIELD = "ruleId";
-
- public UseRuleIdInQPChangesData(Database db) {
- super(db);
- }
-
- @Override
- protected void execute(Context context) throws SQLException {
- Map ruleKeysById = context.prepareSelect("select id, plugin_name, plugin_rule_key from rules")
- .list(row -> new Rule(row.getInt(1), RuleKey.of(row.getString(2), row.getString(3)).toString()))
- .stream()
- .collect(Collectors.toMap(r -> r.ruleKey, r -> r.ruleId));
-
- MassUpdate massUpdate = context.prepareMassUpdate();
- massUpdate.select("select kee,change_data from qprofile_changes");
- massUpdate.update("update qprofile_changes set change_data=? where kee=?");
- massUpdate.execute(((row, update) -> handle(row, update, ruleKeysById)));
- }
-
- private static boolean handle(Select.Row row, SqlStatement update, Map ruleKeysById) throws SQLException {
- String key = row.getString(1);
- String data = row.getString(2);
-
- Map map = KeyValueFormat.parse(data);
- String ruleKey = map.get(RULE_KEY_DATA_FIELD);
- if (ruleKey == null) {
- return false;
- }
-
- Integer ruleId = ruleKeysById.get(ruleKey);
- if (ruleId != null) {
- map.put(RULE_ID_DATA_FIELD, String.valueOf(ruleId));
- }
- map.remove(RULE_KEY_DATA_FIELD);
-
- update.setString(1, KeyValueFormat.format(map));
- update.setString(2, key);
- return true;
- }
-
- private static final class Rule {
- private final int ruleId;
- private final String ruleKey;
-
- private Rule(int ruleId, String ruleKey) {
- this.ruleId = ruleId;
- this.ruleKey = ruleKey;
- }
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v71/package-info.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v71/package-info.java
deleted file mode 100644
index df0391cec14..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v71/package-info.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public 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.v71;
-
-import javax.annotation.ParametersAreNonnullByDefault;
-
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/AddExternalIdToUsers.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/AddExternalIdToUsers.java
deleted file mode 100644
index 0e95f0bac88..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/AddExternalIdToUsers.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v72;
-
-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 AddExternalIdToUsers extends DdlChange {
-
- public AddExternalIdToUsers(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute(new AddColumnsBuilder(getDialect(), "users")
- .addColumn(newVarcharColumnDefBuilder()
- .setColumnName("external_id")
- .setLimit(255)
- .setIsNullable(true)
- .build())
- .build());
- }
-
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/AddFileSourceLineCount.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/AddFileSourceLineCount.java
deleted file mode 100644
index 839f5b07caf..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/AddFileSourceLineCount.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v72;
-
-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.AddColumnsBuilder;
-import org.sonar.server.platform.db.migration.step.DdlChange;
-
-public class AddFileSourceLineCount extends DdlChange {
- public AddFileSourceLineCount(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute(new AddColumnsBuilder(getDialect(), "file_sources")
- .addColumn(IntegerColumnDef.newIntegerColumnDefBuilder()
- .setColumnName("line_count")
- .setIsNullable(true)
- .build())
- .build());
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/AddHashMethodToUsersTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/AddHashMethodToUsersTable.java
deleted file mode 100644
index 6bf3ae9f011..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/AddHashMethodToUsersTable.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v72;
-
-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 AddHashMethodToUsersTable extends DdlChange {
-
- public AddHashMethodToUsersTable(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute(new AddColumnsBuilder(getDialect(), "users")
- .addColumn(VarcharColumnDef.newVarcharColumnDefBuilder()
- .setColumnName("hash_method")
- .setIsNullable(true)
- .setLimit(10)
- .build())
- .build());
- }
-
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/AddLineHashesVersionToFileSources.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/AddLineHashesVersionToFileSources.java
deleted file mode 100644
index 7da7fe63bd2..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/AddLineHashesVersionToFileSources.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v72;
-
-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.AddColumnsBuilder;
-import org.sonar.server.platform.db.migration.step.DdlChange;
-
-public class AddLineHashesVersionToFileSources extends DdlChange {
-
- public AddLineHashesVersionToFileSources(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute(new AddColumnsBuilder(getDialect(), "file_sources")
- .addColumn(IntegerColumnDef.newIntegerColumnDefBuilder()
- .setColumnName("line_hashes_version")
- .setIsNullable(true)
- .build())
- .build());
- }
-
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/AddOrganizationUuidToUsers.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/AddOrganizationUuidToUsers.java
deleted file mode 100644
index 23ba6d58141..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/AddOrganizationUuidToUsers.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v72;
-
-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.UUID_SIZE;
-import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder;
-
-public class AddOrganizationUuidToUsers extends DdlChange {
-
- public AddOrganizationUuidToUsers(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute(new AddColumnsBuilder(getDialect(), "users")
- .addColumn(newVarcharColumnDefBuilder()
- .setColumnName("organization_uuid")
- .setLimit(UUID_SIZE)
- .setIsNullable(true)
- .build())
- .build());
- }
-
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/AddRuleExternal.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/AddRuleExternal.java
deleted file mode 100644
index e51f6af0172..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/AddRuleExternal.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v72;
-
-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 java.sql.SQLException;
-
-public class AddRuleExternal extends DdlChange {
-
- public AddRuleExternal(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute(new AddColumnsBuilder(getDialect(), "rules")
- .addColumn(BooleanColumnDef.newBooleanColumnDefBuilder()
- .setColumnName("is_external")
- .setIsNullable(true)
- .build())
- .build());
- }
-
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/AddUUIDtoUsers.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/AddUUIDtoUsers.java
deleted file mode 100644
index e37e2b01651..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/AddUUIDtoUsers.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v72;
-
-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 AddUUIDtoUsers extends DdlChange {
-
- private static final String TABLE_NAME = "users";
- private static final String UUID_COLUMN_NAME = "uuid";
- // We need to use a length of 255 as the migration that fed it will use login, which are using a length of 255
- private static final int UUID_LENGTH = 255;
-
- public AddUUIDtoUsers(Database db) {
- super(db);
- }
-
- @Override public void execute(Context context) throws SQLException {
- context.execute(new AddColumnsBuilder(getDialect(), TABLE_NAME)
- .addColumn(VarcharColumnDef.newVarcharColumnDefBuilder()
- .setColumnName(UUID_COLUMN_NAME)
- .setIsNullable(true)
- .setLimit(UUID_LENGTH)
- .build())
- .build());
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/AddUniqueIndexOnRulesParameters.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/AddUniqueIndexOnRulesParameters.java
deleted file mode 100644
index d0644008952..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/AddUniqueIndexOnRulesParameters.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v72;
-
-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.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;
-
-/**
- * The missing unique index can be added when server is up, so
- * blue/green deployment is supported.
- * See {@link PurgeDuplicateRulesParameters} for more details.
- */
-@SupportsBlueGreen
-public class AddUniqueIndexOnRulesParameters extends DdlChange {
-
- public AddUniqueIndexOnRulesParameters(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute(new CreateIndexBuilder()
- .setTable("rules_parameters")
- .setName("rules_parameters_unique")
- .setUnique(true)
- .addColumn(IntegerColumnDef.newIntegerColumnDefBuilder()
- .setColumnName("rule_id")
- .setIsNullable(false)
- .build())
- .addColumn(VarcharColumnDef.newVarcharColumnDefBuilder()
- .setColumnName("name")
- .setLimit(128)
- .setIsNullable(false)
- .build())
- .build());
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/AddUniqueIndexesOnUsers.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/AddUniqueIndexesOnUsers.java
deleted file mode 100644
index 615901e9eb8..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/AddUniqueIndexesOnUsers.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v72;
-
-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;
-
-import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder;
-
-public class AddUniqueIndexesOnUsers extends DdlChange {
-
- public AddUniqueIndexesOnUsers(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute(new CreateIndexBuilder()
- .setTable("users")
- .setName("users_uuid")
- .setUnique(true)
- .addColumn(notNullableColumn("uuid", 255))
- .build());
-
- context.execute(new CreateIndexBuilder()
- .setTable("users")
- .setName("uniq_external_id")
- .setUnique(true)
- .addColumn(notNullableColumn("external_identity_provider", 100))
- .addColumn(notNullableColumn("external_id", 255))
- .build());
- }
-
- private static VarcharColumnDef notNullableColumn(String columnName, int limit) {
- return newVarcharColumnDefBuilder()
- .setColumnName(columnName)
- .setLimit(limit)
- .setIsNullable(false)
- .build();
- }
-
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/CreateAlmAppInstallsTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/CreateAlmAppInstallsTable.java
deleted file mode 100644
index 368b0f915a5..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/CreateAlmAppInstallsTable.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v72;
-
-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.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.MAX_SIZE;
-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 CreateAlmAppInstallsTable extends DdlChange {
-
- private static final String TABLE_NAME = "alm_app_installs";
-
- private static final VarcharColumnDef UUID = newVarcharColumnDefBuilder()
- .setColumnName("uuid")
- .setLimit(UUID_SIZE)
- .setIsNullable(false)
- .build();
- private static final VarcharColumnDef ALM_ID_COLUMN = newVarcharColumnDefBuilder()
- .setColumnName("alm_id")
- .setIsNullable(false)
- .setLimit(40)
- .build();
- private static final VarcharColumnDef OWNER_COLUMN = newVarcharColumnDefBuilder()
- .setColumnName("owner_id")
- .setIsNullable(false)
- .setLimit(MAX_SIZE)
- .build();
- private static final VarcharColumnDef INSTALL_COLUMN = newVarcharColumnDefBuilder()
- .setColumnName("install_id")
- .setIsNullable(false)
- .setLimit(MAX_SIZE)
- .build();
- private static final BigIntegerColumnDef CREATED_AT_COLUMN = newBigIntegerColumnDefBuilder()
- .setColumnName("created_at")
- .setIsNullable(false)
- .build();
- private static final BigIntegerColumnDef UPDATED_AT_COLUMN = newBigIntegerColumnDefBuilder()
- .setColumnName("updated_at")
- .setIsNullable(false)
- .build();
-
- public CreateAlmAppInstallsTable(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
-
- if (!tableExists()) {
- context.execute(new CreateTableBuilder(getDialect(), TABLE_NAME)
- .addPkColumn(UUID)
- .addColumn(ALM_ID_COLUMN)
- .addColumn(OWNER_COLUMN)
- .addColumn(INSTALL_COLUMN)
- .addColumn(CREATED_AT_COLUMN)
- .addColumn(UPDATED_AT_COLUMN)
- .build());
-
- context.execute(new CreateIndexBuilder()
- .addColumn(ALM_ID_COLUMN)
- .addColumn(OWNER_COLUMN)
- .setUnique(true)
- .setTable(TABLE_NAME)
- .setName("alm_app_installs_owner")
- .build());
- context.execute(new CreateIndexBuilder()
- .addColumn(ALM_ID_COLUMN)
- .addColumn(INSTALL_COLUMN)
- .setUnique(true)
- .setTable(TABLE_NAME)
- .setName("alm_app_installs_install")
- .build());
- }
- }
-
- private boolean tableExists() throws SQLException {
- try (Connection connection = getDatabase().getDataSource().getConnection()) {
- return DatabaseUtils.tableExists(TABLE_NAME, connection);
- }
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/CreateProjectMappingsTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/CreateProjectMappingsTable.java
deleted file mode 100644
index e50fc1276ca..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/CreateProjectMappingsTable.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v72;
-
-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.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.MAX_SIZE;
-import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder;
-
-public class CreateProjectMappingsTable extends DdlChange {
-
- private static final String TABLE_NAME = "project_mappings";
-
- private static final VarcharColumnDef UUID_COLUMN = VarcharColumnDef.newVarcharColumnDefBuilder()
- .setColumnName("uuid")
- .setIsNullable(false)
- .setLimit(VarcharColumnDef.UUID_SIZE)
- .build();
- private static final VarcharColumnDef KEY_TYPE_COLUMN = newVarcharColumnDefBuilder()
- .setColumnName("key_type")
- .setIsNullable(false)
- .setLimit(200)
- .build();
- private static final VarcharColumnDef KEE_COLUMN = newVarcharColumnDefBuilder()
- .setColumnName("kee")
- .setIsNullable(false)
- .setLimit(MAX_SIZE)
- .build();
- private static final VarcharColumnDef PROJECT_UUID = VarcharColumnDef.newVarcharColumnDefBuilder()
- .setColumnName("project_uuid")
- .setIsNullable(false)
- .setLimit(VarcharColumnDef.UUID_SIZE)
- .build();
- private static final BigIntegerColumnDef CREATED_AT_COLUMN = newBigIntegerColumnDefBuilder()
- .setColumnName("created_at")
- .setIsNullable(false)
- .build();
-
- public CreateProjectMappingsTable(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
-
- if (!tableExists()) {
- context.execute(new CreateTableBuilder(getDialect(), TABLE_NAME)
- .addPkColumn(UUID_COLUMN)
- .addColumn(KEY_TYPE_COLUMN)
- .addColumn(KEE_COLUMN)
- .addColumn(PROJECT_UUID)
- .addColumn(CREATED_AT_COLUMN)
- .build());
-
- context.execute(new CreateIndexBuilder()
- .addColumn(KEY_TYPE_COLUMN)
- .addColumn(KEE_COLUMN)
- .setUnique(true)
- .setTable(TABLE_NAME)
- .setName("key_type_kee")
- .build());
-
- context.execute(new CreateIndexBuilder()
- .addColumn(PROJECT_UUID)
- .setUnique(false)
- .setTable(TABLE_NAME)
- .setName("project_uuid")
- .build());
- }
- }
-
- private boolean tableExists() throws SQLException {
- try (Connection connection = getDatabase().getDataSource().getConnection()) {
- return DatabaseUtils.tableExists(TABLE_NAME, connection);
- }
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/DbVersion72.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/DbVersion72.java
deleted file mode 100644
index c256d1a495f..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/DbVersion72.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v72;
-
-import org.sonar.server.platform.db.migration.step.MigrationStepRegistry;
-import org.sonar.server.platform.db.migration.version.DbVersion;
-
-public class DbVersion72 implements DbVersion {
-
- @Override
- public void addSteps(MigrationStepRegistry registry) {
- registry
- .add(2100, "Increase size of USERS.CRYPTED_PASSWORD", IncreaseCryptedPasswordSize.class)
- .add(2101, "Add HASH_METHOD to table users", AddHashMethodToUsersTable.class)
- .add(2102, "Populate HASH_METHOD on table users", PopulateHashMethodOnUsers.class)
- .add(2103, "Add isExternal boolean to rules", AddRuleExternal.class)
- .add(2104, "Create ALM_APP_INSTALLS table", CreateAlmAppInstallsTable.class)
- .add(2105, "Add LINE_HASHES_VERSION to table FILE_SOURCES", AddLineHashesVersionToFileSources.class)
- .add(2106, "Create PROJECT_MAPPINGS table", CreateProjectMappingsTable.class)
- .add(2107, "Add UUID on table USERS", AddUUIDtoUsers.class)
- .add(2108, "Populate USERS.UUID with USERS.LOGIN", PopulateUUIDOnUsers.class)
- .add(2109, "Add EXTERNAL_ID on table users", AddExternalIdToUsers.class)
- .add(2110, "Rename EXTERNAL_IDENTITY to EXTERNAL_LOGIN on table users", RenameExternalIdentityToExternalLoginOnUsers.class)
- .add(2111, "Update null values from external columns and login of users", UpdateNullValuesFromExternalColumnsAndLoginOfUsers.class)
- .add(2112, "Fix duplication in EXTERNAL_ID and EXTERNAL_LOGIN on table users", FixDuplicationInExternalLoginOnUsers.class)
- .add(2113, "Makes same columns of table users not nullable", MakeSomeColumnsOfUsersNotNullable.class)
- .add(2114, "Add unique indexes on table users", AddUniqueIndexesOnUsers.class)
- .add(2115, "Add ORGANIZATION_UUID on table users", AddOrganizationUuidToUsers.class)
- .add(2116, "Populate ORGANIZATION_UUID in table users", PopulateOrganizationUuidOnUsers.class)
- .add(2117, "Drop USER_ID from table organizations", DropUserIdFromOrganizations.class)
- .add(2118, "Rename USER_LOGIN TO USER_UUID on table QPROFILE_CHANGES", RenameUserLoginToUserUuidOnTableQProfileChanges.class)
- .add(2119, "Rename LOGIN TO USER_UUID on table USER_TOKENS", RenameLoginToUserUuidOnTableUserTokens.class)
- .add(2120, "Rename USER_LOGIN TO USER_UUID on table MANUAL_MEASURES", RenameUserLoginToUserUuidOnTableManualMeasures.class)
- .add(2121, "Rename NOTE_USER_LOGIN TO NOTE_USER_UUID on table RULES_METADATA", RenameNoteUserLoginToNoteUserUuidOnTableRulesMetadata.class)
- .add(2122, "Rename SUBMITTER_LOGIN TO SUBMITTER_UUID on table CE_QUEUE", RenameSubmitterLoginToSubmitterUuidOnTableCeQueue.class)
- .add(2123, "Rename SUBMITTER_LOGIN TO SUBMITTER_UUID on table CE_ACTIVITY", RenameSubmitterLoginToSubmitterUuidOnTableCeActivity.class)
- .add(2124, "Add FILE_SOURCE.LINE_COUNT", AddFileSourceLineCount.class)
- .add(2125, "Populate FILE_SOURCE.LINE_COUNT", PopulateFileSourceLineCount.class)
- .add(2126, "Make FILE_SOURCE.LINE_COUNT not nullable", MakeFileSourceLineCountNotNullable.class)
- .add(2127, "Purge orphans for Compute Engine", PurgeOrphansForCE.class)
- .add(2128, "Purge duplicate rules_parameters and their orphans", PurgeDuplicateRulesParameters.class)
- .add(2129, "Add unique index on rule_id + name on rules_parameters", AddUniqueIndexOnRulesParameters.class)
- ;
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/DropUserIdFromOrganizations.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/DropUserIdFromOrganizations.java
deleted file mode 100644
index 1c37f0c9310..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/DropUserIdFromOrganizations.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v72;
-
-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 DropUserIdFromOrganizations extends DdlChange {
-
- public DropUserIdFromOrganizations(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute(new DropColumnsBuilder(getDialect(), "organizations", "user_id").build());
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/FixDuplicationInExternalLoginOnUsers.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/FixDuplicationInExternalLoginOnUsers.java
deleted file mode 100644
index 6a7d645da9e..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/FixDuplicationInExternalLoginOnUsers.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v72;
-
-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 FixDuplicationInExternalLoginOnUsers extends DataChange {
-
- private final System2 system2;
-
- public FixDuplicationInExternalLoginOnUsers(Database db, System2 system2) {
- super(db);
- this.system2 = system2;
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- MassUpdate massUpdate = context.prepareMassUpdate().rowPluralName("users having duplicated values in EXTERNAL_LOGIN");
- massUpdate.select("SELECT u1.id, u1.login FROM users u1 " +
- "WHERE EXISTS (SELECT 1 FROM users u2 WHERE u2.external_login = u1.external_login AND u2.id != u1.id)");
- // EXTERNAL_ID is also updated because the column was added previously and content was copied from EXTERNAL_LOGIN
- massUpdate.update("UPDATE users SET external_login=?, external_id=?, updated_at=? WHERE id=?");
-
- long now = system2.now();
- massUpdate.execute((row, update) -> {
- long id = row.getLong(1);
- String login = row.getString(2);
- update.setString(1, login);
- update.setString(2, login);
- update.setLong(3, now);
- update.setLong(4, id);
- return true;
- });
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/IncreaseCryptedPasswordSize.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/IncreaseCryptedPasswordSize.java
deleted file mode 100644
index af654321fc8..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/IncreaseCryptedPasswordSize.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v72;
-
-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 IncreaseCryptedPasswordSize extends DdlChange {
- private static final String TABLE_NAME = "users";
-
- public IncreaseCryptedPasswordSize(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute(new AlterColumnsBuilder(getDialect(), TABLE_NAME)
- .updateColumn(newVarcharColumnDefBuilder()
- .setColumnName("crypted_password")
- .setLimit(100)
- .build())
- .build());
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/MakeFileSourceLineCountNotNullable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/MakeFileSourceLineCountNotNullable.java
deleted file mode 100644
index 0535ee135cf..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/MakeFileSourceLineCountNotNullable.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v72;
-
-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.IntegerColumnDef.newIntegerColumnDefBuilder;
-
-public class MakeFileSourceLineCountNotNullable extends DdlChange {
- public MakeFileSourceLineCountNotNullable(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute(new AlterColumnsBuilder(getDialect(), "file_sources")
- .updateColumn(newIntegerColumnDefBuilder()
- .setColumnName("line_count")
- .setIsNullable(false)
- .build())
- .build());
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/MakeSomeColumnsOfUsersNotNullable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/MakeSomeColumnsOfUsersNotNullable.java
deleted file mode 100644
index 436a9c572e0..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/MakeSomeColumnsOfUsersNotNullable.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v72;
-
-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.sql.CreateIndexBuilder;
-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.VarcharColumnDef.newVarcharColumnDefBuilder;
-
-public class MakeSomeColumnsOfUsersNotNullable extends DdlChange {
-
- public static final String USERS_TABLE = "users";
- public static final String USERS_LOGIN_INDEX = "users_login";
-
- public MakeSomeColumnsOfUsersNotNullable(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute(new DropIndexBuilder(getDialect())
- .setTable(USERS_TABLE)
- .setName(USERS_LOGIN_INDEX)
- .build());
-
- context.execute(new AlterColumnsBuilder(getDialect(), USERS_TABLE)
- .updateColumn(notNullableColumn("uuid", 255))
- .updateColumn(notNullableColumn("login", 255))
- .updateColumn(notNullableColumn("external_id", 255))
- .updateColumn(notNullableColumn("external_login", 255))
- .updateColumn(notNullableColumn("external_identity_provider", 100))
- .build());
-
- context.execute(new CreateIndexBuilder()
- .setTable(USERS_TABLE)
- .setName(USERS_LOGIN_INDEX)
- .addColumn(notNullableColumn("login", 255))
- .setUnique(true)
- .build());
- }
-
- private static VarcharColumnDef notNullableColumn(String columnName, int limit) {
- return newVarcharColumnDefBuilder()
- .setColumnName(columnName)
- .setLimit(limit)
- .setIsNullable(false)
- .build();
- }
-
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/PopulateFileSourceLineCount.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/PopulateFileSourceLineCount.java
deleted file mode 100644
index bdd6961334b..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/PopulateFileSourceLineCount.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v72;
-
-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.step.Select;
-import org.sonar.server.platform.db.migration.step.SqlStatement;
-
-/**
- * New column is populated with value {@code -1} rather than with the number of lines computed from the value of column
- * {@code line_hashes} (which would be the correct value for this column).
- *
- * Column will be populated with the correct value by the new "DB migration step" of the analysis report processing the
- * first time a project is analyzed after SonarQube's upgrade.
- *
- * This innovative approach to DB migration is used because populating the column from {@code line_hashes} will take
- * a very long time on large DBs.
- */
-public class PopulateFileSourceLineCount extends DataChange {
- private static final int LINE_COUNT_NOT_POPULATED = -1;
-
- public PopulateFileSourceLineCount(Database db) {
- super(db);
- }
-
- @Override
- protected void execute(Context context) throws SQLException {
- MassUpdate massUpdate = context.prepareMassUpdate();
- massUpdate.select("select distinct project_uuid from file_sources where line_count is null");
- massUpdate.update("update file_sources set line_count = ? where project_uuid = ?")
- // Having transactions involving many rows can be very slow and should be avoided.
- // A project can have many file_sources, so transaction is committed after each project.
- .setBatchSize(1);
- massUpdate.rowPluralName("file sources");
- massUpdate.execute(PopulateFileSourceLineCount::handle);
- }
-
- private static boolean handle(Select.Row row, SqlStatement update) throws SQLException {
- String projectUuid = row.getString(1);
-
- update.setInt(1, LINE_COUNT_NOT_POPULATED);
- update.setString(2, projectUuid);
- return true;
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/PopulateHashMethodOnUsers.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/PopulateHashMethodOnUsers.java
deleted file mode 100644
index 18d35c7e401..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/PopulateHashMethodOnUsers.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v72;
-
-import java.sql.SQLException;
-import org.sonar.api.utils.System2;
-import org.sonar.db.Database;
-import org.sonar.server.platform.db.migration.step.DataChange;
-
-public class PopulateHashMethodOnUsers extends DataChange {
-
- private final System2 system2;
-
- public PopulateHashMethodOnUsers(Database db, System2 system2) {
- super(db);
- this.system2 = system2;
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.prepareUpsert("UPDATE users SET hash_method=?, updated_at=? WHERE crypted_password IS NOT NULL")
- .setString(1, "SHA1")
- .setLong(2, system2.now())
- .execute()
- .commit();
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/PopulateOrganizationUuidOnUsers.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/PopulateOrganizationUuidOnUsers.java
deleted file mode 100644
index f9f58ead902..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/PopulateOrganizationUuidOnUsers.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v72;
-
-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 PopulateOrganizationUuidOnUsers extends DataChange {
-
- private final System2 system2;
-
- public PopulateOrganizationUuidOnUsers(Database db, System2 system2) {
- super(db);
- this.system2 = system2;
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- MassUpdate massUpdate = context.prepareMassUpdate().rowPluralName("users");
- massUpdate.select("SELECT u.id, o.uuid FROM users u " +
- "INNER JOIN organizations o ON o.user_id=u.id " +
- "WHERE u.organization_uuid IS NULL");
- massUpdate.update("UPDATE users SET organization_uuid=?, updated_at=? WHERE id=?");
-
- long now = system2.now();
- massUpdate.execute((row, update) -> {
- long id = row.getLong(1);
- String organizationUuid = row.getString(2);
- update.setString(1, organizationUuid);
- update.setLong(2, now);
- update.setLong(3, id);
- return true;
- });
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/PopulateUUIDOnUsers.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/PopulateUUIDOnUsers.java
deleted file mode 100644
index b9826f6aafa..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/PopulateUUIDOnUsers.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v72;
-
-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;
-import org.sonar.server.platform.db.migration.step.MassUpdate;
-
-public class PopulateUUIDOnUsers extends DataChange {
-
- private final System2 system2;
- private final UuidFactory uuidFactory;
-
- public PopulateUUIDOnUsers(Database db, System2 system2, UuidFactory uuidFactory) {
- super(db);
- this.system2 = system2;
- this.uuidFactory = uuidFactory;
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- MassUpdate massUpdate = context.prepareMassUpdate();
- massUpdate.select("select id, login from users where uuid is null");
- massUpdate.rowPluralName("users");
- massUpdate.update("update users set uuid=?, updated_at=? where id=?");
- massUpdate.execute((row, update) -> {
- String login = row.getString(2);
- if (login == null) {
- login = uuidFactory.create();
- }
- // login -> uuid
- update.setString(1, login);
- update.setLong(2, system2.now());
- update.setLong(3, row.getLong(1));
- return true;
- });
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/PurgeDuplicateRulesParameters.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/PurgeDuplicateRulesParameters.java
deleted file mode 100644
index 7ea968173ba..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/PurgeDuplicateRulesParameters.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v72;
-
-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;
-
-/**
- * The migration drops duplicated rows from some rules-related tables.
- * The root cause of these duplications is not known. It could even
- * be already fixed. Assuming that the duplications are not created frequently,
- * nor recently, then executing the migration when server is up
- * is safe. Blue/green deployment is supported.
- */
-@SupportsBlueGreen
-public class PurgeDuplicateRulesParameters extends DataChange {
-
- private static final String REMOVE_DUPLICATE_RULES_PARAMS_SQL_FOR_GENERIC =
- "DELETE FROM rules_parameters p1 WHERE id NOT IN (SELECT * FROM (SELECT MIN(id) FROM rules_parameters GROUP BY rule_id, name) temp)";
-
- private static final String REMOVE_DUPLICATE_ACTIVE_RULE_PARAMS_SQL_FOR_GENERIC =
- "DELETE FROM active_rule_parameters arp WHERE arp.rules_parameter_id NOT IN (SELECT * FROM (SELECT MIN(id) FROM rules_parameters GROUP BY rule_id, name) temp)";
-
- private static final String REMOVE_DUPLICATE_RULES_PARAMS_SQL_FOR_MSSQL =
- "DELETE p1 FROM rules_parameters as p1 WHERE id NOT IN (SELECT id FROM (SELECT MIN(id) as id FROM rules_parameters GROUP BY rule_id, name) temp)";
-
- private static final String REMOVE_DUPLICATE_ACTIVE_RULE_PARAMS_SQL_FOR_MSSQL =
- "DELETE arp FROM active_rule_parameters as arp WHERE arp.rules_parameter_id NOT IN (SELECT id FROM (SELECT MIN(id) as id FROM rules_parameters GROUP BY rule_id, name) temp)";
-
- public PurgeDuplicateRulesParameters(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- String removeDuplicateRulesParamsSql;
- String removeDuplicateActiveRuleParamsSql;
- switch (getDialect().getId()) {
- case "mssql":
- removeDuplicateRulesParamsSql = REMOVE_DUPLICATE_RULES_PARAMS_SQL_FOR_MSSQL;
- removeDuplicateActiveRuleParamsSql = REMOVE_DUPLICATE_ACTIVE_RULE_PARAMS_SQL_FOR_MSSQL;
- break;
- default:
- removeDuplicateRulesParamsSql = REMOVE_DUPLICATE_RULES_PARAMS_SQL_FOR_GENERIC;
- removeDuplicateActiveRuleParamsSql = REMOVE_DUPLICATE_ACTIVE_RULE_PARAMS_SQL_FOR_GENERIC;
- break;
- }
-
- context.prepareUpsert(removeDuplicateActiveRuleParamsSql)
- .execute()
- .commit();
- context.prepareUpsert(removeDuplicateRulesParamsSql)
- .execute()
- .commit();
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/PurgeOrphansForCE.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/PurgeOrphansForCE.java
deleted file mode 100644
index e399cd04114..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/PurgeOrphansForCE.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v72;
-
-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;
-
-import static java.util.Arrays.asList;
-
-/**
- * The migration drops the orphans from tables ce_*. It can be executed
- * when server is up, so it supports blue/green deployments.
- */
-@SupportsBlueGreen
-public class PurgeOrphansForCE extends DataChange {
-
- public PurgeOrphansForCE(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- for (String tableName : asList("ce_task_characteristics", "ce_task_input", "ce_scanner_context")) {
- deleteOrphansFrom(context, tableName);
- }
- }
-
- private void deleteOrphansFrom(Context context, String tableName) throws SQLException {
- String query = buildDeleteFromQuery(tableName, "c",
- "not exists (select 1 from ce_activity ca where ca.uuid = c.task_uuid)" +
- "and not exists (select 1 from ce_queue cq where cq.uuid = c.task_uuid)");
-
- context.prepareUpsert(query)
- .execute()
- .commit();
- }
-
- private String buildDeleteFromQuery(String tableName, String alias, String whereClause) {
- String dialectId = getDialect().getId();
- if ("mssql".equals(dialectId)) {
- return "delete " + alias + " from " + tableName + " as " + alias + " where " + whereClause;
- }
- return "delete from " + tableName + " " + alias + " where " + whereClause;
- }
-
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/RenameExternalIdentityToExternalLoginOnUsers.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/RenameExternalIdentityToExternalLoginOnUsers.java
deleted file mode 100644
index 21085b5dd1a..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/RenameExternalIdentityToExternalLoginOnUsers.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v72;
-
-import java.sql.SQLException;
-import org.sonar.db.Database;
-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.newVarcharColumnDefBuilder;
-
-public class RenameExternalIdentityToExternalLoginOnUsers extends DdlChange {
-
- public RenameExternalIdentityToExternalLoginOnUsers(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute(new RenameColumnsBuilder(getDialect(), "users")
- .renameColumn("external_identity",
- newVarcharColumnDefBuilder()
- .setColumnName("external_login")
- .setLimit(255)
- .build())
- .build());
- }
-
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/RenameLoginToUserUuidOnTableUserTokens.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/RenameLoginToUserUuidOnTableUserTokens.java
deleted file mode 100644
index 54fd5f4d061..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/RenameLoginToUserUuidOnTableUserTokens.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v72;
-
-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.newVarcharColumnDefBuilder;
-
-public class RenameLoginToUserUuidOnTableUserTokens extends DdlChange {
-
- private static final String USER_TOKENS_TABLE = "user_tokens";
-
- public RenameLoginToUserUuidOnTableUserTokens(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute(new DropIndexBuilder(getDialect())
- .setTable(USER_TOKENS_TABLE)
- .setName("user_tokens_login_name")
- .build());
-
- VarcharColumnDef userUuidColumn = newVarcharColumnDefBuilder()
- .setColumnName("user_uuid")
- .setLimit(255)
- .setIsNullable(false)
- .build();
- context.execute(new RenameColumnsBuilder(getDialect(), USER_TOKENS_TABLE)
- .renameColumn("login",
- userUuidColumn)
- .build());
-
- context.execute(new CreateIndexBuilder()
- .setTable(USER_TOKENS_TABLE)
- .setName("user_tokens_user_uuid_name")
- .setUnique(true)
- .addColumn(userUuidColumn)
- .addColumn(newVarcharColumnDefBuilder()
- .setColumnName("name")
- .setLimit(100)
- .setIsNullable(false)
- .build())
- .build());
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/RenameNoteUserLoginToNoteUserUuidOnTableRulesMetadata.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/RenameNoteUserLoginToNoteUserUuidOnTableRulesMetadata.java
deleted file mode 100644
index ff1b6592ff6..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/RenameNoteUserLoginToNoteUserUuidOnTableRulesMetadata.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v72;
-
-import java.sql.SQLException;
-import org.sonar.db.Database;
-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.newVarcharColumnDefBuilder;
-
-public class RenameNoteUserLoginToNoteUserUuidOnTableRulesMetadata extends DdlChange {
-
- private static final String TABLE = "rules_metadata";
-
- public RenameNoteUserLoginToNoteUserUuidOnTableRulesMetadata(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute(new RenameColumnsBuilder(getDialect(), TABLE)
- .renameColumn("note_user_login",
- newVarcharColumnDefBuilder()
- .setColumnName("note_user_uuid")
- .setLimit(255)
- .setIsNullable(true)
- .build())
- .build());
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/RenameSubmitterLoginToSubmitterUuidOnTableCeActivity.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/RenameSubmitterLoginToSubmitterUuidOnTableCeActivity.java
deleted file mode 100644
index 42b9406f374..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/RenameSubmitterLoginToSubmitterUuidOnTableCeActivity.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v72;
-
-import java.sql.SQLException;
-import org.sonar.db.Database;
-import org.sonar.server.platform.db.migration.es.MigrationEsClient;
-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.newVarcharColumnDefBuilder;
-
-public class RenameSubmitterLoginToSubmitterUuidOnTableCeActivity extends DdlChange {
-
- private final MigrationEsClient esClient;
-
- public RenameSubmitterLoginToSubmitterUuidOnTableCeActivity(Database db, MigrationEsClient esClient) {
- super(db);
- this.esClient = esClient;
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute(new RenameColumnsBuilder(getDialect(), "ce_activity")
- .renameColumn("submitter_login",
- newVarcharColumnDefBuilder()
- .setColumnName("submitter_uuid")
- .setLimit(255)
- .setIsNullable(true)
- .build())
- .build());
-
- esClient.deleteIndexes("users");
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/RenameSubmitterLoginToSubmitterUuidOnTableCeQueue.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/RenameSubmitterLoginToSubmitterUuidOnTableCeQueue.java
deleted file mode 100644
index d868e6c8d23..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/RenameSubmitterLoginToSubmitterUuidOnTableCeQueue.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v72;
-
-import java.sql.SQLException;
-import org.sonar.db.Database;
-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.newVarcharColumnDefBuilder;
-
-public class RenameSubmitterLoginToSubmitterUuidOnTableCeQueue extends DdlChange {
-
- public RenameSubmitterLoginToSubmitterUuidOnTableCeQueue(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute(new RenameColumnsBuilder(getDialect(), "ce_queue")
- .renameColumn("submitter_login",
- newVarcharColumnDefBuilder()
- .setColumnName("submitter_uuid")
- .setLimit(255)
- .setIsNullable(true)
- .build())
- .build());
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/RenameUserLoginToUserUuidOnTableManualMeasures.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/RenameUserLoginToUserUuidOnTableManualMeasures.java
deleted file mode 100644
index 67f46fe0007..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/RenameUserLoginToUserUuidOnTableManualMeasures.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v72;
-
-import java.sql.SQLException;
-import org.sonar.db.Database;
-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.newVarcharColumnDefBuilder;
-
-public class RenameUserLoginToUserUuidOnTableManualMeasures extends DdlChange {
-
- private static final String TABLE = "manual_measures";
-
- public RenameUserLoginToUserUuidOnTableManualMeasures(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute(new RenameColumnsBuilder(getDialect(), TABLE)
- .renameColumn("user_login",
- newVarcharColumnDefBuilder()
- .setColumnName("user_uuid")
- .setLimit(255)
- .setIsNullable(true)
- .build())
- .build());
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/RenameUserLoginToUserUuidOnTableQProfileChanges.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/RenameUserLoginToUserUuidOnTableQProfileChanges.java
deleted file mode 100644
index 912f850cea7..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/RenameUserLoginToUserUuidOnTableQProfileChanges.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v72;
-
-import java.sql.SQLException;
-import org.sonar.db.Database;
-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.newVarcharColumnDefBuilder;
-
-public class RenameUserLoginToUserUuidOnTableQProfileChanges extends DdlChange {
-
- public RenameUserLoginToUserUuidOnTableQProfileChanges(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute(new RenameColumnsBuilder(getDialect(), "qprofile_changes")
- .renameColumn("user_login",
- newVarcharColumnDefBuilder()
- .setColumnName("user_uuid")
- .setLimit(255)
- .setIsNullable(true)
- .build())
- .build());
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/UpdateNullValuesFromExternalColumnsAndLoginOfUsers.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/UpdateNullValuesFromExternalColumnsAndLoginOfUsers.java
deleted file mode 100644
index 3bc54f68c5e..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/UpdateNullValuesFromExternalColumnsAndLoginOfUsers.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v72;
-
-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.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;
-
-/**
- * The goal of this migration is to sanitize disabled USERS, regarding new way of authentication users.
- * Indeed, authentication will search for user by LOGIN but also by using EXTERNAL_ID and EXTERNAL_PROVIDER.
- *
- * As a consequence, these columns must be set as NOT NULL in order to add a UNIQUE index on them.
- *
- * Unfortunately, these columns were previously set as null when disabling a user, that's why we need to populate them.
- */
-public class UpdateNullValuesFromExternalColumnsAndLoginOfUsers extends DataChange {
-
- private static final Logger LOG = Loggers.get(UpdateNullValuesFromExternalColumnsAndLoginOfUsers.class);
-
- private final System2 system2;
- private UuidFactory uuidFactory;
-
- public UpdateNullValuesFromExternalColumnsAndLoginOfUsers(Database db, System2 system2, UuidFactory uuidFactory) {
- super(db);
- this.system2 = system2;
- this.uuidFactory = uuidFactory;
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- MassUpdate massUpdate = context.prepareMassUpdate().rowPluralName("users");
- massUpdate.select("SELECT id, login, external_login, external_identity_provider FROM users " +
- "WHERE login IS NULL OR external_login IS NULL OR external_id IS NULL OR external_identity_provider IS NULL");
- massUpdate.update("UPDATE users SET login=?, external_login=?, external_id=?, external_identity_provider=?, updated_at=? WHERE id=?");
-
- long now = system2.now();
- massUpdate.execute((row, update) -> {
- long id = row.getLong(1);
- String login = row.getString(2);
- if (login == null) {
- LOG.warn("No login has been found for user id '{}'. A UUID has been generated to not have null value.", id);
- login = uuidFactory.create();
- }
- String externalLogin = row.getNullableString(3);
- externalLogin = externalLogin == null ? login : externalLogin;
-
- String externalIdentityProvider = row.getNullableString(4);
-
- update.setString(1, login);
- update.setString(2, externalLogin);
- update.setString(3, externalLogin);
- update.setString(4, externalIdentityProvider == null ? "sonarqube" : externalIdentityProvider);
- update.setLong(5, now);
- update.setLong(6, id);
- return true;
- });
- }
-
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/package-info.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/package-info.java
deleted file mode 100644
index db577f646f1..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v72/package-info.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public 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.v72;
-
-import javax.annotation.ParametersAreNonnullByDefault;
-
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v73/AddFromHotspotFlagToIssues.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v73/AddFromHotspotFlagToIssues.java
deleted file mode 100644
index b4751a51081..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v73/AddFromHotspotFlagToIssues.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v73;
-
-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 AddFromHotspotFlagToIssues extends DdlChange {
-
- public AddFromHotspotFlagToIssues(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute(new AddColumnsBuilder(getDialect(), "issues")
- .addColumn(newBooleanColumnDefBuilder()
- .setColumnName("from_hotspot")
- .setIsNullable(true)
- .build())
- .build());
- }
-
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v73/AddIndexOnOrganizationMembers.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v73/AddIndexOnOrganizationMembers.java
deleted file mode 100644
index 1055e19f666..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v73/AddIndexOnOrganizationMembers.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v73;
-
-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.IntegerColumnDef;
-import org.sonar.server.platform.db.migration.sql.CreateIndexBuilder;
-import org.sonar.server.platform.db.migration.step.DdlChange;
-
-@SupportsBlueGreen
-public class AddIndexOnOrganizationMembers extends DdlChange {
- public AddIndexOnOrganizationMembers(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute(
- new CreateIndexBuilder()
- .setTable("organization_members")
- .setName("ix_org_members_on_user_id")
- .addColumn(IntegerColumnDef.newIntegerColumnDefBuilder()
- .setColumnName("user_id")
- .setIsNullable(false)
- .build())
- .build());
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v73/AddSecurityStandardsToRules.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v73/AddSecurityStandardsToRules.java
deleted file mode 100644
index 13f95696f56..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v73/AddSecurityStandardsToRules.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v73;
-
-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.AddColumnsBuilder;
-import org.sonar.server.platform.db.migration.step.DdlChange;
-
-@SupportsBlueGreen
-public class AddSecurityStandardsToRules extends DdlChange {
-
- private static final String TABLE_NAME = "rules";
- private static final String COLUMN_NAME = "security_standards";
- private static final int COLUMN_LENGTH = 4000;
-
- public AddSecurityStandardsToRules(Database db) {
- super(db);
- }
-
- @Override public void execute(Context context) throws SQLException {
- context.execute(new AddColumnsBuilder(getDialect(), TABLE_NAME)
- .addColumn(VarcharColumnDef.newVarcharColumnDefBuilder()
- .setColumnName(COLUMN_NAME)
- .setIsNullable(true)
- .setLimit(COLUMN_LENGTH)
- .build())
- .build());
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v73/AddSubscriptionToOrganizations.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v73/AddSubscriptionToOrganizations.java
deleted file mode 100644
index 541b0127dc1..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v73/AddSubscriptionToOrganizations.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v73;
-
-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.VarcharColumnDef.newVarcharColumnDefBuilder;
-
-@SupportsBlueGreen
-public class AddSubscriptionToOrganizations extends DdlChange {
-
- public AddSubscriptionToOrganizations(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute(new AddColumnsBuilder(getDialect(), "organizations")
- .addColumn(newVarcharColumnDefBuilder()
- .setColumnName("subscription")
- .setLimit(40)
- .setIsNullable(true)
- .build())
- .build());
- }
-
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v73/CreateProjectAlmBindingsTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v73/CreateProjectAlmBindingsTable.java
deleted file mode 100644
index 11163f36e53..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v73/CreateProjectAlmBindingsTable.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v73;
-
-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.SupportsBlueGreen;
-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;
-
-@SupportsBlueGreen
-public class CreateProjectAlmBindingsTable extends DdlChange {
-
- private static final String TABLE_NAME = "project_alm_bindings";
-
- private static final VarcharColumnDef UUID = newVarcharColumnDefBuilder()
- .setColumnName("uuid")
- .setLimit(UUID_SIZE)
- .setIsNullable(false)
- .build();
- private static final VarcharColumnDef ALM_ID_COLUMN = newVarcharColumnDefBuilder()
- .setColumnName("alm_id")
- .setIsNullable(false)
- .setLimit(40)
- .build();
- private static final VarcharColumnDef REPO_ID_COLUMN = newVarcharColumnDefBuilder()
- .setColumnName("repo_id")
- .setIsNullable(false)
- .setLimit(256)
- .build();
- private static final VarcharColumnDef PROJECT_UUID_COLUMN = newVarcharColumnDefBuilder()
- .setColumnName("project_uuid")
- .setIsNullable(false)
- .setLimit(40)
- .build();
- private static final VarcharColumnDef GITHUB_SLUG_COLUMN = newVarcharColumnDefBuilder()
- .setColumnName("github_slug")
- .setIsNullable(true)
- .setLimit(256)
- .build();
- private static final VarcharColumnDef URL_COLUMN = newVarcharColumnDefBuilder()
- .setColumnName("url")
- .setIsNullable(false)
- .setLimit(2000)
- .build();
- private static final BigIntegerColumnDef CREATED_AT_COLUMN = newBigIntegerColumnDefBuilder()
- .setColumnName("created_at")
- .setIsNullable(false)
- .build();
- private static final BigIntegerColumnDef UPDATED_AT_COLUMN = newBigIntegerColumnDefBuilder()
- .setColumnName("updated_at")
- .setIsNullable(false)
- .build();
-
- public CreateProjectAlmBindingsTable(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
-
- if (!tableExists()) {
- context.execute(new CreateTableBuilder(getDialect(), TABLE_NAME)
- .addPkColumn(UUID)
- .addColumn(ALM_ID_COLUMN)
- .addColumn(REPO_ID_COLUMN)
- .addColumn(PROJECT_UUID_COLUMN)
- .addColumn(GITHUB_SLUG_COLUMN)
- .addColumn(URL_COLUMN)
- .addColumn(CREATED_AT_COLUMN)
- .addColumn(UPDATED_AT_COLUMN)
- .build());
-
- context.execute(new CreateIndexBuilder()
- .addColumn(ALM_ID_COLUMN)
- .addColumn(REPO_ID_COLUMN)
- .setUnique(true)
- .setTable(TABLE_NAME)
- .setName(TABLE_NAME + "_alm_repo")
- .build());
- context.execute(new CreateIndexBuilder()
- .addColumn(PROJECT_UUID_COLUMN)
- .setUnique(true)
- .setTable(TABLE_NAME)
- .setName(TABLE_NAME + "_project")
- .build());
- }
- }
-
- private boolean tableExists() throws SQLException {
- try (Connection connection = getDatabase().getDataSource().getConnection()) {
- return DatabaseUtils.tableExists(TABLE_NAME, connection);
- }
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v73/DbVersion73.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v73/DbVersion73.java
deleted file mode 100644
index 1852a795727..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v73/DbVersion73.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v73;
-
-import org.sonar.server.platform.db.migration.step.MigrationStepRegistry;
-import org.sonar.server.platform.db.migration.version.DbVersion;
-
-public class DbVersion73 implements DbVersion {
-
- @Override
- public void addSteps(MigrationStepRegistry registry) {
- registry
- .add(2200, "Populate PROJECT_BRANCHES with existing main application branches", PopulateMainApplicationBranches.class)
- .add(2201, "Add 'securityhotspotadmin' permission to all permission templates groups already having 'issueadmin'", PopulateHotspotAdminPermissionOnTemplatesGroups.class)
- .add(2202, "Add 'securityhotspotadmin' permission to all permission templates users already having 'issueadmin'", PopulateHotspotAdminPermissionOnTemplatesUsers.class)
- .add(2203, "Add 'securityhotspotadmin' permission to all groups already having 'issueadmin'", PopulateHotspotAdminPermissionOnGroups.class)
- .add(2204, "Add 'securityhotspotadmin' permission to all users already having 'issueadmin'", PopulateHotspotAdminPermissionOnUsers.class)
- .add(2205, "Add 'from hotspot' flag to issues", AddFromHotspotFlagToIssues.class)
- .add(2206, "Add SUBSCRIPTION column to ORGANIZATIONS table", AddSubscriptionToOrganizations.class)
- .add(2207, "Populate SUBSCRIPTION in ORGANIZATIONS", PopulateSubscriptionOnOrganizations.class)
- .add(2208, "Add rules.security_standards", AddSecurityStandardsToRules.class)
- .add(2209, "Fix missing quality profiles on organizations", FixMissingQualityProfilesOnOrganizations.class)
- .add(2210, "Add 'securityhotspotadmin' permission to templates characteristics already having 'issueadmin'", PopulateHotspotAdminPermissionOnTemplatesCharacteristics.class)
- .add(2211, "Set SUBSCRIPTION not nullable in ORGANIZATIONS", SetSubscriptionOnOrganizationsNotNullable.class)
- .add(2212, "Add index on ORGANIZATION_MEMBERS", AddIndexOnOrganizationMembers.class)
- .add(2213, "Create table to store project ALM bindings", CreateProjectAlmBindingsTable.class)
- ;
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v73/FixMissingQualityProfilesOnOrganizations.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v73/FixMissingQualityProfilesOnOrganizations.java
deleted file mode 100644
index ff1f5a98789..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v73/FixMissingQualityProfilesOnOrganizations.java
+++ /dev/null
@@ -1,172 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v73;
-
-import com.google.common.collect.ArrayListMultimap;
-import com.google.common.collect.ListMultimap;
-import java.sql.SQLException;
-import java.util.List;
-import org.sonar.api.config.Configuration;
-import org.sonar.api.utils.System2;
-import org.sonar.core.util.UuidFactory;
-import org.sonar.db.Database;
-import org.sonar.db.dialect.MsSql;
-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.util.stream.Collectors.joining;
-
-@SupportsBlueGreen
-// SONAR-11021
-public class FixMissingQualityProfilesOnOrganizations extends DataChange {
-
- private final System2 system2;
- private final UuidFactory uuidFactory;
- private final Configuration configuration;
- private final String as;
-
- public FixMissingQualityProfilesOnOrganizations(Database db, System2 system2, UuidFactory uuidFactory, Configuration configuration) {
- super(db);
- this.system2 = system2;
- this.uuidFactory = uuidFactory;
- this.configuration = configuration;
- if (db.getDialect().getId().equals(MsSql.ID)) {
- as = " AS ";
- } else {
- as = "";
- }
- }
-
- @Override
- protected void execute(Context context) throws SQLException {
- if (!configuration.getBoolean("sonar.sonarcloud.enabled").orElse(false)) {
- return;
- }
-
- long now = system2.now();
-
- insertMissingOrgQProfiles(context, now);
- insertMissingDefaultQProfiles(context, now);
- }
-
- private void insertMissingOrgQProfiles(Context context, long now) throws SQLException {
- MassUpdate massUpdate = context
- .prepareMassUpdate()
- .rowPluralName("Organization quality profiles");
- massUpdate.select("SELECT o.uuid, rp.kee FROM organizations " + as + " o, rules_profiles " + as + " rp " +
- "WHERE rp.is_built_in = ? " +
- "AND NOT EXISTS(SELECT (1) FROM org_qprofiles oqp WHERE oqp.organization_uuid = o.uuid AND oqp.rules_profile_uuid = rp.kee)")
- .setBoolean(1, true);
- massUpdate.update("INSERT INTO org_qprofiles (uuid, organization_uuid, rules_profile_uuid, created_at, updated_at) VALUES(?, ?, ?, ?, ?)");
- massUpdate.execute((row, update) -> {
- String organizationUuid = row.getString(1);
- String rulesProfileUuid = row.getString(2);
- update.setString(1, uuidFactory.create());
- update.setString(2, organizationUuid);
- update.setString(3, rulesProfileUuid);
- update.setLong(4, now);
- update.setLong(5, now);
-
- return true;
- });
- }
-
- private void insertMissingDefaultQProfiles(Context context, long now) throws SQLException {
- String defaultRulesProfileKees = reduceBuiltInQualityProfiles(context)
- .stream()
- .map(qp -> "'" + qp.kee + "'")
- .collect(joining(","));
-
- if (defaultRulesProfileKees.isEmpty()) {
- return;
- }
-
- MassUpdate massUpdate = context
- .prepareMassUpdate()
- .rowPluralName("Organization default quality profiles");
- massUpdate.select("SELECT o.uuid, oqp.uuid, rp.language FROM organizations " + as + " o, org_qprofiles " + as + " oqp, rules_profiles " + as + " rp " +
- "WHERE oqp.rules_profile_uuid = rp.kee " +
- "AND oqp.organization_uuid = o.uuid " +
- "AND rp.kee IN ( " + defaultRulesProfileKees + " ) " +
- "AND NOT EXISTS(SELECT(1) FROM default_qprofiles dqp WHERE dqp.organization_uuid = o.uuid AND dqp.language = rp.language)");
- massUpdate.update("INSERT INTO default_qprofiles (organization_uuid, language, qprofile_uuid, created_at, updated_at) VALUES(?, ?, ?, ?, ?)");
- massUpdate.execute((row, update) -> {
- String organizationUuid = row.getString(1);
- String orgQProfileUuid = row.getString(2);
- String language = row.getString(3);
- update.setString(1, organizationUuid);
- update.setString(2, language);
- update.setString(3, orgQProfileUuid);
- update.setLong(4, now);
- update.setLong(5, now);
-
- return true;
- });
- }
-
- /**
- * Return the list of preferred built-in quality profiles.
- * In the current state of database, the information of the "by-default" one is absent (handled by plugin).
- * Let's choose the "Sonar Way" one, fallbacking to the first one
- *
- * This methods is returning the list of rules_profiles kee of built-in quality profiles with one by language
- */
- private static List reduceBuiltInQualityProfiles(Context context) throws SQLException {
- ListMultimap builtInQPByLanguages = ArrayListMultimap.create();
-
- List builtInQProfiles = context.prepareSelect("SELECT kee, language, name FROM rules_profiles WHERE is_built_in = ?")
- .setBoolean(1, true)
- .list(row -> new BuiltInQProfile(row.getString(1), row.getString(2), row.getString(3)));
-
- builtInQProfiles.forEach(builtInQProfile -> builtInQPByLanguages.put(builtInQProfile.language, builtInQProfile));
-
- // Filter all built in quality profiles to have only one by language
- // And prefer the one named "Sonar Way"
- builtInQPByLanguages.keySet().forEach(l -> {
- List qps = builtInQPByLanguages.get(l);
- if (qps.size() > 1) {
- BuiltInQProfile sonarWay = qps.stream().filter(qp -> qp.name.equals("Sonar way"))
- .findFirst()
- .orElse(qps.get(0));
- qps.forEach(qp -> {
- if (qp.kee.equals(sonarWay.kee)) {
- return;
- }
- builtInQProfiles.remove(qp);
- });
- }
- });
-
- return builtInQProfiles;
- }
-
- private static class BuiltInQProfile {
- private final String kee;
- private final String language;
- private final String name;
-
- public BuiltInQProfile(String kee, String language, String name) {
- this.kee = kee;
- this.language = language;
- this.name = name;
- }
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v73/PopulateHotspotAdminPermissionOnGroups.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v73/PopulateHotspotAdminPermissionOnGroups.java
deleted file mode 100644
index 195e2ce12bf..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v73/PopulateHotspotAdminPermissionOnGroups.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v73;
-
-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;
-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;
-
-@SupportsBlueGreen
-public class PopulateHotspotAdminPermissionOnGroups extends DataChange {
- private static final String ISSUE_ADMIN_ROLE = "issueadmin";
- private static final String HOTSPOT_ADMIN_ROLE = "securityhotspotadmin";
-
- public PopulateHotspotAdminPermissionOnGroups(Database db) {
- super(db);
- }
-
- @Override
- protected void execute(Context context) throws SQLException {
- MassUpdate massUpdate = context.prepareMassUpdate();
- massUpdate.select("SELECT group_id, resource_id, organization_uuid" +
- " FROM group_roles gr1" +
- " WHERE role = ?" +
- " AND NOT EXISTS (" +
- " SELECT id" +
- " FROM group_roles gr2" +
- " WHERE role = ?" +
- " AND gr1.group_id = gr2.group_id" +
- " AND gr1.resource_id = gr2.resource_id" +
- " AND gr1.organization_uuid = gr2.organization_uuid)")
- .setString(1, ISSUE_ADMIN_ROLE)
- .setString(2, HOTSPOT_ADMIN_ROLE);
- massUpdate.update("INSERT INTO group_roles (group_id, resource_id, organization_uuid, role) values (?,?,?,?)");
- massUpdate.rowPluralName("group roles");
- massUpdate.execute(PopulateHotspotAdminPermissionOnGroups::handle);
- }
-
- private static boolean handle(Select.Row row, SqlStatement update) throws SQLException {
- int groupId = row.getInt(1);
- int resourceId = row.getInt(2);
- String organizationUuid = row.getString(3);
-
- update.setInt(1, groupId);
- update.setInt(2, resourceId);
- update.setString(3, organizationUuid);
- update.setString(4, HOTSPOT_ADMIN_ROLE);
- return true;
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v73/PopulateHotspotAdminPermissionOnTemplatesCharacteristics.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v73/PopulateHotspotAdminPermissionOnTemplatesCharacteristics.java
deleted file mode 100644
index f8458a4a610..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v73/PopulateHotspotAdminPermissionOnTemplatesCharacteristics.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v73;
-
-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;
-import org.sonar.server.platform.db.migration.step.Select;
-import org.sonar.server.platform.db.migration.step.SqlStatement;
-
-@SupportsBlueGreen
-public class PopulateHotspotAdminPermissionOnTemplatesCharacteristics extends DataChange {
- private static final String ISSUE_ADMIN_ROLE = "issueadmin";
- private static final String HOTSPOT_ADMIN_ROLE = "securityhotspotadmin";
- private final System2 system2;
-
- public PopulateHotspotAdminPermissionOnTemplatesCharacteristics(Database db, System2 system2) {
- super(db);
- this.system2 = system2;
- }
-
- @Override
- protected void execute(Context context) throws SQLException {
- Date now = new Date(system2.now());
- MassUpdate massUpdate = context.prepareMassUpdate();
- massUpdate.select("SELECT template_id" +
- " FROM perm_tpl_characteristics c1" +
- " WHERE permission_key = ?" +
- " AND with_project_creator = ?" +
- " AND NOT EXISTS (" +
- " SELECT id" +
- " FROM perm_tpl_characteristics c2" +
- " WHERE permission_key = ?" +
- " AND c1.template_id = c2.template_id)")
- .setString(1, ISSUE_ADMIN_ROLE)
- .setBoolean(2, true)
- .setString(3, HOTSPOT_ADMIN_ROLE);
- massUpdate.update("INSERT INTO perm_tpl_characteristics (template_id, permission_key, with_project_creator, created_at, updated_at) values (?,?,?,?,?)");
- massUpdate.rowPluralName("permission templates characteristics");
- massUpdate.execute((row, update) -> handle(row, update, now.getTime()));
- }
-
- private static boolean handle(Select.Row row, SqlStatement update, long now) throws SQLException {
- int templateId = row.getInt(1);
-
- update.setInt(1, templateId);
- update.setString(2, HOTSPOT_ADMIN_ROLE);
- update.setBoolean(3, true);
- update.setLong(4, now);
- update.setLong(5, now);
- return true;
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v73/PopulateHotspotAdminPermissionOnTemplatesGroups.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v73/PopulateHotspotAdminPermissionOnTemplatesGroups.java
deleted file mode 100644
index 1b241dc40ca..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v73/PopulateHotspotAdminPermissionOnTemplatesGroups.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v73;
-
-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;
-import org.sonar.server.platform.db.migration.step.Select;
-import org.sonar.server.platform.db.migration.step.SqlStatement;
-
-@SupportsBlueGreen
-public class PopulateHotspotAdminPermissionOnTemplatesGroups extends DataChange {
- private static final String ISSUE_ADMIN_ROLE = "issueadmin";
- private static final String HOTSPOT_ADMIN_ROLE = "securityhotspotadmin";
- private final System2 system2;
-
- public PopulateHotspotAdminPermissionOnTemplatesGroups(Database db, System2 system2) {
- super(db);
- this.system2 = system2;
- }
-
- @Override
- protected void execute(Context context) throws SQLException {
- Date now = new Date(system2.now());
- MassUpdate massUpdate = context.prepareMassUpdate();
- massUpdate.select("SELECT group_id, template_id" +
- " FROM perm_templates_groups gr1" +
- " WHERE permission_reference = ?" +
- " AND NOT EXISTS (" +
- " SELECT id" +
- " FROM perm_templates_groups gr2" +
- " WHERE permission_reference = ?" +
- " AND gr1.group_id = gr2.group_id" +
- " AND gr1.template_id = gr2.template_id)")
- .setString(1, ISSUE_ADMIN_ROLE)
- .setString(2, HOTSPOT_ADMIN_ROLE);
- massUpdate.update("INSERT INTO perm_templates_groups (group_id, template_id, permission_reference, created_at, updated_at) values (?,?,?,?,?)");
- massUpdate.rowPluralName("permission templates groups roles");
- massUpdate.execute((row, update) -> handle(row, update, now));
- }
-
- private static boolean handle(Select.Row row, SqlStatement update, Date now) throws SQLException {
- int groupId = row.getInt(1);
- int templateId = row.getInt(2);
-
- update.setInt(1, groupId);
- update.setInt(2, templateId);
- update.setString(3, HOTSPOT_ADMIN_ROLE);
- update.setDate(4, now);
- update.setDate(5, now);
- return true;
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v73/PopulateHotspotAdminPermissionOnTemplatesUsers.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v73/PopulateHotspotAdminPermissionOnTemplatesUsers.java
deleted file mode 100644
index be4a281d38d..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v73/PopulateHotspotAdminPermissionOnTemplatesUsers.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v73;
-
-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;
-import org.sonar.server.platform.db.migration.step.Select;
-import org.sonar.server.platform.db.migration.step.SqlStatement;
-
-@SupportsBlueGreen
-public class PopulateHotspotAdminPermissionOnTemplatesUsers extends DataChange {
- private static final String ISSUE_ADMIN_ROLE = "issueadmin";
- private static final String HOTSPOT_ADMIN_ROLE = "securityhotspotadmin";
- private final System2 system2;
-
- public PopulateHotspotAdminPermissionOnTemplatesUsers(Database db, System2 system2) {
- super(db);
- this.system2 = system2;
- }
-
- @Override
- protected void execute(Context context) throws SQLException {
- Date now = new Date(system2.now());
- MassUpdate massUpdate = context.prepareMassUpdate();
- massUpdate.select("SELECT user_id, template_id" +
- " FROM perm_templates_users u1" +
- " WHERE permission_reference = ?" +
- " AND NOT EXISTS (" +
- " SELECT id" +
- " FROM perm_templates_users u2" +
- " WHERE permission_reference = ?" +
- " AND u1.user_id = u2.user_id" +
- " AND u1.template_id = u2.template_id)")
- .setString(1, ISSUE_ADMIN_ROLE)
- .setString(2, HOTSPOT_ADMIN_ROLE);
- massUpdate.update("INSERT INTO perm_templates_users (user_id, template_id, permission_reference, created_at, updated_at) values (?,?,?,?,?)");
- massUpdate.rowPluralName("permission templates users roles");
- massUpdate.execute((row, update) -> handle(row, update, now));
- }
-
- private static boolean handle(Select.Row row, SqlStatement update, Date now) throws SQLException {
- int userId = row.getInt(1);
- int templateId = row.getInt(2);
-
- update.setInt(1, userId);
- update.setInt(2, templateId);
- update.setString(3, HOTSPOT_ADMIN_ROLE);
- update.setDate(4, now);
- update.setDate(5, now);
- return true;
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v73/PopulateHotspotAdminPermissionOnUsers.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v73/PopulateHotspotAdminPermissionOnUsers.java
deleted file mode 100644
index 592aa0d047a..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v73/PopulateHotspotAdminPermissionOnUsers.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v73;
-
-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;
-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;
-
-@SupportsBlueGreen
-public class PopulateHotspotAdminPermissionOnUsers extends DataChange {
- private static final String ISSUE_ADMIN_ROLE = "issueadmin";
- private static final String HOTSPOT_ADMIN_ROLE = "securityhotspotadmin";
-
- public PopulateHotspotAdminPermissionOnUsers(Database db) {
- super(db);
- }
-
- @Override
- protected void execute(Context context) throws SQLException {
- MassUpdate massUpdate = context.prepareMassUpdate();
- massUpdate.select("SELECT user_id, resource_id, organization_uuid" +
- " FROM user_roles ur1" +
- " WHERE role = ?" +
- " AND NOT EXISTS (" +
- " SELECT id" +
- " FROM user_roles ur2" +
- " WHERE role = ?" +
- " AND ur1.user_id = ur2.user_id" +
- " AND ur1.resource_id = ur2.resource_id" +
- " AND ur1.organization_uuid = ur2.organization_uuid)")
- .setString(1, ISSUE_ADMIN_ROLE)
- .setString(2, HOTSPOT_ADMIN_ROLE);
- massUpdate.update("INSERT INTO user_roles (user_id, resource_id, organization_uuid, role) values (?,?,?,?)");
- massUpdate.rowPluralName("user roles");
- massUpdate.execute(PopulateHotspotAdminPermissionOnUsers::handle);
- }
-
- private static boolean handle(Select.Row row, SqlStatement update) throws SQLException {
- int userId = row.getInt(1);
- int resourceId = row.getInt(2);
- String organizationUuid = row.getString(3);
-
- update.setInt(1, userId);
- update.setInt(2, resourceId);
- update.setString(3, organizationUuid);
- update.setString(4, HOTSPOT_ADMIN_ROLE);
- return true;
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v73/PopulateMainApplicationBranches.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v73/PopulateMainApplicationBranches.java
deleted file mode 100644
index 2ce9144829b..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v73/PopulateMainApplicationBranches.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v73;
-
-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;
-import org.sonar.server.platform.db.migration.step.MassUpdate;
-
-@SupportsBlueGreen
-public class PopulateMainApplicationBranches extends DataChange {
-
- private static final String MAIN_BRANCH_NAME = "master";
-
- private final System2 system2;
-
- public PopulateMainApplicationBranches(Database db, System2 system2) {
- super(db);
- this.system2 = system2;
- }
-
- @Override
- protected void execute(Context context) throws SQLException {
- long now = system2.now();
- MassUpdate massUpdate = context.prepareMassUpdate();
- massUpdate.select("SELECT uuid FROM projects p "
- + "WHERE p.scope='PRJ' AND p.qualifier='APP' AND p.main_branch_project_uuid IS NULL "
- + "AND NOT EXISTS (SELECT uuid FROM project_branches b WHERE b.uuid = p.uuid)");
- massUpdate.update("INSERT INTO project_branches (uuid, project_uuid, kee, branch_type, key_type, "
- + "merge_branch_uuid, created_at, updated_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?)");
- massUpdate.rowPluralName("applications");
- massUpdate.execute((row, update) -> {
- String uuid = row.getString(1);
- update.setString(1, uuid);
- update.setString(2, uuid);
- update.setString(3, MAIN_BRANCH_NAME);
- update.setString(4, "LONG");
- update.setString(5, "BRANCH");
- update.setString(6, null);
- update.setLong(7, now);
- update.setLong(8, now);
- return true;
- });
- }
-
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v73/PopulateSubscriptionOnOrganizations.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v73/PopulateSubscriptionOnOrganizations.java
deleted file mode 100644
index b57ea298580..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v73/PopulateSubscriptionOnOrganizations.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v73;
-
-import java.sql.SQLException;
-import org.sonar.api.config.Configuration;
-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 PopulateSubscriptionOnOrganizations extends DataChange {
-
- private final System2 system2;
- private final Configuration configuration;
-
- public PopulateSubscriptionOnOrganizations(Database db, System2 system2, Configuration configuration) {
- super(db);
- this.system2 = system2;
- this.configuration = configuration;
- }
-
- @Override
- protected void execute(Context context) throws SQLException {
- if (configuration.getBoolean("sonar.sonarcloud.enabled").orElse(false)) {
- executeOnSonarCloud(context);
- } else {
- executeOnSonarQube(context);
- }
- }
-
- private void executeOnSonarQube(Context context) throws SQLException {
- long now = system2.now();
- MassUpdate massUpdate = context.prepareMassUpdate().rowPluralName("organizations");
- massUpdate.select("SELECT o.uuid FROM organizations o WHERE o.subscription IS NULL ");
- massUpdate.update("UPDATE organizations SET subscription=?, updated_at=? WHERE uuid=?");
- massUpdate.execute((row, update) -> {
- String uuid = row.getString(1);
- update.setString(1, "SONARQUBE");
- update.setLong(2, now);
- update.setString(3, uuid);
- return true;
- });
- }
-
- private void executeOnSonarCloud(Context context) throws SQLException {
- long now = system2.now();
- MassUpdate massUpdate = context.prepareMassUpdate().rowPluralName("organizations");
- massUpdate.select("SELECT o.uuid, count(p.uuid) FROM organizations o " +
- "LEFT OUTER JOIN projects p on p.organization_uuid=o.uuid AND p.private=? " +
- "WHERE subscription IS NULL " +
- "GROUP BY o.uuid")
- .setBoolean(1, true);
- massUpdate.update("UPDATE organizations SET subscription=?, updated_at=? WHERE uuid=?");
- massUpdate.execute((row, update) -> {
- String uuid = row.getString(1);
- long privateProjectsCount = row.getLong(2);
- update.setString(1, privateProjectsCount > 0 ? "PAID" : "FREE");
- update.setLong(2, now);
- update.setString(3, uuid);
- return true;
- });
- }
-
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v73/SetSubscriptionOnOrganizationsNotNullable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v73/SetSubscriptionOnOrganizationsNotNullable.java
deleted file mode 100644
index 12fe4be4b29..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v73/SetSubscriptionOnOrganizationsNotNullable.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v73;
-
-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.VarcharColumnDef.newVarcharColumnDefBuilder;
-
-@SupportsBlueGreen
-public class SetSubscriptionOnOrganizationsNotNullable extends DdlChange {
-
- public SetSubscriptionOnOrganizationsNotNullable(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute(new AlterColumnsBuilder(getDialect(), "organizations")
- .updateColumn(newVarcharColumnDefBuilder()
- .setColumnName("subscription")
- .setLimit(40)
- .setIsNullable(false)
- .build())
- .build());
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v73/package-info.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v73/package-info.java
deleted file mode 100644
index 4911af7a1f0..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v73/package-info.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public 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.v73;
-
-import javax.annotation.ParametersAreNonnullByDefault;
-
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v74/AddAdHocColumnsInInRulesMetadata.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v74/AddAdHocColumnsInInRulesMetadata.java
deleted file mode 100644
index bab0ce2395d..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v74/AddAdHocColumnsInInRulesMetadata.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v74;
-
-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.ClobColumnDef.newClobColumnDefBuilder;
-import static org.sonar.server.platform.db.migration.def.TinyIntColumnDef.newTinyIntColumnDefBuilder;
-import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder;
-
-@SupportsBlueGreen
-public class AddAdHocColumnsInInRulesMetadata extends DdlChange {
-
- public AddAdHocColumnsInInRulesMetadata(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute(new AddColumnsBuilder(getDialect(), "rules_metadata")
- .addColumn(newVarcharColumnDefBuilder()
- .setColumnName("ad_hoc_name")
- .setLimit(200)
- .setIsNullable(true)
- .build())
- .addColumn(newClobColumnDefBuilder()
- .setColumnName("ad_hoc_description")
- .setIsNullable(true)
- .build())
- .addColumn(newVarcharColumnDefBuilder()
- .setColumnName("ad_hoc_severity")
- .setIsNullable(true)
- .setLimit(10)
- .build())
- .addColumn(newTinyIntColumnDefBuilder()
- .setColumnName("ad_hoc_type")
- .setIsNullable(true)
- .build())
- .build());
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v74/AddApplicationCreatorAndPortfolioCreatorToSonarAdministrator.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v74/AddApplicationCreatorAndPortfolioCreatorToSonarAdministrator.java
deleted file mode 100644
index aa01ecb64fa..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v74/AddApplicationCreatorAndPortfolioCreatorToSonarAdministrator.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v74;
-
-import java.sql.SQLException;
-import org.sonar.api.config.Configuration;
-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.version.v63.DefaultOrganizationUuidProvider;
-
-@SupportsBlueGreen
-public class AddApplicationCreatorAndPortfolioCreatorToSonarAdministrator extends DataChange {
-
- private final Configuration configuration;
- private final DefaultOrganizationUuidProvider defaultOrganizationUuidProvider;
-
- public AddApplicationCreatorAndPortfolioCreatorToSonarAdministrator(Database db, Configuration configuration,
- DefaultOrganizationUuidProvider defaultOrganizationUuidProvider) {
- super(db);
- this.configuration = configuration;
- this.defaultOrganizationUuidProvider = defaultOrganizationUuidProvider;
- }
-
- @Override
- protected void execute(Context context) throws SQLException {
- if (configuration.getBoolean("sonar.sonarcloud.enabled").orElse(false)) {
- // Nothing to do on SonarCloud
- return;
- }
-
- Integer sonarAdmGroupId = context.prepareSelect("SELECT id FROM groups WHERE name=?")
- .setString(1, "sonar-administrators")
- .get(r -> r.getInt(1));
-
- if (sonarAdmGroupId == null) {
- // We cannot find the default sonar-administrators groups
- return;
- }
-
- insertPermissionIfMissing(context, sonarAdmGroupId, "applicationcreator");
- insertPermissionIfMissing(context, sonarAdmGroupId, "portfoliocreator");
- }
-
- private void insertPermissionIfMissing(Context context, Integer sonarAdmGroupId, String role) throws SQLException {
- if (isPermissionMissing(context, sonarAdmGroupId, role)) {
- context.prepareUpsert("INSERT INTO group_roles(organization_uuid, group_id, role) VALUES(?, ?, ?)")
- .setString(1, defaultOrganizationUuidProvider.get(context))
- .setInt(2, sonarAdmGroupId)
- .setString(3, role)
- .execute()
- .commit();
- }
- }
-
- private static boolean isPermissionMissing(Context context, Integer sonarAdmGroupId, String role) throws SQLException {
- Integer count = context.prepareSelect("SELECT COUNT(id) FROM group_roles WHERE group_id=? AND role=?")
- .setInt(1, sonarAdmGroupId)
- .setString(2, role)
- .get(r -> r.getInt(1));
-
- return count == null || count == 0;
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v74/AddDefaultPermTemplateColumnsToOrganizations.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v74/AddDefaultPermTemplateColumnsToOrganizations.java
deleted file mode 100644
index 31e30a92cd4..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v74/AddDefaultPermTemplateColumnsToOrganizations.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v74;
-
-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.AddColumnsBuilder;
-import org.sonar.server.platform.db.migration.step.DdlChange;
-
-import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder;
-
-@SupportsBlueGreen
-public class AddDefaultPermTemplateColumnsToOrganizations extends DdlChange {
- public AddDefaultPermTemplateColumnsToOrganizations(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute(
- new AddColumnsBuilder(getDialect(), "organizations")
- .addColumn(
- newVarcharColumnDefBuilder()
- .setColumnName("default_perm_template_app")
- .setLimit(VarcharColumnDef.UUID_SIZE)
- .setIsNullable(true)
- .build())
- .addColumn(
- newVarcharColumnDefBuilder()
- .setColumnName("default_perm_template_port")
- .setLimit(VarcharColumnDef.UUID_SIZE)
- .setIsNullable(true)
- .build())
- .build());
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v74/AddIsAdHocToRules.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v74/AddIsAdHocToRules.java
deleted file mode 100644
index cb42483d92b..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v74/AddIsAdHocToRules.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v74;
-
-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 AddIsAdHocToRules extends DdlChange {
-
- public AddIsAdHocToRules(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute(new AddColumnsBuilder(getDialect(), "rules")
- .addColumn(newBooleanColumnDefBuilder()
- .setColumnName("is_ad_hoc")
- .setIsNullable(true)
- .build())
- .build());
- }
-
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v74/AddTmpColumnsToCeActivity.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v74/AddTmpColumnsToCeActivity.java
deleted file mode 100644
index 5803606af9b..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v74/AddTmpColumnsToCeActivity.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v74;
-
-import org.sonar.db.Database;
-import org.sonar.server.platform.db.migration.SupportsBlueGreen;
-
-@SupportsBlueGreen
-public class AddTmpColumnsToCeActivity extends AddTmpColumnsToCeTable {
-
- public AddTmpColumnsToCeActivity(Database db) {
- super(db, "ce_activity");
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v74/AddTmpColumnsToCeQueue.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v74/AddTmpColumnsToCeQueue.java
deleted file mode 100644
index c349212b9ce..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v74/AddTmpColumnsToCeQueue.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v74;
-
-import org.sonar.db.Database;
-import org.sonar.server.platform.db.migration.SupportsBlueGreen;
-
-@SupportsBlueGreen
-public class AddTmpColumnsToCeQueue extends AddTmpColumnsToCeTable {
-
- public AddTmpColumnsToCeQueue(Database db) {
- super(db, "ce_queue");
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v74/AddTmpColumnsToCeTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v74/AddTmpColumnsToCeTable.java
deleted file mode 100644
index 51ab5562ae1..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v74/AddTmpColumnsToCeTable.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v74;
-
-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;
-
-abstract class AddTmpColumnsToCeTable extends DdlChange {
- private static final VarcharColumnDef COLUMN_TMP_COMPONENT_UUID = newVarcharColumnDefBuilder()
- .setColumnName("tmp_component_uuid")
- .setLimit(VarcharColumnDef.UUID_SIZE)
- .setIsNullable(true)
- .build();
- private static final VarcharColumnDef COLUMN_TMP_MAIN_COMPONENT_UUID = newVarcharColumnDefBuilder()
- .setColumnName("tmp_main_component_uuid")
- .setLimit(VarcharColumnDef.UUID_SIZE)
- .setIsNullable(true)
- .build();
- private final String tableName;
-
- public AddTmpColumnsToCeTable(Database db, String tableName) {
- super(db);
- this.tableName = tableName;
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute(new AddColumnsBuilder(getDialect(), tableName)
- .addColumn(COLUMN_TMP_MAIN_COMPONENT_UUID)
- .addColumn(COLUMN_TMP_COMPONENT_UUID)
- .build());
-
- // create indexes
- context.execute(new CreateIndexBuilder()
- .setTable(tableName)
- .setName(tableName + "_tmp_cpnt_uuid")
- .addColumn(COLUMN_TMP_COMPONENT_UUID)
- .setUnique(false)
- .build());
- context.execute(new CreateIndexBuilder()
- .setTable(tableName)
- .setName(tableName + "_tmp_main_cpnt_uuid")
- .addColumn(COLUMN_TMP_MAIN_COMPONENT_UUID)
- .setUnique(false)
- .build());
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v74/AddTmpLastKeyColumnsToCeActivity.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v74/AddTmpLastKeyColumnsToCeActivity.java
deleted file mode 100644
index fcc299822ca..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v74/AddTmpLastKeyColumnsToCeActivity.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v74;
-
-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.BooleanColumnDef;
-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.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;
-
-@SupportsBlueGreen
-public class AddTmpLastKeyColumnsToCeActivity extends DdlChange {
- private static final String TABLE_NAME = "ce_activity";
- private static final int TASK_TYPE_COLUMN_SIZE = 15;
- private static final BooleanColumnDef COLUMN_TMP_IS_LAST = newBooleanColumnDefBuilder()
- .setColumnName("tmp_is_last")
- .setIsNullable(true)
- .build();
- private static final VarcharColumnDef COLUMN_TMP_IS_LAST_KEY = newVarcharColumnDefBuilder()
- .setColumnName("tmp_is_last_key")
- .setLimit(UUID_SIZE + TASK_TYPE_COLUMN_SIZE)
- .setIsNullable(true)
- .build();
- private static final BooleanColumnDef COLUMN_TMP_MAIN_IS_LAST = newBooleanColumnDefBuilder()
- .setColumnName("tmp_main_is_last")
- .setIsNullable(true)
- .build();
- private static final VarcharColumnDef COLUMN_TMP_MAIN_IS_LAST_KEY = newVarcharColumnDefBuilder()
- .setColumnName("tmp_main_is_last_key")
- .setLimit(UUID_SIZE + TASK_TYPE_COLUMN_SIZE)
- .setIsNullable(true)
- .build();
- private static final VarcharColumnDef COLUMN_STATUS = newVarcharColumnDefBuilder()
- .setColumnName("status")
- .setLimit(15)
- .setIsNullable(false)
- .build();
-
- public AddTmpLastKeyColumnsToCeActivity(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute(new AddColumnsBuilder(getDialect(), TABLE_NAME)
- .addColumn(COLUMN_TMP_IS_LAST)
- .addColumn(COLUMN_TMP_IS_LAST_KEY)
- .addColumn(COLUMN_TMP_MAIN_IS_LAST)
- .addColumn(COLUMN_TMP_MAIN_IS_LAST_KEY)
- .build());
-
- // create indexes
- context.execute(new CreateIndexBuilder()
- .setTable(TABLE_NAME)
- .setName(TABLE_NAME + "_t_islast_key")
- .addColumn(COLUMN_TMP_IS_LAST_KEY)
- .setUnique(false)
- .build());
- context.execute(new CreateIndexBuilder()
- .setTable(TABLE_NAME)
- .setName(TABLE_NAME + "_t_islast")
- .addColumn(COLUMN_TMP_IS_LAST)
- .addColumn(COLUMN_STATUS)
- .setUnique(false)
- .build());
- context.execute(new CreateIndexBuilder()
- .setTable(TABLE_NAME)
- .setName(TABLE_NAME + "_t_main_islast_key")
- .addColumn(COLUMN_TMP_MAIN_IS_LAST_KEY)
- .setUnique(false)
- .build());
- context.execute(new CreateIndexBuilder()
- .setTable(TABLE_NAME)
- .setName(TABLE_NAME + "_t_main_islast")
- .addColumn(COLUMN_TMP_MAIN_IS_LAST)
- .addColumn(COLUMN_STATUS)
- .setUnique(false)
- .build());
-
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v74/CleanOrphanRowsInCeTables.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v74/CleanOrphanRowsInCeTables.java
deleted file mode 100644
index 1303aa7ab2a..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v74/CleanOrphanRowsInCeTables.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v74;
-
-import java.sql.SQLException;
-import org.sonar.api.config.Configuration;
-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 CleanOrphanRowsInCeTables extends DataChange {
- private final Configuration configuration;
-
- public CleanOrphanRowsInCeTables(Database db, Configuration configuration1) {
- super(db);
- this.configuration = configuration1;
- }
-
- @Override
- protected void execute(Context context) throws SQLException {
- if (isSonarCloud(configuration)) {
- return;
- }
-
- // clean orphans on ce_activity
- MassUpdate massUpdate = context.prepareMassUpdate();
- massUpdate.select("select" +
- " cea.uuid" +
- " from ce_activity cea" +
- " where" +
- " cea.component_uuid is not null" +
- " and cea.main_component_uuid is not null" +
- " and cea.component_uuid = cea.main_component_uuid" +
- " and exists (select 1 from ce_task_characteristics ctc where ctc.task_uuid = cea.uuid)");
- massUpdate.update("delete from ce_task_input where task_uuid = ?");
- massUpdate.update("delete from ce_scanner_context where task_uuid = ?");
- massUpdate.update("delete from ce_task_characteristics where task_uuid = ?");
- massUpdate.update("delete from ce_activity where uuid = ?");
- massUpdate.rowPluralName("orphans of deleted branch/pr");
- massUpdate.execute((row, update, updateIndex) -> {
- String taskUuid = row.getString(1);
- update.setString(1, taskUuid);
- return true;
- });
- }
-
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v74/CreateApplicationsAndPortfoliosCreatorPermissions.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v74/CreateApplicationsAndPortfoliosCreatorPermissions.java
deleted file mode 100644
index fb93bdef350..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v74/CreateApplicationsAndPortfoliosCreatorPermissions.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v74;
-
-import org.sonar.api.security.DefaultGroups;
-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 java.sql.SQLException;
-import java.util.Date;
-
-@SupportsBlueGreen
-public class CreateApplicationsAndPortfoliosCreatorPermissions extends DataChange {
-
- private static final Logger LOG = Loggers.get(CreateApplicationsAndPortfoliosCreatorPermissions.class);
- private static final String DEFAULT_ORGANIZATION_KEY = "default-organization";
-
- private final System2 system2;
-
- public CreateApplicationsAndPortfoliosCreatorPermissions(Database db, System2 system2) {
- super(db);
- this.system2 = system2;
- }
-
- @Override
- protected void execute(Context context) throws SQLException {
- Date now = new Date(system2.now());
- Long adminGroupId = context.prepareSelect("SELECT id FROM groups WHERE name=?")
- .setString(1, DefaultGroups.ADMINISTRATORS)
- .get(row -> row.getLong(1));
- String templateKey = context.prepareSelect("SELECT default_perm_template_view FROM organizations WHERE kee=?")
- .setString(1, DEFAULT_ORGANIZATION_KEY)
- .get(row -> row.getString(1));
-
- if (adminGroupId == null) {
- LOG.info("Unable to find {} group. Skipping adding applications and portfolios creator permissions.", DefaultGroups.ADMINISTRATORS);
- return;
- }
-
- if (templateKey == null) {
- LOG.info("There is no default template for views. Skipping adding applications and portfolios creator permissions.");
- }
-
- Long templateId = context.prepareSelect("SELECT id FROM permission_templates WHERE kee=?")
- .setString(1, templateKey)
- .get(row -> row.getLong(1));
-
- if (templateId == null) {
- LOG.info("Unable to find the default template [{}] for views. Skipping adding applications and portfolios creator permissions.", templateKey);
- return;
- }
-
- if (isPermissionAbsent(context, adminGroupId, "applicationcreator")) {
- insertPermission(context, adminGroupId, templateId, "applicationcreator", now);
- }
-
- if (isPermissionAbsent(context, adminGroupId, "portfoliocreator")) {
- insertPermission(context, adminGroupId, templateId, "portfoliocreator", now);
- }
- }
-
- private static boolean isPermissionAbsent(Context context, Long groupId, String permission) throws SQLException {
- Long count = context.prepareSelect("SELECT count(*) FROM perm_templates_groups WHERE group_id=? AND permission_reference=?")
- .setLong(1, groupId)
- .setString(2, permission)
- .get(row -> (row.getLong(1)));
-
- return (count == null) || count == 0;
- }
-
- private static void insertPermission(Context context, Long groupId, Long templateId, String permission, Date now) throws SQLException {
- context.prepareUpsert("INSERT INTO perm_templates_groups (group_id, template_id, permission_reference, created_at, updated_at) values (?,?,?,?,?)")
- .setLong(1, groupId)
- .setLong(2, templateId)
- .setString(3, permission)
- .setDate(4, now)
- .setDate(5, now)
- .execute()
- .commit();
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v74/CreateCeTaskMessage.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v74/CreateCeTaskMessage.java
deleted file mode 100644
index 4b87653fa0b..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v74/CreateCeTaskMessage.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v74;
-
-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.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.MAX_SIZE;
-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 CreateCeTaskMessage extends DdlChange {
-
- public static final String TABLE_NAME = "ce_task_message";
- private static final VarcharColumnDef COLUMN_UUID = newVarcharColumnDefBuilder()
- .setColumnName("uuid")
- .setIsNullable(false)
- .setLimit(UUID_SIZE)
- .build();
- private static final VarcharColumnDef COLUMN_TASK_UUID = newVarcharColumnDefBuilder()
- .setColumnName("task_uuid")
- .setIsNullable(false)
- .setLimit(UUID_SIZE)
- .build();
- private static final VarcharColumnDef COLUMN_MESSAGE = newVarcharColumnDefBuilder()
- .setColumnName("message")
- .setIsNullable(false)
- .setLimit(MAX_SIZE)
- .build();
- private static final BigIntegerColumnDef COLUMN_CREATED_AT = newBigIntegerColumnDefBuilder()
- .setColumnName("created_at")
- .setIsNullable(false)
- .build();
-
- public CreateCeTaskMessage(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- CreateTableBuilder createTableBuilder = new CreateTableBuilder(getDialect(), TABLE_NAME);
- if (!createTableBuilder.tableExists(getDatabase())) {
- context.execute(createTableBuilder
- .addPkColumn(COLUMN_UUID)
- .addColumn(COLUMN_TASK_UUID)
- .addColumn(COLUMN_MESSAGE)
- .addColumn(COLUMN_CREATED_AT)
- .build());
-
- context.execute(new CreateIndexBuilder()
- .setTable(TABLE_NAME)
- .setName(TABLE_NAME + "_task")
- .addColumn(COLUMN_TASK_UUID)
- .setUnique(false)
- .build());
- }
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v74/DbVersion74.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v74/DbVersion74.java
deleted file mode 100644
index 6a30e9412a6..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v74/DbVersion74.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v74;
-
-import org.sonar.server.platform.db.migration.step.MigrationStepRegistry;
-import org.sonar.server.platform.db.migration.version.DbVersion;
-
-public class DbVersion74 implements DbVersion {
-
- @Override
- public void addSteps(MigrationStepRegistry registry) {
- registry
- .add(2300, "Populate null values of IS_EXTERNAL in RULES", PopulateNullValuesOfIsExternalOnRules.class)
- .add(2301, "Add IS_ADHOC column to RULES table", AddIsAdHocToRules.class)
- .add(2302, "Populate IS_AD_HOC in RULES", PopulateIsAdHocOnRules.class)
- .add(2303, "Set IS_EXTERNAL and IS_AD_HOC not nullable in RULES", SetIsExternalAndIsAdHocNotNullableInRules.class)
- .add(2304, "Add ad hoc related columns in RULES_METADATA", AddAdHocColumnsInInRulesMetadata.class)
- .add(2312, "Add CE_QUEUE.MAIN_COMPONENT_UUID 1/3", AddTmpColumnsToCeQueue.class)
- .add(2313, "Add CE_ACTIVITY.MAIN_COMPONENT_UUID 1/3", AddTmpColumnsToCeActivity.class)
- .add(2314, "Populate CE_QUEUE.MAIN_COMPONENT_UUID 2/3", PopulateTmpColumnsToCeQueue.class)
- .add(2315, "Populate CE_ACTIVITY.MAIN_COMPONENT_UUID 2/3", PopulateTmpColumnsToCeActivity.class)
- .add(2316, "Add CE_ACTIVITY.MAIN_LAST_KEY 1/3", AddTmpLastKeyColumnsToCeActivity.class)
- .add(2317, "Populate CE_ACTIVITY.MAIN_LAST_KEY 2/3", PopulateTmpLastKeyColumnsToCeActivity.class)
- .add(2318, "Finalize CE_QUEUE.MAIN_COMPONENT_UUID 3/3", FinalizeMainComponentUuidColumnsToCeActivity.class)
- .add(2319, "Finalize CE_ACTIVITY.MAIN_COMPONENT_UUID 3/3", FinalizeMainComponentUuidColumnsToCeQueue.class)
- .add(2320, "Finalize CE_ACTIVITY.MAIN_LAST_KEY 3/3", FinalizeMainLastKeyColumnsToCeActivity.class)
- .add(2321, "Increase organization key and name length", IncreaseOrganizationsKeeAndNameLength.class)
- .add(2322, "Create table CE_TASK_MESSAGE", CreateCeTaskMessage.class)
- .add(2323, "Clean orphans from deleted branches and PRs in CE_* tables", CleanOrphanRowsInCeTables.class)
- .add(2324, "Create new creator permissions for applications and portfolios", CreateApplicationsAndPortfoliosCreatorPermissions.class)
- .add(2325, "Add default templates for applications and portfolios", AddDefaultPermTemplateColumnsToOrganizations.class)
- .add(2326, "Create new creator permissions for applications and portfolios", CreateApplicationsAndPortfoliosCreatorPermissions.class)
- .add(2327, "Populate default template permissions on organizations", PopulateDefaultPermTemplateOnOrganizations.class)
- .add(2328, "Add portfolio and application creator permissions on sonar-administrators group", AddApplicationCreatorAndPortfolioCreatorToSonarAdministrator.class)
- .add(2329, "Drop column DEFAULT_PERM_TEMPLATE_VIEW on organizations", DropDefaultPermTemplateViewFromOrganizations.class)
- ;
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v74/DropDefaultPermTemplateViewFromOrganizations.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v74/DropDefaultPermTemplateViewFromOrganizations.java
deleted file mode 100644
index cd64b933bbb..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v74/DropDefaultPermTemplateViewFromOrganizations.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v74;
-
-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.DropColumnsBuilder;
-import org.sonar.server.platform.db.migration.step.DdlChange;
-
-@SupportsBlueGreen
-public class DropDefaultPermTemplateViewFromOrganizations extends DdlChange {
-
- public DropDefaultPermTemplateViewFromOrganizations(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute(new DropColumnsBuilder(getDialect(), "organizations", "default_perm_template_view").build());
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v74/FinalizeMainComponentUuidColumnsToCeActivity.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v74/FinalizeMainComponentUuidColumnsToCeActivity.java
deleted file mode 100644
index 9575cf91534..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v74/FinalizeMainComponentUuidColumnsToCeActivity.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v74;
-
-import org.sonar.db.Database;
-
-public class FinalizeMainComponentUuidColumnsToCeActivity extends FinalizeMainComponentUuidColumnsToCeTable {
-
- public FinalizeMainComponentUuidColumnsToCeActivity(Database db) {
- super(db, "ce_activity");
- }
-
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v74/FinalizeMainComponentUuidColumnsToCeQueue.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v74/FinalizeMainComponentUuidColumnsToCeQueue.java
deleted file mode 100644
index dff65a05a43..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v74/FinalizeMainComponentUuidColumnsToCeQueue.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v74;
-
-import org.sonar.db.Database;
-
-public class FinalizeMainComponentUuidColumnsToCeQueue extends FinalizeMainComponentUuidColumnsToCeTable {
- public FinalizeMainComponentUuidColumnsToCeQueue(Database db) {
- super(db, "ce_queue");
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v74/FinalizeMainComponentUuidColumnsToCeTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v74/FinalizeMainComponentUuidColumnsToCeTable.java
deleted file mode 100644
index af2a9911bd5..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v74/FinalizeMainComponentUuidColumnsToCeTable.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v74;
-
-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.sql.RenameColumnsBuilder;
-import org.sonar.server.platform.db.migration.step.DdlChange;
-
-import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder;
-
-public abstract class FinalizeMainComponentUuidColumnsToCeTable extends DdlChange {
- private static final VarcharColumnDef COLUMN_COMPONENT_UUID = newVarcharColumnDefBuilder()
- .setColumnName("component_uuid")
- .setLimit(VarcharColumnDef.UUID_SIZE)
- .setIsNullable(true)
- .build();
- private static final VarcharColumnDef COLUMN_MAIN_COMPONENT_UUID = newVarcharColumnDefBuilder()
- .setColumnName("main_component_uuid")
- .setLimit(VarcharColumnDef.UUID_SIZE)
- .setIsNullable(true)
- .build();
- private final String tableName;
-
- FinalizeMainComponentUuidColumnsToCeTable(Database db, String tableName) {
- super(db);
- this.tableName = tableName;
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- // drop index on existing column COMPONENT_UUID
- context.execute(new DropIndexBuilder(getDialect())
- .setTable(tableName)
- .setName(tableName + "_component_uuid")
- .build());
- // drop existing column
- context.execute(new DropColumnsBuilder(getDialect(), tableName, "component_uuid").build());
-
- // drop indexes on tmp columns
- context.execute(new DropIndexBuilder(getDialect())
- .setTable(tableName)
- .setName(tableName + "_tmp_cpnt_uuid")
- .build());
- context.execute(new DropIndexBuilder(getDialect())
- .setTable(tableName)
- .setName(tableName + "_tmp_main_cpnt_uuid")
- .build());
-
- // rename tmp columns
- context.execute(new RenameColumnsBuilder(getDialect(), tableName)
- .renameColumn("tmp_component_uuid", COLUMN_COMPONENT_UUID)
- .renameColumn("tmp_main_component_uuid", COLUMN_MAIN_COMPONENT_UUID)
- .build());
-
- // recreate indexes on renamed columns
- context.execute(new CreateIndexBuilder()
- .setTable(tableName)
- .setName(tableName + "_component")
- .addColumn(COLUMN_COMPONENT_UUID)
- .setUnique(false)
- .build());
- context.execute(new CreateIndexBuilder()
- .setTable(tableName)
- .setName(tableName + "_main_component")
- .addColumn(COLUMN_MAIN_COMPONENT_UUID)
- .setUnique(false)
- .build());
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v74/FinalizeMainLastKeyColumnsToCeActivity.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v74/FinalizeMainLastKeyColumnsToCeActivity.java
deleted file mode 100644
index e93c562ff6e..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v74/FinalizeMainLastKeyColumnsToCeActivity.java
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v74;
-
-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.def.VarcharColumnDef;
-import org.sonar.server.platform.db.migration.sql.AlterColumnsBuilder;
-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.sql.RenameColumnsBuilder;
-import org.sonar.server.platform.db.migration.step.DdlChange;
-
-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 FinalizeMainLastKeyColumnsToCeActivity extends DdlChange {
- private static final String TABLE_NAME = "ce_activity";
- private static final int TASK_TYPE_COLUMN_SIZE = 15;
- private static final BooleanColumnDef COLUMN_IS_LAST = newBooleanColumnDefBuilder()
- .setColumnName("is_last")
- .setIsNullable(false)
- .build();
- private static final VarcharColumnDef COLUMN_IS_LAST_KEY = newVarcharColumnDefBuilder()
- .setColumnName("is_last_key")
- .setLimit(UUID_SIZE + TASK_TYPE_COLUMN_SIZE)
- .setIsNullable(false)
- .build();
- private static final BooleanColumnDef COLUMN_MAIN_IS_LAST = newBooleanColumnDefBuilder()
- .setColumnName("main_is_last")
- .setIsNullable(false)
- .build();
- private static final VarcharColumnDef COLUMN_MAIN_IS_LAST_KEY = newVarcharColumnDefBuilder()
- .setColumnName("main_is_last_key")
- .setLimit(UUID_SIZE + TASK_TYPE_COLUMN_SIZE)
- .setIsNullable(false)
- .build();
- private static final VarcharColumnDef COLUMN_STATUS = newVarcharColumnDefBuilder()
- .setColumnName("status")
- .setLimit(15)
- .setIsNullable(false)
- .build();
-
- public FinalizeMainLastKeyColumnsToCeActivity(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- // drop index on existing columns
- context.execute(new DropIndexBuilder(getDialect())
- .setTable(TABLE_NAME)
- .setName("ce_activity_islastkey")
- .build());
- context.execute(new DropIndexBuilder(getDialect())
- .setTable(TABLE_NAME)
- .setName("ce_activity_islast_status")
- .build());
-
- // drop existing columns
- context.execute(new DropColumnsBuilder(getDialect(), TABLE_NAME, COLUMN_IS_LAST.getName(), COLUMN_IS_LAST_KEY.getName())
- .build());
-
- // drop index on tmp columns
- context.execute(new DropIndexBuilder(getDialect())
- .setTable(TABLE_NAME)
- .setName("ce_activity_t_islast_key")
- .build());
- context.execute(new DropIndexBuilder(getDialect())
- .setTable(TABLE_NAME)
- .setName("ce_activity_t_islast")
- .build());
- context.execute(new DropIndexBuilder(getDialect())
- .setTable(TABLE_NAME)
- .setName("ce_activity_t_main_islast_key")
- .build());
- context.execute(new DropIndexBuilder(getDialect())
- .setTable(TABLE_NAME)
- .setName("ce_activity_t_main_islast")
- .build());
-
- // rename tmp columns
- context.execute(new RenameColumnsBuilder(getDialect(), TABLE_NAME)
- .renameColumn("tmp_is_last", COLUMN_IS_LAST)
- .renameColumn("tmp_is_last_key", COLUMN_IS_LAST_KEY)
- .renameColumn("tmp_main_is_last", COLUMN_MAIN_IS_LAST)
- .renameColumn("tmp_main_is_last_key", COLUMN_MAIN_IS_LAST_KEY)
- .build());
-
- // make not nullable
- context.execute(new AlterColumnsBuilder(getDialect(), TABLE_NAME)
- .updateColumn(COLUMN_IS_LAST)
- .updateColumn(COLUMN_IS_LAST_KEY)
- .updateColumn(COLUMN_MAIN_IS_LAST)
- .updateColumn(COLUMN_MAIN_IS_LAST_KEY)
- .build());
-
- // create indexes
- context.execute(new CreateIndexBuilder()
- .setTable(TABLE_NAME)
- .setName(TABLE_NAME + "_islast_key")
- .addColumn(COLUMN_IS_LAST_KEY)
- .setUnique(false)
- .build());
- context.execute(new CreateIndexBuilder()
- .setTable(TABLE_NAME)
- .setName(TABLE_NAME + "_islast")
- .addColumn(COLUMN_IS_LAST)
- .addColumn(COLUMN_STATUS)
- .setUnique(false)
- .build());
- context.execute(new CreateIndexBuilder()
- .setTable(TABLE_NAME)
- .setName(TABLE_NAME + "_main_islast_key")
- .addColumn(COLUMN_MAIN_IS_LAST_KEY)
- .setUnique(false)
- .build());
- context.execute(new CreateIndexBuilder()
- .setTable(TABLE_NAME)
- .setName(TABLE_NAME + "_main_islast")
- .addColumn(COLUMN_MAIN_IS_LAST)
- .addColumn(COLUMN_STATUS)
- .setUnique(false)
- .build());
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v74/IncreaseOrganizationsKeeAndNameLength.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v74/IncreaseOrganizationsKeeAndNameLength.java
deleted file mode 100644
index dcd49a2ad36..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v74/IncreaseOrganizationsKeeAndNameLength.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v74;
-
-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.VarcharColumnDef.newVarcharColumnDefBuilder;
-
-@SupportsBlueGreen
-public class IncreaseOrganizationsKeeAndNameLength extends DdlChange {
-
- public static final String ORGANIZATIONS_TABLE = "organizations";
-
- public IncreaseOrganizationsKeeAndNameLength(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute(new AlterColumnsBuilder(getDialect(), ORGANIZATIONS_TABLE)
- .updateColumn(newVarcharColumnDefBuilder()
- .setColumnName("kee")
- .setLimit(255)
- .setIsNullable(false)
- .build())
- .build());
- context.execute(new AlterColumnsBuilder(getDialect(), ORGANIZATIONS_TABLE)
- .updateColumn(newVarcharColumnDefBuilder()
- .setColumnName("name")
- .setLimit(255)
- .setIsNullable(false)
- .build())
- .build());
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v74/PopulateDefaultPermTemplateOnOrganizations.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v74/PopulateDefaultPermTemplateOnOrganizations.java
deleted file mode 100644
index a4eb89d015b..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v74/PopulateDefaultPermTemplateOnOrganizations.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v74;
-
-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;
-import org.sonar.server.platform.db.migration.step.MassUpdate;
-
-@SupportsBlueGreen
-public class PopulateDefaultPermTemplateOnOrganizations extends DataChange {
-
- private final System2 system2;
-
- public PopulateDefaultPermTemplateOnOrganizations(Database db, System2 system2) {
- super(db);
- this.system2 = system2;
- }
-
- @Override
- protected void execute(Context context) throws SQLException {
- long now = system2.now();
- MassUpdate massUpdate = context.prepareMassUpdate().rowPluralName("organizations");
- massUpdate.select("SELECT uuid, default_perm_template_view FROM organizations WHERE default_perm_template_view IS NOT NULL");
- massUpdate.update("UPDATE organizations " +
- "SET default_perm_template_app=?, default_perm_template_port=?, updated_at=? " +
- "WHERE uuid=?");
- massUpdate.execute((row, update) -> {
- String uuid = row.getString(1);
- String defaultPermTemplateView = row.getString(2);
- update.setString(1, defaultPermTemplateView);
- update.setString(2, defaultPermTemplateView);
- update.setLong(3, now);
- update.setString(4, uuid);
- return true;
- });
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v74/PopulateIsAdHocOnRules.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v74/PopulateIsAdHocOnRules.java
deleted file mode 100644
index d3a7506de65..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v74/PopulateIsAdHocOnRules.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v74;
-
-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;
-import org.sonar.server.platform.db.migration.step.MassUpdate;
-
-@SupportsBlueGreen
-public class PopulateIsAdHocOnRules extends DataChange {
-
- private final System2 system2;
-
- public PopulateIsAdHocOnRules(Database db, System2 system2) {
- super(db);
- this.system2 = system2;
- }
-
- @Override
- protected void execute(Context context) throws SQLException {
- long now = system2.now();
- MassUpdate massUpdate = context.prepareMassUpdate().rowPluralName("rules");
- massUpdate.select("SELECT r.id, r.is_external FROM rules r WHERE r.is_ad_hoc IS NULL");
- massUpdate.update("UPDATE rules SET is_ad_hoc=?, updated_at=? WHERE id=?");
- massUpdate.execute((row, update) -> {
- int id = row.getInt(1);
- update.setBoolean(1, row.getBoolean(2));
- update.setLong(2, now);
- update.setInt(3, id);
- return true;
- });
- }
-
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v74/PopulateNullValuesOfIsExternalOnRules.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v74/PopulateNullValuesOfIsExternalOnRules.java
deleted file mode 100644
index aaa39dc17a6..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v74/PopulateNullValuesOfIsExternalOnRules.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v74;
-
-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;
-import org.sonar.server.platform.db.migration.step.MassUpdate;
-
-@SupportsBlueGreen
-public class PopulateNullValuesOfIsExternalOnRules extends DataChange {
-
- private final System2 system2;
-
- public PopulateNullValuesOfIsExternalOnRules(Database db, System2 system2) {
- super(db);
- this.system2 = system2;
- }
-
- @Override
- protected void execute(Context context) throws SQLException {
- long now = system2.now();
- MassUpdate massUpdate = context.prepareMassUpdate().rowPluralName("rules");
- massUpdate.select("SELECT r.id FROM rules r WHERE r.is_external IS NULL");
- massUpdate.update("UPDATE rules SET is_external=?, updated_at=? WHERE id=?");
- massUpdate.execute((row, update) -> {
- int id = row.getInt(1);
- update.setBoolean(1, false);
- update.setLong(2, now);
- update.setInt(3, id);
- return true;
- });
- }
-
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v74/PopulateTmpColumnsToCeActivity.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v74/PopulateTmpColumnsToCeActivity.java
deleted file mode 100644
index 308e003bd67..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v74/PopulateTmpColumnsToCeActivity.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v74;
-
-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;
-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;
-
-@SupportsBlueGreen
-public class PopulateTmpColumnsToCeActivity extends DataChange {
-
- public PopulateTmpColumnsToCeActivity(Database db) {
- super(db);
- }
-
- @Override
- protected void execute(Context context) throws SQLException {
- // activity of long and short branches
- populateCeActivityTmpColumns(context, "Archived tasks of branches",
- "select" +
- " cea.uuid, p.uuid, cea.component_uuid" +
- " from ce_activity cea" +
- " inner join projects mp on mp.uuid = cea.component_uuid" +
- " inner join ce_task_characteristics ctc1 on ctc1.task_uuid = cea.uuid and ctc1.kee = 'branchType'" +
- " inner join ce_task_characteristics ctc2 on ctc2.task_uuid = cea.uuid and ctc2.kee = 'branch'" +
- " inner join projects p on p.kee = concat(mp.kee, concat(':BRANCH:', ctc2.text_value))" +
- " where" +
- " cea.component_uuid is not null" +
- " and (cea.tmp_component_uuid is null or cea.tmp_main_component_uuid is null)");
-
- // activity of PRs
- populateCeActivityTmpColumns(context, "Archived tasks of PRs",
- "select" +
- " cea.uuid, p.uuid, cea.component_uuid" +
- " from ce_activity cea" +
- " inner join projects mp on mp.uuid = cea.component_uuid " +
- " inner join ce_task_characteristics ctc1 on ctc1.task_uuid = cea.uuid and ctc1.kee = 'pullRequest'" +
- " inner join projects p on p.kee = concat(mp.kee, concat(':PULL_REQUEST:', ctc1.text_value))" +
- " where" +
- " cea.component_uuid is not null" +
- " and (cea.tmp_component_uuid is null or cea.tmp_main_component_uuid is null)");
-
- // all activities which tmp columns are not populated yet (will include main and deprecated branches)
- // both tmp columns will be set to CE_ACTIVITY.COMPONENT_UUID
- // do not join on PROJECTS to also catch orphans
- populateCeActivityTmpColumns(context, "Archived tasks of main and deprecated branches",
- "select" +
- " cea.uuid, cea.component_uuid, cea.component_uuid" +
- " from ce_activity cea" +
- " where" +
- " cea.component_uuid is not null" +
- " and (cea.tmp_component_uuid is null or cea.tmp_main_component_uuid is null)");
- }
-
- private static void populateCeActivityTmpColumns(Context context, String rowPluralName, String sql) throws SQLException {
- MassUpdate massUpdate = context.prepareMassUpdate();
- massUpdate.select(sql);
- massUpdate.update("update ce_activity set tmp_component_uuid=?, tmp_main_component_uuid=? where uuid=?");
- massUpdate.rowPluralName(rowPluralName);
- massUpdate.execute(PopulateTmpColumnsToCeActivity::handleUpdate);
- }
-
- private static boolean handleUpdate(Select.Row row, SqlStatement update) throws SQLException {
- String uuid = row.getString(1);
- String componentUuuid = row.getString(2);
- String mainComponentUuuid = row.getString(3);
-
- update.setString(1, componentUuuid);
- update.setString(2, mainComponentUuuid);
- update.setString(3, uuid);
-
- return true;
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v74/PopulateTmpColumnsToCeQueue.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v74/PopulateTmpColumnsToCeQueue.java
deleted file mode 100644
index 9fa4c9eac49..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v74/PopulateTmpColumnsToCeQueue.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v74;
-
-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;
-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;
-
-@SupportsBlueGreen
-public class PopulateTmpColumnsToCeQueue extends DataChange {
- public PopulateTmpColumnsToCeQueue(Database db) {
- super(db);
- }
-
- @Override
- protected void execute(Context context) throws SQLException {
- // queued task of long and short branches which have already been analyzed at least once
- populateCeQueueTmpColumns(context, "queued tasks of branches",
- "select" +
- " cq.uuid, p.uuid, cq.component_uuid" +
- " from ce_queue cq" +
- " inner join projects mp on mp.uuid = cq.component_uuid" +
- " inner join ce_task_characteristics ctc1 on ctc1.task_uuid = cq.uuid and ctc1.kee = 'branchType'" +
- " inner join ce_task_characteristics ctc2 on ctc2.task_uuid = cq.uuid and ctc2.kee = 'branch'" +
- " inner join projects p on p.kee = concat(mp.kee, concat(':BRANCH:', ctc2.text_value))" +
- " where" +
- " cq.component_uuid is not null" +
- " and (cq.tmp_component_uuid is null or cq.tmp_main_component_uuid is null)");
-
- // queued task of pull request which have already been analyzed at least once
- populateCeQueueTmpColumns(context, "queued tasks of PRs",
- " select" +
- " cq.uuid, p.uuid, cq.component_uuid" +
- " from ce_queue cq" +
- " inner join projects mp on mp.uuid = cq.component_uuid " +
- " inner join ce_task_characteristics ctc1 on ctc1.task_uuid = cq.uuid and ctc1.kee = 'pullRequest'" +
- " inner join projects p on p.kee = concat(mp.kee, concat(':PULL_REQUEST:', ctc1.text_value))" +
- " where" +
- " cq.component_uuid is not null" +
- " and (cq.tmp_component_uuid is null or cq.tmp_main_component_uuid is null)");
-
- // queued task of long and short branches which have never been analyzed must be deleted
- deleteFromCeQueue(context, "queued tasks of never analyzed branches",
- "select" +
- " cq.uuid" +
- " from ce_queue cq" +
- " inner join projects mp on mp.uuid = cq.component_uuid" +
- " inner join ce_task_characteristics ctc1 on ctc1.task_uuid = cq.uuid and ctc1.kee = 'branchType'" +
- " inner join ce_task_characteristics ctc2 on ctc2.task_uuid = cq.uuid and ctc2.kee = 'branch'" +
- " where" +
- " cq.component_uuid is not null" +
- " and (cq.tmp_component_uuid is null or cq.tmp_main_component_uuid is null)" +
- " and not exists (select 1 from projects p where p.kee = concat(mp.kee, concat(':BRANCH:', ctc2.text_value)))");
-
- // queued of pull request which have never been analyzed must be deleted
- deleteFromCeQueue(context, "queued tasks of never analyzed PRs",
- "select" +
- " cq.uuid" +
- " from ce_queue cq" +
- " inner join projects mp on mp.uuid = cq.component_uuid " +
- " inner join ce_task_characteristics ctc1 on ctc1.task_uuid = cq.uuid and ctc1.kee = 'pullRequest'" +
- " where" +
- " cq.component_uuid is not null" +
- " and (cq.tmp_component_uuid is null or cq.tmp_main_component_uuid is null)" +
- " and not exists (select 1 from projects p where p.kee = concat(mp.kee, concat(':PULL_REQUEST:', ctc1.text_value)))");
-
- // all queue which tmp columns are not populated yet (will include main and deprecated branches)
- // both tmp columns will be set to CE_QUEUE.COMPONENT_UUID
- // do not join on PROJECTS to also catch orphans (there are many for branch and PRs due to SONAR-10642)
- populateCeQueueTmpColumns(context, "queued tasks of main and deprecated branches",
- "select" +
- " cq.uuid, cq.component_uuid, cq.component_uuid" +
- " from ce_queue cq" +
- " where" +
- " cq.component_uuid is not null" +
- " and (cq.tmp_component_uuid is null or cq.tmp_main_component_uuid is null)");
- }
-
- private static void populateCeQueueTmpColumns(Context context, String pluralName, String selectSQL) throws SQLException {
- MassUpdate massUpdate = context.prepareMassUpdate();
- massUpdate.select(selectSQL);
- massUpdate.update("update ce_queue set tmp_component_uuid=?, tmp_main_component_uuid=? where uuid=?");
- massUpdate.rowPluralName(pluralName);
- massUpdate.execute(PopulateTmpColumnsToCeQueue::handleUpdate);
- }
-
- private static boolean handleUpdate(Select.Row row, SqlStatement update) throws SQLException {
- String uuid = row.getString(1);
- String componentUuuid = row.getString(2);
- String mainComponentUuuid = row.getString(3);
-
- update.setString(1, componentUuuid);
- update.setString(2, mainComponentUuuid);
- update.setString(3, uuid);
-
- return true;
- }
-
- private static void deleteFromCeQueue(Context context, String pluralName, String sql) throws SQLException {
- MassUpdate massUpdate = context.prepareMassUpdate();
- massUpdate.select(sql);
- massUpdate.update("delete from ce_queue where uuid = ?");
- massUpdate.rowPluralName(pluralName);
- massUpdate.execute(PopulateTmpColumnsToCeQueue::handleDelete);
- }
-
- private static boolean handleDelete(Select.Row row, SqlStatement update) throws SQLException {
- String uuid = row.getString(1);
-
- update.setString(1, uuid);
-
- return true;
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v74/PopulateTmpLastKeyColumnsToCeActivity.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v74/PopulateTmpLastKeyColumnsToCeActivity.java
deleted file mode 100644
index 9bcbaf1c342..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v74/PopulateTmpLastKeyColumnsToCeActivity.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v74;
-
-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;
-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;
-
-@SupportsBlueGreen
-public class PopulateTmpLastKeyColumnsToCeActivity extends DataChange {
-
- public PopulateTmpLastKeyColumnsToCeActivity(Database db) {
- super(db);
- }
-
- @Override
- protected void execute(Context context) throws SQLException {
- MassUpdate massUpdate = context.prepareMassUpdate();
- massUpdate.select("select" +
- " cea.uuid, cea.task_type, cea.component_uuid, cea.tmp_component_uuid, cea.tmp_main_component_uuid" +
- " from ce_activity cea" +
- " where" +
- " cea.tmp_is_last is null" +
- " or cea.tmp_is_last_key is null" +
- " or cea.tmp_main_is_last is null" +
- " or cea.tmp_main_is_last_key is null");
- massUpdate.update("update ce_activity" +
- " set" +
- " tmp_is_last=?" +
- " ,tmp_is_last_key=?" +
- " ,tmp_main_is_last=?" +
- " ,tmp_main_is_last_key=?" +
- " where uuid=?");
- massUpdate.rowPluralName("rows of ce_activity");
- massUpdate.execute(PopulateTmpLastKeyColumnsToCeActivity::handleUpdate);
- }
-
- private static boolean handleUpdate(Select.Row row, SqlStatement update) throws SQLException {
- String uuid = row.getString(1);
- String taskType = row.getString(2);
- String oldComponentUuid = row.getString(3);
- String componentUuuid = row.getString(4);
- String mainComponentUuuid = row.getString(5);
-
- update.setBoolean(1, false);
- update.setString(2, oldComponentUuid == null ? taskType : (taskType + componentUuuid));
- update.setBoolean(3, false);
- update.setString(4, oldComponentUuid == null ? taskType : (taskType + mainComponentUuuid));
- update.setString(5, uuid);
-
- return true;
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v74/SetIsExternalAndIsAdHocNotNullableInRules.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v74/SetIsExternalAndIsAdHocNotNullableInRules.java
deleted file mode 100644
index e8217c1deab..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v74/SetIsExternalAndIsAdHocNotNullableInRules.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v74;
-
-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 SetIsExternalAndIsAdHocNotNullableInRules extends DdlChange {
-
- public SetIsExternalAndIsAdHocNotNullableInRules(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute(new AlterColumnsBuilder(getDialect(), "rules")
- .updateColumn(newBooleanColumnDefBuilder()
- .setColumnName("is_external")
- .setIsNullable(false)
- .build())
- .updateColumn(newBooleanColumnDefBuilder()
- .setColumnName("is_ad_hoc")
- .setIsNullable(false)
- .build())
- .build());
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v74/package-info.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v74/package-info.java
deleted file mode 100644
index bdbfad024f4..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v74/package-info.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public 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.v74;
-
-import javax.annotation.ParametersAreNonnullByDefault;
-
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v75/AddEventComponentChanges.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v75/AddEventComponentChanges.java
deleted file mode 100644
index ee56f735e99..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v75/AddEventComponentChanges.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v75;
-
-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.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.UUID_VARCHAR_SIZE;
-import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder;
-
-@SupportsBlueGreen
-public class AddEventComponentChanges extends DdlChange {
- private static final String TABLE_NAME = "event_component_changes";
- private static final VarcharColumnDef COLUMN_UUID = newVarcharColumnDefBuilder()
- .setColumnName("uuid")
- .setIsNullable(false)
- .setLimit(UUID_SIZE)
- .build();
- private static final VarcharColumnDef COLUMN_EVENT_UUID = newVarcharColumnDefBuilder()
- .setColumnName("event_uuid")
- .setIsNullable(false)
- .setLimit(UUID_SIZE)
- .build();
- private static final VarcharColumnDef COLUMN_EVENT_ANALYSIS_UUID = newVarcharColumnDefBuilder()
- .setColumnName("event_analysis_uuid")
- .setIsNullable(false)
- .setLimit(UUID_VARCHAR_SIZE)
- .build();
- private static final VarcharColumnDef COLUMN_EVENT_COMPONENT_UUID = newVarcharColumnDefBuilder()
- .setColumnName("event_component_uuid")
- .setIsNullable(false)
- .setLimit(UUID_VARCHAR_SIZE)
- .build();
- private static final VarcharColumnDef COLUMN_CHANGE_CATEGORY = newVarcharColumnDefBuilder()
- .setColumnName("change_category")
- .setIsNullable(false)
- .setLimit(12)
- .build();
- private static final VarcharColumnDef COLUMN_COMPONENT_UUID = newVarcharColumnDefBuilder()
- .setColumnName("component_uuid")
- .setIsNullable(false)
- .setLimit(UUID_VARCHAR_SIZE)
- .build();
- private static final VarcharColumnDef COLUMN_COMPONENT_KEY = newVarcharColumnDefBuilder()
- .setColumnName("component_key")
- .setIsNullable(false)
- .setLimit(400)
- .build();
- private static final VarcharColumnDef COLUMN_COMPONENT_NAME = newVarcharColumnDefBuilder()
- .setColumnName("component_name")
- .setIsNullable(false)
- .setLimit(2000)
- .build();
- private static final VarcharColumnDef COLUMN_COMPONENT_BRANCH_KEY = newVarcharColumnDefBuilder()
- .setColumnName("component_branch_key")
- .setIsNullable(true)
- .setLimit(255)
- .build();
- private static final BigIntegerColumnDef COLUMN_CREATED_AT = newBigIntegerColumnDefBuilder()
- .setColumnName("created_at")
- .setIsNullable(false)
- .build();
-
- public AddEventComponentChanges(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- CreateTableBuilder createTableBuilder = new CreateTableBuilder(getDialect(), TABLE_NAME);
- if (!createTableBuilder.tableExists(getDatabase())) {
- context.execute(createTableBuilder
- .addPkColumn(COLUMN_UUID)
- .addColumn(COLUMN_EVENT_UUID)
- .addColumn(COLUMN_EVENT_COMPONENT_UUID)
- .addColumn(COLUMN_EVENT_ANALYSIS_UUID)
- .addColumn(COLUMN_CHANGE_CATEGORY)
- .addColumn(COLUMN_COMPONENT_UUID)
- .addColumn(COLUMN_COMPONENT_KEY)
- .addColumn(COLUMN_COMPONENT_NAME)
- .addColumn(COLUMN_COMPONENT_BRANCH_KEY)
- .addColumn(COLUMN_CREATED_AT)
- .build());
-
- context.execute(new CreateIndexBuilder()
- .setTable(TABLE_NAME)
- .setName(TABLE_NAME + "_unique")
- .addColumn(COLUMN_EVENT_UUID)
- .addColumn(COLUMN_CHANGE_CATEGORY)
- .addColumn(COLUMN_COMPONENT_UUID)
- .setUnique(true)
- .build());
- context.execute(new CreateIndexBuilder()
- .setTable(TABLE_NAME)
- .setName("event_cpnt_changes_cpnt")
- .addColumn(COLUMN_EVENT_COMPONENT_UUID)
- .setUnique(false)
- .build());
- context.execute(new CreateIndexBuilder()
- .setTable(TABLE_NAME)
- .setName("event_cpnt_changes_analysis")
- .addColumn(COLUMN_EVENT_ANALYSIS_UUID)
- .setUnique(false)
- .build());
- }
-
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v75/AddIsOwnerUserColumnInAlmAppInstall.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v75/AddIsOwnerUserColumnInAlmAppInstall.java
deleted file mode 100644
index f0e5c287ac6..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v75/AddIsOwnerUserColumnInAlmAppInstall.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v75;
-
-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 AddIsOwnerUserColumnInAlmAppInstall extends DdlChange {
-
- public AddIsOwnerUserColumnInAlmAppInstall(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute(new AddColumnsBuilder(getDialect(), "alm_app_installs")
- .addColumn(newBooleanColumnDefBuilder()
- .setColumnName("is_owner_user")
- .setIsNullable(true)
- .build())
- .build());
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v75/AddUserExternalIdColumnInAlmAppInstall.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v75/AddUserExternalIdColumnInAlmAppInstall.java
deleted file mode 100644
index 3ed05df6886..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v75/AddUserExternalIdColumnInAlmAppInstall.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v75;
-
-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.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;
-
-@SupportsBlueGreen
-public class AddUserExternalIdColumnInAlmAppInstall extends DdlChange {
-
- private static final String ALM_APP_INSTALLS_TABLE = "alm_app_installs";
- private static final String USER_EXTERNAL_ID_COLUMN = "user_external_id";
-
- public AddUserExternalIdColumnInAlmAppInstall(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- VarcharColumnDef userExternalIdDef = newVarcharColumnDefBuilder()
- .setColumnName(USER_EXTERNAL_ID_COLUMN)
- .setLimit(255)
- .setIsNullable(true)
- .build();
- context.execute(new AddColumnsBuilder(getDialect(), ALM_APP_INSTALLS_TABLE)
- .addColumn(userExternalIdDef).build());
- context.execute(new CreateIndexBuilder()
- .setTable(ALM_APP_INSTALLS_TABLE)
- .addColumn(userExternalIdDef)
- .setUnique(false)
- .setName("alm_app_installs_external_id")
- .build());
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v75/CreateOrganizationsAlmBindingsTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v75/CreateOrganizationsAlmBindingsTable.java
deleted file mode 100644
index 8c7421e2b88..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v75/CreateOrganizationsAlmBindingsTable.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v75;
-
-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.SupportsBlueGreen;
-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.newVarcharColumnDefBuilder;
-
-@SupportsBlueGreen
-public class CreateOrganizationsAlmBindingsTable extends DdlChange {
-
- private static final String TABLE_NAME = "organization_alm_bindings";
-
- private static final VarcharColumnDef UUID_COLUMN = newVarcharColumnDefBuilder()
- .setColumnName("uuid")
- .setIsNullable(false)
- .setLimit(VarcharColumnDef.UUID_SIZE)
- .build();
- private static final VarcharColumnDef ORGANIZATION_UUID_COLUMN = newVarcharColumnDefBuilder()
- .setColumnName("organization_uuid")
- .setIsNullable(false)
- .setLimit(VarcharColumnDef.UUID_SIZE)
- .build();
- private static final VarcharColumnDef ALM_APP_INSTALL_UUID_COLUMN = newVarcharColumnDefBuilder()
- .setColumnName("alm_app_install_uuid")
- .setIsNullable(false)
- .setLimit(VarcharColumnDef.UUID_SIZE)
- .build();
- private static final VarcharColumnDef ALM_ID_COLUMN = newVarcharColumnDefBuilder()
- .setColumnName("alm_id")
- .setIsNullable(false)
- .setLimit(40)
- .build();
- private static final VarcharColumnDef URL_COLUMN = newVarcharColumnDefBuilder()
- .setColumnName("url")
- .setIsNullable(false)
- .setLimit(2000)
- .build();
- private static final VarcharColumnDef USER_UUID_COLUMN = newVarcharColumnDefBuilder()
- .setColumnName("user_uuid")
- .setIsNullable(false)
- .setLimit(255)
- .build();
- private static final BigIntegerColumnDef CREATED_AT_COLUMN = newBigIntegerColumnDefBuilder()
- .setColumnName("created_at")
- .setIsNullable(false)
- .build();
-
- public CreateOrganizationsAlmBindingsTable(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- if (!tableExists()) {
- context.execute(new CreateTableBuilder(getDialect(), TABLE_NAME)
- .addPkColumn(UUID_COLUMN)
- .addColumn(ORGANIZATION_UUID_COLUMN)
- .addColumn(ALM_APP_INSTALL_UUID_COLUMN)
- .addColumn(ALM_ID_COLUMN)
- .addColumn(URL_COLUMN)
- .addColumn(USER_UUID_COLUMN)
- .addColumn(CREATED_AT_COLUMN)
- .build());
-
- context.execute(new CreateIndexBuilder()
- .addColumn(ORGANIZATION_UUID_COLUMN)
- .setUnique(true)
- .setTable(TABLE_NAME)
- .setName("org_alm_bindings_org")
- .build());
-
- context.execute(new CreateIndexBuilder()
- .addColumn(ALM_APP_INSTALL_UUID_COLUMN)
- .setUnique(true)
- .setTable(TABLE_NAME)
- .setName("org_alm_bindings_install")
- .build());
- }
- }
-
- private boolean tableExists() throws SQLException {
- try (Connection connection = getDatabase().getDataSource().getConnection()) {
- return DatabaseUtils.tableExists(TABLE_NAME, connection);
- }
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v75/DbVersion75.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v75/DbVersion75.java
deleted file mode 100644
index 05176b69a7b..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v75/DbVersion75.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v75;
-
-import org.sonar.server.platform.db.migration.step.MigrationStepRegistry;
-import org.sonar.server.platform.db.migration.version.DbVersion;
-
-public class DbVersion75 implements DbVersion {
-
- @Override
- public void addSteps(MigrationStepRegistry registry) {
- registry
- .add(2400, "Add column IS_OWNER_USER in ALM_APP_INSTALLS", AddIsOwnerUserColumnInAlmAppInstall.class)
- .add(2401, "Create ORGANIZATION_ALM_BINDINGS table", CreateOrganizationsAlmBindingsTable.class)
- .add(2402, "Add column USER_EXTERNAL_ID in ALM_APP_INSTALLS", AddUserExternalIdColumnInAlmAppInstall.class)
- .add(2403, "Set IS_OWNER_USER not nullable in ALM_APP_INSTALLS", SetIsOwnerUserNotNullableInAlmAppInstalls.class)
- .add(2404, "Add table EVENT_COMPONENT_CHANGES", AddEventComponentChanges.class);
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v75/SetIsOwnerUserNotNullableInAlmAppInstalls.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v75/SetIsOwnerUserNotNullableInAlmAppInstalls.java
deleted file mode 100644
index e3958722bb3..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v75/SetIsOwnerUserNotNullableInAlmAppInstalls.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v75;
-
-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 SetIsOwnerUserNotNullableInAlmAppInstalls extends DdlChange {
-
- public SetIsOwnerUserNotNullableInAlmAppInstalls(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute(new AlterColumnsBuilder(getDialect(), "alm_app_installs")
- .updateColumn(newBooleanColumnDefBuilder()
- .setColumnName("is_owner_user")
- .setIsNullable(false)
- .build())
- .build());
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v75/package-info.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v75/package-info.java
deleted file mode 100644
index 65298459ec9..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v75/package-info.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public 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.v75;
-
-import javax.annotation.ParametersAreNonnullByDefault;
-
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v76/AddUniqueIndexInUserPropertiesTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v76/AddUniqueIndexInUserPropertiesTable.java
deleted file mode 100644
index cb01b4464d2..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v76/AddUniqueIndexInUserPropertiesTable.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v76;
-
-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.CreateIndexBuilder;
-import org.sonar.server.platform.db.migration.step.DdlChange;
-
-import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder;
-
-@SupportsBlueGreen
-public class AddUniqueIndexInUserPropertiesTable extends DdlChange {
-
- private static final String TABLE_NAME = "user_properties";
-
- public AddUniqueIndexInUserPropertiesTable(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute(new CreateIndexBuilder()
- .addColumn(newVarcharColumnDefBuilder()
- .setColumnName("user_uuid")
- .setIsNullable(false)
- .setLimit(255)
- .build())
- .addColumn(newVarcharColumnDefBuilder()
- .setColumnName("kee")
- .setIsNullable(false)
- .setLimit(100)
- .build())
- .setUnique(true)
- .setTable(TABLE_NAME)
- .setName("user_properties_user_uuid_kee")
- .build());
- }
-
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v76/AddUniqueIndexOnExternalLoginInUsersTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v76/AddUniqueIndexOnExternalLoginInUsersTable.java
deleted file mode 100644
index 61e30223aff..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v76/AddUniqueIndexOnExternalLoginInUsersTable.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v76;
-
-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.step.DdlChange;
-
-import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder;
-
-@SupportsBlueGreen
-public class AddUniqueIndexOnExternalLoginInUsersTable extends DdlChange {
-
- public AddUniqueIndexOnExternalLoginInUsersTable(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute(new CreateIndexBuilder()
- .setTable("users")
- .setName("uniq_external_login")
- .setUnique(true)
- .addColumn(notNullableColumn("external_identity_provider", 100))
- .addColumn(notNullableColumn("external_login", 255))
- .build());
- }
-
- private static VarcharColumnDef notNullableColumn(String columnName, int limit) {
- return newVarcharColumnDefBuilder()
- .setColumnName(columnName)
- .setLimit(limit)
- .setIsNullable(false)
- .build();
- }
-
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v76/CreateUserPropertiesTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v76/CreateUserPropertiesTable.java
deleted file mode 100644
index d501b1db4f2..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v76/CreateUserPropertiesTable.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v76;
-
-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.SupportsBlueGreen;
-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.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;
-
-@SupportsBlueGreen
-public class CreateUserPropertiesTable extends DdlChange {
-
- private static final String TABLE_NAME = "user_properties";
-
- 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(255)
- .build();
- private static final VarcharColumnDef KEY_COLUMN = newVarcharColumnDefBuilder()
- .setColumnName("kee")
- .setIsNullable(false)
- .setLimit(100)
- .build();
- private static final VarcharColumnDef TEXT_VALUE_COLUMN = newVarcharColumnDefBuilder()
- .setColumnName("text_value")
- .setIsNullable(false)
- .setLimit(4000)
- .build();
- private static final BigIntegerColumnDef CREATED_AT_COLUMN = newBigIntegerColumnDefBuilder()
- .setColumnName("created_at")
- .setIsNullable(false)
- .build();
- private static final BigIntegerColumnDef UPDATED_AT_COLUMN = newBigIntegerColumnDefBuilder()
- .setColumnName("updated_at")
- .setIsNullable(false)
- .build();
-
- public CreateUserPropertiesTable(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- if (tableExists()) {
- return;
- }
- context.execute(new CreateTableBuilder(getDialect(), TABLE_NAME)
- .addPkColumn(UUID_COLUMN)
- .addColumn(USER_UUID_COLUMN)
- .addColumn(KEY_COLUMN)
- .addColumn(TEXT_VALUE_COLUMN)
- .addColumn(CREATED_AT_COLUMN)
- .addColumn(UPDATED_AT_COLUMN)
- .build());
- }
-
- private boolean tableExists() throws SQLException {
- try (Connection connection = getDatabase().getDataSource().getConnection()) {
- return DatabaseUtils.tableExists(TABLE_NAME, connection);
- }
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v76/DbVersion76.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v76/DbVersion76.java
deleted file mode 100644
index ee64126ef95..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v76/DbVersion76.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v76;
-
-import org.sonar.server.platform.db.migration.step.MigrationStepRegistry;
-import org.sonar.server.platform.db.migration.version.DbVersion;
-
-public class DbVersion76 implements DbVersion {
-
- @Override
- public void addSteps(MigrationStepRegistry registry) {
- registry
- .add(2500, "Create table USER_PROPERTIES", CreateUserPropertiesTable.class)
- .add(2501, "Add index in table USER_PROPERTIES", AddUniqueIndexInUserPropertiesTable.class)
- .add(2502, "Archive module properties in a new project level property", MigrateModuleProperties.class)
- .add(2503, "Delete useless 'sonar.dbcleaner.cleanDirectory' property", DeleteUselessProperty.class)
- .add(2504, "Delete useless module and folder level measures", DeleteModuleAndFolderMeasures.class)
- .add(2505, "Fix the direction values of certain metrics (prepare for migration of conditions)", FixDirectionOfMetrics.class)
- .add(2506, "Migrate quality gate conditions using warning, period and no more supported operations", MigrateNoMoreUsedQualityGateConditions.class)
- .add(2507, "Delete sonar.onboardingTutorial.showToNewUsers from settings", DeleteUselessOnboardingSetting.class)
- .add(2508, "Add unique index on EXTERNAL_LOGIN and EXTERNAL_IDENTITY_PROVIDER columns in table USERS", AddUniqueIndexOnExternalLoginInUsersTable.class)
- ;
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v76/DeleteModuleAndFolderMeasures.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v76/DeleteModuleAndFolderMeasures.java
deleted file mode 100644
index 2d2e7af9577..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v76/DeleteModuleAndFolderMeasures.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v76;
-
-import java.sql.SQLException;
-import org.sonar.api.config.Configuration;
-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;
-
-/**
- * Remove module and folder level measures
- */
-@SupportsBlueGreen
-public class DeleteModuleAndFolderMeasures extends DataChange {
-
- private final Configuration configuration;
-
- public DeleteModuleAndFolderMeasures(Database db, Configuration configuration) {
- super(db);
- this.configuration = configuration;
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- if (isSonarCloud(configuration)) {
- return;
- }
- MassUpdate massUpdate = context.prepareMassUpdate().rowPluralName("components");
- massUpdate.select("SELECT p.uuid FROM projects p WHERE p.qualifier in ('DIR', 'BRC') AND exists(SELECT 1 FROM project_measures m WHERE m.component_uuid = p.uuid)");
- massUpdate.update("DELETE FROM project_measures WHERE component_uuid=?")
- // important to keep the number of rows in a transaction under control. A component may have dozens/hundreds of measures to be deleted.
- .setBatchSize(10);
- massUpdate.execute((row, update) -> {
- String componentUuid = row.getString(1);
- update.setString(1, componentUuid);
- return true;
- });
- }
-
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v76/DeleteUselessOnboardingSetting.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v76/DeleteUselessOnboardingSetting.java
deleted file mode 100644
index 303cffb419f..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v76/DeleteUselessOnboardingSetting.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v76;
-
-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 java.sql.SQLException;
-
-/**
- * Remove the "sonar.onboardingTutorial.showToNewUsers" settings from the PROPERTIES table
- */
-@SupportsBlueGreen
-public class DeleteUselessOnboardingSetting extends DataChange {
-
- public DeleteUselessOnboardingSetting(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- MassUpdate massUpdate = context.prepareMassUpdate().rowPluralName("useless onboarding settings");
- massUpdate.select("SELECT id FROM properties WHERE prop_key=?")
- .setString(1, "sonar.onboardingTutorial.showToNewUsers");
- massUpdate.update("DELETE FROM properties WHERE id=?");
- massUpdate.execute((row, update) -> {
- long propertyId = row.getLong(1);
- update.setLong(1, propertyId);
- return true;
- });
- }
-
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v76/DeleteUselessProperty.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v76/DeleteUselessProperty.java
deleted file mode 100644
index 441b5a8ece1..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v76/DeleteUselessProperty.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v76;
-
-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;
-
-/**
- * Remove the following settings from the PROPERTIES table :
- * - sonar.dbcleaner.cleanDirectory
- */
-@SupportsBlueGreen
-public class DeleteUselessProperty extends DataChange {
-
- public DeleteUselessProperty(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.prepareUpsert("DELETE FROM properties WHERE prop_key = 'sonar.dbcleaner.cleanDirectory'")
- .execute()
- .commit();
- }
-
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v76/FixDirectionOfMetrics.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v76/FixDirectionOfMetrics.java
deleted file mode 100644
index 8bbc6992fbe..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v76/FixDirectionOfMetrics.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v76;
-
-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 FixDirectionOfMetrics extends DataChange {
-
- public FixDirectionOfMetrics(Database db) {
- super(db);
- }
-
- @Override
- protected void execute(Context context) throws SQLException {
- String sql = "UPDATE metrics SET direction = ? WHERE name = ? AND direction != ?";
-
- context.prepareUpsert(sql)
- .setInt(1, 1)
- .setString(2, "tests")
- .setInt(3, 1)
- .execute()
- .commit();
-
- context.prepareUpsert(sql)
- .setInt(1, -1)
- .setString(2, "conditions_to_cover")
- .setInt(3, -1)
- .execute()
- .commit();
-
- context.prepareUpsert(sql)
- .setInt(1, -1)
- .setString(2, "new_conditions_to_cover")
- .setInt(3, -1)
- .execute()
- .commit();
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v76/MigrateModuleProperties.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v76/MigrateModuleProperties.java
deleted file mode 100644
index 79fa960913c..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v76/MigrateModuleProperties.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v76;
-
-import java.sql.SQLException;
-import java.util.concurrent.atomic.AtomicReference;
-import org.apache.commons.lang.StringUtils;
-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;
-import org.sonar.server.platform.db.migration.step.Upsert;
-
-@SupportsBlueGreen
-public class MigrateModuleProperties extends DataChange {
-
- protected static final String NEW_PROPERTY_NAME = "sonar.subproject.settings.archived";
-
- private final System2 system2;
-
- public MigrateModuleProperties(Database db, System2 system2) {
- super(db);
- this.system2 = system2;
- }
-
- @Override
- protected void execute(Context context) throws SQLException {
- long now = system2.now();
- moveModulePropertiesToProjectLevel(context, now);
- removeModuleProperties(context);
- }
-
- private static void moveModulePropertiesToProjectLevel(Context context, long time) throws SQLException {
- StringBuilder builder = new StringBuilder();
- AtomicReference currentProjectId = new AtomicReference<>();
- AtomicReference currentModuleUuid = new AtomicReference<>();
-
- context.prepareSelect("select prop.prop_key, prop.text_value, prop.clob_value, module1.name, module1.uuid, root.id as project_id, root.name as project_name " +
- "from properties prop " +
- "left join projects module1 on module1.id = prop.resource_id " +
- "left join projects root on root.uuid = module1.project_uuid " +
- "where module1.qualifier = 'BRC' and prop.user_id is null " +
- "order by root.uuid, module1.uuid, prop.prop_key")
- .scroll(row -> {
- String propertyKey = row.getString(1);
- String propertyTextValue = row.getString(2);
- String propertyClobValue = row.getString(3);
- String moduleName = row.getString(4);
- String moduleUuid = row.getString(5);
- Integer projectId = row.getInt(6);
- String projectName = row.getString(7);
-
- if (!projectId.equals(currentProjectId.get())) {
- if (currentProjectId.get() != null) {
- insertProjectProperties(context, currentProjectId.get(), builder.toString(), time);
- }
-
- builder.setLength(0);
- currentProjectId.set(projectId);
- }
-
- if (!moduleUuid.equals(currentModuleUuid.get())) {
- if (currentModuleUuid.get() != null && builder.length() != 0) {
- builder.append("\n");
- }
- builder.append("# Settings from '").append(projectName).append("::").append(moduleName).append("'\n");
- currentModuleUuid.set(moduleUuid);
- }
-
- builder.append(propertyKey).append("=");
- if (StringUtils.isNotBlank(propertyTextValue)) {
- builder.append(propertyTextValue);
- } else if (StringUtils.isNotBlank(propertyClobValue)) {
- builder.append(propertyClobValue);
- }
- builder.append("\n");
- });
-
- if (builder.length() > 0) {
- insertProjectProperties(context, currentProjectId.get(), builder.toString(), time);
- }
- }
-
- private static void insertProjectProperties(Context context, int projectId, String content, long time) throws SQLException {
- Upsert upsert = context.prepareUpsert("insert into properties (prop_key, resource_id, is_empty, clob_value, created_at) values (?, ?, ?, ?, ?)");
- upsert.setString(1, NEW_PROPERTY_NAME)
- .setInt(2, projectId)
- .setBoolean(3, false)
- .setString(4, content)
- .setLong(5, time)
- .execute()
- .commit();
- }
-
- private static void removeModuleProperties(Context context) throws SQLException {
- MassUpdate massUpdate = context.prepareMassUpdate().rowPluralName("module level properties");
- massUpdate.select("select prop.id as property_id " +
- "from properties prop " +
- "left join projects module1 on module1.id = prop.resource_id " +
- "where module1.qualifier = 'BRC'");
- massUpdate.update("delete from properties where id=?");
- massUpdate.execute((row, update) -> {
- update.setInt(1, row.getInt(1));
- return true;
- });
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v76/MigrateNoMoreUsedQualityGateConditions.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v76/MigrateNoMoreUsedQualityGateConditions.java
deleted file mode 100644
index 7bd9a7636f6..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v76/MigrateNoMoreUsedQualityGateConditions.java
+++ /dev/null
@@ -1,428 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v76;
-
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.ImmutableSet;
-import java.sql.SQLException;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.stream.Collectors;
-import javax.annotation.CheckForNull;
-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.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.Upsert;
-
-import static com.google.common.base.Strings.isNullOrEmpty;
-import static java.util.stream.Collectors.toSet;
-import static org.sonar.core.util.stream.MoreCollectors.toList;
-import static org.sonar.core.util.stream.MoreCollectors.uniqueIndex;
-import static org.sonar.server.platform.db.migration.step.Select.LONG_READER;
-
-@SupportsBlueGreen
-public class MigrateNoMoreUsedQualityGateConditions extends DataChange {
-
- private static final Logger LOG = Loggers.get(MigrateNoMoreUsedQualityGateConditions.class);
-
- private static final String OPERATOR_GREATER_THAN = "GT";
- private static final String OPERATOR_LESS_THAN = "LT";
-
- private static final int DIRECTION_WORST = -1;
- private static final int DIRECTION_BETTER = 1;
- private static final int DIRECTION_NONE = 0;
-
- private static final Set SUPPORTED_OPERATORS = ImmutableSet.of(OPERATOR_GREATER_THAN, OPERATOR_LESS_THAN);
- private static final Set SUPPORTED_METRIC_TYPES = ImmutableSet.of("INT", "FLOAT", "PERCENT", "MILLISEC", "LEVEL", "RATING", "WORK_DUR");
- private static final Map LEAK_METRIC_KEY_BY_METRIC_KEY = ImmutableMap.builder()
- .put("branch_coverage", "new_branch_coverage")
- .put("conditions_to_cover", "new_conditions_to_cover")
- .put("coverage", "new_coverage")
- .put("line_coverage", "new_line_coverage")
- .put("lines_to_cover", "new_lines_to_cover")
- .put("uncovered_conditions", "new_uncovered_conditions")
- .put("uncovered_lines", "new_uncovered_lines")
- .put("duplicated_blocks", "new_duplicated_blocks")
- .put("duplicated_lines", "new_duplicated_lines")
- .put("duplicated_lines_density", "new_duplicated_lines_density")
- .put("blocker_violations", "new_blocker_violations")
- .put("critical_violations", "new_critical_violations")
- .put("info_violations", "new_info_violations")
- .put("violations", "new_violations")
- .put("major_violations", "new_major_violations")
- .put("minor_violations", "new_minor_violations")
- .put("sqale_index", "new_technical_debt")
- .put("code_smells", "new_code_smells")
- .put("sqale_rating", "new_maintainability_rating")
- .put("sqale_debt_ratio", "new_sqale_debt_ratio")
- .put("bugs", "new_bugs")
- .put("reliability_rating", "new_reliability_rating")
- .put("reliability_remediation_effort", "new_reliability_remediation_effort")
- .put("vulnerabilities", "new_vulnerabilities")
- .put("security_rating", "new_security_rating")
- .put("security_remediation_effort", "new_security_remediation_effort")
- .put("lines", "new_lines")
- .build();
-
- private final System2 system2;
-
- public MigrateNoMoreUsedQualityGateConditions(Database db, System2 system2) {
- super(db);
- this.system2 = system2;
- }
-
- @Override
- protected void execute(Context context) throws SQLException {
- MigrationContext migrationContext = new MigrationContext(context, new Date(system2.now()), loadMetrics(context));
- List qualityGateIds = context.prepareSelect("SELECT id FROM quality_gates qg WHERE qg.is_built_in=?")
- .setBoolean(1, false)
- .list(LONG_READER);
- for (long qualityGateId : qualityGateIds) {
- List conditions = loadConditions(context, qualityGateId);
-
- markNoMoreSupportedConditionsAsToBeDeleted(migrationContext, conditions);
- markConditionsHavingOnlyWarningAsToBeDeleted(conditions);
- markConditionsUsingLeakPeriodHavingNoRelatedLeakMetricAsToBeDeleted(migrationContext, conditions);
- markConditionsUsingLeakPeriodHavingAlreadyRelatedConditionAsToBeDeleted(migrationContext, conditions);
- updateConditionsUsingLeakPeriod(migrationContext, conditions);
- updateConditionsHavingErrorAndWarningByRemovingWarning(migrationContext, conditions);
- dropConditionsIfNeeded(migrationContext, conditions);
-
- migrationContext.increaseNumberOfProcessedQualityGate();
- }
- LOG.info("{} custom quality gates have been loaded", migrationContext.getNbOfQualityGates());
- LOG.info("{} conditions have been removed", migrationContext.getNbOfRemovedConditions());
- LOG.info("{} conditions have been updated", migrationContext.getNbOfUpdatedConditions());
- }
-
- private static List loadMetrics(Context context) throws SQLException {
- return context
- .prepareSelect("SELECT m.id, m.name, m.val_type, m.direction FROM metrics m WHERE m.enabled=?")
- .setBoolean(1, true)
- .list(row -> new Metric(row.getInt(1), row.getString(2), row.getString(3), row.getInt(4)));
- }
-
- private static List loadConditions(Context context, long qualityGateId) throws SQLException {
- return context.prepareSelect("SELECT qgc.id, qgc.metric_id, qgc.operator, qgc.value_error, qgc.value_warning, qgc.period FROM quality_gate_conditions qgc " +
- "WHERE qgc.qgate_id=? ")
- .setLong(1, qualityGateId)
- .list(
- row -> new QualityGateCondition(row.getInt(1), row.getInt(2), row.getString(3),
- row.getString(4), row.getString(5), row.getInt(6)));
- }
-
- private static void markNoMoreSupportedConditionsAsToBeDeleted(MigrationContext migrationContext, List conditions) {
- conditions.stream()
- .filter(c -> !c.isToBeDeleted())
- .filter(c -> !isConditionStillSupported(c, migrationContext.getMetricById(c.getMetricId())))
- .forEach(QualityGateCondition::setToBeDeleted);
- }
-
- private static void markConditionsHavingOnlyWarningAsToBeDeleted(List conditions) {
- conditions.stream()
- .filter(c -> !c.isToBeDeleted())
- .filter(c -> !isNullOrEmpty(c.getWarning()) && isNullOrEmpty(c.getError()))
- .forEach(QualityGateCondition::setToBeDeleted);
- }
-
- private static void markConditionsUsingLeakPeriodHavingNoRelatedLeakMetricAsToBeDeleted(MigrationContext migrationContext, List conditions) {
- conditions
- .stream()
- .filter(c -> !c.isToBeDeleted())
- .filter(QualityGateCondition::hasLeakPeriod)
- .filter(condition -> !isConditionOnLeakMetric(migrationContext, condition))
- .forEach(condition -> {
- String metricKey = migrationContext.getMetricById(condition.getMetricId()).getKey();
- String relatedLeakMetric = LEAK_METRIC_KEY_BY_METRIC_KEY.get(metricKey);
- // Metric has no related metric on leak period => delete condition
- if (relatedLeakMetric == null) {
- condition.setToBeDeleted();
- }
- });
- }
-
- private static void markConditionsUsingLeakPeriodHavingAlreadyRelatedConditionAsToBeDeleted(MigrationContext migrationContext, List conditions) {
- Map conditionsByMetricKey = conditions.stream()
- .filter(c -> !c.isToBeDeleted())
- .collect(uniqueIndex(c -> migrationContext.getMetricById(c.getMetricId()).getKey()));
-
- conditions
- .stream()
- .filter(condition -> !condition.isToBeDeleted())
- .filter(QualityGateCondition::hasLeakPeriod)
- .filter(condition -> !isConditionOnLeakMetric(migrationContext, condition))
- .forEach(condition -> {
- String metricKey = migrationContext.getMetricById(condition.getMetricId()).getKey();
- String relatedLeakMetric = LEAK_METRIC_KEY_BY_METRIC_KEY.get(metricKey);
- if (relatedLeakMetric != null) {
- QualityGateCondition existingConditionUsingRelatedLeakPeriod = conditionsByMetricKey.get(relatedLeakMetric);
- if (existingConditionUsingRelatedLeakPeriod != null) {
- // Another condition on related leak period metric exist => delete condition
- condition.setToBeDeleted();
- }
- }
- });
- }
-
- private static void updateConditionsHavingErrorAndWarningByRemovingWarning(MigrationContext migrationContext, List conditions)
- throws SQLException {
- Set conditionsToBeUpdated = conditions.stream()
- .filter(c -> !c.isToBeDeleted())
- .filter(c -> !isNullOrEmpty(c.getWarning()) && !isNullOrEmpty(c.getError()))
- .map(QualityGateCondition::getId)
- .collect(toSet());
- if (conditionsToBeUpdated.isEmpty()) {
- return;
- }
- migrationContext.getContext()
- .prepareUpsert("UPDATE quality_gate_conditions SET value_warning = NULL, updated_at = ? WHERE id IN (" + conditionsToBeUpdated
- .stream()
- .map(c -> Integer.toString(c))
- .collect(Collectors.joining(",")) + ")")
- .setDate(1, migrationContext.getNow())
- .execute()
- .commit();
- migrationContext.addUpdatedConditions(conditionsToBeUpdated.size());
- }
-
- private static void updateConditionsUsingLeakPeriod(MigrationContext migrationContext, List conditions)
- throws SQLException {
-
- Map conditionsByMetricKey = conditions.stream()
- .filter(c -> !c.isToBeDeleted())
- .collect(uniqueIndex(c -> migrationContext.getMetricById(c.getMetricId()).getKey()));
-
- Upsert updateMetricId = migrationContext.getContext()
- .prepareUpsert("UPDATE quality_gate_conditions SET metric_id = ?, updated_at = ? WHERE id = ? ")
- .setDate(2, migrationContext.getNow());
-
- conditions
- .stream()
- .filter(c -> !c.isToBeDeleted())
- .filter(QualityGateCondition::hasLeakPeriod)
- .filter(condition -> !isConditionOnLeakMetric(migrationContext, condition))
- .forEach(condition -> {
- String metricKey = migrationContext.getMetricById(condition.getMetricId()).getKey();
- String relatedLeakMetric = LEAK_METRIC_KEY_BY_METRIC_KEY.get(metricKey);
- QualityGateCondition existingConditionUsingRelatedLeakPeriod = conditionsByMetricKey.get(relatedLeakMetric);
- // Metric has a related leak period metric => update the condition
- if (existingConditionUsingRelatedLeakPeriod == null) {
- try {
- updateMetricId.setInt(1, migrationContext.getMetricByKey(relatedLeakMetric).getId());
- updateMetricId.setInt(3, condition.getId());
- updateMetricId.execute();
- migrationContext.addUpdatedConditions(1);
- } catch (SQLException e) {
- throw new IllegalStateException("Fail to update quality gate conditions", e);
- }
- }
- });
- updateMetricId.commit();
- }
-
- private static void dropConditionsIfNeeded(MigrationContext context, List conditions) throws SQLException {
- List conditionsToBeDeleted = conditions.stream()
- .filter(QualityGateCondition::isToBeDeleted)
- .collect(toList());
- if (conditionsToBeDeleted.isEmpty()) {
- return;
- }
- context.getContext()
- .prepareUpsert("DELETE FROM quality_gate_conditions WHERE id IN (" + conditionsToBeDeleted
- .stream()
- .map(c -> Integer.toString(c.getId()))
- .collect(Collectors.joining(",")) + ")")
- .execute()
- .commit();
- context.addRemovedConditions(conditionsToBeDeleted.size());
- }
-
- private static boolean isConditionOnLeakMetric(MigrationContext migrationContext, QualityGateCondition condition) {
- return LEAK_METRIC_KEY_BY_METRIC_KEY.containsValue(migrationContext.getMetricById(condition.getMetricId()).getKey());
- }
-
- private static boolean isConditionStillSupported(QualityGateCondition condition, Metric metric) {
- return isSupportedMetricType(metric) && isSupportedOperator(condition, metric);
- }
-
- private static boolean isSupportedMetricType(Metric metric) {
- return SUPPORTED_METRIC_TYPES.contains(metric.getType());
- }
-
- private static boolean isSupportedOperator(QualityGateCondition condition, Metric metric) {
- String operator = condition.getOperator();
- int direction = metric.getDirection();
- return SUPPORTED_OPERATORS.contains(operator) &&
- (direction == DIRECTION_NONE ||
- (direction == DIRECTION_WORST && operator.equalsIgnoreCase(OPERATOR_GREATER_THAN)) ||
- (direction == DIRECTION_BETTER && operator.equalsIgnoreCase(OPERATOR_LESS_THAN)));
- }
-
- private static class QualityGateCondition {
- private final int id;
- private final int metricId;
- private final String operator;
- private final String error;
- private final String warning;
- private final Integer period;
-
- private boolean toBeDeleted = false;
-
- public QualityGateCondition(int id, int metricId, String operator, @Nullable String error, @Nullable String warning,
- @Nullable Integer period) {
- this.id = id;
- this.metricId = metricId;
- this.operator = operator;
- this.error = error;
- this.warning = warning;
- this.period = period;
- }
-
- public int getId() {
- return id;
- }
-
- public int getMetricId() {
- return metricId;
- }
-
- public String getOperator() {
- return operator;
- }
-
- @CheckForNull
- public String getError() {
- return error;
- }
-
- @CheckForNull
- public String getWarning() {
- return warning;
- }
-
- public boolean hasLeakPeriod() {
- return period != null && period == 1;
- }
-
- public void setToBeDeleted() {
- toBeDeleted = true;
- }
-
- public boolean isToBeDeleted() {
- return toBeDeleted;
- }
- }
-
- private static class Metric {
- private final int id;
- private final String key;
- private final String type;
- private final int direction;
-
- public Metric(int id, String key, String type, int direction) {
- this.id = id;
- this.key = key;
- this.type = type;
- this.direction = direction;
- }
-
- public int getId() {
- return id;
- }
-
- public String getKey() {
- return key;
- }
-
- public String getType() {
- return type;
- }
-
- public int getDirection() {
- return direction;
- }
- }
-
- private static class MigrationContext {
-
- private final Context context;
- private final Date now;
- private final Map metricsById;
- private final Map metricsByKey;
-
- private int nbOfQualityGates;
- private int nbOfRemovedConditions;
- private int nbOfUpdatedConditions;
-
- public MigrationContext(Context context, Date now, List metrics) {
- this.context = context;
- this.now = now;
- this.metricsById = metrics.stream().collect(uniqueIndex(Metric::getId));
- this.metricsByKey = metrics.stream().collect(uniqueIndex(Metric::getKey));
- }
-
- public Context getContext() {
- return context;
- }
-
- public Date getNow() {
- return now;
- }
-
- public Metric getMetricByKey(String key) {
- return metricsByKey.get(key);
- }
-
- public Metric getMetricById(int id) {
- return metricsById.get(id);
- }
-
- public void increaseNumberOfProcessedQualityGate() {
- nbOfQualityGates += 1;
- }
-
- public int getNbOfQualityGates() {
- return nbOfQualityGates;
- }
-
- public void addRemovedConditions(int removedConditions) {
- nbOfRemovedConditions += removedConditions;
- }
-
- public int getNbOfRemovedConditions() {
- return nbOfRemovedConditions;
- }
-
- public void addUpdatedConditions(int updatedConditions) {
- nbOfUpdatedConditions += updatedConditions;
- }
-
- public int getNbOfUpdatedConditions() {
- return nbOfUpdatedConditions;
- }
- }
-
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v76/package-info.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v76/package-info.java
deleted file mode 100644
index 994c7342253..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v76/package-info.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public 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.v76;
-
-import javax.annotation.ParametersAreNonnullByDefault;
-
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v77/AddBuildStringToSnapshot.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v77/AddBuildStringToSnapshot.java
deleted file mode 100644
index 2390465ea14..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v77/AddBuildStringToSnapshot.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v77;
-
-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.AddColumnsBuilder;
-import org.sonar.server.platform.db.migration.step.DdlChange;
-
-import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder;
-
-@SupportsBlueGreen
-public class AddBuildStringToSnapshot extends DdlChange {
- private static final String TABLE_NAME = "snapshots";
- private static final VarcharColumnDef COLUMN = newVarcharColumnDefBuilder()
- .setColumnName("build_string")
- .setIsNullable(true)
- .setLimit(100)
- .build();
-
- public AddBuildStringToSnapshot(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute(new AddColumnsBuilder(getDialect(), TABLE_NAME)
- .addColumn(COLUMN)
- .build());
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v77/AddLastConnectionDateToUserTokens.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v77/AddLastConnectionDateToUserTokens.java
deleted file mode 100644
index c2b3170ed38..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v77/AddLastConnectionDateToUserTokens.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v77;
-
-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.BigIntegerColumnDef;
-import org.sonar.server.platform.db.migration.sql.AddColumnsBuilder;
-import org.sonar.server.platform.db.migration.step.DdlChange;
-
-@SupportsBlueGreen
-public class AddLastConnectionDateToUserTokens extends DdlChange {
-
- public AddLastConnectionDateToUserTokens(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute(new AddColumnsBuilder(getDialect(), "user_tokens")
- .addColumn(BigIntegerColumnDef.newBigIntegerColumnDefBuilder()
- .setColumnName("last_connection_date")
- .setIsNullable(true)
- .build())
- .build());
- }
-
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v77/AddLastConnectionDateToUsers.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v77/AddLastConnectionDateToUsers.java
deleted file mode 100644
index 40b5c9a233a..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v77/AddLastConnectionDateToUsers.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v77;
-
-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.BigIntegerColumnDef;
-import org.sonar.server.platform.db.migration.sql.AddColumnsBuilder;
-import org.sonar.server.platform.db.migration.step.DdlChange;
-
-@SupportsBlueGreen
-public class AddLastConnectionDateToUsers extends DdlChange {
-
- public AddLastConnectionDateToUsers(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute(new AddColumnsBuilder(getDialect(), "users")
- .addColumn(BigIntegerColumnDef.newBigIntegerColumnDefBuilder()
- .setColumnName("last_connection_date")
- .setIsNullable(true)
- .build())
- .build());
- }
-
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v77/AddManualBaselineToProjectBranches.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v77/AddManualBaselineToProjectBranches.java
deleted file mode 100644
index 3c0ee15e286..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v77/AddManualBaselineToProjectBranches.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v77;
-
-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.AddColumnsBuilder;
-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 AddManualBaselineToProjectBranches extends DdlChange {
-
- static final String TABLE_NAME = "project_branches";
-
- private static final VarcharColumnDef COLUMN_MANUAL_BASELINE_ANALYSIS_UUID = newVarcharColumnDefBuilder()
- .setColumnName("manual_baseline_analysis_uuid")
- .setIsNullable(true)
- .setLimit(UUID_SIZE)
- .build();
-
- public AddManualBaselineToProjectBranches(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute(new AddColumnsBuilder(getDialect(), TABLE_NAME)
- .addColumn(COLUMN_MANUAL_BASELINE_ANALYSIS_UUID)
- .build());
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v77/AddMembersSyncFlagToOrgAlmBinding.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v77/AddMembersSyncFlagToOrgAlmBinding.java
deleted file mode 100644
index b75f0584f71..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v77/AddMembersSyncFlagToOrgAlmBinding.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v77;
-
-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.BooleanColumnDef;
-import org.sonar.server.platform.db.migration.sql.AddColumnsBuilder;
-import org.sonar.server.platform.db.migration.step.DdlChange;
-
-@SupportsBlueGreen
-public class AddMembersSyncFlagToOrgAlmBinding extends DdlChange {
-
- public AddMembersSyncFlagToOrgAlmBinding(Database db) {
- super(db);
- }
-
- @Override
- public void execute(DdlChange.Context context) throws SQLException {
- context.execute(new AddColumnsBuilder(getDialect(), "organization_alm_bindings")
- .addColumn(BooleanColumnDef.newBooleanColumnDefBuilder()
- .setColumnName("members_sync_enabled")
- .setIsNullable(true)
- .build())
- .build());
- }
-
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v77/DbVersion77.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v77/DbVersion77.java
deleted file mode 100644
index 86da2b49f30..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v77/DbVersion77.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v77;
-
-import org.sonar.server.platform.db.migration.step.MigrationStepRegistry;
-import org.sonar.server.platform.db.migration.version.DbVersion;
-
-public class DbVersion77 implements DbVersion {
-
- @Override
- public void addSteps(MigrationStepRegistry registry) {
- registry
- .add(2600, "Drop elasticsearch index 'tests'", DropElasticsearchIndexTests.class)
- .add(2601, "Delete lines with DATA_TYPE='TEST' from table FILES_SOURCE", DeleteTestDataTypeFromFileSources.class)
- .add(2602, "Add column LAST_CONNECTION_DATE to USERS table", AddLastConnectionDateToUsers.class)
- .add(2603, "Add column LAST_USED_DATE to USER_TOKENS table", AddLastConnectionDateToUserTokens.class)
- .add(2604, "Add baseline columns in PROJECT_BRANCHES", AddManualBaselineToProjectBranches.class)
- .add(2606, "Drop DATA_TYPE column from FILE_SOURCES table", DropDataTypeFromFileSources.class)
- .add(2607, "Add MEMBERS_SYNC_ENABLED column to ORGANIZATIONS_ALM_BINDING table", AddMembersSyncFlagToOrgAlmBinding.class)
- .add(2608, "Delete favorites on not supported components", DeleteFavouritesOnNotSupportedComponentQualifiers.class)
- .add(2609, "Delete exceeding favorites when there are more than 100 for a user", DeleteFavoritesExceedingOneHundred.class)
- .add(2610, "Truncate ES_QUEUE table content", TruncateEsQueue.class)
- .add(2611, "Add SNAPSHOTS.BUILD_STRING", AddBuildStringToSnapshot.class);
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v77/DeleteFavoritesExceedingOneHundred.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v77/DeleteFavoritesExceedingOneHundred.java
deleted file mode 100644
index 688dcfab9e6..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v77/DeleteFavoritesExceedingOneHundred.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v77;
-
-import java.sql.SQLException;
-import java.util.Comparator;
-import java.util.List;
-import java.util.Objects;
-import java.util.stream.Collectors;
-import java.util.stream.IntStream;
-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.Select;
-import org.sonar.server.platform.db.migration.step.Upsert;
-
-import static java.util.Arrays.asList;
-import static org.sonar.core.util.stream.MoreCollectors.toList;
-
-@SupportsBlueGreen
-public class DeleteFavoritesExceedingOneHundred extends DataChange {
-
- private static final Logger LOG = Loggers.get(DeleteFavoritesExceedingOneHundred.class);
-
- private static final String FAVOURITE_PROPERTY = "favourite";
-
- private static final List SORTED_QUALIFIERS = asList("TRK", "VW", "APP", "SVW", "FIL", "UTS");
-
- public DeleteFavoritesExceedingOneHundred(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- List userIdsHavingMoreThanOneHundredFavourites = context.prepareSelect("SELECT user_id FROM " +
- "(SELECT DISTINCT user_id, COUNT(id) AS nb FROM properties WHERE prop_key = ? AND user_id IS NOT NULL GROUP BY user_id) sub " +
- "WHERE sub.nb > 100")
- .setString(1, FAVOURITE_PROPERTY)
- .list(row -> row.getInt(1));
- LOG.info("Deleting favourites exceeding one hundred elements for {} users", userIdsHavingMoreThanOneHundredFavourites.size());
- for (Integer userId : userIdsHavingMoreThanOneHundredFavourites) {
- List propertyIdsToKeep = context.prepareSelect("SELECT prop.id, p.qualifier, p.enabled FROM properties prop " +
- "INNER JOIN projects p ON p.id=prop.resource_id " +
- "WHERE prop.prop_key=? AND prop.user_id = ?")
- .setString(1, FAVOURITE_PROPERTY)
- .setInt(2, userId)
- .list(Property::new)
- .stream()
- .sorted()
- .map(Property::getId)
- .limit(100)
- .collect(toList());
-
- String idsToString = IntStream.range(0, propertyIdsToKeep.size()).mapToObj(i -> "?").collect(Collectors.joining(","));
- Upsert upsert = context.prepareUpsert("DELETE FROM properties WHERE prop_key=? AND user_id=? AND id NOT in (" + idsToString + ")")
- .setString(1, FAVOURITE_PROPERTY)
- .setInt(2, userId);
- int index = 3;
- for (Integer id : propertyIdsToKeep) {
- upsert.setInt(index, id);
- index++;
- }
- upsert.execute().commit();
- }
- }
-
- private static class Property implements Comparable {
- private final int id;
- private final String qualifier;
- private final boolean enabled;
-
- Property(Select.Row row) throws SQLException {
- this.id = row.getInt(1);
- this.qualifier = row.getString(2);
- this.enabled = row.getBoolean(3);
- }
-
- int getId() {
- return id;
- }
-
- String getQualifier() {
- return qualifier;
- }
-
- boolean isEnabled() {
- return enabled;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) {
- return true;
- }
- if (o == null || getClass() != o.getClass()) {
- return false;
- }
- Property property = (Property) o;
- return id == property.id;
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(id);
- }
-
- @Override
- public int compareTo(Property o) {
- return Comparator.comparing(Property::isEnabled)
- .reversed()
- .thenComparing(property -> SORTED_QUALIFIERS.indexOf(property.getQualifier()))
- .compare(this, o);
- }
- }
-
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v77/DeleteFavouritesOnNotSupportedComponentQualifiers.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v77/DeleteFavouritesOnNotSupportedComponentQualifiers.java
deleted file mode 100644
index eae96710a36..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v77/DeleteFavouritesOnNotSupportedComponentQualifiers.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v77;
-
-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;
-import org.sonar.server.platform.db.migration.step.MassUpdate;
-
-@SupportsBlueGreen
-public class DeleteFavouritesOnNotSupportedComponentQualifiers extends DataChange {
-
- public DeleteFavouritesOnNotSupportedComponentQualifiers(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- MassUpdate massUpdate = context.prepareMassUpdate().rowPluralName("favourites");
- massUpdate.select("SELECT prop.id FROM properties prop " +
- "INNER JOIN projects p ON p.id=prop.resource_id AND p.qualifier NOT IN ('TRK', 'FIL', 'VW', 'SVW', 'APP', 'UTS') " +
- "WHERE prop_key=? AND user_id IS NOT NULL")
- .setString(1, "favourite");
- massUpdate.update("DELETE FROM properties WHERE id=?");
- massUpdate.execute((row, update) -> {
- int id = row.getInt(1);
- update.setInt(1, id);
- return true;
- });
- }
-
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v77/DeleteTestDataTypeFromFileSources.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v77/DeleteTestDataTypeFromFileSources.java
deleted file mode 100644
index c059fe71cce..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v77/DeleteTestDataTypeFromFileSources.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v77;
-
-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;
-import org.sonar.server.platform.db.migration.step.MassUpdate;
-
-@SupportsBlueGreen
-public class DeleteTestDataTypeFromFileSources extends DataChange {
-
- public DeleteTestDataTypeFromFileSources(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- MassUpdate massUpdate = context.prepareMassUpdate().rowPluralName("file sources");
- massUpdate.select("SELECT DISTINCT project_uuid FROM file_sources WHERE data_type='TEST'");
- massUpdate.update("DELETE FROM file_sources WHERE project_uuid=? AND data_type='TEST'");
- massUpdate.execute((row, update) -> {
- String projectUuid = row.getString(1);
- update.setString(1, projectUuid);
- return true;
- });
- }
-
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v77/DropDataTypeFromFileSources.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v77/DropDataTypeFromFileSources.java
deleted file mode 100644
index 6ace29f5179..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v77/DropDataTypeFromFileSources.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v77;
-
-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.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.VarcharColumnDef.newVarcharColumnDefBuilder;
-
-@SupportsBlueGreen
-public class DropDataTypeFromFileSources extends DdlChange {
-
- private static final String TABLE_NAME = "file_sources";
-
- public DropDataTypeFromFileSources(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute(new DropIndexBuilder(getDialect())
- .setTable(TABLE_NAME)
- .setName("file_sources_uuid_type")
- .build());
-
- context.execute(new DropColumnsBuilder(getDialect(), TABLE_NAME, "data_type")
- .build());
-
- context.execute(new CreateIndexBuilder()
- .setTable(TABLE_NAME)
- .setName("file_sources_file_uuid")
- .setUnique(true)
- .addColumn(newVarcharColumnDefBuilder()
- .setColumnName("file_uuid")
- .setIsNullable(false)
- .setLimit(50)
- .build())
- .build());
- }
-
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v77/DropElasticsearchIndexTests.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v77/DropElasticsearchIndexTests.java
deleted file mode 100644
index 3b30eabe317..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v77/DropElasticsearchIndexTests.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v77;
-
-import java.sql.SQLException;
-import org.sonar.db.Database;
-import org.sonar.server.platform.db.migration.SupportsBlueGreen;
-import org.sonar.server.platform.db.migration.es.MigrationEsClient;
-import org.sonar.server.platform.db.migration.step.DdlChange;
-
-@SupportsBlueGreen
-public class DropElasticsearchIndexTests extends DdlChange {
-
- private final MigrationEsClient migrationEsClient;
-
- public DropElasticsearchIndexTests(Database db, MigrationEsClient migrationEsClient) {
- super(db);
- this.migrationEsClient = migrationEsClient;
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- migrationEsClient.deleteIndexes("tests");
- }
-
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v77/TruncateEsQueue.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v77/TruncateEsQueue.java
deleted file mode 100644
index b0c1650047f..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v77/TruncateEsQueue.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v77;
-
-import java.sql.SQLException;
-import org.sonar.db.Database;
-import org.sonar.server.platform.db.migration.step.DataChange;
-
-/**
- * This DB migration comes with the change of ES indices structures and must not be flagged as compatible with BlueGreen
- * deployment because ES indices must be recreated and this is not compatible with BlueGreen.
- */
-public class TruncateEsQueue extends DataChange {
- public TruncateEsQueue(Database db) {
- super(db);
- }
-
- @Override
- protected void execute(Context context) throws SQLException {
- context.prepareUpsert("truncate table es_queue").execute().commit();
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v77/package-info.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v77/package-info.java
deleted file mode 100644
index 84451d73f64..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v77/package-info.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public 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.v77;
-
-import javax.annotation.ParametersAreNonnullByDefault;
-
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v78/AddIndexToOrgQProfileParentUuid.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v78/AddIndexToOrgQProfileParentUuid.java
deleted file mode 100644
index e983ec7c4e9..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v78/AddIndexToOrgQProfileParentUuid.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v78;
-
-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.CreateIndexBuilder;
-import org.sonar.server.platform.db.migration.step.DdlChange;
-
-import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder;
-
-@SupportsBlueGreen
-public class AddIndexToOrgQProfileParentUuid extends DdlChange {
-
- public AddIndexToOrgQProfileParentUuid(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute(new CreateIndexBuilder()
- .addColumn(newVarcharColumnDefBuilder()
- .setColumnName("parent_uuid")
- .setLimit(255)
- .setIsNullable(true)
- .setIgnoreOracleUnit(true)
- .build())
- .setUnique(false)
- .setTable("org_qprofiles")
- .setName("org_qprofiles_parent_uuid")
- .build());
- }
-
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v78/AddSecurityFieldsToElasticsearchIndices.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v78/AddSecurityFieldsToElasticsearchIndices.java
deleted file mode 100644
index 11ae80f5322..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v78/AddSecurityFieldsToElasticsearchIndices.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v78;
-
-import com.google.common.collect.ImmutableMap;
-import java.sql.SQLException;
-import java.util.Map;
-import org.sonar.db.Database;
-import org.sonar.server.platform.db.migration.SupportsBlueGreen;
-import org.sonar.server.platform.db.migration.es.MigrationEsClient;
-import org.sonar.server.platform.db.migration.step.DdlChange;
-
-@SupportsBlueGreen
-public class AddSecurityFieldsToElasticsearchIndices extends DdlChange {
-
- private static final String ISSUE_INDEX = "issues";
- private static final String RULE_INDEX = "rules";
- private static final String KEYWORD_TYPE = "keyword";
-
- private final MigrationEsClient migrationEsClient;
-
- public AddSecurityFieldsToElasticsearchIndices(Database db, MigrationEsClient migrationEsClient) {
- super(db);
- this.migrationEsClient = migrationEsClient;
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- Map mappingOptions = ImmutableMap.of("norms", "false");
-
- migrationEsClient.addMappingToExistingIndex(ISSUE_INDEX, "auth", "sonarsourceSecurity", KEYWORD_TYPE, mappingOptions);
- migrationEsClient.addMappingToExistingIndex(RULE_INDEX, "rule", "cwe", KEYWORD_TYPE, mappingOptions);
- migrationEsClient.addMappingToExistingIndex(RULE_INDEX, "rule", "owaspTop10", KEYWORD_TYPE, mappingOptions);
- migrationEsClient.addMappingToExistingIndex(RULE_INDEX, "rule", "sansTop25", KEYWORD_TYPE, mappingOptions);
- migrationEsClient.addMappingToExistingIndex(RULE_INDEX, "rule", "sonarsourceSecurity", KEYWORD_TYPE, mappingOptions);
- }
-
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v78/AddSnapshotRevision.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v78/AddSnapshotRevision.java
deleted file mode 100644
index bf04798289d..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v78/AddSnapshotRevision.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v78;
-
-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.VarcharColumnDef.newVarcharColumnDefBuilder;
-
-@SupportsBlueGreen
-public class AddSnapshotRevision extends DdlChange {
-
- public AddSnapshotRevision(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute(new AddColumnsBuilder(getDialect(), "snapshots")
- .addColumn(newVarcharColumnDefBuilder()
- .setColumnName("revision")
- .setIsNullable(true)
- .setLimit(100)
- .build())
- .build());
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v78/AddWebhooksSecret.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v78/AddWebhooksSecret.java
deleted file mode 100644
index 72b18c9c0a9..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v78/AddWebhooksSecret.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v78;
-
-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.VarcharColumnDef.newVarcharColumnDefBuilder;
-
-@SupportsBlueGreen
-public class AddWebhooksSecret extends DdlChange {
-
- public AddWebhooksSecret(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- context.execute(new AddColumnsBuilder(getDialect(), "webhooks")
- .addColumn(newVarcharColumnDefBuilder()
- .setColumnName("secret")
- .setIsNullable(true)
- .setLimit(200)
- .build())
- .build());
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v78/CreateInternalComponentPropertiesTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v78/CreateInternalComponentPropertiesTable.java
deleted file mode 100644
index bd2c70a069a..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v78/CreateInternalComponentPropertiesTable.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v78;
-
-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.SupportsBlueGreen;
-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.newVarcharColumnDefBuilder;
-
-@SupportsBlueGreen
-public class CreateInternalComponentPropertiesTable extends DdlChange {
-
- private static final String TABLE_NAME = "internal_component_props";
-
- private static final VarcharColumnDef UUID_COLUMN = newVarcharColumnDefBuilder()
- .setColumnName("uuid")
- .setIsNullable(false)
- .setLimit(VarcharColumnDef.UUID_SIZE)
- .build();
-
- private static final VarcharColumnDef COMPONENT_UUID_COLUMN = newVarcharColumnDefBuilder()
- .setColumnName("component_uuid")
- .setIsNullable(false)
- .setLimit(50)
- .build();
-
- private static final VarcharColumnDef KEE_COLUMN = newVarcharColumnDefBuilder()
- .setColumnName("kee")
- .setIsNullable(false)
- .setLimit(512)
- .build();
-
- private static final VarcharColumnDef VALUE_COLUMN = newVarcharColumnDefBuilder()
- .setColumnName("value")
- .setIsNullable(true)
- .setLimit(4000)
- .build();
-
- private static final BigIntegerColumnDef UPDATED_AT_COLUMN = newBigIntegerColumnDefBuilder()
- .setColumnName("updated_at")
- .setIsNullable(false)
- .build();
-
- private static final BigIntegerColumnDef CREATED_AT_COLUMN = newBigIntegerColumnDefBuilder()
- .setColumnName("created_at")
- .setIsNullable(false)
- .build();
-
- public CreateInternalComponentPropertiesTable(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- if (!tableExists()) {
- context.execute(new CreateTableBuilder(getDialect(), TABLE_NAME)
- .addPkColumn(UUID_COLUMN)
- .addColumn(COMPONENT_UUID_COLUMN)
- .addColumn(KEE_COLUMN)
- .addColumn(VALUE_COLUMN)
- .addColumn(UPDATED_AT_COLUMN)
- .addColumn(CREATED_AT_COLUMN)
- .build());
-
- context.execute(new CreateIndexBuilder()
- .addColumn(COMPONENT_UUID_COLUMN)
- .addColumn(KEE_COLUMN)
- .setUnique(true)
- .setTable(TABLE_NAME)
- .setName("unique_component_uuid_kee")
- .build());
- }
- }
-
- private boolean tableExists() throws SQLException {
- try (Connection connection = getDatabase().getDataSource().getConnection()) {
- return DatabaseUtils.tableExists(TABLE_NAME, connection);
- }
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v78/DbVersion78.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v78/DbVersion78.java
deleted file mode 100644
index 1910c2ea02b..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v78/DbVersion78.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v78;
-
-import org.sonar.server.platform.db.migration.step.MigrationStepRegistry;
-import org.sonar.server.platform.db.migration.version.DbVersion;
-
-public class DbVersion78 implements DbVersion {
-
- @Override
- public void addSteps(MigrationStepRegistry registry) {
- registry
- .add(2700, "Drop overall subscriptions on notifications about new and resolved issues", DeleteOverallSubscriptionsOnNewAndResolvedIssuesNotifications.class)
- .add(2701, "Add index to org_qprofile.parent_uuid", AddIndexToOrgQProfileParentUuid.class)
- .add(2702, "Add column webhooks.secret", AddWebhooksSecret.class)
- .add(2703, "Add security fields to Elasticsearch indices", AddSecurityFieldsToElasticsearchIndices.class)
- .add(2704, "Add InternalComponentProperties table", CreateInternalComponentPropertiesTable.class)
- .add(2705, "Add column snapshots.revision", AddSnapshotRevision.class)
- .add(2706, "Migrate revision from analysis_properties to snapshots.revision", MigrateRevision.class)
- .add(2707, "Update statuses of Security Hotspots", UpdateSecurityHotspotsStatuses.class)
- .add(2708, "Remove orphans from PROJECT_BRANCHES", RemoveOrphansFromProjectBranches.class);
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v78/DeleteOverallSubscriptionsOnNewAndResolvedIssuesNotifications.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v78/DeleteOverallSubscriptionsOnNewAndResolvedIssuesNotifications.java
deleted file mode 100644
index 4863cf66b6e..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v78/DeleteOverallSubscriptionsOnNewAndResolvedIssuesNotifications.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v78;
-
-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;
-import org.sonar.server.platform.db.migration.step.MassUpdate;
-
-@SupportsBlueGreen
-public class DeleteOverallSubscriptionsOnNewAndResolvedIssuesNotifications extends DataChange {
-
- public DeleteOverallSubscriptionsOnNewAndResolvedIssuesNotifications(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- MassUpdate massUpdate = context.prepareMassUpdate().rowPluralName("subscriptions");
- massUpdate.select("select id from properties " +
- "where resource_id is null " +
- "and (prop_key like 'notification.NewFalsePositiveIssue.%' or prop_key like 'notification.NewIssues.%')");
- massUpdate.update("delete from properties where id=?");
- massUpdate.execute((row, update) -> {
- long id = row.getLong(1);
- update.setLong(1, id);
- return true;
- });
- }
-
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v78/MigrateRevision.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v78/MigrateRevision.java
deleted file mode 100644
index 5959a6e4cca..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v78/MigrateRevision.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v78;
-
-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;
-import org.sonar.server.platform.db.migration.step.MassUpdate;
-
-@SupportsBlueGreen
-public class MigrateRevision extends DataChange {
- public MigrateRevision(Database db) {
- super(db);
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- MassUpdate massUpdate = context.prepareMassUpdate();
- massUpdate.select("select ap.snapshot_uuid, ap.text_value" +
- " from analysis_properties ap" +
- " where kee = 'sonar.analysis.scm_revision_id'");
- massUpdate.update("update snapshots set revision=? where uuid=?");
- massUpdate.rowPluralName("migrate revision from analysis_properties to snapshots");
- massUpdate.execute((row, update) -> {
- String snapshotUuid = row.getString(1);
- String revision = row.getString(2);
- update.setString(1, revision);
- update.setString(2, snapshotUuid);
- return true;
- });
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v78/RemoveOrphansFromProjectBranches.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v78/RemoveOrphansFromProjectBranches.java
deleted file mode 100644
index 97b97937ef5..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v78/RemoveOrphansFromProjectBranches.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v78;
-
-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;
-import org.sonar.server.platform.db.migration.step.MassUpdate;
-
-@SupportsBlueGreen
-public class RemoveOrphansFromProjectBranches extends DataChange {
- public RemoveOrphansFromProjectBranches(Database db) {
- super(db);
- }
-
- @Override
- protected void execute(Context context) throws SQLException {
- MassUpdate massUpdate = context.prepareMassUpdate();
- massUpdate.select("select pb.uuid from project_branches pb where not exists (select 1 from projects p where p.uuid = pb.uuid)");
- massUpdate.update("delete from project_branches where uuid=?");
- massUpdate.rowPluralName("orphans in table PROJECT_BRANCHES");
- massUpdate.execute((row, update) -> {
- String uuid = row.getString(1);
-
- update.setString(1, uuid);
- return true;
- });
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v78/UpdateSecurityHotspotsStatuses.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v78/UpdateSecurityHotspotsStatuses.java
deleted file mode 100644
index ca988261401..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v78/UpdateSecurityHotspotsStatuses.java
+++ /dev/null
@@ -1,242 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v78;
-
-import com.google.common.collect.Maps;
-import java.io.Serializable;
-import java.sql.SQLException;
-import java.util.Map;
-import java.util.Objects;
-import javax.annotation.CheckForNull;
-import javax.annotation.Nullable;
-import org.sonar.api.config.Configuration;
-import org.sonar.api.utils.System2;
-import org.sonar.core.util.UuidFactory;
-import org.sonar.db.Database;
-import org.sonar.server.platform.db.migration.SupportsBlueGreen;
-import org.sonar.server.platform.db.migration.es.MigrationEsClient;
-import org.sonar.server.platform.db.migration.step.DataChange;
-import org.sonar.server.platform.db.migration.step.MassUpdate;
-
-@SupportsBlueGreen
-public class UpdateSecurityHotspotsStatuses extends DataChange {
-
- private static final String RESOLUTION_FIXED = "FIXED";
- private static final String RESOLUTION_WONT_FIX = "WONTFIX";
-
- private static final String STATUS_OPEN = "OPEN";
- private static final String STATUS_REOPENED = "REOPENED";
- private static final String STATUS_RESOLVED = "RESOLVED";
-
- private static final String STATUS_TO_REVIEW = "TO_REVIEW";
- private static final String STATUS_IN_REVIEW = "IN_REVIEW";
- private static final String STATUS_REVIEWED = "REVIEWED";
-
- private static final int RULE_TYPE_SECURITY_HOTSPOT = 4;
-
- private final Configuration configuration;
- private final System2 system2;
- private final MigrationEsClient esClient;
- private final UuidFactory uuidFactory;
-
- public UpdateSecurityHotspotsStatuses(Database db, Configuration configuration, System2 system2, MigrationEsClient esClient, UuidFactory uuidFactory) {
- super(db);
- this.configuration = configuration;
- this.system2 = system2;
- this.esClient = esClient;
- this.uuidFactory = uuidFactory;
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- if (configuration.getBoolean("sonar.sonarcloud.enabled").orElse(false)) {
- return;
- }
- long now = system2.now();
- MassUpdate massUpdate = context.prepareMassUpdate().rowPluralName("security hotspots");
- massUpdate.select("select i.kee, i.status, i.resolution, i.issue_type from issues i " +
- "inner join rules r on r.id = i.rule_id and r.rule_type = ? " +
- "where (i.resolution is null or i.resolution in (?, ?)) and i.issue_type=? " +
- // Add status check for the re-entrance, in order to not reload already migrated issues
- "and i.status not in (?, ?, ?)")
- .setInt(1, RULE_TYPE_SECURITY_HOTSPOT)
- .setString(2, RESOLUTION_FIXED)
- .setString(3, RESOLUTION_WONT_FIX)
- .setInt(4, RULE_TYPE_SECURITY_HOTSPOT)
- .setString(5, STATUS_TO_REVIEW)
- .setString(6, STATUS_IN_REVIEW)
- .setString(7, STATUS_REVIEWED);
- massUpdate.update("update issues set status=?, resolution=?, updated_at=? where kee=? ");
- massUpdate.update("insert into issue_changes (kee, issue_key, change_type, change_data, created_at, updated_at, issue_change_creation_date) values (?, ?, 'diff', ?, ?, ?, ?)");
- massUpdate.execute((row, update, updateIndex) -> {
- String issueKey = row.getString(1);
- String status = row.getString(2);
- String resolution = row.getNullableString(3);
-
- IssueUpdate issueUpdate = new IssueUpdate(status, resolution);
- FieldDiffs fieldDiffs = issueUpdate.process();
- if (!issueUpdate.isUpdated()) {
- return false;
- }
- if (updateIndex == 0) {
- update.setString(1, issueUpdate.getNewStatus());
- update.setString(2, issueUpdate.getNewResolution());
- update.setLong(3, now);
- update.setString(4, issueKey);
- return true;
- } else {
- // No changelog on OPEN issue as there was no previous state
- if (!status.equals(STATUS_OPEN)) {
- update.setString(1, uuidFactory.create());
- update.setString(2, issueKey);
- update.setString(3, fieldDiffs.toEncodedString());
- update.setLong(4, now);
- update.setLong(5, now);
- update.setLong(6, now);
- return true;
- }
- return false;
- }
- });
- esClient.deleteIndexes("issues");
- }
-
- private static class IssueUpdate {
-
- private static final String RESOLUTION_FIELD = "resolution";
- private static final String STATUS_FIELD = "status";
-
- private final String status;
- private final String resolution;
-
- private String newStatus;
- private String newResolution;
- private boolean updated;
-
- IssueUpdate(String status, @CheckForNull String resolution) {
- this.status = status;
- this.resolution = resolution;
- }
-
- FieldDiffs process() {
- if ((status.equals(STATUS_OPEN) || (status.equals(STATUS_REOPENED))) && resolution == null) {
- newStatus = STATUS_TO_REVIEW;
- newResolution = null;
- updated = true;
- } else if (status.equals(STATUS_RESOLVED) && resolution != null) {
- if (resolution.equals(RESOLUTION_FIXED)) {
- newStatus = STATUS_IN_REVIEW;
- newResolution = null;
- updated = true;
- } else if (resolution.equals(RESOLUTION_WONT_FIX)) {
- newStatus = STATUS_REVIEWED;
- newResolution = RESOLUTION_FIXED;
- updated = true;
- }
- }
- FieldDiffs fieldDiffs = new FieldDiffs();
- fieldDiffs.setDiff(STATUS_FIELD, status, newStatus);
- fieldDiffs.setDiff(RESOLUTION_FIELD, resolution, newResolution);
- return fieldDiffs;
- }
-
- String getNewStatus() {
- return newStatus;
- }
-
- String getNewResolution() {
- return newResolution;
- }
-
- boolean isUpdated() {
- return updated;
- }
- }
-
- /**
- * Inspired and simplified from {@link org.sonar.core.issue.FieldDiffs}
- */
- static class FieldDiffs implements Serializable {
-
- private final Map diffs = Maps.newLinkedHashMap();
-
- void setDiff(String field, @Nullable String oldValue, @Nullable String newValue) {
- diffs.put(field, new Diff(oldValue, newValue));
- }
-
- String toEncodedString() {
- StringBuilder sb = new StringBuilder();
- boolean notFirst = false;
- for (Map.Entry entry : diffs.entrySet()) {
- if (notFirst) {
- sb.append(',');
- } else {
- notFirst = true;
- }
- sb.append(entry.getKey());
- sb.append('=');
- sb.append(entry.getValue().toEncodedString());
- }
- return sb.toString();
- }
-
- static class Diff implements Serializable {
- private String oldValue;
- private String newValue;
-
- Diff(@Nullable String oldValue, @Nullable String newValue) {
- this.oldValue = oldValue;
- this.newValue = newValue;
- }
-
- private String toEncodedString() {
- StringBuilder sb = new StringBuilder();
- if (oldValue != null) {
- sb.append(oldValue);
- sb.append('|');
- }
- if (newValue != null) {
- sb.append(newValue);
- }
- return sb.toString();
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) {
- return true;
- }
- if (o == null || getClass() != o.getClass()) {
- return false;
- }
- FieldDiffs.Diff diff = (FieldDiffs.Diff) o;
- return Objects.equals(oldValue, diff.oldValue) &&
- Objects.equals(newValue, diff.newValue);
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(oldValue, newValue);
- }
- }
-
- }
-
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v78/package-info.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v78/package-info.java
deleted file mode 100644
index b5b3035b9be..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v78/package-info.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public 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.v78;
-
-import javax.annotation.ParametersAreNonnullByDefault;
-
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v79/CreateInitialSchema.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v79/CreateInitialSchema.java
new file mode 100644
index 00000000000..b6e36d57228
--- /dev/null
+++ b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v79/CreateInitialSchema.java
@@ -0,0 +1,1375 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2019 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package org.sonar.server.platform.db.migration.version.v79;
+
+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.ColumnDef;
+import org.sonar.server.platform.db.migration.def.IntegerColumnDef;
+import org.sonar.server.platform.db.migration.def.TinyIntColumnDef;
+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.BlobColumnDef.newBlobColumnDefBuilder;
+import static org.sonar.server.platform.db.migration.def.BooleanColumnDef.newBooleanColumnDefBuilder;
+import static org.sonar.server.platform.db.migration.def.ClobColumnDef.newClobColumnDefBuilder;
+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.TimestampColumnDef.newTimestampColumnDefBuilder;
+import static org.sonar.server.platform.db.migration.def.TinyIntColumnDef.newTinyIntColumnDefBuilder;
+import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.MAX_SIZE;
+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;
+import static org.sonar.server.platform.db.migration.sql.CreateTableBuilder.ColumnFlag.AUTO_INCREMENT;
+
+public class CreateInitialSchema extends DdlChange {
+
+ public CreateInitialSchema(Database db) {
+ super(db);
+ }
+
+ @Override
+ public void execute(Context context) throws SQLException {
+ createActiveRuleParameters(context);
+ createActiveRules(context);
+ createAlmAppInstalls(context);
+ createAnalysisProperties(context);
+ createCeActivity(context);
+ createCeQueue(context);
+ createCeScannerContext(context);
+ createCeTaskCharacteristics(context);
+ createCeTaskInput(context);
+ createCeTaskMessage(context);
+ createDefaultQProfiles(context);
+ createDeprecatedRuleKeys(context);
+ createDuplicationsIndex(context);
+ createEsQueue(context);
+ createEventComponentChanges(context);
+ createEvents(context);
+ createFileSources(context);
+ createGroupRoles(context);
+ createGroups(context);
+ createGroupsUsers(context);
+ createInternalComponentProps(context);
+ createInternalProperties(context);
+ createIssueChanges(context);
+ createIssues(context);
+ createLiveMeasures(context);
+ createManualMeasures(context);
+ createMetrics(context);
+ createNotifications(context);
+ createOrgQProfiles(context);
+ createOrgQualityGates(context);
+ createOrganizationAlmBindings(context);
+ createOrganizationMembers(context);
+ createOrganizations(context);
+ createPermTemplatesGroups(context);
+ createPermTemplatesUsers(context);
+ createPermTemplatesCharacteristics(context);
+ createPermissionTemplates(context);
+ createPlugins(context);
+ createProjectAlmBindings(context);
+ createProjectBranches(context);
+ createProjectLinks(context);
+ createProjectMappings(context);
+ createProjectMeasures(context);
+ createProjectQprofiles(context);
+ createProjects(context);
+ createProperties(context);
+ createQProfileChanges(context);
+ createQProfileEditGroups(context);
+ createQProfileEditUsers(context);
+ createQualityGateConditions(context);
+ createQualityGates(context);
+ createRulesRepository(context);
+ createRules(context);
+ createRulesMetadata(context);
+ createRulesParameters(context);
+ createRulesProfiles(context);
+ createSnapshots(context);
+ createUserProperties(context);
+ createUserRoles(context);
+ createUserTokens(context);
+ createUsers(context);
+ createWebhookDeliveries(context);
+ createWebhooks(context);
+ }
+
+ private void createActiveRuleParameters(Context context) {
+ String tableName = "active_rule_parameters";
+ IntegerColumnDef activeRuleIdColumnDef = newIntegerColumnDefBuilder().setColumnName("active_rule_id").setIsNullable(false).build();
+ context.execute(
+ newTableBuilder(tableName)
+ .addPkColumn(newIntegerColumnDefBuilder().setColumnName("id").setIsNullable(false).build(), AUTO_INCREMENT)
+ .addColumn(activeRuleIdColumnDef)
+ .addColumn(newIntegerColumnDefBuilder().setColumnName("rules_parameter_id").setIsNullable(false).build())
+ .addColumn(newLenientVarcharBuilder("value").setLimit(MAX_SIZE).build())
+ .addColumn(newLenientVarcharBuilder("rules_parameter_key").setLimit(128).build())
+ .build());
+ addIndex(context, tableName, "ix_arp_on_active_rule_id", false, activeRuleIdColumnDef);
+ }
+
+ private void createActiveRules(Context context) {
+ IntegerColumnDef profileIdCol = newIntegerColumnDefBuilder().setColumnName("profile_id").setIsNullable(false).build();
+ IntegerColumnDef ruleIdCol = newIntegerColumnDefBuilder().setColumnName("rule_id").setIsNullable(false).build();
+ context.execute(
+ newTableBuilder("active_rules")
+ .addPkColumn(newIntegerColumnDefBuilder().setColumnName("id").setIsNullable(false).build(), AUTO_INCREMENT)
+ .addColumn(profileIdCol)
+ .addColumn(ruleIdCol)
+ .addColumn(newIntegerColumnDefBuilder().setColumnName("failure_level").setIsNullable(false).build())
+ .addColumn(newLenientVarcharBuilder("inheritance").setLimit(10).build())
+ .addColumn(newBigIntegerColumnDefBuilder().setColumnName("created_at").build())
+ .addColumn(newBigIntegerColumnDefBuilder().setColumnName("updated_at").build())
+ .build());
+ addIndex(context, "active_rules", "uniq_profile_rule_ids", true, profileIdCol, ruleIdCol);
+ }
+
+ private void createAlmAppInstalls(Context context) {
+ String tableName = "alm_app_installs";
+ VarcharColumnDef almIdCol = newVarcharColumnBuilder("alm_id").setIsNullable(false).setLimit(UUID_SIZE).build();
+ VarcharColumnDef ownerCol = newVarcharColumnBuilder("owner_id").setIsNullable(false).setLimit(MAX_SIZE).build();
+ VarcharColumnDef installCol = newVarcharColumnBuilder("install_id").setIsNullable(false).setLimit(MAX_SIZE).build();
+ VarcharColumnDef userExternalIdCol = newVarcharColumnBuilder("user_external_id").setLimit(255).setIsNullable(true).build();
+ context.execute(newTableBuilder(tableName)
+ .addPkColumn(newVarcharColumnBuilder("uuid").setLimit(UUID_SIZE).setIsNullable(false).build())
+ .addColumn(almIdCol)
+ .addColumn(ownerCol)
+ .addColumn(installCol)
+ .addColumn(newBooleanColumnDefBuilder().setColumnName("is_owner_user").setIsNullable(false).build())
+ .addColumn(userExternalIdCol)
+ .addColumn(newBigIntegerColumnDefBuilder().setColumnName("created_at").setIsNullable(false).build())
+ .addColumn(newBigIntegerColumnDefBuilder().setColumnName("updated_at").setIsNullable(false).build())
+ .build());
+ addIndex(context, tableName, "alm_app_installs_owner", true, almIdCol, ownerCol);
+ addIndex(context, tableName, "alm_app_installs_install", true, almIdCol, installCol);
+ addIndex(context, tableName, "alm_app_installs_external_id", false, userExternalIdCol);
+ }
+
+ private void createAnalysisProperties(Context context) {
+ String tableName = "analysis_properties";
+ VarcharColumnDef snapshotUuidColumn = newVarcharColumnBuilder("snapshot_uuid")
+ .setIsNullable(false)
+ .setLimit(UUID_SIZE)
+ .build();
+ context.execute(
+ newTableBuilder(tableName)
+ .addPkColumn(newVarcharColumnBuilder("uuid").setIsNullable(false).setLimit(UUID_SIZE).build())
+ .addColumn(snapshotUuidColumn)
+ .addColumn(newVarcharColumnBuilder("kee").setIsNullable(false).setLimit(512).build())
+ .addColumn(newVarcharColumnBuilder("text_value").setIsNullable(true).setLimit(MAX_SIZE).build())
+ .addColumn(newClobColumnDefBuilder().setColumnName("clob_value").setIsNullable(true).build())
+ .addColumn(newBooleanColumnDefBuilder().setColumnName("is_empty").setIsNullable(false).build())
+ .addColumn(newBigIntegerColumnDefBuilder().setColumnName("created_at").setIsNullable(false).build())
+ .build());
+ addIndex(context, tableName, "ix_snapshot_uuid", false, snapshotUuidColumn);
+ }
+
+ private void createCeActivity(Context context) {
+ String tableName = "ce_activity";
+ VarcharColumnDef uuidCol = newLenientVarcharBuilder("uuid").setLimit(UUID_SIZE).setIsNullable(false).build();
+ VarcharColumnDef mainComponentUuidCol = newVarcharColumnBuilder("main_component_uuid").setLimit(UUID_SIZE).setIsNullable(true).build();
+ VarcharColumnDef componentUuidCol = newVarcharColumnBuilder("component_uuid").setLimit(UUID_SIZE).setIsNullable(true).build();
+ VarcharColumnDef statusCol = newLenientVarcharBuilder("status").setLimit(15).setIsNullable(false).build();
+ BooleanColumnDef isLastCol = newBooleanColumnDefBuilder().setColumnName("is_last").setIsNullable(false).build();
+ VarcharColumnDef isLastKeyCol = newLenientVarcharBuilder("is_last_key").setLimit(55).setIsNullable(false).build();
+ BooleanColumnDef mainIsLastCol = newBooleanColumnDefBuilder().setColumnName("main_is_last").setIsNullable(false).build();
+ VarcharColumnDef mainIsLastKeyCol = newLenientVarcharBuilder("main_is_last_key").setLimit(55).setIsNullable(false).build();
+ context.execute(
+ newTableBuilder(tableName)
+ .addPkColumn(newIntegerColumnDefBuilder().setColumnName("id").setIsNullable(false).build(), AUTO_INCREMENT)
+ .addColumn(uuidCol)
+ .addColumn(newLenientVarcharBuilder("task_type").setLimit(15).setIsNullable(false).build())
+ .addColumn(mainComponentUuidCol)
+ .addColumn(componentUuidCol)
+ .addColumn(statusCol)
+ .addColumn(mainIsLastCol)
+ .addColumn(mainIsLastKeyCol)
+ .addColumn(isLastCol)
+ .addColumn(isLastKeyCol)
+ .addColumn(newLenientVarcharBuilder("submitter_uuid").setLimit(255).setIsNullable(true).build())
+ .addColumn(newBigIntegerColumnDefBuilder().setColumnName("submitted_at").setIsNullable(false).build())
+ .addColumn(newBigIntegerColumnDefBuilder().setColumnName("started_at").setIsNullable(true).build())
+ .addColumn(newBigIntegerColumnDefBuilder().setColumnName("executed_at").setIsNullable(true).build())
+ .addColumn(newIntegerColumnDefBuilder().setColumnName("execution_count").setIsNullable(false).build())
+ .addColumn(newBigIntegerColumnDefBuilder().setColumnName("execution_time_ms").setIsNullable(true).build())
+ .addColumn(newLenientVarcharBuilder("analysis_uuid").setLimit(UUID_VARCHAR_SIZE).setIsNullable(true).build())
+ .addColumn(newLenientVarcharBuilder("error_message").setLimit(1_000).setIsNullable(true).build())
+ .addColumn(newClobColumnDefBuilder().setColumnName("error_stacktrace").setIsNullable(true).build())
+ .addColumn(newVarcharColumnBuilder("error_type").setLimit(20).setIsNullable(true).build())
+ .addColumn(newVarcharColumnBuilder("worker_uuid").setLimit(UUID_SIZE).setIsNullable(true).build())
+ .addColumn(newBigIntegerColumnDefBuilder().setColumnName("created_at").setIsNullable(false).build())
+ .addColumn(newBigIntegerColumnDefBuilder().setColumnName("updated_at").setIsNullable(false).build())
+ .build());
+ addIndex(context, tableName, "ce_activity_component", false, componentUuidCol);
+ addIndex(context, tableName, "ce_activity_islast", false, isLastCol, statusCol);
+ addIndex(context, tableName, "ce_activity_islast_key", false, isLastKeyCol);
+ addIndex(context, tableName, "ce_activity_main_component", false, mainComponentUuidCol);
+ addIndex(context, tableName, "ce_activity_main_islast", false, mainIsLastCol, statusCol);
+ addIndex(context, tableName, "ce_activity_main_islast_key", false, mainIsLastKeyCol);
+ addIndex(context, tableName, "ce_activity_uuid", true, uuidCol);
+ }
+
+ private void createCeQueue(Context context) {
+ String tableName = "ce_queue";
+ VarcharColumnDef uuidCol = newLenientVarcharBuilder("uuid").setLimit(UUID_SIZE).setIsNullable(false).build();
+ VarcharColumnDef mainComponentUuidCol = newLenientVarcharBuilder("main_component_uuid").setLimit(UUID_SIZE).setIsNullable(true).build();
+ VarcharColumnDef componentUuidCol = newLenientVarcharBuilder("component_uuid").setLimit(UUID_SIZE).setIsNullable(true).build();
+ context.execute(
+ newTableBuilder(tableName)
+ .addPkColumn(newIntegerColumnDefBuilder().setColumnName("id").setIsNullable(false).build(), AUTO_INCREMENT)
+ .addColumn(uuidCol)
+ .addColumn(newLenientVarcharBuilder("task_type").setLimit(15).setIsNullable(false).build())
+ .addColumn(mainComponentUuidCol)
+ .addColumn(componentUuidCol)
+ .addColumn(newLenientVarcharBuilder("status").setLimit(15).setIsNullable(true).build())
+ .addColumn(newLenientVarcharBuilder("submitter_uuid").setLimit(255).setIsNullable(true).build())
+ .addColumn(newBigIntegerColumnDefBuilder().setColumnName("started_at").setIsNullable(true).build())
+ .addColumn(newVarcharColumnBuilder("worker_uuid").setLimit(UUID_SIZE).setIsNullable(true).build())
+ .addColumn(newIntegerColumnDefBuilder().setColumnName("execution_count").setIsNullable(false).build())
+ .addColumn(newBigIntegerColumnDefBuilder().setColumnName("created_at").setIsNullable(false).build())
+ .addColumn(newBigIntegerColumnDefBuilder().setColumnName("updated_at").setIsNullable(false).build())
+ .build());
+ addIndex(context, tableName, "ce_queue_main_component", false, mainComponentUuidCol);
+ addIndex(context, tableName, "ce_queue_component", false, componentUuidCol);
+ addIndex(context, tableName, "ce_queue_uuid", true, uuidCol);
+ }
+
+ private void createCeScannerContext(Context context) {
+ context.execute(
+ newTableBuilder("ce_scanner_context")
+ .addPkColumn(newLenientVarcharBuilder("task_uuid").setLimit(UUID_SIZE).setIsNullable(false).build())
+ .addColumn(newBlobColumnDefBuilder().setColumnName("context_data").setIsNullable(false).build())
+ .addColumn(newBigIntegerColumnDefBuilder().setColumnName("created_at").setIsNullable(false).build())
+ .addColumn(newBigIntegerColumnDefBuilder().setColumnName("updated_at").setIsNullable(false).build())
+ .build());
+ }
+
+ private void createCeTaskCharacteristics(Context context) {
+ String tableName = "ce_task_characteristics";
+ VarcharColumnDef ceTaskUuidColumn = newLenientVarcharBuilder("task_uuid")
+ .setLimit(UUID_SIZE)
+ .setIsNullable(false)
+ .build();
+
+ context.execute(
+ newTableBuilder(tableName)
+ .addPkColumn(newLenientVarcharBuilder("uuid").setLimit(UUID_SIZE).setIsNullable(false).build())
+ .addColumn(ceTaskUuidColumn)
+ .addColumn(newLenientVarcharBuilder("kee").setLimit(512).setIsNullable(false).build())
+ .addColumn(newLenientVarcharBuilder("text_value").setLimit(512).setIsNullable(true).build())
+ .build());
+ addIndex(context, tableName, "ce_characteristics_" + ceTaskUuidColumn.getName(), false, ceTaskUuidColumn);
+ }
+
+ private void createCeTaskInput(Context context) {
+ context.execute(
+ newTableBuilder("ce_task_input")
+ .addPkColumn(newLenientVarcharBuilder("task_uuid").setLimit(UUID_SIZE).setIsNullable(false).build())
+ .addColumn(newBlobColumnDefBuilder().setColumnName("input_data").setIsNullable(true).build())
+ .addColumn(newBigIntegerColumnDefBuilder().setColumnName("created_at").setIsNullable(false).build())
+ .addColumn(newBigIntegerColumnDefBuilder().setColumnName("updated_at").setIsNullable(false).build())
+ .build());
+ }
+
+ private void createCeTaskMessage(Context context) {
+ String tableName = "ce_task_message";
+ VarcharColumnDef taskUuidCol = newVarcharColumnBuilder("task_uuid").setIsNullable(false).setLimit(UUID_SIZE).build();
+ context.execute(newTableBuilder(tableName)
+ .addPkColumn(newVarcharColumnBuilder("uuid").setIsNullable(false).setLimit(UUID_SIZE).build())
+ .addColumn(taskUuidCol)
+ .addColumn(newVarcharColumnBuilder("message").setIsNullable(false).setLimit(MAX_SIZE).build())
+ .addColumn(newBigIntegerColumnDefBuilder().setColumnName("created_at").setIsNullable(false).build())
+ .build());
+ addIndex(context, tableName, tableName + "_task", false, taskUuidCol);
+ }
+
+ private void createDefaultQProfiles(Context context) {
+ String tableName = "default_qprofiles";
+ VarcharColumnDef profileUuidColumn = newLenientVarcharBuilder("qprofile_uuid")
+ .setLimit(255)
+ .setIsNullable(false)
+ .build();
+
+ context.execute(
+ newTableBuilder(tableName)
+ .addPkColumn(newLenientVarcharBuilder("organization_uuid").setLimit(UUID_SIZE).setIsNullable(false).build())
+ .addPkColumn(newLenientVarcharBuilder("language").setLimit(20).setIsNullable(false).build())
+ .addColumn(profileUuidColumn)
+ .addColumn(newBigIntegerColumnDefBuilder().setColumnName("created_at").setIsNullable(false).build())
+ .addColumn(newBigIntegerColumnDefBuilder().setColumnName("updated_at").setIsNullable(false).build())
+ .build());
+ addIndex(context, tableName, "uniq_default_qprofiles_uuid", true, profileUuidColumn);
+ }
+
+ private void createDeprecatedRuleKeys(Context context) {
+ String tableName = "deprecated_rule_keys";
+ IntegerColumnDef ruleIdCol = newIntegerColumnDefBuilder().setColumnName("rule_id").setIsNullable(false).build();
+ VarcharColumnDef oldRepositoryKeyCol = newVarcharColumnBuilder("old_repository_key").setIsNullable(false).setLimit(255).build();
+ VarcharColumnDef oldRuleKeyCol = newVarcharColumnBuilder("old_rule_key").setIsNullable(false).setLimit(200).build();
+ context.execute(newTableBuilder(tableName)
+ .addPkColumn(newVarcharColumnBuilder("uuid").setIsNullable(false).setLimit(UUID_SIZE).build())
+ .addColumn(ruleIdCol)
+ .addColumn(oldRepositoryKeyCol)
+ .addColumn(oldRuleKeyCol)
+ .addColumn(newBigIntegerColumnDefBuilder().setColumnName("created_at").setIsNullable(false).build())
+ .build());
+ addIndex(context, tableName, "uniq_deprecated_rule_keys", true, oldRepositoryKeyCol, oldRuleKeyCol);
+ addIndex(context, tableName, "rule_id_deprecated_rule_keys", true, ruleIdCol);
+ }
+
+ private void createDuplicationsIndex(Context context) {
+ String tableName = "duplications_index";
+ VarcharColumnDef hashCol = newLenientVarcharBuilder("hash").setLimit(50).setIsNullable(false).build();
+ VarcharColumnDef analysisUuidCol = newLenientVarcharBuilder("analysis_uuid").setLimit(UUID_VARCHAR_SIZE).setIsNullable(false).build();
+ VarcharColumnDef componentUuidCol = newLenientVarcharBuilder("component_uuid").setLimit(UUID_VARCHAR_SIZE).setIsNullable(false).build();
+ context.execute(
+ newTableBuilder(tableName)
+ .addPkColumn(newBigIntegerColumnDefBuilder().setColumnName("id").setIsNullable(false).build(), AUTO_INCREMENT)
+ .addColumn(analysisUuidCol)
+ .addColumn(componentUuidCol)
+ .addColumn(hashCol)
+ .addColumn(newIntegerColumnDefBuilder().setColumnName("index_in_file").setIsNullable(false).build())
+ .addColumn(newIntegerColumnDefBuilder().setColumnName("start_line").setIsNullable(false).build())
+ .addColumn(newIntegerColumnDefBuilder().setColumnName("end_line").setIsNullable(false).build())
+ .build());
+
+ addIndex(context, tableName, "duplications_index_hash", false, hashCol);
+ addIndex(context, tableName, "duplication_analysis_component", false, analysisUuidCol, componentUuidCol);
+ }
+
+ private void createEsQueue(Context context) {
+ String tableName = "es_queue";
+ BigIntegerColumnDef createdAtCol = newBigIntegerColumnDefBuilder().setColumnName("created_at").setIsNullable(false).build();
+ context.execute(
+ newTableBuilder(tableName)
+ .addPkColumn(newVarcharColumnBuilder("uuid").setIsNullable(false).setLimit(UUID_SIZE).build())
+ .addColumn(newVarcharColumnBuilder("doc_type").setIsNullable(false).setLimit(40).build())
+ .addColumn(newVarcharColumnBuilder("doc_id").setIsNullable(false).setLimit(MAX_SIZE).build())
+ .addColumn(newVarcharColumnBuilder("doc_id_type").setIsNullable(true).setLimit(20).build())
+ .addColumn(newVarcharColumnBuilder("doc_routing").setIsNullable(true).setLimit(MAX_SIZE).build())
+ .addColumn(createdAtCol)
+ .build());
+ addIndex(context, tableName, "es_queue_created_at", false, createdAtCol);
+ }
+
+ private void createEventComponentChanges(Context context) {
+ String tableName = "event_component_changes";
+ VarcharColumnDef eventUuidCol = newVarcharColumnBuilder("event_uuid").setIsNullable(false).setLimit(UUID_SIZE).build();
+ VarcharColumnDef eventComponentUuidCol = newVarcharColumnBuilder("event_component_uuid").setIsNullable(false).setLimit(UUID_VARCHAR_SIZE).build();
+ VarcharColumnDef eventAnalysisUuidCol = newVarcharColumnBuilder("event_analysis_uuid").setIsNullable(false).setLimit(UUID_VARCHAR_SIZE).build();
+ VarcharColumnDef changeCategoryCol = newVarcharColumnBuilder("change_category").setIsNullable(false).setLimit(12).build();
+ VarcharColumnDef componentUuidCol = newVarcharColumnBuilder("component_uuid").setIsNullable(false).setLimit(UUID_VARCHAR_SIZE).build();
+ context.execute(newTableBuilder(tableName)
+ .addPkColumn(newVarcharColumnBuilder("uuid").setIsNullable(false).setLimit(UUID_SIZE).build())
+ .addColumn(eventUuidCol)
+ .addColumn(eventComponentUuidCol)
+ .addColumn(eventAnalysisUuidCol)
+ .addColumn(changeCategoryCol)
+ .addColumn(componentUuidCol)
+ .addColumn(newVarcharColumnBuilder("component_key").setIsNullable(false).setLimit(400).build())
+ .addColumn(newVarcharColumnBuilder("component_name").setIsNullable(false).setLimit(2000).build())
+ .addColumn(newVarcharColumnBuilder("component_branch_key").setIsNullable(true).setLimit(255).build())
+ .addColumn(newBigIntegerColumnDefBuilder().setColumnName("created_at").setIsNullable(false).build())
+ .build());
+ addIndex(context, tableName, tableName + "_unique", true, eventUuidCol, changeCategoryCol, componentUuidCol);
+ addIndex(context, tableName, "event_cpnt_changes_cpnt", false, eventComponentUuidCol);
+ addIndex(context, tableName, "event_cpnt_changes_analysis", false, eventAnalysisUuidCol);
+ }
+
+ private void createEvents(Context context) {
+ String tableName = "events";
+ VarcharColumnDef uuidCol = newVarcharColumnBuilder("uuid").setLimit(UUID_SIZE).setIsNullable(false).build();
+ VarcharColumnDef analysisUuidCol = newLenientVarcharBuilder("analysis_uuid").setLimit(UUID_VARCHAR_SIZE).setIsNullable(false).build();
+ VarcharColumnDef componentUuid = newLenientVarcharBuilder("component_uuid").setLimit(UUID_VARCHAR_SIZE).setIsNullable(false).build();
+ context.execute(
+ newTableBuilder(tableName)
+ .addPkColumn(newIntegerColumnDefBuilder().setColumnName("id").setIsNullable(false).build(), AUTO_INCREMENT)
+ .addColumn(uuidCol)
+ .addColumn(analysisUuidCol)
+ .addColumn(newLenientVarcharBuilder("name").setLimit(400).setIsNullable(true).build())
+ .addColumn(newLenientVarcharBuilder("category").setLimit(50).build())
+ .addColumn(newLenientVarcharBuilder("description").setLimit(MAX_SIZE).build())
+ .addColumn(newLenientVarcharBuilder("event_data").setLimit(MAX_SIZE).build())
+ .addColumn(newBigIntegerColumnDefBuilder().setColumnName("event_date").setIsNullable(false).build())
+ .addColumn(newBigIntegerColumnDefBuilder().setColumnName("created_at").setIsNullable(false).build())
+ .addColumn(componentUuid)
+ .build());
+ addIndex(context, tableName, "events_uuid", true, uuidCol);
+ addIndex(context, tableName, "events_analysis", false, analysisUuidCol);
+ addIndex(context, tableName, "events_component_uuid", false, componentUuid);
+ }
+
+ private void createFileSources(Context context) {
+ String tableName = "file_sources";
+ VarcharColumnDef projectUuidCol = newLenientVarcharBuilder("project_uuid").setLimit(UUID_VARCHAR_SIZE).setIsNullable(false).build();
+ BigIntegerColumnDef updatedAtCol = newBigIntegerColumnDefBuilder().setColumnName("updated_at").setIsNullable(false).build();
+ VarcharColumnDef fileUuidCol = newLenientVarcharBuilder("file_uuid").setLimit(UUID_VARCHAR_SIZE).setIsNullable(false).build();
+ context.execute(
+ newTableBuilder(tableName)
+ .addPkColumn(newIntegerColumnDefBuilder().setColumnName("id").setIsNullable(false).build(), AUTO_INCREMENT)
+ .addColumn(projectUuidCol)
+ .addColumn(fileUuidCol)
+ .addColumn(newClobColumnDefBuilder().setColumnName("line_hashes").setIsNullable(true).build())
+ .addColumn(newIntegerColumnDefBuilder().setColumnName("line_hashes_version").setIsNullable(true).build())
+ .addColumn(newLenientVarcharBuilder("data_hash").setLimit(50).setIsNullable(true).build())
+ .addColumn(newLenientVarcharBuilder("src_hash").setLimit(50).setIsNullable(true).build())
+ .addColumn(newLenientVarcharBuilder("revision").setLimit(100).setIsNullable(true).build())
+ .addColumn(newIntegerColumnDefBuilder().setColumnName("line_count").setIsNullable(false).build())
+ .addColumn(newBlobColumnDefBuilder().setColumnName("binary_data").setIsNullable(true).build())
+ .addColumn(newBigIntegerColumnDefBuilder().setColumnName("created_at").setIsNullable(false).build())
+ .addColumn(updatedAtCol)
+ .build());
+ addIndex(context, tableName, "file_sources_file_uuid", true, fileUuidCol);
+ addIndex(context, tableName, "file_sources_project_uuid", false, projectUuidCol);
+ addIndex(context, tableName, "file_sources_updated_at", false, updatedAtCol);
+ }
+
+ private void createGroupRoles(Context context) {
+ String tableName = "group_roles";
+ IntegerColumnDef groupIdCol = newIntegerColumnDefBuilder().setColumnName("group_id").setIsNullable(true).build();
+ IntegerColumnDef resourceIdCol = newIntegerColumnDefBuilder().setColumnName("resource_id").setIsNullable(true).build();
+ VarcharColumnDef roleCol = newLenientVarcharBuilder("role").setLimit(64).setIsNullable(false).build();
+ VarcharColumnDef organizationUuidCol = newLenientVarcharBuilder("organization_uuid").setIsNullable(false).setLimit(UUID_SIZE).build();
+ context.execute(
+ newTableBuilder(tableName)
+ .addPkColumn(newIntegerColumnDefBuilder().setColumnName("id").setIsNullable(false).build(), AUTO_INCREMENT)
+ .addColumn(organizationUuidCol)
+ .addColumn(groupIdCol)
+ .addColumn(resourceIdCol)
+ .addColumn(roleCol)
+ .build());
+ addIndex(context, tableName, "uniq_group_roles", true, organizationUuidCol, groupIdCol, resourceIdCol, roleCol);
+ addIndex(context, tableName, "group_roles_resource", false, resourceIdCol);
+ }
+
+ private void createGroups(Context context) {
+ context.execute(
+ newTableBuilder("groups")
+ .addPkColumn(newIntegerColumnDefBuilder().setColumnName("id").setIsNullable(false).build(), AUTO_INCREMENT)
+ .addColumn(newLenientVarcharBuilder("organization_uuid").setIsNullable(false).setLimit(UUID_SIZE).build())
+ .addColumn(newLenientVarcharBuilder("name").setLimit(500).setIsNullable(true).build())
+ .addColumn(newLenientVarcharBuilder("description").setLimit(200).setIsNullable(true).build())
+ .addColumn(newTimestampColumnDefBuilder().setColumnName("created_at").setIsNullable(true).build())
+ .addColumn(newTimestampColumnDefBuilder().setColumnName("updated_at").setIsNullable(true).build())
+ .build());
+ }
+
+ private void createGroupsUsers(Context context) {
+ String tableName = "groups_users";
+ BigIntegerColumnDef userIdCol = newBigIntegerColumnDefBuilder().setColumnName("user_id").setIsNullable(true).build();
+ BigIntegerColumnDef groupIdCol = newBigIntegerColumnDefBuilder().setColumnName("group_id").setIsNullable(true).build();
+ context.execute(
+ newTableBuilder(tableName)
+ .addColumn(userIdCol)
+ .addColumn(groupIdCol)
+ .build());
+ addIndex(context, tableName, "index_groups_users_on_user_id", false, userIdCol);
+ addIndex(context, tableName, "index_groups_users_on_group_id", false, groupIdCol);
+ addIndex(context, tableName, "groups_users_unique", true, groupIdCol, userIdCol);
+ }
+
+ private void createInternalComponentProps(Context context) {
+ String tableName = "internal_component_props";
+ VarcharColumnDef componentUuidCol = newVarcharColumnBuilder("component_uuid").setIsNullable(false).setLimit(UUID_VARCHAR_SIZE).build();
+ VarcharColumnDef keeCol = newVarcharColumnBuilder("kee").setIsNullable(false).setLimit(512).build();
+ context.execute(newTableBuilder(tableName)
+ .addPkColumn(newVarcharColumnBuilder("uuid").setIsNullable(false).setLimit(UUID_SIZE).build())
+ .addColumn(componentUuidCol)
+ .addColumn(keeCol)
+ .addColumn(newVarcharColumnBuilder("value").setIsNullable(true).setLimit(MAX_SIZE).build())
+ .addColumn(newBigIntegerColumnDefBuilder().setColumnName("updated_at").setIsNullable(false).build())
+ .addColumn(newBigIntegerColumnDefBuilder().setColumnName("created_at").setIsNullable(false).build())
+ .build());
+ addIndex(context, tableName, "unique_component_uuid_kee", true, componentUuidCol, keeCol);
+ }
+
+ private void createInternalProperties(Context context) {
+ context.execute(
+ newTableBuilder("internal_properties")
+ .addPkColumn(newLenientVarcharBuilder("kee").setLimit(20).setIsNullable(false).build())
+ .addColumn(newBooleanColumnDefBuilder().setColumnName("is_empty").setIsNullable(false).build())
+ .addColumn(newVarcharColumnDefBuilder().setColumnName("text_value").setLimit(MAX_SIZE).setIgnoreOracleUnit(true).build())
+ .addColumn(newClobColumnDefBuilder().setColumnName("clob_value").setIsNullable(true).build())
+ .addColumn(newBigIntegerColumnDefBuilder().setColumnName("created_at").setIsNullable(false).build())
+ .build());
+ }
+
+ private void createIssueChanges(Context context) {
+ String tableName = "issue_changes";
+ VarcharColumnDef issueKeyCol = newLenientVarcharBuilder("issue_key").setLimit(50).setIsNullable(false).build();
+ VarcharColumnDef keeCol = newLenientVarcharBuilder("kee").setLimit(50).build();
+ context.execute(
+ newTableBuilder(tableName)
+ .addPkColumn(newBigIntegerColumnDefBuilder().setColumnName("id").setIsNullable(false).build(), AUTO_INCREMENT)
+ .addColumn(keeCol)
+ .addColumn(issueKeyCol)
+ .addColumn(newLenientVarcharBuilder("user_login").setLimit(255).build())
+ .addColumn(newLenientVarcharBuilder("change_type").setLimit(20).build())
+ .addColumn(newClobColumnDefBuilder().setColumnName("change_data").build())
+ .addColumn(newBigIntegerColumnDefBuilder().setColumnName("created_at").build())
+ .addColumn(newBigIntegerColumnDefBuilder().setColumnName("updated_at").build())
+ .addColumn(newBigIntegerColumnDefBuilder().setColumnName("issue_change_creation_date").build())
+ .build());
+ addIndex(context, tableName, "issue_changes_issue_key", false, issueKeyCol);
+ addIndex(context, tableName, "issue_changes_kee", false, keeCol);
+ }
+
+ private void createIssues(Context context) {
+ VarcharColumnDef assigneeCol = newLenientVarcharBuilder("assignee").setLimit(255).build();
+ VarcharColumnDef componentUuidCol = newLenientVarcharBuilder("component_uuid").setLimit(50).build();
+ BigIntegerColumnDef issueCreationDateCol = newBigIntegerColumnDefBuilder().setColumnName("issue_creation_date").build();
+ VarcharColumnDef keeCol = newLenientVarcharBuilder("kee").setLimit(50).setIsNullable(false).build();
+ VarcharColumnDef projectUuidCol = newLenientVarcharBuilder("project_uuid").setLimit(50).build();
+ VarcharColumnDef resolutionCol = newLenientVarcharBuilder("resolution").setLimit(20).build();
+ IntegerColumnDef ruleIdCol = newIntegerColumnDefBuilder().setColumnName("rule_id").build();
+ BigIntegerColumnDef updatedAtCol = newBigIntegerColumnDefBuilder().setColumnName("updated_at").build();
+ context.execute(
+ newTableBuilder("issues")
+ .addPkColumn(newBigIntegerColumnDefBuilder().setColumnName("id").setIsNullable(false).build(), AUTO_INCREMENT)
+ .addColumn(keeCol)
+ .addColumn(ruleIdCol)
+ .addColumn(newLenientVarcharBuilder("severity").setLimit(10).build())
+ .addColumn(newBooleanColumnDefBuilder().setColumnName("manual_severity").setIsNullable(false).build())
+ // unit has been fixed in SonarQube 5.6 (see migration 1151, SONAR-7493)
+ .addColumn(newVarcharColumnBuilder("message").setLimit(MAX_SIZE).build())
+ .addColumn(newIntegerColumnDefBuilder().setColumnName("line").build())
+ .addColumn(newDecimalColumnDefBuilder().setColumnName("gap").setPrecision(30).setScale(20).build())
+ .addColumn(newLenientVarcharBuilder("status").setLimit(20).build())
+ .addColumn(resolutionCol)
+ .addColumn(newLenientVarcharBuilder("checksum").setLimit(1000).build())
+ .addColumn(newLenientVarcharBuilder("reporter").setLimit(255).build())
+ .addColumn(assigneeCol)
+ .addColumn(newLenientVarcharBuilder("author_login").setLimit(255).build())
+ .addColumn(newLenientVarcharBuilder("action_plan_key").setLimit(50).build())
+ .addColumn(newLenientVarcharBuilder("issue_attributes").setLimit(MAX_SIZE).build())
+ .addColumn(newIntegerColumnDefBuilder().setColumnName("effort").build())
+ .addColumn(newBigIntegerColumnDefBuilder().setColumnName("created_at").build())
+ .addColumn(updatedAtCol)
+ .addColumn(issueCreationDateCol)
+ .addColumn(newBigIntegerColumnDefBuilder().setColumnName("issue_update_date").build())
+ .addColumn(newBigIntegerColumnDefBuilder().setColumnName("issue_close_date").build())
+ .addColumn(newLenientVarcharBuilder("tags").setLimit(MAX_SIZE).build())
+ .addColumn(componentUuidCol)
+ .addColumn(projectUuidCol)
+ .addColumn(newBlobColumnDefBuilder().setColumnName("locations").build())
+ .addColumn(new TinyIntColumnDef.Builder().setColumnName("issue_type").build())
+ .addColumn(newBooleanColumnDefBuilder().setColumnName("from_hotspot").setIsNullable(true).build())
+ .build());
+ addIndex(context, "issues", "issues_assignee", false, assigneeCol);
+ addIndex(context, "issues", "issues_component_uuid", false, componentUuidCol);
+ addIndex(context, "issues", "issues_creation_date", false, issueCreationDateCol);
+ addIndex(context, "issues", "issues_kee", true, keeCol);
+ addIndex(context, "issues", "issues_project_uuid", false, projectUuidCol);
+ addIndex(context, "issues", "issues_resolution", false, resolutionCol);
+ addIndex(context, "issues", "issues_rule_id", false, ruleIdCol);
+ addIndex(context, "issues", "issues_updated_at", false, updatedAtCol);
+ }
+
+ private void createLiveMeasures(Context context) {
+ String tableName = "live_measures";
+ VarcharColumnDef projectUuidCol = newVarcharColumnBuilder("project_uuid").setIsNullable(false).setLimit(UUID_VARCHAR_SIZE).build();
+ VarcharColumnDef componentUuidCol = newVarcharColumnBuilder("component_uuid").setIsNullable(false).setLimit(UUID_VARCHAR_SIZE).build();
+ IntegerColumnDef metricIdCol = newIntegerColumnDefBuilder().setColumnName("metric_id").setIsNullable(false).build();
+ context.execute(newTableBuilder(tableName)
+ .addPkColumn(newVarcharColumnBuilder("uuid").setIsNullable(false).setLimit(UUID_SIZE).build())
+ .addColumn(projectUuidCol)
+ .addColumn(componentUuidCol)
+ .addColumn(metricIdCol)
+ .addColumn(newDecimalColumnDefBuilder().setColumnName("value").setPrecision(38).setScale(20).build())
+ .addColumn(newVarcharColumnBuilder("text_value").setIsNullable(true).setLimit(MAX_SIZE).build())
+ .addColumn(newDecimalColumnDefBuilder().setColumnName("variation").setPrecision(38).setScale(20).build())
+ .addColumn(newBlobColumnDefBuilder().setColumnName("measure_data").setIsNullable(true).build())
+ .addColumn(newVarcharColumnBuilder("update_marker").setIsNullable(true).setLimit(UUID_SIZE).build())
+ .addColumn(newBigIntegerColumnDefBuilder().setColumnName("created_at").setIsNullable(false).build())
+ .addColumn(newBigIntegerColumnDefBuilder().setColumnName("updated_at").setIsNullable(false).build())
+ .build());
+ addIndex(context, tableName, "live_measures_project", false, projectUuidCol);
+ addIndex(context, tableName, "live_measures_component", true, componentUuidCol, metricIdCol);
+ }
+
+ private void createManualMeasures(Context context) {
+ String tableName = "manual_measures";
+ VarcharColumnDef componentUuidCol = newLenientVarcharBuilder("component_uuid").setLimit(UUID_VARCHAR_SIZE).setIsNullable(false).build();
+ context.execute(
+ newTableBuilder(tableName)
+ .addPkColumn(newBigIntegerColumnDefBuilder().setColumnName("id").setIsNullable(false).build(), AUTO_INCREMENT)
+ .addColumn(newIntegerColumnDefBuilder().setColumnName("metric_id").setIsNullable(false).build())
+ .addColumn(newDecimalColumnDefBuilder().setColumnName("value").setPrecision(38).setScale(20).build())
+ .addColumn(newLenientVarcharBuilder("text_value").setLimit(MAX_SIZE).build())
+ .addColumn(newLenientVarcharBuilder("user_uuid").setLimit(255).build())
+ .addColumn(newLenientVarcharBuilder("description").setLimit(MAX_SIZE).build())
+ .addColumn(newBigIntegerColumnDefBuilder().setColumnName("created_at").build())
+ .addColumn(newBigIntegerColumnDefBuilder().setColumnName("updated_at").build())
+ .addColumn(componentUuidCol)
+ .build());
+ addIndex(context, tableName, "manual_measures_component_uuid", false, componentUuidCol);
+ }
+
+ private void createMetrics(Context context) {
+ String tableName = "metrics";
+ VarcharColumnDef nameCol = newLenientVarcharBuilder("name").setLimit(64).setIsNullable(false).build();
+ context.execute(
+ newTableBuilder(tableName)
+ .addPkColumn(newIntegerColumnDefBuilder().setColumnName("id").setIsNullable(false).build(), AUTO_INCREMENT)
+ .addColumn(nameCol)
+ .addColumn(newLenientVarcharBuilder("description").setLimit(255).build())
+ .addColumn(newIntegerColumnDefBuilder().setColumnName("direction").setIsNullable(false).setDefaultValue(0).build())
+ .addColumn(newLenientVarcharBuilder("domain").setLimit(64).build())
+ .addColumn(newLenientVarcharBuilder("short_name").setLimit(64).build())
+ .addColumn(newBooleanColumnDefBuilder().setColumnName("qualitative").setDefaultValue(false).setIsNullable(false).build())
+ .addColumn(newLenientVarcharBuilder("val_type").setLimit(8).build())
+ .addColumn(newBooleanColumnDefBuilder().setColumnName("user_managed").setDefaultValue(false).build())
+ .addColumn(newBooleanColumnDefBuilder().setColumnName("enabled").setDefaultValue(true).build())
+ .addColumn(newDecimalColumnDefBuilder().setColumnName("worst_value").setPrecision(38).setScale(20).build())
+ .addColumn(newDecimalColumnDefBuilder().setColumnName("best_value").setPrecision(38).setScale(20).build())
+ .addColumn(newBooleanColumnDefBuilder().setColumnName("optimized_best_value").build())
+ .addColumn(newBooleanColumnDefBuilder().setColumnName("hidden").build())
+ .addColumn(newBooleanColumnDefBuilder().setColumnName("delete_historical_data").build())
+ .addColumn(newIntegerColumnDefBuilder().setColumnName("decimal_scale").build())
+ .build());
+ addIndex(context, tableName, "metrics_unique_name", true, nameCol);
+ }
+
+ private void createNotifications(Context context) {
+ context.execute(
+ newTableBuilder("notifications")
+ .addPkColumn(newIntegerColumnDefBuilder().setColumnName("id").setIsNullable(false).build(), AUTO_INCREMENT)
+ .addColumn(newBlobColumnDefBuilder().setColumnName("data").build())
+ .build());
+ }
+
+ private void createOrgQProfiles(Context context) {
+ String tableName = "org_qprofiles";
+ int profileUuidSize = 255;
+ VarcharColumnDef organizationCol = newLenientVarcharBuilder("organization_uuid").setLimit(UUID_SIZE).setIsNullable(false).build();
+ VarcharColumnDef rulesProfileUuidCol = newLenientVarcharBuilder("rules_profile_uuid").setLimit(profileUuidSize).setIsNullable(false).build();
+ VarcharColumnDef parentUuidCol = newLenientVarcharBuilder("parent_uuid").setLimit(profileUuidSize).setIsNullable(true).build();
+ context.execute(
+ newTableBuilder(tableName)
+ .addPkColumn(newVarcharColumnBuilder("uuid").setLimit(profileUuidSize).setIsNullable(false).build())
+ .addColumn(organizationCol)
+ .addColumn(rulesProfileUuidCol)
+ .addColumn(parentUuidCol)
+ .addColumn(newBigIntegerColumnDefBuilder().setColumnName("last_used").setIsNullable(true).build())
+ .addColumn(newBigIntegerColumnDefBuilder().setColumnName("user_updated_at").setIsNullable(true).build())
+ .addColumn(newBigIntegerColumnDefBuilder().setColumnName("created_at").setIsNullable(false).build())
+ .addColumn(newBigIntegerColumnDefBuilder().setColumnName("updated_at").setIsNullable(false).build())
+ .build());
+ addIndex(context, tableName, "qprofiles_org_uuid", false, organizationCol);
+ addIndex(context, tableName, "qprofiles_rp_uuid", false, rulesProfileUuidCol);
+ addIndex(context, tableName, "org_qprofiles_parent_uuid", false, parentUuidCol);
+ }
+
+ private void createOrgQualityGates(Context context) {
+ String tableName = "org_quality_gates";
+ VarcharColumnDef organizationUuidCol = newVarcharColumnBuilder("organization_uuid").setIsNullable(false).setLimit(UUID_SIZE).build();
+ VarcharColumnDef qualityGateUuidCol = newVarcharColumnBuilder("quality_gate_uuid").setIsNullable(false).setLimit(UUID_SIZE).build();
+ context.execute(newTableBuilder(tableName)
+ .addPkColumn(newVarcharColumnBuilder("uuid").setIsNullable(false).setLimit(UUID_SIZE).build())
+ .addColumn(organizationUuidCol)
+ .addColumn(qualityGateUuidCol)
+ .build());
+ addIndex(context, tableName, "uniq_org_quality_gates", true, organizationUuidCol, qualityGateUuidCol);
+ }
+
+ private void createOrganizationAlmBindings(Context context) {
+ String tableName = "organization_alm_bindings";
+ VarcharColumnDef organizationUuidCol = newVarcharColumnBuilder("organization_uuid").setIsNullable(false).setLimit(UUID_SIZE).build();
+ VarcharColumnDef almAppInstallUuidCol = newVarcharColumnBuilder("alm_app_install_uuid").setIsNullable(false).setLimit(UUID_SIZE).build();
+ context.execute(newTableBuilder(tableName)
+ .addPkColumn(newVarcharColumnBuilder("uuid").setIsNullable(false).setLimit(UUID_SIZE).build())
+ .addColumn(organizationUuidCol)
+ .addColumn(almAppInstallUuidCol)
+ .addColumn(newVarcharColumnBuilder("alm_id").setIsNullable(false).setLimit(UUID_SIZE).build())
+ .addColumn(newVarcharColumnBuilder("url").setIsNullable(false).setLimit(2000).build())
+ .addColumn(newVarcharColumnBuilder("user_uuid").setIsNullable(false).setLimit(255).build())
+ .addColumn(newBooleanColumnDefBuilder().setColumnName("members_sync_enabled").setIsNullable(true).build())
+ .addColumn(newBigIntegerColumnDefBuilder().setColumnName("created_at").setIsNullable(false).build())
+ .build());
+ addIndex(context, tableName, "org_alm_bindings_org", true, organizationUuidCol);
+ addIndex(context, tableName, "org_alm_bindings_install", true, almAppInstallUuidCol);
+ }
+
+ private void createOrganizationMembers(Context context) {
+ String tableName = "organization_members";
+ IntegerColumnDef userIdCol = newIntegerColumnDefBuilder().setColumnName("user_id").setIsNullable(false).build();
+ context.execute(
+ newTableBuilder(tableName)
+ .addPkColumn(newVarcharColumnBuilder("organization_uuid").setLimit(UUID_SIZE).setIsNullable(false).build())
+ .addPkColumn(userIdCol)
+ .build());
+ addIndex(context, tableName, "ix_org_members_on_user_id", false, userIdCol);
+ }
+
+ private void createOrganizations(Context context) {
+ String tableName = "organizations";
+ VarcharColumnDef keeColumn = newLenientVarcharBuilder("kee").setLimit(255).setIsNullable(false).build();
+ context.execute(
+ newTableBuilder(tableName)
+ .addPkColumn(newLenientVarcharBuilder("uuid").setLimit(UUID_SIZE).setIsNullable(false).build())
+ .addColumn(keeColumn)
+ .addColumn(newLenientVarcharBuilder("name").setLimit(255).setIsNullable(false).build())
+ .addColumn(newLenientVarcharBuilder("description").setLimit(256).setIsNullable(true).build())
+ .addColumn(newLenientVarcharBuilder("url").setLimit(256).setIsNullable(true).build())
+ .addColumn(newLenientVarcharBuilder("avatar_url").setLimit(256).setIsNullable(true).build())
+ .addColumn(newBooleanColumnDefBuilder().setColumnName("guarded").setIsNullable(false).build())
+ .addColumn(newIntegerColumnDefBuilder().setColumnName("default_group_id").setIsNullable(true).build())
+ .addColumn(newVarcharColumnBuilder("default_quality_gate_uuid").setLimit(UUID_SIZE).setIsNullable(false).build())
+ .addColumn(newVarcharColumnBuilder("default_perm_template_project").setLimit(UUID_SIZE).setIsNullable(true).build())
+ .addColumn(newVarcharColumnBuilder("default_perm_template_app").setLimit(UUID_SIZE).setIsNullable(true).build())
+ .addColumn(newVarcharColumnBuilder("default_perm_template_port").setLimit(UUID_SIZE).setIsNullable(true).build())
+ .addColumn(newBooleanColumnDefBuilder().setColumnName("new_project_private").setIsNullable(false).build())
+ .addColumn(newVarcharColumnBuilder("subscription").setLimit(UUID_SIZE).setIsNullable(false).build())
+ .addColumn(newBigIntegerColumnDefBuilder().setColumnName("created_at").setIsNullable(false).build())
+ .addColumn(newBigIntegerColumnDefBuilder().setColumnName("updated_at").setIsNullable(false).build())
+ .build());
+ addIndex(context, tableName, "organization_key", true, keeColumn);
+ }
+
+ private void createPermTemplatesGroups(Context context) {
+ context.execute(
+ newTableBuilder("perm_templates_groups")
+ .addPkColumn(newIntegerColumnDefBuilder().setColumnName("id").setIsNullable(false).build(), AUTO_INCREMENT)
+ .addColumn(newIntegerColumnDefBuilder().setColumnName("group_id").build())
+ .addColumn(newIntegerColumnDefBuilder().setColumnName("template_id").setIsNullable(false).build())
+ .addColumn(newLenientVarcharBuilder("permission_reference").setLimit(64).setIsNullable(false).build())
+ .addColumn(newTimestampColumnDefBuilder().setColumnName("created_at").build())
+ .addColumn(newTimestampColumnDefBuilder().setColumnName("updated_at").build())
+ .build());
+ }
+
+ private void createPermTemplatesUsers(Context context) {
+ context.execute(
+ newTableBuilder("perm_templates_users")
+ .addPkColumn(newIntegerColumnDefBuilder().setColumnName("id").setIsNullable(false).build(), AUTO_INCREMENT)
+ .addColumn(newIntegerColumnDefBuilder().setColumnName("user_id").setIsNullable(false).build())
+ .addColumn(newIntegerColumnDefBuilder().setColumnName("template_id").setIsNullable(false).build())
+ .addColumn(newLenientVarcharBuilder("permission_reference").setLimit(64).setIsNullable(false).build())
+ .addColumn(newTimestampColumnDefBuilder().setColumnName("created_at").build())
+ .addColumn(newTimestampColumnDefBuilder().setColumnName("updated_at").build())
+ .build());
+ }
+
+ private void createPermTemplatesCharacteristics(Context context) {
+ String tableName = "perm_tpl_characteristics";
+ IntegerColumnDef templateIdColumn = newIntegerColumnDefBuilder().setColumnName("template_id").setIsNullable(false).build();
+ VarcharColumnDef permissionKeyColumn = newLenientVarcharBuilder("permission_key").setLimit(64).setIsNullable(false).build();
+ context.execute(
+ newTableBuilder(tableName)
+ .addPkColumn(newIntegerColumnDefBuilder().setColumnName("id").setIsNullable(false).build(), AUTO_INCREMENT)
+ .addColumn(templateIdColumn)
+ .addColumn(permissionKeyColumn)
+ .addColumn(newBooleanColumnDefBuilder().setColumnName("with_project_creator").setIsNullable(false).setDefaultValue(false).build())
+ .addColumn(newBigIntegerColumnDefBuilder().setColumnName("created_at").setIsNullable(false).build())
+ .addColumn(newBigIntegerColumnDefBuilder().setColumnName("updated_at").setIsNullable(false).build())
+ .build());
+
+ addIndex(context, tableName, "uniq_perm_tpl_charac", true, templateIdColumn, permissionKeyColumn);
+ }
+
+ private void createPermissionTemplates(Context context) {
+ context.execute(
+ newTableBuilder("permission_templates")
+ .addPkColumn(newIntegerColumnDefBuilder().setColumnName("id").setIsNullable(false).build(), AUTO_INCREMENT)
+ .addColumn(newLenientVarcharBuilder("organization_uuid").setIsNullable(false).setLimit(40).build())
+ .addColumn(newLenientVarcharBuilder("name").setLimit(100).setIsNullable(false).build())
+ .addColumn(newLenientVarcharBuilder("kee").setLimit(100).setIsNullable(false).build())
+ .addColumn(newLenientVarcharBuilder("description").setLimit(MAX_SIZE).build())
+ .addColumn(newTimestampColumnDefBuilder().setColumnName("created_at").build())
+ .addColumn(newTimestampColumnDefBuilder().setColumnName("updated_at").build())
+ .addColumn(newLenientVarcharBuilder("key_pattern").setLimit(500).build())
+ .build());
+ }
+
+ private void createPlugins(Context context) {
+ int pluginKeyMaxSize = 200;
+ String tableName = "plugins";
+ VarcharColumnDef keyColumn = newVarcharColumnBuilder("kee").setLimit(pluginKeyMaxSize).setIsNullable(false).build();
+ context.execute(
+ newTableBuilder(tableName)
+ .addPkColumn(newLenientVarcharBuilder("uuid").setLimit(UUID_SIZE).setIsNullable(false).build())
+ .addColumn(keyColumn)
+ .addColumn(newVarcharColumnBuilder("base_plugin_key").setLimit(pluginKeyMaxSize).setIsNullable(true).build())
+ .addColumn(newVarcharColumnBuilder("file_hash").setLimit(200).setIsNullable(false).build())
+ .addColumn(newBigIntegerColumnDefBuilder().setColumnName("created_at").setIsNullable(false).build())
+ .addColumn(newBigIntegerColumnDefBuilder().setColumnName("updated_at").setIsNullable(false).build())
+ .build());
+ addIndex(context, tableName, "plugins_key", true, keyColumn);
+ }
+
+ private void createProjectAlmBindings(Context context) {
+ String tableName = "project_alm_bindings";
+ VarcharColumnDef almIdCol = newVarcharColumnDefBuilder().setColumnName("alm_id").setIsNullable(false).setLimit(40).build();
+ VarcharColumnDef repoIdCol = newVarcharColumnDefBuilder().setColumnName("repo_id").setIsNullable(false).setLimit(256).build();
+ VarcharColumnDef projectUuidCol = newVarcharColumnDefBuilder().setColumnName("project_uuid").setIsNullable(false).setLimit(40).build();
+ context.execute(newTableBuilder(tableName)
+ .addPkColumn(newVarcharColumnBuilder("uuid").setLimit(UUID_SIZE).setIsNullable(false).build())
+ .addColumn(almIdCol)
+ .addColumn(repoIdCol)
+ .addColumn(projectUuidCol)
+ .addColumn(newVarcharColumnBuilder("github_slug").setIsNullable(true).setLimit(256).build())
+ .addColumn(newVarcharColumnBuilder("url").setIsNullable(false).setLimit(2000).build())
+ .addColumn(newBigIntegerColumnDefBuilder().setColumnName("created_at").setIsNullable(false).build())
+ .addColumn(newBigIntegerColumnDefBuilder().setColumnName("updated_at").setIsNullable(false).build())
+ .build());
+ addIndex(context, tableName, tableName + "_alm_repo", true, almIdCol, repoIdCol);
+ addIndex(context, tableName, tableName + "_project", true, projectUuidCol);
+ }
+
+ private void createProjectBranches(Context context) {
+ String tableName = "project_branches";
+ VarcharColumnDef projectUuidCol = newVarcharColumnBuilder("project_uuid").setIsNullable(false).setLimit(UUID_VARCHAR_SIZE).build();
+ VarcharColumnDef keeCol = newVarcharColumnBuilder("kee").setIsNullable(false).setLimit(255).build();
+ VarcharColumnDef keyTypeCol = newVarcharColumnBuilder("key_type").setIsNullable(false).setLimit(12).build();
+ context.execute(
+ newTableBuilder(tableName)
+ .addPkColumn(newVarcharColumnBuilder("uuid").setIsNullable(false).setLimit(UUID_VARCHAR_SIZE).build())
+ .addColumn(projectUuidCol)
+ .addColumn(keeCol)
+ .addColumn(newVarcharColumnBuilder("branch_type").setIsNullable(true).setLimit(12).build())
+ .addColumn(newVarcharColumnBuilder("merge_branch_uuid").setIsNullable(true).setLimit(UUID_VARCHAR_SIZE).build())
+ .addColumn(keyTypeCol)
+ .addColumn(newBlobColumnDefBuilder().setColumnName("pull_request_binary").setIsNullable(true).build())
+ .addColumn(newVarcharColumnBuilder("manual_baseline_analysis_uuid").setIsNullable(true).setLimit(UUID_SIZE).build())
+ .addColumn(newBigIntegerColumnDefBuilder().setColumnName("created_at").setIsNullable(false).build())
+ .addColumn(newBigIntegerColumnDefBuilder().setColumnName("updated_at").setIsNullable(false).build())
+ .build());
+ addIndex(context, tableName, "project_branches_kee_key_type", true, projectUuidCol, keeCol, keyTypeCol);
+ }
+
+ private void createProjectLinks(Context context) {
+ String tableName = "project_links";
+ VarcharColumnDef projectUuidCol = newVarcharColumnBuilder("project_uuid").setLimit(UUID_SIZE).setIsNullable(false).build();
+ context.execute(newTableBuilder(tableName)
+ .addPkColumn(newVarcharColumnBuilder("uuid").setLimit(UUID_SIZE).setIsNullable(false).build())
+ .addColumn(projectUuidCol)
+ .addColumn(newVarcharColumnBuilder("link_type").setLimit(20).setIsNullable(false).build())
+ .addColumn(newVarcharColumnBuilder("name").setLimit(128).setIsNullable(true).build())
+ .addColumn(newVarcharColumnBuilder("href").setLimit(2048).setIsNullable(false).build())
+ .addColumn(newBigIntegerColumnDefBuilder().setColumnName("created_at").setIsNullable(false).build())
+ .addColumn(newBigIntegerColumnDefBuilder().setColumnName("updated_at").setIsNullable(false).build())
+ .build());
+ addIndex(context, tableName, "project_links_project", false, projectUuidCol);
+ }
+
+ private void createProjectMappings(Context context) {
+ String tableName = "project_mappings";
+ VarcharColumnDef keyTypeCol = newVarcharColumnBuilder("key_type").setIsNullable(false).setLimit(200).build();
+ VarcharColumnDef keyCol = newVarcharColumnBuilder("kee").setIsNullable(false).setLimit(MAX_SIZE).build();
+ VarcharColumnDef projectUuidCol = newVarcharColumnBuilder("project_uuid").setIsNullable(false).setLimit(UUID_SIZE).build();
+ context.execute(newTableBuilder(tableName)
+ .addPkColumn(newVarcharColumnBuilder("uuid").setIsNullable(false).setLimit(UUID_SIZE).build())
+ .addColumn(keyTypeCol)
+ .addColumn(keyCol)
+ .addColumn(projectUuidCol)
+ .addColumn(newBigIntegerColumnDefBuilder().setColumnName("created_at").setIsNullable(false).build())
+ .build());
+ addIndex(context, tableName, "key_type_kee", true, keyTypeCol, keyCol);
+ addIndex(context, tableName, "project_uuid", false, projectUuidCol);
+ }
+
+ private void createProjectMeasures(Context context) {
+ String tableName = "project_measures";
+ IntegerColumnDef personIdCol = newIntegerColumnDefBuilder().setColumnName("person_id").build();
+ IntegerColumnDef metricIdCol = newIntegerColumnDefBuilder().setColumnName("metric_id").setIsNullable(false).build();
+ VarcharColumnDef analysisUuidCol = newLenientVarcharBuilder("analysis_uuid").setLimit(UUID_VARCHAR_SIZE).setIsNullable(false).build();
+ VarcharColumnDef componentUuidCol = newLenientVarcharBuilder("component_uuid").setLimit(UUID_VARCHAR_SIZE).setIsNullable(false).build();
+ context.execute(
+ newTableBuilder(tableName)
+ .addPkColumn(newBigIntegerColumnDefBuilder().setColumnName("id").setIsNullable(false).build(), AUTO_INCREMENT)
+ .addColumn(newDecimalColumnDefBuilder().setColumnName("value").setPrecision(38).setScale(20).build())
+ .addColumn(metricIdCol)
+ .addColumn(analysisUuidCol)
+ .addColumn(componentUuidCol)
+ .addColumn(newLenientVarcharBuilder("text_value").setLimit(MAX_SIZE).build())
+ .addColumn(newLenientVarcharBuilder("alert_status").setLimit(5).build())
+ .addColumn(newLenientVarcharBuilder("alert_text").setLimit(MAX_SIZE).build())
+ .addColumn(newLenientVarcharBuilder("description").setLimit(MAX_SIZE).build())
+ .addColumn(personIdCol)
+ .addColumn(newDecimalColumnDefBuilder().setColumnName("variation_value_1").setPrecision(38).setScale(20).build())
+ .addColumn(newDecimalColumnDefBuilder().setColumnName("variation_value_2").setPrecision(38).setScale(20).build())
+ .addColumn(newDecimalColumnDefBuilder().setColumnName("variation_value_3").setPrecision(38).setScale(20).build())
+ .addColumn(newDecimalColumnDefBuilder().setColumnName("variation_value_4").setPrecision(38).setScale(20).build())
+ .addColumn(newDecimalColumnDefBuilder().setColumnName("variation_value_5").setPrecision(38).setScale(20).build())
+ .addColumn(newBlobColumnDefBuilder().setColumnName("measure_data").build())
+ .build());
+ addIndex(context, tableName, "measures_analysis_metric", false, analysisUuidCol, metricIdCol);
+ addIndex(context, tableName, "measures_component_uuid", false, componentUuidCol);
+ }
+
+ private void createProjectQprofiles(Context context) {
+ String tableName = "project_qprofiles";
+ VarcharColumnDef projectUuid = newLenientVarcharBuilder("project_uuid").setLimit(50).setIsNullable(false).build();
+ VarcharColumnDef profileKey = newLenientVarcharBuilder("profile_key").setLimit(50).setIsNullable(false).build();
+ context.execute(
+ newTableBuilder(tableName)
+ .addPkColumn(newIntegerColumnDefBuilder().setColumnName("id").setIsNullable(false).build(), AUTO_INCREMENT)
+ .addColumn(projectUuid)
+ .addColumn(profileKey)
+ .build());
+ addIndex(context, tableName, "uniq_project_qprofiles", true, projectUuid, profileKey);
+ }
+
+ private void createProjects(Context context) {
+ String tableName = "projects";
+ VarcharColumnDef uuidCol = newLenientVarcharBuilder("uuid").setLimit(50).setIsNullable(false).build();
+ VarcharColumnDef organizationUuidCol = newVarcharColumnBuilder("organization_uuid").setLimit(UUID_SIZE).setIsNullable(false).build();
+ VarcharColumnDef keeCol = newLenientVarcharBuilder("kee").setLimit(400).setIsNullable(true).build();
+ VarcharColumnDef qualifierCol = newLenientVarcharBuilder("qualifier").setLimit(10).setIsNullable(true).build();
+ VarcharColumnDef rootUuidCol = newVarcharColumnBuilder("root_uuid").setLimit(UUID_VARCHAR_SIZE).setIsNullable(false).build();
+ VarcharColumnDef projectUuidCol = newLenientVarcharBuilder("project_uuid").setLimit(50).setIsNullable(false).build();
+ VarcharColumnDef moduleUuidCol = newLenientVarcharBuilder("module_uuid").setLimit(50).setIsNullable(true).build();
+ context.execute(
+ newTableBuilder(tableName)
+ .addPkColumn(newIntegerColumnDefBuilder().setColumnName("id").setIsNullable(false).build(), AUTO_INCREMENT)
+ .addColumn(uuidCol)
+ .addColumn(organizationUuidCol)
+ .addColumn(keeCol)
+ .addColumn(newLenientVarcharBuilder("deprecated_kee").setLimit(400).setIsNullable(true).build())
+ .addColumn(newLenientVarcharBuilder("name").setLimit(2_000).setIsNullable(true).build())
+ .addColumn(newLenientVarcharBuilder("long_name").setLimit(2_000).setIsNullable(true).build())
+ .addColumn(newLenientVarcharBuilder("description").setLimit(2_000).setIsNullable(true).build())
+ .addColumn(newBooleanColumnDefBuilder().setColumnName("enabled").setDefaultValue(true).setIsNullable(false).build())
+ .addColumn(newLenientVarcharBuilder("scope").setLimit(3).setIsNullable(true).build())
+ .addColumn(qualifierCol)
+ .addColumn(newBooleanColumnDefBuilder().setColumnName("private").setIsNullable(false).build())
+ .addColumn(rootUuidCol)
+ .addColumn(newLenientVarcharBuilder("language").setLimit(20).setIsNullable(true).build())
+ .addColumn(newVarcharColumnBuilder("copy_component_uuid").setLimit(UUID_VARCHAR_SIZE).setIsNullable(true).build())
+ .addColumn(newVarcharColumnBuilder("developer_uuid").setLimit(UUID_VARCHAR_SIZE).setIsNullable(true).build())
+ .addColumn(newLenientVarcharBuilder("path").setLimit(2_000).setIsNullable(true).build())
+ .addColumn(newLenientVarcharBuilder("uuid_path").setLimit(1_500).setIsNullable(false).build())
+ .addColumn(projectUuidCol)
+ .addColumn(moduleUuidCol)
+ .addColumn(newLenientVarcharBuilder("module_uuid_path").setLimit(1_500).setIsNullable(true).build())
+ .addColumn(newBigIntegerColumnDefBuilder().setColumnName("authorization_updated_at").setIsNullable(true).build())
+ .addColumn(newVarcharColumnBuilder("tags").setLimit(500).setIsNullable(true).build())
+ .addColumn(newVarcharColumnBuilder("main_branch_project_uuid").setLimit(UUID_VARCHAR_SIZE).setIsNullable(true).build())
+ .addColumn(newBooleanColumnDefBuilder().setColumnName("b_changed").setIsNullable(true).build())
+ .addColumn(newLenientVarcharBuilder("b_name").setLimit(500).setIsNullable(true).build())
+ .addColumn(newLenientVarcharBuilder("b_long_name").setLimit(500).setIsNullable(true).build())
+ .addColumn(newLenientVarcharBuilder("b_description").setLimit(2_000).setIsNullable(true).build())
+ .addColumn(newBooleanColumnDefBuilder().setColumnName("b_enabled").setIsNullable(true).build())
+ .addColumn(newLenientVarcharBuilder("b_qualifier").setLimit(10).setIsNullable(true).build())
+ .addColumn(newLenientVarcharBuilder("b_language").setLimit(20).setIsNullable(true).build())
+ .addColumn(newLenientVarcharBuilder("b_copy_component_uuid").setLimit(UUID_VARCHAR_SIZE).setIsNullable(true).build())
+ .addColumn(newLenientVarcharBuilder("b_path").setLimit(2_000).setIsNullable(true).build())
+ .addColumn(newLenientVarcharBuilder("b_uuid_path").setLimit(1_500).setIsNullable(true).build())
+ .addColumn(newLenientVarcharBuilder("b_module_uuid").setLimit(UUID_VARCHAR_SIZE).setIsNullable(true).build())
+ .addColumn(newLenientVarcharBuilder("b_module_uuid_path").setLimit(1_500).setIsNullable(true).build())
+ .addColumn(newTimestampColumnDefBuilder().setColumnName("created_at").setIsNullable(true).build())
+ .build());
+ addIndex(context, tableName, "projects_organization", false, organizationUuidCol);
+ addIndex(context, tableName, "projects_kee", true, keeCol);
+ addIndex(context, tableName, "projects_module_uuid", false, moduleUuidCol);
+ addIndex(context, tableName, "projects_project_uuid", false, projectUuidCol);
+ addIndex(context, tableName, "projects_qualifier", false, qualifierCol);
+ addIndex(context, tableName, "projects_root_uuid", false, rootUuidCol);
+ // see SONAR-12341, index projects_uuid should actually be unique
+ addIndex(context, tableName, "projects_uuid", false, uuidCol);
+ }
+
+ private void createProperties(Context context) {
+ String tableName = "properties";
+ VarcharColumnDef propKey = newLenientVarcharBuilder("prop_key").setLimit(512).setIsNullable(false).build();
+ context.execute(newTableBuilder(tableName)
+ .addPkColumn(newIntegerColumnDefBuilder().setColumnName("id").setIsNullable(false).build(), AUTO_INCREMENT)
+ .addColumn(propKey)
+ .addColumn(newBigIntegerColumnDefBuilder().setColumnName("resource_id").setIsNullable(true).build())
+ .addColumn(newBigIntegerColumnDefBuilder().setColumnName("user_id").setIsNullable(true).build())
+ .addColumn(newBooleanColumnDefBuilder().setColumnName("is_empty").setIsNullable(false).build())
+ .addColumn(newLenientVarcharBuilder("text_value").setLimit(MAX_SIZE).build())
+ .addColumn(newClobColumnDefBuilder().setColumnName("clob_value").setIsNullable(true).build())
+ .addColumn(newBigIntegerColumnDefBuilder().setColumnName("created_at").setIsNullable(false).build())
+ // table with be renamed to properties in following migration, use final constraint name right away
+ .withPkConstraintName("pk_properties")
+ .build());
+ addIndex(context, tableName, "properties_key", false, propKey);
+ }
+
+ private void createQProfileChanges(Context context) {
+ String tableName = "qprofile_changes";
+ VarcharColumnDef rulesProfileUuidCol = newLenientVarcharBuilder("rules_profile_uuid").setLimit(255).setIsNullable(false).build();
+ context.execute(newTableBuilder(tableName)
+ .addPkColumn(newLenientVarcharBuilder("kee").setLimit(UUID_SIZE).setIsNullable(false).build())
+ .addColumn(rulesProfileUuidCol)
+ .addColumn(newLenientVarcharBuilder("change_type").setLimit(20).setIsNullable(false).build())
+ .addColumn(newLenientVarcharBuilder("user_uuid").setLimit(255).setIsNullable(true).build())
+ .addColumn(newClobColumnDefBuilder().setColumnName("change_data").setIsNullable(true).build())
+ .addColumn(newBigIntegerColumnDefBuilder().setColumnName("created_at").setIsNullable(false).build())
+ .build());
+ addIndex(context, tableName, "qp_changes_rules_profile_uuid", false, rulesProfileUuidCol);
+ }
+
+ private void createQProfileEditGroups(Context context) {
+ String tableName = "qprofile_edit_groups";
+ IntegerColumnDef groupCol = newIntegerColumnDefBuilder().setColumnName("group_id").setIsNullable(false).build();
+ VarcharColumnDef qProfileUuidCol = newVarcharColumnBuilder("qprofile_uuid").setIsNullable(false).setLimit(255).build();
+ context.execute(newTableBuilder(tableName)
+ .addPkColumn(newVarcharColumnBuilder("uuid").setIsNullable(false).setLimit(UUID_SIZE).build())
+ .addColumn(groupCol)
+ .addColumn(qProfileUuidCol)
+ .addColumn(newBigIntegerColumnDefBuilder().setColumnName("created_at").setIsNullable(false).build())
+ .build());
+ addIndex(context, tableName, tableName + "_qprofile", false, qProfileUuidCol);
+ addIndex(context, tableName, tableName + "_unique", true, groupCol, qProfileUuidCol);
+ }
+
+ private void createQProfileEditUsers(Context context) {
+ String tableName = "qprofile_edit_users";
+ IntegerColumnDef userIdCol = newIntegerColumnDefBuilder().setColumnName("user_id").setIsNullable(false).build();
+ VarcharColumnDef qProfileUuidCol = newVarcharColumnBuilder("qprofile_uuid").setIsNullable(false).setLimit(255).build();
+ context.execute(newTableBuilder(tableName)
+ .addPkColumn(newVarcharColumnBuilder("uuid").setIsNullable(false).setLimit(UUID_SIZE).build())
+ .addColumn(userIdCol)
+ .addColumn(qProfileUuidCol)
+ .addColumn(newBigIntegerColumnDefBuilder().setColumnName("created_at").setIsNullable(false).build())
+ .build());
+ addIndex(context, tableName, tableName + "_qprofile", false, qProfileUuidCol);
+ addIndex(context, tableName, tableName + "_unique", true, userIdCol, qProfileUuidCol);
+ }
+
+ private void createQualityGateConditions(Context context) {
+ context.execute(
+ newTableBuilder("quality_gate_conditions")
+ .addPkColumn(newIntegerColumnDefBuilder().setColumnName("id").setIsNullable(false).build(), AUTO_INCREMENT)
+ .addColumn(newIntegerColumnDefBuilder().setColumnName("qgate_id").setIsNullable(true).build())
+ .addColumn(newIntegerColumnDefBuilder().setColumnName("metric_id").setIsNullable(true).build())
+ .addColumn(newIntegerColumnDefBuilder().setColumnName("period").setIsNullable(true).build())
+ .addColumn(newLenientVarcharBuilder("operator").setLimit(3).setIsNullable(true).build())
+ .addColumn(newLenientVarcharBuilder("value_error").setLimit(64).setIsNullable(true).build())
+ .addColumn(newLenientVarcharBuilder("value_warning").setLimit(64).setIsNullable(true).build())
+ .addColumn(newTimestampColumnDefBuilder().setColumnName("created_at").setIsNullable(true).build())
+ .addColumn(newTimestampColumnDefBuilder().setColumnName("updated_at").setIsNullable(true).build())
+ .build());
+ }
+
+ private void createQualityGates(Context context) {
+ String tableName = "quality_gates";
+ VarcharColumnDef uuidCol = newVarcharColumnBuilder("uuid").setIsNullable(false).setLimit(UUID_SIZE).build();
+ context.execute(
+ newTableBuilder(tableName)
+ .addPkColumn(newIntegerColumnDefBuilder().setColumnName("id").setIsNullable(false).build(), AUTO_INCREMENT)
+ .addColumn(uuidCol)
+ .addColumn(newLenientVarcharBuilder("name").setLimit(100).setIsNullable(false).build())
+ .addColumn(newBooleanColumnDefBuilder().setColumnName("is_built_in").setIsNullable(false).build())
+ .addColumn(newTimestampColumnDefBuilder().setColumnName("created_at").setIsNullable(true).build())
+ .addColumn(newTimestampColumnDefBuilder().setColumnName("updated_at").setIsNullable(true).build())
+ .build());
+ addIndex(context, tableName, "uniq_quality_gates_uuid", true, uuidCol);
+ }
+
+ private void createRulesRepository(Context context) {
+ String tableName = "rule_repositories";
+ context.execute(newTableBuilder(tableName)
+ .addPkColumn(newLenientVarcharBuilder("kee").setLimit(200).setIsNullable(false).build())
+ .addColumn(newLenientVarcharBuilder("language").setLimit(20).setIsNullable(false).build())
+ .addColumn(newLenientVarcharBuilder("name").setLimit(4_000).setIsNullable(false).build())
+ .addColumn(newBigIntegerColumnDefBuilder().setColumnName("created_at").setIsNullable(false).build())
+ .build());
+ }
+
+ private void createRules(Context context) {
+ VarcharColumnDef pluginRuleKeyCol = newLenientVarcharBuilder("plugin_rule_key").setLimit(200).setIsNullable(false).build();
+ VarcharColumnDef pluginNameCol = newLenientVarcharBuilder("plugin_name").setLimit(255).setIsNullable(false).build();
+ context.execute(
+ newTableBuilder("rules")
+ .addPkColumn(newIntegerColumnDefBuilder().setColumnName("id").setIsNullable(false).build(), AUTO_INCREMENT)
+ .addColumn(newLenientVarcharBuilder("name").setLimit(200).setIsNullable(true).build())
+ .addColumn(pluginRuleKeyCol)
+ .addColumn(newVarcharColumnBuilder("plugin_key").setLimit(200).setIsNullable(true).build())
+ .addColumn(newLenientVarcharBuilder("plugin_config_key").setLimit(200).setIsNullable(true).build())
+ .addColumn(pluginNameCol)
+ .addColumn(newVarcharColumnBuilder("scope").setLimit(20).setIsNullable(false).build())
+ .addColumn(newClobColumnDefBuilder().setColumnName("description").setIsNullable(true).build())
+ .addColumn(newIntegerColumnDefBuilder().setColumnName("priority").setIsNullable(true).build())
+ .addColumn(newIntegerColumnDefBuilder().setColumnName("template_id").setIsNullable(true).build())
+ .addColumn(newLenientVarcharBuilder("status").setLimit(40).setIsNullable(true).build())
+ .addColumn(newLenientVarcharBuilder("language").setLimit(20).setIsNullable(true).build())
+ .addColumn(newLenientVarcharBuilder("def_remediation_function").setLimit(20).setIsNullable(true).build())
+ .addColumn(newLenientVarcharBuilder("def_remediation_gap_mult").setLimit(20).setIsNullable(true).build())
+ .addColumn(newLenientVarcharBuilder("def_remediation_base_effort").setLimit(20).setIsNullable(true).build())
+ .addColumn(newLenientVarcharBuilder("gap_description").setLimit(MAX_SIZE).setIsNullable(true).build())
+ .addColumn(newLenientVarcharBuilder("system_tags").setLimit(MAX_SIZE).setIsNullable(true).build())
+ .addColumn(newBooleanColumnDefBuilder().setColumnName("is_template").setIsNullable(false).setDefaultValue(false).build())
+ .addColumn(newLenientVarcharBuilder("description_format").setLimit(20).setIsNullable(true).build())
+ .addColumn(new TinyIntColumnDef.Builder().setColumnName("rule_type").setIsNullable(true).build())
+ .addColumn(newVarcharColumnBuilder("security_standards").setIsNullable(true).setLimit(4_000).build())
+ .addColumn(newBooleanColumnDefBuilder().setColumnName("is_ad_hoc").setIsNullable(false).build())
+ .addColumn(newBooleanColumnDefBuilder().setColumnName("is_external").setIsNullable(false).build())
+ .addColumn(newBigIntegerColumnDefBuilder().setColumnName("created_at").setIsNullable(true).build())
+ .addColumn(newBigIntegerColumnDefBuilder().setColumnName("updated_at").setIsNullable(true).build())
+ .build());
+ addIndex(context, "rules", "rules_repo_key", true, pluginRuleKeyCol, pluginNameCol);
+ }
+
+ private void createRulesMetadata(Context context) {
+ String tableName = "rules_metadata";
+ context.execute(newTableBuilder(tableName)
+ .addPkColumn(newIntegerColumnDefBuilder().setColumnName("rule_id").setIsNullable(false).build())
+ .addPkColumn(newVarcharColumnBuilder("organization_uuid").setLimit(UUID_SIZE).setIsNullable(false).build())
+ .addColumn(newClobColumnDefBuilder().setColumnName("note_data").setIsNullable(true).build())
+ .addColumn(newVarcharColumnBuilder("note_user_uuid").setLimit(255).setIsNullable(true).build())
+ .addColumn(newBigIntegerColumnDefBuilder().setColumnName("note_created_at").setIsNullable(true).build())
+ .addColumn(newBigIntegerColumnDefBuilder().setColumnName("note_updated_at").setIsNullable(true).build())
+ .addColumn(newVarcharColumnBuilder("remediation_function").setLimit(20).setIsNullable(true).build())
+ .addColumn(newVarcharColumnBuilder("remediation_gap_mult").setLimit(20).setIsNullable(true).build())
+ .addColumn(newVarcharColumnBuilder("remediation_base_effort").setLimit(20).setIsNullable(true).build())
+ .addColumn(newVarcharColumnBuilder("tags").setLimit(4_000).setIsNullable(true).build())
+ .addColumn(newVarcharColumnBuilder("ad_hoc_name").setLimit(200).setIsNullable(true).build())
+ .addColumn(newClobColumnDefBuilder().setColumnName("ad_hoc_description").setIsNullable(true).build())
+ .addColumn(newVarcharColumnBuilder("ad_hoc_severity").setLimit(10).setIsNullable(true).build())
+ .addColumn(newTinyIntColumnDefBuilder().setColumnName("ad_hoc_type").setIsNullable(true).build())
+ .addColumn(newBigIntegerColumnDefBuilder().setColumnName("created_at").setIsNullable(false).build())
+ .addColumn(newBigIntegerColumnDefBuilder().setColumnName("updated_at").setIsNullable(false).build())
+ .withPkConstraintName("pk_" + tableName)
+ .build());
+ }
+
+ private void createRulesParameters(Context context) {
+ String tableName = "rules_parameters";
+ IntegerColumnDef ruleIdCol = newIntegerColumnDefBuilder().setColumnName("rule_id").setIsNullable(false).build();
+ VarcharColumnDef nameCol = newLenientVarcharBuilder("name").setLimit(128).setIsNullable(false).build();
+ context.execute(
+ newTableBuilder(tableName)
+ .addPkColumn(newIntegerColumnDefBuilder().setColumnName("id").setIsNullable(false).build(), AUTO_INCREMENT)
+ .addColumn(ruleIdCol)
+ .addColumn(nameCol)
+ .addColumn(newLenientVarcharBuilder("description").setLimit(MAX_SIZE).setIsNullable(true).build())
+ .addColumn(newLenientVarcharBuilder("param_type").setLimit(512).setIsNullable(false).build())
+ .addColumn(newLenientVarcharBuilder("default_value").setLimit(MAX_SIZE).setIsNullable(true).build())
+ .build());
+ addIndex(context, tableName, "rules_parameters_rule_id", false, ruleIdCol);
+ addIndex(context, tableName, "rules_parameters_unique", true, ruleIdCol, nameCol);
+ }
+
+ private void createRulesProfiles(Context context) {
+ VarcharColumnDef keeCol = newLenientVarcharBuilder("kee").setLimit(255).setIsNullable(false).build();
+ context.execute(
+ newTableBuilder("rules_profiles")
+ .addPkColumn(newIntegerColumnDefBuilder().setColumnName("id").setIsNullable(false).build(), AUTO_INCREMENT)
+ .addColumn(newLenientVarcharBuilder("name").setLimit(100).setIsNullable(false).build())
+ .addColumn(newLenientVarcharBuilder("language").setLimit(20).setIsNullable(true).build())
+ .addColumn(keeCol)
+ .addColumn(newBooleanColumnDefBuilder().setColumnName("is_built_in").setIsNullable(false).build())
+ .addColumn(newLenientVarcharBuilder("rules_updated_at").setLimit(100).setIsNullable(true).build())
+ .addColumn(newTimestampColumnDefBuilder().setColumnName("created_at").setIsNullable(true).build())
+ .addColumn(newTimestampColumnDefBuilder().setColumnName("updated_at").setIsNullable(true).build())
+ .build());
+ addIndex(context, "rules_profiles", "uniq_qprof_key", true, keeCol);
+ }
+
+ private void createSnapshots(Context context) {
+ String tableName = "snapshots";
+ VarcharColumnDef uuidCol = newLenientVarcharBuilder("uuid").setLimit(UUID_VARCHAR_SIZE).setIsNullable(false).build();
+ VarcharColumnDef componentUuidCol = newLenientVarcharBuilder("component_uuid").setLimit(UUID_VARCHAR_SIZE).setIsNullable(false).build();
+ context.execute(
+ newTableBuilder(tableName)
+ .addPkColumn(newIntegerColumnDefBuilder().setColumnName("id").setIsNullable(false).build(), AUTO_INCREMENT)
+ .addColumn(uuidCol)
+ .addColumn(componentUuidCol)
+ .addColumn(newLenientVarcharBuilder("status").setLimit(4).setIsNullable(false).setDefaultValue("U").build())
+ .addColumn(newBooleanColumnDefBuilder().setColumnName("islast").setIsNullable(false).setDefaultValue(false).build())
+ .addColumn(newLenientVarcharBuilder("version").setLimit(500).setIsNullable(true).build())
+ .addColumn(newIntegerColumnDefBuilder().setColumnName("purge_status").setIsNullable(true).build())
+ .addColumn(newVarcharColumnBuilder("build_string").setLimit(100).setIsNullable(true).build())
+ .addColumn(newVarcharColumnBuilder("revision").setLimit(100).setIsNullable(true).build())
+ .addColumn(newBigIntegerColumnDefBuilder().setColumnName("build_date").setIsNullable(true).build())
+ .addColumn(newLenientVarcharBuilder("period1_mode").setLimit(100).setIsNullable(true).build())
+ .addColumn(newLenientVarcharBuilder("period1_param").setLimit(100).setIsNullable(true).build())
+ .addColumn(newLenientVarcharBuilder("period2_mode").setLimit(100).setIsNullable(true).build())
+ .addColumn(newLenientVarcharBuilder("period2_param").setLimit(100).setIsNullable(true).build())
+ .addColumn(newLenientVarcharBuilder("period3_mode").setLimit(100).setIsNullable(true).build())
+ .addColumn(newLenientVarcharBuilder("period3_param").setLimit(100).setIsNullable(true).build())
+ .addColumn(newLenientVarcharBuilder("period4_mode").setLimit(100).setIsNullable(true).build())
+ .addColumn(newLenientVarcharBuilder("period4_param").setLimit(100).setIsNullable(true).build())
+ .addColumn(newLenientVarcharBuilder("period5_mode").setLimit(100).setIsNullable(true).build())
+ .addColumn(newLenientVarcharBuilder("period5_param").setLimit(100).setIsNullable(true).build())
+ .addColumn(newBigIntegerColumnDefBuilder().setColumnName("period1_date").setIsNullable(true).build())
+ .addColumn(newBigIntegerColumnDefBuilder().setColumnName("period2_date").setIsNullable(true).build())
+ .addColumn(newBigIntegerColumnDefBuilder().setColumnName("period3_date").setIsNullable(true).build())
+ .addColumn(newBigIntegerColumnDefBuilder().setColumnName("period4_date").setIsNullable(true).build())
+ .addColumn(newBigIntegerColumnDefBuilder().setColumnName("period5_date").setIsNullable(true).build())
+ .addColumn(newBigIntegerColumnDefBuilder().setColumnName("created_at").setIsNullable(true).build())
+ .build());
+ addIndex(context, tableName, "analyses_uuid", true, uuidCol);
+ addIndex(context, tableName, "snapshot_component", false, componentUuidCol);
+ }
+
+ private void createUserProperties(Context context) {
+ String tableName = "user_properties";
+ VarcharColumnDef userUuidCol = newVarcharColumnBuilder("user_uuid").setLimit(255).setIsNullable(false).build();
+ VarcharColumnDef keyCol = newVarcharColumnBuilder("kee").setLimit(100).setIsNullable(false).build();
+ context.execute(newTableBuilder(tableName)
+ .addPkColumn(newVarcharColumnBuilder("uuid").setLimit(UUID_SIZE).setIsNullable(false).build())
+ .addColumn(userUuidCol)
+ .addColumn(keyCol)
+ .addColumn(newVarcharColumnBuilder("text_value").setLimit(4_000).setIsNullable(false).build())
+ .addColumn(newBigIntegerColumnDefBuilder().setColumnName("created_at").setIsNullable(false).build())
+ .addColumn(newBigIntegerColumnDefBuilder().setColumnName("updated_at").setIsNullable(false).build())
+ .build());
+ addIndex(context, tableName, "user_properties_user_uuid_kee", true, userUuidCol, keyCol);
+ }
+
+ private void createUserRoles(Context context) {
+ String tableName = "user_roles";
+ IntegerColumnDef userIdCol = newIntegerColumnDefBuilder().setColumnName("user_id").setIsNullable(true).build();
+ IntegerColumnDef resourceIdCol = newIntegerColumnDefBuilder().setColumnName("resource_id").setIsNullable(true).build();
+ context.execute(
+ newTableBuilder(tableName)
+ .addPkColumn(newIntegerColumnDefBuilder().setColumnName("id").setIsNullable(false).build(), AUTO_INCREMENT)
+ .addColumn(newLenientVarcharBuilder("organization_uuid").setLimit(UUID_SIZE).setIsNullable(false).build())
+ .addColumn(userIdCol)
+ .addColumn(resourceIdCol)
+ .addColumn(newLenientVarcharBuilder("role").setLimit(64).setIsNullable(false).build())
+ .build());
+ addIndex(context, tableName, "user_roles_resource", false, resourceIdCol);
+ addIndex(context, tableName, "user_roles_user", false, userIdCol);
+ }
+
+ private void createUserTokens(Context context) {
+ String tableName = "user_tokens";
+ VarcharColumnDef userUuidCol = newVarcharColumnBuilder("user_uuid").setLimit(255).setIsNullable(false).build();
+ VarcharColumnDef nameCol = newVarcharColumnBuilder("name").setLimit(100).setIsNullable(false).build();
+ VarcharColumnDef tokenHashCol = newVarcharColumnBuilder("token_hash").setLimit(255).setIsNullable(false).build();
+ context.execute(
+ newTableBuilder(tableName)
+ .addPkColumn(newIntegerColumnDefBuilder().setColumnName("id").setIsNullable(false).build(), AUTO_INCREMENT)
+ .addColumn(userUuidCol)
+ .addColumn(nameCol)
+ .addColumn(tokenHashCol)
+ .addColumn(newBigIntegerColumnDefBuilder().setColumnName("last_connection_date").setIsNullable(true).build())
+ .addColumn(newBigIntegerColumnDefBuilder().setColumnName("created_at").setIsNullable(false).build())
+ .build());
+ addIndex(context, tableName, "user_tokens_user_uuid_name", true, userUuidCol, nameCol);
+ addIndex(context, tableName, "user_tokens_token_hash", true, tokenHashCol);
+ }
+
+ private void createUsers(Context context) {
+ String tableName = "users";
+ VarcharColumnDef uuidCol = newVarcharColumnBuilder("uuid").setLimit(255).setIsNullable(false).build();
+ VarcharColumnDef loginCol = newLenientVarcharBuilder("login").setLimit(255).setIsNullable(false).build();
+ BigIntegerColumnDef updatedAtCol = newBigIntegerColumnDefBuilder().setColumnName("updated_at").setIsNullable(true).build();
+ VarcharColumnDef externalLoginCol = newLenientVarcharBuilder("external_login").setLimit(255).setIsNullable(false).build();
+ VarcharColumnDef externalIdentityProviderCol = newLenientVarcharBuilder("external_identity_provider").setLimit(100).setIsNullable(false).build();
+ VarcharColumnDef externalIdCol = newVarcharColumnBuilder("external_id").setLimit(255).setIsNullable(false).build();
+ context.execute(
+ newTableBuilder(tableName)
+ .addPkColumn(newIntegerColumnDefBuilder().setColumnName("id").setIsNullable(false).build(), AUTO_INCREMENT)
+ .addColumn(uuidCol)
+ .addColumn(loginCol)
+ .addColumn(newVarcharColumnBuilder("organization_uuid").setLimit(UUID_SIZE).setIsNullable(true).build())
+ .addColumn(newLenientVarcharBuilder("name").setLimit(200).setIsNullable(true).build())
+ .addColumn(newLenientVarcharBuilder("email").setLimit(100).setIsNullable(true).build())
+ .addColumn(newLenientVarcharBuilder("crypted_password").setLimit(100).setIsNullable(true).build())
+ .addColumn(newLenientVarcharBuilder("salt").setLimit(40).setIsNullable(true).build())
+ .addColumn(newVarcharColumnBuilder("hash_method").setLimit(10).setIsNullable(true).build())
+ .addColumn(newBooleanColumnDefBuilder().setColumnName("active").setDefaultValue(true).setIsNullable(true).build())
+ .addColumn(newLenientVarcharBuilder("scm_accounts").setLimit(MAX_SIZE).build())
+ .addColumn(externalLoginCol)
+ .addColumn(externalIdentityProviderCol)
+ .addColumn(externalIdCol)
+ .addColumn(newBooleanColumnDefBuilder().setColumnName("is_root").setIsNullable(false).build())
+ .addColumn(newBooleanColumnDefBuilder().setColumnName("user_local").setIsNullable(true).build())
+ .addColumn(newBooleanColumnDefBuilder().setColumnName("onboarded").setIsNullable(false).build())
+ .addColumn(newVarcharColumnBuilder("homepage_type").setLimit(40).setIsNullable(true).build())
+ .addColumn(newVarcharColumnBuilder("homepage_parameter").setLimit(40).setIsNullable(true).build())
+ .addColumn(newBigIntegerColumnDefBuilder().setColumnName("last_connection_date").setIsNullable(true).build())
+ .addColumn(newBigIntegerColumnDefBuilder().setColumnName("created_at").setIsNullable(true).build())
+ .addColumn(updatedAtCol)
+ .build());
+ addIndex(context, tableName, "users_login", true, loginCol);
+ addIndex(context, tableName, "users_updated_at", false, updatedAtCol);
+ addIndex(context, tableName, "users_uuid", true, uuidCol);
+ addIndex(context, tableName, "uniq_external_id", true, externalIdentityProviderCol, externalIdCol);
+ addIndex(context, tableName, "uniq_external_login", true, externalIdentityProviderCol, externalLoginCol);
+ }
+
+ private void createWebhookDeliveries(Context context) {
+ String tableName = "webhook_deliveries";
+ VarcharColumnDef componentUuidColumn = newLenientVarcharBuilder("component_uuid").setLimit(UUID_SIZE).setIsNullable(false).build();
+ VarcharColumnDef ceTaskUuidColumn = newLenientVarcharBuilder("ce_task_uuid").setLimit(UUID_SIZE).setIsNullable(true).build();
+ context.execute(newTableBuilder(tableName)
+ .addPkColumn(newLenientVarcharBuilder("uuid").setLimit(UUID_SIZE).setIsNullable(false).build())
+ .addColumn(newVarcharColumnBuilder("webhook_uuid").setLimit(UUID_SIZE).setIsNullable(false).build())
+ .addColumn(componentUuidColumn)
+ .addColumn(ceTaskUuidColumn)
+ .addColumn(newVarcharColumnBuilder("analysis_uuid").setLimit(UUID_SIZE).setIsNullable(true).build())
+ .addColumn(newLenientVarcharBuilder("name").setLimit(100).setIsNullable(false).build())
+ .addColumn(newLenientVarcharBuilder("url").setLimit(2_000).setIsNullable(false).build())
+ .addColumn(newBooleanColumnDefBuilder().setColumnName("success").setIsNullable(false).build())
+ .addColumn(newIntegerColumnDefBuilder().setColumnName("http_status").setIsNullable(true).build())
+ .addColumn(newBigIntegerColumnDefBuilder().setColumnName("duration_ms").setIsNullable(false).build())
+ .addColumn(newClobColumnDefBuilder().setColumnName("payload").setIsNullable(false).build())
+ .addColumn(newClobColumnDefBuilder().setColumnName("error_stacktrace").setIsNullable(true).build())
+ .addColumn(newBigIntegerColumnDefBuilder().setColumnName("created_at").setIsNullable(false).build())
+ .build());
+ addIndex(context, tableName, "component_uuid", false, componentUuidColumn);
+ addIndex(context, tableName, "ce_task_uuid", false, ceTaskUuidColumn);
+ }
+
+ private void createWebhooks(Context context) {
+ String tableName = "webhooks";
+ VarcharColumnDef organizationUuidCol = newVarcharColumnBuilder("organization_uuid").setLimit(UUID_SIZE).setIsNullable(true).build();
+ VarcharColumnDef projectUuidCol = newVarcharColumnBuilder("project_uuid").setLimit(UUID_SIZE).setIsNullable(true).build();
+ context.execute(newTableBuilder(tableName)
+ .addPkColumn(newVarcharColumnBuilder("uuid").setLimit(UUID_SIZE).setIsNullable(false).build())
+ .addColumn(organizationUuidCol)
+ .addColumn(projectUuidCol)
+ .addColumn(newVarcharColumnBuilder("name").setLimit(100).setIsNullable(false).build())
+ .addColumn(newVarcharColumnBuilder("url").setLimit(2_000).setIsNullable(false).build())
+ .addColumn(newVarcharColumnBuilder("secret").setLimit(200).setIsNullable(true).build())
+ .addColumn(newBigIntegerColumnDefBuilder().setColumnName("created_at").setIsNullable(false).build())
+ .addColumn(newBigIntegerColumnDefBuilder().setColumnName("updated_at").setIsNullable(true).build())
+ .build());
+ addIndex(context, tableName, "organization_webhook", false, organizationUuidCol);
+ addIndex(context, tableName, "project_webhook", false, projectUuidCol);
+ }
+
+ private static void addIndex(Context context, String table, String index, boolean unique, ColumnDef... columns) {
+ CreateIndexBuilder builder = new CreateIndexBuilder()
+ .setTable(table)
+ .setName(index)
+ .setUnique(unique);
+ for (ColumnDef column : columns) {
+ builder.addColumn(column);
+ }
+ context.execute(builder.build());
+ }
+
+ private static VarcharColumnDef.Builder newLenientVarcharBuilder(String column) {
+ return new VarcharColumnDef.Builder().setColumnName(column).setIgnoreOracleUnit(true);
+ }
+
+ private static VarcharColumnDef.Builder newVarcharColumnBuilder(String column) {
+ return newVarcharColumnDefBuilder().setColumnName(column);
+ }
+
+ private CreateTableBuilder newTableBuilder(String tableName) {
+ return new CreateTableBuilder(getDialect(), tableName);
+ }
+}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v79/DbVersion79.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v79/DbVersion79.java
index 39f8bf26db1..741aa24b9d5 100644
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v79/DbVersion79.java
+++ b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v79/DbVersion79.java
@@ -26,11 +26,7 @@ public class DbVersion79 implements DbVersion {
@Override
public void addSteps(MigrationStepRegistry registry) {
registry
- .add(2800, "Truncate environment variables and system properties from existing scanner reports",
- TruncateEnvAndSystemVarsFromScannerContext.class)
- .add(2801, "populate install version and install date internal properties", PopulateInstallDateAndVersion.class)
- .add(2802, "Migrate property 'sonar.pullrequest.provider' value from VSTS to Azure DevOps", MigrateVstsProviderToAzureDevOps.class)
- .add(2803, "Remove quality gate conditions on Security Review Rating", RemoveQGConditionsOnSecurityReviewRating.class)
- .add(2804, "Reindex issues and rules to take into account latest categories definition", ReindexIssuesAndRules.class);
+ .add(1, "Create initial schema", CreateInitialSchema.class)
+ .add(2, "Populate initial schema", PopulateInitialSchema.class);
}
}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v79/MigrateVstsProviderToAzureDevOps.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v79/MigrateVstsProviderToAzureDevOps.java
deleted file mode 100644
index 23a6bd06a28..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v79/MigrateVstsProviderToAzureDevOps.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v79;
-
-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;
-import org.sonar.server.platform.db.migration.step.MassUpdate;
-
-@SupportsBlueGreen
-public class MigrateVstsProviderToAzureDevOps extends DataChange {
-
- private static final String VSTS = "VSTS";
- private static final String VSTS_TFS = "VSTS / TFS";
-
- public MigrateVstsProviderToAzureDevOps(Database db) {
- super(db);
- }
-
- @Override
- protected void execute(Context context) throws SQLException {
- MassUpdate massUpdate = context.prepareMassUpdate();
- massUpdate.select("select id, text_value from properties " +
- " where prop_key = 'sonar.pullrequest.provider' and text_value in ('" + VSTS + "', '" + VSTS_TFS + "')");
- massUpdate.update("update properties " +
- " set text_value= ?, " +
- " clob_value = null " +
- " where id = ?");
- massUpdate.rowPluralName("PR provider properties");
- massUpdate.execute((row, update) -> {
- update.setString(1, convert(row.getString(2)));
- update.setLong(2, row.getLong(1));
- return true;
- });
- }
-
- private static String convert(String oldValue) {
- switch (oldValue) {
- case VSTS:
- return "Azure DevOps Services";
- case VSTS_TFS:
- return "Azure DevOps";
- default:
- throw new IllegalStateException("Unexpected value: " + oldValue);
- }
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v79/PopulateInitialSchema.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v79/PopulateInitialSchema.java
new file mode 100644
index 00000000000..4d18e3bfa84
--- /dev/null
+++ b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v79/PopulateInitialSchema.java
@@ -0,0 +1,276 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2019 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package org.sonar.server.platform.db.migration.version.v79;
+
+import java.sql.SQLException;
+import java.util.Arrays;
+import java.util.Date;
+import java.util.List;
+import org.sonar.api.SonarRuntime;
+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.Upsert;
+
+public class PopulateInitialSchema extends DataChange {
+
+ private static final String ADMINS_GROUP = "sonar-administrators";
+ private static final String USERS_GROUP = "sonar-users";
+ private static final String ADMIN_USER = "admin";
+ private static final List ADMIN_ROLES = Arrays.asList("admin", "profileadmin", "gateadmin", "provisioning", "applicationcreator", "portfoliocreator");
+
+ private final System2 system2;
+ private final UuidFactory uuidFactory;
+ private final SonarRuntime sonarRuntime;
+
+ public PopulateInitialSchema(Database db, System2 system2, UuidFactory uuidFactory, SonarRuntime sonarRuntime) {
+ super(db);
+ this.system2 = system2;
+ this.uuidFactory = uuidFactory;
+ this.sonarRuntime = sonarRuntime;
+ }
+
+ @Override
+ public void execute(Context context) throws SQLException {
+ String organizationUuid = uuidFactory.create();
+
+ int adminUserId = insertAdminUser(context);
+ Groups groups = insertGroups(context, organizationUuid);
+ String defaultQGUuid = insertQualityGate(context);
+ insertOrganization(context, organizationUuid, groups, defaultQGUuid);
+ insertOrgQualityGate(context, organizationUuid, defaultQGUuid);
+ insertInternalProperty(context, organizationUuid);
+ insertGroupRoles(context, organizationUuid, groups);
+ insertGroupUsers(context, adminUserId, groups);
+ insertOrganizationMember(context, adminUserId, organizationUuid);
+ }
+
+ private int insertAdminUser(Context context) throws SQLException {
+ truncateTable(context, "users");
+
+ long now = system2.now();
+ context.prepareUpsert("insert into users " +
+ "(uuid, login, name, email, external_id, external_login, external_identity_provider, user_local, crypted_password, salt, hash_method, is_root, onboarded, created_at, updated_at)"
+ +
+ " values " +
+ "(?, ?, 'Administrator', null, 'admin', 'admin', 'sonarqube', ?, '$2a$12$uCkkXmhW5ThVK8mpBvnXOOJRLd64LJeHTeCkSuB3lfaR2N0AYBaSi', null, 'BCRYPT', ?, ?, ?, ?)")
+ .setString(1, uuidFactory.create())
+ .setString(2, ADMIN_USER)
+ .setBoolean(3, true)
+ .setBoolean(4, false)
+ .setBoolean(5, true)
+ .setLong(6, now)
+ .setLong(7, now)
+ .execute()
+ .commit();
+
+ return context.prepareSelect("select id from users where login=?")
+ .setString(1, ADMIN_USER)
+ .get(t -> t.getInt(1));
+ }
+
+ private void insertOrganization(Context context, String organizationUuid, Groups groups, String defaultQGUuid) throws SQLException {
+ truncateTable(context, "organizations");
+
+ long now = system2.now();
+ context.prepareUpsert("insert into organizations " +
+ "(uuid, kee, name, guarded, new_project_private, default_group_id, default_quality_gate_uuid, subscription, created_at, updated_at)" +
+ " values " +
+ "(?, 'default-organization', 'Default Organization', ?, ?, ?, ?, 'SONARQUBE', ?, ?)")
+ .setString(1, organizationUuid)
+ .setBoolean(2, true)
+ .setBoolean(3, false)
+ .setInt(4, groups.getUserGroupId())
+ .setString(5, defaultQGUuid)
+ .setLong(6, now)
+ .setLong(7, now)
+ .execute()
+ .commit();
+ }
+
+ private void insertOrgQualityGate(Context context, String organizationUuid, String defaultQGUuid) throws SQLException {
+ truncateTable(context, "org_quality_gates");
+
+ context.prepareUpsert("insert into org_quality_gates " +
+ "(uuid, organization_uuid, quality_gate_uuid)" +
+ " values " +
+ "(?, ?, ?)")
+ .setString(1, uuidFactory.create())
+ .setString(2, organizationUuid)
+ .setString(3, defaultQGUuid)
+ .execute()
+ .commit();
+ }
+
+ private void insertInternalProperty(Context context, String organizationUuid) throws SQLException {
+ truncateTable(context, "internal_properties");
+
+ long now = system2.now();
+ Upsert upsert = context.prepareUpsert("insert into internal_properties " +
+ "(kee, is_empty, text_value, created_at)" +
+ " values" +
+ " (?, ?, ?, ?)");
+ upsert
+ .setString(1, "organization.default")
+ .setBoolean(2, false)
+ .setString(3, organizationUuid)
+ .setLong(4, now)
+ .addBatch();
+ upsert
+ .setString(1, "installation.date")
+ .setBoolean(2, false)
+ .setString(3, String.valueOf(system2.now()))
+ .setLong(4, now)
+ .addBatch();
+ upsert
+ .setString(1, "installation.version")
+ .setBoolean(2, false)
+ .setString(3, sonarRuntime.getApiVersion().toString())
+ .setLong(4, now)
+ .addBatch();
+ upsert
+ .execute()
+ .commit();
+ }
+
+ private Groups insertGroups(Context context, String organizationUuid) throws SQLException {
+ truncateTable(context, "groups");
+
+ Date now = new Date(system2.now());
+ Upsert upsert = context.prepareUpsert("insert into groups (organization_uuid, name, description, created_at, updated_at) values (?, ?, ?, ?, ?)");
+ upsert
+ .setString(1, organizationUuid)
+ .setString(2, ADMINS_GROUP)
+ .setString(3, "System administrators")
+ .setDate(4, now)
+ .setDate(5, now)
+ .addBatch();
+ upsert
+ .setString(1, organizationUuid)
+ .setString(2, USERS_GROUP)
+ .setString(3, "Any new users created will automatically join this group")
+ .setDate(4, now)
+ .setDate(5, now)
+ .addBatch();
+ upsert
+ .execute()
+ .commit();
+
+ return new Groups(getGroupId(context, ADMINS_GROUP), getGroupId(context, USERS_GROUP));
+ }
+
+ private static int getGroupId(Context context, String groupName) throws SQLException {
+ return context.prepareSelect("select id from groups where name=?")
+ .setString(1, groupName)
+ .get(t -> t.getInt(1));
+ }
+
+ private String insertQualityGate(Context context) throws SQLException {
+ truncateTable(context, "quality_gates");
+
+ String uuid = uuidFactory.create();
+ Date now = new Date(system2.now());
+ context.prepareUpsert("insert into quality_gates " +
+ "(uuid, name, is_built_in, created_at, updated_at)" +
+ " values " +
+ "(?, 'Sonar way', ?, ?, ?)")
+ .setString(1, uuid)
+ .setBoolean(2, true)
+ .setDate(3, now)
+ .setDate(4, now)
+ .execute()
+ .commit();
+ return uuid;
+ }
+
+ private static final class Groups {
+ private final int adminGroupId;
+ private final int userGroupId;
+
+ private Groups(int adminGroupId, int userGroupId) {
+ this.adminGroupId = adminGroupId;
+ this.userGroupId = userGroupId;
+ }
+
+ public int getAdminGroupId() {
+ return adminGroupId;
+ }
+
+ public int getUserGroupId() {
+ return userGroupId;
+ }
+ }
+
+ private static void insertGroupRoles(Context context, String organizationUuid, Groups groups) throws SQLException {
+ truncateTable(context, "group_roles");
+
+ Upsert upsert = context.prepareUpsert("insert into group_roles (organization_uuid, group_id, role) values (?, ?, ?)");
+ for (String adminRole : ADMIN_ROLES) {
+ upsert
+ .setString(1, organizationUuid)
+ .setInt(2, groups.getAdminGroupId())
+ .setString(3, adminRole)
+ .addBatch();
+ }
+ for (String anyoneRole : Arrays.asList("scan", "provisioning")) {
+ upsert
+ .setString(1, organizationUuid)
+ .setInt(2, null)
+ .setString(3, anyoneRole)
+ .addBatch();
+ }
+ upsert
+ .execute()
+ .commit();
+ }
+
+ private static void insertGroupUsers(Context context, int adminUserId, Groups groups) throws SQLException {
+ truncateTable(context, "groups_users");
+
+ Upsert upsert = context.prepareUpsert("insert into groups_users (user_id, group_id) values (?,?)");
+ upsert
+ .setInt(1, adminUserId)
+ .setInt(2, groups.getUserGroupId())
+ .addBatch();
+ upsert
+ .setInt(1, adminUserId)
+ .setInt(2, groups.getAdminGroupId())
+ .addBatch();
+ upsert
+ .execute()
+ .commit();
+ }
+
+ private static void insertOrganizationMember(Context context, int adminUserId, String organizationUuid) throws SQLException {
+ truncateTable(context, "organization_members");
+
+ context.prepareUpsert("insert into organization_members(organization_uuid, user_id) values (?, ?)")
+ .setString(1, organizationUuid)
+ .setInt(2, adminUserId)
+ .execute()
+ .commit();
+ }
+
+ private static void truncateTable(Context context, String table) throws SQLException {
+ context.prepareUpsert("truncate table " + table).execute().commit();
+ }
+
+}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v79/PopulateInstallDateAndVersion.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v79/PopulateInstallDateAndVersion.java
deleted file mode 100644
index 14b1b9624d3..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v79/PopulateInstallDateAndVersion.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v79;
-
-import java.sql.SQLException;
-import org.sonar.api.SonarRuntime;
-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;
-
-@SupportsBlueGreen
-public class PopulateInstallDateAndVersion extends DataChange {
-
- private static final Logger LOG = Loggers.get(PopulateInstallDateAndVersion.class);
- private static final String INSTALLATION_DATE = "installation.date";
- private static final String INSTALLATION_VERSION = "installation.version";
- private final SonarRuntime sonarRuntime;
- private final System2 system2;
-
- public PopulateInstallDateAndVersion(Database db, SonarRuntime sonarRuntime, System2 system2) {
- super(db);
- this.sonarRuntime = sonarRuntime;
- this.system2 = system2;
- }
-
- @Override
- protected void execute(Context context) throws SQLException {
- removeProperties(context);
- Long createdAt = context.prepareSelect("select min(created_at) from users where created_at is not null")
- .get(row -> row.getLong(1));
- if (createdAt != null && createdAt != 0) {
- populateInstallationDate(context, createdAt);
- populateInstallationVersion(context, createdAt);
- }
- }
-
- private void populateInstallationDate(Context context, Long createdAt) throws SQLException {
- insertInternalProperty(context, INSTALLATION_DATE, String.valueOf(createdAt));
- }
-
- private void populateInstallationVersion(Context context, Long createdAt) throws SQLException {
- if (Math.abs(system2.now() - createdAt) / 60 / 60 / 1000 <= 24) {
- String apiVersion = sonarRuntime.getApiVersion().toString();
- insertInternalProperty(context, INSTALLATION_VERSION, apiVersion);
- } else {
- // if the difference between now and smallest account creation date is more than a day, we consider that this is a
- // start with an existing SQ, and not a fresh start. in this case, we do not populate the internalProperty,
- // as there is no way to know the original SQ installation version.
- LOG.warn("skipping " + INSTALLATION_VERSION + " because we cannot determine what is the installation version.");
- }
- }
-
- private void insertInternalProperty(Context context, String key, String value) throws SQLException {
- context.prepareUpsert("insert into internal_properties (kee, is_empty, text_value, clob_value, created_at) VALUES (?, ?, ?, ?, ?)")
- .setString(1, key)
- .setBoolean(2, false)
- .setString(3, value)
- .setString(4, null)
- .setLong(5, system2.now())
- .execute().commit().close();
- }
-
- private static void removeProperties(Context context) throws SQLException {
- context.prepareUpsert("delete from internal_properties where kee = ? or kee = ?")
- .setString(1, INSTALLATION_DATE)
- .setString(2, INSTALLATION_VERSION)
- .execute().commit().close();
-
- }
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v79/ReindexIssuesAndRules.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v79/ReindexIssuesAndRules.java
deleted file mode 100644
index a9eefedfa63..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v79/ReindexIssuesAndRules.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v79;
-
-import java.sql.SQLException;
-import org.sonar.api.config.Configuration;
-import org.sonar.db.Database;
-import org.sonar.server.platform.db.migration.SupportsBlueGreen;
-import org.sonar.server.platform.db.migration.es.MigrationEsClient;
-import org.sonar.server.platform.db.migration.step.DataChange;
-
-@SupportsBlueGreen
-public class ReindexIssuesAndRules extends DataChange {
-
- private final Configuration configuration;
- private final MigrationEsClient esClient;
-
- public ReindexIssuesAndRules(Database db, Configuration configuration, MigrationEsClient esClient) {
- super(db);
- this.configuration = configuration;
- this.esClient = esClient;
- }
-
- @Override
- public void execute(Context context) throws SQLException {
- if (configuration.getBoolean("sonar.sonarcloud.enabled").orElse(false)) {
- return;
- }
- esClient.deleteIndexes("issues", "rules");
- }
-
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v79/RemoveQGConditionsOnSecurityReviewRating.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v79/RemoveQGConditionsOnSecurityReviewRating.java
deleted file mode 100644
index 53ca0613b9c..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v79/RemoveQGConditionsOnSecurityReviewRating.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v79;
-
-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;
-import org.sonar.server.platform.db.migration.step.MassUpdate;
-
-@SupportsBlueGreen
-public class RemoveQGConditionsOnSecurityReviewRating extends DataChange {
-
- public RemoveQGConditionsOnSecurityReviewRating(Database db) {
- super(db);
- }
-
- @Override
- protected void execute(Context context) throws SQLException {
- MassUpdate massUpdate = context.prepareMassUpdate().rowPluralName("quality gate conditions on security review rating");
- massUpdate.select("SELECT qgc.id FROM quality_gate_conditions qgc " +
- "INNER JOIN metrics m on m.id=qgc.metric_id " +
- "WHERE m.name='security_review_rating'");
- massUpdate.update("DELETE FROM quality_gate_conditions WHERE id=?");
- massUpdate.execute((row, update) -> {
- update.setLong(1, row.getLong(1));
- return true;
- });
- }
-
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v79/TruncateEnvAndSystemVarsFromScannerContext.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v79/TruncateEnvAndSystemVarsFromScannerContext.java
deleted file mode 100644
index 1815b52e6d8..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v79/TruncateEnvAndSystemVarsFromScannerContext.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v79;
-
- import java.nio.charset.StandardCharsets;
- 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;
- 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;
-
-@SupportsBlueGreen
-public class TruncateEnvAndSystemVarsFromScannerContext extends DataChange {
-
- public TruncateEnvAndSystemVarsFromScannerContext(Database db) {
- super(db);
- }
-
- @Override
- protected void execute(Context context) throws SQLException {
- MassUpdate massUpdate = context.prepareMassUpdate();
- massUpdate.select("select task_uuid, context_data from ce_scanner_context sc");
- massUpdate.update("update ce_scanner_context set context_data = ? where task_uuid = ?");
- massUpdate.rowPluralName("truncate scanner context content");
- massUpdate.execute(TruncateEnvAndSystemVarsFromScannerContext::truncateScannerContext);
- }
-
- private static boolean truncateScannerContext(Select.Row row, SqlStatement update) throws SQLException {
- String taskUuid = row.getString(1);
- byte[] bytes = row.getBytes(2);
- String reportContent = new String(bytes, StandardCharsets.UTF_8);
- int startIndex = reportContent.indexOf("SonarQube plugins:");
- if (startIndex != -1) {
- reportContent = reportContent.substring(startIndex);
- }
- update.setBytes(1, reportContent.getBytes(StandardCharsets.UTF_8));
- update.setString(2, taskUuid);
- return true;
- }
-}
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 4dbc9a9f8f8..4244868b614 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
@@ -37,7 +37,7 @@ public class MigrationConfigurationModuleTest {
assertThat(container.getPicoContainer().getComponentAdapters())
.hasSize(COMPONENTS_IN_EMPTY_COMPONENT_CONTAINER
// DbVersion classes
- + 21
+ + 2
// Others
+ 4);
}
diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v63/DefaultOrganizationUuidProviderImplTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/DefaultOrganizationUuidProviderImplTest.java
similarity index 97%
rename from server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v63/DefaultOrganizationUuidProviderImplTest.java
rename to server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/DefaultOrganizationUuidProviderImplTest.java
index 7c395732887..5e529145414 100644
--- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v63/DefaultOrganizationUuidProviderImplTest.java
+++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/DefaultOrganizationUuidProviderImplTest.java
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-package org.sonar.server.platform.db.migration.version.v63;
+package org.sonar.server.platform.db.migration.version;
import java.sql.Connection;
import org.junit.Rule;
diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v63/TestDefaultOrganizationUuidProvider.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/TestDefaultOrganizationUuidProvider.java
similarity index 94%
rename from server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v63/TestDefaultOrganizationUuidProvider.java
rename to server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/TestDefaultOrganizationUuidProvider.java
index 8bc6f6afb77..5d736c0b33b 100644
--- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v63/TestDefaultOrganizationUuidProvider.java
+++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/TestDefaultOrganizationUuidProvider.java
@@ -17,9 +17,8 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-package org.sonar.server.platform.db.migration.version.v63;
+package org.sonar.server.platform.db.migration.version;
-import java.sql.SQLException;
import org.sonar.server.platform.db.migration.step.DataChange;
import static java.util.Objects.requireNonNull;
diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v56/DbVersion56Test.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v56/DbVersion56Test.java
deleted file mode 100644
index 2e42e537db8..00000000000
--- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v56/DbVersion56Test.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v56;
-
-import org.junit.Test;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.sonar.server.platform.db.migration.version.DbVersionTestUtils.verifyMigrationCount;
-import static org.sonar.server.platform.db.migration.version.DbVersionTestUtils.verifyMinimumMigrationNumber;
-
-public class DbVersion56Test {
- private DbVersion56 underTest = new DbVersion56();
-
- @Test
- public void verify_no_support_component() {
- assertThat(underTest.getSupportComponents()).isEmpty();
- }
-
- @Test
- public void migrationNumber_starts_at_1153() {
- verifyMinimumMigrationNumber(underTest, 1);
- }
-
- @Test
- public void verify_migration_count() {
- verifyMigrationCount(underTest, 2);
- }
-
-
-}
diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v56/PopulateInitialSchemaTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v56/PopulateInitialSchemaTest.java
deleted file mode 100644
index 64bbd0b0a44..00000000000
--- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v56/PopulateInitialSchemaTest.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2019 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v56;
-
-import java.sql.SQLException;
-import java.util.List;
-import java.util.Map;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.sonar.api.utils.System2;
-import org.sonar.core.util.stream.MoreCollectors;
-import org.sonar.db.CoreDbTester;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-public class PopulateInitialSchemaTest {
-
- private static final long NOW = 1_500L;
-
- @Rule
- public ExpectedException expectedException = ExpectedException.none();
-
- private System2 system2 = mock(System2.class);
-
- @Rule
- public CoreDbTester db = CoreDbTester.createForSchema(PopulateInitialSchemaTest.class, "v56.sql");
-
- private PopulateInitialSchema underTest = new PopulateInitialSchema(db.database(), system2);
-
- @Test
- public void migration_inserts_users_and_groups() throws SQLException {
- when(system2.now()).thenReturn(NOW);
-
- underTest.execute();
-
- verifyGroup("sonar-administrators", "System administrators");
- verifyGroup("sonar-users", "Any new users created will automatically join this group");
- verifyRolesOfAdminsGroup();
- verifyRolesOfUsersGroup();
- verifyRolesOfAnyone();
- verifyAdminUser();
- verifyMembershipOfAdminUser();
- }
-
- private void verifyRolesOfAdminsGroup() {
- List roles = selectRoles("sonar-administrators");
- assertThat(roles).containsOnly("admin", "profileadmin", "gateadmin", "shareDashboard", "provisioning");
- }
-
- private void verifyRolesOfUsersGroup() {
- assertThat(selectRoles("sonar-users")).isEmpty();
- }
-
- private void verifyRolesOfAnyone() {
- List