Cleanup old entries from resource_last_import_time table. (#112438)
* Cleanup old entries from resource_last_import_time table. * Add index for last_import_time column. * Address review feedback.
This commit is contained in:
@@ -116,7 +116,7 @@ func initResourceTables(mg *migrator.Migrator) string {
|
||||
},
|
||||
})
|
||||
|
||||
tables = append(tables, migrator.Table{
|
||||
resource_last_import_time := migrator.Table{
|
||||
Name: "resource_last_import_time",
|
||||
Columns: []*migrator.Column{
|
||||
{Name: "group", Type: migrator.DB_NVarchar, Length: 190, Nullable: false},
|
||||
@@ -125,7 +125,8 @@ func initResourceTables(mg *migrator.Migrator) string {
|
||||
{Name: "last_import_time", Type: migrator.DB_DateTime, Nullable: false},
|
||||
},
|
||||
PrimaryKeys: []string{"group", "resource", "namespace"},
|
||||
})
|
||||
}
|
||||
tables = append(tables, resource_last_import_time)
|
||||
|
||||
// Initialize all tables
|
||||
for t := range tables {
|
||||
@@ -178,5 +179,11 @@ func initResourceTables(mg *migrator.Migrator) string {
|
||||
Name: "IDX_resource_history_namespace_group_resource_name_generation",
|
||||
}))
|
||||
|
||||
mg.AddMigration("Add UQE_resource_last_import_time_last_import_time index", migrator.NewAddIndexMigration(resource_last_import_time, &migrator.Index{
|
||||
Cols: []string{"last_import_time"},
|
||||
Type: migrator.IndexType,
|
||||
Name: "UQE_resource_last_import_time_last_import_time",
|
||||
}))
|
||||
|
||||
return marker
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user