go-pg / migrations

SQL database migrations for Golang go-pg and PostgreSQL
https://godoc.org/github.com/go-pg/migrations
BSD 2-Clause "Simplified" License
309 stars 59 forks source link

Use models from go-pg #86

Closed Lucantas closed 4 years ago

Lucantas commented 4 years ago

Is it possible to use the models from an application using go-pg? The examples only show how to work with sql files, is people actually writing those sql queries in their application or there is a way to get the dynamic query from go-pg to write migrations?

vmihailenco commented 4 years ago

Syre, Go-based migrations (https://github.com/go-pg/migrations/blob/master/example/2_add_id.go) can be any Go code of your choosing. You don't even have to execute SQL queries there.