Migrations

package module
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2023 License: MIT Imports: 7 Imported by: 1

README

migrations

Golang library that can be used to run DB migrations on app startup

In project where you add the package - you need to use for example (directory you set where the migration files is) //go:embed directory var folder embed.FS

And then pass folder and named directory as a parameters to the RunAutoMigrate function

For example you can call auto migrations with err, _, _ := migrations.RunAutoMigrate(migrateDBInstance.DBX().DB, folder, "directory") if err != nil { log.Error(err) }

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RunAutoMigrate

func RunAutoMigrate(db *sql.DB, fs embed.FS, migrationPath string, dbType string, dbName string) (err error, step string, dbVersion uint)

function to run migration from go - when app is started migration is set just to postgreSql database

Types

This section is empty.

Jump to

Keyboard shortcuts

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