postgres

package
v0.0.5-alpha Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package postgres runs golang-migrate migrations against a Postgres database.

This package intentionally lives outside hex/db so consumers who use a different dialect never link the Postgres migration driver. Import it only when you need Postgres migrations.

The SQL driver itself (e.g. github.com/lib/pq or github.com/jackc/pgx) is still the caller's responsibility to blank-import.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Migrate

func Migrate(sqldb *sql.DB, migrations embed.FS, dir string) error

Migrate applies all pending Up migrations from the embedded FS. Returns nil if there are no changes.

The caller retains ownership of sqldb; this function never closes it (even though golang-migrate's Migrate.Close would). The iofs source has no external resources to release, so no cleanup is required.

func MigrateDown

func MigrateDown(sqldb *sql.DB, migrations embed.FS, dir string) error

MigrateDown rolls back every applied migration. sqldb is not closed.

func MigrateSteps

func MigrateSteps(sqldb *sql.DB, migrations embed.FS, dir string, n int) error

MigrateSteps applies n migrations up (n > 0) or down (n < 0). sqldb is not closed.

Types

This section is empty.

Jump to

Keyboard shortcuts

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