Description
We need to implement a series of geographic data models within the BetterTogether
namespace, nested under a Geography
module. These models will represent various geographic entities such as countries, states, regions, cities, districts, neighborhoods, streets, and addresses. Each model will have specific attributes and associations. The migrations will set up the necessary database tables with appropriate columns and relationships.
Tasks:
-
Create Models:
-
BetterTogether::Geography::Country
-
BetterTogether::Geography::State
-
BetterTogether::Geography::Region
-
BetterTogether::Geography::City
-
BetterTogether::Geography::District
-
BetterTogether::Geography::Neighborhood
-
BetterTogether::Geography::Street
-
BetterTogether::Geography::Address
-
-
Define Model Attributes and Associations:
- Add
bt_identifier
,bt_protected
, andbt_slug
attributes to each model. - Define associations between models (e.g.,
belongs_to
,has_many
). - Use
bt_references
for associations.
- Add
-
Generate Migrations:
- Create
create_bt_table
migration forcountries
. - Create
create_bt_table
migration forstates
with reference tocountries
. - Create
create_bt_table
migration forregions
with reference tocountries
. - Create
create_bt_table
migration forcities
with references tostates
andregions
. - Create
create_bt_table
migration fordistricts
with references tocities
andregions
. - Create
create_bt_table
migration forneighborhoods
with references tocities
anddistricts
. - Create
create_bt_table
migration forstreets
with references toneighborhoods
andcities
. - Create
create_bt_table
migration foraddresses
with references tocities
,states
, andcountries
, and ast_point
for coordinates.
- Create
-
Implement Models:
- Implement
BetterTogether::Geography::Country
model. - Implement
BetterTogether::Geography::State
model. - Implement
BetterTogether::Geography::Region
model. - Implement
BetterTogether::Geography::City
model. - Implement
BetterTogether::Geography::District
model. - Implement
BetterTogether::Geography::Neighborhood
model. - Implement
BetterTogether::Geography::Street
model. - Implement
BetterTogether::Geography::Address
model.
- Implement
-
Testing:
- Write model tests for validations and associations.
- Write migration tests to ensure database structure is correct.
- Test CRUD operations for each model.
-
Documentation:
- Update README with new models and their attributes.
- Document the database schema changes.
- Add usage examples for each geographic entity.
Please make sure to create a branch for this implementation and open a pull request once the tasks are completed. Let’s ensure all tests pass before merging the changes into the main branch.
This checklist covers the major tasks required to implement the geographic data models and their migrations, ensuring that each step is tracked and documented properly.