Complete removal of migration_history system in favor of instance_setting based schema versioning. Changes: - Remove migration_history table creation from all LATEST.sql files - Delete all migration_history model and implementation files (~300 lines) - Remove FindMigrationHistoryList and UpsertMigrationHistory from Driver interface - Replace complex backward compatibility functions with simple version check - Update health check to use instance_setting instead of migration_history - Simplify checkMinimumUpgradeVersion to detect pre-v0.22 installations Breaking change: Users on versions < v0.22.0 (May 2024) must upgrade to v0.25.x first before upgrading to this version. Clear error message with upgrade instructions will be shown for old installations. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
25 lines
845 B
Go
25 lines
845 B
Go
package v1
|
|
|
|
import (
|
|
"context"
|
|
|
|
"google.golang.org/grpc/codes"
|
|
"google.golang.org/grpc/health/grpc_health_v1"
|
|
"google.golang.org/grpc/status"
|
|
)
|
|
|
|
func (s *APIV1Service) Check(ctx context.Context,
|
|
_ *grpc_health_v1.HealthCheckRequest) (*grpc_health_v1.HealthCheckResponse, error) {
|
|
// Check if database is initialized by verifying instance basic setting exists
|
|
instanceBasicSetting, err := s.Store.GetInstanceBasicSetting(ctx)
|
|
if err != nil {
|
|
return nil, status.Errorf(codes.Unavailable, "database not initialized: %v", err)
|
|
}
|
|
|
|
// Verify schema version is set (empty means database not properly initialized)
|
|
if instanceBasicSetting.SchemaVersion == "" {
|
|
return nil, status.Errorf(codes.Unavailable, "schema version not set")
|
|
}
|
|
|
|
return &grpc_health_v1.HealthCheckResponse{Status: grpc_health_v1.HealthCheckResponse_SERVING}, nil
|
|
}
|