Documentation
¶
Index ¶
Constants ¶
View Source
const QryVersionUpdate = `
INSERT INTO __meta__ (version, description) VALUES ($1, $2)
`
QryVersionUpdate inserts the current version and description into the meta table
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Manager ¶
type Manager struct {
DB string
// contains filtered or unexported fields
}
Manager is a migration manager
func (*Manager) ClearDatabase ¶
ClearDatabase drops and creates a database
type Migration ¶
A Migration consists of an SQL statement and an ID. The Sequence is the order of the migrations.
type MigrationState ¶
type MigrationState struct {
AppliedAt time.Time `json:"applied_at"`
Description string `json:"description"`
Version int `json:"version"`
}
MigrationState is the current version of the database and when it was applied.
func MigrationStateFromDB ¶
MigrationStateFromDB reads the current migration state from the meta table.
type Migrations ¶
type Migrations []*Migration
Migrations is a sorted collection of migrations
func GetMigrations ¶
func GetMigrations() Migrations
GetMigrations retrievs all migrations from the embedded filesystem
func (Migrations) Less ¶
func (m Migrations) Less(i, j int) bool
Less implements the sort interface and compares the sequence
type Status ¶
type Status struct {
Available bool `json:"available"`
Database string `json:"database"`
Migrated bool `json:"migrated"`
Migration *MigrationState `json:"migration"`
PendingMigrations int `json:"pending_migrations"`
Error *string `json:"error"`
}
Status is the current status of the database
Click to show internal directories.
Click to hide internal directories.