Documentation ¶
Index ¶
- Constants
- Variables
- func CreateTables() (result bool, err error)
- func HasMigrations() (result bool, err error)
- func IsLatest(newTime string) (isLatest bool, err error)
- func Print(mid int64) (err error)
- func Setup(db *gorp.DbMap, projectDatabaseID int)
- func VersionExists(hash string) (exists bool, err error)
- type Migration
- func GetLatest() (m Migration, err error)
- func Load(mid int64) (m *Migration, err error)
- func LoadList(start int64, count int64) (migrations []Migration, end int64, total int64, err error)
- func LoadMigrationsList(mids []int64) (m []Migration, err error)
- func LoadVersion(version string) (m *Migration, err error)
- func New(p Param) (m Migration, err error)
- type Param
- type Step
Constants ¶
const ( // Is waiting to be approved Unapproved = iota // Has been denied Denied // Has been depreciated Depreciated // Has been approved Approved // Is complete Complete // Is complete and was forced by Continuous Integration ForcedCI // Is currently being applied InProgress // Failed to apply Failed // Skipped application Skipped // Has been rolled back Rollback )
The status states of the Migration or Migration Step
Variables ¶
var StatusString = [10]string{
"Unapproved",
"Denied",
"Depreciated",
"Approved",
"Complete",
"ForcedCI",
"InProgress",
"Failed",
"Skipped",
"Rollback",
}
Functions ¶
func CreateTables ¶
CreateTables Create the table for the Migration table as it needs some specific handling for the time related columns than go-gorp can current handle.
func HasMigrations ¶
HasMigrations There are existing migrations
func IsLatest ¶
IsLatest Return if the RFC3339 formatted timestamp is newer than the newest migration in the DB
func VersionExists ¶
VersionExists Check if the Git version has already been registered for migration
Types ¶
type Migration ¶
type Migration struct { MID int64 `db:"mid,autoincrement,primarykey" json:"mid"` DB int `db:"db" json:"db"` Project string `db:"project" json:"project"` Version string `db:"version" json:"version"` VersionTimestamp string `db:"version_timestamp" json:"version_timestamp"` VersionDescription string `db:"version_description,size:512" json:"version_description"` Status int `db:"status" json:"status"` VettedBy string `db:"vetted_by" json:"vetted_by"` Timestamp string `db:"timestamp" json:"timestamp"` Steps []Step `db:"-" json:"steps"` Sandbox bool `db:"-" json:"-"` }
Migration This struct stores the top migration properties.
func LoadMigrationsList ¶
LoadMigrationsList Populate a slice of Migrations using the Migration Ids contained within mids
func LoadVersion ¶
LoadVersion Load a migation from the DB using the Git version
type Param ¶
type Param struct { Project string Version string Timestamp string Description string Forwards mysql.SQLOperations Backwards mysql.SQLOperations Rollback bool Sandbox bool VettedBy string }
Param A struct used to define parameters for the setup and creation of the Migration struct
type Step ¶
type Step struct { SID int64 `db:"sid,autoincrement,primarykey" json:"sid"` MID int64 `db:"mid" json:"mid"` Op int `db:"op" json:"op"` MDID int64 `db:"mdid" json:"mdid"` Name string `db:"name" json:"name"` Forward string `db:"forward" json:"forward"` Backward string `db:"backward" json:"backward"` Output string `db:"output,size:1024" json:"output"` Status int `db:"status" json:"status"` VettedBy string `db:"vetted_by" json:"vetted_by"` }
Step This struct stores the state for a step in a migration
func LoadStepsList ¶
LoadStepsList Populate a slice of Steps using the Step Ids contained within sids
func (*Step) UpdateMetadata ¶
UpdateMetadata Use the Step info to update the database