Skip to content

Commit

Permalink
fix: export unexported options
Browse files Browse the repository at this point in the history
  • Loading branch information
GAlexIHU committed Sep 4, 2024
1 parent 8771ee4 commit 4bc487a
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions tools/migrate/migrate.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,20 @@ type Migrate = migrate.Migrate
var OMMigrations embed.FS

type Options struct {
db *sql.DB
fs fs.FS
fsPath string
pgConfig *postgres.Config
DB *sql.DB
FS fs.FS
FSPath string
PGConfig *postgres.Config
}

// NewMigrate creates a new migrate instance.
func NewMigrate(opt Options) (*Migrate, error) {
d, err := iofs.New(opt.fs, opt.fsPath)
d, err := iofs.New(opt.FS, opt.FSPath)
if err != nil {
return nil, err
}

driver, err := postgres.WithInstance(opt.db, opt.pgConfig)
driver, err := postgres.WithInstance(opt.DB, opt.PGConfig)
if err != nil {
return nil, err
}
Expand All @@ -44,21 +44,21 @@ func NewMigrate(opt Options) (*Migrate, error) {

func Default(db *sql.DB) (*Migrate, error) {
return NewMigrate(Options{
db: db,
fs: OMMigrations,
fsPath: "migrations",
pgConfig: &postgres.Config{
DB: db,
FS: OMMigrations,
FSPath: "migrations",
PGConfig: &postgres.Config{
MigrationsTable: MigrationsTable,
},
})
}

func Up(db *sql.DB) error {
m, err := NewMigrate(Options{
db: db,
fs: OMMigrations,
fsPath: "migrations",
pgConfig: &postgres.Config{
DB: db,
FS: OMMigrations,
FSPath: "migrations",
PGConfig: &postgres.Config{
MigrationsTable: MigrationsTable,
},
})
Expand Down

0 comments on commit 4bc487a

Please sign in to comment.