Ignore:
Timestamp:
09/29/26 20:55:13 (6 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/wiki/RelationalDesignAIUsage.md

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