migration

package
v0.9.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 26, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package migration provides integration with Flyway for database migrations

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	FlywayPath    string        // Path to the Flyway executable
	ConfigPath    string        // Path to the configuration file
	MigrationPath string        // Path to migration scripts
	Timeout       time.Duration // Timeout for migration operations
	Environment   string        // Environment (development, testing, production)
	DryRun        bool          // Only validate, do not execute
}

Config configuration for migrations

type FlywayMigrator

type FlywayMigrator struct {
	// contains filtered or unexported fields
}

FlywayMigrator handles database migrations using Flyway

func NewFlywayMigrator

func NewFlywayMigrator(cfg *config.Config, log logger.Logger) *FlywayMigrator

NewFlywayMigrator creates a new instance of the migrator

func (*FlywayMigrator) GetDefaultMigrationConfig

func (fm *FlywayMigrator) GetDefaultMigrationConfig() *Config

GetDefaultMigrationConfig gets the default configuration for migrations

func (*FlywayMigrator) Info

func (fm *FlywayMigrator) Info(ctx context.Context, cfg *Config) error

Info shows information about the status of migrations

func (*FlywayMigrator) Migrate

func (fm *FlywayMigrator) Migrate(ctx context.Context, cfg *Config) error

Migrate executes pending migrations

func (*FlywayMigrator) RunMigrationsAtStartup

func (fm *FlywayMigrator) RunMigrationsAtStartup(ctx context.Context) error

RunMigrationsAtStartup executes migrations automatically at application startup

func (*FlywayMigrator) Validate

func (fm *FlywayMigrator) Validate(ctx context.Context, cfg *Config) error

Validate validates migrations without executing them

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL