chainlink: github.com/smartcontractkit/chainlink/core/store/migrations/migration0 Index | Files

package migration0

import "github.com/smartcontractkit/chainlink/core/store/migrations/migration0"

Index

Package Files

migrate.go

func Migrate Uses

func Migrate(tx *gorm.DB) error

Migrate runs the initial migration

Do not reference the canonical structs from `store/models`, here. Place the struct corresponding to the DB table at the bottom of this file, and reference that in the `AutoMigrate` call. We don't want tables being `AutoMigrate`d whenever we change the canonical struct, because that could lead to data loss. Make an explicit migration in its own ../migrations<rough_unix_time>/migrate.go file/package.

For instance, the `JobRun` struct referenced here does not have a Payment field. The "payment" column is added to the job_runs table later, in ./migration1567029116/migrate.go.

type Encumbrance Uses

type Encumbrance struct {
    ID         uint         `gorm:"primary_key;auto_increment"`
    Payment    *assets.Link `gorm:"type:varchar(255)"`
    Expiration uint64
    // This is a models.AnyTime in models.Encumbrance, but the DB column is a datetime
    EndAt time.Time
    // This is a models.EIP55AddressCollection in models.Encumbrance, but the DB column is text.
    Oracles string `gorm:"type:text"`
}

Encumbrance is a capture of DB model before migration1568390387

type ExternalInitiator Uses

type ExternalInitiator struct {
    *gorm.Model
    AccessKey    string
    Salt         string
    HashedSecret string
}

ExternalInitiator represents a user that can initiate runs remotely

type Head struct {
    HashRaw string `gorm:"primary_key;type:varchar;column:hash"`
    Number  int64  `gorm:"index;type:bigint;not null"`
}

Head is a capture of the model before migration1560881846

type Initiator Uses

type Initiator struct {
    ID         uint      `gorm:"primary_key;auto_increment"`
    JobSpecID  string    `gorm:"index;type:varchar(36) REFERENCES job_specs(id)"`
    Type       string    `gorm:"index;not null"`
    CreatedAt  time.Time `gorm:"index"`
    DeletedAt  null.Time `gorm:"index"`
    Schedule   string
    Time       time.Time
    Ran        bool
    Address    common.Address `gorm:"index"`
    Requesters string         `gorm:"type:text"`
}

Initiator is a capture of the model before migration1565210496

type JobRun Uses

type JobRun struct {
    ID             string `gorm:"primary_key;not null"`
    JobSpecID      string `gorm:"index;not null;type:varchar(36) REFERENCES job_specs(id)"`
    ResultID       uint
    RunRequestID   uint
    Status         string    `gorm:"index"`
    CreatedAt      time.Time `gorm:"index"`
    FinishedAt     null.Time
    UpdatedAt      time.Time
    InitiatorID    uint
    CreationHeight string `gorm:"type:varchar(255)"`
    ObservedHeight string `gorm:"type:varchar(255)"`
    OverridesID    uint
    DeletedAt      null.Time `gorm:"index"`
}

JobRun is a capture of the model before migration1565210496

type JobSpec Uses

type JobSpec struct {
    ID        string    `gorm:"primary_key;not null"`
    CreatedAt time.Time `gorm:"index"`
    StartAt   null.Time `gorm:"index"`
    EndAt     null.Time `gorm:"index"`
    DeletedAt null.Time `gorm:"index"`
}

JobSpec is a capture of the model before migration1565139192

type RunRequest Uses

type RunRequest struct {
    ID        uint `gorm:"primary_key"`
    RequestID *string
    TxHash    *common.Hash
    Requester *common.Address
    CreatedAt time.Time
}

RunRequest is a capture of the model before migration1565139192

type RunResult Uses

type RunResult struct {
    ID           uint   `gorm:"primary_key;auto_increment"`
    Data         string `gorm:"type:text"`
    Status       string
    ErrorMessage string
    Amount       *assets.Link `gorm:"type:varchar(255)"`
}

RunResult is a capture of the model before migration1567029116

type ServiceAgreement Uses

type ServiceAgreement struct {
    ID            string    `gorm:"primary_key"`
    CreatedAt     time.Time `gorm:"index"`
    EncumbranceID uint
    RequestBody   string
    Signature     string `gorm:"type:varchar(255)"`
    JobSpecID     string `gorm:"index;not null;type:varchar(36) REFERENCES job_specs(id)"`
}

ServiceAgreement is a capture of the model before migration1565291711

type TaskRun Uses

type TaskRun struct {
    ID                   string `gorm:"primary_key;not null"`
    JobRunID             string `gorm:"index;not null;type:varchar(36) REFERENCES job_runs(id) ON DELETE CASCADE"`
    ResultID             uint
    Status               string
    TaskSpecID           uint `gorm:"index;not null REFERENCES task_specs(id)"`
    MinimumConfirmations uint64
    CreatedAt            time.Time `gorm:"index"`
}

TaskRun stores the Task and represents the status of the Task to be ran.

type TaskSpec Uses

type TaskSpec struct {
    gorm.Model
    JobSpecID     string `gorm:"index;type:varchar(36) REFERENCES job_specs(id)"`
    Type          string `gorm:"index;not null"`
    Confirmations clnull.Uint32
    Params        string `gorm:"type:text"`
}

TaskSpec is a capture of the model before migration1565291711

type Tx Uses

type Tx struct {
    ID        uint64         `gorm:"primary_key;auto_increment"`
    From      common.Address `gorm:"index;not null"`
    To        common.Address `gorm:"not null"`
    Data      []byte
    Nonce     uint64     `gorm:"index"`
    Value     *utils.Big `gorm:"type:varchar(255)"`
    GasLimit  uint64
    Hash      common.Hash
    GasPrice  *utils.Big `gorm:"type:varchar(255)"`
    Confirmed bool
    Hex       string `gorm:"type:text"`
    SentAt    uint64
}

Tx is a capture of the model representing Txes before migration1559081901

type TxAttempt Uses

type TxAttempt struct {
    Hash      common.Hash `gorm:"primary_key;not null"`
    TxID      uint64      `gorm:"index"`
    GasPrice  *utils.Big  `gorm:"type:varchar(255)"`
    Confirmed bool
    Hex       string `gorm:"type:text"`
    SentAt    uint64
    CreatedAt time.Time `gorm:"index"`
}

TxAttempt is a capture of the model representing TxAttempts before migration1559081901

Package migration0 imports 9 packages (graph) and is imported by 3 packages. Updated 2020-05-19. Refresh now. Tools for package owners.