Thanks to visit codestin.com
Credit goes to github.com

Skip to content

sqlite3: Unable to open database file if directory contains whitespace #499

@ganboonhong

Description

@ganboonhong

Describe the Bug
Unable to open sqlite database file if directory contains whitespace. An error was returned while trying to open a sqlite file located under $HOME/Library/Application Support/ (which is returned by https://pkg.go.dev/os#UserConfigDir).

Steps to Reproduce
Try running this unit test by replacing sqlite3-driver-test with sqlite3 driver test:

dir, err := ioutil.TempDir("", "sqlite3-driver-test")

you will see the following error:

--- FAIL: Test (0.00s)
    sqlite3_test.go:29: DB path : /var/folders/65/j4_h7qkd5xl9qmxlxzbnjj4r0000gn/T/sqlite3 driver test573028882/sqlite3.db
    sqlite3_test.go:34: unable to open database file
FAIL
exit status 1
FAIL	github.com/golang-migrate/migrate/v4/database/sqlite3	0.322s

Expected Behavior
Expect no error.

Migrate Version
v4.14.1

Loaded Source Drivers
github

Loaded Database Drivers
sqlite3

Go Version
go version go1.15.6 darwin/amd64

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions