posh-providers/golang-migrate/migrate
Kevin Franklin Kim 4588a19b45
feat: add schema
2025-04-04 16:44:08 +02:00
..
command.go feat(golang-migrate/migrate): add op 2024-12-04 10:56:34 +01:00
config_test.go feat: add schema 2025-04-04 16:44:08 +02:00
config.go feat(golang-migrate/migrate): add provider 2024-12-04 10:00:57 +01:00
config.schema.json feat: add schema 2025-04-04 16:44:08 +02:00
logger.go feat(golang-migrate/migrate): add provider 2024-12-04 10:00:57 +01:00
README.md feat(golang-migrate/migrate): add provider 2024-12-04 10:00:57 +01:00

POSH Golang Migrate provider

Usage

Plugin

package main

import (
  // ...
  // import database drivers
  _ "github.com/golang-migrate/migrate/v4/database/pgx/v5"
  // import source drivers
  _ "github.com/golang-migrate/migrate/v4/source/file"
  // ...
)

type Plugin struct {
  l log.Logger
}

func New(l log.Logger) (plugin.Plugin, error) {
  var err error
  inst := &Plugin{
    l:        l,
    commands: command.Commands{},
  }

  // ...

  inst.commands.Add(migrate.NewCommand(l))

  // ...

  return inst, nil
}

Config

## Migrate
migrate:
  # https://github.com/golang-migrate/migrate/blob/master/README.md#migration-sources
  databases:
    local: pgx5://postgres:postgres@localhost:5432/admin?sslmode=disable
  # https://github.com/golang-migrate/migrate/blob/master/README.md#migration-sources
  sources:
    default: file://migrations