elixirmoney / money

Elixir library for working with Money safer, easier, and fun... Is an interpretation of the Fowler's Money pattern in fun.prog.
https://hex.pm/packages/money/
MIT License
827 stars 141 forks source link

Suggest using varchar instead of char on postgres #178

Closed michelboaventura closed 2 years ago

michelboaventura commented 2 years ago

The type char has a fixed length and automatically blank pads the field. So if you create the field with char(5) and uses USD it'll be stored as USD, which will break Money's ability to load the value back. The correct type should be varchar instead. This isn't a big problem working with regular currencies since they all have three letters names, but when you enter crypto world there are currencies with 2, 3 and 4 letters.

Nitrino commented 2 years ago

@michelboaventura Thanks 👍🏻