Feat/clean up code#395
Conversation
…-command chore: remove runtime usage of image_url from commands and query services
chore: drop image_url column from world_heritage_sites
fix: fix image url key in split JSON and cleanup image_url references
7c42616
into
chore/integrate-image_url-into-image-table
There was a problem hiding this comment.
Pull request overview
This PR removes the legacy image_url/primary_image_url columns from world_heritage_sites and updates read/indexing flows to use the world_heritage_site_images relationship as the source of thumbnail/primary image URLs.
Changes:
- Drop
image_urlandprimary_image_urlcolumns via new migrations and remove related writes from seed/test/import code. - Update read/query paths (including Algolia import) to fetch primary images through the
imagesrelation. - Fix JSON split output to store the actual image URL (not a hash) for later import.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
src/database/seeders/WorldHeritageSeeder.php |
Removes image_url from seeded world_heritage_sites rows. |
src/database/migrations/2026_03_29_151147_drop_image_url_from_world_heritage_sites.php |
Drops legacy image_url column (with rollback). |
src/database/migrations/2026_03_29_155722_drop_primary_image_url_from_world_heritage_sites.php |
Drops legacy primary_image_url column (with rollback). |
src/app/Packages/Domains/WorldHeritageReadQueryService.php |
Eager-loads primary image via images relation instead of selecting image_url. |
src/app/Packages/Domains/Test/QueryService/WorldHeritageQueryService_countEachRegionTest.php |
Removes image_url from inserted test records. |
src/app/Console/Commands/SplitWorldHeritageJson.php |
Outputs raw image URL into split images payload (instead of hashing). |
src/app/Console/Commands/ImportWorldHeritageSiteFromSplitFile.php |
Stops importing image_url into world_heritage_sites. |
src/app/Console/Commands/AlgoliaImportWorldHeritages.php |
Uses primary image from images relation for thumbnail_url. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| public function down(): void | ||
| { | ||
| Schema::table('world_heritage_sites', function (Blueprint $table) { | ||
| $table->string('primary_image_url')->nullable()->after('short_description'); |
There was a problem hiding this comment.
down() re-adds primary_image_url as string() after short_description, but the column was originally created as text() (see 2025_12_31_163422_add_primary_image_url_to_world_heritage_table.php). Rolling back this migration would therefore not restore the original schema and could truncate longer URLs. Consider restoring it as text()->nullable() and (optionally) placing it after image_url when that column exists (fallback to no after() or after('short_description') when it doesn’t).
| $table->string('primary_image_url')->nullable()->after('short_description'); | |
| $table->text('primary_image_url')->nullable()->after('short_description'); |
No description provided.