1- # Schema dumping (obtuse version, do not implement)
2-
3- ** breaks plpgsql lsp extension, would need opt migration names to skip regex option,
4- or via flag on top of the file (preferred)**
5-
6- Eventually, accumulated migrations will take too long to run compared to
7- creating the final schema in one go.
8- You can create a new migration via ` project migrate.create x_schema_dump ` (must be named
9- x_schema_dump).
10- These migration files will be detected before executing ` up ` migrations.
11-
12- The latest x_schema_dump migration will be the new reference point for further
13- migrations.
14-
15- If current revision is 0 (i.e. ` error: no migration ` exit 1),
16- it will execute ` force $((latest_schema_dump_revision - 1)) `
17- and then ` up ` normally. Ideal for tests, gen db, etc.
18-
19- If current revision is within 1 and ` $((latest_schema_dump_revision -1)) ` (e.g.
20- in prod environment)
21- it will skip all x_schema_dump migrations in between, executing
22- ` goto $((schema_dump_revision - 1)) ` and then ` force $schema_dump_revision ` in ascending x_schema_dump
23- migrations order.
24-
25- In any other case, it simply runs ` up ` as usual.
1+ > # Schema dumping (obtuse version, do not implement)
2+ > ** breaks plpgsql lsp extension, would need opt migration names to skip regex > option,
3+ > or via flag on top of the file (preferred)**
4+ >
5+ > Eventually, accumulated migrations will take too long to run compared to
6+ > creating the final schema in one go.
7+ > You can create a new migration via ` project migrate.create x_schema_dump ` > (must be named
8+ > x_schema_dump).
9+ > These migration files will be detected before executing ` up ` migrations.
10+ >
11+ > The latest x_schema_dump migration will be the new reference point for further
12+ > migrations.
13+ >
14+ > If current revision is 0 (i.e. ` error: no migration ` exit 1),
15+ > it will execute ` force $((latest_schema_dump_revision - 1)) `
16+ > and then ` up ` normally. Ideal for tests, gen db, etc.
17+ >
18+ > If current revision is within 1 and ` $((latest_schema_dump_revision -1)) ` (e.g.
19+ > in prod environment)
20+ > it will skip all x_schema_dump migrations in between, executing
21+ > ` goto $((schema_dump_revision - 1)) ` and then ` force $schema_dump_revision ` in > ascending x_schema_dump
22+ > migrations order.
23+ >
24+ > In any other case, it simply runs ` up ` as usual.
2625
2726
2827# Schema dumping (less obtuse version)
@@ -36,9 +35,10 @@ project db.bash
3635```
3736
3837TODO: all comments will be lost. should instead make use of comments on tables
39- instead of sql comments so they're saved after migrating a to a schema dump
38+ instead of sql comments so they're saved after migrating to a schema dump
4039and removing old files. (not like anyone would read old migration files comments
41- anyway). Can use ` project dev-utils.show-table-comments ` to make maintenance easier.
40+ anyway). Can use ` project dev-utils.show-table-comments ` to make maintenance
41+ easier.
4242
4343Once prod is up to date (i.e. revision at latest_schema_dump_revision minus
4444one),
0 commit comments