Skip to content

Commit afa2d94

Browse files
committed
Add readme to script
1 parent c07f2fd commit afa2d94

File tree

2 files changed

+87
-1
lines changed

2 files changed

+87
-1
lines changed

scripts/releasemigrations/README.md

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
# Migration Releases
2+
3+
The `main.go` is a program that lists all releases and which migrations are contained with each upgrade.
4+
5+
# Usage
6+
7+
```bash
8+
releasemigrations [--patches] [--minors] [--majors]
9+
-after-v2
10+
Only include releases after v2.0.0
11+
-dir string
12+
Migration directory (default "coderd/database/migrations")
13+
-list
14+
List migrations
15+
-majors
16+
Include major releases
17+
-minors
18+
Include minor releases
19+
-patches
20+
Include patches releases
21+
-versions string
22+
Comma separated list of versions to use. This skips uses git tag to find tags.
23+
```
24+
25+
# Examples
26+
27+
## Find all migrations between 2 versions
28+
29+
Going from 2.3.0 to 2.4.0
30+
31+
```bash
32+
$ go run scripts/releasemigrations/main.go --list --versions=v2.3.0,v2.4.0 11:47:00 AM
33+
2023/11/21 11:47:09 [minor] 4 migrations added between v2.3.0 and v2.4.0
34+
2023/11/21 11:47:09 coderd/database/migrations/000165_prevent_autostart_days.up.sql
35+
2023/11/21 11:47:09 coderd/database/migrations/000166_template_active_version.up.sql
36+
2023/11/21 11:47:09 coderd/database/migrations/000167_workspace_agent_api_version.up.sql
37+
2023/11/21 11:47:09 coderd/database/migrations/000168_pg_coord_tailnet_v2_api.up.sql
38+
2023/11/21 11:47:09 Patches: 0 (0 with migrations)
39+
2023/11/21 11:47:09 Minors: 1 (1 with migrations)
40+
2023/11/21 11:47:09 Majors: 0 (0 with migrations)
41+
```
42+
43+
## Looking at all patch releases after v2
44+
45+
```bash
46+
$ go run scripts/releasemigrations/main.go --patches --after-v2 11:47:09 AM
47+
2023/11/21 11:48:00 [patch] No migrations added between v2.0.0 and v2.0.1
48+
2023/11/21 11:48:00 [patch] 2 migrations added between v2.0.1 and v2.0.2
49+
2023/11/21 11:48:00 [patch] No migrations added between v2.1.0 and v2.1.1
50+
2023/11/21 11:48:00 [patch] No migrations added between v2.1.1 and v2.1.2
51+
2023/11/21 11:48:00 [patch] No migrations added between v2.1.2 and v2.1.3
52+
2023/11/21 11:48:00 [patch] 1 migrations added between v2.1.3 and v2.1.4
53+
2023/11/21 11:48:00 [patch] 2 migrations added between v2.1.4 and v2.1.5
54+
2023/11/21 11:48:00 [patch] 1 migrations added between v2.3.0 and v2.3.1
55+
2023/11/21 11:48:00 [patch] 1 migrations added between v2.3.1 and v2.3.2
56+
2023/11/21 11:48:00 [patch] 1 migrations added between v2.3.2 and v2.3.3
57+
2023/11/21 11:48:00 Patches: 10 (6 with migrations)
58+
2023/11/21 11:48:00 Minors: 4 (4 with migrations)
59+
2023/11/21 11:48:00 Majors: 0 (0 with migrations)
60+
```
61+
62+
## Seeing all the noise this thing can make
63+
64+
This shows when every migration was introduced.
65+
66+
```bash
67+
$ go run scripts/releasemigrations/main.go --patches --minors --majors --list
68+
# ...
69+
2023/11/21 11:48:31 [minor] 5 migrations added between v2.2.1 and v2.3.0
70+
2023/11/21 11:48:31 coderd/database/migrations/000160_provisioner_job_status.up.sql
71+
2023/11/21 11:48:31 coderd/database/migrations/000161_workspace_agent_stats_template_id_created_at_user_id_include_sessions.up.sql
72+
2023/11/21 11:48:31 coderd/database/migrations/000162_workspace_automatic_updates.up.sql
73+
2023/11/21 11:48:31 coderd/database/migrations/000163_external_auth_extra.up.sql
74+
2023/11/21 11:48:31 coderd/database/migrations/000164_archive_template_versions.up.sql
75+
2023/11/21 11:48:31 [patch] 1 migrations added between v2.3.0 and v2.3.1
76+
2023/11/21 11:48:31 coderd/database/migrations/000165_prevent_autostart_days.up.sql
77+
2023/11/21 11:48:31 [patch] 1 migrations added between v2.3.1 and v2.3.2
78+
2023/11/21 11:48:31 coderd/database/migrations/000166_template_active_version.up.sql
79+
2023/11/21 11:48:31 [patch] 1 migrations added between v2.3.2 and v2.3.3
80+
2023/11/21 11:48:31 coderd/database/migrations/000167_workspace_agent_api_version.up.sql
81+
2023/11/21 11:48:31 [minor] 1 migrations added between v2.3.3 and v2.4.0
82+
2023/11/21 11:48:31 coderd/database/migrations/000168_pg_coord_tailnet_v2_api.up.sql
83+
2023/11/21 11:48:31 Patches: 122 (55 with migrations)
84+
2023/11/21 11:48:31 Minors: 31 (26 with migrations)
85+
2023/11/21 11:48:31 Majors: 1 (1 with migrations)
86+
```

scripts/releasemigrations/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ func main() {
6767
}
6868

6969
func usage() {
70-
_, _ = fmt.Println("Usage: releasemigrations [--patches] [--minors] [--majors]")
70+
_, _ = fmt.Println("Usage: releasemigrations [--patches] [--minors] [--majors] [--list]")
7171
_, _ = fmt.Println("Choose at lease one of --patches, --minors, or --majors. You can choose all!")
7272
_, _ = fmt.Println("Must be run from the coder repo at the root.")
7373
}

0 commit comments

Comments
 (0)