Skip to content

[WIP] Implement storage schema for import sessions and transactions#69

Closed
Copilot wants to merge 1 commit intomainfrom
copilot/design-storage-schema-implementation
Closed

[WIP] Implement storage schema for import sessions and transactions#69
Copilot wants to merge 1 commit intomainfrom
copilot/design-storage-schema-implementation

Conversation

Copy link
Contributor

Copilot AI commented Mar 22, 2026

Thanks for assigning this issue to me. I'm starting to work on it and will keep this PR's description up to date as I form a plan and make progress.

Original prompt

This section details on the original issue you should resolve

<issue_title>feat: storage schema — import sessions, canonical transactions, merchant tables</issue_title>
<issue_description>## Summary
Design and implement the storage schema that underpins the entire application. Current storage is likely too shallow.

Schema

-- Import provenance
import_sessions(id, file_hash, filename, account_id, imported_at, total_rows, parsed_rows, error_rows)

-- Raw imported data (never modified)
raw_transactions(id, import_session_id, row_number, date, amount_cents, description, raw_data_json)

-- Resolved/canonical transactions
canonical_transactions(id, raw_transaction_id, date, amount_cents, merchant_id, category, confidence, reviewed)

-- Merchant resolution
merchants(id, canonical_name, category, created_at, updated_at)
merchant_aliases(id, merchant_id, alias_pattern, match_type, created_by)

-- Double-entry ledger
accounts(id, name, type, institution, currency, created_at)
postings(id, date, debit_account_id, credit_account_id, amount_cents, canonical_transaction_id, memo)

-- Recurring detection
recurring_series(id, merchant_id, account_id, interval_days, avg_amount_cents, confidence, status)

-- Review decisions
review_decisions(id, entity_type, entity_id, decision, decided_at, previous_value, new_value)

Principles

  • Raw data is immutable — never modify imported rows
  • All mutations go through canonical layer
  • Every decision is logged in review_decisions
  • Use PluresDB if available, SQLite as fallback

Acceptance

  • Schema implemented with migrations
  • Raw transactions preserved immutably
  • All CRUD operations tested
  • Review decisions create audit trail</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@kayodebristol
Copy link
Contributor

Closing this PR to enforce the 1-PR-per-repo rule. Only one Copilot PR is allowed per repository at a time. The oldest PR (#48) will be kept active.

Copilot stopped work on behalf of kayodebristol due to an error March 22, 2026 23:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: storage schema — import sessions, canonical transactions, merchant tables

2 participants