4 ms·
I personally tend to prefer migrate[1] as it doesn't require java. [1]: https://github.com/golang-migrate/migrate https://github.com/golang-migrate/migrate
by stock_toaster 8y ago
I personally tend to prefer migrate[1] as it doesn't require java.
[1]: https://github.com/golang-migrate/migrate https://github.com/golang-migrate/migrate
- majewsky 8y agoMigrate is awesome! My only issue: Since it uses bare SQL for the migrations, you have to do some lifting if you need to support multiple RDBMS with different DDLs. I have some regexes in my project to translate Postgres DDL into SQLite DDL for my test suite.
- dam5s 8y agoWhy would you not test your code with the same RDBMS you will have in production? Especially if it’s something as easy to install as Postgres? It seems like begging for trouble...
- james-mcelwain 8y agoIf you're using an ORM, it can be an easy way to ensure that no vendor specific stuff sneaks in. Also, until recently it was difficult to run, e.g., SQL Server in Docker, so Postgres might be easier to test with. Agreed SQLite is a weird choice, but not all integration tests are robust enough to test characteristics of the underlying db, i.e. focus on business logic not performance.
- majewsky 8y agoI have several dozen tests that run in completely separate DBs. With SQLite, the test suite runs through in 1 second: $ time go test github.com/sapcc/limes/... | grep -v 'no test files' ok github.com/sapcc/limes 0.004s ok github.com/sapcc/limes/pkg/api 0.515s ok github.com/sapcc/limes/pkg/collector 0.449s ok github.com/sapcc/limes/pkg/core 0.006s I doubt that you can setup and tear down several dozen Postgreses in that time.
- axelfontaine 8y agoFlyway doesn't require Java. The CLI ships with a private JRE as well as drivers for most databases out of the box. Simply untar and run.
- zmmmmm 8y agoJava seems ideal as it will be completely cross platform and you can add / update the database drivers after the fact. Migrate has a different binary for each platform and from what I can see, the support for each database is compiled in, so just to update a driver you are going to be maintaining that binary all over the place.