mirror of
https://github.com/TECHNOFAB11/dbmate.git
synced 2026-02-02 09:25:07 +01:00
Refactor drivers into separate packages (#179)
`dbmate` package was starting to get a bit polluted. This PR migrates each driver into a separate package, with clean separation between each. In addition: * Drivers are now initialized with a URL, avoiding the need to pass `*url.URL` to every method * Sqlite supports a cleaner syntax for relative paths * Driver tests now load their test URL from environment variables Public API of `dbmate` package has not changed (no changes to `main` package).
This commit is contained in:
parent
c907c3f5c6
commit
61771e386d
23 changed files with 1195 additions and 1078 deletions
12
Makefile
12
Makefile
|
|
@ -3,14 +3,14 @@ LDFLAGS := -ldflags '-s'
|
|||
# statically link binaries (to support alpine + scratch containers)
|
||||
STATICLDFLAGS := -ldflags '-s -extldflags "-static"'
|
||||
# avoid building code that is incompatible with static linking
|
||||
TAGS := -tags netgo,osusergo,sqlite_omit_load_extension
|
||||
TAGS := -tags netgo,osusergo,sqlite_omit_load_extension,sqlite_json
|
||||
|
||||
.PHONY: all
|
||||
all: build lint test
|
||||
all: build test lint
|
||||
|
||||
.PHONY: test
|
||||
test:
|
||||
go test -v $(TAGS) $(STATICLDFLAGS) ./...
|
||||
go test -p 1 $(TAGS) $(STATICLDFLAGS) ./...
|
||||
|
||||
.PHONY: fix
|
||||
fix:
|
||||
|
|
@ -22,9 +22,9 @@ lint:
|
|||
|
||||
.PHONY: wait
|
||||
wait:
|
||||
dist/dbmate-linux-amd64 -e MYSQL_URL wait
|
||||
dist/dbmate-linux-amd64 -e POSTGRESQL_URL wait
|
||||
dist/dbmate-linux-amd64 -e CLICKHOUSE_URL wait
|
||||
dist/dbmate-linux-amd64 -e CLICKHOUSE_TEST_URL wait
|
||||
dist/dbmate-linux-amd64 -e MYSQL_TEST_URL wait
|
||||
dist/dbmate-linux-amd64 -e POSTGRES_TEST_URL wait
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue