netlify / gotrue

An SWT based API for managing users and issuing SWT tokens.
https://www.gotrueapi.org
MIT License
3.82k stars 283 forks source link

feat: use Gorm.io instead of soda/pop #275

Closed jrapoport closed 3 years ago

jrapoport commented 3 years ago

- Summary Drop soda/pop in favor of gorm.io. gorm is easier to use and maintain. changing a model now involves adding the field to the struct, and that's it. It will automatically migrate changes based on the struct itself, and is now completely self-contained — meaning no more migration path or sql files. On Dial() it will now automatically create the DB (if needed)and set everything up/migrate any changes. More complex migrations (i.e. moving data) would require code, but that is supported by gorm and easy enough to add. This also adds support for sqlserver, postgres, and sqlite. There are also a number of other gorm drivers available for things like AWS.

- Test plan

passing

- Description for the changelog

removes soda/pop & related files in favor of gorm.io. db setup & migration is now automatic and self-contained.

- A picture of a cute animal (not mandatory but encouraged) happy-pupper

jrapoport commented 3 years ago

idk what is up with the label failing. I added "feat:" 🤷🏻‍♂️

mraerino commented 3 years ago

@jrapoport thanks for your contribution.

it's very unlikely that we'll switch this service to use gorm. we use pop or sqlx in most systems at netlify today and don't feel confident enough for production use of gorm.

the main reason is that we have a strong preference towards explicit migrations that are applied manually. it's hard to recover our production systems from a failed migration. at some point we might have better tooling to address this concern, but for now, this is a limit we'll keep.

jrapoport commented 3 years ago

I'm dropping a link here for anyone that finds this and wants to use it: https://github.com/jrapoport/gothic

it started off as a PR/ fork, but has since been completely rewritten.