feat(balance): schema & migrations v14/v15 + types (securities, holdings, account.kind) #210

Closed
opened 2026-06-04 01:36:42 +00:00 by maximus · 0 comments
Owner

Fondations de schema de l Etape 2 (detail par titre), purement additives. v1-v13 jamais editees ; verifier la version max courante dans lib.rs avant d ecrire et utiliser les n suivants.

Fichiers concernes

  • src-tauri/src/lib.rs (migrations inline v14, v15)
  • src-tauri/src/database/balance_schema.sql (reference)
  • src-tauri/src/database/consolidated_schema.sql (nouveaux profils, parite)
  • src/shared/types/index.ts

Criteres d acceptation

  • Table balance_securities (symbol TEXT COLLATE NOCASE UNIQUE, name?, currency DEFAULT CAD, asset_type CHECK stock|crypto, timestamps)
  • Table balance_snapshot_holdings (snapshot_line_id FK ON DELETE CASCADE, security_id FK ON DELETE RESTRICT, quantity, unit_price, value, book_cost?, price_source?, price_fetched_at?, UNIQUE(snapshot_line_id, security_id)) + 2 index
  • balance_accounts.kind (simple|detailed, NOT NULL DEFAULT simple) + detailed_since DATE nullable ; backfill kind=detailed pour comptes sous categorie priced
  • consolidated_schema.sql a parite (2 tables + colonne kind + defauts seed) pour les nouveaux profils
  • Types TS BalanceSecurity, BalanceSnapshotHolding, BalanceAccountKind ; BalanceAccount/WithCategory exposent kind + detailed_since
  • cargo test vert : v1-v13 checksums intacts, v14/v15 idempotentes ; npm run build vert

Review caveats

  • ARCH (vert): snapshot_line_id comme FK (pas snapshot+account) — conserver, UNIQUE(snapshot_id,account_id) garantit deja 1 ligne/compte.
  • SEC/ARCH (jaune): symbole normalise upper/trim + COLLATE NOCASE pour eviter les doublons de casse.

Decisions prises ce soir

  • (revision) detailed_since faisant autorite pour le pivot.
  • (spec Etape 1) vehicle_type nullable + 5 classes d actif = acquis, ne pas toucher (v1-v13 intactes).

Spec source

spec-plan-bilan-detail-titres.md (+ spec-decisions-bilan-detail-titres.md)

Fondations de schema de l Etape 2 (detail par titre), purement additives. v1-v13 jamais editees ; verifier la version max courante dans lib.rs avant d ecrire et utiliser les n suivants. ## Fichiers concernes - src-tauri/src/lib.rs (migrations inline v14, v15) - src-tauri/src/database/balance_schema.sql (reference) - src-tauri/src/database/consolidated_schema.sql (nouveaux profils, parite) - src/shared/types/index.ts ## Criteres d acceptation - [ ] Table balance_securities (symbol TEXT COLLATE NOCASE UNIQUE, name?, currency DEFAULT CAD, asset_type CHECK stock|crypto, timestamps) - [ ] Table balance_snapshot_holdings (snapshot_line_id FK ON DELETE CASCADE, security_id FK ON DELETE RESTRICT, quantity, unit_price, value, book_cost?, price_source?, price_fetched_at?, UNIQUE(snapshot_line_id, security_id)) + 2 index - [ ] balance_accounts.kind (simple|detailed, NOT NULL DEFAULT simple) + detailed_since DATE nullable ; backfill kind=detailed pour comptes sous categorie priced - [ ] consolidated_schema.sql a parite (2 tables + colonne kind + defauts seed) pour les nouveaux profils - [ ] Types TS BalanceSecurity, BalanceSnapshotHolding, BalanceAccountKind ; BalanceAccount/WithCategory exposent kind + detailed_since - [ ] cargo test vert : v1-v13 checksums intacts, v14/v15 idempotentes ; npm run build vert ## Review caveats - ARCH (vert): snapshot_line_id comme FK (pas snapshot+account) — conserver, UNIQUE(snapshot_id,account_id) garantit deja 1 ligne/compte. - SEC/ARCH (jaune): symbole normalise upper/trim + COLLATE NOCASE pour eviter les doublons de casse. ## Decisions prises ce soir - (revision) detailed_since faisant autorite pour le pivot. - (spec Etape 1) vehicle_type nullable + 5 classes d actif = acquis, ne pas toucher (v1-v13 intactes). ## Spec source spec-plan-bilan-detail-titres.md (+ spec-decisions-bilan-detail-titres.md)
maximus added this to the overnight-2026-06-05-bilan-detail-titres milestone 2026-06-04 01:36:42 +00:00
maximus added the
status:ready
type:feature
source:human
labels 2026-06-04 01:36:42 +00:00
maximus added
type:schema
and removed
type:feature
labels 2026-06-04 01:38:20 +00:00
maximus added
status:review
and removed
status:ready
labels 2026-06-06 16:53:34 +00:00
maximus added
status:approved
and removed
status:review
labels 2026-06-06 19:35:23 +00:00
Sign in to join this conversation.
No project
No assignees
1 participant
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: maximus/Simpl-Resultat#210
No description provided.