# 20260510161155_AddEbookProgressAndChapter.Designer

- File ID: file:kwumax:20260510161155-addebookprogressandchapter-design
- Path: NexusReader.Data/Migrations/20260510161155_AddEbookProgressAndChapter.Designer.cs
- Role: database-config
- Layer: data

## Purpose

EF Core migration designer: describes the target EF Core model state for the migration named AddEbookProgressAndChapter (schema, entity mappings, relationships, indices, and seed data).

## Key Details

Migration designer configures Postgres vector extension and vector columns, identity-by-default columns, many tenant-scoped entities, FK relationships and indexes, and seeds SubscriptionPlans (Free/Basic/Pro/Enterprise). File is auto-generated by EF Core migrations and represents model snapshot for migration 20260510161155.

## Symbols

- AddEbookProgressAndChapter: EF Core migration designer: describes the target EF Core model state for the migration named AddEbookProgressAndChapter (schema, entity mappings, relationships, indices, and seed data).
- BuildTargetModel(): Constructs the EF Core model: registers Postgres vector extension, identity and domain entities, their properties, relationships, indices and seed data for SubscriptionPlans.
- Ebook (model configured): Represents an ebook record tracked per user/tenant with reading progress and last chapter metadata.
- KnowledgeUnit (model configured): Stores text chunks with vector embeddings and tenant/source metadata for semantic search.
- KnowledgeUnitLink (model configured): Represents directed relations between KnowledgeUnits (source -> target) with relation type.
- NexusUser (model configured): Application user with subscription & usage tracking fields plus identity columns.
- SubscriptionPlan (model configured): Defines available subscription tiers and token limits; seeded with default plans.
- SemanticKnowledgeCache (model configured): Cache of semantic embeddings and JSON response data per tenant and model/version to avoid recomputation.
- Author (model configured): Book author with a collection of Ebooks.
- QuizResult (model configured): User quiz attempt result tied to tenant and user.

## Dependencies

- imports NexusReader.Data/Persistence/AppDbContext.cs

## Calls

- No resolved calls.

## Unresolved References

- dependency-target: Pgvector (external)
- dependency-target: Npgsql.EntityFrameworkCore.PostgreSQL (external)

## Coverage

- Symbols: 10
- Executable symbols: 1
- Executable symbols with control flow: 1
- Grounded edges: 11
- Unresolved references: 2
- Control-flow fragments: 1
- Unresolved jumps: 0
- Unsupported constructs: 0
- Control-flow coverage: 100%
- Required diagrams: 2
- Generated diagrams: 2

## Control Flow Fragments

- BuildTargetModel: 13 nodes, 12 edges, 0 jumps, 0 unsupported constructs

## Diagrams

### 20260510161155_AddEbookProgressAndChapter.Designer Neighborhood

```mermaid
flowchart LR
    class_1eh84ev_addebookprogressandchapter("AddEbookProgressAndChapter")
    file_kwumax_20260510161155_addebookprogressandchapter_design("20260510161155_AddEbookProgressAndChapter.Designer")
    method_145q8gt_buildtargetmodel[["BuildTargetModel()"]]
    file_1pacvtg_appdbcontext_cs[/"AppDbContext"/]
    type_12mtiix_knowledgeunitlink_model_configured[/"KnowledgeUnitLink (model configured)"/]
    type_1d5hut9_author_model_configured[/"Author (model configured)"/]
    type_1p6mlsn_nexususer_model_configured[/"NexusUser (model configured)"/]
    type_1w5eq5k_semanticknowledgecache_model_configured[/"SemanticKnowledgeCache (model configured)"/]
    type_mrafiy_subscriptionplan_model_configured[/"SubscriptionPlan (model configured)"/]
    type_q2ghu0_ebook_model_configured[/"Ebook (model configured)"/]
    type_vznymy_knowledgeunit_model_configured[/"KnowledgeUnit (model configured)"/]
    type_xrqv0u_quizresult_model_configured[/"QuizResult (model configured)"/]
    file_kwumax_20260510161155_addebookprogressandchapter_design -->|AppDbContext| file_1pacvtg_appdbcontext_cs
```

### 20260510161155_AddEbookProgressAndChapter.Designer Execution Overview

```mermaid
flowchart TD
    class_1eh84ev_addebookprogressandchapter("AddEbookProgressAndChapter")
    method_145q8gt_buildtargetmodel[["BuildTargetModel()"]]
    class_1eh84ev_addebookprogressandchapter -->|contains| method_145q8gt_buildtargetmodel
```

## Diagram Validation

- Status: pass
