Fix CSV import: populate Name and Currency fields with schema enforcement#166
Merged
PhantomDave merged 3 commits intomainfrom Dec 11, 2025
Merged
Fix CSV import: populate Name and Currency fields with schema enforcement#166PhantomDave merged 3 commits intomainfrom
PhantomDave merged 3 commits intomainfrom
Conversation
Co-authored-by: PhantomDave <34485699+PhantomDave@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix broken CSV import and update database schema
Fix CSV import: populate Name and Currency fields with schema enforcement
Dec 11, 2025
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a critical bug in CSV import where Name and Currency columns were being silently dropped, and strengthens the database schema by adding NOT NULL constraints with default values for these fields. The fix involves mapping these fields in the import logic, normalizing currency values to uppercase, and applying database-level defaults to ensure data consistency.
Key changes:
- Added Name and Currency field mapping in
FileImportService.FromParsedData()with uppercase normalization for currency - Applied database constraints: Name (max 200 chars, default "Untitled"), Currency (default "USD")
- Added comprehensive unit test coverage with 14 test cases covering field combinations and edge cases
Reviewed changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
PhantomDave.BankTracking.Api/Services/FileImportService.cs |
Added Name and Currency column mapping logic with uppercase normalization and "USD" default |
PhantomDave.BankTracking.Data/Context/BankTrackerDbContext.cs |
Added NOT NULL constraints and defaults for Name and Currency fields in FinanceRecord entity configuration |
PhantomDave.BankTracking.Data/Migrations/20251211094646_AddRequiredNameAndCurrencyDefaults.cs |
Migration to alter Name (varchar 200, default "Untitled") and Currency (default "USD") columns |
PhantomDave.BankTracking.Data/Migrations/20251211094646_AddRequiredNameAndCurrencyDefaults.Designer.cs |
Auto-generated migration designer file reflecting the schema changes |
PhantomDave.BankTracking.Data/Migrations/BankTrackerDbContextModelSnapshot.cs |
Updated model snapshot with new Name and Currency constraints and defaults |
PhantomDave.BankTracking.UnitTests/Services/FileImportServiceTests.cs |
Comprehensive test suite with 14 tests covering field mapping, normalization, defaults, and edge cases |
.config/dotnet-tools.json |
Added dotnet-ef tool version 10.0.1 for database migrations support |
Files not reviewed (1)
- PhantomDave.BankTracking.Data/Migrations/20251211094646_AddRequiredNameAndCurrencyDefaults.Designer.cs: Language not supported
Owner
|
@copilot apply changes based on the comments in this thread |
…ckfill Co-authored-by: PhantomDave <34485699+PhantomDave@users.noreply.github.com>
Copilot stopped work on behalf of
PhantomDave due to an error
December 11, 2025 10:12
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix CSV Import Name and Currency Fields
Progress:
Summary
Fixed broken CSV import where
nameandcurrencycolumns were not populated. Added proper validation, defaults, and database schema enforcement with comprehensive test coverage.All Code Review Comments Addressed:
Changes Made:
Verification:
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.