Documentation
¶
Index ¶
- func ClearRegistry()
- func RegisterMigration(name string, migration Migration)
- type Migration
- type Migrator
- type Repository
- func (r *Repository) CreateRepository() error
- func (r *Repository) Delete(migrationName string) error
- func (r *Repository) DeleteRepository() error
- func (r *Repository) GetLast() ([]migration.File, error)
- func (r *Repository) GetMigrations() ([]migration.File, error)
- func (r *Repository) GetMigrationsByBatch(batch int) ([]migration.File, error)
- func (r *Repository) GetMigrationsByStep(steps int) ([]migration.File, error)
- func (r *Repository) GetNextBatchNumber() (int, error)
- func (r *Repository) GetRan() ([]string, error)
- func (r *Repository) Log(migrationName string, batch int) error
- func (r *Repository) RepositoryExists() bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClearRegistry ¶
func ClearRegistry()
ClearRegistry clears the global migration registry (useful for testing)
func RegisterMigration ¶
RegisterMigration registers a migration in the global registry
Types ¶
type Migration ¶
type Migration struct {
Up func(schema contractsschema.Schema) error
Down func(schema contractsschema.Schema) error
}
Migration represents a migration with Up and Down methods
type Migrator ¶
type Migrator struct {
// contains filtered or unexported fields
}
Migrator handles database migrations.
func NewMigrator ¶
func NewMigrator(config config.Config, orm contractsorm.Orm, schema *schema.Schema, paths []string) *Migrator
NewMigrator creates a new Migrator instance.
type Repository ¶
type Repository struct {
// contains filtered or unexported fields
}
Repository manages migration records in the database.
func NewRepository ¶
func NewRepository(config config.Config, orm contractsorm.Orm) *Repository
NewRepository creates a new Repository instance.
func (*Repository) CreateRepository ¶
func (r *Repository) CreateRepository() error
func (*Repository) Delete ¶
func (r *Repository) Delete(migrationName string) error
func (*Repository) DeleteRepository ¶
func (r *Repository) DeleteRepository() error
func (*Repository) GetMigrations ¶
func (r *Repository) GetMigrations() ([]migration.File, error)
func (*Repository) GetMigrationsByBatch ¶
func (r *Repository) GetMigrationsByBatch(batch int) ([]migration.File, error)
func (*Repository) GetMigrationsByStep ¶
func (r *Repository) GetMigrationsByStep(steps int) ([]migration.File, error)
func (*Repository) GetNextBatchNumber ¶
func (r *Repository) GetNextBatchNumber() (int, error)
func (*Repository) GetRan ¶
func (r *Repository) GetRan() ([]string, error)
func (*Repository) RepositoryExists ¶
func (r *Repository) RepositoryExists() bool
Click to show internal directories.
Click to hide internal directories.