diff --git a/pkg/api/mlflow/dao/models/experiment.go b/pkg/api/mlflow/dao/models/experiment.go index 192cc9564..2d5830e40 100644 --- a/pkg/api/mlflow/dao/models/experiment.go +++ b/pkg/api/mlflow/dao/models/experiment.go @@ -7,12 +7,12 @@ import ( // Experiment represents model to work with `experiments` table. type Experiment struct { ID *int32 `gorm:"column:experiment_id;not null;primaryKey"` - Name string `gorm:"type:varchar(256);not null;index:idx_namespace_name,unique"` + Name string `gorm:"type:varchar(256);not null;index:,unique,composite:name"` ArtifactLocation string `gorm:"type:varchar(256)"` LifecycleStage LifecycleStage `gorm:"type:varchar(32);check:lifecycle_stage IN ('active', 'deleted')"` CreationTime sql.NullInt64 `gorm:"type:bigint"` LastUpdateTime sql.NullInt64 `gorm:"type:bigint"` - NamespaceID uint `gorm:"index:idx_namespace_name,unique"` + NamespaceID uint `gorm:"index:,unique,composite:name"` Namespace Namespace Tags []ExperimentTag `gorm:"constraint:OnDelete:CASCADE"` Runs []Run `gorm:"constraint:OnDelete:CASCADE"` diff --git a/pkg/database/migrations/v_0006/migrate.go b/pkg/database/migrations/v_0006/migrate.go index 4268f3d73..c29549cfc 100644 --- a/pkg/database/migrations/v_0006/migrate.go +++ b/pkg/database/migrations/v_0006/migrate.go @@ -31,7 +31,7 @@ func Migrate(db *gorm.DB) error { if err := tx.Migrator().AlterColumn(&Experiment{}, "Name"); err != nil { return err } - if err := tx.Migrator().CreateIndex(&Experiment{}, "idx_namespace_name"); err != nil { + if err := tx.Migrator().CreateIndex(&Experiment{}, "Name"); err != nil { return err } return tx.Model(&SchemaVersion{}). diff --git a/pkg/database/migrations/v_0006/model.go b/pkg/database/migrations/v_0006/model.go index c93430b54..f4b5c57a9 100644 --- a/pkg/database/migrations/v_0006/model.go +++ b/pkg/database/migrations/v_0006/model.go @@ -44,12 +44,12 @@ type Namespace struct { type Experiment struct { ID *int32 `gorm:"column:experiment_id;not null;primaryKey"` - Name string `gorm:"type:varchar(256);not null;index:idx_namespace_name,unique"` + Name string `gorm:"type:varchar(256);not null;index:,unique,composite:name"` ArtifactLocation string `gorm:"type:varchar(256)"` LifecycleStage LifecycleStage `gorm:"type:varchar(32);check:lifecycle_stage IN ('active', 'deleted')"` CreationTime sql.NullInt64 `gorm:"type:bigint"` LastUpdateTime sql.NullInt64 `gorm:"type:bigint"` - NamespaceID uint `gorm:"index:idx_namespace_name,unique"` + NamespaceID uint `gorm:"index:,unique,composite:name"` Namespace Namespace Tags []ExperimentTag `gorm:"constraint:OnDelete:CASCADE"` Runs []Run `gorm:"constraint:OnDelete:CASCADE"` diff --git a/pkg/database/model.go b/pkg/database/model.go index 843845b30..2ee68486f 100644 --- a/pkg/database/model.go +++ b/pkg/database/model.go @@ -44,12 +44,12 @@ type Namespace struct { type Experiment struct { ID *int32 `gorm:"column:experiment_id;not null;primaryKey"` - Name string `gorm:"type:varchar(256);not null;index:idx_namespace_name,unique"` + Name string `gorm:"type:varchar(256);not null;index:,unique,composite:name"` ArtifactLocation string `gorm:"type:varchar(256)"` LifecycleStage LifecycleStage `gorm:"type:varchar(32);check:lifecycle_stage IN ('active', 'deleted')"` CreationTime sql.NullInt64 `gorm:"type:bigint"` LastUpdateTime sql.NullInt64 `gorm:"type:bigint"` - NamespaceID uint `gorm:"index:idx_namespace_name,unique"` + NamespaceID uint `gorm:"index:,unique,composite:name"` Namespace Namespace Tags []ExperimentTag `gorm:"constraint:OnDelete:CASCADE"` Runs []Run `gorm:"constraint:OnDelete:CASCADE"`