migrations

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2024 License: MIT Imports: 5 Imported by: 0

README

migration-tool

Create directory

mkdir migrations

/migrations/person.sql

CREATE TABLE IF NOT EXISTS Persons (
    PersonID int,
    LastName varchar(255),
    FirstName varchar(255),
    Address varchar(255),
    City varchar(255)
);

Example

func main() {
	db := DB{}
	db.Set("postgres", "postgres://postgres:postgres@localhost:5432/eventstore?sslmode=disable")
	defer db.Close()
	db.Migrate("./migrations/")
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReadFile

func ReadFile(path string) (string, error)

Types

type DB

type DB struct {
	*sql.DB
}

func (*DB) Migrate

func (db *DB) Migrate(directory string)

func (*DB) Set

func (db *DB) Set(dbType, psqlInfo string)

Jump to

Keyboard shortcuts

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