Skip to content

Commit b4f79b8

Browse files
committed
update readme.
1 parent eea9a30 commit b4f79b8

File tree

1 file changed

+5
-38
lines changed

1 file changed

+5
-38
lines changed

README.md

Lines changed: 5 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,6 @@ import (
1313
"gorm.io/gorm"
1414
)
1515

16-
var migrateFlag *bool
17-
18-
func init() {
19-
migrateFlag = flag.Bool("migrate", false, "run the migration.")
20-
}
21-
2216

2317
func main() {
2418
db, _ := gorm.Open(sqlite.Open("gorm.db"), &gorm.Config{})
@@ -71,38 +65,11 @@ func main() {
7165
},
7266
}
7367

74-
flag.Parse()
75-
if *migrateFlag {
76-
err := migo.Run(db, migrations)
77-
if err != nil {
78-
log.Fatalln(err)
79-
}
68+
err := migo.Run(dbClient, migrations, "up", *migo.DefaultOptions.WithPgSchema("<YOUR PGSCHEMA>"))
69+
if err != nil {
70+
log.Fatalln(err)
8071
}
81-
}
82-
83-
```
84-
# Usage
8572

86-
## up
87-
88-
Apply all available migrations.
89-
```sh
90-
$ go run main.go -migrate -pgschema=my_schema_name up
91-
$ 2022/08/25 02:07:27 Migration ran
92-
```
93-
94-
## down
95-
96-
Roll back a single migration from the current version.
97-
```sh
98-
$ go run main.go -migrate -pgschema=my_schema_name down
99-
$ 2022/08/25 02:07:27 Migration ran
100-
```
101-
102-
## gen
73+
}
10374

104-
Generates the current timestamp, you can copy it to use it as an ID to you new migration
105-
```sh
106-
$ go run main.go -migrate gen
107-
$ 20220825031134
108-
```
75+
```

0 commit comments

Comments
 (0)