Documentation
¶
Index ¶
- type ConfigFn
- type MigLite
- func (m *MigLite) Down(opt command.DownOption) error
- func (m *MigLite) Init(opt command.InitOption) error
- func (m *MigLite) Show(opt command.ShowOption) error
- func (m *MigLite) Skip(opt command.SkipOption) error
- func (m *MigLite) Status(opt command.StatusOption) error
- func (m *MigLite) Up(opt command.UpOption) error
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MigLite ¶ added in v0.2.0
type MigLite struct {
// contains filtered or unexported fields
}
MigLite manage the migration
func New ¶ added in v0.2.0
New creates a new MigLite instance, with optional configuration functions
- configFile: if not exist, will skip load it.
Example ¶
package main
import (
"github.com/gookit/goutil"
"github.com/gookit/miglite"
"github.com/gookit/miglite/pkg/command"
"github.com/gookit/miglite/pkg/config"
)
func main() {
mig, err := miglite.New("miglite.yml", func(cfg *config.Config) {
// update config options
})
goutil.PanicIfErr(err) // handle error
// run up migrations
err = mig.Up(command.UpOption{
Yes: true, // dont confirm
// ... options
})
goutil.PanicIfErr(err) // handle error
// other operations
// init migrations schema
err = mig.Init(command.InitOption{
// ... options
})
goutil.PanicIfErr(err) // handle error
// run down migrations
err = mig.Down(command.DownOption{
// ... options
})
goutil.PanicIfErr(err)
err = mig.Status(command.StatusOption{
// ... options
})
goutil.PanicIfErr(err) // handle error
err = mig.Show(command.ShowOption{
// ... options
})
goutil.PanicIfErr(err) // handle error
err = mig.Skip(command.SkipOption{
// ... options
})
goutil.PanicIfErr(err) // handle error
}
Output:
func NewWithConfig ¶ added in v0.2.0
NewWithConfig creates a new MigLite instance with a pre-configured Config
func (*MigLite) Down ¶ added in v0.2.0
func (m *MigLite) Down(opt command.DownOption) error
Down runs the migration down operation.
func (*MigLite) Init ¶ added in v0.2.0
func (m *MigLite) Init(opt command.InitOption) error
Init initializes the migration schema
func (*MigLite) Show ¶ added in v0.2.0
func (m *MigLite) Show(opt command.ShowOption) error
Show displays all tables in the database.
func (*MigLite) Skip ¶ added in v0.2.0
func (m *MigLite) Skip(opt command.SkipOption) error
Skip skips some migration files.
Click to show internal directories.
Click to hide internal directories.

