nnjeim / world

A Laravel package which provides a list of the countries, states, cities, currencies, timezones and languages.
MIT License
737 stars 104 forks source link

Add indexes to the main tables #82

Closed soymgomez closed 4 months ago

soymgomez commented 5 months ago

hi,

when testing this package I have seen that it does not have any indication in any table. I think that in terms of performance, especially in the larger tables, it is interesting to have an index for the main search keys of that table.

I am open to any suggestion since I am not a great expert in this field.

Best regards

nnjeim commented 5 months ago

@soymgomez hi, i appreciate your contribution 2 things here: 1- the id in each table is always indexed. no need to call ->index() 2- what remains is the country_id, state_id relationships. By indexing those relationships we need to take care that dropping the tables will cause an issue is not called in a proper way example: drop cities, then states then countries. The point #2 will affect refreshing the package after a new update is released.