Fix Receipt TransactionId nullable database migrations
The previous commit had the model changes but the database wasn't properly migrated. This commit adds the missing migrations to make TransactionId nullable in the Receipts table. Changes: - Updated MoneyMapContext to make Transaction relationship optional for Receipt (IsRequired(false)) - Created additional migrations to properly handle: - Making TransactionId column nullable - Updating the unique index to handle NULL values with WHERE clause - Applied all migrations to database successfully The Receipts page should now work correctly for uploading unmapped receipts without a TransactionId. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -130,11 +130,12 @@ namespace MoneyMap.Data
|
||||
e.Property(x => x.Total).HasColumnType("decimal(18,2)");
|
||||
e.Property(x => x.Currency).HasMaxLength(8);
|
||||
|
||||
// Receipt must belong to a Transaction. If txn is deleted, cascade remove receipts.
|
||||
// Receipt can optionally belong to a Transaction. If txn is deleted, cascade remove receipts.
|
||||
e.HasOne(x => x.Transaction)
|
||||
.WithMany(t => t.Receipts)
|
||||
.HasForeignKey(x => x.TransactionId)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired(false);
|
||||
});
|
||||
|
||||
// ---------- RECEIPT PARSE LOG ----------
|
||||
|
||||
Reference in New Issue
Block a user