Ignore:
Timestamp:
09/29/26 20:55:13 (8 hours ago)
Author:
Stefan <trsunovstefan@…>
Branches:
main
Parents:
0cee8ec
Message:

Correct P1/P2 consistency (Holdings, WatchlistItems), redo P5 normalization

File:
1 edited

Legend:

Unmodified
Added
Removed
  • docs/P2-RelationalDesign/RelationalDesignAIUsage.md

    r0cee8ec r1549dae  
    1212### Diagram
    1313
    14 The student produces `relational_schema.jpg` in DBeaver from the live `project` schema; see [RelationalDesign](RelationalDesign.md) for instructions.
     14`relational_diagram_v4.png` was exported by the student in DBeaver from the live `project` schema, with the tables in the same positions as the entity sets of `ERModel_v05.png`; see [RelationalDesign](RelationalDesign.md#how-to-regenerate-it) for instructions.
    1515
    1616### Results in details / description
    … …  
    100100`trade.go` alone to keep the reservation consistent — the same reasoning
    101101already applied to `avg_price NOT NULL` in session 2.
     102
     103### Session 4 — 2026-09-29 (Claude Opus 5.5): correction after review
     104
     105**Prompt (student, excerpt):** I pasted the reviewer's comments on P2:
     106
     107> the `contains` relationship from the model is implemented differently in the database
     108> the `holds` relationship from the model is implemented differently in the database
     109> there may be other inconsistencies that are difficult to spot; the Phase 2 diagram should
     110> have been created using DBeaver with a layout visually similar to the ERD
     111
     112> I suggest correcting only the Phase 1 model so that it matches Phase 2 [...] For Phase 2,
     113> simply update the image according to the requirements.
     114
     115**Response (AI, summarised):**
     116
     117- Explained the mismatch. In the model, `Holds` and `Contains` were M:N relationships, whose
     118  table key would be the pair `{user_id, crypto_id}` / `{watchlist_id, crypto_id}`. But
     119  `holdings` and `watchlist_items` have their own `id` primary key, which is how an entity
     120  set is implemented. Following the reviewer's advice, P1 was corrected (v05, entity sets
     121  `Holdings` and `WatchlistItems`), and the database was not changed.
     122- Found the other inconsistencies between this page and the live schema. The page was
     123  missing `users.reserved_balance`, `orders.filled_quantity`, the status
     124  `partially_filled`, `market_trades.buy_order_id` / `sell_order_id` and the whole
     125  `order_events` table. The "10 tables", "5 indexes" and "the one nullable foreign key"
     126  counts were also out of date (really 11 tables, 8 indexes in `schema_creation.sql`, and 3
     127  nullable foreign keys).
     128- Rewrote [RelationalDesign](RelationalDesign.md). Each relation is labelled with its entity
     129  set and each foreign key with its relationship, and the transformation is a table of all
     130  15 relationships → 15 foreign keys, with `NOT NULL` following participation.
     131- Wrote export instructions with a table grid that mirrors `ERModel_v05.png`.
     132
     133**What I decided:** to correct P1 instead of the database, as the reviewer suggested. I
     134exported `relational_diagram_v4.png` from DBeaver myself, with the tables arranged like the
     135ER diagram.
Note: See TracChangeset for help on using the changeset viewer.