@@ -373,7 +373,6 @@ func InitDBClient(initConnectionTimeout time.Duration) *storage.DB {
373373		glog .Fatalf ("Failed to initialize the databases. Error: %s" , response .Error )
374374	}
375375
376- 
377376	response  =  db .Migrator ().DropIndex (& model.Experiment {}, "Name" )
378377	if  response  !=  nil  {
379378		glog .Fatalf ("Failed to drop unique key on experiment name. Error: %s" , response )
@@ -396,23 +395,15 @@ func InitDBClient(initConnectionTimeout time.Duration) *storage.DB {
396395	//   – namespace_createatinsec 
397396	//   – namespace_conditions_finishedatinsec 
398397	//   – name_namespace_index 
399- 	// See the `index:` and `uniqueIndex:` tags in model.Run, model.RunDetails,  and model.Pipeline. 
398+ 	// See the `index:` and `uniqueIndex:` tags in model.Run and model.Pipeline. 
400399
401- 	switch  driverName  {
402- 	case  "pgx" :
403- 		db .Exec (`ALTER TABLE run_metrics ADD CONSTRAINT fk_run_metrics_runuuid FOREIGN KEY ("RunUUID") REFERENCES run_details("UUID") ON DELETE CASCADE ON UPDATE CASCADE` )
404- 		db .Exec (`ALTER TABLE pipeline_versions ADD CONSTRAINT fk_pipeline_versions_pipelineid FOREIGN KEY ("PipelineId") REFERENCES pipelines("UUID") ON DELETE CASCADE ON UPDATE CASCADE` )
405- 		db .Exec (`ALTER TABLE tasks ADD CONSTRAINT fk_tasks_runuuid FOREIGN KEY ("RunUUID") REFERENCES run_details("UUID") ON DELETE CASCADE ON UPDATE CASCADE` )
406- 	case  "mysql" :
407- 		db .Exec (`ALTER TABLE run_metrics ADD CONSTRAINT fk_run_metrics_runuuid FOREIGN KEY (RunUUID) REFERENCES run_details(UUID) ON DELETE CASCADE ON UPDATE CASCADE` )
408- 		db .Exec (`ALTER TABLE pipeline_versions ADD CONSTRAINT fk_pipeline_versions_pipelineid FOREIGN KEY (PipelineId) REFERENCES pipelines(UUID) ON DELETE CASCADE ON UPDATE CASCADE` )
409- 		db .Exec (`ALTER TABLE tasks ADD CONSTRAINT fk_tasks_runuuid FOREIGN KEY (RunUUID) REFERENCES run_details(UUID) ON DELETE CASCADE ON UPDATE CASCADE` )
400+ 	// Manual ALTER TABLE … ADD CONSTRAINT calls have been removed. 
401+ 	// Foreign key constraints are now defined and managed by GORM via struct tags 
402+ 	// on RunMetric.RunUUID, PipelineVersion.PipelineId, Task.RunUUID, etc.).  
403+ 	// This ensures a single source of truth for schema definitions and avoids duplicate or out-of-sync DDL. 
410404
411- 		// Removed invalid ModifyColumn on Job.WorkflowSpecManifest. 
412- 		// This field never existed on Job; original reference likely confused with PipelineSpec. 
413- 	default :
414- 		glog .Fatalf ("Driver %v is not supported, use \" mysql\"  for MySQL, or \" pgx\"  for PostgreSQL" , driverName )
415- 	}
405+ 	// Removed invalid ModifyColumn on Job.WorkflowSpecManifest. 
406+ 	// This field never existed on Job; original reference likely confused with PipelineSpec. 
416407
417408	// Data backfill for pipeline_versions if this is the first time for 
418409	// pipeline_versions to enter mlpipeline DB. 
0 commit comments