diff --git a/pkg/migration/migrations/migrations.go b/pkg/migration/migrations/migrations.go index d584abbd0a24..2ae2209208b6 100644 --- a/pkg/migration/migrations/migrations.go +++ b/pkg/migration/migrations/migrations.go @@ -19,6 +19,7 @@ import ( "github.com/cockroachdb/cockroach/pkg/clusterversion" "github.com/cockroachdb/cockroach/pkg/migration" + "github.com/cockroachdb/errors" ) // GetMigration returns the migration corresponding to this version if @@ -72,12 +73,6 @@ var migrations = []migration.Migration{ NoPrecondition, fixDescriptorMigration, ), - migration.NewTenantMigration( - "add the system.statement_statistics and system.transaction_statistics tables", - toCV(clusterversion.SQLStatsTables), - NoPrecondition, - sqlStatsTablesMigration, - ), migration.NewTenantMigration( "add the system.database_role_settings table", toCV(clusterversion.DatabaseRoleSettings), @@ -139,10 +134,19 @@ var migrations = []migration.Migration{ NoPrecondition, tenantUsageSingleConsumptionColumn, ), + migration.NewTenantMigration( + "add the system.statement_statistics and system.transaction_statistics tables", + toCV(clusterversion.SQLStatsTables), + NoPrecondition, + sqlStatsTablesMigration, + ), } func init() { for _, m := range migrations { + if _, exists := registry[m.ClusterVersion()]; exists { + panic(errors.AssertionFailedf("duplicate migration registration for %v", m.ClusterVersion())) + } registry[m.ClusterVersion()] = m } }