You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Minor attempt to clear up the behaviour in the documentation (#372)
I'm not sure what is the proper terminology for `public` vs
`public_03_add_column` schemas. Major/main vs minor/specific? I think
there definitely should be a consistent terminology, though.
---------
Co-authored-by: Andrew Farries <andyrb@gmail.com>
Copy file name to clipboardExpand all lines: docs/README.md
+6-4Lines changed: 6 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -539,7 +539,7 @@ The `pgroll` CLI offers the following subcommands:
539
539
The `pgroll` CLI has the following top-level flags:
540
540
*`--postgres-url`: The URL of the postgres instance against which migrations will be run.
541
541
*`--schema`: The Postgres schema in which migrations will be run (default `"public"`).
542
-
*`--pgroll-schema`: The Postgres schema in which `pgroll` will store its internal state (default: `"pgroll"`).
542
+
*`--pgroll-schema`: The Postgres schema in which `pgroll` will store its internal state (default: `"pgroll"`). One `--pgroll-schema` may be used safely with multiple `--schema`s.
543
543
*`--lock-timeout`: The Postgres `lock_timeout` value to use for all `pgroll` DDL operations, specified in milliseconds (default `500`).
544
544
*`--role`: The Postgres role to use for all `pgroll` DDL operations (default: `""`, which doesn't set any role).
545
545
@@ -572,9 +572,11 @@ The tables and functions in this schema store `pgroll`'s internal state and are
572
572
$ pgroll start sql/03_add_column.json
573
573
```
574
574
575
-
This starts the migration defined in the `sql/01_create_table.json` file.
575
+
This starts the migration defined in the `sql/03_add_column.json` file.
576
576
577
-
After starting a migration there will be two schema versions in the database; one for the old schema before the migration and one for the new version with the schema changes.
577
+
After starting a migration there will be two schema versions in the database; one for the old schema before the migration (e.g. `public_02_create_table`) and one for the new version with the schema changes (e.g. `public_03_add_column`). Each of these schemas merely contains views on the tables in the `public` schema.
578
+
579
+
#### Using `pgroll start` with the `--complete` flag
578
580
579
581
A migration can be started and completed with one command by specifying the `--complete` flag:
580
582
@@ -598,7 +600,7 @@ This completes the most recently started migration.
598
600
599
601
Running `pgroll complete` when there is no migration in progress is a no-op.
600
602
601
-
Completing a `pgroll` migration removes the previous schema version from the database, leaving only the latest version of the schema.
603
+
Completing a `pgroll` migration removes the previous schema version from the database (e.g. `public_02_create_table`), leaving only the latest version of the schema (e.g. `public_03_add_column`). At this point, any temporary columns and triggers created on the affected tables in the `public` schema will also be cleaned up, leaving the table schema in its final state. Note that the real schema (e.g. `public`) should never be used directly by the client as that is not safe; instead, clients should use the schemas with versioned views (e.g. `public_03_add_column`).
602
604
603
605
:warning: Before running `pgroll complete` ensure that all applications that depend on the old version of the database schema are no longer live. Prematurely running `pgroll complete` can cause downtime of old application instances that depend on the old schema.
0 commit comments