Documentation ¶
Index ¶
- Constants
- Variables
- type Migra
- func (m *Migra) CreateMigrationTable(ctx context.Context) error
- func (m *Migra) DB() *sql.DB
- func (m *Migra) DropMigrationTable(ctx context.Context) error
- func (m *Migra) Latest(ctx context.Context) (*Migration, error)
- func (m *Migra) List(ctx context.Context) ([]Migration, error)
- func (m *Migra) MigrationTable() string
- func (m *Migra) Pop(ctx context.Context) error
- func (m *Migra) PopAll(ctx context.Context) (int, error)
- func (m *Migra) PopUntil(ctx context.Context, name string) error
- func (m *Migra) Push(ctx context.Context, migration *Migration) error
- func (m *Migra) PushDir(ctx context.Context, dirpath string) error
- func (m *Migra) PushDirFS(ctx context.Context, filesystem fs.FS, dirpath string) error
- func (m *Migra) PushFS(ctx context.Context, filesystem fs.FS) error
- func (m *Migra) PushFile(ctx context.Context, filepath string) error
- func (m *Migra) PushFileFS(ctx context.Context, filesystem fs.FS, filepath string) error
- func (m *Migra) PushMany(ctx context.Context, migrations []Migration) error
- func (m *Migra) SetMigrationTable(table string) *Migra
- func (m *Migra) SetSchema(schema string) *Migra
- type Migration
Constants ¶
View Source
const ( // DefaultMigrationTable is the name given to the migration table if not overriden by SetMigrationTable DefaultMigrationTable = "_migrations" // DefaultSchemaName is the name given to the migration table schema if not overriden by SetSchemaName DefaultSchemaName = "public" )
Variables ¶
View Source
var (
ErrNoMigration = errors.New("no migration found")
)
Functions ¶
This section is empty.
Types ¶
type Migra ¶
type Migra struct {
// contains filtered or unexported fields
}
Migra contains methods for migrating an sql database
func (*Migra) CreateMigrationTable ¶
CreateMigrationTable creates the table and schema where migrations will be stored and executed. The name of the table can be set using the SetMigrationTable method.
func (*Migra) DropMigrationTable ¶
DropMigrationTable
func (*Migra) MigrationTable ¶
MigrationTable returns the fully qualified, schema prefixed table name
func (*Migra) PushFileFS ¶
PushFileFS pushes a file with given name from the filesystem
func (*Migra) SetMigrationTable ¶
SetMigrationTable sets the default table where migrations will be stored and executed
Click to show internal directories.
Click to hide internal directories.