Documentation ¶
Overview ¶
Liquo package aims to provide a ox plugin to manage migrations with the Liquibase style. That is, using the databasechangelog and databasechangeloglock as well as the xml format for liquibase migrations.
IMPORTANT: This plugin is not ready to be used in production, rather it aims to allow developers to avoid the java and liquibase installation by doing what liquibase does.
Index ¶
- Variables
- func Plugins() []core.Plugin
- type ChangeLog
- type ChangeSet
- type Command
- func (lb Command) EnsureTables(conn *pgx.Conn) error
- func (lb *Command) Flags() *pflag.FlagSet
- func (lb Command) HelpText() string
- func (lb Command) Name() string
- func (lb Command) ParentName() string
- func (lb *Command) ParseFlags(args []string)
- func (lb Command) ReadChangelog() (*ChangeLog, error)
- func (lb Command) ReadMigration(path string) (*Migration, error)
- func (lb *Command) Rollback() error
- func (lb *Command) Run(ctx context.Context, root string, args []string) error
- func (lb *Command) RunBeforeTest(ctx context.Context, root string, args []string) error
- func (lb Command) Up() error
- type Generator
- type Migration
- type MigrationFile
Constants ¶
This section is empty.
Variables ¶
var ( ErrNameArgMissing = errors.New("name arg missing") ErrInvalidName = errors.New("invalid migration name") ErrInvalidPath = errors.New("invalid path") ErrInvalidChangelogFormat = errors.New("changelog.xml file has bad format or is empty") )
var ErrInvalidInstruction = errors.New("Invalid instruction please specify up or down")
Functions ¶
Types ¶
type ChangeLog ¶
type ChangeLog struct { XMLName xml.Name `xml:"databaseChangeLog"` Migrations []MigrationFile `xml:"include"` }
DatabaseChangelog file containing all of the migrations. This is the root migrations commander, the tool only considers migration files in the changelog.
type ChangeSet ¶
type ChangeSet struct { ID string `xml:"id,attr"` Author string `xml:"author,attr"` SQL []string `xml:"sql"` RollbackSQL string `xml:"rollback"` }
ChangeSet with SQL and Rollback instructions.
type Command ¶
type Command struct {
// contains filtered or unexported fields
}
func (Command) EnsureTables ¶
EnsureTables are in the database.
func (Command) ParentName ¶
func (*Command) ParseFlags ¶
func (Command) ReadChangelog ¶
func (*Command) RunBeforeTest ¶
type Generator ¶
type Generator struct {
// contains filtered or unexported fields
}
Generator for liquibase SQL migrations, it generates xml liquibase for SQL in the root + basedir folder. It uses the argument passed to determine both the name of the migration and the destination. Some examples are: - "ox generate migration name" generates [timestamp]-name.xml - "ox generate migration folder/name" generates folder/[timestamp]-name.xml - "ox generate migration name --base migrations" generates migrations/[timestamp]-name.xml
func (Generator) Generate ¶
Generate a new migration based on the passed args. This needs at least 3 args since the 3rd arg will be used by the generator to build the name of the migration.
func (Generator) InvocationName ¶
Name is the name used to identify the generator and also the plugin
func (*Generator) ParseFlags ¶
Parseflags will parse the baseFolder from the --base or -b flag
type Migration ¶
type Migration struct {
ChangeSets []ChangeSet `xml:"changeSet"`
}
Migration xml with liquibase format. A migration may be composed of multiple changesets.
type MigrationFile ¶
type MigrationFile struct {
File string `xml:"file,attr"`
}
MigrationFiles in the changelog. These are used to get the file path to the migration.