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:
Adrian Macneil 2020-11-19 15:04:42 +13:00 committed by GitHub
parent c907c3f5c6
commit 61771e386d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
23 changed files with 1195 additions and 1078 deletions

View file

@ -11,9 +11,10 @@ services:
- postgres
- clickhouse
environment:
MYSQL_URL: mysql://root:root@mysql/dbmate
POSTGRESQL_URL: postgres://postgres:postgres@postgres/dbmate?sslmode=disable
CLICKHOUSE_URL: clickhouse://clickhouse:9000?database=dbmate
CLICKHOUSE_TEST_URL: clickhouse://clickhouse:9000?database=dbmate_test
MYSQL_TEST_URL: mysql://root:root@mysql/dbmate_test
POSTGRES_TEST_URL: postgres://postgres:postgres@postgres/dbmate_test?sslmode=disable
SQLITE_TEST_URL: sqlite3:/tmp/dbmate_test.sqlite3
dbmate:
build: