-
Notifications
You must be signed in to change notification settings - Fork 673
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Yee Hing Tong <[email protected]>
- Loading branch information
1 parent
c69cc81
commit 72d9c47
Showing
19 changed files
with
374 additions
and
181 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,5 @@ | ||
artifactsServer: | ||
myTestValue: "test from file" | ||
myTestValue: "test from file" | ||
database: | ||
postgres: | ||
dbname: artifacts |
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 |
---|---|---|
@@ -1,19 +1,19 @@ | ||
package shared | ||
|
||
import ( | ||
stdlibLogger "github.com/flyteorg/flyte/flytestdlib/logger" | ||
"context" | ||
"github.com/flyteorg/flyte/flytestdlib/database" | ||
"github.com/go-gormigrate/gormigrate/v2" | ||
"github.com/flyteorg/flyte/flytestdlib/promutils" | ||
"github.com/spf13/cobra" | ||
) | ||
\ | ||
|
||
// NewMigrateCmd represents the migrate command | ||
func NewMigrateCmd(migs []*gormigrate.Migration) *cobra.Command { | ||
return &cobra.Command{ | ||
Use: "migrate", | ||
Short: "This command will run all the migrations for the database", | ||
RunE: func(cmd *cobra.Command, args []string) error { | ||
return migrions.Migrate(confi.GetDBConfig(), stdlibLogger.GetConfig(), promutils.NewScope("dbmigrate"), migrs) | ||
return database.Migrate(context.Background(), migs) | ||
}, | ||
} | ||
} |
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
Large diffs are not rendered by default.
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
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,29 +1,4 @@ | ||
package server | ||
|
||
import ( | ||
"context" | ||
"github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/artifact" | ||
) | ||
|
||
type ArtifactHandler interface { | ||
CreateArtifact(ctx context.Context, request *artifact.CreateArtifactRequest) (*artifact.CreateArtifactResponse, error) | ||
GetArtifact(ctx context.Context, request *artifact.GetArtifactRequest) (*artifact.GetArtifactResponse, error) | ||
} | ||
|
||
type TriggerHandler interface { | ||
CreateTrigger(ctx context.Context, request *artifact.CreateTriggerRequest) (*artifact.CreateTriggerResponse, error) | ||
DeleteTrigger(ctx context.Context, request *artifact.DeleteTriggerRequest) (*artifact.DeleteTriggerResponse, error) | ||
} | ||
|
||
type TagHandler interface { | ||
AddTag(ctx context.Context, request *artifact.AddTagRequest) (*artifact.AddTagResponse, error) | ||
} | ||
|
||
type LineageHandler interface { | ||
RegisterProducer(ctx context.Context, request *artifact.RegisterProducerRequest) (*artifact.RegisterResponse, error) | ||
RegisterConsumer(ctx context.Context, request *artifact.RegisterConsumerRequest) (*artifact.RegisterResponse, error) | ||
} | ||
|
||
type SearchHandler interface { | ||
SearchArtifacts(ctx context.Context, request *artifact.SearchArtifactsRequest) (*artifact.SearchArtifactsResponse, error) | ||
type StorageInterface interface { | ||
} |
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,59 @@ | ||
package server | ||
|
||
import ( | ||
"github.com/go-gormigrate/gormigrate/v2" | ||
"github.com/jinzhu/gorm/dialects/postgres" | ||
|
||
"gorm.io/gorm" | ||
) | ||
|
||
var Migrations = []*gormigrate.Migration{ | ||
{ | ||
ID: "2023-10-12-inits", | ||
Migrate: func(tx *gorm.DB) error { | ||
type ArtifactsKey struct { | ||
gorm.Model | ||
Project string `gorm:"primary_key;type:varchar(64)"` | ||
Domain string `gorm:"primary_key;type:varchar(64)"` | ||
Name string `gorm:"primary_key;type:varchar(255)"` | ||
} | ||
type Artifact struct { | ||
gorm.Model | ||
ArtifactsKey | ||
Version string `gorm:"type:varchar(255);index:idx_artifact_version"` | ||
Partitions postgres.Hstore `gorm:"index:idx_artifact_partitions"` | ||
|
||
LiteralType []byte `gorm:"not null"` | ||
LiteralValue []byte `gorm:"not null"` | ||
|
||
Description string `gorm:"type:varchar(255)"` | ||
OffloadedLongDescription string `gorm:"type:varchar(255)"` | ||
MetadataType string `gorm:"type:varchar(64)"` | ||
OffloadedUserMetadata string `gorm:"type:varchar(255)"` | ||
|
||
// Project/Domain assumed to always be the same as the Artifact | ||
ExecutionName string `gorm:"type:varchar(255)"` | ||
WorkflowProject string `gorm:"type:varchar(64)"` | ||
WorkflowDomain string `gorm:"type:varchar(64)"` | ||
WorkflowName string `gorm:"type:varchar(255)"` | ||
WorkflowVersion string `gorm:"type:varchar(255)"` | ||
TaskProject string `gorm:"type:varchar(64)"` | ||
TaskDomain string `gorm:"type:varchar(64)"` | ||
TaskName string `gorm:"type:varchar(255)"` | ||
TaskVersion string `gorm:"type:varchar(255)"` | ||
NodeID string `gorm:"type:varchar(64)"` | ||
// See Admin migration for note. | ||
// Here nullable in the case of workflow output. | ||
RetryAttempt *uint32 | ||
} | ||
return tx.AutoMigrate( | ||
&ArtifactsKey{}, &Artifact{}, | ||
) | ||
}, | ||
Rollback: func(tx *gorm.DB) error { | ||
return tx.Migrator().DropTable( | ||
"markers", | ||
) | ||
}, | ||
}, | ||
} |
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
Oops, something went wrong.