Skip to content

Latest commit

 

History

History
31 lines (26 loc) · 562 Bytes

README.md

File metadata and controls

31 lines (26 loc) · 562 Bytes

This is a Proof of Concept for using the embed package in conjunction with sql-migrate.

Example

import (
	"embed"

	embedmigrations "github.com/Delisa-sama/go-embed-migration-source"
)

//go:embed migrations
var migrationFiles embed.FS

// MigrationSource embedded migration source.
var MigrationSource = &embedmigrations.EmbedFileSystemMigrationSource{
	FileSystem: migrationFiles,
	Dir:        "migrations",
}
...
num, err := sqlmigrate.ExecMax(
  db,
  dialect,
  MigrationSource,
  sqlmigrate.Up,
  limit,
)
if err != nil {
  return err
}