-
-
Notifications
You must be signed in to change notification settings - Fork 362
Fix tags migration (again) #3659
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
📝 WalkthroughWalkthroughAdded a German-specific normalization in the photo tags migration: after normalizing each raw tag, occurrences of the German sharp S ( Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
Tip 🔌 Remote MCP (Model Context Protocol) integration is now available!Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats. 📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 💡 Knowledge Base configuration:
You can enable these sources in your CodeRabbit configuration. 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 180000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (12)
✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (3)
database/migrations/2025_06_07_144157_photo_tags_to_table.php (3)
98-105: Unify key-existence checks (prefer isset() for consistency and speed)Use the same check style across the file to avoid cognitive overhead.
- if ($tag === '' || !array_key_exists($tag, $tags_to_create)) { + if ($tag === '' || !isset($tags_to_create[$tag])) { // skip tags that do not exist in the new tags // this can happen if the tag was removed from the photo // but still exists in the tag_album's show_tags field continue; }- if (!array_key_exists($tag_id, $id_to_tag)) { + if (!isset($id_to_tag[$tag_id])) { // skip tags that do not exist in the new tags // this can happen if the tag was removed from the photo // but still exists in the tag_album's show_tags field continue; }Also applies to: 151-158
30-31: Fix typo in docblock“itergate” → “iterate”.
- * We itergate over all photos with tags and create a new tag for each + * We iterate over all photos with tags and create a new tag for each
81-84: Rename “chuncked” → “chunked” for clarityMinor readability polish.
- $tags_chuncked = $tags->chunk(100); - foreach ($tags_chuncked as $chunk) { + $tags_chunked = $tags->chunk(100); + foreach ($tags_chunked as $chunk) { DB::table('tags')->insert($chunk->all()); }- $tag_photo_links_collection_chuncked = $tag_photo_links_collection->chunk(100); - foreach ($tag_photo_links_collection_chuncked as $chunk) { + $tag_photo_links_collection_chunked = $tag_photo_links_collection->chunk(100); + foreach ($tag_photo_links_collection_chunked as $chunk) { DB::table('photos_tags')->insert($chunk->all()); }Also applies to: 87-91
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled
- Linear integration is disabled
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
database/migrations/2025_06_07_144157_photo_tags_to_table.php(1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.php
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
**/*.php: Any new PHP file must include the license header and have a single blank line after the opening <?php tag
Use snake_case for PHP variable names
Apply PSR-4 coding standard
Always call in_array with strict mode: in_array($needle, $haystack, true)
Use only booleans in if conditions; avoid integers or strings
Use strict comparison (===, !==) instead of loose comparison (==, !=)
Avoid duplicating code in both if and else branches
Do not use empty(); prefer explicit checks
Files:
database/migrations/2025_06_07_144157_photo_tags_to_table.php
🧠 Learnings (2)
📓 Common learnings
Learnt from: ildyria
PR: LycheeOrg/Lychee#3626
File: database/migrations/2025_06_07_144157_photo_tags_to_table.php:87-105
Timestamp: 2025-08-18T10:19:04.946Z
Learning: In the Lychee photo management system, the migration `2025_06_07_144157_photo_tags_to_table.php` runs on data that only contains comma-separated tag names in tag_albums.show_tags - OR/AND expressions do not exist at this migration time, so handling them is unnecessary.
📚 Learning: 2025-08-18T10:19:04.946Z
Learnt from: ildyria
PR: LycheeOrg/Lychee#3626
File: database/migrations/2025_06_07_144157_photo_tags_to_table.php:87-105
Timestamp: 2025-08-18T10:19:04.946Z
Learning: In the Lychee photo management system, the migration `2025_06_07_144157_photo_tags_to_table.php` runs on data that only contains comma-separated tag names in tag_albums.show_tags - OR/AND expressions do not exist at this migration time, so handling them is unnecessary.
Applied to files:
database/migrations/2025_06_07_144157_photo_tags_to_table.php
⏰ Context from checks skipped due to timeout of 180000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (12)
- GitHub Check: 3️⃣ PHP dist / 8.3 - postgresql
- GitHub Check: 3️⃣ PHP dist / 8.4 - postgresql
- GitHub Check: 3️⃣ PHP dist / 8.4 - sqlite
- GitHub Check: 3️⃣ PHP dist / 8.3 - mariadb
- GitHub Check: 3️⃣ PHP dist / 8.3 - sqlite
- GitHub Check: 3️⃣ PHP dist / 8.4 - mariadb
- GitHub Check: 2️⃣ PHP tests / 8.4 - sqlite -- Unit,Feature_v2
- GitHub Check: 2️⃣ PHP tests / 8.4 - postgresql -- Unit,Feature_v2
- GitHub Check: 2️⃣ PHP tests / 8.4 - mariadb -- Unit,Feature_v2
- GitHub Check: 2️⃣ PHP tests / 8.3 - mariadb -- Unit,Feature_v2
- GitHub Check: 2️⃣ PHP tests / 8.3 - sqlite -- Unit,Feature_v2
- GitHub Check: 2️⃣ PHP tests / 8.3 - postgresql -- Unit,Feature_v2
🔇 Additional comments (1)
database/migrations/2025_06_07_144157_photo_tags_to_table.php (1)
63-69: LGTM: switch to isset() here is correct and slightly fasterValues stored in $tags_to_create are arrays (never null), so isset() preserves semantics.
Codecov Report✅ All modified and coverable lines are covered by tests. 🚀 New features to boost your workflow:
|
Summary by CodeRabbit