Documentation ¶
Index ¶
- Variables
- func DoMigrate[InstanceCfgT any](cfg MigrationConfig[InstanceCfgT], ...) (uint, bool, error)
- func NewMigratePgxInstance(db *sql.DB, sourceURL string, cfg *pgx.Config) (*migrate.Migrate, error)
- func NewMigrateSQLiteInstance(db *sql.DB, sourceURL string, cfg *sqlite3.Config) (*migrate.Migrate, error)
- type MigrationConfig
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func DoMigrate ¶
func DoMigrate[InstanceCfgT any](cfg MigrationConfig[InstanceCfgT], newInstance func(db *sql.DB, sourceURL string, cfg InstanceCfgT) (*migrate.Migrate, error)) (uint, bool, error)
DoMigrate applies migration to a database
func NewMigratePgxInstance ¶
NewMigratePgxInstance is a newInstance function for pgx/v5 database driver
Types ¶
type MigrationConfig ¶
type MigrationConfig[InstanceCfgT any] struct { // File path // format: path or /absolutepath MigrationsPath string // format: sqlite3://path/to/db // postgresql://user:password@ip:port/dbname?conn_opts DB *sql.DB // Put -1 for no limit, 0 to down database // and any number > 0 to limit version VersionLimit int // Drop DB before applying migrations Drop bool // Config used for migration connects DriverCfg InstanceCfgT }
Click to show internal directories.
Click to hide internal directories.