Commit graph

181 commits

Author SHA1 Message Date
Matthew Wraith
81fe01b34f
Postgres defaults to unix socket (#230) 2021-12-17 16:44:14 -08:00
Eng Zer Jun
fb17e8eeca
refactor: move from io/ioutil to io and os package (#236)
The `io/ioutil` package has been deprecated in Go 1.16. This commit replaces the existing `io/ioutil` functions with their new definitions in `io` and `os` packages.

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2021-08-26 21:13:37 -07:00
Adrian Macneil
6243c2b9a9
Update readme with new docker image (#225) 2021-07-22 23:57:17 +00:00
Adrian Macneil
26d5f9f306
Strip leading 'v' for docker image tags (#224) 2021-07-22 23:09:57 +00:00
Adrian Macneil
511336d346
v1.12.1 (#223) 2021-07-22 15:40:15 -07:00
Adrian Macneil
4a3698c7ac
Publish Docker image (#220) 2021-07-22 15:19:10 -07:00
Adrian Macneil
7c6f9ed747
Add vscode config (#222) 2021-07-22 17:33:35 +00:00
Adrian Macneil
cdbbdd65ea
Add Apple silicon (darwin/arm64) build (#211) 2021-04-07 21:16:18 +00:00
Lucas Bremgartner
abd02b7f0b
Update features for golang-migrate (#205) 2021-04-07 14:03:39 -07:00
Adrian Macneil
b020782b0e
v1.12.0 (#210) 2021-04-07 13:51:50 -07:00
Ilia Ablamonov
7b92033d1b
Support non-UTC timezones (#208)
Fix #207
2021-04-02 21:34:22 +00:00
Matt Snider
08022422d4
mysql: Fix escaping of '+' character in passwords (#200)
Fixes #199
2021-03-09 07:46:36 +00:00
Jae Bentvelzen
ece2c3c122
Improve error message when database URL is missing (#202) 2021-03-08 23:44:30 -08:00
Adrian Macneil
53c9c19e82
master -> main (#201) 2021-03-04 22:04:14 +00:00
Adrian Macneil
0c758a8d9f
Go v1.16 (#196) 2021-02-22 11:26:35 -08:00
Bouke van der Bijl
2bac2c7590
Write log lines to DB.Log output (#195)
This makes it possible to redirect the logs somewhere else, useful if you embed dbmate into your application.
2021-02-18 14:10:57 -08:00
Adrian Macneil
454f93a000
Document --migrations--table flag (#186)
Also reordered some of the readme sections and added a table of contents.

Closes https://github.com/amacneil/dbmate/issues/185
2020-12-12 16:54:02 -08:00
Adrian Macneil
61771e386d
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).
2020-11-19 15:04:42 +13:00
Adrian Macneil
c907c3f5c6
Ability to specify custom migrations table name (#178)
Supported via `--migrations-table` CLI flag or `DBMATE_MIGRATIONS_TABLE` environment variable.

Specified table name is quoted when necessary.

For PostgreSQL specifically, it's also possible to specify a custom schema (for example: `--migrations-table=foo.migrations`).

Closes #168
2020-11-17 18:11:24 +13:00
Adrian Macneil
656dc0253a
Update docs (#175) 2020-11-10 14:09:53 +13:00
Adrian Macneil
c2b14bb7e0
v1.11.0 (#174) 2020-11-10 12:38:51 +13:00
Adrian Macneil
e44e09eb67
Migrate CI to GitHub Actions (#171) 2020-11-02 20:22:59 +13:00
Enrico
2950db7131
mysql: Create the schema_migrations table using latin1 charset (#172)
Force the `schema_migrations` table to be created with `latin1` character set, to fix the behavior of dbmate in MariaDB 10.1 and older (or MySQL 5.6 and older) when the system charset has more than 1 byte per character (e.g. utf8mb4)

Closes #85
2020-11-02 12:02:28 +13:00
Adrian Macneil
5b7e6cef18
Add codeql-analysis.yml (#163) 2020-11-01 18:30:30 +13:00
Adrian Macneil
203065661c
Properly check errors from sql.Rows (#170) 2020-11-01 15:30:20 +13:00
Adrian Macneil
ac718a23dc
postgres: Automatically create search_path schema when needed (#169)
In #167 we added support for specifying a postgres `search_path`, which is used to store the `schema_migrations` table. However, if the schema does not already exist it will cause an error.

In this PR we automatically create the first schema in the `search_path` if it does not exist.
2020-11-01 15:09:13 +13:00
Adrian Macneil
55a8065efe
postgres: Support custom schema for schema_migrations table (#167)
Instead of hardcoding `schema_migrations` table to the `public` schema, add support for specifying a schema via the `search_path` URL parameter.

**Backwards compatibility note**: If anyone was using the previously undocumented `search_path` behavior (affecting migrations themselves, but always storing the `schema_migrations` table in `public`), you will need to either prepend `public` to your `search_path`, or migrate your `schema_migrations` table to your primary schema:

```sql
ALTER TABLE public.schema_migrations SET SCHEMA myschema;
```

Closes #110
2020-11-01 13:30:35 +13:00
Adrian Macneil
d4ecd0b259
postgres: Limit pg_dump to schemas in search_path (#166) 2020-10-31 17:13:49 +13:00
Adrian Macneil
af41fbfb4e
Make golint happy (#165) 2020-10-30 19:04:02 +13:00
Adrian Macneil
2b3f59fbe3
Go v1.15 (#161) 2020-09-27 14:50:30 -07:00
Adrian Macneil
26f17d5141
Document migration order (#160) 2020-09-24 10:14:31 -07:00
Adrian Macneil
616c4fe442
v1.10.0 (#158) 2020-08-13 08:30:58 -07:00
Adrian Macneil
4387633e1f
Add sql clients to docker image (#157)
Instead of a nice super-minimal production docker image, create one based on alpine with sql clients installed (`mariadb-client`, `postgresql-client`, and `sqlite`).

* Increases docker image size from 10 MB to 56 MB 👎 
* Allows people to run `dbmate dump` command with our docker image (fixes #114) 👍 
* I'm not sure what compatibility is like between `mysqldump` from `mariadb-client` versus `mysql-client`, but starting here since mariadb is included with alpine, and the version I built using mysql and ubuntu weighed in at 165 MB. 🤔
2020-08-11 15:36:07 -07:00
Adrian Macneil
4581acafad
Build statically linked binaries (#156)
Prior to this commit, we released two linux binaries:

* `dbmate-linux-amd64` (built with cgo, dynamically linked)
* `dbmate-linux-musl-amd64` (built without cgo, statically linked, no sqlite support)

The statically linked binary is desirable for alpine linux users (or anyone else using musl libc or minimal docker images). The original reason for having two separate binaries was that the easiest method to create a static binary for go is to set `CGO_ENABLED=0`, but unfortunately this also prevented us from building sqlite (which requires cgo).

With this commit, all linux and windows binaries are explicitly statically linked while leaving cgo enabled. Hat tip to https://www.arp242.net/static-go.html which explained the necessary flags to enable this.

As an added bonus, the `dbmate` docker image now now uses a `scratch` base rather than `gcr.io/distroless/base`, reducing the image size from 26.7 MB to 9.8 MB.
2020-08-11 13:05:55 -07:00
Adrian Macneil
df461ff6c7
Add linux/arm64 build (#155) 2020-08-08 16:25:13 -07:00
Adrian Macneil
073efc996e
Update README.md (#154) 2020-08-08 12:30:22 -07:00
Adrian Macneil
24b3fccacd
Update RELEASING.md (#153) 2020-08-08 11:58:46 -07:00
Adrian Macneil
b41a73d70c
Ignore db directory (#151) 2020-08-08 11:58:25 -07:00
Adrian Macneil
9e2d1b8c3b
Allow setting flags via environment variables (#152) 2020-08-08 11:50:45 -07:00
Adrian Macneil
a9aaaad1fb
Add --url flag (#150) 2020-08-08 11:19:33 -07:00
Adrian Macneil
d1b3334ff7
Update dependencies (#149) 2020-08-07 18:45:32 -07:00
Adrian Macneil
0775179987
Update to urfave/cli v2 (#148) 2020-08-07 18:09:03 -07:00
Adrian Macneil
23aa907644
Add Homebrew release action (#147) 2020-08-07 13:45:35 -07:00
Ilia Ablamonov
c2dd1bd5af
Add ClickHouse support (#140) 2020-08-07 13:38:48 -07:00
Adrian Macneil
8234882546
v1.9.1 (#146) 2020-07-19 15:23:14 -07:00
Adrian Macneil
11c251bd25
Redact passwords in error messages (#145)
Fixes #144
2020-07-19 15:04:45 -07:00
Viswesh Periyasamy
2b61b4375a
updating version (#141) 2020-06-25 13:57:09 -07:00
Viswesh Periyasamy
24705c5d01
adding verbose output for statement execution (#138)
* adding verbose output for statement execution

* fixing lint and redefined v flag

* changing name due to inherited verbose flag and updating README

* linting

* moving verbose flag to subcommand, removing driver verbose, adding tests

* fixing README, cleaning up spacing
2020-06-25 12:26:09 -07:00
Adrian Macneil
5e128ae6a6
Update README.md (#137) 2020-05-24 20:42:33 -07:00
Nikita Konev
079523c25f Add --wait-timeout option (#127)
Closes #127
2020-05-24 19:51:36 -07:00