feat(ops): add usage_logs partitioning check at deployment startup
Add CheckUsageLogsPartitioning function that: - Checks if usage_logs table is partitioned - Warns with prominent banner if not partitioned and rows > 100K - Provides actionable guidance for manual partition migration This helps operators identify performance risks early and take appropriate action before data volume causes issues.
This commit is contained in:
@@ -362,7 +362,13 @@ func initializeDatabase(cfg *SetupConfig) error {
|
||||
|
||||
migrationCtx, cancel := context.WithTimeout(context.Background(), 60*time.Second)
|
||||
defer cancel()
|
||||
return repository.ApplyMigrations(migrationCtx, db)
|
||||
if err := repository.ApplyMigrations(migrationCtx, db); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// 检查 usage_logs 分区状态(仅在首次部署时提示)
|
||||
repository.CheckUsageLogsPartitioning(migrationCtx, db)
|
||||
return nil
|
||||
}
|
||||
|
||||
func createAdminUser(cfg *SetupConfig) (bool, string, error) {
|
||||
|
||||
Reference in New Issue
Block a user