jackc / tern

The SQL Fan's Migrator

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Purpose of MigratorOptions.FileSystem (v2-dev)

lzap opened this issue · comments

Hey,

I am looking into the v2-dev branch a bit and I have some concerns about the FileSystem value from the MigratorOptions type. What is it used for? It looks like both LoadMigrations and FindMigrations function do take fs.FS argument already. From the history it looks like it was part of the type, so it is perhaps a leftover? Is the intention to keep using the config type, or to pass the filesystem as arguments?

Thanks!

Just to explain you why there are multiple people (apparently) using the API instead of CLI: your driver and also the tern migrator is a great for for microservices. In this environment, embedding everything into the binary is the easiest option and also typically apps want to automatically migrate on start themselves. That's why (I think) lots of people are using the API, which was perhaps not meant to be used this way from the day one :-)

Feel free to close, I would be happy to provide patch but this is a WIP branch so I am not sure what is happening.

It does appear that that is no longer used. I removed it.


Just to explain you why there are multiple people (apparently) using the API instead of CLI: your driver and also the tern migrator is a great for for microservices.

Glad to hear it. That's not how I typically use it, but making it embeddable was one of the initial design goals.

Thanks. To give you further feedback, the main motivation for us to use tern was that it performs migrations in transactions where as other alternatives do not. For example, go-migrate has some weird "dirty" flag and when migration fails, one needs to investigate what happened and manually change the dirty flag. I have no idea why transactions were not used. Tern is simple and does exactly what it does, also error messages are meaningful :-)

I think most of the problems stem from the fact that other projects aim to be super-generic while tern was written with postgres in mind (and should also work with others but it's not guaranteed I guess).

Anyway, thanks! Cheers.