peterldowns / pgtestdb

quickly run tests in their own temporary, isolated, postgres databases
MIT License
186 stars 14 forks source link

Add tern migrator #10

Closed WillAbides closed 2 months ago

WillAbides commented 4 months ago

I heard about this project at gophercon, and I would like to try it out. The project I want to use it for uses https://github.com/jackc/tern for migrations. Would you consider a PR implementing a tern migrator?

peterldowns commented 4 months ago

Hi Will, thanks for asking before getting started. Yes, I would happily accept a PR contributing a tern migrator, and I can take on any maintenance/updating work necessary after the initial contribution.

I haven't used Tern before but based on their readme docs it should be fairly straightforward to call it as a library:

All the actual functionality of tern is in the github.com/jackc/tern/v2/migrate library. If you need to embed migrations into your own application this library can help. If you don't need the full functionality of tern, then a migration generator script as described below may be a easier way of embedding simple migrations.

I would generally recommend/prefer this approach, but if need be, you can always fall back to calling the tern cli tool similar to how the atlasmigrator does it.

WillAbides commented 4 months ago

Great. I already have an internal tool that is pretty similar to pgtestdb. I should be able to port over the migrator pretty easily.

peterldowns commented 4 months ago

Awesome. I'll do my best to review and merge any submission in a timely manner, but heads up that this is a somewhat busy time of the year for me. Thanks again for being interested in contributing. Please let me know if you have any questions or suggestions for improvement, and apologies in advance for anything confusing you run into.