So what do you guys think of taking some `country_...
# general
b
So what do you guys think of taking some
country_id
columns and converting them to
country_iso
as the foreign key?
k
Interesting, what’s the benefit exactly?
b
If you need to filter based on a state or country iso, you do not need to keep doing joins. This was quite annoying over at Bevv. Instead everything would have an iso as the foreign key linked to the
spree_countries
and
spree_states
tables. Essentially saves a join. Then you can look up the actual data in memory with Carmen or go fetch from the database table.
k
In general, I think it might be a good idea. I’d like to understand if there’s a path to introduce the change in a backward compatible way
b
Yeah, that would be valuable. It could just be extracted to its own gem and we begin using foreign keys with that extracted gem.
Boom! Two fewer tables in the database 😛
k
Ah, please consider completed orders in the past as well, if you update carmen and some countries/states reference change, it might be hard to find the right information in the future. Not sure how Carmen internal references are updated though, and also if it’s realistic that they change.