Open atljoseph opened 3 months ago
Describe the Bug SQLite3 accepts file URL with prefix file:///, but golang-migrate requires prefix sqlite3:///.
file:///
sqlite3:///
Steps to Reproduce Steps to reproduce the behavior:
file:///path/to/sqlite3.db
sqlite3:///path/to/sqlite3.db
Expected Behavior I should be able to call this code in following way, with no error, and with positive functionality:
File migrations/embed.go:
migrations/embed.go
package migrations //go:embed *.sql var FS embed.FS
File db.go:
db.go
... iofsDriver, iofsErr := iofs.New(migrations.FS, ".") if iofsErr != nil { return fmt.Errorf("cannot open database migration embedded directory: %w", iofsErr) } m, mErr := migrate.NewWithSourceInstance("iofs", iofsDriver, `sqlite3:///path/to/sqlite3.db`) if mErr != nil { return fmt.Errorf("cannot open database migration helper: %w", mErr) } if migrateErr := m.Up(); migrateErr != nil { if !errors.Is(migrateErr, migrate.ErrNoChange) { return fmt.Errorf("cannot perform database migration: %w", migrateErr) } } ...
Migrate Version From go.mod: github.com/golang-migrate/migrate/v4 v4.17.0 I don't have CLI installed. Calling it from Go code.
go.mod
Loaded Source Drivers Already described above.
Loaded Database Drivers Already described above.
Go Version go version go1.22.1 darwin/arm64
Stacktrace None.
Additional context Running this in fyne on a mobile app. Incidentally, if i run the following similar code, there is no error:
... config := &sqlite3.Config{} driver, driverErr := sqlite3.WithInstance(db.dbx.DB, config) if driverErr != nil { return fmt.Errorf("cannot open database migration driver: %w", driverErr) } m, mErr := migrate.NewWithInstance("iofs", iofsDriver, "", driver) if mErr != nil { return fmt.Errorf("cannot open database migration helper: %w", mErr) } if migrateErr := m.Up(); migrateErr != nil { if !errors.Is(migrateErr, migrate.ErrNoChange) { return fmt.Errorf("cannot perform database migration: %w", migrateErr) } } ...
Should accept file URI, and possible DB type string.
Describe the Bug SQLite3 accepts file URL with prefix
file:///
, but golang-migrate requires prefixsqlite3:///
.Steps to Reproduce Steps to reproduce the behavior:
file:///path/to/sqlite3.db
.file:///path/to/sqlite3.db
.sqlite3:///path/to/sqlite3.db
.Expected Behavior I should be able to call this code in following way, with no error, and with positive functionality:
File
migrations/embed.go
:File
db.go
:Migrate Version From
go.mod
: github.com/golang-migrate/migrate/v4 v4.17.0 I don't have CLI installed. Calling it from Go code.Loaded Source Drivers Already described above.
Loaded Database Drivers Already described above.
Go Version go version go1.22.1 darwin/arm64
Stacktrace None.
Additional context Running this in fyne on a mobile app. Incidentally, if i run the following similar code, there is no error: