Documentation ¶
Overview ¶
Liquibase 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(conns interface{}) []plugins.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
- type URLProvider
Constants ¶
This section is empty.
Variables ¶
var ( ErrNameArgMissing = errors.New("name arg missing") ErrInvalidName = errors.New("invalid migration name") ErrInvalidPath = errors.New("invalid path") )
var ErrInvalidInstruction = errors.New("Invalid instruction please specify up or down")
Functions ¶
Types ¶
type ChangeLog ¶ added in v0.7.11
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 ¶ added in v0.7.11
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 ¶ added in v0.7.11
EnsureTables are in the database.
func (Command) ParentName ¶
func (*Command) ParseFlags ¶ added in v0.6.3
func (Command) ReadChangelog ¶ added in v0.7.11
func (Command) ReadMigration ¶ added in v0.7.11
func (*Command) RunBeforeTest ¶
type Generator ¶ added in v0.7.0
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 ¶ added in v0.7.0
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) Name ¶ added in v0.7.0
Name is the name used to identify the generator and also the plugin
func (*Generator) ParseFlags ¶ added in v0.7.8
Parseflags will parse the baseFolder from the --base or -b flag
type Migration ¶ added in v0.7.11
type Migration struct {
ChangeSets []ChangeSet `xml:"changeSet"`
}
Migration xml with liquibase format. A migration may be composed of multiple changesets.
type MigrationFile ¶ added in v0.7.11
type MigrationFile struct {
File string `xml:"file,attr"`
}
MigrationFiles in the changelog. These are used to get the file path to the migration.
type URLProvider ¶ added in v0.5.3
type URLProvider interface {
URL() string
}
URLProvider provider is a struct that has the URL() method. Like pop.Connection.