-
Notifications
You must be signed in to change notification settings - Fork 75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support fs.FS #29
base: master
Are you sure you want to change the base?
Support fs.FS #29
Conversation
It seems like there is a general issue with using packages from future go version even with a build tag guarding it golang/go#40067 |
Given the issue above it is maybe better to wait with built in fs.FS support until a new major version of tern which can require Go 1.16 and replaces MigratorFS with fs.FS entirely? |
There is a That said, I already replaced |
Though not pertinent to this issue, I'd love to hear more of your opinions on how to write and use migrations better. If you've written about this elsewhere already, I appreciate any pointers you can share. |
I haven't written this up anywhere but here's a short version. A down migration doesn't make sense in production. If a migration adds a column the down migration would remove it. What about the data in that column? IMHO, it should always be rolled forward to explicitly deal with issues like that. Down migrations are only useful in development. But in development it is better to reset the database and remigrate. The other thing is I have lately been more and more enamored with using server side functions and views. And with that I've come to the opinion that database migrations and database code should be treated separately. SQL code should be installed in its own schema and entirely replaced whenever there is a deploy. This entirely avoids issues with changing a view or function when other views or functions depend on it. (It also could let multiple versions temporarily coexist to allow zero downtime deploys.) |
I don't think many people wants to use down migrations in production, to me they are a last resort to roll back a failing upgrade that hopefully never has to be used. The few times I have used down migrations in production any added columns probably never have been populated to begin with. For local development however I use them quite often to go between feature branches in some projects rolling back the database to master before switching branch. |
In local development I find it faster / simpler to keep a development database premade as a template and and use |
Any news? Maybe we add that feature, who needs - will use. |
Even if we put this behind a build tag older Go versions A fix has been backported to later versions of go 1.15. My vote is to consider adding this somewhere after go 1.18 is released, by then people should be on a go version where this isn't an issue. |
I'll take this out of draft now since go 1.15 compatibility should not be something that is needed anymore because 1.15 has been out of support for a year now. |
I saw that the test was empty, putting back as a draft. |
Note sure about the NewFS function.
I haven't investigated how to test fs.FS stuff yet so I will add tests when I have had time to read how fs.FS works in more detail.