forked from kubeflow/model-registry
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes kubeflow#35, refactor DB schema
Add missing indexes Constraints for keys Associations Use appropriate column sizes for numeric types Set creation and modification timestamps automatically using gorm tags Clean up Makefile to install pinned deps in ./bin
- Loading branch information
Showing
27 changed files
with
515 additions
and
254 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Ignore everything in this directory | ||
* | ||
# Except this file | ||
!.gitignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package db | ||
|
||
const TableNameArtifact = "Artifact" | ||
|
||
// Artifact mapped from table <Artifact> | ||
type Artifact struct { | ||
ID int64 `gorm:"column:id;primaryKey;autoIncrement:true" json:"-"` | ||
TypeID int64 `gorm:"column:type_id;not null;uniqueIndex:UniqueArtifactTypeName,priority:1" json:"-"` | ||
URI *string `gorm:"column:uri;type:text;index:idx_artifact_uri,priority:1" json:"-"` | ||
State *int8 `gorm:"column:state" json:"-"` | ||
Name *string `gorm:"column:name;type:varchar(255);uniqueIndex:UniqueArtifactTypeName,priority:2" json:"-"` | ||
ExternalID *string `gorm:"column:external_id;type:varchar(255);uniqueIndex:idx_artifact_external_id,priority:1" json:"-"` | ||
CreateTimeSinceEpoch int64 `gorm:"autoCreateTime:milli;column:create_time_since_epoch;not null;index:idx_artifact_create_time_since_epoch,priority:1" json:"-"` | ||
LastUpdateTimeSinceEpoch int64 `gorm:"autoUpdateTime:milli;column:last_update_time_since_epoch;not null;index:idx_artifact_last_update_time_since_epoch,priority:1" json:"-"` | ||
|
||
// relationships | ||
Properties []ArtifactProperty | ||
ArtifactType Type `gorm:"foreignKey:TypeID;references:ID"` | ||
Attributions []Attribution `gorm:"foreignKey:ArtifactID;references:ID"` | ||
Events []Event | ||
} | ||
|
||
// TableName Artifact's table name | ||
func (*Artifact) TableName() string { | ||
return TableNameArtifact | ||
} | ||
|
||
type ArtifactState int | ||
|
||
const ( | ||
UNKNOWN ArtifactState = iota | ||
// PENDING A state indicating that the artifact may exist. | ||
PENDING | ||
// LIVE A state indicating that the artifact should exist, unless something | ||
// external to the system deletes it. | ||
LIVE | ||
// MARKED_FOR_DELETION A state indicating that the artifact should be deleted. | ||
MARKED_FOR_DELETION | ||
// DELETED A state indicating that the artifact has been deleted. | ||
DELETED | ||
// ABANDONED A state indicating that the artifact has been abandoned, which may be | ||
// due to a failed or cancelled execution. | ||
ABANDONED | ||
// REFERENCE A state indicating that the artifact is a reference artifact. At | ||
// execution start time, the orchestrator produces an output artifact for | ||
// each output key with state PENDING. However, for an intermediate | ||
// artifact, this first artifact's state will be REFERENCE. Intermediate | ||
// artifacts emitted during a component's execution will copy the REFERENCE | ||
// artifact's attributes. At the end of an execution, the artifact state | ||
// should remain REFERENCE instead of being changed to LIVE. | ||
REFERENCE | ||
) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
package db | ||
|
||
const TableNameArtifactProperty = "ArtifactProperty" | ||
|
||
// ArtifactProperty mapped from table <ArtifactProperty> | ||
type ArtifactProperty struct { | ||
ArtifactID int64 `gorm:"column:artifact_id;primaryKey" json:"-"` | ||
Name string `gorm:"column:name;primaryKey;index:idx_artifact_property_double,priority:1;index:idx_artifact_property_string,priority:1;index:idx_artifact_property_int,priority:1" json:"-"` | ||
IsCustomProperty bool `gorm:"column:is_custom_property;primaryKey;index:idx_artifact_property_double,priority:2;index:idx_artifact_property_string,priority:2;index:idx_artifact_property_int,priority:2" json:"-"` | ||
IntValue *int64 `gorm:"column:int_value;index:idx_artifact_property_int,priority:3" json:"-"` | ||
DoubleValue *float64 `gorm:"column:double_value;index:idx_artifact_property_double,priority:3" json:"-"` | ||
StringValue *string `gorm:"column:string_value;index:idx_artifact_property_string,priority:3" json:"-"` | ||
ByteValue *[]byte `gorm:"column:byte_value" json:"-"` | ||
ProtoValue *[]byte `gorm:"column:proto_value" json:"-"` | ||
BoolValue *bool `gorm:"column:bool_value" json:"-"` | ||
TypeURL *string `gorm:"column:type_url" json:"-"` | ||
} | ||
|
||
// TableName ArtifactProperty's table name | ||
func (*ArtifactProperty) TableName() string { | ||
return TableNameArtifactProperty | ||
} | ||
|
||
func (p *ArtifactProperty) GetID() int64 { | ||
return p.ArtifactID | ||
} | ||
|
||
func (p *ArtifactProperty) SetID(i int64) { | ||
p.ArtifactID = i | ||
} | ||
|
||
func (p *ArtifactProperty) GetName() string { | ||
return p.Name | ||
} | ||
|
||
func (p *ArtifactProperty) SetName(s string) { | ||
p.Name = s | ||
} | ||
|
||
func (p *ArtifactProperty) GetIsCustomProperty() bool { | ||
return p.IsCustomProperty | ||
} | ||
|
||
func (p *ArtifactProperty) SetIsCustomProperty(b bool) { | ||
p.IsCustomProperty = b | ||
} | ||
|
||
func (p *ArtifactProperty) GetIntValue() *int64 { | ||
return p.IntValue | ||
} | ||
|
||
func (p *ArtifactProperty) SetIntValue(i *int64) { | ||
p.IntValue = i | ||
} | ||
|
||
func (p *ArtifactProperty) GetDoubleValue() *float64 { | ||
return p.DoubleValue | ||
} | ||
|
||
func (p *ArtifactProperty) SetDoubleValue(f *float64) { | ||
p.DoubleValue = f | ||
} | ||
|
||
func (p *ArtifactProperty) GetStringValue() *string { | ||
return p.StringValue | ||
} | ||
|
||
func (p *ArtifactProperty) SetStringValue(s *string) { | ||
p.StringValue = s | ||
} | ||
|
||
func (p *ArtifactProperty) GetByteValue() *[]byte { | ||
return p.ByteValue | ||
} | ||
|
||
func (p *ArtifactProperty) SetByteValue(b *[]byte) { | ||
p.ByteValue = b | ||
} | ||
|
||
func (p *ArtifactProperty) GetProtoValue() *[]byte { | ||
return p.ProtoValue | ||
} | ||
|
||
func (p *ArtifactProperty) SetProtoValue(b *[]byte) { | ||
p.ProtoValue = b | ||
} | ||
|
||
func (p *ArtifactProperty) GetBoolValue() *bool { | ||
return p.BoolValue | ||
} | ||
|
||
func (p *ArtifactProperty) SetBoolValue(b *bool) { | ||
p.BoolValue = b | ||
} | ||
|
||
func (p *ArtifactProperty) GetTypeURL() *string { | ||
return p.TypeURL | ||
} | ||
|
||
func (p *ArtifactProperty) SetTypeURL(s *string) { | ||
p.TypeURL = s | ||
} |
4 changes: 0 additions & 4 deletions
4
internal/model/db/association.gen.go → internal/model/db/association.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 0 additions & 4 deletions
4
internal/model/db/attribution.gen.go → internal/model/db/attribution.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.