@@ -388,14 +388,6 @@ func ensureUniqueCompositeIndex(db *gorm.DB, model interface{}, indexName string
388388 }
389389}
390390
391- // This helper function enforces a composite unique index on a given model.
392- // Refer to ensureUniqueCompositeIndex for details.
393- // func ensureIndex(db *gorm.DB, model interface{}, indexName string) {
394- // if err := db.Migrator().CreateIndex(model, indexName); err != nil {
395- // glog.Fatalf("Failed to create index %s. Error: %s", indexName, err)
396- // }
397- // }
398-
399391func InitDBClient (initConnectionTimeout time.Duration ) * storage.DB {
400392 // Allowed driverName values:
401393 // 1) To use MySQL, use `mysql`
@@ -486,22 +478,18 @@ func InitDBClient(initConnectionTimeout time.Duration) *storage.DB {
486478 glog .Fatalf ("Failed to update the resource reference payload type. Error: %s" , response )
487479 }
488480
481+ // Manual AddForeignKey() and AddIndex() calls have been removed.
482+ // Both Methods are GORM v1 legacy which no longer exist in GORM v2.
483+ // Foreign key constraints are now defined and managed by GORM via struct tags 'constraint' and 'index'.
484+ // This ensures a single source of truth for schema definitions and avoids duplicate or out-of-sync DDL.
485+
486+ // The ensureUniqueCompositeIndex() method is called to replace the GORM v1 legacy AddUniqueIndex method.
489487 ensureUniqueCompositeIndex (db , & model.Pipeline {}, "namespace_name" )
490488 ensureUniqueCompositeIndex (db , & model.Experiment {}, "idx_name_namespace" )
491489 ensureUniqueCompositeIndex (db , & model.PipelineVersion {}, "idx_pipelineid_name" )
492490
493- // ensureIndex(db, &model.Run{}, "experimentuuid_createatinsec")
494- // ensureIndex(db, &model.Run{}, "experimentuuid_conditions_finishedatinsec")
495- // ensureIndex(db, &model.Run{}, "namespace_createatinsec")
496- // ensureIndex(db, &model.Run{}, "namespace_conditions_finishedatinsec")
497-
498- // Manual AddForeignKey() calls have been removed.
499- // Foreign key constraints are now defined and managed by GORM via struct tags 'constraint'
500- // on RunMetric.RunUUID, PipelineVersion.PipelineId, Task.RunUUID, etc.).
501- // This ensures a single source of truth for schema definitions and avoids duplicate or out-of-sync DDL.
502-
503491 // Removed invalid ModifyColumn on Job.WorkflowSpecManifest.
504- // This field never existed on Job; original reference likely confused with PipelineSpec.
492+ // This field does not exist on Job; original reference likely confused with PipelineSpec.
505493
506494 // Data backfill for pipeline_versions if this is the first time for
507495 // pipeline_versions to enter mlpipeline DB.
0 commit comments