hcb
hcb copied to clipboard
[1/4] Migrate from CountryEnumable to ISO3166::Country Alpha2
🔁 Migrate from CountryEnumable to ISO3166::Country Alpha2 (1/4)
🧠 Context
We're deprecating our custom CountryEnumable::country_enum_list (which maps countries to integers) in favor of ISO3166::Country, which uses standard alpha2 codes ("US", "IN", etc.). This shift will simplify country handling across the codebase and reduce redundancy.
This is Step 1 of a 4 part migration process
✅ Changes in this PR
- Adds new
country_alpha2(string) columns via migration:-
events.country_alpha2 -
wires.country_alpha2
-
- Adds
before_savehooks to auto-populatecountry_alpha2based on existing:-
event.country -
wire.recipient_country
-
- Removes:
-
include CountryEnumable -
has_country_enumfrom theEventmodel to begin decoupling from the legacy enum system.
-
Overview
- Add
country_alpha2columns + save hooks (this PR ✅ - Backfill alpha2 values from existing integer data
- Update app logic to use
country_alpha2(UI, filters, validations) - Drop old enum fields + delete
CountryEnumable
Existing behavior using event.country or wire.recipient_country should remain intact for now