dbmate 2.18.0 → 2.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +33 -18
- package/package.json +8 -8
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
Dbmate is a database migration tool that will keep your database schema in sync across multiple developers and your production servers.
|
|
8
8
|
|
|
9
|
-
It is a standalone command line tool that can be used with Go, Node.js, Python, Ruby, PHP, or any other language or framework you are using to write database-backed applications. This is especially helpful if you are writing multiple services in different languages, and want to maintain some sanity with consistent development tools.
|
|
9
|
+
It is a standalone command line tool that can be used with Go, Node.js, Python, Ruby, PHP, Rust, C++, or any other language or framework you are using to write database-backed applications. This is especially helpful if you are writing multiple services in different languages, and want to maintain some sanity with consistent development tools.
|
|
10
10
|
|
|
11
11
|
For a comparison between dbmate and other popular database schema migration tools, please see [Alternatives](#alternatives).
|
|
12
12
|
|
|
@@ -23,6 +23,7 @@ For a comparison between dbmate and other popular database schema migration tool
|
|
|
23
23
|
- [SQLite](#sqlite)
|
|
24
24
|
- [ClickHouse](#clickhouse)
|
|
25
25
|
- [BigQuery](#bigquery)
|
|
26
|
+
- [Spanner](#spanner)
|
|
26
27
|
- [Creating Migrations](#creating-migrations)
|
|
27
28
|
- [Running Migrations](#running-migrations)
|
|
28
29
|
- [Rolling Back Migrations](#rolling-back-migrations)
|
|
@@ -50,7 +51,7 @@ For a comparison between dbmate and other popular database schema migration tool
|
|
|
50
51
|
- Database connection URL is defined using an environment variable (`DATABASE_URL` by default), or specified on the command line
|
|
51
52
|
- Built-in support for reading environment variables from your `.env` file
|
|
52
53
|
- Easy to distribute, single self-contained binary
|
|
53
|
-
-
|
|
54
|
+
- Doesn't try to upsell you on a SaaS service
|
|
54
55
|
|
|
55
56
|
## Installation
|
|
56
57
|
|
|
@@ -85,7 +86,7 @@ $ sudo chmod +x /usr/local/bin/dbmate
|
|
|
85
86
|
Install using [Scoop](https://scoop.sh)
|
|
86
87
|
|
|
87
88
|
```pwsh
|
|
88
|
-
scoop install dbmate
|
|
89
|
+
$ scoop install dbmate
|
|
89
90
|
```
|
|
90
91
|
|
|
91
92
|
**Docker**
|
|
@@ -104,20 +105,6 @@ If you wish to create or apply migrations, you will need to use Docker's [bind m
|
|
|
104
105
|
$ docker run --rm -it --network=host -v "$(pwd)/db:/db" ghcr.io/amacneil/dbmate new create_users_table
|
|
105
106
|
```
|
|
106
107
|
|
|
107
|
-
**Heroku**
|
|
108
|
-
|
|
109
|
-
To use dbmate on Heroku, either use the NPM method, or store the linux binary in your git repository:
|
|
110
|
-
|
|
111
|
-
```sh
|
|
112
|
-
$ mkdir -p bin
|
|
113
|
-
$ curl -fsSL -o bin/dbmate https://github.com/amacneil/dbmate/releases/latest/download/dbmate-linux-amd64
|
|
114
|
-
$ chmod +x bin/dbmate
|
|
115
|
-
$ git add bin/dbmate
|
|
116
|
-
$ git commit -m "Add dbmate binary"
|
|
117
|
-
$ git push heroku master
|
|
118
|
-
$ heroku run bin/dbmate --help
|
|
119
|
-
```
|
|
120
|
-
|
|
121
108
|
## Commands
|
|
122
109
|
|
|
123
110
|
```sh
|
|
@@ -291,18 +278,20 @@ DATABASE_URL="clickhouse://username:password@127.0.0.1:9000/database_name?on_clu
|
|
|
291
278
|
[See other supported connection options](https://github.com/ClickHouse/clickhouse-go#dsn).
|
|
292
279
|
|
|
293
280
|
#### BigQuery
|
|
281
|
+
|
|
294
282
|
Follow the following format for `DATABASE_URL` when connecting to actual BigQuery in GCP:
|
|
295
283
|
|
|
296
284
|
```
|
|
297
285
|
bigquery://projectid/location/dataset
|
|
298
286
|
```
|
|
287
|
+
|
|
299
288
|
`projectid` (mandatory) - Project ID
|
|
300
289
|
|
|
301
290
|
`dataset` (mandatory) - Dataset name within the Project
|
|
302
291
|
|
|
303
292
|
`location` (optional) - Where Dataset is created
|
|
304
293
|
|
|
305
|
-
|
|
294
|
+
_NOTE: Follow [this doc](https://cloud.google.com/docs/authentication/provide-credentials-adc) on how to set `GOOGLE_APPLICATION_CREDENTIALS` environment variable for proper Authentication_
|
|
306
295
|
|
|
307
296
|
Follow the following format if trying to connect to a custom endpoint e.g. [BigQuery Emulator](https://github.com/goccy/bigquery-emulator)
|
|
308
297
|
|
|
@@ -312,6 +301,32 @@ bigquery://host:port/projectid/location/dataset?disable_auth=true
|
|
|
312
301
|
|
|
313
302
|
`disable_auth` (optional) - Pass `true` to skip Authentication, use only for testing and connecting to emulator.
|
|
314
303
|
|
|
304
|
+
#### Spanner
|
|
305
|
+
|
|
306
|
+
Spanner support is currently limited to databases using the [PostgreSQL Dialect](https://cloud.google.com/spanner/docs/postgresql-interface), which must be chosen during database creation. For future Spanner with GoogleSQL support, see [this discussion](https://github.com/amacneil/dbmate/discussions/369).
|
|
307
|
+
|
|
308
|
+
Spanner with the Postgres interface requires that the [PGAdapter](https://cloud.google.com/spanner/docs/pgadapter) is running. Use the following format for `DATABASE_URL`, with the host and port set to where the PGAdapter is running:
|
|
309
|
+
|
|
310
|
+
```shell
|
|
311
|
+
DATABASE_URL="spanner-postgres://127.0.0.1:5432/database_name?sslmode=disable"
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
Note that specifying a username and password is not necessary, as authentication is handled by the PGAdapter (they will be ignored by the PGAdapter if specified).
|
|
315
|
+
|
|
316
|
+
Other options of the [postgres driver](#postgresql) are supported.
|
|
317
|
+
|
|
318
|
+
Spanner also doesn't allow DDL to be executed inside explicit transactions. You must therefore specify `transaction:false` on migrations that include DDL:
|
|
319
|
+
|
|
320
|
+
```sql
|
|
321
|
+
-- migrate:up transaction:false
|
|
322
|
+
CREATE TABLE ...
|
|
323
|
+
|
|
324
|
+
-- migrate:down transaction:false
|
|
325
|
+
DROP TABLE ...
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
Schema dumps are not currently supported, as `pg_dump` uses functions that are not provided by Spanner.
|
|
329
|
+
|
|
315
330
|
### Creating Migrations
|
|
316
331
|
|
|
317
332
|
To create a new migration, run `dbmate new create_users_table`. You can name the migration anything you like. This will create a file `db/migrations/20151127184807_create_users_table.sql` in the current directory:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dbmate",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.19.0",
|
|
4
4
|
"description": "A lightweight, framework-agnostic database migration tool",
|
|
5
5
|
"repository": "https://github.com/amacneil/dbmate",
|
|
6
6
|
"homepage": "https://github.com/amacneil/dbmate#readme",
|
|
@@ -24,12 +24,12 @@
|
|
|
24
24
|
"build": "tsc --build"
|
|
25
25
|
},
|
|
26
26
|
"optionalDependencies": {
|
|
27
|
-
"@dbmate/linux-ia32": "2.
|
|
28
|
-
"@dbmate/linux-x64": "2.
|
|
29
|
-
"@dbmate/linux-arm": "2.
|
|
30
|
-
"@dbmate/linux-arm64": "2.
|
|
31
|
-
"@dbmate/darwin-x64": "2.
|
|
32
|
-
"@dbmate/darwin-arm64": "2.
|
|
33
|
-
"@dbmate/win32-x64": "2.
|
|
27
|
+
"@dbmate/linux-ia32": "2.19.0",
|
|
28
|
+
"@dbmate/linux-x64": "2.19.0",
|
|
29
|
+
"@dbmate/linux-arm": "2.19.0",
|
|
30
|
+
"@dbmate/linux-arm64": "2.19.0",
|
|
31
|
+
"@dbmate/darwin-x64": "2.19.0",
|
|
32
|
+
"@dbmate/darwin-arm64": "2.19.0",
|
|
33
|
+
"@dbmate/win32-x64": "2.19.0"
|
|
34
34
|
}
|
|
35
35
|
}
|