Create new migration files & Eloquent#67
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR establishes database support for world heritage sites that span multiple countries by creating new migration files and Eloquent models. It also simplifies the Docker Compose configuration by removing unnecessary services and streamlining the formatting.
- Creates a countries table and a many-to-many relationship table (site_state_parties) to link world heritage sites with multiple countries
- Adds Country and updated WorldHeritage Eloquent models with proper many-to-many relationships
- Simplifies Docker Compose configuration by removing nginx service and reformatting existing services
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/database/migrations/2025_08_18_080451_countries.php | Creates countries table with state party codes and names |
| src/database/migrations/2025_08_18_080644_site_state_parties.php | Creates pivot table linking heritage sites to countries with additional metadata |
| src/app/Models/Country.php | New Eloquent model for countries with many-to-many relationship to heritage sites |
| src/app/Models/WorldHeritage.php | Updated model to include many-to-many relationship with countries |
| docker-compose.yml | Simplified configuration with removed nginx service and condensed formatting |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
|
|
||
| public function down(): void | ||
| { | ||
| Schema::dropIfExists('state_party_world_heritage_site'); |
There was a problem hiding this comment.
The table name in the down() method doesn't match the table created in up(). It should be 'site_state_parties' instead of 'state_party_world_heritage_site'.
| Schema::dropIfExists('state_party_world_heritage_site'); | |
| Schema::dropIfExists('site_state_parties'); |
| */ | ||
| public function down(): void | ||
| { | ||
| // |
There was a problem hiding this comment.
The down() method should implement the rollback logic to drop the 'countries' table using Schema::dropIfExists('countries').
| // | |
| Schema::dropIfExists('countries'); |
| 'state_party_code', | ||
| 'id', | ||
| 'state_party_code' | ||
| )->withPivot(['is_primary','inscription_year']) |
There was a problem hiding this comment.
[nitpick] Missing spaces after commas in the array. Should be ['is_primary', 'inscription_year'] for consistent code formatting.
| )->withPivot(['is_primary','inscription_year']) | |
| )->withPivot(['is_primary', 'inscription_year']) |
| 'world_heritage_site_id', | ||
| 'state_party_code', | ||
| 'id' | ||
| )->withPivot(['is_primary','inscription_year']) |
There was a problem hiding this comment.
[nitpick] Missing spaces after commas in the array. Should be ['is_primary', 'inscription_year'] for consistent code formatting.
| )->withPivot(['is_primary','inscription_year']) | |
| )->withPivot(['is_primary', 'inscription_year']) |
what I have done