Documentation
¶
Index ¶
- Variables
- func ReadSchema(ctx context.Context, conn *sql.DB, stateSchema, schemaname string) (*schema.Schema, error)
- type State
- func (s *State) Close() error
- func (s *State) Complete(ctx context.Context, schema, name string) error
- func (s *State) GetActiveMigration(ctx context.Context, schema string) (*migrations.Migration, error)
- func (s *State) Init(ctx context.Context) error
- func (s *State) IsActiveMigrationPeriod(ctx context.Context, schema string) (bool, error)
- func (s *State) LatestVersion(ctx context.Context, schema string) (*string, error)
- func (s *State) PreviousVersion(ctx context.Context, schema string) (*string, error)
- func (s *State) ReadSchema(ctx context.Context, schemaName string) (*schema.Schema, error)
- func (s *State) Rollback(ctx context.Context, schema, name string) error
- func (s *State) Schema() string
- func (s *State) Start(ctx context.Context, schemaname string, migration *migrations.Migration) (*schema.Schema, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNoActiveMigration = errors.New("no active migration")
Functions ¶
Types ¶
type State ¶
type State struct {
// contains filtered or unexported fields
}
func (*State) GetActiveMigration ¶
func (s *State) GetActiveMigration(ctx context.Context, schema string) (*migrations.Migration, error)
GetActiveMigration returns the name & raw content of the active migration (if any), errors out otherwise
func (*State) IsActiveMigrationPeriod ¶
IsActiveMigrationPeriod returns true if there is an active migration
func (*State) LatestVersion ¶
LatestVersion returns the name of the latest version schema
func (*State) PreviousVersion ¶
PreviousVersion returns the name of the previous version schema
func (*State) ReadSchema ¶
func (*State) Rollback ¶
Rollback removes a migration from the state (we consider it rolled back, as if it never started)
func (*State) Start ¶
func (s *State) Start(ctx context.Context, schemaname string, migration *migrations.Migration) (*schema.Schema, error)
Start creates a new migration, storing its name and raw content this will effectively activate a new migration period, so `IsActiveMigrationPeriod` will return true until the migration is completed This method will return the current schema (before the migration is applied)
Click to show internal directories.
Click to hide internal directories.