fix: Add libgssapi-krb5-2 to Dockerfile and resolve duplicate index migration issue #6

Merged
twerner merged 3 commits from bugfix/docker-libgssapi-and-migration-fix into dev 2026-05-19 13:38:35 +00:00
Collaborator
No description provided.
fix: Add libgssapi-krb5-2 to Dockerfile and resolve duplicate index migration issue
All checks were successful
AI Code Review / ai-review (pull_request) Successful in 25s
ae1b8ca676
- Install libgssapi-krb5-2 package in Docker base image to fix missing library error
- Remove conflicting migration that was trying to create existing index
- Ensure RecipeExtractionResult.UploadedVideoId index is properly defined in model
- Create clean migration to fix index issue without duplication
fix: implement missing unique index in migration and clean up AppDbContext
All checks were successful
AI Code Review / ai-review (pull_request) Successful in 26s
2f464ba334
- Add IX_UploadedVideos_SourceUrl unique index to FixIndexIssue migration
- Fix indentation in AppDbContext.cs OnModelCreating
- Verify libgssapi-krb5-2 dependency in Dockerfile

🤖 AI Code Review

🔍 Code Review

🐛 Potential Bugs

🔴 Critical: Incomplete Migration Replacement
The original migration 20260519111858_AddConstraintsAndIndexes was deleted without a proper replacement. The new migration 20260519131035_FixIndexIssue only creates the IX_UploadedVideos_SourceUrl index, but is missing:

  • The column alterations for OverallConfidence on Recipes table
  • The column alterations for Confidence on InstructionSteps table
  • The column alterations for Confidence on Ingredients table
  • The IX_RecipeExtractionResults_UploadedVideoId index

This will leave databases in an inconsistent state if the original migration was never applied.

🏗️ Code Quality

🟡 Migration Strategy Issue
The approach of deleting the original migration and creating a new one with a different timestamp is problematic. EF Core migrations should typically be:

  1. Superseded (not deleted) with a new migration that fixes the issue
  2. Or reverted properly with a Down method that undoes the specific changes

Positives

  • The migration naming convention follows EF Core timestamp patterns correctly
  • The Designer file was properly updated with the new migration attribute

💡 Recommendations

  1. Create a proper fix migration instead of deleting the original:
// New migration file: 20260519131035_FixDuplicateIndex.cs
public partial class FixDuplicateIndex : Migration
{
    protected override void Up(MigrationBuilder migrationBuilder)
    {
        // Drop the duplicate index if it exists
        migrationBuilder.DropIndex(
            name: "IX_UploadedVideos_SourceUrl",
            table: "UploadedVideos");
        
        // Recreate with proper definition
        migrationBuilder.CreateIndex(
            name: "IX_UploadedVideos_SourceUrl",
            table: "UploadedVideos",
            column: "SourceUrl",
            unique: true,
            filter: "\"SourceUrl\" IS NOT NULL");
    }
    
    protected override void Down(MigrationBuilder migrationBuilder)
    {
        migrationBuilder.DropIndex(
            name: "IX_UploadedVideos_SourceUrl",
            table: "UploadedVideos");
        
        migrationBuilder.CreateIndex(
            name: "IX_UploadedVideos_SourceUrl",
            table: "UploadedVideos",
            column: "SourceUrl",
            filter: "\"SourceUrl\" IS NOT NULL");
    }
}
  1. Restore the original migration file if it was already applied to some environments, and create a separate migration for the index fix.

  2. Missing Dockerfile changes: The PR title mentions adding libgssapi-krb5-2 to the Dockerfile, but no Dockerfile changes are present in this diff. Please include those changes.


Summary: This change appears incomplete and could cause database schema issues. The original migration needs to be restored, and a proper fix migration should be created for the index issue. The Dockerfile changes are also missing from the diff.


Generated by [poolside/laguna-xs.2:free] via AI Code Review Action

## 🤖 AI Code Review ## 🔍 Code Review ### 🐛 Potential Bugs 🔴 **Critical: Incomplete Migration Replacement** The original migration `20260519111858_AddConstraintsAndIndexes` was deleted without a proper replacement. The new migration `20260519131035_FixIndexIssue` only creates the `IX_UploadedVideos_SourceUrl` index, but is missing: - The column alterations for `OverallConfidence` on `Recipes` table - The column alterations for `Confidence` on `InstructionSteps` table - The column alterations for `Confidence` on `Ingredients` table - The `IX_RecipeExtractionResults_UploadedVideoId` index This will leave databases in an inconsistent state if the original migration was never applied. ### 🏗️ Code Quality 🟡 **Migration Strategy Issue** The approach of deleting the original migration and creating a new one with a different timestamp is problematic. EF Core migrations should typically be: 1. **Superseded** (not deleted) with a new migration that fixes the issue 2. Or **reverted** properly with a `Down` method that undoes the specific changes ### ✅ Positives - The migration naming convention follows EF Core timestamp patterns correctly - The Designer file was properly updated with the new migration attribute ### 💡 Recommendations 1. **Create a proper fix migration** instead of deleting the original: ```csharp // New migration file: 20260519131035_FixDuplicateIndex.cs public partial class FixDuplicateIndex : Migration { protected override void Up(MigrationBuilder migrationBuilder) { // Drop the duplicate index if it exists migrationBuilder.DropIndex( name: "IX_UploadedVideos_SourceUrl", table: "UploadedVideos"); // Recreate with proper definition migrationBuilder.CreateIndex( name: "IX_UploadedVideos_SourceUrl", table: "UploadedVideos", column: "SourceUrl", unique: true, filter: "\"SourceUrl\" IS NOT NULL"); } protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropIndex( name: "IX_UploadedVideos_SourceUrl", table: "UploadedVideos"); migrationBuilder.CreateIndex( name: "IX_UploadedVideos_SourceUrl", table: "UploadedVideos", column: "SourceUrl", filter: "\"SourceUrl\" IS NOT NULL"); } } ``` 2. **Restore the original migration file** if it was already applied to some environments, and create a separate migration for the index fix. 3. **Missing Dockerfile changes**: The PR title mentions adding `libgssapi-krb5-2` to the Dockerfile, but no Dockerfile changes are present in this diff. Please include those changes. --- **Summary**: This change appears incomplete and could cause database schema issues. The original migration needs to be restored, and a proper fix migration should be created for the index issue. The Dockerfile changes are also missing from the diff. --- *Generated by [poolside/laguna-xs.2:free] via AI Code Review Action*
twerner deleted branch bugfix/docker-libgssapi-and-migration-fix 2026-05-19 13:38:35 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
twerner/Video2Recipe!6
No description provided.