From 74c7b7725eae5b5f7e92b9bba0bb393de4ef8b0b Mon Sep 17 00:00:00 2001 From: Yee Hing Tong Date: Fri, 17 Mar 2023 15:12:09 -0700 Subject: [PATCH 1/8] noop migrations Signed-off-by: Yee Hing Tong --- pkg/repositories/config/migrations.go | 379 ++++++++++++++++++++++++++ 1 file changed, 379 insertions(+) diff --git a/pkg/repositories/config/migrations.go b/pkg/repositories/config/migrations.go index cc441b478..a289d8443 100644 --- a/pkg/repositories/config/migrations.go +++ b/pkg/repositories/config/migrations.go @@ -3,6 +3,8 @@ package config import ( "database/sql" "fmt" + "github.com/flyteorg/flyteidl/gen/pb-go/flyteidl/core" + "time" "github.com/flyteorg/flyteadmin/pkg/repositories/models" schedulerModels "github.com/flyteorg/flyteadmin/scheduler/repositories/models" @@ -440,6 +442,383 @@ var Migrations = []*gormigrate.Migration{ return tx.Model(&models.Execution{}).Migrator().DropColumn(&models.Execution{}, "launch_entity") }, }, + + /* The following is a series of Postgres specific migrations. They should mirror the state + of the database as of 2023 March. The rollback is a noop for everything because the migration itself should + be a noop. + */ + + { + ID: "pg-noop-2023-03-31-noop-project-3", + Migrate: func(tx *gorm.DB) error { + type Project struct { + ID uint `gorm:"index;autoIncrement;not null"` + CreatedAt time.Time `gorm:"type:time"` + UpdatedAt time.Time `gorm:"type:time"` + DeletedAt *time.Time `gorm:"index"` + Identifier string `gorm:"primary_key"` + Name string `valid:"length(0|255)"` // Human-readable name, not a unique identifier. + Description string `gorm:"type:varchar(300)"` + Labels []byte + // GORM doesn't save the zero value for ints, so we use a pointer for the State field + State *int32 `gorm:"default:0;index"` + } + return tx.AutoMigrate(&Project{}) + }, + Rollback: func(tx *gorm.DB) error { + return nil + }, + }, + // ALTER TABLE "projects" ALTER COLUMN "id" DROP NOT NULL otherwise. + + { + ID: "pg-noop-2023-03-31-noop-task-2", + Migrate: func(tx *gorm.DB) error { + type Task struct { + ID uint `gorm:"index;autoIncrement;not null"` + CreatedAt time.Time `gorm:"type:time"` + UpdatedAt time.Time `gorm:"type:time"` + DeletedAt *time.Time `gorm:"index"` + Project string `gorm:"primary_key;index:task_project_domain_name_idx;index:task_project_domain_idx" valid:"length(0|255)"` + Domain string `gorm:"primary_key;index:task_project_domain_name_idx;index:task_project_domain_idx" valid:"length(0|255)"` + Name string `gorm:"primary_key;index:task_project_domain_name_idx" valid:"length(0|255)"` + Version string `gorm:"primary_key" valid:"length(0|255)"` + Closure []byte `gorm:"not null"` + // Hash of the compiled task closure + Digest []byte + // Task type (also stored in the closure put promoted as a column for filtering). + Type string `gorm:"" valid:"length(0|255)"` + // ShortDescription for the task. + ShortDescription string + } + return tx.AutoMigrate(&Task{}) + }, + Rollback: func(tx *gorm.DB) error { + return nil + }, + }, + + { + ID: "pg-noop-2023-03-31-noop-workflow", + Migrate: func(tx *gorm.DB) error { + type Workflow struct { + ID uint `gorm:"index;autoIncrement;not null"` + CreatedAt time.Time `gorm:"type:time"` + UpdatedAt time.Time `gorm:"type:time"` + DeletedAt *time.Time `gorm:"index"` + Project string `gorm:"primary_key;index:workflow_project_domain_name_idx;index:workflow_project_domain_idx" valid:"length(0|255)"` + Domain string `gorm:"primary_key;index:workflow_project_domain_name_idx;index:workflow_project_domain_idx" valid:"length(0|255)"` + Name string `gorm:"primary_key;index:workflow_project_domain_name_idx" valid:"length(0|255)"` + Version string `gorm:"primary_key"` + TypedInterface []byte + RemoteClosureIdentifier string `gorm:"not null" valid:"length(0|255)"` + // Hash of the compiled workflow closure + Digest []byte + // ShortDescription for the workflow. + ShortDescription string + } + return tx.AutoMigrate(&Workflow{}) + }, + Rollback: func(tx *gorm.DB) error { + return nil + }, + }, + + { + ID: "pg-noop-2023-03-31-noop-launchplan", + Migrate: func(tx *gorm.DB) error { + type LaunchPlanScheduleType string + + type LaunchPlan struct { + ID uint `gorm:"index;autoIncrement;not null"` + CreatedAt time.Time `gorm:"type:time"` + UpdatedAt time.Time `gorm:"type:time"` + DeletedAt *time.Time `gorm:"index"` + Project string `gorm:"primary_key;index:lp_project_domain_name_idx,lp_project_domain_idx" valid:"length(0|255)"` + Domain string `gorm:"primary_key;index:lp_project_domain_name_idx,lp_project_domain_idx" valid:"length(0|255)"` + Name string `gorm:"primary_key;index:lp_project_domain_name_idx" valid:"length(0|255)"` + Version string `gorm:"primary_key" valid:"length(0|255)"` + Spec []byte `gorm:"not null"` + WorkflowID uint `gorm:"index"` + Closure []byte `gorm:"not null"` + // GORM doesn't save the zero value for ints, so we use a pointer for the State field + State *int32 `gorm:"default:0"` + // Hash of the launch plan + Digest []byte + ScheduleType LaunchPlanScheduleType + } + return tx.AutoMigrate(&LaunchPlan{}) + }, + Rollback: func(tx *gorm.DB) error { + return nil + }, + }, + + { + ID: "pg-noop-2023-03-31-noop-namedentitymetadata", + Migrate: func(tx *gorm.DB) error { + type NamedEntityMetadata struct { + ID uint `gorm:"index;autoIncrement;not null"` + CreatedAt time.Time `gorm:"type:time"` + UpdatedAt time.Time `gorm:"type:time"` + DeletedAt *time.Time `gorm:"index"` + ResourceType core.ResourceType `gorm:"primary_key;index:named_entity_metadata_type_project_domain_name_idx" valid:"length(0|255)"` + Project string `gorm:"primary_key;index:named_entity_metadata_type_project_domain_name_idx" valid:"length(0|255)"` + Domain string `gorm:"primary_key;index:named_entity_metadata_type_project_domain_name_idx" valid:"length(0|255)"` + Name string `gorm:"primary_key;index:named_entity_metadata_type_project_domain_name_idx" valid:"length(0|255)"` + Description string `gorm:"type:varchar(300)"` + // GORM doesn't save the zero value for ints, so we use a pointer for the State field + State *int32 `gorm:"default:0"` + } + + return tx.AutoMigrate(&NamedEntityMetadata{}) + }, + Rollback: func(tx *gorm.DB) error { + return nil + }, + }, + + { + ID: "pg-noop-2023-03-31-noop-taskexecution-3", + Migrate: func(tx *gorm.DB) error { + type TaskKey struct { + Project string `gorm:"primary_key"` + Domain string `gorm:"primary_key"` + Name string `gorm:"primary_key"` + Version string `gorm:"primary_key"` + } + type TaskExecutionKey struct { + TaskKey + Project string `gorm:"primary_key;column:execution_project;index:idx_task_executions_exec"` + Domain string `gorm:"primary_key;column:execution_domain;index:idx_task_executions_exec"` + Name string `gorm:"primary_key;column:execution_name;index:idx_task_executions_exec"` + NodeID string `gorm:"primary_key;index:idx_task_executions_exec;index"` + // *IMPORTANT* This is a pointer to an int in order to allow setting an empty ("0") value according to gorm convention. + // Because RetryAttempt is part of the TaskExecution primary key is should *never* be null. + RetryAttempt *uint32 `gorm:"primary_key;AUTO_INCREMENT:FALSE"` + } + type TaskExecution struct { + ID uint `gorm:"index;autoIncrement;not null"` + CreatedAt time.Time `gorm:"type:time"` + UpdatedAt time.Time `gorm:"type:time"` + DeletedAt *time.Time `gorm:"index"` + TaskExecutionKey + Phase string `gorm:"type:text"` + PhaseVersion uint32 + InputURI string `gorm:"type:text"` + Closure []byte + StartedAt *time.Time + // Corresponds to the CreatedAt field in the TaskExecution closure + // This field is prefixed with TaskExecution because it signifies when + // the execution was createdAt, not to be confused with gorm.Model.CreatedAt + TaskExecutionCreatedAt *time.Time + // Corresponds to the UpdatedAt field in the TaskExecution closure + // This field is prefixed with TaskExecution because it signifies when + // the execution was UpdatedAt, not to be confused with gorm.Model.UpdatedAt + TaskExecutionUpdatedAt *time.Time + Duration time.Duration + // The child node executions (if any) launched by this task execution. + ChildNodeExecution []NodeExecution `gorm:"foreignkey:ParentTaskExecutionID;references:ID"` + } + + return tx.AutoMigrate(&TaskExecution{}) + }, + Rollback: func(tx *gorm.DB) error { + return nil + }, + }, + + { + ID: "pg-noop-2023-03-31-noop-nodeexecution-2", + Migrate: func(tx *gorm.DB) error { + type ExecutionKey struct { + Project string `gorm:"primary_key;column:execution_project"` + Domain string `gorm:"primary_key;column:execution_domain"` + Name string `gorm:"primary_key;column:execution_name"` + } + + type NodeExecutionKey struct { + ExecutionKey + NodeID string `gorm:"primary_key;index"` + } + type NodeExecution struct { + ID uint `gorm:"index;autoIncrement;not null"` + CreatedAt time.Time `gorm:"type:time"` + UpdatedAt time.Time `gorm:"type:time"` + DeletedAt *time.Time `gorm:"index"` + NodeExecutionKey + // Also stored in the closure, but defined as a separate column because it's useful for filtering and sorting. + Phase string + InputURI string + Closure []byte + StartedAt *time.Time + // Corresponds to the CreatedAt field in the NodeExecution closure + // Prefixed with NodeExecution to avoid clashes with gorm.Model CreatedAt + NodeExecutionCreatedAt *time.Time + // Corresponds to the UpdatedAt field in the NodeExecution closure + // Prefixed with NodeExecution to avoid clashes with gorm.Model UpdatedAt + NodeExecutionUpdatedAt *time.Time + Duration time.Duration + // The task execution (if any) which launched this node execution. + ParentTaskExecutionID uint `sql:"default:null" gorm:"index"` + // The workflow execution (if any) which this node execution launched + LaunchedExecution models.Execution `gorm:"foreignKey:ParentNodeExecutionID;references:ID"` + // In the case of dynamic workflow nodes, the remote closure is uploaded to the path specified here. + DynamicWorkflowRemoteClosureReference string + // Metadata that is only relevant to the flyteadmin service that is used to parse the model and track additional attributes. + InternalData []byte + } + + return tx.AutoMigrate(&NodeExecution{}) + }, + Rollback: func(tx *gorm.DB) error { + return nil + }, + }, + + { + ID: "pg-noop-2023-03-31-noop-execution-event", + Migrate: func(tx *gorm.DB) error { + type ExecutionKey struct { + Project string `gorm:"primary_key;column:execution_project" valid:"length(0|127)"` + Domain string `gorm:"primary_key;column:execution_domain" valid:"length(0|127)"` + Name string `gorm:"primary_key;column:execution_name" valid:"length(0|127)"` + } + type ExecutionEvent struct { + ID uint `gorm:"index;autoIncrement;not null"` + CreatedAt time.Time `gorm:"type:time"` + UpdatedAt time.Time `gorm:"type:time"` + DeletedAt *time.Time `gorm:"index"` + ExecutionKey + RequestID string `valid:"length(0|255)"` + OccurredAt time.Time + Phase string `gorm:"primary_key"` + } + + return tx.AutoMigrate(&ExecutionEvent{}) + }, + Rollback: func(tx *gorm.DB) error { + return nil + }, + }, + + { + ID: "pg-noop-2023-03-31-noop-node-execution-event", + Migrate: func(tx *gorm.DB) error { + type ExecutionKey struct { + Project string `gorm:"primary_key;column:execution_project" valid:"length(0|127)"` + Domain string `gorm:"primary_key;column:execution_domain" valid:"length(0|127)"` + Name string `gorm:"primary_key;column:execution_name" valid:"length(0|127)"` + } + type NodeExecutionKey struct { + ExecutionKey + NodeID string `gorm:"primary_key;index" valid:"length(0|180)"` + } + type NodeExecutionEvent struct { + ID uint `gorm:"index;autoIncrement;not null"` + CreatedAt time.Time `gorm:"type:time"` + UpdatedAt time.Time `gorm:"type:time"` + DeletedAt *time.Time `gorm:"index"` + NodeExecutionKey + RequestID string + OccurredAt time.Time + Phase string `gorm:"primary_key"` + } + + return tx.AutoMigrate(&NodeExecutionEvent{}) + }, + Rollback: func(tx *gorm.DB) error { + return nil + }, + }, + + { + ID: "pg-noop-2023-03-31-noop-description-entity-2", + Migrate: func(tx *gorm.DB) error { + type DescriptionEntityKey struct { + ResourceType core.ResourceType `gorm:"primary_key;index:description_entity_project_domain_name_version_idx" valid:"length(0|255)"` + Project string `gorm:"primary_key;index:description_entity_project_domain_name_version_idx" valid:"length(0|255)"` + Domain string `gorm:"primary_key;index:description_entity_project_domain_name_version_idx" valid:"length(0|255)"` + Name string `gorm:"primary_key;index:description_entity_project_domain_name_version_idx" valid:"length(0|255)"` + Version string `gorm:"primary_key;index:description_entity_project_domain_name_version_idx" valid:"length(0|255)"` + } + + // SourceCode Database model to encapsulate a SourceCode. + type SourceCode struct { + Link string `valid:"length(0|255)"` + } + + // DescriptionEntity Database model to encapsulate a DescriptionEntity. + type DescriptionEntity struct { + DescriptionEntityKey + ID uint `gorm:"index;autoIncrement;not null"` + CreatedAt time.Time `gorm:"type:time"` + UpdatedAt time.Time `gorm:"type:time"` + DeletedAt *time.Time `gorm:"index"` + SourceCode + ShortDescription string + LongDescription []byte + } + + return tx.AutoMigrate(&DescriptionEntity{}) + }, + Rollback: func(tx *gorm.DB) error { + return nil + }, + }, + + { + ID: "pg-noop-2023-03-31-noop-signal", + Migrate: func(tx *gorm.DB) error { + type SignalKey struct { + ExecutionKey + SignalID string `gorm:"primary_key;index" valid:"length(0|255)"` + } + + type Signal struct { + ID uint `gorm:"index;autoIncrement;not null"` + CreatedAt time.Time `gorm:"type:time"` + UpdatedAt time.Time `gorm:"type:time"` + DeletedAt *time.Time `gorm:"index"` + SignalKey + Type []byte `gorm:"not null"` + Value []byte + } + + return tx.AutoMigrate(&Signal{}) + }, + Rollback: func(tx *gorm.DB) error { + return nil + }, + }, + + { + ID: "pg-noop-2023-03-31-noop-resource-3", + Migrate: func(tx *gorm.DB) error { + type ResourcePriority int32 + + // In this model, the combination of (Project, Domain, Workflow, LaunchPlan, ResourceType) is unique + type Resource struct { + ID int64 `gorm:"AUTO_INCREMENT;column:id;primary_key;not null"` + CreatedAt time.Time + UpdatedAt time.Time + DeletedAt *time.Time `sql:"index"` + Project string `gorm:"uniqueIndex:resource_idx" valid:"length(0|255)"` + Domain string `gorm:"uniqueIndex:resource_idx" valid:"length(0|255)"` + Workflow string `gorm:"uniqueIndex:resource_idx" valid:"length(0|255)"` + LaunchPlan string `gorm:"uniqueIndex:resource_idx" valid:"length(0|255)"` + ResourceType string `gorm:"uniqueIndex:resource_idx" valid:"length(0|255)"` + Priority ResourcePriority + // Serialized flyteidl.admin.MatchingAttributes. + Attributes []byte + } + + return tx.AutoMigrate(&Resource{}) + }, + Rollback: func(tx *gorm.DB) error { + return nil + }, + }, } func alterTableColumnType(db *sql.DB, columnName, columnType string) error { From 78de8131942631ce632d0feb25cece8b3f45eebf Mon Sep 17 00:00:00 2001 From: Yee Hing Tong Date: Mon, 20 Mar 2023 13:24:06 -0700 Subject: [PATCH 2/8] split out migrations, add a test as standalone Signed-off-by: Yee Hing Tong --- go.mod | 24 +++--- go.sum | 54 +++++++------- pkg/repositories/config/migrations.go | 6 +- pkg/repositories/config/migrations_test.go | 85 ++++++++++++++++++++++ 4 files changed, 131 insertions(+), 38 deletions(-) diff --git a/go.mod b/go.mod index 250ad351e..836f4c861 100644 --- a/go.mod +++ b/go.mod @@ -32,7 +32,7 @@ require ( github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 github.com/grpc-ecosystem/grpc-gateway v1.16.0 github.com/gtank/cryptopasta v0.0.0-20170601214702-1f550f6f2f69 - github.com/jackc/pgconn v1.10.1 + github.com/jackc/pgconn v1.13.0 github.com/lestrrat-go/jwx v1.1.6 github.com/magiconair/properties v1.8.6 github.com/mitchellh/mapstructure v1.4.3 @@ -45,16 +45,16 @@ require ( github.com/sendgrid/sendgrid-go v3.10.0+incompatible github.com/spf13/cobra v1.4.0 github.com/spf13/pflag v1.0.5 - github.com/stretchr/testify v1.7.2 + github.com/stretchr/testify v1.8.0 golang.org/x/oauth2 v0.0.0-20220411215720-9780585627b5 golang.org/x/time v0.0.0-20220210224613-90d013bbcef8 google.golang.org/api v0.76.0 google.golang.org/genproto v0.0.0-20220426171045-31bebdecfb46 google.golang.org/grpc v1.46.0 google.golang.org/protobuf v1.28.0 - gorm.io/driver/postgres v1.2.3 + gorm.io/driver/postgres v1.4.5 gorm.io/driver/sqlite v1.1.1 - gorm.io/gorm v1.22.4 + gorm.io/gorm v1.24.1-0.20221019064659-5dd2bb482755 k8s.io/api v0.24.1 k8s.io/apimachinery v0.24.1 k8s.io/client-go v0.24.1 @@ -101,6 +101,7 @@ require ( github.com/go-openapi/jsonpointer v0.19.5 // indirect github.com/go-openapi/jsonreference v0.19.5 // indirect github.com/go-openapi/swag v0.19.14 // indirect + github.com/go-sql-driver/mysql v1.7.0 // indirect github.com/go-test/deep v1.0.7 // indirect github.com/goccy/go-json v0.4.8 // indirect github.com/gofrs/uuid v4.2.0+incompatible // indirect @@ -118,13 +119,13 @@ require ( github.com/jackc/chunkreader/v2 v2.0.1 // indirect github.com/jackc/pgio v1.0.0 // indirect github.com/jackc/pgpassfile v1.0.0 // indirect - github.com/jackc/pgproto3/v2 v2.2.0 // indirect + github.com/jackc/pgproto3/v2 v2.3.1 // indirect github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b // indirect - github.com/jackc/pgtype v1.9.0 // indirect - github.com/jackc/pgx/v4 v4.14.0 // indirect + github.com/jackc/pgtype v1.12.0 // indirect + github.com/jackc/pgx/v4 v4.17.2 // indirect github.com/jcmturner/gofork v1.0.0 // indirect github.com/jinzhu/inflection v1.0.0 // indirect - github.com/jinzhu/now v1.1.4 // indirect + github.com/jinzhu/now v1.1.5 // indirect github.com/jmespath/go-jmespath v0.4.0 // indirect github.com/josharian/intern v1.0.0 // indirect github.com/json-iterator/go v1.1.12 // indirect @@ -163,10 +164,10 @@ require ( github.com/spf13/cast v1.4.1 // indirect github.com/spf13/jwalterweatherman v1.1.0 // indirect github.com/spf13/viper v1.11.0 // indirect - github.com/stretchr/objx v0.3.0 // indirect + github.com/stretchr/objx v0.4.0 // indirect github.com/subosito/gotenv v1.2.0 // indirect go.opencensus.io v0.23.0 // indirect - golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e // indirect + golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa // indirect golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e // indirect golang.org/x/net v0.7.0 // indirect golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4 // indirect @@ -185,6 +186,7 @@ require ( gopkg.in/square/go-jose.v2 v2.5.1 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect + gorm.io/driver/mysql v1.4.4 // indirect k8s.io/apiextensions-apiserver v0.24.1 // indirect sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2 // indirect sigs.k8s.io/yaml v1.3.0 // indirect @@ -208,3 +210,5 @@ require ( ) replace github.com/robfig/cron/v3 => github.com/unionai/cron/v3 v3.0.2-0.20210825070134-bfc34418fe84 + +replace github.com/flyteorg/flytestdlib => ../flytestdlib diff --git a/go.sum b/go.sum index c52ee174d..285d80191 100644 --- a/go.sum +++ b/go.sum @@ -314,8 +314,6 @@ github.com/flyteorg/flyteplugins v1.0.40 h1:RTsYingqmqr13qBbi4CB2ArXDHNHUOkAF+HT github.com/flyteorg/flyteplugins v1.0.40/go.mod h1:qyUPqVspLcLGJpKxVwHDWf+kBpOGuItOxCaF6zAmDio= github.com/flyteorg/flytepropeller v1.1.70 h1:/d1qqz13rdVADM85ST70eerAdBstJJz9UUB/mNSZi0w= github.com/flyteorg/flytepropeller v1.1.70/go.mod h1:MezHUJmgPzm4Pu8nIy6LLiEkxNA6buTQ7hInSqCViTY= -github.com/flyteorg/flytestdlib v1.0.15 h1:kv9jDQmytbE84caY+pkZN8trJU2ouSAmESzpTEhfTt0= -github.com/flyteorg/flytestdlib v1.0.15/go.mod h1:ghw/cjY0sEWIIbyCtcJnL/Gt7ZS7gf9SUi0CCPhbz3s= github.com/flyteorg/stow v0.3.6 h1:jt50ciM14qhKBaIrB+ppXXY+SXB59FNREFgTJqCyqIk= github.com/flyteorg/stow v0.3.6/go.mod h1:5dfBitPM004dwaZdoVylVjxFT4GWAgI0ghAndhNUzCo= github.com/fogleman/gg v1.2.1-0.20190220221249-0403632d5b90/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k= @@ -366,8 +364,10 @@ github.com/go-openapi/swag v0.19.14 h1:gm3vOOXfiuw5i9p5N9xJvfjvuofpyvLA9Wr6QfK5F github.com/go-openapi/swag v0.19.14/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/eQntq43wQ= github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= github.com/go-sql-driver/mysql v1.4.1/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= -github.com/go-sql-driver/mysql v1.5.0 h1:ozyZYNQW3x3HtqT1jira07DN2PArx2v7/mN66gGcHOs= github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= +github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= +github.com/go-sql-driver/mysql v1.7.0 h1:ueSltNNllEqE3qcWBTD0iQd3IpL/6U+mJxLkazJ7YPc= +github.com/go-sql-driver/mysql v1.7.0/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/go-test/deep v1.0.7 h1:/VSMRlnY/JSyqxQUzQLKVMAskpY/NZKFA5j2P+0pP2M= github.com/go-test/deep v1.0.7/go.mod h1:QV8Hv/iy04NyLBxAdO9njL0iVPN1S4d/A3NVv1V36o8= @@ -816,8 +816,8 @@ github.com/jackc/pgconn v1.6.4/go.mod h1:w2pne1C2tZgP+TvjqLpOigGzNqjBgQW9dUw/4Ch github.com/jackc/pgconn v1.8.0/go.mod h1:1C2Pb36bGIP9QHGBYCjnyhqu7Rv3sGshaQUvmfGIB/o= github.com/jackc/pgconn v1.9.0/go.mod h1:YctiPyvzfU11JFxoXokUOOKQXQmDMoJL9vJzHH8/2JY= github.com/jackc/pgconn v1.9.1-0.20210724152538-d89c8390a530/go.mod h1:4z2w8XhRbP1hYxkpTuBjTS3ne3J48K83+u0zoyvg2pI= -github.com/jackc/pgconn v1.10.1 h1:DzdIHIjG1AxGwoEEqS+mGsURyjt4enSmqzACXvVzOT8= -github.com/jackc/pgconn v1.10.1/go.mod h1:4z2w8XhRbP1hYxkpTuBjTS3ne3J48K83+u0zoyvg2pI= +github.com/jackc/pgconn v1.13.0 h1:3L1XMNV2Zvca/8BYhzcRFS70Lr0WlDg16Di6SFGAbys= +github.com/jackc/pgconn v1.13.0/go.mod h1:AnowpAqO4CMIIJNZl2VJp+KrkAZciAkhEl0W0JIobpI= github.com/jackc/pgio v1.0.0 h1:g12B9UwVnzGhueNavwioyEEpAmqMe1E/BN9ES+8ovkE= github.com/jackc/pgio v1.0.0/go.mod h1:oP+2QK2wFfUWgr+gxjoBH9KGBb31Eio69xUb0w5bYf8= github.com/jackc/pgmock v0.0.0-20190831213851-13a1b77aafa2/go.mod h1:fGZlG77KXmcq05nJLRkk0+p82V8B8Dw8KN2/V9c/OAE= @@ -835,8 +835,8 @@ github.com/jackc/pgproto3/v2 v2.0.1/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwX github.com/jackc/pgproto3/v2 v2.0.2/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA= github.com/jackc/pgproto3/v2 v2.0.6/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA= github.com/jackc/pgproto3/v2 v2.1.1/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA= -github.com/jackc/pgproto3/v2 v2.2.0 h1:r7JypeP2D3onoQTCxWdTpCtJ4D+qpKr0TxvoyMhZ5ns= -github.com/jackc/pgproto3/v2 v2.2.0/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA= +github.com/jackc/pgproto3/v2 v2.3.1 h1:nwj7qwf0S+Q7ISFfBndqeLwSwxs+4DPsbRFjECT1Y4Y= +github.com/jackc/pgproto3/v2 v2.3.1/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA= github.com/jackc/pgservicefile v0.0.0-20200307190119-3430c5407db8/go.mod h1:vsD4gTJCa9TptPL8sPkXrLZ+hDuNrZCnj29CQpr4X1E= github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b h1:C8S2+VttkHFdOOCXJe+YGfa4vHYwlt4Zx+IVXQ97jYg= github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b/go.mod h1:vsD4gTJCa9TptPL8sPkXrLZ+hDuNrZCnj29CQpr4X1E= @@ -848,8 +848,8 @@ github.com/jackc/pgtype v1.3.1-0.20200510190516-8cd94a14c75a/go.mod h1:vaogEUkAL github.com/jackc/pgtype v1.3.1-0.20200606141011-f6355165a91c/go.mod h1:cvk9Bgu/VzJ9/lxTO5R5sf80p0DiucVtN7ZxvaC4GmQ= github.com/jackc/pgtype v1.4.2/go.mod h1:JCULISAZBFGrHaOXIIFiyfzW5VY0GRitRr8NeJsrdig= github.com/jackc/pgtype v1.8.1-0.20210724151600-32e20a603178/go.mod h1:C516IlIV9NKqfsMCXTdChteoXmwgUceqaLfjg2e3NlM= -github.com/jackc/pgtype v1.9.0 h1:/SH1RxEtltvJgsDqp3TbiTFApD3mey3iygpuEGeuBXk= -github.com/jackc/pgtype v1.9.0/go.mod h1:LUMuVrfsFfdKGLw+AFFVv6KtHOFMwRgDDzBt76IqCA4= +github.com/jackc/pgtype v1.12.0 h1:Dlq8Qvcch7kiehm8wPGIW0W3KsCCHJnRacKW0UM8n5w= +github.com/jackc/pgtype v1.12.0/go.mod h1:LUMuVrfsFfdKGLw+AFFVv6KtHOFMwRgDDzBt76IqCA4= github.com/jackc/pgx v3.2.0+incompatible/go.mod h1:0ZGrqGqkRlliWnWB4zKnWtjbSWbGkVEFm4TeybAXq+I= github.com/jackc/pgx v3.6.2+incompatible/go.mod h1:0ZGrqGqkRlliWnWB4zKnWtjbSWbGkVEFm4TeybAXq+I= github.com/jackc/pgx/v4 v4.0.0-20190420224344-cc3461e65d96/go.mod h1:mdxmSJJuR08CZQyj1PVQBHy9XOp5p8/SHH6a0psbY9Y= @@ -861,14 +861,14 @@ github.com/jackc/pgx/v4 v4.6.1-0.20200510190926-94ba730bb1e9/go.mod h1:t3/cdRQl6 github.com/jackc/pgx/v4 v4.6.1-0.20200606145419-4e5062306904/go.mod h1:ZDaNWkt9sW1JMiNn0kdYBaLelIhw7Pg4qd+Vk6tw7Hg= github.com/jackc/pgx/v4 v4.8.1/go.mod h1:4HOLxrl8wToZJReD04/yB20GDwf4KBYETvlHciCnwW0= github.com/jackc/pgx/v4 v4.12.1-0.20210724153913-640aa07df17c/go.mod h1:1QD0+tgSXP7iUjYm9C1NxKhny7lq6ee99u/z+IHFcgs= -github.com/jackc/pgx/v4 v4.14.0 h1:TgdrmgnM7VY72EuSQzBbBd4JA1RLqJolrw9nQVZABVc= -github.com/jackc/pgx/v4 v4.14.0/go.mod h1:jT3ibf/A0ZVCp89rtCIN0zCJxcE74ypROmHEZYsG/j8= +github.com/jackc/pgx/v4 v4.17.2 h1:0Ut0rpeKwvIVbMQ1KbMBU4h6wxehBI535LK6Flheh8E= +github.com/jackc/pgx/v4 v4.17.2/go.mod h1:lcxIZN44yMIrWI78a5CpucdD14hX0SBDbNRvjDBItsw= github.com/jackc/puddle v0.0.0-20190413234325-e4ced69a3a2b/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= github.com/jackc/puddle v0.0.0-20190608224051-11cab39313c9/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= github.com/jackc/puddle v1.1.0/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= github.com/jackc/puddle v1.1.1/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= github.com/jackc/puddle v1.1.3/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= -github.com/jackc/puddle v1.2.0/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= +github.com/jackc/puddle v1.3.0/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= github.com/jcmturner/gofork v0.0.0-20190328161633-dc7c13fece03/go.mod h1:MK8+TM0La+2rjBD4jE12Kj1pCCxK7d2LK/UM3ncEo0o= github.com/jcmturner/gofork v1.0.0 h1:J7uCkflzTEhUZ64xqKnkDxq3kzc96ajM1Gli5ktUem8= github.com/jcmturner/gofork v1.0.0/go.mod h1:MK8+TM0La+2rjBD4jE12Kj1pCCxK7d2LK/UM3ncEo0o= @@ -877,10 +877,9 @@ github.com/jinzhu/copier v0.3.5 h1:GlvfUwHk62RokgqVNvYsku0TATCF7bAHVwEXoBh3iJg= github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E= github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc= github.com/jinzhu/now v1.1.1/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8= -github.com/jinzhu/now v1.1.2/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8= -github.com/jinzhu/now v1.1.3/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8= -github.com/jinzhu/now v1.1.4 h1:tHnRBy1i5F2Dh8BAFxqFzxKqqvezXrL2OW1TnX+Mlas= github.com/jinzhu/now v1.1.4/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8= +github.com/jinzhu/now v1.1.5 h1:/o9tlHleP7gOFmsnYNz3RGnqzefHA47wQpKrrdTIwXQ= +github.com/jinzhu/now v1.1.5/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8= github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= github.com/jmespath/go-jmespath v0.3.0/go.mod h1:9QtRXoHjLGCJ5IBSaohpXITPlowMeeYCZ7fLUTSywik= github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg= @@ -1312,8 +1311,8 @@ github.com/streadway/amqp v0.0.0-20190404075320-75d898a42a94/go.mod h1:AZpEONHx3 github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= -github.com/stretchr/objx v0.3.0 h1:NGXK3lHquSN08v5vWalVI/L8XU9hdzE/G6xsrze47As= -github.com/stretchr/objx v0.3.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= +github.com/stretchr/objx v0.4.0 h1:M2gUjqZET1qApGOWNSnZ49BAIMX4F/1plDv3+l31EJ4= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= @@ -1321,8 +1320,8 @@ github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5 github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.2 h1:4jaiDzPyXQvSd7D0EjG45355tLlV3VOECpq10pLC+8s= -github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= +github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/subosito/gotenv v1.1.1/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s= github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= @@ -1469,8 +1468,8 @@ golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5y golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.0.0-20220214200702-86341886e292/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e h1:T8NU3HyQ8ClP4SEE+KbFlg6n0NhuTsN4MyznaarGsZM= -golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa h1:zuSxTR4o9y82ebqCUJYNGJbGPo6sKVl54f/TVDObg1c= +golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -2123,20 +2122,21 @@ gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C gopkg.in/yaml.v3 v3.0.0/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gorm.io/driver/mysql v1.0.1 h1:omJoilUzyrAp0xNoio88lGJCroGdIOen9hq2A/+3ifw= gorm.io/driver/mysql v1.0.1/go.mod h1:KtqSthtg55lFp3S5kUXqlGaelnWpKitn4k1xZTnoiPw= +gorm.io/driver/mysql v1.4.4 h1:MX0K9Qvy0Na4o7qSC/YI7XxqUw5KDw01umqgID+svdQ= +gorm.io/driver/mysql v1.4.4/go.mod h1:BCg8cKI+R0j/rZRQxeKis/forqRwRSYOR8OM3Wo6hOM= gorm.io/driver/postgres v1.0.0/go.mod h1:wtMFcOzmuA5QigNsgEIb7O5lhvH1tHAF1RbWmLWV4to= -gorm.io/driver/postgres v1.2.3 h1:f4t0TmNMy9gh3TU2PX+EppoA6YsgFnyq8Ojtddb42To= -gorm.io/driver/postgres v1.2.3/go.mod h1:pJV6RgYQPG47aM1f0QeOzFH9HxQc8JcmAgjRCgS0wjs= +gorm.io/driver/postgres v1.4.5 h1:mTeXTTtHAgnS9PgmhN2YeUbazYpLhUI1doLnw42XUZc= +gorm.io/driver/postgres v1.4.5/go.mod h1:GKNQYSJ14qvWkvPwXljMGehpKrhlDNsqYRr5HnYGncg= gorm.io/driver/sqlite v1.1.1 h1:qtWqNAEUyi7gYSUAJXeiAMz0lUOdakZF5ia9Fqnp5G4= gorm.io/driver/sqlite v1.1.1/go.mod h1:hm2olEcl8Tmsc6eZyxYSeznnsDaMqamBvEXLNtBg4cI= gorm.io/driver/sqlserver v1.0.2 h1:FzxAlw0/7hntMzSiNfotpYCo9Lz8dqWQGdmCGqIiFGo= gorm.io/driver/sqlserver v1.0.2/go.mod h1:gb0Y9QePGgqjzrVyTQUZeh9zkd5v0iz71cM1B4ZycEY= gorm.io/gorm v1.9.19/go.mod h1:0HFTzE/SqkGTzK6TlDPPQbAYCluiVvhzoA1+aVyzenw= gorm.io/gorm v1.20.0/go.mod h1:0HFTzE/SqkGTzK6TlDPPQbAYCluiVvhzoA1+aVyzenw= -gorm.io/gorm v1.22.3/go.mod h1:F+OptMscr0P2F2qU97WT1WimdH9GaQPoDW7AYd5i2Y0= -gorm.io/gorm v1.22.4 h1:8aPcyEJhY0MAt8aY6Dc524Pn+pO29K+ydu+e/cXSpQM= -gorm.io/gorm v1.22.4/go.mod h1:1aeVC+pe9ZmvKZban/gW4QPra7PRoTEssyc922qCAkk= +gorm.io/gorm v1.23.8/go.mod h1:l2lP/RyAtc1ynaTjFksBde/O8v9oOGIApu2/xRitmZk= +gorm.io/gorm v1.24.1-0.20221019064659-5dd2bb482755 h1:7AdrbfcvKnzejfqP5g37fdSZOXH/JvaPIzBIHTOqXKk= +gorm.io/gorm v1.24.1-0.20221019064659-5dd2bb482755/go.mod h1:DVrVomtaYTbqs7gB/x2uVvqnXzv0nqjB396B8cG4dBA= gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo= gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= gotest.tools/v3 v3.0.2/go.mod h1:3SzNCllyD9/Y+b5r9JIKQ474KzkZyqLqEfYqMsX94Bk= diff --git a/pkg/repositories/config/migrations.go b/pkg/repositories/config/migrations.go index a289d8443..8a2201fe3 100644 --- a/pkg/repositories/config/migrations.go +++ b/pkg/repositories/config/migrations.go @@ -19,7 +19,7 @@ var ( "schedule_entities_snapshots", "task_executions", "tasks", "workflows", "description_entities"} ) -var Migrations = []*gormigrate.Migration{ +var LegacyMigrations = []*gormigrate.Migration{ // Create projects table. { ID: "2019-05-22-projects", @@ -442,7 +442,9 @@ var Migrations = []*gormigrate.Migration{ return tx.Model(&models.Execution{}).Migrator().DropColumn(&models.Execution{}, "launch_entity") }, }, +} +var NoopMigrations = []*gormigrate.Migration{ /* The following is a series of Postgres specific migrations. They should mirror the state of the database as of 2023 March. The rollback is a noop for everything because the migration itself should be a noop. @@ -821,6 +823,8 @@ var Migrations = []*gormigrate.Migration{ }, } +var Migrations = append(LegacyMigrations, NoopMigrations...) + func alterTableColumnType(db *sql.DB, columnName, columnType string) error { var err error diff --git a/pkg/repositories/config/migrations_test.go b/pkg/repositories/config/migrations_test.go index 29f798051..377658ace 100644 --- a/pkg/repositories/config/migrations_test.go +++ b/pkg/repositories/config/migrations_test.go @@ -1,7 +1,15 @@ package config import ( + "context" + "fmt" + "github.com/flyteorg/flytestdlib/database" + "github.com/go-gormigrate/gormigrate/v2" + gormLogger "gorm.io/gorm/logger" + "log" + "os" "testing" + "time" mocket "github.com/Selvatico/go-mocket" "github.com/stretchr/testify/assert" @@ -32,3 +40,80 @@ func GetDbForTest(t *testing.T) *gorm.DB { } return db } + +func TestNoopMigrations(t *testing.T) { + gLogger := gormLogger.New(log.New(os.Stdout, "\r\n", log.LstdFlags), gormLogger.Config{ + SlowThreshold: 200 * time.Millisecond, + LogLevel: gormLogger.Info, + IgnoreRecordNotFoundError: false, + Colorful: true, + }) + + gormConfig := &gorm.Config{ + Logger: gLogger, + DisableForeignKeyConstraintWhenMigrating: false, + } + + var gormDb *gorm.DB + pgConfig := database.PostgresConfig{ + Host: "localhost", + Port: 30001, + DbName: "migratecopy1", + User: "postgres", + Password: "postgres", + ExtraOptions: "", + Debug: false, + } + ctx := context.Background() + postgresDsn := database.PostgresDsn(ctx, pgConfig) + dialector := postgres.Open(postgresDsn) + gormDb, err := gorm.Open(dialector, gormConfig) + assert.NoError(t, err) + + fmt.Println(gormDb) + + m := gormigrate.New(gormDb, gormigrate.DefaultOptions, Migrations) + if err := m.Migrate(); err != nil { + fmt.Errorf("database migration failed: %v", err) + } + fmt.Println(ctx, "Migration ran successfully") +} + +// Before running, create database replicator; +func TestMigrationReplicate(t *testing.T) { + gLogger := gormLogger.New(log.New(os.Stdout, "\r\n", log.LstdFlags), gormLogger.Config{ + SlowThreshold: 200 * time.Millisecond, + LogLevel: gormLogger.Info, + IgnoreRecordNotFoundError: false, + Colorful: true, + }) + + gormConfig := &gorm.Config{ + Logger: gLogger, + DisableForeignKeyConstraintWhenMigrating: false, + } + + var gormDb *gorm.DB + pgConfig := database.PostgresConfig{ + Host: "localhost", + Port: 30001, + DbName: "replicator", // this should be a completely blank database + User: "postgres", + Password: "postgres", + ExtraOptions: "", + Debug: false, + } + ctx := context.Background() + postgresDsn := database.PostgresDsn(ctx, pgConfig) + dialector := postgres.Open(postgresDsn) + gormDb, err := gorm.Open(dialector, gormConfig) + assert.NoError(t, err) + + fmt.Println(gormDb) + + m := gormigrate.New(gormDb, gormigrate.DefaultOptions, NoopMigrations) + if err := m.Migrate(); err != nil { + fmt.Errorf("database migration failed: %v", err) + } + fmt.Println(ctx, "Migration ran successfully") +} From f34587036f716047fd4890260575656a1c91e587 Mon Sep 17 00:00:00 2001 From: Yee Hing Tong Date: Mon, 20 Mar 2023 14:44:45 -0700 Subject: [PATCH 3/8] add Executions table Signed-off-by: Yee Hing Tong --- flyte.sql | 1716 +++++++++++++++++++++++++ pkg/repositories/config/migrations.go | 69 +- replicate.sql | 1282 ++++++++++++++++++ 3 files changed, 3065 insertions(+), 2 deletions(-) create mode 100644 flyte.sql create mode 100644 replicate.sql diff --git a/flyte.sql b/flyte.sql new file mode 100644 index 000000000..8c9189601 --- /dev/null +++ b/flyte.sql @@ -0,0 +1,1716 @@ +-- +-- PostgreSQL database dump +-- + +-- Dumped from database version 15.1 +-- Dumped by pg_dump version 15.1 + +-- Started on 2023-03-20 14:15:17 PDT + +SET statement_timeout = 0; +SET lock_timeout = 0; +SET idle_in_transaction_session_timeout = 0; +SET client_encoding = 'UTF8'; +SET standard_conforming_strings = on; +SELECT pg_catalog.set_config('search_path', '', false); +SET check_function_bodies = false; +SET xmloption = content; +SET client_min_messages = warning; +SET row_security = off; + +SET default_tablespace = ''; + +SET default_table_access_method = heap; + +-- +-- TOC entry 236 (class 1259 OID 16540) +-- Name: artifact_data; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.artifact_data ( + created_at timestamp with time zone, + updated_at timestamp with time zone, + deleted_at timestamp with time zone, + dataset_project text NOT NULL, + dataset_name text NOT NULL, + dataset_domain text NOT NULL, + dataset_version text NOT NULL, + artifact_id text NOT NULL, + name text NOT NULL, + location text +); + + +ALTER TABLE public.artifact_data OWNER TO postgres; + +-- +-- TOC entry 233 (class 1259 OID 16516) +-- Name: artifacts; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.artifacts ( + created_at timestamp with time zone, + updated_at timestamp with time zone, + deleted_at timestamp with time zone, + dataset_project text NOT NULL, + dataset_name text NOT NULL, + dataset_domain text NOT NULL, + dataset_version text NOT NULL, + artifact_id text NOT NULL, + dataset_uuid uuid, + serialized_metadata bytea +); + + +ALTER TABLE public.artifacts OWNER TO postgres; + +-- +-- TOC entry 215 (class 1259 OID 16389) +-- Name: datasets; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.datasets ( + created_at timestamp with time zone, + updated_at timestamp with time zone, + deleted_at timestamp with time zone, + project text NOT NULL, + name text NOT NULL, + domain text NOT NULL, + version text NOT NULL, + uuid uuid, + serialized_metadata bytea +); + + +ALTER TABLE public.datasets OWNER TO postgres; + +-- +-- TOC entry 249 (class 1259 OID 16646) +-- Name: description_entities; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.description_entities ( + resource_type integer NOT NULL, + project text NOT NULL, + domain text NOT NULL, + name text NOT NULL, + version text NOT NULL, + id bigint NOT NULL, + created_at timestamp with time zone, + updated_at timestamp with time zone, + deleted_at timestamp with time zone, + short_description text, + long_description bytea, + link text +); + + +ALTER TABLE public.description_entities OWNER TO postgres; + +-- +-- TOC entry 248 (class 1259 OID 16645) +-- Name: description_entities_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres +-- + +CREATE SEQUENCE public.description_entities_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +ALTER TABLE public.description_entities_id_seq OWNER TO postgres; + +-- +-- TOC entry 3553 (class 0 OID 0) +-- Dependencies: 248 +-- Name: description_entities_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres +-- + +ALTER SEQUENCE public.description_entities_id_seq OWNED BY public.description_entities.id; + + +-- +-- TOC entry 228 (class 1259 OID 16484) +-- Name: execution_events; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.execution_events ( + id bigint NOT NULL, + created_at timestamp with time zone, + updated_at timestamp with time zone, + deleted_at timestamp with time zone, + execution_project text NOT NULL, + execution_domain text NOT NULL, + execution_name text NOT NULL, + request_id text, + occurred_at timestamp with time zone, + phase text NOT NULL +); + + +ALTER TABLE public.execution_events OWNER TO postgres; + +-- +-- TOC entry 227 (class 1259 OID 16483) +-- Name: execution_events_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres +-- + +CREATE SEQUENCE public.execution_events_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +ALTER TABLE public.execution_events_id_seq OWNER TO postgres; + +-- +-- TOC entry 3554 (class 0 OID 0) +-- Dependencies: 227 +-- Name: execution_events_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres +-- + +ALTER SEQUENCE public.execution_events_id_seq OWNED BY public.execution_events.id; + + +-- +-- TOC entry 226 (class 1259 OID 16465) +-- Name: executions; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.executions ( + id bigint NOT NULL, + created_at timestamp with time zone, + updated_at timestamp with time zone, + deleted_at timestamp with time zone, + execution_project text NOT NULL, + execution_domain text NOT NULL, + execution_name text NOT NULL, + launch_plan_id bigint, + workflow_id bigint, + task_id bigint, + phase text, + closure bytea, + spec bytea NOT NULL, + started_at timestamp with time zone, + execution_created_at timestamp with time zone, + execution_updated_at timestamp with time zone, + duration bigint, + abort_cause text, + mode integer, + source_execution_id bigint, + parent_node_execution_id bigint, + cluster text, + inputs_uri text, + user_inputs_uri text, + error_kind text, + error_code text, + "user" text, + state integer DEFAULT 0, + launch_entity text +); + + +ALTER TABLE public.executions OWNER TO postgres; + +-- +-- TOC entry 225 (class 1259 OID 16464) +-- Name: executions_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres +-- + +CREATE SEQUENCE public.executions_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +ALTER TABLE public.executions_id_seq OWNER TO postgres; + +-- +-- TOC entry 3555 (class 0 OID 0) +-- Dependencies: 225 +-- Name: executions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres +-- + +ALTER SEQUENCE public.executions_id_seq OWNED BY public.executions.id; + + +-- +-- TOC entry 224 (class 1259 OID 16451) +-- Name: launch_plans; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.launch_plans ( + id bigint NOT NULL, + created_at timestamp with time zone, + updated_at timestamp with time zone, + deleted_at timestamp with time zone, + project text NOT NULL, + domain text NOT NULL, + name text NOT NULL, + version text NOT NULL, + spec bytea NOT NULL, + workflow_id bigint, + closure bytea NOT NULL, + state integer DEFAULT 0, + digest bytea, + schedule_type text +); + + +ALTER TABLE public.launch_plans OWNER TO postgres; + +-- +-- TOC entry 223 (class 1259 OID 16450) +-- Name: launch_plans_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres +-- + +CREATE SEQUENCE public.launch_plans_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +ALTER TABLE public.launch_plans_id_seq OWNER TO postgres; + +-- +-- TOC entry 3556 (class 0 OID 0) +-- Dependencies: 223 +-- Name: launch_plans_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres +-- + +ALTER SEQUENCE public.launch_plans_id_seq OWNED BY public.launch_plans.id; + + +-- +-- TOC entry 214 (class 1259 OID 16386) +-- Name: migrations; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.migrations ( + id character varying(255) NOT NULL +); + + +ALTER TABLE public.migrations OWNER TO postgres; + +-- +-- TOC entry 241 (class 1259 OID 16570) +-- Name: named_entity_metadata; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.named_entity_metadata ( + id bigint NOT NULL, + created_at timestamp with time zone, + updated_at timestamp with time zone, + deleted_at timestamp with time zone, + resource_type integer NOT NULL, + project text NOT NULL, + domain text NOT NULL, + name text NOT NULL, + description character varying(300), + state integer DEFAULT 0 +); + + +ALTER TABLE public.named_entity_metadata OWNER TO postgres; + +-- +-- TOC entry 240 (class 1259 OID 16569) +-- Name: named_entity_metadata_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres +-- + +CREATE SEQUENCE public.named_entity_metadata_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +ALTER TABLE public.named_entity_metadata_id_seq OWNER TO postgres; + +-- +-- TOC entry 3557 (class 0 OID 0) +-- Dependencies: 240 +-- Name: named_entity_metadata_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres +-- + +ALTER SEQUENCE public.named_entity_metadata_id_seq OWNED BY public.named_entity_metadata.id; + + +-- +-- TOC entry 232 (class 1259 OID 16508) +-- Name: node_execution_events; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.node_execution_events ( + id bigint NOT NULL, + created_at timestamp with time zone, + updated_at timestamp with time zone, + deleted_at timestamp with time zone, + execution_project text NOT NULL, + execution_domain text NOT NULL, + execution_name text NOT NULL, + node_id text NOT NULL, + request_id text, + occurred_at timestamp with time zone, + phase text NOT NULL +); + + +ALTER TABLE public.node_execution_events OWNER TO postgres; + +-- +-- TOC entry 231 (class 1259 OID 16507) +-- Name: node_execution_events_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres +-- + +CREATE SEQUENCE public.node_execution_events_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +ALTER TABLE public.node_execution_events_id_seq OWNER TO postgres; + +-- +-- TOC entry 3558 (class 0 OID 0) +-- Dependencies: 231 +-- Name: node_execution_events_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres +-- + +ALTER SEQUENCE public.node_execution_events_id_seq OWNED BY public.node_execution_events.id; + + +-- +-- TOC entry 230 (class 1259 OID 16495) +-- Name: node_executions; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.node_executions ( + id bigint NOT NULL, + created_at timestamp with time zone, + updated_at timestamp with time zone, + deleted_at timestamp with time zone, + execution_project text NOT NULL, + execution_domain text NOT NULL, + execution_name text NOT NULL, + node_id text NOT NULL, + phase text, + input_uri text, + closure bytea, + started_at timestamp with time zone, + node_execution_created_at timestamp with time zone, + node_execution_updated_at timestamp with time zone, + duration bigint, + parent_task_execution_id bigint, + dynamic_workflow_remote_closure_reference text, + internal_data bytea, + node_execution_metadata bytea, + parent_id bigint, + cache_status text, + error_kind text, + error_code text +); + + +ALTER TABLE public.node_executions OWNER TO postgres; + +-- +-- TOC entry 229 (class 1259 OID 16494) +-- Name: node_executions_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres +-- + +CREATE SEQUENCE public.node_executions_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +ALTER TABLE public.node_executions_id_seq OWNER TO postgres; + +-- +-- TOC entry 3559 (class 0 OID 0) +-- Dependencies: 229 +-- Name: node_executions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres +-- + +ALTER SEQUENCE public.node_executions_id_seq OWNED BY public.node_executions.id; + + +-- +-- TOC entry 237 (class 1259 OID 16547) +-- Name: partition_keys; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.partition_keys ( + created_at timestamp with time zone, + updated_at timestamp with time zone, + deleted_at timestamp with time zone, + dataset_uuid uuid NOT NULL, + name text NOT NULL +); + + +ALTER TABLE public.partition_keys OWNER TO postgres; + +-- +-- TOC entry 238 (class 1259 OID 16554) +-- Name: partitions; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.partitions ( + created_at timestamp with time zone, + updated_at timestamp with time zone, + deleted_at timestamp with time zone, + dataset_uuid uuid NOT NULL, + key text NOT NULL, + value text NOT NULL, + artifact_id text NOT NULL +); + + +ALTER TABLE public.partitions OWNER TO postgres; + +-- +-- TOC entry 217 (class 1259 OID 16399) +-- Name: projects; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.projects ( + id bigint NOT NULL, + created_at timestamp with time zone, + updated_at timestamp with time zone, + deleted_at timestamp with time zone, + identifier text NOT NULL, + name text, + description character varying(300), + labels bytea, + state integer DEFAULT 0 +); + + +ALTER TABLE public.projects OWNER TO postgres; + +-- +-- TOC entry 216 (class 1259 OID 16397) +-- Name: projects_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres +-- + +CREATE SEQUENCE public.projects_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +ALTER TABLE public.projects_id_seq OWNER TO postgres; + +-- +-- TOC entry 3560 (class 0 OID 0) +-- Dependencies: 216 +-- Name: projects_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres +-- + +ALTER SEQUENCE public.projects_id_seq OWNED BY public.projects.id; + + +-- +-- TOC entry 239 (class 1259 OID 16562) +-- Name: reservations; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.reservations ( + created_at timestamp with time zone, + updated_at timestamp with time zone, + deleted_at timestamp with time zone, + dataset_project text NOT NULL, + dataset_name text NOT NULL, + dataset_domain text NOT NULL, + dataset_version text NOT NULL, + tag_name text NOT NULL, + owner_id text, + expires_at timestamp with time zone, + serialized_metadata bytea +); + + +ALTER TABLE public.reservations OWNER TO postgres; + +-- +-- TOC entry 243 (class 1259 OID 16583) +-- Name: resources; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.resources ( + id bigint NOT NULL, + created_at timestamp with time zone, + updated_at timestamp with time zone, + deleted_at timestamp with time zone, + project text, + domain text, + workflow text, + launch_plan text, + resource_type text, + priority integer, + attributes bytea +); + + +ALTER TABLE public.resources OWNER TO postgres; + +-- +-- TOC entry 242 (class 1259 OID 16582) +-- Name: resources_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres +-- + +CREATE SEQUENCE public.resources_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +ALTER TABLE public.resources_id_seq OWNER TO postgres; + +-- +-- TOC entry 3561 (class 0 OID 0) +-- Dependencies: 242 +-- Name: resources_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres +-- + +ALTER SEQUENCE public.resources_id_seq OWNED BY public.resources.id; + + +-- +-- TOC entry 245 (class 1259 OID 16595) +-- Name: schedulable_entities; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.schedulable_entities ( + id bigint NOT NULL, + created_at timestamp with time zone, + updated_at timestamp with time zone, + deleted_at timestamp with time zone, + project text NOT NULL, + domain text NOT NULL, + name text NOT NULL, + version text NOT NULL, + cron_expression text, + fixed_rate_value bigint, + unit integer, + kickoff_time_input_arg text, + active boolean +); + + +ALTER TABLE public.schedulable_entities OWNER TO postgres; + +-- +-- TOC entry 244 (class 1259 OID 16594) +-- Name: schedulable_entities_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres +-- + +CREATE SEQUENCE public.schedulable_entities_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +ALTER TABLE public.schedulable_entities_id_seq OWNER TO postgres; + +-- +-- TOC entry 3562 (class 0 OID 0) +-- Dependencies: 244 +-- Name: schedulable_entities_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres +-- + +ALTER SEQUENCE public.schedulable_entities_id_seq OWNED BY public.schedulable_entities.id; + + +-- +-- TOC entry 247 (class 1259 OID 16606) +-- Name: schedule_entities_snapshots; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.schedule_entities_snapshots ( + id bigint NOT NULL, + created_at timestamp with time zone, + updated_at timestamp with time zone, + deleted_at timestamp with time zone, + snapshot bytea +); + + +ALTER TABLE public.schedule_entities_snapshots OWNER TO postgres; + +-- +-- TOC entry 246 (class 1259 OID 16605) +-- Name: schedule_entities_snapshots_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres +-- + +CREATE SEQUENCE public.schedule_entities_snapshots_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +ALTER TABLE public.schedule_entities_snapshots_id_seq OWNER TO postgres; + +-- +-- TOC entry 3563 (class 0 OID 0) +-- Dependencies: 246 +-- Name: schedule_entities_snapshots_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres +-- + +ALTER SEQUENCE public.schedule_entities_snapshots_id_seq OWNED BY public.schedule_entities_snapshots.id; + + +-- +-- TOC entry 251 (class 1259 OID 16658) +-- Name: signals; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.signals ( + id bigint NOT NULL, + created_at timestamp with time zone, + updated_at timestamp with time zone, + deleted_at timestamp with time zone, + execution_project text NOT NULL, + execution_domain text NOT NULL, + execution_name text NOT NULL, + signal_id text NOT NULL, + type bytea NOT NULL, + value bytea +); + + +ALTER TABLE public.signals OWNER TO postgres; + +-- +-- TOC entry 250 (class 1259 OID 16657) +-- Name: signals_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres +-- + +CREATE SEQUENCE public.signals_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +ALTER TABLE public.signals_id_seq OWNER TO postgres; + +-- +-- TOC entry 3564 (class 0 OID 0) +-- Dependencies: 250 +-- Name: signals_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres +-- + +ALTER SEQUENCE public.signals_id_seq OWNED BY public.signals.id; + + +-- +-- TOC entry 218 (class 1259 OID 16416) +-- Name: tags; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.tags ( + created_at timestamp with time zone, + updated_at timestamp with time zone, + deleted_at timestamp with time zone, + dataset_project text NOT NULL, + dataset_name text NOT NULL, + dataset_domain text NOT NULL, + dataset_version text NOT NULL, + tag_name text NOT NULL, + artifact_id text, + dataset_uuid uuid +); + + +ALTER TABLE public.tags OWNER TO postgres; + +-- +-- TOC entry 235 (class 1259 OID 16528) +-- Name: task_executions; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.task_executions ( + id bigint NOT NULL, + created_at timestamp with time zone, + updated_at timestamp with time zone, + deleted_at timestamp with time zone, + project text NOT NULL, + domain text NOT NULL, + name text NOT NULL, + version text NOT NULL, + execution_project text NOT NULL, + execution_domain text NOT NULL, + execution_name text NOT NULL, + node_id text NOT NULL, + retry_attempt bigint NOT NULL, + phase text, + phase_version bigint, + input_uri text, + closure bytea, + started_at timestamp with time zone, + task_execution_created_at timestamp with time zone, + task_execution_updated_at timestamp with time zone, + duration bigint +); + + +ALTER TABLE public.task_executions OWNER TO postgres; + +-- +-- TOC entry 234 (class 1259 OID 16527) +-- Name: task_executions_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres +-- + +CREATE SEQUENCE public.task_executions_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +ALTER TABLE public.task_executions_id_seq OWNER TO postgres; + +-- +-- TOC entry 3565 (class 0 OID 0) +-- Dependencies: 234 +-- Name: task_executions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres +-- + +ALTER SEQUENCE public.task_executions_id_seq OWNED BY public.task_executions.id; + + +-- +-- TOC entry 220 (class 1259 OID 16425) +-- Name: tasks; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.tasks ( + id bigint NOT NULL, + created_at timestamp with time zone, + updated_at timestamp with time zone, + deleted_at timestamp with time zone, + project text NOT NULL, + domain text NOT NULL, + name text NOT NULL, + version text NOT NULL, + closure bytea NOT NULL, + digest bytea, + type text, + short_description text +); + + +ALTER TABLE public.tasks OWNER TO postgres; + +-- +-- TOC entry 219 (class 1259 OID 16423) +-- Name: tasks_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres +-- + +CREATE SEQUENCE public.tasks_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +ALTER TABLE public.tasks_id_seq OWNER TO postgres; + +-- +-- TOC entry 3566 (class 0 OID 0) +-- Dependencies: 219 +-- Name: tasks_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres +-- + +ALTER SEQUENCE public.tasks_id_seq OWNED BY public.tasks.id; + + +-- +-- TOC entry 222 (class 1259 OID 16438) +-- Name: workflows; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.workflows ( + id bigint NOT NULL, + created_at timestamp with time zone, + updated_at timestamp with time zone, + deleted_at timestamp with time zone, + project text NOT NULL, + domain text NOT NULL, + name text NOT NULL, + version text NOT NULL, + typed_interface bytea, + remote_closure_identifier text NOT NULL, + digest bytea, + short_description text +); + + +ALTER TABLE public.workflows OWNER TO postgres; + +-- +-- TOC entry 221 (class 1259 OID 16437) +-- Name: workflows_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres +-- + +CREATE SEQUENCE public.workflows_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +ALTER TABLE public.workflows_id_seq OWNER TO postgres; + +-- +-- TOC entry 3567 (class 0 OID 0) +-- Dependencies: 221 +-- Name: workflows_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres +-- + +ALTER SEQUENCE public.workflows_id_seq OWNED BY public.workflows.id; + + +-- +-- TOC entry 3297 (class 2604 OID 16649) +-- Name: description_entities id; Type: DEFAULT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.description_entities ALTER COLUMN id SET DEFAULT nextval('public.description_entities_id_seq'::regclass); + + +-- +-- TOC entry 3288 (class 2604 OID 16616) +-- Name: execution_events id; Type: DEFAULT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.execution_events ALTER COLUMN id SET DEFAULT nextval('public.execution_events_id_seq'::regclass); + + +-- +-- TOC entry 3286 (class 2604 OID 16618) +-- Name: executions id; Type: DEFAULT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.executions ALTER COLUMN id SET DEFAULT nextval('public.executions_id_seq'::regclass); + + +-- +-- TOC entry 3284 (class 2604 OID 16620) +-- Name: launch_plans id; Type: DEFAULT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.launch_plans ALTER COLUMN id SET DEFAULT nextval('public.launch_plans_id_seq'::regclass); + + +-- +-- TOC entry 3292 (class 2604 OID 16622) +-- Name: named_entity_metadata id; Type: DEFAULT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.named_entity_metadata ALTER COLUMN id SET DEFAULT nextval('public.named_entity_metadata_id_seq'::regclass); + + +-- +-- TOC entry 3290 (class 2604 OID 16624) +-- Name: node_execution_events id; Type: DEFAULT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.node_execution_events ALTER COLUMN id SET DEFAULT nextval('public.node_execution_events_id_seq'::regclass); + + +-- +-- TOC entry 3289 (class 2604 OID 16626) +-- Name: node_executions id; Type: DEFAULT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.node_executions ALTER COLUMN id SET DEFAULT nextval('public.node_executions_id_seq'::regclass); + + +-- +-- TOC entry 3280 (class 2604 OID 16628) +-- Name: projects id; Type: DEFAULT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.projects ALTER COLUMN id SET DEFAULT nextval('public.projects_id_seq'::regclass); + + +-- +-- TOC entry 3294 (class 2604 OID 16630) +-- Name: resources id; Type: DEFAULT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.resources ALTER COLUMN id SET DEFAULT nextval('public.resources_id_seq'::regclass); + + +-- +-- TOC entry 3295 (class 2604 OID 16633) +-- Name: schedulable_entities id; Type: DEFAULT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.schedulable_entities ALTER COLUMN id SET DEFAULT nextval('public.schedulable_entities_id_seq'::regclass); + + +-- +-- TOC entry 3296 (class 2604 OID 16635) +-- Name: schedule_entities_snapshots id; Type: DEFAULT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.schedule_entities_snapshots ALTER COLUMN id SET DEFAULT nextval('public.schedule_entities_snapshots_id_seq'::regclass); + + +-- +-- TOC entry 3298 (class 2604 OID 16661) +-- Name: signals id; Type: DEFAULT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.signals ALTER COLUMN id SET DEFAULT nextval('public.signals_id_seq'::regclass); + + +-- +-- TOC entry 3291 (class 2604 OID 16639) +-- Name: task_executions id; Type: DEFAULT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.task_executions ALTER COLUMN id SET DEFAULT nextval('public.task_executions_id_seq'::regclass); + + +-- +-- TOC entry 3282 (class 2604 OID 16641) +-- Name: tasks id; Type: DEFAULT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.tasks ALTER COLUMN id SET DEFAULT nextval('public.tasks_id_seq'::regclass); + + +-- +-- TOC entry 3283 (class 2604 OID 16643) +-- Name: workflows id; Type: DEFAULT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.workflows ALTER COLUMN id SET DEFAULT nextval('public.workflows_id_seq'::regclass); + + +-- +-- TOC entry 3372 (class 2606 OID 16546) +-- Name: artifact_data artifact_data_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.artifact_data + ADD CONSTRAINT artifact_data_pkey PRIMARY KEY (dataset_project, dataset_name, dataset_domain, dataset_version, artifact_id, name); + + +-- +-- TOC entry 3364 (class 2606 OID 16523) +-- Name: artifacts artifacts_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.artifacts + ADD CONSTRAINT artifacts_pkey PRIMARY KEY (dataset_project, dataset_name, dataset_domain, dataset_version, artifact_id); + + +-- +-- TOC entry 3305 (class 2606 OID 16398) +-- Name: datasets datasets_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.datasets + ADD CONSTRAINT datasets_pkey PRIMARY KEY (project, name, domain, version); + + +-- +-- TOC entry 3307 (class 2606 OID 16404) +-- Name: datasets datasets_uuid_key; Type: CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.datasets + ADD CONSTRAINT datasets_uuid_key UNIQUE (uuid); + + +-- +-- TOC entry 3397 (class 2606 OID 16653) +-- Name: description_entities description_entities_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.description_entities + ADD CONSTRAINT description_entities_pkey PRIMARY KEY (resource_type, project, domain, name, version); + + +-- +-- TOC entry 3346 (class 2606 OID 16491) +-- Name: execution_events execution_events_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.execution_events + ADD CONSTRAINT execution_events_pkey PRIMARY KEY (execution_project, execution_domain, execution_name, phase); + + +-- +-- TOC entry 3335 (class 2606 OID 16473) +-- Name: executions executions_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.executions + ADD CONSTRAINT executions_pkey PRIMARY KEY (execution_project, execution_domain, execution_name); + + +-- +-- TOC entry 3332 (class 2606 OID 16459) +-- Name: launch_plans launch_plans_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.launch_plans + ADD CONSTRAINT launch_plans_pkey PRIMARY KEY (project, domain, name, version); + + +-- +-- TOC entry 3300 (class 2606 OID 16393) +-- Name: migrations migrations_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.migrations + ADD CONSTRAINT migrations_pkey PRIMARY KEY (id); + + +-- +-- TOC entry 3383 (class 2606 OID 16578) +-- Name: named_entity_metadata named_entity_metadata_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.named_entity_metadata + ADD CONSTRAINT named_entity_metadata_pkey PRIMARY KEY (resource_type, project, domain, name); + + +-- +-- TOC entry 3361 (class 2606 OID 16515) +-- Name: node_execution_events node_execution_events_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.node_execution_events + ADD CONSTRAINT node_execution_events_pkey PRIMARY KEY (execution_project, execution_domain, execution_name, node_id, phase); + + +-- +-- TOC entry 3356 (class 2606 OID 16502) +-- Name: node_executions node_executions_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.node_executions + ADD CONSTRAINT node_executions_pkey PRIMARY KEY (execution_project, execution_domain, execution_name, node_id); + + +-- +-- TOC entry 3374 (class 2606 OID 16553) +-- Name: partition_keys partition_keys_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.partition_keys + ADD CONSTRAINT partition_keys_pkey PRIMARY KEY (dataset_uuid, name); + + +-- +-- TOC entry 3377 (class 2606 OID 16560) +-- Name: partitions partitions_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.partitions + ADD CONSTRAINT partitions_pkey PRIMARY KEY (dataset_uuid, key, value, artifact_id); + + +-- +-- TOC entry 3312 (class 2606 OID 16410) +-- Name: projects projects_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.projects + ADD CONSTRAINT projects_pkey PRIMARY KEY (identifier); + + +-- +-- TOC entry 3379 (class 2606 OID 16568) +-- Name: reservations reservations_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.reservations + ADD CONSTRAINT reservations_pkey PRIMARY KEY (dataset_project, dataset_name, dataset_domain, dataset_version, tag_name); + + +-- +-- TOC entry 3387 (class 2606 OID 16632) +-- Name: resources resources_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.resources + ADD CONSTRAINT resources_pkey PRIMARY KEY (id); + + +-- +-- TOC entry 3391 (class 2606 OID 16602) +-- Name: schedulable_entities schedulable_entities_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.schedulable_entities + ADD CONSTRAINT schedulable_entities_pkey PRIMARY KEY (project, domain, name, version); + + +-- +-- TOC entry 3395 (class 2606 OID 16637) +-- Name: schedule_entities_snapshots schedule_entities_snapshots_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.schedule_entities_snapshots + ADD CONSTRAINT schedule_entities_snapshots_pkey PRIMARY KEY (id); + + +-- +-- TOC entry 3405 (class 2606 OID 16665) +-- Name: signals signals_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.signals + ADD CONSTRAINT signals_pkey PRIMARY KEY (execution_project, execution_domain, execution_name, signal_id); + + +-- +-- TOC entry 3315 (class 2606 OID 16422) +-- Name: tags tags_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.tags + ADD CONSTRAINT tags_pkey PRIMARY KEY (dataset_project, dataset_name, dataset_domain, dataset_version, tag_name); + + +-- +-- TOC entry 3370 (class 2606 OID 16535) +-- Name: task_executions task_executions_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.task_executions + ADD CONSTRAINT task_executions_pkey PRIMARY KEY (project, domain, name, version, execution_project, execution_domain, execution_name, node_id, retry_attempt); + + +-- +-- TOC entry 3321 (class 2606 OID 16432) +-- Name: tasks tasks_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.tasks + ADD CONSTRAINT tasks_pkey PRIMARY KEY (project, domain, name, version); + + +-- +-- TOC entry 3327 (class 2606 OID 16445) +-- Name: workflows workflows_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.workflows + ADD CONSTRAINT workflows_pkey PRIMARY KEY (project, domain, name, version); + + +-- +-- TOC entry 3362 (class 1259 OID 16526) +-- Name: artifacts_dataset_uuid_idx; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX artifacts_dataset_uuid_idx ON public.artifacts USING btree (dataset_uuid); + + +-- +-- TOC entry 3301 (class 1259 OID 16411) +-- Name: dataset_domain_idx; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX dataset_domain_idx ON public.datasets USING btree (domain); + + +-- +-- TOC entry 3302 (class 1259 OID 16412) +-- Name: dataset_name_idx; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX dataset_name_idx ON public.datasets USING btree (name); + + +-- +-- TOC entry 3303 (class 1259 OID 16408) +-- Name: dataset_version_idx; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX dataset_version_idx ON public.datasets USING btree (version); + + +-- +-- TOC entry 3398 (class 1259 OID 16656) +-- Name: description_entity_project_domain_name_version_idx; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX description_entity_project_domain_name_version_idx ON public.description_entities USING btree (resource_type, project, domain, name, version); + + +-- +-- TOC entry 3399 (class 1259 OID 16654) +-- Name: idx_description_entities_deleted_at; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_description_entities_deleted_at ON public.description_entities USING btree (deleted_at); + + +-- +-- TOC entry 3400 (class 1259 OID 16655) +-- Name: idx_description_entities_id; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_description_entities_id ON public.description_entities USING btree (id); + + +-- +-- TOC entry 3347 (class 1259 OID 16492) +-- Name: idx_execution_events_deleted_at; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_execution_events_deleted_at ON public.execution_events USING btree (deleted_at); + + +-- +-- TOC entry 3348 (class 1259 OID 16617) +-- Name: idx_execution_events_id; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_execution_events_id ON public.execution_events USING btree (id); + + +-- +-- TOC entry 3336 (class 1259 OID 16481) +-- Name: idx_executions_created_at; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_executions_created_at ON public.executions USING btree (execution_created_at); + + +-- +-- TOC entry 3337 (class 1259 OID 16478) +-- Name: idx_executions_deleted_at; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_executions_deleted_at ON public.executions USING btree (deleted_at); + + +-- +-- TOC entry 3338 (class 1259 OID 16480) +-- Name: idx_executions_error_kind; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_executions_error_kind ON public.executions USING btree (error_kind); + + +-- +-- TOC entry 3339 (class 1259 OID 16619) +-- Name: idx_executions_id; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_executions_id ON public.executions USING btree (id); + + +-- +-- TOC entry 3340 (class 1259 OID 16474) +-- Name: idx_executions_launch_plan_id; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_executions_launch_plan_id ON public.executions USING btree (launch_plan_id); + + +-- +-- TOC entry 3341 (class 1259 OID 16476) +-- Name: idx_executions_state; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_executions_state ON public.executions USING btree (state); + + +-- +-- TOC entry 3342 (class 1259 OID 16482) +-- Name: idx_executions_task_id; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_executions_task_id ON public.executions USING btree (task_id); + + +-- +-- TOC entry 3343 (class 1259 OID 16479) +-- Name: idx_executions_user; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_executions_user ON public.executions USING btree ("user"); + + +-- +-- TOC entry 3344 (class 1259 OID 16477) +-- Name: idx_executions_workflow_id; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_executions_workflow_id ON public.executions USING btree (workflow_id); + + +-- +-- TOC entry 3328 (class 1259 OID 16462) +-- Name: idx_launch_plans_deleted_at; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_launch_plans_deleted_at ON public.launch_plans USING btree (deleted_at); + + +-- +-- TOC entry 3329 (class 1259 OID 16621) +-- Name: idx_launch_plans_id; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_launch_plans_id ON public.launch_plans USING btree (id); + + +-- +-- TOC entry 3330 (class 1259 OID 16460) +-- Name: idx_launch_plans_workflow_id; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_launch_plans_workflow_id ON public.launch_plans USING btree (workflow_id); + + +-- +-- TOC entry 3380 (class 1259 OID 16581) +-- Name: idx_named_entity_metadata_deleted_at; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_named_entity_metadata_deleted_at ON public.named_entity_metadata USING btree (deleted_at); + + +-- +-- TOC entry 3381 (class 1259 OID 16623) +-- Name: idx_named_entity_metadata_id; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_named_entity_metadata_id ON public.named_entity_metadata USING btree (id); + + +-- +-- TOC entry 3357 (class 1259 OID 16524) +-- Name: idx_node_execution_events_deleted_at; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_node_execution_events_deleted_at ON public.node_execution_events USING btree (deleted_at); + + +-- +-- TOC entry 3358 (class 1259 OID 16625) +-- Name: idx_node_execution_events_id; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_node_execution_events_id ON public.node_execution_events USING btree (id); + + +-- +-- TOC entry 3359 (class 1259 OID 16521) +-- Name: idx_node_execution_events_node_id; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_node_execution_events_node_id ON public.node_execution_events USING btree (node_id); + + +-- +-- TOC entry 3349 (class 1259 OID 16505) +-- Name: idx_node_executions_deleted_at; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_node_executions_deleted_at ON public.node_executions USING btree (deleted_at); + + +-- +-- TOC entry 3350 (class 1259 OID 16593) +-- Name: idx_node_executions_error_kind; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_node_executions_error_kind ON public.node_executions USING btree (error_kind); + + +-- +-- TOC entry 3351 (class 1259 OID 16627) +-- Name: idx_node_executions_id; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_node_executions_id ON public.node_executions USING btree (id); + + +-- +-- TOC entry 3352 (class 1259 OID 16504) +-- Name: idx_node_executions_node_id; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_node_executions_node_id ON public.node_executions USING btree (node_id); + + +-- +-- TOC entry 3353 (class 1259 OID 16592) +-- Name: idx_node_executions_parent_id; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_node_executions_parent_id ON public.node_executions USING btree (parent_id); + + +-- +-- TOC entry 3354 (class 1259 OID 16503) +-- Name: idx_node_executions_parent_task_execution_id; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_node_executions_parent_task_execution_id ON public.node_executions USING btree (parent_task_execution_id); + + +-- +-- TOC entry 3375 (class 1259 OID 16561) +-- Name: idx_partitions_artifact_id; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_partitions_artifact_id ON public.partitions USING btree (artifact_id); + + +-- +-- TOC entry 3308 (class 1259 OID 16414) +-- Name: idx_projects_deleted_at; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_projects_deleted_at ON public.projects USING btree (deleted_at); + + +-- +-- TOC entry 3309 (class 1259 OID 16629) +-- Name: idx_projects_id; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_projects_id ON public.projects USING btree (id); + + +-- +-- TOC entry 3310 (class 1259 OID 16413) +-- Name: idx_projects_state; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_projects_state ON public.projects USING btree (state); + + +-- +-- TOC entry 3388 (class 1259 OID 16603) +-- Name: idx_schedulable_entities_deleted_at; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_schedulable_entities_deleted_at ON public.schedulable_entities USING btree (deleted_at); + + +-- +-- TOC entry 3389 (class 1259 OID 16634) +-- Name: idx_schedulable_entities_id; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_schedulable_entities_id ON public.schedulable_entities USING btree (id); + + +-- +-- TOC entry 3392 (class 1259 OID 16614) +-- Name: idx_schedule_entities_snapshots_deleted_at; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_schedule_entities_snapshots_deleted_at ON public.schedule_entities_snapshots USING btree (deleted_at); + + +-- +-- TOC entry 3393 (class 1259 OID 16638) +-- Name: idx_schedule_entities_snapshots_id; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_schedule_entities_snapshots_id ON public.schedule_entities_snapshots USING btree (id); + + +-- +-- TOC entry 3401 (class 1259 OID 16667) +-- Name: idx_signals_deleted_at; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_signals_deleted_at ON public.signals USING btree (deleted_at); + + +-- +-- TOC entry 3402 (class 1259 OID 16668) +-- Name: idx_signals_id; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_signals_id ON public.signals USING btree (id); + + +-- +-- TOC entry 3403 (class 1259 OID 16666) +-- Name: idx_signals_signal_id; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_signals_signal_id ON public.signals USING btree (signal_id); + + +-- +-- TOC entry 3365 (class 1259 OID 16538) +-- Name: idx_task_executions_deleted_at; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_task_executions_deleted_at ON public.task_executions USING btree (deleted_at); + + +-- +-- TOC entry 3366 (class 1259 OID 16537) +-- Name: idx_task_executions_exec; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_task_executions_exec ON public.task_executions USING btree (execution_project, execution_domain, execution_name, node_id); + + +-- +-- TOC entry 3367 (class 1259 OID 16640) +-- Name: idx_task_executions_id; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_task_executions_id ON public.task_executions USING btree (id); + + +-- +-- TOC entry 3368 (class 1259 OID 16536) +-- Name: idx_task_executions_node_id; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_task_executions_node_id ON public.task_executions USING btree (node_id); + + +-- +-- TOC entry 3316 (class 1259 OID 16434) +-- Name: idx_tasks_deleted_at; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_tasks_deleted_at ON public.tasks USING btree (deleted_at); + + +-- +-- TOC entry 3317 (class 1259 OID 16642) +-- Name: idx_tasks_id; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_tasks_id ON public.tasks USING btree (id); + + +-- +-- TOC entry 3322 (class 1259 OID 16448) +-- Name: idx_workflows_deleted_at; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_workflows_deleted_at ON public.workflows USING btree (deleted_at); + + +-- +-- TOC entry 3323 (class 1259 OID 16644) +-- Name: idx_workflows_id; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_workflows_id ON public.workflows USING btree (id); + + +-- +-- TOC entry 3333 (class 1259 OID 16461) +-- Name: lp_project_domain_name_idx; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX lp_project_domain_name_idx ON public.launch_plans USING btree (project, domain, name); + + +-- +-- TOC entry 3384 (class 1259 OID 16580) +-- Name: named_entity_metadata_type_project_domain_name_idx; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX named_entity_metadata_type_project_domain_name_idx ON public.named_entity_metadata USING btree (resource_type, project, domain, name); + + +-- +-- TOC entry 3385 (class 1259 OID 16591) +-- Name: resource_idx; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE UNIQUE INDEX resource_idx ON public.resources USING btree (project, domain, workflow, launch_plan, resource_type); + + +-- +-- TOC entry 3313 (class 1259 OID 16424) +-- Name: tags_dataset_uuid_idx; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX tags_dataset_uuid_idx ON public.tags USING btree (dataset_uuid); + + +-- +-- TOC entry 3318 (class 1259 OID 16436) +-- Name: task_project_domain_idx; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX task_project_domain_idx ON public.tasks USING btree (project, domain); + + +-- +-- TOC entry 3319 (class 1259 OID 16433) +-- Name: task_project_domain_name_idx; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX task_project_domain_name_idx ON public.tasks USING btree (project, domain, name); + + +-- +-- TOC entry 3324 (class 1259 OID 16446) +-- Name: workflow_project_domain_idx; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX workflow_project_domain_idx ON public.workflows USING btree (project, domain); + + +-- +-- TOC entry 3325 (class 1259 OID 16447) +-- Name: workflow_project_domain_name_idx; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX workflow_project_domain_name_idx ON public.workflows USING btree (project, domain, name); + + +-- Completed on 2023-03-20 14:15:25 PDT + +-- +-- PostgreSQL database dump complete +-- + diff --git a/pkg/repositories/config/migrations.go b/pkg/repositories/config/migrations.go index 8a2201fe3..3e7e6437c 100644 --- a/pkg/repositories/config/migrations.go +++ b/pkg/repositories/config/migrations.go @@ -4,6 +4,7 @@ import ( "database/sql" "fmt" "github.com/flyteorg/flyteidl/gen/pb-go/flyteidl/core" + "github.com/flyteorg/flytestdlib/storage" "time" "github.com/flyteorg/flyteadmin/pkg/repositories/models" @@ -581,7 +582,71 @@ var NoopMigrations = []*gormigrate.Migration{ }, { - ID: "pg-noop-2023-03-31-noop-taskexecution-3", + ID: "pg-noop-2023-03-31-noop-execution", + Migrate: func(tx *gorm.DB) error { + type ExecutionKey struct { + Project string `gorm:"primary_key;column:execution_project" valid:"length(0|255)"` + Domain string `gorm:"primary_key;column:execution_domain" valid:"length(0|255)"` + Name string `gorm:"primary_key;column:execution_name" valid:"length(0|255)"` + } + + type Execution struct { + ID uint `gorm:"index;autoIncrement;not null"` + CreatedAt time.Time + UpdatedAt time.Time + DeletedAt *time.Time `gorm:"index"` + ExecutionKey + LaunchPlanID uint `gorm:"index"` + WorkflowID uint `gorm:"index"` + TaskID uint `gorm:"index"` + Phase string `valid:"length(0|255)"` + Closure []byte + Spec []byte `gorm:"not null"` + StartedAt *time.Time + // Corresponds to the CreatedAt field in the Execution closure. + // Prefixed with Execution to avoid clashes with gorm.Model CreatedAt + ExecutionCreatedAt *time.Time `gorm:"index:idx_executions_created_at"` + // Corresponds to the UpdatedAt field in the Execution closure + // Prefixed with Execution to avoid clashes with gorm.Model UpdatedAt + ExecutionUpdatedAt *time.Time + Duration time.Duration + // In the case of an aborted execution this string may be non-empty. + // It should be ignored for any other value of phase other than aborted. + AbortCause string `valid:"length(0|255)"` + // Corresponds to the execution mode used to trigger this execution + Mode int32 + // The "parent" execution (if there is one) that is related to this execution. + SourceExecutionID uint + // The parent node execution if this was launched by a node + ParentNodeExecutionID uint + // Cluster where execution was triggered + Cluster string `valid:"length(0|255)"` + // Offloaded location of inputs LiteralMap. These are the inputs evaluated and contain applied defaults. + InputsURI storage.DataReference + // User specified inputs. This map might be incomplete and not include defaults applied + UserInputsURI storage.DataReference + // Execution Error Kind. nullable + ErrorKind *string `gorm:"index"` + // Execution Error Code nullable + ErrorCode *string `valid:"length(0|255)"` + // The user responsible for launching this execution. + // This is also stored in the spec but promoted as a column for filtering. + User string `gorm:"index" valid:"length(0|255)"` + // GORM doesn't save the zero value for ints, so we use a pointer for the State field + State *int32 `gorm:"index;default:0"` + // The resource type of the entity used to launch the execution, one of 'launch_plan' or 'task' + LaunchEntity string + } + + return tx.AutoMigrate(&Execution{}) + }, + Rollback: func(tx *gorm.DB) error { + return nil + }, + }, + + { + ID: "pg-noop-2023-03-31-noop-taskexecution", Migrate: func(tx *gorm.DB) error { type TaskKey struct { Project string `gorm:"primary_key"` @@ -631,7 +696,7 @@ var NoopMigrations = []*gormigrate.Migration{ }, { - ID: "pg-noop-2023-03-31-noop-nodeexecution-2", + ID: "pg-noop-2023-03-31-noop-nodeexecution", Migrate: func(tx *gorm.DB) error { type ExecutionKey struct { Project string `gorm:"primary_key;column:execution_project"` diff --git a/replicate.sql b/replicate.sql new file mode 100644 index 000000000..7240f4fcf --- /dev/null +++ b/replicate.sql @@ -0,0 +1,1282 @@ +-- +-- PostgreSQL database dump +-- + +-- Dumped from database version 15.1 +-- Dumped by pg_dump version 15.1 + +-- Started on 2023-03-20 14:34:36 PDT + +SET statement_timeout = 0; +SET lock_timeout = 0; +SET idle_in_transaction_session_timeout = 0; +SET client_encoding = 'UTF8'; +SET standard_conforming_strings = on; +SELECT pg_catalog.set_config('search_path', '', false); +SET check_function_bodies = false; +SET xmloption = content; +SET client_min_messages = warning; +SET row_security = off; + +SET default_tablespace = ''; + +SET default_table_access_method = heap; + +-- +-- TOC entry 234 (class 1259 OID 16800) +-- Name: description_entities; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.description_entities ( + resource_type integer NOT NULL, + project text NOT NULL, + domain text NOT NULL, + name text NOT NULL, + version text NOT NULL, + id bigint NOT NULL, + created_at timestamp with time zone, + updated_at timestamp with time zone, + deleted_at timestamp with time zone, + link text, + short_description text, + long_description bytea +); + + +ALTER TABLE public.description_entities OWNER TO postgres; + +-- +-- TOC entry 233 (class 1259 OID 16799) +-- Name: description_entities_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres +-- + +CREATE SEQUENCE public.description_entities_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +ALTER TABLE public.description_entities_id_seq OWNER TO postgres; + +-- +-- TOC entry 3481 (class 0 OID 0) +-- Dependencies: 233 +-- Name: description_entities_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres +-- + +ALTER SEQUENCE public.description_entities_id_seq OWNED BY public.description_entities.id; + + +-- +-- TOC entry 230 (class 1259 OID 16777) +-- Name: execution_events; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.execution_events ( + id bigint NOT NULL, + created_at timestamp with time zone, + updated_at timestamp with time zone, + deleted_at timestamp with time zone, + execution_project text NOT NULL, + execution_domain text NOT NULL, + execution_name text NOT NULL, + request_id text, + occurred_at timestamp with time zone, + phase text NOT NULL +); + + +ALTER TABLE public.execution_events OWNER TO postgres; + +-- +-- TOC entry 229 (class 1259 OID 16776) +-- Name: execution_events_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres +-- + +CREATE SEQUENCE public.execution_events_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +ALTER TABLE public.execution_events_id_seq OWNER TO postgres; + +-- +-- TOC entry 3482 (class 0 OID 0) +-- Dependencies: 229 +-- Name: execution_events_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres +-- + +ALTER SEQUENCE public.execution_events_id_seq OWNED BY public.execution_events.id; + + +-- +-- TOC entry 240 (class 1259 OID 16836) +-- Name: executions; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.executions ( + id bigint NOT NULL, + created_at timestamp with time zone, + updated_at timestamp with time zone, + deleted_at timestamp with time zone, + execution_project text NOT NULL, + execution_domain text NOT NULL, + execution_name text NOT NULL, + launch_plan_id bigint, + workflow_id bigint, + task_id bigint, + phase text, + closure bytea, + spec bytea NOT NULL, + started_at timestamp with time zone, + execution_created_at timestamp with time zone, + execution_updated_at timestamp with time zone, + duration bigint, + abort_cause text, + mode integer, + source_execution_id bigint, + parent_node_execution_id bigint, + cluster text, + inputs_uri text, + user_inputs_uri text, + error_kind text, + error_code text, + "user" text, + state integer DEFAULT 0, + launch_entity text +); + + +ALTER TABLE public.executions OWNER TO postgres; + +-- +-- TOC entry 239 (class 1259 OID 16835) +-- Name: executions_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres +-- + +CREATE SEQUENCE public.executions_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +ALTER TABLE public.executions_id_seq OWNER TO postgres; + +-- +-- TOC entry 3483 (class 0 OID 0) +-- Dependencies: 239 +-- Name: executions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres +-- + +ALTER SEQUENCE public.executions_id_seq OWNED BY public.executions.id; + + +-- +-- TOC entry 222 (class 1259 OID 16724) +-- Name: launch_plans; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.launch_plans ( + id bigint NOT NULL, + created_at timestamp with time zone, + updated_at timestamp with time zone, + deleted_at timestamp with time zone, + project text NOT NULL, + domain text NOT NULL, + name text NOT NULL, + version text NOT NULL, + spec bytea NOT NULL, + workflow_id bigint, + closure bytea NOT NULL, + state integer DEFAULT 0, + digest bytea, + schedule_type text +); + + +ALTER TABLE public.launch_plans OWNER TO postgres; + +-- +-- TOC entry 221 (class 1259 OID 16723) +-- Name: launch_plans_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres +-- + +CREATE SEQUENCE public.launch_plans_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +ALTER TABLE public.launch_plans_id_seq OWNER TO postgres; + +-- +-- TOC entry 3484 (class 0 OID 0) +-- Dependencies: 221 +-- Name: launch_plans_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres +-- + +ALTER SEQUENCE public.launch_plans_id_seq OWNED BY public.launch_plans.id; + + +-- +-- TOC entry 214 (class 1259 OID 16679) +-- Name: migrations; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.migrations ( + id character varying(255) NOT NULL +); + + +ALTER TABLE public.migrations OWNER TO postgres; + +-- +-- TOC entry 224 (class 1259 OID 16738) +-- Name: named_entity_metadata; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.named_entity_metadata ( + id bigint NOT NULL, + created_at timestamp with time zone, + updated_at timestamp with time zone, + deleted_at timestamp with time zone, + resource_type integer NOT NULL, + project text NOT NULL, + domain text NOT NULL, + name text NOT NULL, + description character varying(300), + state integer DEFAULT 0 +); + + +ALTER TABLE public.named_entity_metadata OWNER TO postgres; + +-- +-- TOC entry 223 (class 1259 OID 16737) +-- Name: named_entity_metadata_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres +-- + +CREATE SEQUENCE public.named_entity_metadata_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +ALTER TABLE public.named_entity_metadata_id_seq OWNER TO postgres; + +-- +-- TOC entry 3485 (class 0 OID 0) +-- Dependencies: 223 +-- Name: named_entity_metadata_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres +-- + +ALTER SEQUENCE public.named_entity_metadata_id_seq OWNED BY public.named_entity_metadata.id; + + +-- +-- TOC entry 232 (class 1259 OID 16788) +-- Name: node_execution_events; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.node_execution_events ( + id bigint NOT NULL, + created_at timestamp with time zone, + updated_at timestamp with time zone, + deleted_at timestamp with time zone, + execution_project text NOT NULL, + execution_domain text NOT NULL, + execution_name text NOT NULL, + node_id text NOT NULL, + request_id text, + occurred_at timestamp with time zone, + phase text NOT NULL +); + + +ALTER TABLE public.node_execution_events OWNER TO postgres; + +-- +-- TOC entry 231 (class 1259 OID 16787) +-- Name: node_execution_events_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres +-- + +CREATE SEQUENCE public.node_execution_events_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +ALTER TABLE public.node_execution_events_id_seq OWNER TO postgres; + +-- +-- TOC entry 3486 (class 0 OID 0) +-- Dependencies: 231 +-- Name: node_execution_events_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres +-- + +ALTER SEQUENCE public.node_execution_events_id_seq OWNED BY public.node_execution_events.id; + + +-- +-- TOC entry 228 (class 1259 OID 16764) +-- Name: node_executions; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.node_executions ( + id bigint NOT NULL, + created_at timestamp with time zone, + updated_at timestamp with time zone, + deleted_at timestamp with time zone, + execution_project text NOT NULL, + execution_domain text NOT NULL, + execution_name text NOT NULL, + node_id text NOT NULL, + phase text, + input_uri text, + closure bytea, + started_at timestamp with time zone, + node_execution_created_at timestamp with time zone, + node_execution_updated_at timestamp with time zone, + duration bigint, + parent_task_execution_id bigint, + dynamic_workflow_remote_closure_reference text, + internal_data bytea +); + + +ALTER TABLE public.node_executions OWNER TO postgres; + +-- +-- TOC entry 227 (class 1259 OID 16763) +-- Name: node_executions_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres +-- + +CREATE SEQUENCE public.node_executions_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +ALTER TABLE public.node_executions_id_seq OWNER TO postgres; + +-- +-- TOC entry 3487 (class 0 OID 0) +-- Dependencies: 227 +-- Name: node_executions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres +-- + +ALTER SEQUENCE public.node_executions_id_seq OWNED BY public.node_executions.id; + + +-- +-- TOC entry 216 (class 1259 OID 16685) +-- Name: projects; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.projects ( + id bigint NOT NULL, + created_at timestamp with time zone, + updated_at timestamp with time zone, + deleted_at timestamp with time zone, + identifier text NOT NULL, + name text, + description character varying(300), + labels bytea, + state integer DEFAULT 0 +); + + +ALTER TABLE public.projects OWNER TO postgres; + +-- +-- TOC entry 215 (class 1259 OID 16684) +-- Name: projects_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres +-- + +CREATE SEQUENCE public.projects_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +ALTER TABLE public.projects_id_seq OWNER TO postgres; + +-- +-- TOC entry 3488 (class 0 OID 0) +-- Dependencies: 215 +-- Name: projects_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres +-- + +ALTER SEQUENCE public.projects_id_seq OWNED BY public.projects.id; + + +-- +-- TOC entry 238 (class 1259 OID 16824) +-- Name: resources; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.resources ( + id bigint NOT NULL, + created_at timestamp with time zone, + updated_at timestamp with time zone, + deleted_at timestamp with time zone, + project text, + domain text, + workflow text, + launch_plan text, + resource_type text, + priority integer, + attributes bytea +); + + +ALTER TABLE public.resources OWNER TO postgres; + +-- +-- TOC entry 237 (class 1259 OID 16823) +-- Name: resources_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres +-- + +CREATE SEQUENCE public.resources_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +ALTER TABLE public.resources_id_seq OWNER TO postgres; + +-- +-- TOC entry 3489 (class 0 OID 0) +-- Dependencies: 237 +-- Name: resources_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres +-- + +ALTER SEQUENCE public.resources_id_seq OWNED BY public.resources.id; + + +-- +-- TOC entry 236 (class 1259 OID 16812) +-- Name: signals; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.signals ( + id bigint NOT NULL, + created_at timestamp with time zone, + updated_at timestamp with time zone, + deleted_at timestamp with time zone, + execution_project text NOT NULL, + execution_domain text NOT NULL, + execution_name text NOT NULL, + signal_id text NOT NULL, + type bytea NOT NULL, + value bytea +); + + +ALTER TABLE public.signals OWNER TO postgres; + +-- +-- TOC entry 235 (class 1259 OID 16811) +-- Name: signals_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres +-- + +CREATE SEQUENCE public.signals_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +ALTER TABLE public.signals_id_seq OWNER TO postgres; + +-- +-- TOC entry 3490 (class 0 OID 0) +-- Dependencies: 235 +-- Name: signals_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres +-- + +ALTER SEQUENCE public.signals_id_seq OWNED BY public.signals.id; + + +-- +-- TOC entry 226 (class 1259 OID 16751) +-- Name: task_executions; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.task_executions ( + id bigint NOT NULL, + created_at timestamp with time zone, + updated_at timestamp with time zone, + deleted_at timestamp with time zone, + project text NOT NULL, + domain text NOT NULL, + name text NOT NULL, + version text NOT NULL, + execution_project text NOT NULL, + execution_domain text NOT NULL, + execution_name text NOT NULL, + node_id text NOT NULL, + retry_attempt bigint NOT NULL, + phase text, + phase_version bigint, + input_uri text, + closure bytea, + started_at timestamp with time zone, + task_execution_created_at timestamp with time zone, + task_execution_updated_at timestamp with time zone, + duration bigint +); + + +ALTER TABLE public.task_executions OWNER TO postgres; + +-- +-- TOC entry 225 (class 1259 OID 16750) +-- Name: task_executions_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres +-- + +CREATE SEQUENCE public.task_executions_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +ALTER TABLE public.task_executions_id_seq OWNER TO postgres; + +-- +-- TOC entry 3491 (class 0 OID 0) +-- Dependencies: 225 +-- Name: task_executions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres +-- + +ALTER SEQUENCE public.task_executions_id_seq OWNED BY public.task_executions.id; + + +-- +-- TOC entry 218 (class 1259 OID 16698) +-- Name: tasks; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.tasks ( + id bigint NOT NULL, + created_at timestamp with time zone, + updated_at timestamp with time zone, + deleted_at timestamp with time zone, + project text NOT NULL, + domain text NOT NULL, + name text NOT NULL, + version text NOT NULL, + closure bytea NOT NULL, + digest bytea, + type text, + short_description text +); + + +ALTER TABLE public.tasks OWNER TO postgres; + +-- +-- TOC entry 217 (class 1259 OID 16697) +-- Name: tasks_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres +-- + +CREATE SEQUENCE public.tasks_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +ALTER TABLE public.tasks_id_seq OWNER TO postgres; + +-- +-- TOC entry 3492 (class 0 OID 0) +-- Dependencies: 217 +-- Name: tasks_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres +-- + +ALTER SEQUENCE public.tasks_id_seq OWNED BY public.tasks.id; + + +-- +-- TOC entry 220 (class 1259 OID 16711) +-- Name: workflows; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.workflows ( + id bigint NOT NULL, + created_at timestamp with time zone, + updated_at timestamp with time zone, + deleted_at timestamp with time zone, + project text NOT NULL, + domain text NOT NULL, + name text NOT NULL, + version text NOT NULL, + typed_interface bytea, + remote_closure_identifier text NOT NULL, + digest bytea, + short_description text +); + + +ALTER TABLE public.workflows OWNER TO postgres; + +-- +-- TOC entry 219 (class 1259 OID 16710) +-- Name: workflows_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres +-- + +CREATE SEQUENCE public.workflows_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +ALTER TABLE public.workflows_id_seq OWNER TO postgres; + +-- +-- TOC entry 3493 (class 0 OID 0) +-- Dependencies: 219 +-- Name: workflows_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres +-- + +ALTER SEQUENCE public.workflows_id_seq OWNED BY public.workflows.id; + + +-- +-- TOC entry 3254 (class 2604 OID 16803) +-- Name: description_entities id; Type: DEFAULT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.description_entities ALTER COLUMN id SET DEFAULT nextval('public.description_entities_id_seq'::regclass); + + +-- +-- TOC entry 3252 (class 2604 OID 16780) +-- Name: execution_events id; Type: DEFAULT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.execution_events ALTER COLUMN id SET DEFAULT nextval('public.execution_events_id_seq'::regclass); + + +-- +-- TOC entry 3257 (class 2604 OID 16839) +-- Name: executions id; Type: DEFAULT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.executions ALTER COLUMN id SET DEFAULT nextval('public.executions_id_seq'::regclass); + + +-- +-- TOC entry 3246 (class 2604 OID 16727) +-- Name: launch_plans id; Type: DEFAULT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.launch_plans ALTER COLUMN id SET DEFAULT nextval('public.launch_plans_id_seq'::regclass); + + +-- +-- TOC entry 3248 (class 2604 OID 16741) +-- Name: named_entity_metadata id; Type: DEFAULT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.named_entity_metadata ALTER COLUMN id SET DEFAULT nextval('public.named_entity_metadata_id_seq'::regclass); + + +-- +-- TOC entry 3253 (class 2604 OID 16791) +-- Name: node_execution_events id; Type: DEFAULT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.node_execution_events ALTER COLUMN id SET DEFAULT nextval('public.node_execution_events_id_seq'::regclass); + + +-- +-- TOC entry 3251 (class 2604 OID 16767) +-- Name: node_executions id; Type: DEFAULT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.node_executions ALTER COLUMN id SET DEFAULT nextval('public.node_executions_id_seq'::regclass); + + +-- +-- TOC entry 3242 (class 2604 OID 16688) +-- Name: projects id; Type: DEFAULT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.projects ALTER COLUMN id SET DEFAULT nextval('public.projects_id_seq'::regclass); + + +-- +-- TOC entry 3256 (class 2604 OID 16827) +-- Name: resources id; Type: DEFAULT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.resources ALTER COLUMN id SET DEFAULT nextval('public.resources_id_seq'::regclass); + + +-- +-- TOC entry 3255 (class 2604 OID 16815) +-- Name: signals id; Type: DEFAULT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.signals ALTER COLUMN id SET DEFAULT nextval('public.signals_id_seq'::regclass); + + +-- +-- TOC entry 3250 (class 2604 OID 16754) +-- Name: task_executions id; Type: DEFAULT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.task_executions ALTER COLUMN id SET DEFAULT nextval('public.task_executions_id_seq'::regclass); + + +-- +-- TOC entry 3244 (class 2604 OID 16701) +-- Name: tasks id; Type: DEFAULT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.tasks ALTER COLUMN id SET DEFAULT nextval('public.tasks_id_seq'::regclass); + + +-- +-- TOC entry 3245 (class 2604 OID 16714) +-- Name: workflows id; Type: DEFAULT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.workflows ALTER COLUMN id SET DEFAULT nextval('public.workflows_id_seq'::regclass); + + +-- +-- TOC entry 3311 (class 2606 OID 16807) +-- Name: description_entities description_entities_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.description_entities + ADD CONSTRAINT description_entities_pkey PRIMARY KEY (resource_type, project, domain, name, version); + + +-- +-- TOC entry 3302 (class 2606 OID 16784) +-- Name: execution_events execution_events_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.execution_events + ADD CONSTRAINT execution_events_pkey PRIMARY KEY (execution_project, execution_domain, execution_name, phase); + + +-- +-- TOC entry 3324 (class 2606 OID 16844) +-- Name: executions executions_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.executions + ADD CONSTRAINT executions_pkey PRIMARY KEY (execution_project, execution_domain, execution_name); + + +-- +-- TOC entry 3282 (class 2606 OID 16732) +-- Name: launch_plans launch_plans_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.launch_plans + ADD CONSTRAINT launch_plans_pkey PRIMARY KEY (project, domain, name, version); + + +-- +-- TOC entry 3260 (class 2606 OID 16683) +-- Name: migrations migrations_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.migrations + ADD CONSTRAINT migrations_pkey PRIMARY KEY (id); + + +-- +-- TOC entry 3287 (class 2606 OID 16746) +-- Name: named_entity_metadata named_entity_metadata_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.named_entity_metadata + ADD CONSTRAINT named_entity_metadata_pkey PRIMARY KEY (resource_type, project, domain, name); + + +-- +-- TOC entry 3309 (class 2606 OID 16795) +-- Name: node_execution_events node_execution_events_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.node_execution_events + ADD CONSTRAINT node_execution_events_pkey PRIMARY KEY (execution_project, execution_domain, execution_name, node_id, phase); + + +-- +-- TOC entry 3300 (class 2606 OID 16771) +-- Name: node_executions node_executions_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.node_executions + ADD CONSTRAINT node_executions_pkey PRIMARY KEY (execution_project, execution_domain, execution_name, node_id); + + +-- +-- TOC entry 3265 (class 2606 OID 16693) +-- Name: projects projects_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.projects + ADD CONSTRAINT projects_pkey PRIMARY KEY (identifier); + + +-- +-- TOC entry 3322 (class 2606 OID 16831) +-- Name: resources resources_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.resources + ADD CONSTRAINT resources_pkey PRIMARY KEY (id); + + +-- +-- TOC entry 3319 (class 2606 OID 16819) +-- Name: signals signals_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.signals + ADD CONSTRAINT signals_pkey PRIMARY KEY (execution_project, execution_domain, execution_name, signal_id); + + +-- +-- TOC entry 3294 (class 2606 OID 16758) +-- Name: task_executions task_executions_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.task_executions + ADD CONSTRAINT task_executions_pkey PRIMARY KEY (project, domain, name, version, execution_project, execution_domain, execution_name, node_id, retry_attempt); + + +-- +-- TOC entry 3271 (class 2606 OID 16705) +-- Name: tasks tasks_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.tasks + ADD CONSTRAINT tasks_pkey PRIMARY KEY (project, domain, name, version); + + +-- +-- TOC entry 3277 (class 2606 OID 16718) +-- Name: workflows workflows_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.workflows + ADD CONSTRAINT workflows_pkey PRIMARY KEY (project, domain, name, version); + + +-- +-- TOC entry 3312 (class 1259 OID 16808) +-- Name: description_entity_project_domain_name_version_idx; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX description_entity_project_domain_name_version_idx ON public.description_entities USING btree (resource_type, project, domain, name, version); + + +-- +-- TOC entry 3313 (class 1259 OID 16809) +-- Name: idx_description_entities_deleted_at; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_description_entities_deleted_at ON public.description_entities USING btree (deleted_at); + + +-- +-- TOC entry 3314 (class 1259 OID 16810) +-- Name: idx_description_entities_id; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_description_entities_id ON public.description_entities USING btree (id); + + +-- +-- TOC entry 3303 (class 1259 OID 16785) +-- Name: idx_execution_events_deleted_at; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_execution_events_deleted_at ON public.execution_events USING btree (deleted_at); + + +-- +-- TOC entry 3304 (class 1259 OID 16786) +-- Name: idx_execution_events_id; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_execution_events_id ON public.execution_events USING btree (id); + + +-- +-- TOC entry 3325 (class 1259 OID 16845) +-- Name: idx_executions_created_at; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_executions_created_at ON public.executions USING btree (execution_created_at); + + +-- +-- TOC entry 3326 (class 1259 OID 16853) +-- Name: idx_executions_deleted_at; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_executions_deleted_at ON public.executions USING btree (deleted_at); + + +-- +-- TOC entry 3327 (class 1259 OID 16850) +-- Name: idx_executions_error_kind; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_executions_error_kind ON public.executions USING btree (error_kind); + + +-- +-- TOC entry 3328 (class 1259 OID 16847) +-- Name: idx_executions_id; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_executions_id ON public.executions USING btree (id); + + +-- +-- TOC entry 3329 (class 1259 OID 16846) +-- Name: idx_executions_launch_plan_id; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_executions_launch_plan_id ON public.executions USING btree (launch_plan_id); + + +-- +-- TOC entry 3330 (class 1259 OID 16848) +-- Name: idx_executions_state; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_executions_state ON public.executions USING btree (state); + + +-- +-- TOC entry 3331 (class 1259 OID 16851) +-- Name: idx_executions_task_id; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_executions_task_id ON public.executions USING btree (task_id); + + +-- +-- TOC entry 3332 (class 1259 OID 16849) +-- Name: idx_executions_user; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_executions_user ON public.executions USING btree ("user"); + + +-- +-- TOC entry 3333 (class 1259 OID 16852) +-- Name: idx_executions_workflow_id; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_executions_workflow_id ON public.executions USING btree (workflow_id); + + +-- +-- TOC entry 3278 (class 1259 OID 16735) +-- Name: idx_launch_plans_deleted_at; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_launch_plans_deleted_at ON public.launch_plans USING btree (deleted_at); + + +-- +-- TOC entry 3279 (class 1259 OID 16736) +-- Name: idx_launch_plans_id; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_launch_plans_id ON public.launch_plans USING btree (id); + + +-- +-- TOC entry 3280 (class 1259 OID 16733) +-- Name: idx_launch_plans_workflow_id; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_launch_plans_workflow_id ON public.launch_plans USING btree (workflow_id); + + +-- +-- TOC entry 3284 (class 1259 OID 16748) +-- Name: idx_named_entity_metadata_deleted_at; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_named_entity_metadata_deleted_at ON public.named_entity_metadata USING btree (deleted_at); + + +-- +-- TOC entry 3285 (class 1259 OID 16749) +-- Name: idx_named_entity_metadata_id; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_named_entity_metadata_id ON public.named_entity_metadata USING btree (id); + + +-- +-- TOC entry 3305 (class 1259 OID 16797) +-- Name: idx_node_execution_events_deleted_at; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_node_execution_events_deleted_at ON public.node_execution_events USING btree (deleted_at); + + +-- +-- TOC entry 3306 (class 1259 OID 16798) +-- Name: idx_node_execution_events_id; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_node_execution_events_id ON public.node_execution_events USING btree (id); + + +-- +-- TOC entry 3307 (class 1259 OID 16796) +-- Name: idx_node_execution_events_node_id; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_node_execution_events_node_id ON public.node_execution_events USING btree (node_id); + + +-- +-- TOC entry 3295 (class 1259 OID 16772) +-- Name: idx_node_executions_deleted_at; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_node_executions_deleted_at ON public.node_executions USING btree (deleted_at); + + +-- +-- TOC entry 3296 (class 1259 OID 16773) +-- Name: idx_node_executions_id; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_node_executions_id ON public.node_executions USING btree (id); + + +-- +-- TOC entry 3297 (class 1259 OID 16775) +-- Name: idx_node_executions_node_id; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_node_executions_node_id ON public.node_executions USING btree (node_id); + + +-- +-- TOC entry 3298 (class 1259 OID 16774) +-- Name: idx_node_executions_parent_task_execution_id; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_node_executions_parent_task_execution_id ON public.node_executions USING btree (parent_task_execution_id); + + +-- +-- TOC entry 3261 (class 1259 OID 16695) +-- Name: idx_projects_deleted_at; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_projects_deleted_at ON public.projects USING btree (deleted_at); + + +-- +-- TOC entry 3262 (class 1259 OID 16696) +-- Name: idx_projects_id; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_projects_id ON public.projects USING btree (id); + + +-- +-- TOC entry 3263 (class 1259 OID 16694) +-- Name: idx_projects_state; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_projects_state ON public.projects USING btree (state); + + +-- +-- TOC entry 3315 (class 1259 OID 16821) +-- Name: idx_signals_deleted_at; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_signals_deleted_at ON public.signals USING btree (deleted_at); + + +-- +-- TOC entry 3316 (class 1259 OID 16822) +-- Name: idx_signals_id; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_signals_id ON public.signals USING btree (id); + + +-- +-- TOC entry 3317 (class 1259 OID 16820) +-- Name: idx_signals_signal_id; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_signals_signal_id ON public.signals USING btree (signal_id); + + +-- +-- TOC entry 3289 (class 1259 OID 16761) +-- Name: idx_task_executions_deleted_at; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_task_executions_deleted_at ON public.task_executions USING btree (deleted_at); + + +-- +-- TOC entry 3290 (class 1259 OID 16760) +-- Name: idx_task_executions_exec; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_task_executions_exec ON public.task_executions USING btree (execution_project, execution_domain, execution_name, node_id); + + +-- +-- TOC entry 3291 (class 1259 OID 16762) +-- Name: idx_task_executions_id; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_task_executions_id ON public.task_executions USING btree (id); + + +-- +-- TOC entry 3292 (class 1259 OID 16759) +-- Name: idx_task_executions_node_id; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_task_executions_node_id ON public.task_executions USING btree (node_id); + + +-- +-- TOC entry 3266 (class 1259 OID 16708) +-- Name: idx_tasks_deleted_at; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_tasks_deleted_at ON public.tasks USING btree (deleted_at); + + +-- +-- TOC entry 3267 (class 1259 OID 16709) +-- Name: idx_tasks_id; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_tasks_id ON public.tasks USING btree (id); + + +-- +-- TOC entry 3272 (class 1259 OID 16721) +-- Name: idx_workflows_deleted_at; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_workflows_deleted_at ON public.workflows USING btree (deleted_at); + + +-- +-- TOC entry 3273 (class 1259 OID 16722) +-- Name: idx_workflows_id; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX idx_workflows_id ON public.workflows USING btree (id); + + +-- +-- TOC entry 3283 (class 1259 OID 16734) +-- Name: lp_project_domain_name_idx; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX lp_project_domain_name_idx ON public.launch_plans USING btree (project, domain, name); + + +-- +-- TOC entry 3288 (class 1259 OID 16747) +-- Name: named_entity_metadata_type_project_domain_name_idx; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX named_entity_metadata_type_project_domain_name_idx ON public.named_entity_metadata USING btree (resource_type, project, domain, name); + + +-- +-- TOC entry 3320 (class 1259 OID 16832) +-- Name: resource_idx; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE UNIQUE INDEX resource_idx ON public.resources USING btree (project, domain, workflow, launch_plan, resource_type); + + +-- +-- TOC entry 3268 (class 1259 OID 16706) +-- Name: task_project_domain_idx; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX task_project_domain_idx ON public.tasks USING btree (project, domain); + + +-- +-- TOC entry 3269 (class 1259 OID 16707) +-- Name: task_project_domain_name_idx; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX task_project_domain_name_idx ON public.tasks USING btree (project, domain, name); + + +-- +-- TOC entry 3274 (class 1259 OID 16719) +-- Name: workflow_project_domain_idx; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX workflow_project_domain_idx ON public.workflows USING btree (project, domain); + + +-- +-- TOC entry 3275 (class 1259 OID 16720) +-- Name: workflow_project_domain_name_idx; Type: INDEX; Schema: public; Owner: postgres +-- + +CREATE INDEX workflow_project_domain_name_idx ON public.workflows USING btree (project, domain, name); + + +-- Completed on 2023-03-20 14:34:39 PDT + +-- +-- PostgreSQL database dump complete +-- + From 9687514e1c698433c7afd3f49fe5f0136453acb4 Mon Sep 17 00:00:00 2001 From: Yee Hing Tong Date: Mon, 20 Mar 2023 16:50:05 -0700 Subject: [PATCH 4/8] add missing columns to node executions Signed-off-by: Yee Hing Tong --- flyte.sql | 1716 ------------------- pkg/repositories/config/migration_models.go | 3 + pkg/repositories/config/migrations.go | 64 +- pkg/repositories/config/migrations_test.go | 42 +- replicate.sql | 1282 -------------- 5 files changed, 105 insertions(+), 3002 deletions(-) delete mode 100644 flyte.sql delete mode 100644 replicate.sql diff --git a/flyte.sql b/flyte.sql deleted file mode 100644 index 8c9189601..000000000 --- a/flyte.sql +++ /dev/null @@ -1,1716 +0,0 @@ --- --- PostgreSQL database dump --- - --- Dumped from database version 15.1 --- Dumped by pg_dump version 15.1 - --- Started on 2023-03-20 14:15:17 PDT - -SET statement_timeout = 0; -SET lock_timeout = 0; -SET idle_in_transaction_session_timeout = 0; -SET client_encoding = 'UTF8'; -SET standard_conforming_strings = on; -SELECT pg_catalog.set_config('search_path', '', false); -SET check_function_bodies = false; -SET xmloption = content; -SET client_min_messages = warning; -SET row_security = off; - -SET default_tablespace = ''; - -SET default_table_access_method = heap; - --- --- TOC entry 236 (class 1259 OID 16540) --- Name: artifact_data; Type: TABLE; Schema: public; Owner: postgres --- - -CREATE TABLE public.artifact_data ( - created_at timestamp with time zone, - updated_at timestamp with time zone, - deleted_at timestamp with time zone, - dataset_project text NOT NULL, - dataset_name text NOT NULL, - dataset_domain text NOT NULL, - dataset_version text NOT NULL, - artifact_id text NOT NULL, - name text NOT NULL, - location text -); - - -ALTER TABLE public.artifact_data OWNER TO postgres; - --- --- TOC entry 233 (class 1259 OID 16516) --- Name: artifacts; Type: TABLE; Schema: public; Owner: postgres --- - -CREATE TABLE public.artifacts ( - created_at timestamp with time zone, - updated_at timestamp with time zone, - deleted_at timestamp with time zone, - dataset_project text NOT NULL, - dataset_name text NOT NULL, - dataset_domain text NOT NULL, - dataset_version text NOT NULL, - artifact_id text NOT NULL, - dataset_uuid uuid, - serialized_metadata bytea -); - - -ALTER TABLE public.artifacts OWNER TO postgres; - --- --- TOC entry 215 (class 1259 OID 16389) --- Name: datasets; Type: TABLE; Schema: public; Owner: postgres --- - -CREATE TABLE public.datasets ( - created_at timestamp with time zone, - updated_at timestamp with time zone, - deleted_at timestamp with time zone, - project text NOT NULL, - name text NOT NULL, - domain text NOT NULL, - version text NOT NULL, - uuid uuid, - serialized_metadata bytea -); - - -ALTER TABLE public.datasets OWNER TO postgres; - --- --- TOC entry 249 (class 1259 OID 16646) --- Name: description_entities; Type: TABLE; Schema: public; Owner: postgres --- - -CREATE TABLE public.description_entities ( - resource_type integer NOT NULL, - project text NOT NULL, - domain text NOT NULL, - name text NOT NULL, - version text NOT NULL, - id bigint NOT NULL, - created_at timestamp with time zone, - updated_at timestamp with time zone, - deleted_at timestamp with time zone, - short_description text, - long_description bytea, - link text -); - - -ALTER TABLE public.description_entities OWNER TO postgres; - --- --- TOC entry 248 (class 1259 OID 16645) --- Name: description_entities_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres --- - -CREATE SEQUENCE public.description_entities_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - -ALTER TABLE public.description_entities_id_seq OWNER TO postgres; - --- --- TOC entry 3553 (class 0 OID 0) --- Dependencies: 248 --- Name: description_entities_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres --- - -ALTER SEQUENCE public.description_entities_id_seq OWNED BY public.description_entities.id; - - --- --- TOC entry 228 (class 1259 OID 16484) --- Name: execution_events; Type: TABLE; Schema: public; Owner: postgres --- - -CREATE TABLE public.execution_events ( - id bigint NOT NULL, - created_at timestamp with time zone, - updated_at timestamp with time zone, - deleted_at timestamp with time zone, - execution_project text NOT NULL, - execution_domain text NOT NULL, - execution_name text NOT NULL, - request_id text, - occurred_at timestamp with time zone, - phase text NOT NULL -); - - -ALTER TABLE public.execution_events OWNER TO postgres; - --- --- TOC entry 227 (class 1259 OID 16483) --- Name: execution_events_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres --- - -CREATE SEQUENCE public.execution_events_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - -ALTER TABLE public.execution_events_id_seq OWNER TO postgres; - --- --- TOC entry 3554 (class 0 OID 0) --- Dependencies: 227 --- Name: execution_events_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres --- - -ALTER SEQUENCE public.execution_events_id_seq OWNED BY public.execution_events.id; - - --- --- TOC entry 226 (class 1259 OID 16465) --- Name: executions; Type: TABLE; Schema: public; Owner: postgres --- - -CREATE TABLE public.executions ( - id bigint NOT NULL, - created_at timestamp with time zone, - updated_at timestamp with time zone, - deleted_at timestamp with time zone, - execution_project text NOT NULL, - execution_domain text NOT NULL, - execution_name text NOT NULL, - launch_plan_id bigint, - workflow_id bigint, - task_id bigint, - phase text, - closure bytea, - spec bytea NOT NULL, - started_at timestamp with time zone, - execution_created_at timestamp with time zone, - execution_updated_at timestamp with time zone, - duration bigint, - abort_cause text, - mode integer, - source_execution_id bigint, - parent_node_execution_id bigint, - cluster text, - inputs_uri text, - user_inputs_uri text, - error_kind text, - error_code text, - "user" text, - state integer DEFAULT 0, - launch_entity text -); - - -ALTER TABLE public.executions OWNER TO postgres; - --- --- TOC entry 225 (class 1259 OID 16464) --- Name: executions_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres --- - -CREATE SEQUENCE public.executions_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - -ALTER TABLE public.executions_id_seq OWNER TO postgres; - --- --- TOC entry 3555 (class 0 OID 0) --- Dependencies: 225 --- Name: executions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres --- - -ALTER SEQUENCE public.executions_id_seq OWNED BY public.executions.id; - - --- --- TOC entry 224 (class 1259 OID 16451) --- Name: launch_plans; Type: TABLE; Schema: public; Owner: postgres --- - -CREATE TABLE public.launch_plans ( - id bigint NOT NULL, - created_at timestamp with time zone, - updated_at timestamp with time zone, - deleted_at timestamp with time zone, - project text NOT NULL, - domain text NOT NULL, - name text NOT NULL, - version text NOT NULL, - spec bytea NOT NULL, - workflow_id bigint, - closure bytea NOT NULL, - state integer DEFAULT 0, - digest bytea, - schedule_type text -); - - -ALTER TABLE public.launch_plans OWNER TO postgres; - --- --- TOC entry 223 (class 1259 OID 16450) --- Name: launch_plans_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres --- - -CREATE SEQUENCE public.launch_plans_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - -ALTER TABLE public.launch_plans_id_seq OWNER TO postgres; - --- --- TOC entry 3556 (class 0 OID 0) --- Dependencies: 223 --- Name: launch_plans_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres --- - -ALTER SEQUENCE public.launch_plans_id_seq OWNED BY public.launch_plans.id; - - --- --- TOC entry 214 (class 1259 OID 16386) --- Name: migrations; Type: TABLE; Schema: public; Owner: postgres --- - -CREATE TABLE public.migrations ( - id character varying(255) NOT NULL -); - - -ALTER TABLE public.migrations OWNER TO postgres; - --- --- TOC entry 241 (class 1259 OID 16570) --- Name: named_entity_metadata; Type: TABLE; Schema: public; Owner: postgres --- - -CREATE TABLE public.named_entity_metadata ( - id bigint NOT NULL, - created_at timestamp with time zone, - updated_at timestamp with time zone, - deleted_at timestamp with time zone, - resource_type integer NOT NULL, - project text NOT NULL, - domain text NOT NULL, - name text NOT NULL, - description character varying(300), - state integer DEFAULT 0 -); - - -ALTER TABLE public.named_entity_metadata OWNER TO postgres; - --- --- TOC entry 240 (class 1259 OID 16569) --- Name: named_entity_metadata_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres --- - -CREATE SEQUENCE public.named_entity_metadata_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - -ALTER TABLE public.named_entity_metadata_id_seq OWNER TO postgres; - --- --- TOC entry 3557 (class 0 OID 0) --- Dependencies: 240 --- Name: named_entity_metadata_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres --- - -ALTER SEQUENCE public.named_entity_metadata_id_seq OWNED BY public.named_entity_metadata.id; - - --- --- TOC entry 232 (class 1259 OID 16508) --- Name: node_execution_events; Type: TABLE; Schema: public; Owner: postgres --- - -CREATE TABLE public.node_execution_events ( - id bigint NOT NULL, - created_at timestamp with time zone, - updated_at timestamp with time zone, - deleted_at timestamp with time zone, - execution_project text NOT NULL, - execution_domain text NOT NULL, - execution_name text NOT NULL, - node_id text NOT NULL, - request_id text, - occurred_at timestamp with time zone, - phase text NOT NULL -); - - -ALTER TABLE public.node_execution_events OWNER TO postgres; - --- --- TOC entry 231 (class 1259 OID 16507) --- Name: node_execution_events_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres --- - -CREATE SEQUENCE public.node_execution_events_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - -ALTER TABLE public.node_execution_events_id_seq OWNER TO postgres; - --- --- TOC entry 3558 (class 0 OID 0) --- Dependencies: 231 --- Name: node_execution_events_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres --- - -ALTER SEQUENCE public.node_execution_events_id_seq OWNED BY public.node_execution_events.id; - - --- --- TOC entry 230 (class 1259 OID 16495) --- Name: node_executions; Type: TABLE; Schema: public; Owner: postgres --- - -CREATE TABLE public.node_executions ( - id bigint NOT NULL, - created_at timestamp with time zone, - updated_at timestamp with time zone, - deleted_at timestamp with time zone, - execution_project text NOT NULL, - execution_domain text NOT NULL, - execution_name text NOT NULL, - node_id text NOT NULL, - phase text, - input_uri text, - closure bytea, - started_at timestamp with time zone, - node_execution_created_at timestamp with time zone, - node_execution_updated_at timestamp with time zone, - duration bigint, - parent_task_execution_id bigint, - dynamic_workflow_remote_closure_reference text, - internal_data bytea, - node_execution_metadata bytea, - parent_id bigint, - cache_status text, - error_kind text, - error_code text -); - - -ALTER TABLE public.node_executions OWNER TO postgres; - --- --- TOC entry 229 (class 1259 OID 16494) --- Name: node_executions_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres --- - -CREATE SEQUENCE public.node_executions_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - -ALTER TABLE public.node_executions_id_seq OWNER TO postgres; - --- --- TOC entry 3559 (class 0 OID 0) --- Dependencies: 229 --- Name: node_executions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres --- - -ALTER SEQUENCE public.node_executions_id_seq OWNED BY public.node_executions.id; - - --- --- TOC entry 237 (class 1259 OID 16547) --- Name: partition_keys; Type: TABLE; Schema: public; Owner: postgres --- - -CREATE TABLE public.partition_keys ( - created_at timestamp with time zone, - updated_at timestamp with time zone, - deleted_at timestamp with time zone, - dataset_uuid uuid NOT NULL, - name text NOT NULL -); - - -ALTER TABLE public.partition_keys OWNER TO postgres; - --- --- TOC entry 238 (class 1259 OID 16554) --- Name: partitions; Type: TABLE; Schema: public; Owner: postgres --- - -CREATE TABLE public.partitions ( - created_at timestamp with time zone, - updated_at timestamp with time zone, - deleted_at timestamp with time zone, - dataset_uuid uuid NOT NULL, - key text NOT NULL, - value text NOT NULL, - artifact_id text NOT NULL -); - - -ALTER TABLE public.partitions OWNER TO postgres; - --- --- TOC entry 217 (class 1259 OID 16399) --- Name: projects; Type: TABLE; Schema: public; Owner: postgres --- - -CREATE TABLE public.projects ( - id bigint NOT NULL, - created_at timestamp with time zone, - updated_at timestamp with time zone, - deleted_at timestamp with time zone, - identifier text NOT NULL, - name text, - description character varying(300), - labels bytea, - state integer DEFAULT 0 -); - - -ALTER TABLE public.projects OWNER TO postgres; - --- --- TOC entry 216 (class 1259 OID 16397) --- Name: projects_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres --- - -CREATE SEQUENCE public.projects_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - -ALTER TABLE public.projects_id_seq OWNER TO postgres; - --- --- TOC entry 3560 (class 0 OID 0) --- Dependencies: 216 --- Name: projects_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres --- - -ALTER SEQUENCE public.projects_id_seq OWNED BY public.projects.id; - - --- --- TOC entry 239 (class 1259 OID 16562) --- Name: reservations; Type: TABLE; Schema: public; Owner: postgres --- - -CREATE TABLE public.reservations ( - created_at timestamp with time zone, - updated_at timestamp with time zone, - deleted_at timestamp with time zone, - dataset_project text NOT NULL, - dataset_name text NOT NULL, - dataset_domain text NOT NULL, - dataset_version text NOT NULL, - tag_name text NOT NULL, - owner_id text, - expires_at timestamp with time zone, - serialized_metadata bytea -); - - -ALTER TABLE public.reservations OWNER TO postgres; - --- --- TOC entry 243 (class 1259 OID 16583) --- Name: resources; Type: TABLE; Schema: public; Owner: postgres --- - -CREATE TABLE public.resources ( - id bigint NOT NULL, - created_at timestamp with time zone, - updated_at timestamp with time zone, - deleted_at timestamp with time zone, - project text, - domain text, - workflow text, - launch_plan text, - resource_type text, - priority integer, - attributes bytea -); - - -ALTER TABLE public.resources OWNER TO postgres; - --- --- TOC entry 242 (class 1259 OID 16582) --- Name: resources_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres --- - -CREATE SEQUENCE public.resources_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - -ALTER TABLE public.resources_id_seq OWNER TO postgres; - --- --- TOC entry 3561 (class 0 OID 0) --- Dependencies: 242 --- Name: resources_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres --- - -ALTER SEQUENCE public.resources_id_seq OWNED BY public.resources.id; - - --- --- TOC entry 245 (class 1259 OID 16595) --- Name: schedulable_entities; Type: TABLE; Schema: public; Owner: postgres --- - -CREATE TABLE public.schedulable_entities ( - id bigint NOT NULL, - created_at timestamp with time zone, - updated_at timestamp with time zone, - deleted_at timestamp with time zone, - project text NOT NULL, - domain text NOT NULL, - name text NOT NULL, - version text NOT NULL, - cron_expression text, - fixed_rate_value bigint, - unit integer, - kickoff_time_input_arg text, - active boolean -); - - -ALTER TABLE public.schedulable_entities OWNER TO postgres; - --- --- TOC entry 244 (class 1259 OID 16594) --- Name: schedulable_entities_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres --- - -CREATE SEQUENCE public.schedulable_entities_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - -ALTER TABLE public.schedulable_entities_id_seq OWNER TO postgres; - --- --- TOC entry 3562 (class 0 OID 0) --- Dependencies: 244 --- Name: schedulable_entities_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres --- - -ALTER SEQUENCE public.schedulable_entities_id_seq OWNED BY public.schedulable_entities.id; - - --- --- TOC entry 247 (class 1259 OID 16606) --- Name: schedule_entities_snapshots; Type: TABLE; Schema: public; Owner: postgres --- - -CREATE TABLE public.schedule_entities_snapshots ( - id bigint NOT NULL, - created_at timestamp with time zone, - updated_at timestamp with time zone, - deleted_at timestamp with time zone, - snapshot bytea -); - - -ALTER TABLE public.schedule_entities_snapshots OWNER TO postgres; - --- --- TOC entry 246 (class 1259 OID 16605) --- Name: schedule_entities_snapshots_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres --- - -CREATE SEQUENCE public.schedule_entities_snapshots_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - -ALTER TABLE public.schedule_entities_snapshots_id_seq OWNER TO postgres; - --- --- TOC entry 3563 (class 0 OID 0) --- Dependencies: 246 --- Name: schedule_entities_snapshots_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres --- - -ALTER SEQUENCE public.schedule_entities_snapshots_id_seq OWNED BY public.schedule_entities_snapshots.id; - - --- --- TOC entry 251 (class 1259 OID 16658) --- Name: signals; Type: TABLE; Schema: public; Owner: postgres --- - -CREATE TABLE public.signals ( - id bigint NOT NULL, - created_at timestamp with time zone, - updated_at timestamp with time zone, - deleted_at timestamp with time zone, - execution_project text NOT NULL, - execution_domain text NOT NULL, - execution_name text NOT NULL, - signal_id text NOT NULL, - type bytea NOT NULL, - value bytea -); - - -ALTER TABLE public.signals OWNER TO postgres; - --- --- TOC entry 250 (class 1259 OID 16657) --- Name: signals_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres --- - -CREATE SEQUENCE public.signals_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - -ALTER TABLE public.signals_id_seq OWNER TO postgres; - --- --- TOC entry 3564 (class 0 OID 0) --- Dependencies: 250 --- Name: signals_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres --- - -ALTER SEQUENCE public.signals_id_seq OWNED BY public.signals.id; - - --- --- TOC entry 218 (class 1259 OID 16416) --- Name: tags; Type: TABLE; Schema: public; Owner: postgres --- - -CREATE TABLE public.tags ( - created_at timestamp with time zone, - updated_at timestamp with time zone, - deleted_at timestamp with time zone, - dataset_project text NOT NULL, - dataset_name text NOT NULL, - dataset_domain text NOT NULL, - dataset_version text NOT NULL, - tag_name text NOT NULL, - artifact_id text, - dataset_uuid uuid -); - - -ALTER TABLE public.tags OWNER TO postgres; - --- --- TOC entry 235 (class 1259 OID 16528) --- Name: task_executions; Type: TABLE; Schema: public; Owner: postgres --- - -CREATE TABLE public.task_executions ( - id bigint NOT NULL, - created_at timestamp with time zone, - updated_at timestamp with time zone, - deleted_at timestamp with time zone, - project text NOT NULL, - domain text NOT NULL, - name text NOT NULL, - version text NOT NULL, - execution_project text NOT NULL, - execution_domain text NOT NULL, - execution_name text NOT NULL, - node_id text NOT NULL, - retry_attempt bigint NOT NULL, - phase text, - phase_version bigint, - input_uri text, - closure bytea, - started_at timestamp with time zone, - task_execution_created_at timestamp with time zone, - task_execution_updated_at timestamp with time zone, - duration bigint -); - - -ALTER TABLE public.task_executions OWNER TO postgres; - --- --- TOC entry 234 (class 1259 OID 16527) --- Name: task_executions_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres --- - -CREATE SEQUENCE public.task_executions_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - -ALTER TABLE public.task_executions_id_seq OWNER TO postgres; - --- --- TOC entry 3565 (class 0 OID 0) --- Dependencies: 234 --- Name: task_executions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres --- - -ALTER SEQUENCE public.task_executions_id_seq OWNED BY public.task_executions.id; - - --- --- TOC entry 220 (class 1259 OID 16425) --- Name: tasks; Type: TABLE; Schema: public; Owner: postgres --- - -CREATE TABLE public.tasks ( - id bigint NOT NULL, - created_at timestamp with time zone, - updated_at timestamp with time zone, - deleted_at timestamp with time zone, - project text NOT NULL, - domain text NOT NULL, - name text NOT NULL, - version text NOT NULL, - closure bytea NOT NULL, - digest bytea, - type text, - short_description text -); - - -ALTER TABLE public.tasks OWNER TO postgres; - --- --- TOC entry 219 (class 1259 OID 16423) --- Name: tasks_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres --- - -CREATE SEQUENCE public.tasks_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - -ALTER TABLE public.tasks_id_seq OWNER TO postgres; - --- --- TOC entry 3566 (class 0 OID 0) --- Dependencies: 219 --- Name: tasks_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres --- - -ALTER SEQUENCE public.tasks_id_seq OWNED BY public.tasks.id; - - --- --- TOC entry 222 (class 1259 OID 16438) --- Name: workflows; Type: TABLE; Schema: public; Owner: postgres --- - -CREATE TABLE public.workflows ( - id bigint NOT NULL, - created_at timestamp with time zone, - updated_at timestamp with time zone, - deleted_at timestamp with time zone, - project text NOT NULL, - domain text NOT NULL, - name text NOT NULL, - version text NOT NULL, - typed_interface bytea, - remote_closure_identifier text NOT NULL, - digest bytea, - short_description text -); - - -ALTER TABLE public.workflows OWNER TO postgres; - --- --- TOC entry 221 (class 1259 OID 16437) --- Name: workflows_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres --- - -CREATE SEQUENCE public.workflows_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - -ALTER TABLE public.workflows_id_seq OWNER TO postgres; - --- --- TOC entry 3567 (class 0 OID 0) --- Dependencies: 221 --- Name: workflows_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres --- - -ALTER SEQUENCE public.workflows_id_seq OWNED BY public.workflows.id; - - --- --- TOC entry 3297 (class 2604 OID 16649) --- Name: description_entities id; Type: DEFAULT; Schema: public; Owner: postgres --- - -ALTER TABLE ONLY public.description_entities ALTER COLUMN id SET DEFAULT nextval('public.description_entities_id_seq'::regclass); - - --- --- TOC entry 3288 (class 2604 OID 16616) --- Name: execution_events id; Type: DEFAULT; Schema: public; Owner: postgres --- - -ALTER TABLE ONLY public.execution_events ALTER COLUMN id SET DEFAULT nextval('public.execution_events_id_seq'::regclass); - - --- --- TOC entry 3286 (class 2604 OID 16618) --- Name: executions id; Type: DEFAULT; Schema: public; Owner: postgres --- - -ALTER TABLE ONLY public.executions ALTER COLUMN id SET DEFAULT nextval('public.executions_id_seq'::regclass); - - --- --- TOC entry 3284 (class 2604 OID 16620) --- Name: launch_plans id; Type: DEFAULT; Schema: public; Owner: postgres --- - -ALTER TABLE ONLY public.launch_plans ALTER COLUMN id SET DEFAULT nextval('public.launch_plans_id_seq'::regclass); - - --- --- TOC entry 3292 (class 2604 OID 16622) --- Name: named_entity_metadata id; Type: DEFAULT; Schema: public; Owner: postgres --- - -ALTER TABLE ONLY public.named_entity_metadata ALTER COLUMN id SET DEFAULT nextval('public.named_entity_metadata_id_seq'::regclass); - - --- --- TOC entry 3290 (class 2604 OID 16624) --- Name: node_execution_events id; Type: DEFAULT; Schema: public; Owner: postgres --- - -ALTER TABLE ONLY public.node_execution_events ALTER COLUMN id SET DEFAULT nextval('public.node_execution_events_id_seq'::regclass); - - --- --- TOC entry 3289 (class 2604 OID 16626) --- Name: node_executions id; Type: DEFAULT; Schema: public; Owner: postgres --- - -ALTER TABLE ONLY public.node_executions ALTER COLUMN id SET DEFAULT nextval('public.node_executions_id_seq'::regclass); - - --- --- TOC entry 3280 (class 2604 OID 16628) --- Name: projects id; Type: DEFAULT; Schema: public; Owner: postgres --- - -ALTER TABLE ONLY public.projects ALTER COLUMN id SET DEFAULT nextval('public.projects_id_seq'::regclass); - - --- --- TOC entry 3294 (class 2604 OID 16630) --- Name: resources id; Type: DEFAULT; Schema: public; Owner: postgres --- - -ALTER TABLE ONLY public.resources ALTER COLUMN id SET DEFAULT nextval('public.resources_id_seq'::regclass); - - --- --- TOC entry 3295 (class 2604 OID 16633) --- Name: schedulable_entities id; Type: DEFAULT; Schema: public; Owner: postgres --- - -ALTER TABLE ONLY public.schedulable_entities ALTER COLUMN id SET DEFAULT nextval('public.schedulable_entities_id_seq'::regclass); - - --- --- TOC entry 3296 (class 2604 OID 16635) --- Name: schedule_entities_snapshots id; Type: DEFAULT; Schema: public; Owner: postgres --- - -ALTER TABLE ONLY public.schedule_entities_snapshots ALTER COLUMN id SET DEFAULT nextval('public.schedule_entities_snapshots_id_seq'::regclass); - - --- --- TOC entry 3298 (class 2604 OID 16661) --- Name: signals id; Type: DEFAULT; Schema: public; Owner: postgres --- - -ALTER TABLE ONLY public.signals ALTER COLUMN id SET DEFAULT nextval('public.signals_id_seq'::regclass); - - --- --- TOC entry 3291 (class 2604 OID 16639) --- Name: task_executions id; Type: DEFAULT; Schema: public; Owner: postgres --- - -ALTER TABLE ONLY public.task_executions ALTER COLUMN id SET DEFAULT nextval('public.task_executions_id_seq'::regclass); - - --- --- TOC entry 3282 (class 2604 OID 16641) --- Name: tasks id; Type: DEFAULT; Schema: public; Owner: postgres --- - -ALTER TABLE ONLY public.tasks ALTER COLUMN id SET DEFAULT nextval('public.tasks_id_seq'::regclass); - - --- --- TOC entry 3283 (class 2604 OID 16643) --- Name: workflows id; Type: DEFAULT; Schema: public; Owner: postgres --- - -ALTER TABLE ONLY public.workflows ALTER COLUMN id SET DEFAULT nextval('public.workflows_id_seq'::regclass); - - --- --- TOC entry 3372 (class 2606 OID 16546) --- Name: artifact_data artifact_data_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres --- - -ALTER TABLE ONLY public.artifact_data - ADD CONSTRAINT artifact_data_pkey PRIMARY KEY (dataset_project, dataset_name, dataset_domain, dataset_version, artifact_id, name); - - --- --- TOC entry 3364 (class 2606 OID 16523) --- Name: artifacts artifacts_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres --- - -ALTER TABLE ONLY public.artifacts - ADD CONSTRAINT artifacts_pkey PRIMARY KEY (dataset_project, dataset_name, dataset_domain, dataset_version, artifact_id); - - --- --- TOC entry 3305 (class 2606 OID 16398) --- Name: datasets datasets_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres --- - -ALTER TABLE ONLY public.datasets - ADD CONSTRAINT datasets_pkey PRIMARY KEY (project, name, domain, version); - - --- --- TOC entry 3307 (class 2606 OID 16404) --- Name: datasets datasets_uuid_key; Type: CONSTRAINT; Schema: public; Owner: postgres --- - -ALTER TABLE ONLY public.datasets - ADD CONSTRAINT datasets_uuid_key UNIQUE (uuid); - - --- --- TOC entry 3397 (class 2606 OID 16653) --- Name: description_entities description_entities_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres --- - -ALTER TABLE ONLY public.description_entities - ADD CONSTRAINT description_entities_pkey PRIMARY KEY (resource_type, project, domain, name, version); - - --- --- TOC entry 3346 (class 2606 OID 16491) --- Name: execution_events execution_events_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres --- - -ALTER TABLE ONLY public.execution_events - ADD CONSTRAINT execution_events_pkey PRIMARY KEY (execution_project, execution_domain, execution_name, phase); - - --- --- TOC entry 3335 (class 2606 OID 16473) --- Name: executions executions_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres --- - -ALTER TABLE ONLY public.executions - ADD CONSTRAINT executions_pkey PRIMARY KEY (execution_project, execution_domain, execution_name); - - --- --- TOC entry 3332 (class 2606 OID 16459) --- Name: launch_plans launch_plans_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres --- - -ALTER TABLE ONLY public.launch_plans - ADD CONSTRAINT launch_plans_pkey PRIMARY KEY (project, domain, name, version); - - --- --- TOC entry 3300 (class 2606 OID 16393) --- Name: migrations migrations_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres --- - -ALTER TABLE ONLY public.migrations - ADD CONSTRAINT migrations_pkey PRIMARY KEY (id); - - --- --- TOC entry 3383 (class 2606 OID 16578) --- Name: named_entity_metadata named_entity_metadata_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres --- - -ALTER TABLE ONLY public.named_entity_metadata - ADD CONSTRAINT named_entity_metadata_pkey PRIMARY KEY (resource_type, project, domain, name); - - --- --- TOC entry 3361 (class 2606 OID 16515) --- Name: node_execution_events node_execution_events_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres --- - -ALTER TABLE ONLY public.node_execution_events - ADD CONSTRAINT node_execution_events_pkey PRIMARY KEY (execution_project, execution_domain, execution_name, node_id, phase); - - --- --- TOC entry 3356 (class 2606 OID 16502) --- Name: node_executions node_executions_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres --- - -ALTER TABLE ONLY public.node_executions - ADD CONSTRAINT node_executions_pkey PRIMARY KEY (execution_project, execution_domain, execution_name, node_id); - - --- --- TOC entry 3374 (class 2606 OID 16553) --- Name: partition_keys partition_keys_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres --- - -ALTER TABLE ONLY public.partition_keys - ADD CONSTRAINT partition_keys_pkey PRIMARY KEY (dataset_uuid, name); - - --- --- TOC entry 3377 (class 2606 OID 16560) --- Name: partitions partitions_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres --- - -ALTER TABLE ONLY public.partitions - ADD CONSTRAINT partitions_pkey PRIMARY KEY (dataset_uuid, key, value, artifact_id); - - --- --- TOC entry 3312 (class 2606 OID 16410) --- Name: projects projects_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres --- - -ALTER TABLE ONLY public.projects - ADD CONSTRAINT projects_pkey PRIMARY KEY (identifier); - - --- --- TOC entry 3379 (class 2606 OID 16568) --- Name: reservations reservations_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres --- - -ALTER TABLE ONLY public.reservations - ADD CONSTRAINT reservations_pkey PRIMARY KEY (dataset_project, dataset_name, dataset_domain, dataset_version, tag_name); - - --- --- TOC entry 3387 (class 2606 OID 16632) --- Name: resources resources_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres --- - -ALTER TABLE ONLY public.resources - ADD CONSTRAINT resources_pkey PRIMARY KEY (id); - - --- --- TOC entry 3391 (class 2606 OID 16602) --- Name: schedulable_entities schedulable_entities_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres --- - -ALTER TABLE ONLY public.schedulable_entities - ADD CONSTRAINT schedulable_entities_pkey PRIMARY KEY (project, domain, name, version); - - --- --- TOC entry 3395 (class 2606 OID 16637) --- Name: schedule_entities_snapshots schedule_entities_snapshots_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres --- - -ALTER TABLE ONLY public.schedule_entities_snapshots - ADD CONSTRAINT schedule_entities_snapshots_pkey PRIMARY KEY (id); - - --- --- TOC entry 3405 (class 2606 OID 16665) --- Name: signals signals_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres --- - -ALTER TABLE ONLY public.signals - ADD CONSTRAINT signals_pkey PRIMARY KEY (execution_project, execution_domain, execution_name, signal_id); - - --- --- TOC entry 3315 (class 2606 OID 16422) --- Name: tags tags_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres --- - -ALTER TABLE ONLY public.tags - ADD CONSTRAINT tags_pkey PRIMARY KEY (dataset_project, dataset_name, dataset_domain, dataset_version, tag_name); - - --- --- TOC entry 3370 (class 2606 OID 16535) --- Name: task_executions task_executions_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres --- - -ALTER TABLE ONLY public.task_executions - ADD CONSTRAINT task_executions_pkey PRIMARY KEY (project, domain, name, version, execution_project, execution_domain, execution_name, node_id, retry_attempt); - - --- --- TOC entry 3321 (class 2606 OID 16432) --- Name: tasks tasks_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres --- - -ALTER TABLE ONLY public.tasks - ADD CONSTRAINT tasks_pkey PRIMARY KEY (project, domain, name, version); - - --- --- TOC entry 3327 (class 2606 OID 16445) --- Name: workflows workflows_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres --- - -ALTER TABLE ONLY public.workflows - ADD CONSTRAINT workflows_pkey PRIMARY KEY (project, domain, name, version); - - --- --- TOC entry 3362 (class 1259 OID 16526) --- Name: artifacts_dataset_uuid_idx; Type: INDEX; Schema: public; Owner: postgres --- - -CREATE INDEX artifacts_dataset_uuid_idx ON public.artifacts USING btree (dataset_uuid); - - --- --- TOC entry 3301 (class 1259 OID 16411) --- Name: dataset_domain_idx; Type: INDEX; Schema: public; Owner: postgres --- - -CREATE INDEX dataset_domain_idx ON public.datasets USING btree (domain); - - --- --- TOC entry 3302 (class 1259 OID 16412) --- Name: dataset_name_idx; Type: INDEX; Schema: public; Owner: postgres --- - -CREATE INDEX dataset_name_idx ON public.datasets USING btree (name); - - --- --- TOC entry 3303 (class 1259 OID 16408) --- Name: dataset_version_idx; Type: INDEX; Schema: public; Owner: postgres --- - -CREATE INDEX dataset_version_idx ON public.datasets USING btree (version); - - --- --- TOC entry 3398 (class 1259 OID 16656) --- Name: description_entity_project_domain_name_version_idx; Type: INDEX; Schema: public; Owner: postgres --- - -CREATE INDEX description_entity_project_domain_name_version_idx ON public.description_entities USING btree (resource_type, project, domain, name, version); - - --- --- TOC entry 3399 (class 1259 OID 16654) --- Name: idx_description_entities_deleted_at; Type: INDEX; Schema: public; Owner: postgres --- - -CREATE INDEX idx_description_entities_deleted_at ON public.description_entities USING btree (deleted_at); - - --- --- TOC entry 3400 (class 1259 OID 16655) --- Name: idx_description_entities_id; Type: INDEX; Schema: public; Owner: postgres --- - -CREATE INDEX idx_description_entities_id ON public.description_entities USING btree (id); - - --- --- TOC entry 3347 (class 1259 OID 16492) --- Name: idx_execution_events_deleted_at; Type: INDEX; Schema: public; Owner: postgres --- - -CREATE INDEX idx_execution_events_deleted_at ON public.execution_events USING btree (deleted_at); - - --- --- TOC entry 3348 (class 1259 OID 16617) --- Name: idx_execution_events_id; Type: INDEX; Schema: public; Owner: postgres --- - -CREATE INDEX idx_execution_events_id ON public.execution_events USING btree (id); - - --- --- TOC entry 3336 (class 1259 OID 16481) --- Name: idx_executions_created_at; Type: INDEX; Schema: public; Owner: postgres --- - -CREATE INDEX idx_executions_created_at ON public.executions USING btree (execution_created_at); - - --- --- TOC entry 3337 (class 1259 OID 16478) --- Name: idx_executions_deleted_at; Type: INDEX; Schema: public; Owner: postgres --- - -CREATE INDEX idx_executions_deleted_at ON public.executions USING btree (deleted_at); - - --- --- TOC entry 3338 (class 1259 OID 16480) --- Name: idx_executions_error_kind; Type: INDEX; Schema: public; Owner: postgres --- - -CREATE INDEX idx_executions_error_kind ON public.executions USING btree (error_kind); - - --- --- TOC entry 3339 (class 1259 OID 16619) --- Name: idx_executions_id; Type: INDEX; Schema: public; Owner: postgres --- - -CREATE INDEX idx_executions_id ON public.executions USING btree (id); - - --- --- TOC entry 3340 (class 1259 OID 16474) --- Name: idx_executions_launch_plan_id; Type: INDEX; Schema: public; Owner: postgres --- - -CREATE INDEX idx_executions_launch_plan_id ON public.executions USING btree (launch_plan_id); - - --- --- TOC entry 3341 (class 1259 OID 16476) --- Name: idx_executions_state; Type: INDEX; Schema: public; Owner: postgres --- - -CREATE INDEX idx_executions_state ON public.executions USING btree (state); - - --- --- TOC entry 3342 (class 1259 OID 16482) --- Name: idx_executions_task_id; Type: INDEX; Schema: public; Owner: postgres --- - -CREATE INDEX idx_executions_task_id ON public.executions USING btree (task_id); - - --- --- TOC entry 3343 (class 1259 OID 16479) --- Name: idx_executions_user; Type: INDEX; Schema: public; Owner: postgres --- - -CREATE INDEX idx_executions_user ON public.executions USING btree ("user"); - - --- --- TOC entry 3344 (class 1259 OID 16477) --- Name: idx_executions_workflow_id; Type: INDEX; Schema: public; Owner: postgres --- - -CREATE INDEX idx_executions_workflow_id ON public.executions USING btree (workflow_id); - - --- --- TOC entry 3328 (class 1259 OID 16462) --- Name: idx_launch_plans_deleted_at; Type: INDEX; Schema: public; Owner: postgres --- - -CREATE INDEX idx_launch_plans_deleted_at ON public.launch_plans USING btree (deleted_at); - - --- --- TOC entry 3329 (class 1259 OID 16621) --- Name: idx_launch_plans_id; Type: INDEX; Schema: public; Owner: postgres --- - -CREATE INDEX idx_launch_plans_id ON public.launch_plans USING btree (id); - - --- --- TOC entry 3330 (class 1259 OID 16460) --- Name: idx_launch_plans_workflow_id; Type: INDEX; Schema: public; Owner: postgres --- - -CREATE INDEX idx_launch_plans_workflow_id ON public.launch_plans USING btree (workflow_id); - - --- --- TOC entry 3380 (class 1259 OID 16581) --- Name: idx_named_entity_metadata_deleted_at; Type: INDEX; Schema: public; Owner: postgres --- - -CREATE INDEX idx_named_entity_metadata_deleted_at ON public.named_entity_metadata USING btree (deleted_at); - - --- --- TOC entry 3381 (class 1259 OID 16623) --- Name: idx_named_entity_metadata_id; Type: INDEX; Schema: public; Owner: postgres --- - -CREATE INDEX idx_named_entity_metadata_id ON public.named_entity_metadata USING btree (id); - - --- --- TOC entry 3357 (class 1259 OID 16524) --- Name: idx_node_execution_events_deleted_at; Type: INDEX; Schema: public; Owner: postgres --- - -CREATE INDEX idx_node_execution_events_deleted_at ON public.node_execution_events USING btree (deleted_at); - - --- --- TOC entry 3358 (class 1259 OID 16625) --- Name: idx_node_execution_events_id; Type: INDEX; Schema: public; Owner: postgres --- - -CREATE INDEX idx_node_execution_events_id ON public.node_execution_events USING btree (id); - - --- --- TOC entry 3359 (class 1259 OID 16521) --- Name: idx_node_execution_events_node_id; Type: INDEX; Schema: public; Owner: postgres --- - -CREATE INDEX idx_node_execution_events_node_id ON public.node_execution_events USING btree (node_id); - - --- --- TOC entry 3349 (class 1259 OID 16505) --- Name: idx_node_executions_deleted_at; Type: INDEX; Schema: public; Owner: postgres --- - -CREATE INDEX idx_node_executions_deleted_at ON public.node_executions USING btree (deleted_at); - - --- --- TOC entry 3350 (class 1259 OID 16593) --- Name: idx_node_executions_error_kind; Type: INDEX; Schema: public; Owner: postgres --- - -CREATE INDEX idx_node_executions_error_kind ON public.node_executions USING btree (error_kind); - - --- --- TOC entry 3351 (class 1259 OID 16627) --- Name: idx_node_executions_id; Type: INDEX; Schema: public; Owner: postgres --- - -CREATE INDEX idx_node_executions_id ON public.node_executions USING btree (id); - - --- --- TOC entry 3352 (class 1259 OID 16504) --- Name: idx_node_executions_node_id; Type: INDEX; Schema: public; Owner: postgres --- - -CREATE INDEX idx_node_executions_node_id ON public.node_executions USING btree (node_id); - - --- --- TOC entry 3353 (class 1259 OID 16592) --- Name: idx_node_executions_parent_id; Type: INDEX; Schema: public; Owner: postgres --- - -CREATE INDEX idx_node_executions_parent_id ON public.node_executions USING btree (parent_id); - - --- --- TOC entry 3354 (class 1259 OID 16503) --- Name: idx_node_executions_parent_task_execution_id; Type: INDEX; Schema: public; Owner: postgres --- - -CREATE INDEX idx_node_executions_parent_task_execution_id ON public.node_executions USING btree (parent_task_execution_id); - - --- --- TOC entry 3375 (class 1259 OID 16561) --- Name: idx_partitions_artifact_id; Type: INDEX; Schema: public; Owner: postgres --- - -CREATE INDEX idx_partitions_artifact_id ON public.partitions USING btree (artifact_id); - - --- --- TOC entry 3308 (class 1259 OID 16414) --- Name: idx_projects_deleted_at; Type: INDEX; Schema: public; Owner: postgres --- - -CREATE INDEX idx_projects_deleted_at ON public.projects USING btree (deleted_at); - - --- --- TOC entry 3309 (class 1259 OID 16629) --- Name: idx_projects_id; Type: INDEX; Schema: public; Owner: postgres --- - -CREATE INDEX idx_projects_id ON public.projects USING btree (id); - - --- --- TOC entry 3310 (class 1259 OID 16413) --- Name: idx_projects_state; Type: INDEX; Schema: public; Owner: postgres --- - -CREATE INDEX idx_projects_state ON public.projects USING btree (state); - - --- --- TOC entry 3388 (class 1259 OID 16603) --- Name: idx_schedulable_entities_deleted_at; Type: INDEX; Schema: public; Owner: postgres --- - -CREATE INDEX idx_schedulable_entities_deleted_at ON public.schedulable_entities USING btree (deleted_at); - - --- --- TOC entry 3389 (class 1259 OID 16634) --- Name: idx_schedulable_entities_id; Type: INDEX; Schema: public; Owner: postgres --- - -CREATE INDEX idx_schedulable_entities_id ON public.schedulable_entities USING btree (id); - - --- --- TOC entry 3392 (class 1259 OID 16614) --- Name: idx_schedule_entities_snapshots_deleted_at; Type: INDEX; Schema: public; Owner: postgres --- - -CREATE INDEX idx_schedule_entities_snapshots_deleted_at ON public.schedule_entities_snapshots USING btree (deleted_at); - - --- --- TOC entry 3393 (class 1259 OID 16638) --- Name: idx_schedule_entities_snapshots_id; Type: INDEX; Schema: public; Owner: postgres --- - -CREATE INDEX idx_schedule_entities_snapshots_id ON public.schedule_entities_snapshots USING btree (id); - - --- --- TOC entry 3401 (class 1259 OID 16667) --- Name: idx_signals_deleted_at; Type: INDEX; Schema: public; Owner: postgres --- - -CREATE INDEX idx_signals_deleted_at ON public.signals USING btree (deleted_at); - - --- --- TOC entry 3402 (class 1259 OID 16668) --- Name: idx_signals_id; Type: INDEX; Schema: public; Owner: postgres --- - -CREATE INDEX idx_signals_id ON public.signals USING btree (id); - - --- --- TOC entry 3403 (class 1259 OID 16666) --- Name: idx_signals_signal_id; Type: INDEX; Schema: public; Owner: postgres --- - -CREATE INDEX idx_signals_signal_id ON public.signals USING btree (signal_id); - - --- --- TOC entry 3365 (class 1259 OID 16538) --- Name: idx_task_executions_deleted_at; Type: INDEX; Schema: public; Owner: postgres --- - -CREATE INDEX idx_task_executions_deleted_at ON public.task_executions USING btree (deleted_at); - - --- --- TOC entry 3366 (class 1259 OID 16537) --- Name: idx_task_executions_exec; Type: INDEX; Schema: public; Owner: postgres --- - -CREATE INDEX idx_task_executions_exec ON public.task_executions USING btree (execution_project, execution_domain, execution_name, node_id); - - --- --- TOC entry 3367 (class 1259 OID 16640) --- Name: idx_task_executions_id; Type: INDEX; Schema: public; Owner: postgres --- - -CREATE INDEX idx_task_executions_id ON public.task_executions USING btree (id); - - --- --- TOC entry 3368 (class 1259 OID 16536) --- Name: idx_task_executions_node_id; Type: INDEX; Schema: public; Owner: postgres --- - -CREATE INDEX idx_task_executions_node_id ON public.task_executions USING btree (node_id); - - --- --- TOC entry 3316 (class 1259 OID 16434) --- Name: idx_tasks_deleted_at; Type: INDEX; Schema: public; Owner: postgres --- - -CREATE INDEX idx_tasks_deleted_at ON public.tasks USING btree (deleted_at); - - --- --- TOC entry 3317 (class 1259 OID 16642) --- Name: idx_tasks_id; Type: INDEX; Schema: public; Owner: postgres --- - -CREATE INDEX idx_tasks_id ON public.tasks USING btree (id); - - --- --- TOC entry 3322 (class 1259 OID 16448) --- Name: idx_workflows_deleted_at; Type: INDEX; Schema: public; Owner: postgres --- - -CREATE INDEX idx_workflows_deleted_at ON public.workflows USING btree (deleted_at); - - --- --- TOC entry 3323 (class 1259 OID 16644) --- Name: idx_workflows_id; Type: INDEX; Schema: public; Owner: postgres --- - -CREATE INDEX idx_workflows_id ON public.workflows USING btree (id); - - --- --- TOC entry 3333 (class 1259 OID 16461) --- Name: lp_project_domain_name_idx; Type: INDEX; Schema: public; Owner: postgres --- - -CREATE INDEX lp_project_domain_name_idx ON public.launch_plans USING btree (project, domain, name); - - --- --- TOC entry 3384 (class 1259 OID 16580) --- Name: named_entity_metadata_type_project_domain_name_idx; Type: INDEX; Schema: public; Owner: postgres --- - -CREATE INDEX named_entity_metadata_type_project_domain_name_idx ON public.named_entity_metadata USING btree (resource_type, project, domain, name); - - --- --- TOC entry 3385 (class 1259 OID 16591) --- Name: resource_idx; Type: INDEX; Schema: public; Owner: postgres --- - -CREATE UNIQUE INDEX resource_idx ON public.resources USING btree (project, domain, workflow, launch_plan, resource_type); - - --- --- TOC entry 3313 (class 1259 OID 16424) --- Name: tags_dataset_uuid_idx; Type: INDEX; Schema: public; Owner: postgres --- - -CREATE INDEX tags_dataset_uuid_idx ON public.tags USING btree (dataset_uuid); - - --- --- TOC entry 3318 (class 1259 OID 16436) --- Name: task_project_domain_idx; Type: INDEX; Schema: public; Owner: postgres --- - -CREATE INDEX task_project_domain_idx ON public.tasks USING btree (project, domain); - - --- --- TOC entry 3319 (class 1259 OID 16433) --- Name: task_project_domain_name_idx; Type: INDEX; Schema: public; Owner: postgres --- - -CREATE INDEX task_project_domain_name_idx ON public.tasks USING btree (project, domain, name); - - --- --- TOC entry 3324 (class 1259 OID 16446) --- Name: workflow_project_domain_idx; Type: INDEX; Schema: public; Owner: postgres --- - -CREATE INDEX workflow_project_domain_idx ON public.workflows USING btree (project, domain); - - --- --- TOC entry 3325 (class 1259 OID 16447) --- Name: workflow_project_domain_name_idx; Type: INDEX; Schema: public; Owner: postgres --- - -CREATE INDEX workflow_project_domain_name_idx ON public.workflows USING btree (project, domain, name); - - --- Completed on 2023-03-20 14:15:25 PDT - --- --- PostgreSQL database dump complete --- - diff --git a/pkg/repositories/config/migration_models.go b/pkg/repositories/config/migration_models.go index b46b93858..4c0144697 100644 --- a/pkg/repositories/config/migration_models.go +++ b/pkg/repositories/config/migration_models.go @@ -10,6 +10,9 @@ import ( IMPORTANT: You'll observe several models are redefined below with named index tags *omitted*. This is because postgres requires that index names be unique across *all* tables. If you modify Task, Execution, NodeExecution or TaskExecution models in code be sure to update the appropriate duplicate definitions here. + That is, in the actual code, it makes more sense to re-use structs, like how NodeExecutionKey is in both NodeExecution + and in TaskExecution. But simply re-using in migrations would result in indices with the same name. + In the new model where all models are replicated in each function, this is not an issue. */ type TaskKey struct { diff --git a/pkg/repositories/config/migrations.go b/pkg/repositories/config/migrations.go index 3e7e6437c..4a35c0c1d 100644 --- a/pkg/repositories/config/migrations.go +++ b/pkg/repositories/config/migrations.go @@ -3,6 +3,7 @@ package config import ( "database/sql" "fmt" + "github.com/flyteorg/flyteidl/gen/pb-go/flyteidl/admin" "github.com/flyteorg/flyteidl/gen/pb-go/flyteidl/core" "github.com/flyteorg/flytestdlib/storage" "time" @@ -727,13 +728,25 @@ var NoopMigrations = []*gormigrate.Migration{ NodeExecutionUpdatedAt *time.Time Duration time.Duration // The task execution (if any) which launched this node execution. + // TO BE DEPRECATED - as we have now introduced ParentID ParentTaskExecutionID uint `sql:"default:null" gorm:"index"` // The workflow execution (if any) which this node execution launched LaunchedExecution models.Execution `gorm:"foreignKey:ParentNodeExecutionID;references:ID"` // In the case of dynamic workflow nodes, the remote closure is uploaded to the path specified here. DynamicWorkflowRemoteClosureReference string // Metadata that is only relevant to the flyteadmin service that is used to parse the model and track additional attributes. - InternalData []byte + InternalData []byte + NodeExecutionMetadata []byte + // Parent that spawned this node execution - value is empty for executions at level 0 + ParentID *uint `sql:"default:null" gorm:"index"` + // List of child node executions - for cases like Dynamic task, sub workflow, etc + ChildNodeExecutions []NodeExecution `gorm:"foreignKey:ParentID;references:ID"` + // Execution Error Kind. nullable, can be one of core.ExecutionError_ErrorKind + ErrorKind *string `gorm:"index"` + // Execution Error Code nullable. string value, but finite set determined by the execution engine and plugins + ErrorCode *string + // If the node is of Type Task, this should always exist for a successful execution, indicating the cache status for the execution + CacheStatus *string } return tx.AutoMigrate(&NodeExecution{}) @@ -860,7 +873,7 @@ var NoopMigrations = []*gormigrate.Migration{ }, { - ID: "pg-noop-2023-03-31-noop-resource-3", + ID: "pg-noop-2023-03-31-noop-resource", Migrate: func(tx *gorm.DB) error { type ResourcePriority int32 @@ -886,6 +899,53 @@ var NoopMigrations = []*gormigrate.Migration{ return nil }, }, + + { + ID: "pg-noop-2023-03-31-noop-schedulable_entities", + Migrate: func(tx *gorm.DB) error { + type SchedulableEntityKey struct { + Project string `gorm:"primary_key"` + Domain string `gorm:"primary_key"` + Name string `gorm:"primary_key"` + Version string `gorm:"primary_key"` + } + type SchedulableEntity struct { + ID uint `gorm:"index;autoIncrement;not null"` + CreatedAt time.Time + UpdatedAt time.Time + DeletedAt *time.Time `gorm:"index"` + SchedulableEntityKey + CronExpression string + FixedRateValue uint32 + Unit admin.FixedRateUnit + KickoffTimeInputArg string + Active *bool + } + + return tx.AutoMigrate(&SchedulableEntity{}) + }, + Rollback: func(tx *gorm.DB) error { + return nil + }, + }, + + { + ID: "pg-noop-2023-03-31-noop-schedulable_entities-snapshot", + Migrate: func(tx *gorm.DB) error { + type ScheduleEntitiesSnapshot struct { + ID uint `gorm:"index;autoIncrement;not null"` + CreatedAt time.Time + UpdatedAt time.Time + DeletedAt *time.Time `gorm:"index"` + Snapshot []byte `gorm:"column:snapshot" schema:"-"` + } + + return tx.AutoMigrate(&ScheduleEntitiesSnapshot{}) + }, + Rollback: func(tx *gorm.DB) error { + return nil + }, + }, } var Migrations = append(LegacyMigrations, NoopMigrations...) diff --git a/pkg/repositories/config/migrations_test.go b/pkg/repositories/config/migrations_test.go index 377658ace..18a95256b 100644 --- a/pkg/repositories/config/migrations_test.go +++ b/pkg/repositories/config/migrations_test.go @@ -90,14 +90,14 @@ func TestMigrationReplicate(t *testing.T) { gormConfig := &gorm.Config{ Logger: gLogger, - DisableForeignKeyConstraintWhenMigrating: false, + DisableForeignKeyConstraintWhenMigrating: true, } var gormDb *gorm.DB pgConfig := database.PostgresConfig{ Host: "localhost", Port: 30001, - DbName: "replicator", // this should be a completely blank database + DbName: "replicator2", // this should be a completely blank database User: "postgres", Password: "postgres", ExtraOptions: "", @@ -117,3 +117,41 @@ func TestMigrationReplicate(t *testing.T) { } fmt.Println(ctx, "Migration ran successfully") } + +func TestLegacyOnlyMigrations(t *testing.T) { + gLogger := gormLogger.New(log.New(os.Stdout, "\r\n", log.LstdFlags), gormLogger.Config{ + SlowThreshold: 200 * time.Millisecond, + LogLevel: gormLogger.Info, + IgnoreRecordNotFoundError: false, + Colorful: true, + }) + + gormConfig := &gorm.Config{ + Logger: gLogger, + DisableForeignKeyConstraintWhenMigrating: true, + } + + var gormDb *gorm.DB + pgConfig := database.PostgresConfig{ + Host: "localhost", + Port: 30001, + DbName: "currentempty", + User: "postgres", + Password: "postgres", + ExtraOptions: "", + Debug: false, + } + ctx := context.Background() + postgresDsn := database.PostgresDsn(ctx, pgConfig) + dialector := postgres.Open(postgresDsn) + gormDb, err := gorm.Open(dialector, gormConfig) + assert.NoError(t, err) + + fmt.Println(gormDb) + + m := gormigrate.New(gormDb, gormigrate.DefaultOptions, LegacyMigrations) + if err := m.Migrate(); err != nil { + fmt.Errorf("database migration failed: %v", err) + } + fmt.Println(ctx, "Migration ran successfully") +} diff --git a/replicate.sql b/replicate.sql deleted file mode 100644 index 7240f4fcf..000000000 --- a/replicate.sql +++ /dev/null @@ -1,1282 +0,0 @@ --- --- PostgreSQL database dump --- - --- Dumped from database version 15.1 --- Dumped by pg_dump version 15.1 - --- Started on 2023-03-20 14:34:36 PDT - -SET statement_timeout = 0; -SET lock_timeout = 0; -SET idle_in_transaction_session_timeout = 0; -SET client_encoding = 'UTF8'; -SET standard_conforming_strings = on; -SELECT pg_catalog.set_config('search_path', '', false); -SET check_function_bodies = false; -SET xmloption = content; -SET client_min_messages = warning; -SET row_security = off; - -SET default_tablespace = ''; - -SET default_table_access_method = heap; - --- --- TOC entry 234 (class 1259 OID 16800) --- Name: description_entities; Type: TABLE; Schema: public; Owner: postgres --- - -CREATE TABLE public.description_entities ( - resource_type integer NOT NULL, - project text NOT NULL, - domain text NOT NULL, - name text NOT NULL, - version text NOT NULL, - id bigint NOT NULL, - created_at timestamp with time zone, - updated_at timestamp with time zone, - deleted_at timestamp with time zone, - link text, - short_description text, - long_description bytea -); - - -ALTER TABLE public.description_entities OWNER TO postgres; - --- --- TOC entry 233 (class 1259 OID 16799) --- Name: description_entities_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres --- - -CREATE SEQUENCE public.description_entities_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - -ALTER TABLE public.description_entities_id_seq OWNER TO postgres; - --- --- TOC entry 3481 (class 0 OID 0) --- Dependencies: 233 --- Name: description_entities_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres --- - -ALTER SEQUENCE public.description_entities_id_seq OWNED BY public.description_entities.id; - - --- --- TOC entry 230 (class 1259 OID 16777) --- Name: execution_events; Type: TABLE; Schema: public; Owner: postgres --- - -CREATE TABLE public.execution_events ( - id bigint NOT NULL, - created_at timestamp with time zone, - updated_at timestamp with time zone, - deleted_at timestamp with time zone, - execution_project text NOT NULL, - execution_domain text NOT NULL, - execution_name text NOT NULL, - request_id text, - occurred_at timestamp with time zone, - phase text NOT NULL -); - - -ALTER TABLE public.execution_events OWNER TO postgres; - --- --- TOC entry 229 (class 1259 OID 16776) --- Name: execution_events_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres --- - -CREATE SEQUENCE public.execution_events_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - -ALTER TABLE public.execution_events_id_seq OWNER TO postgres; - --- --- TOC entry 3482 (class 0 OID 0) --- Dependencies: 229 --- Name: execution_events_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres --- - -ALTER SEQUENCE public.execution_events_id_seq OWNED BY public.execution_events.id; - - --- --- TOC entry 240 (class 1259 OID 16836) --- Name: executions; Type: TABLE; Schema: public; Owner: postgres --- - -CREATE TABLE public.executions ( - id bigint NOT NULL, - created_at timestamp with time zone, - updated_at timestamp with time zone, - deleted_at timestamp with time zone, - execution_project text NOT NULL, - execution_domain text NOT NULL, - execution_name text NOT NULL, - launch_plan_id bigint, - workflow_id bigint, - task_id bigint, - phase text, - closure bytea, - spec bytea NOT NULL, - started_at timestamp with time zone, - execution_created_at timestamp with time zone, - execution_updated_at timestamp with time zone, - duration bigint, - abort_cause text, - mode integer, - source_execution_id bigint, - parent_node_execution_id bigint, - cluster text, - inputs_uri text, - user_inputs_uri text, - error_kind text, - error_code text, - "user" text, - state integer DEFAULT 0, - launch_entity text -); - - -ALTER TABLE public.executions OWNER TO postgres; - --- --- TOC entry 239 (class 1259 OID 16835) --- Name: executions_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres --- - -CREATE SEQUENCE public.executions_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - -ALTER TABLE public.executions_id_seq OWNER TO postgres; - --- --- TOC entry 3483 (class 0 OID 0) --- Dependencies: 239 --- Name: executions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres --- - -ALTER SEQUENCE public.executions_id_seq OWNED BY public.executions.id; - - --- --- TOC entry 222 (class 1259 OID 16724) --- Name: launch_plans; Type: TABLE; Schema: public; Owner: postgres --- - -CREATE TABLE public.launch_plans ( - id bigint NOT NULL, - created_at timestamp with time zone, - updated_at timestamp with time zone, - deleted_at timestamp with time zone, - project text NOT NULL, - domain text NOT NULL, - name text NOT NULL, - version text NOT NULL, - spec bytea NOT NULL, - workflow_id bigint, - closure bytea NOT NULL, - state integer DEFAULT 0, - digest bytea, - schedule_type text -); - - -ALTER TABLE public.launch_plans OWNER TO postgres; - --- --- TOC entry 221 (class 1259 OID 16723) --- Name: launch_plans_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres --- - -CREATE SEQUENCE public.launch_plans_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - -ALTER TABLE public.launch_plans_id_seq OWNER TO postgres; - --- --- TOC entry 3484 (class 0 OID 0) --- Dependencies: 221 --- Name: launch_plans_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres --- - -ALTER SEQUENCE public.launch_plans_id_seq OWNED BY public.launch_plans.id; - - --- --- TOC entry 214 (class 1259 OID 16679) --- Name: migrations; Type: TABLE; Schema: public; Owner: postgres --- - -CREATE TABLE public.migrations ( - id character varying(255) NOT NULL -); - - -ALTER TABLE public.migrations OWNER TO postgres; - --- --- TOC entry 224 (class 1259 OID 16738) --- Name: named_entity_metadata; Type: TABLE; Schema: public; Owner: postgres --- - -CREATE TABLE public.named_entity_metadata ( - id bigint NOT NULL, - created_at timestamp with time zone, - updated_at timestamp with time zone, - deleted_at timestamp with time zone, - resource_type integer NOT NULL, - project text NOT NULL, - domain text NOT NULL, - name text NOT NULL, - description character varying(300), - state integer DEFAULT 0 -); - - -ALTER TABLE public.named_entity_metadata OWNER TO postgres; - --- --- TOC entry 223 (class 1259 OID 16737) --- Name: named_entity_metadata_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres --- - -CREATE SEQUENCE public.named_entity_metadata_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - -ALTER TABLE public.named_entity_metadata_id_seq OWNER TO postgres; - --- --- TOC entry 3485 (class 0 OID 0) --- Dependencies: 223 --- Name: named_entity_metadata_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres --- - -ALTER SEQUENCE public.named_entity_metadata_id_seq OWNED BY public.named_entity_metadata.id; - - --- --- TOC entry 232 (class 1259 OID 16788) --- Name: node_execution_events; Type: TABLE; Schema: public; Owner: postgres --- - -CREATE TABLE public.node_execution_events ( - id bigint NOT NULL, - created_at timestamp with time zone, - updated_at timestamp with time zone, - deleted_at timestamp with time zone, - execution_project text NOT NULL, - execution_domain text NOT NULL, - execution_name text NOT NULL, - node_id text NOT NULL, - request_id text, - occurred_at timestamp with time zone, - phase text NOT NULL -); - - -ALTER TABLE public.node_execution_events OWNER TO postgres; - --- --- TOC entry 231 (class 1259 OID 16787) --- Name: node_execution_events_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres --- - -CREATE SEQUENCE public.node_execution_events_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - -ALTER TABLE public.node_execution_events_id_seq OWNER TO postgres; - --- --- TOC entry 3486 (class 0 OID 0) --- Dependencies: 231 --- Name: node_execution_events_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres --- - -ALTER SEQUENCE public.node_execution_events_id_seq OWNED BY public.node_execution_events.id; - - --- --- TOC entry 228 (class 1259 OID 16764) --- Name: node_executions; Type: TABLE; Schema: public; Owner: postgres --- - -CREATE TABLE public.node_executions ( - id bigint NOT NULL, - created_at timestamp with time zone, - updated_at timestamp with time zone, - deleted_at timestamp with time zone, - execution_project text NOT NULL, - execution_domain text NOT NULL, - execution_name text NOT NULL, - node_id text NOT NULL, - phase text, - input_uri text, - closure bytea, - started_at timestamp with time zone, - node_execution_created_at timestamp with time zone, - node_execution_updated_at timestamp with time zone, - duration bigint, - parent_task_execution_id bigint, - dynamic_workflow_remote_closure_reference text, - internal_data bytea -); - - -ALTER TABLE public.node_executions OWNER TO postgres; - --- --- TOC entry 227 (class 1259 OID 16763) --- Name: node_executions_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres --- - -CREATE SEQUENCE public.node_executions_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - -ALTER TABLE public.node_executions_id_seq OWNER TO postgres; - --- --- TOC entry 3487 (class 0 OID 0) --- Dependencies: 227 --- Name: node_executions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres --- - -ALTER SEQUENCE public.node_executions_id_seq OWNED BY public.node_executions.id; - - --- --- TOC entry 216 (class 1259 OID 16685) --- Name: projects; Type: TABLE; Schema: public; Owner: postgres --- - -CREATE TABLE public.projects ( - id bigint NOT NULL, - created_at timestamp with time zone, - updated_at timestamp with time zone, - deleted_at timestamp with time zone, - identifier text NOT NULL, - name text, - description character varying(300), - labels bytea, - state integer DEFAULT 0 -); - - -ALTER TABLE public.projects OWNER TO postgres; - --- --- TOC entry 215 (class 1259 OID 16684) --- Name: projects_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres --- - -CREATE SEQUENCE public.projects_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - -ALTER TABLE public.projects_id_seq OWNER TO postgres; - --- --- TOC entry 3488 (class 0 OID 0) --- Dependencies: 215 --- Name: projects_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres --- - -ALTER SEQUENCE public.projects_id_seq OWNED BY public.projects.id; - - --- --- TOC entry 238 (class 1259 OID 16824) --- Name: resources; Type: TABLE; Schema: public; Owner: postgres --- - -CREATE TABLE public.resources ( - id bigint NOT NULL, - created_at timestamp with time zone, - updated_at timestamp with time zone, - deleted_at timestamp with time zone, - project text, - domain text, - workflow text, - launch_plan text, - resource_type text, - priority integer, - attributes bytea -); - - -ALTER TABLE public.resources OWNER TO postgres; - --- --- TOC entry 237 (class 1259 OID 16823) --- Name: resources_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres --- - -CREATE SEQUENCE public.resources_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - -ALTER TABLE public.resources_id_seq OWNER TO postgres; - --- --- TOC entry 3489 (class 0 OID 0) --- Dependencies: 237 --- Name: resources_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres --- - -ALTER SEQUENCE public.resources_id_seq OWNED BY public.resources.id; - - --- --- TOC entry 236 (class 1259 OID 16812) --- Name: signals; Type: TABLE; Schema: public; Owner: postgres --- - -CREATE TABLE public.signals ( - id bigint NOT NULL, - created_at timestamp with time zone, - updated_at timestamp with time zone, - deleted_at timestamp with time zone, - execution_project text NOT NULL, - execution_domain text NOT NULL, - execution_name text NOT NULL, - signal_id text NOT NULL, - type bytea NOT NULL, - value bytea -); - - -ALTER TABLE public.signals OWNER TO postgres; - --- --- TOC entry 235 (class 1259 OID 16811) --- Name: signals_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres --- - -CREATE SEQUENCE public.signals_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - -ALTER TABLE public.signals_id_seq OWNER TO postgres; - --- --- TOC entry 3490 (class 0 OID 0) --- Dependencies: 235 --- Name: signals_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres --- - -ALTER SEQUENCE public.signals_id_seq OWNED BY public.signals.id; - - --- --- TOC entry 226 (class 1259 OID 16751) --- Name: task_executions; Type: TABLE; Schema: public; Owner: postgres --- - -CREATE TABLE public.task_executions ( - id bigint NOT NULL, - created_at timestamp with time zone, - updated_at timestamp with time zone, - deleted_at timestamp with time zone, - project text NOT NULL, - domain text NOT NULL, - name text NOT NULL, - version text NOT NULL, - execution_project text NOT NULL, - execution_domain text NOT NULL, - execution_name text NOT NULL, - node_id text NOT NULL, - retry_attempt bigint NOT NULL, - phase text, - phase_version bigint, - input_uri text, - closure bytea, - started_at timestamp with time zone, - task_execution_created_at timestamp with time zone, - task_execution_updated_at timestamp with time zone, - duration bigint -); - - -ALTER TABLE public.task_executions OWNER TO postgres; - --- --- TOC entry 225 (class 1259 OID 16750) --- Name: task_executions_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres --- - -CREATE SEQUENCE public.task_executions_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - -ALTER TABLE public.task_executions_id_seq OWNER TO postgres; - --- --- TOC entry 3491 (class 0 OID 0) --- Dependencies: 225 --- Name: task_executions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres --- - -ALTER SEQUENCE public.task_executions_id_seq OWNED BY public.task_executions.id; - - --- --- TOC entry 218 (class 1259 OID 16698) --- Name: tasks; Type: TABLE; Schema: public; Owner: postgres --- - -CREATE TABLE public.tasks ( - id bigint NOT NULL, - created_at timestamp with time zone, - updated_at timestamp with time zone, - deleted_at timestamp with time zone, - project text NOT NULL, - domain text NOT NULL, - name text NOT NULL, - version text NOT NULL, - closure bytea NOT NULL, - digest bytea, - type text, - short_description text -); - - -ALTER TABLE public.tasks OWNER TO postgres; - --- --- TOC entry 217 (class 1259 OID 16697) --- Name: tasks_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres --- - -CREATE SEQUENCE public.tasks_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - -ALTER TABLE public.tasks_id_seq OWNER TO postgres; - --- --- TOC entry 3492 (class 0 OID 0) --- Dependencies: 217 --- Name: tasks_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres --- - -ALTER SEQUENCE public.tasks_id_seq OWNED BY public.tasks.id; - - --- --- TOC entry 220 (class 1259 OID 16711) --- Name: workflows; Type: TABLE; Schema: public; Owner: postgres --- - -CREATE TABLE public.workflows ( - id bigint NOT NULL, - created_at timestamp with time zone, - updated_at timestamp with time zone, - deleted_at timestamp with time zone, - project text NOT NULL, - domain text NOT NULL, - name text NOT NULL, - version text NOT NULL, - typed_interface bytea, - remote_closure_identifier text NOT NULL, - digest bytea, - short_description text -); - - -ALTER TABLE public.workflows OWNER TO postgres; - --- --- TOC entry 219 (class 1259 OID 16710) --- Name: workflows_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres --- - -CREATE SEQUENCE public.workflows_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - -ALTER TABLE public.workflows_id_seq OWNER TO postgres; - --- --- TOC entry 3493 (class 0 OID 0) --- Dependencies: 219 --- Name: workflows_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres --- - -ALTER SEQUENCE public.workflows_id_seq OWNED BY public.workflows.id; - - --- --- TOC entry 3254 (class 2604 OID 16803) --- Name: description_entities id; Type: DEFAULT; Schema: public; Owner: postgres --- - -ALTER TABLE ONLY public.description_entities ALTER COLUMN id SET DEFAULT nextval('public.description_entities_id_seq'::regclass); - - --- --- TOC entry 3252 (class 2604 OID 16780) --- Name: execution_events id; Type: DEFAULT; Schema: public; Owner: postgres --- - -ALTER TABLE ONLY public.execution_events ALTER COLUMN id SET DEFAULT nextval('public.execution_events_id_seq'::regclass); - - --- --- TOC entry 3257 (class 2604 OID 16839) --- Name: executions id; Type: DEFAULT; Schema: public; Owner: postgres --- - -ALTER TABLE ONLY public.executions ALTER COLUMN id SET DEFAULT nextval('public.executions_id_seq'::regclass); - - --- --- TOC entry 3246 (class 2604 OID 16727) --- Name: launch_plans id; Type: DEFAULT; Schema: public; Owner: postgres --- - -ALTER TABLE ONLY public.launch_plans ALTER COLUMN id SET DEFAULT nextval('public.launch_plans_id_seq'::regclass); - - --- --- TOC entry 3248 (class 2604 OID 16741) --- Name: named_entity_metadata id; Type: DEFAULT; Schema: public; Owner: postgres --- - -ALTER TABLE ONLY public.named_entity_metadata ALTER COLUMN id SET DEFAULT nextval('public.named_entity_metadata_id_seq'::regclass); - - --- --- TOC entry 3253 (class 2604 OID 16791) --- Name: node_execution_events id; Type: DEFAULT; Schema: public; Owner: postgres --- - -ALTER TABLE ONLY public.node_execution_events ALTER COLUMN id SET DEFAULT nextval('public.node_execution_events_id_seq'::regclass); - - --- --- TOC entry 3251 (class 2604 OID 16767) --- Name: node_executions id; Type: DEFAULT; Schema: public; Owner: postgres --- - -ALTER TABLE ONLY public.node_executions ALTER COLUMN id SET DEFAULT nextval('public.node_executions_id_seq'::regclass); - - --- --- TOC entry 3242 (class 2604 OID 16688) --- Name: projects id; Type: DEFAULT; Schema: public; Owner: postgres --- - -ALTER TABLE ONLY public.projects ALTER COLUMN id SET DEFAULT nextval('public.projects_id_seq'::regclass); - - --- --- TOC entry 3256 (class 2604 OID 16827) --- Name: resources id; Type: DEFAULT; Schema: public; Owner: postgres --- - -ALTER TABLE ONLY public.resources ALTER COLUMN id SET DEFAULT nextval('public.resources_id_seq'::regclass); - - --- --- TOC entry 3255 (class 2604 OID 16815) --- Name: signals id; Type: DEFAULT; Schema: public; Owner: postgres --- - -ALTER TABLE ONLY public.signals ALTER COLUMN id SET DEFAULT nextval('public.signals_id_seq'::regclass); - - --- --- TOC entry 3250 (class 2604 OID 16754) --- Name: task_executions id; Type: DEFAULT; Schema: public; Owner: postgres --- - -ALTER TABLE ONLY public.task_executions ALTER COLUMN id SET DEFAULT nextval('public.task_executions_id_seq'::regclass); - - --- --- TOC entry 3244 (class 2604 OID 16701) --- Name: tasks id; Type: DEFAULT; Schema: public; Owner: postgres --- - -ALTER TABLE ONLY public.tasks ALTER COLUMN id SET DEFAULT nextval('public.tasks_id_seq'::regclass); - - --- --- TOC entry 3245 (class 2604 OID 16714) --- Name: workflows id; Type: DEFAULT; Schema: public; Owner: postgres --- - -ALTER TABLE ONLY public.workflows ALTER COLUMN id SET DEFAULT nextval('public.workflows_id_seq'::regclass); - - --- --- TOC entry 3311 (class 2606 OID 16807) --- Name: description_entities description_entities_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres --- - -ALTER TABLE ONLY public.description_entities - ADD CONSTRAINT description_entities_pkey PRIMARY KEY (resource_type, project, domain, name, version); - - --- --- TOC entry 3302 (class 2606 OID 16784) --- Name: execution_events execution_events_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres --- - -ALTER TABLE ONLY public.execution_events - ADD CONSTRAINT execution_events_pkey PRIMARY KEY (execution_project, execution_domain, execution_name, phase); - - --- --- TOC entry 3324 (class 2606 OID 16844) --- Name: executions executions_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres --- - -ALTER TABLE ONLY public.executions - ADD CONSTRAINT executions_pkey PRIMARY KEY (execution_project, execution_domain, execution_name); - - --- --- TOC entry 3282 (class 2606 OID 16732) --- Name: launch_plans launch_plans_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres --- - -ALTER TABLE ONLY public.launch_plans - ADD CONSTRAINT launch_plans_pkey PRIMARY KEY (project, domain, name, version); - - --- --- TOC entry 3260 (class 2606 OID 16683) --- Name: migrations migrations_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres --- - -ALTER TABLE ONLY public.migrations - ADD CONSTRAINT migrations_pkey PRIMARY KEY (id); - - --- --- TOC entry 3287 (class 2606 OID 16746) --- Name: named_entity_metadata named_entity_metadata_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres --- - -ALTER TABLE ONLY public.named_entity_metadata - ADD CONSTRAINT named_entity_metadata_pkey PRIMARY KEY (resource_type, project, domain, name); - - --- --- TOC entry 3309 (class 2606 OID 16795) --- Name: node_execution_events node_execution_events_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres --- - -ALTER TABLE ONLY public.node_execution_events - ADD CONSTRAINT node_execution_events_pkey PRIMARY KEY (execution_project, execution_domain, execution_name, node_id, phase); - - --- --- TOC entry 3300 (class 2606 OID 16771) --- Name: node_executions node_executions_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres --- - -ALTER TABLE ONLY public.node_executions - ADD CONSTRAINT node_executions_pkey PRIMARY KEY (execution_project, execution_domain, execution_name, node_id); - - --- --- TOC entry 3265 (class 2606 OID 16693) --- Name: projects projects_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres --- - -ALTER TABLE ONLY public.projects - ADD CONSTRAINT projects_pkey PRIMARY KEY (identifier); - - --- --- TOC entry 3322 (class 2606 OID 16831) --- Name: resources resources_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres --- - -ALTER TABLE ONLY public.resources - ADD CONSTRAINT resources_pkey PRIMARY KEY (id); - - --- --- TOC entry 3319 (class 2606 OID 16819) --- Name: signals signals_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres --- - -ALTER TABLE ONLY public.signals - ADD CONSTRAINT signals_pkey PRIMARY KEY (execution_project, execution_domain, execution_name, signal_id); - - --- --- TOC entry 3294 (class 2606 OID 16758) --- Name: task_executions task_executions_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres --- - -ALTER TABLE ONLY public.task_executions - ADD CONSTRAINT task_executions_pkey PRIMARY KEY (project, domain, name, version, execution_project, execution_domain, execution_name, node_id, retry_attempt); - - --- --- TOC entry 3271 (class 2606 OID 16705) --- Name: tasks tasks_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres --- - -ALTER TABLE ONLY public.tasks - ADD CONSTRAINT tasks_pkey PRIMARY KEY (project, domain, name, version); - - --- --- TOC entry 3277 (class 2606 OID 16718) --- Name: workflows workflows_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres --- - -ALTER TABLE ONLY public.workflows - ADD CONSTRAINT workflows_pkey PRIMARY KEY (project, domain, name, version); - - --- --- TOC entry 3312 (class 1259 OID 16808) --- Name: description_entity_project_domain_name_version_idx; Type: INDEX; Schema: public; Owner: postgres --- - -CREATE INDEX description_entity_project_domain_name_version_idx ON public.description_entities USING btree (resource_type, project, domain, name, version); - - --- --- TOC entry 3313 (class 1259 OID 16809) --- Name: idx_description_entities_deleted_at; Type: INDEX; Schema: public; Owner: postgres --- - -CREATE INDEX idx_description_entities_deleted_at ON public.description_entities USING btree (deleted_at); - - --- --- TOC entry 3314 (class 1259 OID 16810) --- Name: idx_description_entities_id; Type: INDEX; Schema: public; Owner: postgres --- - -CREATE INDEX idx_description_entities_id ON public.description_entities USING btree (id); - - --- --- TOC entry 3303 (class 1259 OID 16785) --- Name: idx_execution_events_deleted_at; Type: INDEX; Schema: public; Owner: postgres --- - -CREATE INDEX idx_execution_events_deleted_at ON public.execution_events USING btree (deleted_at); - - --- --- TOC entry 3304 (class 1259 OID 16786) --- Name: idx_execution_events_id; Type: INDEX; Schema: public; Owner: postgres --- - -CREATE INDEX idx_execution_events_id ON public.execution_events USING btree (id); - - --- --- TOC entry 3325 (class 1259 OID 16845) --- Name: idx_executions_created_at; Type: INDEX; Schema: public; Owner: postgres --- - -CREATE INDEX idx_executions_created_at ON public.executions USING btree (execution_created_at); - - --- --- TOC entry 3326 (class 1259 OID 16853) --- Name: idx_executions_deleted_at; Type: INDEX; Schema: public; Owner: postgres --- - -CREATE INDEX idx_executions_deleted_at ON public.executions USING btree (deleted_at); - - --- --- TOC entry 3327 (class 1259 OID 16850) --- Name: idx_executions_error_kind; Type: INDEX; Schema: public; Owner: postgres --- - -CREATE INDEX idx_executions_error_kind ON public.executions USING btree (error_kind); - - --- --- TOC entry 3328 (class 1259 OID 16847) --- Name: idx_executions_id; Type: INDEX; Schema: public; Owner: postgres --- - -CREATE INDEX idx_executions_id ON public.executions USING btree (id); - - --- --- TOC entry 3329 (class 1259 OID 16846) --- Name: idx_executions_launch_plan_id; Type: INDEX; Schema: public; Owner: postgres --- - -CREATE INDEX idx_executions_launch_plan_id ON public.executions USING btree (launch_plan_id); - - --- --- TOC entry 3330 (class 1259 OID 16848) --- Name: idx_executions_state; Type: INDEX; Schema: public; Owner: postgres --- - -CREATE INDEX idx_executions_state ON public.executions USING btree (state); - - --- --- TOC entry 3331 (class 1259 OID 16851) --- Name: idx_executions_task_id; Type: INDEX; Schema: public; Owner: postgres --- - -CREATE INDEX idx_executions_task_id ON public.executions USING btree (task_id); - - --- --- TOC entry 3332 (class 1259 OID 16849) --- Name: idx_executions_user; Type: INDEX; Schema: public; Owner: postgres --- - -CREATE INDEX idx_executions_user ON public.executions USING btree ("user"); - - --- --- TOC entry 3333 (class 1259 OID 16852) --- Name: idx_executions_workflow_id; Type: INDEX; Schema: public; Owner: postgres --- - -CREATE INDEX idx_executions_workflow_id ON public.executions USING btree (workflow_id); - - --- --- TOC entry 3278 (class 1259 OID 16735) --- Name: idx_launch_plans_deleted_at; Type: INDEX; Schema: public; Owner: postgres --- - -CREATE INDEX idx_launch_plans_deleted_at ON public.launch_plans USING btree (deleted_at); - - --- --- TOC entry 3279 (class 1259 OID 16736) --- Name: idx_launch_plans_id; Type: INDEX; Schema: public; Owner: postgres --- - -CREATE INDEX idx_launch_plans_id ON public.launch_plans USING btree (id); - - --- --- TOC entry 3280 (class 1259 OID 16733) --- Name: idx_launch_plans_workflow_id; Type: INDEX; Schema: public; Owner: postgres --- - -CREATE INDEX idx_launch_plans_workflow_id ON public.launch_plans USING btree (workflow_id); - - --- --- TOC entry 3284 (class 1259 OID 16748) --- Name: idx_named_entity_metadata_deleted_at; Type: INDEX; Schema: public; Owner: postgres --- - -CREATE INDEX idx_named_entity_metadata_deleted_at ON public.named_entity_metadata USING btree (deleted_at); - - --- --- TOC entry 3285 (class 1259 OID 16749) --- Name: idx_named_entity_metadata_id; Type: INDEX; Schema: public; Owner: postgres --- - -CREATE INDEX idx_named_entity_metadata_id ON public.named_entity_metadata USING btree (id); - - --- --- TOC entry 3305 (class 1259 OID 16797) --- Name: idx_node_execution_events_deleted_at; Type: INDEX; Schema: public; Owner: postgres --- - -CREATE INDEX idx_node_execution_events_deleted_at ON public.node_execution_events USING btree (deleted_at); - - --- --- TOC entry 3306 (class 1259 OID 16798) --- Name: idx_node_execution_events_id; Type: INDEX; Schema: public; Owner: postgres --- - -CREATE INDEX idx_node_execution_events_id ON public.node_execution_events USING btree (id); - - --- --- TOC entry 3307 (class 1259 OID 16796) --- Name: idx_node_execution_events_node_id; Type: INDEX; Schema: public; Owner: postgres --- - -CREATE INDEX idx_node_execution_events_node_id ON public.node_execution_events USING btree (node_id); - - --- --- TOC entry 3295 (class 1259 OID 16772) --- Name: idx_node_executions_deleted_at; Type: INDEX; Schema: public; Owner: postgres --- - -CREATE INDEX idx_node_executions_deleted_at ON public.node_executions USING btree (deleted_at); - - --- --- TOC entry 3296 (class 1259 OID 16773) --- Name: idx_node_executions_id; Type: INDEX; Schema: public; Owner: postgres --- - -CREATE INDEX idx_node_executions_id ON public.node_executions USING btree (id); - - --- --- TOC entry 3297 (class 1259 OID 16775) --- Name: idx_node_executions_node_id; Type: INDEX; Schema: public; Owner: postgres --- - -CREATE INDEX idx_node_executions_node_id ON public.node_executions USING btree (node_id); - - --- --- TOC entry 3298 (class 1259 OID 16774) --- Name: idx_node_executions_parent_task_execution_id; Type: INDEX; Schema: public; Owner: postgres --- - -CREATE INDEX idx_node_executions_parent_task_execution_id ON public.node_executions USING btree (parent_task_execution_id); - - --- --- TOC entry 3261 (class 1259 OID 16695) --- Name: idx_projects_deleted_at; Type: INDEX; Schema: public; Owner: postgres --- - -CREATE INDEX idx_projects_deleted_at ON public.projects USING btree (deleted_at); - - --- --- TOC entry 3262 (class 1259 OID 16696) --- Name: idx_projects_id; Type: INDEX; Schema: public; Owner: postgres --- - -CREATE INDEX idx_projects_id ON public.projects USING btree (id); - - --- --- TOC entry 3263 (class 1259 OID 16694) --- Name: idx_projects_state; Type: INDEX; Schema: public; Owner: postgres --- - -CREATE INDEX idx_projects_state ON public.projects USING btree (state); - - --- --- TOC entry 3315 (class 1259 OID 16821) --- Name: idx_signals_deleted_at; Type: INDEX; Schema: public; Owner: postgres --- - -CREATE INDEX idx_signals_deleted_at ON public.signals USING btree (deleted_at); - - --- --- TOC entry 3316 (class 1259 OID 16822) --- Name: idx_signals_id; Type: INDEX; Schema: public; Owner: postgres --- - -CREATE INDEX idx_signals_id ON public.signals USING btree (id); - - --- --- TOC entry 3317 (class 1259 OID 16820) --- Name: idx_signals_signal_id; Type: INDEX; Schema: public; Owner: postgres --- - -CREATE INDEX idx_signals_signal_id ON public.signals USING btree (signal_id); - - --- --- TOC entry 3289 (class 1259 OID 16761) --- Name: idx_task_executions_deleted_at; Type: INDEX; Schema: public; Owner: postgres --- - -CREATE INDEX idx_task_executions_deleted_at ON public.task_executions USING btree (deleted_at); - - --- --- TOC entry 3290 (class 1259 OID 16760) --- Name: idx_task_executions_exec; Type: INDEX; Schema: public; Owner: postgres --- - -CREATE INDEX idx_task_executions_exec ON public.task_executions USING btree (execution_project, execution_domain, execution_name, node_id); - - --- --- TOC entry 3291 (class 1259 OID 16762) --- Name: idx_task_executions_id; Type: INDEX; Schema: public; Owner: postgres --- - -CREATE INDEX idx_task_executions_id ON public.task_executions USING btree (id); - - --- --- TOC entry 3292 (class 1259 OID 16759) --- Name: idx_task_executions_node_id; Type: INDEX; Schema: public; Owner: postgres --- - -CREATE INDEX idx_task_executions_node_id ON public.task_executions USING btree (node_id); - - --- --- TOC entry 3266 (class 1259 OID 16708) --- Name: idx_tasks_deleted_at; Type: INDEX; Schema: public; Owner: postgres --- - -CREATE INDEX idx_tasks_deleted_at ON public.tasks USING btree (deleted_at); - - --- --- TOC entry 3267 (class 1259 OID 16709) --- Name: idx_tasks_id; Type: INDEX; Schema: public; Owner: postgres --- - -CREATE INDEX idx_tasks_id ON public.tasks USING btree (id); - - --- --- TOC entry 3272 (class 1259 OID 16721) --- Name: idx_workflows_deleted_at; Type: INDEX; Schema: public; Owner: postgres --- - -CREATE INDEX idx_workflows_deleted_at ON public.workflows USING btree (deleted_at); - - --- --- TOC entry 3273 (class 1259 OID 16722) --- Name: idx_workflows_id; Type: INDEX; Schema: public; Owner: postgres --- - -CREATE INDEX idx_workflows_id ON public.workflows USING btree (id); - - --- --- TOC entry 3283 (class 1259 OID 16734) --- Name: lp_project_domain_name_idx; Type: INDEX; Schema: public; Owner: postgres --- - -CREATE INDEX lp_project_domain_name_idx ON public.launch_plans USING btree (project, domain, name); - - --- --- TOC entry 3288 (class 1259 OID 16747) --- Name: named_entity_metadata_type_project_domain_name_idx; Type: INDEX; Schema: public; Owner: postgres --- - -CREATE INDEX named_entity_metadata_type_project_domain_name_idx ON public.named_entity_metadata USING btree (resource_type, project, domain, name); - - --- --- TOC entry 3320 (class 1259 OID 16832) --- Name: resource_idx; Type: INDEX; Schema: public; Owner: postgres --- - -CREATE UNIQUE INDEX resource_idx ON public.resources USING btree (project, domain, workflow, launch_plan, resource_type); - - --- --- TOC entry 3268 (class 1259 OID 16706) --- Name: task_project_domain_idx; Type: INDEX; Schema: public; Owner: postgres --- - -CREATE INDEX task_project_domain_idx ON public.tasks USING btree (project, domain); - - --- --- TOC entry 3269 (class 1259 OID 16707) --- Name: task_project_domain_name_idx; Type: INDEX; Schema: public; Owner: postgres --- - -CREATE INDEX task_project_domain_name_idx ON public.tasks USING btree (project, domain, name); - - --- --- TOC entry 3274 (class 1259 OID 16719) --- Name: workflow_project_domain_idx; Type: INDEX; Schema: public; Owner: postgres --- - -CREATE INDEX workflow_project_domain_idx ON public.workflows USING btree (project, domain); - - --- --- TOC entry 3275 (class 1259 OID 16720) --- Name: workflow_project_domain_name_idx; Type: INDEX; Schema: public; Owner: postgres --- - -CREATE INDEX workflow_project_domain_name_idx ON public.workflows USING btree (project, domain, name); - - --- Completed on 2023-03-20 14:34:39 PDT - --- --- PostgreSQL database dump complete --- - From 873b37729e57878a5856fa11a5b874d4a742c5ec Mon Sep 17 00:00:00 2001 From: Yee Hing Tong Date: Tue, 21 Mar 2023 17:14:00 -0700 Subject: [PATCH 5/8] cleanup Signed-off-by: Yee Hing Tong --- go.mod | 2 - go.sum | 2 + pkg/repositories/config/migrations_test.go | 126 +-------------------- 3 files changed, 3 insertions(+), 127 deletions(-) diff --git a/go.mod b/go.mod index 836f4c861..65d6a38ed 100644 --- a/go.mod +++ b/go.mod @@ -210,5 +210,3 @@ require ( ) replace github.com/robfig/cron/v3 => github.com/unionai/cron/v3 v3.0.2-0.20210825070134-bfc34418fe84 - -replace github.com/flyteorg/flytestdlib => ../flytestdlib diff --git a/go.sum b/go.sum index 285d80191..9ba6f0ef5 100644 --- a/go.sum +++ b/go.sum @@ -314,6 +314,8 @@ github.com/flyteorg/flyteplugins v1.0.40 h1:RTsYingqmqr13qBbi4CB2ArXDHNHUOkAF+HT github.com/flyteorg/flyteplugins v1.0.40/go.mod h1:qyUPqVspLcLGJpKxVwHDWf+kBpOGuItOxCaF6zAmDio= github.com/flyteorg/flytepropeller v1.1.70 h1:/d1qqz13rdVADM85ST70eerAdBstJJz9UUB/mNSZi0w= github.com/flyteorg/flytepropeller v1.1.70/go.mod h1:MezHUJmgPzm4Pu8nIy6LLiEkxNA6buTQ7hInSqCViTY= +github.com/flyteorg/flytestdlib v1.0.15 h1:kv9jDQmytbE84caY+pkZN8trJU2ouSAmESzpTEhfTt0= +github.com/flyteorg/flytestdlib v1.0.15/go.mod h1:ghw/cjY0sEWIIbyCtcJnL/Gt7ZS7gf9SUi0CCPhbz3s= github.com/flyteorg/stow v0.3.6 h1:jt50ciM14qhKBaIrB+ppXXY+SXB59FNREFgTJqCyqIk= github.com/flyteorg/stow v0.3.6/go.mod h1:5dfBitPM004dwaZdoVylVjxFT4GWAgI0ghAndhNUzCo= github.com/fogleman/gg v1.2.1-0.20190220221249-0403632d5b90/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k= diff --git a/pkg/repositories/config/migrations_test.go b/pkg/repositories/config/migrations_test.go index 18a95256b..fe129018f 100644 --- a/pkg/repositories/config/migrations_test.go +++ b/pkg/repositories/config/migrations_test.go @@ -1,18 +1,9 @@ package config import ( - "context" - "fmt" - "github.com/flyteorg/flytestdlib/database" - "github.com/go-gormigrate/gormigrate/v2" - gormLogger "gorm.io/gorm/logger" - "log" - "os" - "testing" - "time" - mocket "github.com/Selvatico/go-mocket" "github.com/stretchr/testify/assert" + "testing" "gorm.io/driver/postgres" "gorm.io/gorm" @@ -40,118 +31,3 @@ func GetDbForTest(t *testing.T) *gorm.DB { } return db } - -func TestNoopMigrations(t *testing.T) { - gLogger := gormLogger.New(log.New(os.Stdout, "\r\n", log.LstdFlags), gormLogger.Config{ - SlowThreshold: 200 * time.Millisecond, - LogLevel: gormLogger.Info, - IgnoreRecordNotFoundError: false, - Colorful: true, - }) - - gormConfig := &gorm.Config{ - Logger: gLogger, - DisableForeignKeyConstraintWhenMigrating: false, - } - - var gormDb *gorm.DB - pgConfig := database.PostgresConfig{ - Host: "localhost", - Port: 30001, - DbName: "migratecopy1", - User: "postgres", - Password: "postgres", - ExtraOptions: "", - Debug: false, - } - ctx := context.Background() - postgresDsn := database.PostgresDsn(ctx, pgConfig) - dialector := postgres.Open(postgresDsn) - gormDb, err := gorm.Open(dialector, gormConfig) - assert.NoError(t, err) - - fmt.Println(gormDb) - - m := gormigrate.New(gormDb, gormigrate.DefaultOptions, Migrations) - if err := m.Migrate(); err != nil { - fmt.Errorf("database migration failed: %v", err) - } - fmt.Println(ctx, "Migration ran successfully") -} - -// Before running, create database replicator; -func TestMigrationReplicate(t *testing.T) { - gLogger := gormLogger.New(log.New(os.Stdout, "\r\n", log.LstdFlags), gormLogger.Config{ - SlowThreshold: 200 * time.Millisecond, - LogLevel: gormLogger.Info, - IgnoreRecordNotFoundError: false, - Colorful: true, - }) - - gormConfig := &gorm.Config{ - Logger: gLogger, - DisableForeignKeyConstraintWhenMigrating: true, - } - - var gormDb *gorm.DB - pgConfig := database.PostgresConfig{ - Host: "localhost", - Port: 30001, - DbName: "replicator2", // this should be a completely blank database - User: "postgres", - Password: "postgres", - ExtraOptions: "", - Debug: false, - } - ctx := context.Background() - postgresDsn := database.PostgresDsn(ctx, pgConfig) - dialector := postgres.Open(postgresDsn) - gormDb, err := gorm.Open(dialector, gormConfig) - assert.NoError(t, err) - - fmt.Println(gormDb) - - m := gormigrate.New(gormDb, gormigrate.DefaultOptions, NoopMigrations) - if err := m.Migrate(); err != nil { - fmt.Errorf("database migration failed: %v", err) - } - fmt.Println(ctx, "Migration ran successfully") -} - -func TestLegacyOnlyMigrations(t *testing.T) { - gLogger := gormLogger.New(log.New(os.Stdout, "\r\n", log.LstdFlags), gormLogger.Config{ - SlowThreshold: 200 * time.Millisecond, - LogLevel: gormLogger.Info, - IgnoreRecordNotFoundError: false, - Colorful: true, - }) - - gormConfig := &gorm.Config{ - Logger: gLogger, - DisableForeignKeyConstraintWhenMigrating: true, - } - - var gormDb *gorm.DB - pgConfig := database.PostgresConfig{ - Host: "localhost", - Port: 30001, - DbName: "currentempty", - User: "postgres", - Password: "postgres", - ExtraOptions: "", - Debug: false, - } - ctx := context.Background() - postgresDsn := database.PostgresDsn(ctx, pgConfig) - dialector := postgres.Open(postgresDsn) - gormDb, err := gorm.Open(dialector, gormConfig) - assert.NoError(t, err) - - fmt.Println(gormDb) - - m := gormigrate.New(gormDb, gormigrate.DefaultOptions, LegacyMigrations) - if err := m.Migrate(); err != nil { - fmt.Errorf("database migration failed: %v", err) - } - fmt.Println(ctx, "Migration ran successfully") -} From f9fb8ebaec2b1fa03a480688e5022b18050ebc09 Mon Sep 17 00:00:00 2001 From: Yee Hing Tong Date: Tue, 21 Mar 2023 17:15:20 -0700 Subject: [PATCH 6/8] nit Signed-off-by: Yee Hing Tong --- pkg/repositories/config/migrations.go | 3 ++- pkg/repositories/config/migrations_test.go | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/pkg/repositories/config/migrations.go b/pkg/repositories/config/migrations.go index 4a35c0c1d..a79a58b25 100644 --- a/pkg/repositories/config/migrations.go +++ b/pkg/repositories/config/migrations.go @@ -3,10 +3,11 @@ package config import ( "database/sql" "fmt" + "time" + "github.com/flyteorg/flyteidl/gen/pb-go/flyteidl/admin" "github.com/flyteorg/flyteidl/gen/pb-go/flyteidl/core" "github.com/flyteorg/flytestdlib/storage" - "time" "github.com/flyteorg/flyteadmin/pkg/repositories/models" schedulerModels "github.com/flyteorg/flyteadmin/scheduler/repositories/models" diff --git a/pkg/repositories/config/migrations_test.go b/pkg/repositories/config/migrations_test.go index fe129018f..29f798051 100644 --- a/pkg/repositories/config/migrations_test.go +++ b/pkg/repositories/config/migrations_test.go @@ -1,9 +1,10 @@ package config import ( + "testing" + mocket "github.com/Selvatico/go-mocket" "github.com/stretchr/testify/assert" - "testing" "gorm.io/driver/postgres" "gorm.io/gorm" From 36d200a3bf24175a737d5dd5c7367b28c8f798ff Mon Sep 17 00:00:00 2001 From: Yee Hing Tong Date: Wed, 22 Mar 2023 11:52:52 -0700 Subject: [PATCH 7/8] fix test Signed-off-by: Yee Hing Tong --- pkg/repositories/gormimpl/execution_repo_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/repositories/gormimpl/execution_repo_test.go b/pkg/repositories/gormimpl/execution_repo_test.go index 91e5df15e..52a0756b8 100644 --- a/pkg/repositories/gormimpl/execution_repo_test.go +++ b/pkg/repositories/gormimpl/execution_repo_test.go @@ -215,7 +215,7 @@ func TestListExecutions_Filters(t *testing.T) { GlobalMock := mocket.Catcher.Reset() // Only match on queries that append the name filter - GlobalMock.NewMock().WithQuery(`SELECT * FROM "executions" WHERE executions.execution_project = $1 AND executions.execution_domain = $2 AND executions.execution_name = $3 AND (executions.workflow_id = $4) LIMIT 20`).WithReply(executions[0:1]) + GlobalMock.NewMock().WithQuery(`SELECT * FROM "executions" WHERE executions.execution_project = $1 AND executions.execution_domain = $2 AND executions.execution_name = $3 AND executions.workflow_id = $4 LIMIT 20`).WithReply(executions[0:1]) collection, err := executionRepo.List(context.Background(), interfaces.ListResourceInput{ InlineFilters: []common.InlineFilter{ From cc14ca6d79ade77ea91e6d8128e801b18ba8f7f5 Mon Sep 17 00:00:00 2001 From: Yee Hing Tong Date: Wed, 22 Mar 2023 14:06:15 -0700 Subject: [PATCH 8/8] fix tests Signed-off-by: Yee Hing Tong --- pkg/repositories/gormimpl/execution_repo_test.go | 2 +- pkg/repositories/gormimpl/launch_plan_repo_test.go | 4 ++-- pkg/repositories/gormimpl/named_entity_repo_test.go | 2 +- pkg/repositories/gormimpl/project_repo_test.go | 2 +- pkg/repositories/gormimpl/signal_repo_test.go | 12 ++++++++++-- 5 files changed, 15 insertions(+), 7 deletions(-) diff --git a/pkg/repositories/gormimpl/execution_repo_test.go b/pkg/repositories/gormimpl/execution_repo_test.go index 52a0756b8..daf73f6e5 100644 --- a/pkg/repositories/gormimpl/execution_repo_test.go +++ b/pkg/repositories/gormimpl/execution_repo_test.go @@ -313,7 +313,7 @@ func TestListExecutionsForWorkflow(t *testing.T) { GlobalMock.Logging = true // Only match on queries that append expected filters - GlobalMock.NewMock().WithQuery(`SELECT "executions"."id","executions"."created_at","executions"."updated_at","executions"."deleted_at","executions"."execution_project","executions"."execution_domain","executions"."execution_name","executions"."launch_plan_id","executions"."workflow_id","executions"."task_id","executions"."phase","executions"."closure","executions"."spec","executions"."started_at","executions"."execution_created_at","executions"."execution_updated_at","executions"."duration","executions"."abort_cause","executions"."mode","executions"."source_execution_id","executions"."parent_node_execution_id","executions"."cluster","executions"."inputs_uri","executions"."user_inputs_uri","executions"."error_kind","executions"."error_code","executions"."user","executions"."state","executions"."launch_entity" FROM "executions" INNER JOIN workflows ON executions.workflow_id = workflows.id INNER JOIN tasks ON executions.task_id = tasks.id WHERE executions.execution_project = $1 AND executions.execution_domain = $2 AND executions.execution_name = $3 AND (workflows.name = $4) AND tasks.name = $5 LIMIT 20`).WithReply(executions) + GlobalMock.NewMock().WithQuery(`SELECT "executions"."id","executions"."created_at","executions"."updated_at","executions"."deleted_at","executions"."execution_project","executions"."execution_domain","executions"."execution_name","executions"."launch_plan_id","executions"."workflow_id","executions"."task_id","executions"."phase","executions"."closure","executions"."spec","executions"."started_at","executions"."execution_created_at","executions"."execution_updated_at","executions"."duration","executions"."abort_cause","executions"."mode","executions"."source_execution_id","executions"."parent_node_execution_id","executions"."cluster","executions"."inputs_uri","executions"."user_inputs_uri","executions"."error_kind","executions"."error_code","executions"."user","executions"."state","executions"."launch_entity" FROM "executions" INNER JOIN workflows ON executions.workflow_id = workflows.id INNER JOIN tasks ON executions.task_id = tasks.id WHERE executions.execution_project = $1 AND executions.execution_domain = $2 AND executions.execution_name = $3 AND workflows.name = $4 AND tasks.name = $5 LIMIT 20`).WithReply(executions) collection, err := executionRepo.List(context.Background(), interfaces.ListResourceInput{ InlineFilters: []common.InlineFilter{ diff --git a/pkg/repositories/gormimpl/launch_plan_repo_test.go b/pkg/repositories/gormimpl/launch_plan_repo_test.go index 0dd0b6126..f96bd7964 100644 --- a/pkg/repositories/gormimpl/launch_plan_repo_test.go +++ b/pkg/repositories/gormimpl/launch_plan_repo_test.go @@ -403,8 +403,8 @@ func TestListLaunchPlansForWorkflow(t *testing.T) { // HACK: gorm orders the filters on join clauses non-deterministically. Ordering of filters doesn't affect // correctness, but because the mocket library only pattern matches on substrings, both variations of the (valid) // SQL that gorm produces are checked below. - query := `SELECT "launch_plans"."id","launch_plans"."created_at","launch_plans"."updated_at","launch_plans"."deleted_at","launch_plans"."project","launch_plans"."domain","launch_plans"."name","launch_plans"."version","launch_plans"."spec","launch_plans"."workflow_id","launch_plans"."closure","launch_plans"."state","launch_plans"."digest","launch_plans"."schedule_type" FROM "launch_plans" inner join workflows on launch_plans.workflow_id = workflows.id WHERE launch_plans.project = $1 AND launch_plans.domain = $2 AND launch_plans.name = $3 AND (workflows.deleted_at = $4) LIMIT 20` - alternateQuery := `SELECT "launch_plans"."id","launch_plans"."created_at","launch_plans"."updated_at","launch_plans"."deleted_at","launch_plans"."project","launch_plans"."domain","launch_plans"."name","launch_plans"."version","launch_plans"."spec","launch_plans"."workflow_id","launch_plans"."closure","launch_plans"."state","launch_plans"."digest","launch_plans"."schedule_type" FROM "launch_plans" inner join workflows on launch_plans.workflow_id = workflows.id WHERE launch_plans.project = $1 AND launch_plans.domain = $2 AND launch_plans.name = $3 AND (workflows.deleted_at = $4) LIMIT 20` + query := `SELECT "launch_plans"."id","launch_plans"."created_at","launch_plans"."updated_at","launch_plans"."deleted_at","launch_plans"."project","launch_plans"."domain","launch_plans"."name","launch_plans"."version","launch_plans"."spec","launch_plans"."workflow_id","launch_plans"."closure","launch_plans"."state","launch_plans"."digest","launch_plans"."schedule_type" FROM "launch_plans" inner join workflows on launch_plans.workflow_id = workflows.id WHERE launch_plans.project = $1 AND launch_plans.domain = $2 AND launch_plans.name = $3 AND workflows.deleted_at = $4 LIMIT 20` + alternateQuery := `SELECT "launch_plans"."id","launch_plans"."created_at","launch_plans"."updated_at","launch_plans"."deleted_at","launch_plans"."project","launch_plans"."domain","launch_plans"."name","launch_plans"."version","launch_plans"."spec","launch_plans"."workflow_id","launch_plans"."closure","launch_plans"."state","launch_plans"."digest","launch_plans"."schedule_type" FROM "launch_plans" inner join workflows on launch_plans.workflow_id = workflows.id WHERE launch_plans.project = $1 AND launch_plans.domain = $2 AND launch_plans.name = $3 AND workflows.deleted_at = $4 LIMIT 20` GlobalMock.NewMock().WithQuery(query).WithReply(launchPlans) GlobalMock.NewMock().WithQuery(alternateQuery).WithReply(launchPlans) diff --git a/pkg/repositories/gormimpl/named_entity_repo_test.go b/pkg/repositories/gormimpl/named_entity_repo_test.go index d1867eca0..d586a2c8f 100644 --- a/pkg/repositories/gormimpl/named_entity_repo_test.go +++ b/pkg/repositories/gormimpl/named_entity_repo_test.go @@ -47,7 +47,7 @@ func TestGetNamedEntity(t *testing.T) { GlobalMock := mocket.Catcher.Reset() GlobalMock.Logging = true GlobalMock.NewMock().WithQuery( - `SELECT workflows.project,workflows.domain,workflows.name,'2' AS resource_type,named_entity_metadata.description,named_entity_metadata.state FROM "workflows" LEFT JOIN named_entity_metadata ON named_entity_metadata.resource_type = 2 AND named_entity_metadata.project = workflows.project AND named_entity_metadata.domain = workflows.domain AND named_entity_metadata.name = workflows.name WHERE (workflows.project = $1) AND (workflows.domain = $2) AND (workflows.name = $3) LIMIT 1`).WithReply(results) + `SELECT workflows.project,workflows.domain,workflows.name,'2' AS resource_type,named_entity_metadata.description,named_entity_metadata.state FROM "workflows" LEFT JOIN named_entity_metadata ON named_entity_metadata.resource_type = 2 AND named_entity_metadata.project = workflows.project AND named_entity_metadata.domain = workflows.domain AND named_entity_metadata.name = workflows.name WHERE workflows.project = $1 AND workflows.domain = $2 AND workflows.name = $3 LIMIT 1`).WithReply(results) output, err := metadataRepo.Get(context.Background(), interfaces.GetNamedEntityInput{ ResourceType: resourceType, Project: project, diff --git a/pkg/repositories/gormimpl/project_repo_test.go b/pkg/repositories/gormimpl/project_repo_test.go index 5fe7b2f73..145072133 100644 --- a/pkg/repositories/gormimpl/project_repo_test.go +++ b/pkg/repositories/gormimpl/project_repo_test.go @@ -26,7 +26,7 @@ func TestCreateProject(t *testing.T) { query := GlobalMock.NewMock() GlobalMock.Logging = true query.WithQuery( - `INSERT INTO "projects" ("created_at","updated_at","deleted_at","identifier","name","description","labels","state") VALUES ($1,$2,$3,$4,$5,$6,$7,$8)`) + `INSERT INTO "projects" ("created_at","updated_at","deleted_at","name","description","labels","state","identifier") VALUES ($1,$2,$3,$4,$5,$6,$7,$8)`) activeState := int32(admin.Project_ACTIVE) err := projectRepo.Create(context.Background(), models.Project{ diff --git a/pkg/repositories/gormimpl/signal_repo_test.go b/pkg/repositories/gormimpl/signal_repo_test.go index 157af6112..374b60df8 100644 --- a/pkg/repositories/gormimpl/signal_repo_test.go +++ b/pkg/repositories/gormimpl/signal_repo_test.go @@ -4,6 +4,7 @@ import ( "context" "reflect" "testing" + "time" "github.com/flyteorg/flyteadmin/pkg/common" "github.com/flyteorg/flyteadmin/pkg/repositories/errors" @@ -19,6 +20,12 @@ import ( var ( signalModel = &models.Signal{ + BaseModel: models.BaseModel{ + ID: 10, + CreatedAt: time.Time{}, + UpdatedAt: time.Time{}, + DeletedAt: nil, + }, SignalKey: models.SignalKey{ ExecutionKey: models.ExecutionKey{ Project: "project", @@ -34,6 +41,7 @@ var ( func toSignalMap(signalModel models.Signal) map[string]interface{} { signal := make(map[string]interface{}) + signal["id"] = signalModel.ID signal["created_at"] = signalModel.CreatedAt signal["updated_at"] = signalModel.UpdatedAt signal["execution_project"] = signalModel.Project @@ -92,7 +100,7 @@ func TestGetOrCreateSignal(t *testing.T) { // create initial signalModel mockInsertQuery := GlobalMock.NewMock() mockInsertQuery.WithQuery( - `INSERT INTO "signals" ("id","created_at","updated_at","deleted_at","execution_project","execution_domain","execution_name","signal_id","type","value") VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10)`) + `INSERT INTO "signals" ("created_at","updated_at","deleted_at","execution_project","execution_domain","execution_name","signal_id","type","value","id") VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10)`) err := signalRepo.GetOrCreate(ctx, signalModel) assert.NoError(t, err) @@ -104,7 +112,7 @@ func TestGetOrCreateSignal(t *testing.T) { signalModels := []map[string]interface{}{toSignalMap(*signalModel)} mockSelectQuery := GlobalMock.NewMock() mockSelectQuery.WithQuery( - `SELECT * FROM "signals" WHERE "signals"."created_at" = $1 AND "signals"."updated_at" = $2 AND "signals"."execution_project" = $3 AND "signals"."execution_domain" = $4 AND "signals"."execution_name" = $5 AND "signals"."signal_id" = $6 AND "signals"."execution_project" = $7 AND "signals"."execution_domain" = $8 AND "signals"."execution_name" = $9 AND "signals"."signal_id" = $10 ORDER BY "signals"."id" LIMIT 1`).WithReply(signalModels) + `SELECT * FROM "signals" WHERE "signals"."id" = $1 AND "signals"."created_at" = $2 AND "signals"."updated_at" = $3 AND "signals"."execution_project" = $4 AND "signals"."execution_domain" = $5 AND "signals"."execution_name" = $6 AND "signals"."signal_id" = $7 AND "signals"."execution_project" = $8 AND "signals"."execution_domain" = $9 AND "signals"."execution_name" = $10 AND "signals"."signal_id" = $11 ORDER BY "signals"."id" LIMIT 1`).WithReply(signalModels) // retrieve existing signalModel lookupSignalModel := &models.Signal{}