Unistore: Add generation column (#102222)

This commit is contained in:
Ryan McKinley
2025-04-01 20:38:23 +03:00
committed by GitHub
parent cd30742616
commit 9c49c601f1
19 changed files with 194 additions and 87 deletions
@@ -152,7 +152,19 @@ func initResourceTables(mg *migrator.Migrator) string {
mg.AddMigration("Migrate DeletionMarkers to real Resource objects", &deletionMarkerMigrator{})
mg.AddMigration("Add index to resource_history for get trash", migrator.NewAddIndexMigration(resource_history_table, &migrator.Index{
Name: "IDX_resource_history_namespace_group_resource_action_version", Cols: []string{"namespace", "group", "resource", "action", "resource_version"}, Type: migrator.IndexType,
Name: "IDX_resource_history_namespace_group_resource_action_version",
Cols: []string{"namespace", "group", "resource", "action", "resource_version"},
Type: migrator.IndexType,
}))
// Add generation column so we can use it for more aggressive pruning
mg.AddMigration("Add generation to resource history", migrator.NewAddColumnMigration(resource_history_table, &migrator.Column{
Name: "generation", Type: migrator.DB_BigInt, Nullable: false, Default: "0",
}))
mg.AddMigration("Add generation index to resource history", migrator.NewAddIndexMigration(resource_history_table, &migrator.Index{
Cols: []string{"namespace", "group", "resource", "name", "generation"},
Type: migrator.IndexType,
Name: "IDX_resource_history_namespace_group_resource_name_generation",
}))
return marker