Skip to content

Implement Geographic Data Models and Migrations #12

Open
@rsmithlal

Description

@rsmithlal

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:

  1. 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
  2. Define Model Attributes and Associations:

    • Add bt_identifier, bt_protected, and bt_slug attributes to each model.
    • Define associations between models (e.g., belongs_to, has_many).
    • Use bt_references for associations.
  3. Generate Migrations:

    • Create create_bt_table migration for countries.
    • Create create_bt_table migration for states with reference to countries.
    • Create create_bt_table migration for regions with reference to countries.
    • Create create_bt_table migration for cities with references to states and regions.
    • Create create_bt_table migration for districts with references to cities and regions.
    • Create create_bt_table migration for neighborhoods with references to cities and districts.
    • Create create_bt_table migration for streets with references to neighborhoods and cities.
    • Create create_bt_table migration for addresses with references to cities, states, and countries, and a st_point for coordinates.
  4. 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.
  5. Testing:

    • Write model tests for validations and associations.
    • Write migration tests to ensure database structure is correct.
    • Test CRUD operations for each model.
  6. 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.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions