@@ -72,10 +72,11 @@ And please give some love to our featured sponsors 🤩:
72
72
73
73
## Setup
74
74
75
- ` graphile-migrate ` requires two databases: the first is your main database
76
- against which you perform development, the second is a "shadow" database which
75
+ In development, ` graphile-migrate ` requires two databases in development: the
76
+ first is your main development database , the second is a "shadow" database which
77
77
is used by the system to test migrations are consistent. You should never
78
- interact with the "shadow" database directly.
78
+ interact with the "shadow" database directly. In production you'll only have the
79
+ main database.
79
80
80
81
All members of your team should run the same PostgreSQL version to ensure that
81
82
the shadow dump matches for everyone (one way of achieving this is through
@@ -88,7 +89,7 @@ Tracking this file in git will allow you to easily see the changes that
88
89
different migrations are making, so you can be sure you're making the changes
89
90
you intend to. We recommend that you dump the shadow database as it will be
90
91
unaffected by the iteration you've been applying to your development database
91
- (which may have come out of sync).
92
+ (which may have come out of sync - see 'Drift' below ).
92
93
93
94
### Getting started
94
95
@@ -105,6 +106,13 @@ should be a superuser account connection to any **other** database (most
105
106
PostgreSQL servers have a default database called ` postgres ` which is a good
106
107
choice for this).
107
108
109
+ ``` bash
110
+ export DATABASE_URL=" postgres://appuser:password@localhost/myapp"
111
+ export SHADOW_DATABASE_URL=" postgres://appuser:password@localhost/myapp_shadow"
112
+
113
+ export ROOT_DATABASE_URL=" postgres://postgres:postgres@localhost/postgres"
114
+ ```
115
+
108
116
> Your database URL is needed for most Graphile Migrate commands. The shadow
109
117
> database URL is needed for the development-only commands ` commit ` , ` uncommit `
110
118
> and ` reset ` . The root database URL is needed to drop and recreate databases,
@@ -115,13 +123,6 @@ choice for this).
115
123
> production (you only need the ` graphile-migrate migrate ` command in
116
124
> production) unless you have actions that need them.
117
125
118
- ``` bash
119
- export DATABASE_URL=" postgres://appuser:password@localhost/myapp"
120
- export SHADOW_DATABASE_URL=" postgres://appuser:password@localhost/myapp_shadow"
121
-
122
- export ROOT_DATABASE_URL=" postgres://postgres:postgres@localhost/postgres"
123
- ```
124
-
125
126
Then run:
126
127
127
128
``` bash
@@ -382,15 +383,6 @@ Options:
382
383
<!-- CLI_USAGE_END -->
383
384
<!-- prettier-ignore-end -->
384
385
385
- ## Library usage
386
-
387
- It's possible to consume this module as a JavaScript library rather than via the
388
- CLI. There's no documentation on this, but the CLI code in ` cli.ts ` is very
389
- approachable.
390
-
391
- ALPHA WARNING: internals are likely to change a lot, so expect breakage if you
392
- use library mode right now. CLI is more stable.
393
-
394
386
## Configuration
395
387
396
388
Configuration can be stored in a ` .gmrc ` JSON5 file (compatible with JSON and
@@ -721,6 +713,7 @@ make breaking changes to the programmatic API in patch releases (though this has
721
713
not happened yet and is unlikely to happen without good reason). Should you need
722
714
to use the programmatic API, please get in touch to encourage us to make this a
723
715
supported interface ─ we'd love to know how you're using it!
716
+ [src/cli.ts](src/cli.ts) is the best place to start.
724
717
725
718
The project as a whole is stable, but the approach is still "experimental", in
726
719
particular:
0 commit comments