File tree Expand file tree Collapse file tree 3 files changed +28
-2
lines changed Expand file tree Collapse file tree 3 files changed +28
-2
lines changed Original file line number Diff line number Diff line change @@ -91,12 +91,12 @@ $ pg-schema-diff plan --dsn "postgres://postgres:postgres@localhost:5432/postgre
9191# Install
9292## CLI
9393``` bash
94- go install github.com/stripe/pg-schema-diff/cmd/pg-schema-diff
94+ go install github.com/stripe/pg-schema-diff/cmd/pg-schema-diff@latest
9595```
9696
9797## Library
9898``` bash
99- go get -u github.com/stripe/pg-schema-diff
99+ go get -u github.com/stripe/pg-schema-diff@latest
100100```
101101# Using CLI
102102## 1. Apply schema to fresh database
Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ var rootCmd = &cobra.Command{
1515func init () {
1616 rootCmd .AddCommand (buildPlanCmd ())
1717 rootCmd .AddCommand (buildApplyCmd ())
18+ rootCmd .AddCommand (buildVersionCmd ())
1819}
1920
2021func main () {
Original file line number Diff line number Diff line change 1+ package main
2+
3+ import (
4+ "fmt"
5+ "runtime/debug"
6+
7+ "github.com/spf13/cobra"
8+ )
9+
10+ func buildVersionCmd () * cobra.Command {
11+ cmd := & cobra.Command {
12+ Use : "version" ,
13+ Short : "Get the version of pg-schema-diff" ,
14+ }
15+ cmd .RunE = func (_ * cobra.Command , _ []string ) error {
16+ buildInfo , ok := debug .ReadBuildInfo ()
17+ if ! ok {
18+ return fmt .Errorf ("build information not available" )
19+ }
20+ fmt .Printf ("version=%s\n " , buildInfo .Main .Version )
21+
22+ return nil
23+ }
24+ return cmd
25+ }
You can’t perform that action at this time.
0 commit comments