# 20260513185108_MakeKnowledgeUnitEbookIdNullable.Designer

- File ID: file:6fusgm:20260513185108-makeknowledgeunitebookidnullable-
- Path: NexusReader.Data/Persistence/Migrations/20260513185108_MakeKnowledgeUnitEbookIdNullable.Designer.cs
- Role: database-config
- Layer: data

## Purpose

EF Core migration designer that defines the target EF Core model for the migration 'MakeKnowledgeUnitEbookIdNullable' — configures entities, relationships, indices, vector extension, identity settings and seeds subscription plan data.

## Key Details

This EF migration snapshot configures the Postgres vector extension, identity-by-default columns, many entity schemas and relationships, and explicitly declares KnowledgeUnit.EbookId as nullable (Guid?). It also seeds SubscriptionPlans with four entries.

## Symbols

- MakeKnowledgeUnitEbookIdNullable: EF Core migration designer that defines the target EF Core model for the migration 'MakeKnowledgeUnitEbookIdNullable' — configures entities, relationships, indices, vector extension, identity settings and seeds subscription plan data.
- BuildTargetModel(): Constructs the EF Core model snapshot for this migration: annotations, extensions, entity schemas, relationships, indices and data seeding.
- MakeKnowledgeUnitEbookIdNullable: Partial migration class representing the migration that makes KnowledgeUnit.EbookId nullable and supplies the target model snapshot.

## Dependencies

- imports NexusReader.Data/Persistence/AppDbContext.cs
- imports NexusReader.Domain/Entities/Ebook.cs
- imports NexusReader.Domain/Entities/KnowledgeUnit.cs
- imports NexusReader.Domain/Entities/SubscriptionPlan.cs
- imports NexusReader.Domain/Entities/NexusUser.cs
- imports NexusReader.Domain/Entities/Author.cs
- imports NexusReader.Domain/Entities/KnowledgeUnitLink.cs
- imports NexusReader.Domain/Entities/QuizResult.cs
- imports NexusReader.Domain/Entities/SemanticKnowledgeCache.cs

## Calls

- No resolved calls.

## Unresolved References

- call-target: unknown
- call-target: unknown
- call-target: unknown
- call-target: unknown

## Coverage

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

## Control Flow Fragments

- BuildTargetModel: 15 nodes, 14 edges, 4 jumps, 0 unsupported constructs

## Diagrams

### 20260513185108_MakeKnowledgeUnitEbookIdNullable.Designer Neighborhood

_Warnings: diagram file_6fusgm_20260513185108_makeknowledgeunitebookidnullable__neighborhood_view exceeds preferred complexity thresholds (13 nodes, 9 edges)._

```mermaid
---
config:
  flowchart:
    defaultRenderer: "elk"
---
flowchart LR
    class_1gem37m_makeknowledgeunitebookidnullable("MakeKnowledgeUnitEbookIdNullable")
    file_6fusgm_20260513185108_makeknowledgeunitebookidnullable_("20260513185108_MakeKnowledgeUnitEbookIdNullable.Designer")
    method_1egmvje_buildtargetmodel[["BuildTargetModel()"]]
    file_1b03oou_subscriptionplan_cs[/"SubscriptionPlan"/]
    file_1d4ycw2_semanticknowledgecache_cs[/"SemanticKnowledgeCache"/]
    file_1m6x5qy_knowledgeunitlink_cs[/"KnowledgeUnitLink"/]
    file_1pacvtg_appdbcontext_cs[/"AppDbContext"/]
    file_1wyr0y8_quizresult_cs[/"QuizResult"/]
    file_1y56eud_author_cs[/"Author"/]
    file_h6a0xu_knowledgeunit_cs[/"KnowledgeUnit"/]
    file_lcvwj6_ebook_cs[/"Ebook"/]
    file_xcxh5w_nexususer_cs[/"NexusUser"/]
    type_1juajpg_makeknowledgeunitebookidnullable[/"MakeKnowledgeUnitEbookIdNullable"/]
    file_6fusgm_20260513185108_makeknowledgeunitebookidnullable_ -->|SubscriptionPlan| file_1b03oou_subscriptionplan_cs
    file_6fusgm_20260513185108_makeknowledgeunitebookidnullable_ -->|SemanticKnowledgeCache| file_1d4ycw2_semanticknowledgecache_cs
    file_6fusgm_20260513185108_makeknowledgeunitebookidnullable_ -->|KnowledgeUnitLink| file_1m6x5qy_knowledgeunitlink_cs
    file_6fusgm_20260513185108_makeknowledgeunitebookidnullable_ -->|AppDbContext| file_1pacvtg_appdbcontext_cs
    file_6fusgm_20260513185108_makeknowledgeunitebookidnullable_ -->|QuizResult| file_1wyr0y8_quizresult_cs
    file_6fusgm_20260513185108_makeknowledgeunitebookidnullable_ -->|Author| file_1y56eud_author_cs
    file_6fusgm_20260513185108_makeknowledgeunitebookidnullable_ -->|KnowledgeUnit| file_h6a0xu_knowledgeunit_cs
    file_6fusgm_20260513185108_makeknowledgeunitebookidnullable_ -->|Ebook| file_lcvwj6_ebook_cs
    file_6fusgm_20260513185108_makeknowledgeunitebookidnullable_ -->|NexusUser| file_xcxh5w_nexususer_cs
```

### 20260513185108_MakeKnowledgeUnitEbookIdNullable.Designer Execution Overview

```mermaid
flowchart TD
    class_1gem37m_makeknowledgeunitebookidnullable("MakeKnowledgeUnitEbookIdNullable")
    method_1egmvje_buildtargetmodel[["BuildTargetModel()"]]
    unresolved_unresolved_1ii6wwa_call_target{"Unresolved: ModelBuilder.Entity"}
    unresolved_unresolved_1oombcg_call_target{"Unresolved: NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns"}
    unresolved_unresolved_83awfv_call_target{"Unresolved: EntityTypeBuilder.HasData"}
    unresolved_unresolved_vzpeg0_call_target{"Unresolved: NpgsqlModelBuilderExtensions.HasPostgresExtension"}
    class_1gem37m_makeknowledgeunitebookidnullable -->|contains| method_1egmvje_buildtargetmodel
    method_1egmvje_buildtargetmodel -->|unresolved call| unresolved_unresolved_1ii6wwa_call_target
    method_1egmvje_buildtargetmodel -->|unresolved call| unresolved_unresolved_1oombcg_call_target
    method_1egmvje_buildtargetmodel -->|unresolved call| unresolved_unresolved_83awfv_call_target
    method_1egmvje_buildtargetmodel -->|unresolved call| unresolved_unresolved_vzpeg0_call_target
```

### BuildTargetModel() Control Flow

```mermaid
flowchart TD
    method_1egmvje_buildtargetmodel__call_27_NpgsqlModelBuilderExtensions_HasPostgresExtension[["NpgsqlModelBuilderExtensions.HasPostgresExtension"]]
    method_1egmvje_buildtargetmodel__call_28_NpgsqlModelBuilderExtensions_UseIdentityByDefaultColumns[["NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns"]]
    method_1egmvje_buildtargetmodel__call_30_ModelBuilder_Entity[["ModelBuilder.Entity"]]
    method_1egmvje_buildtargetmodel__call_530_EntityTypeBuilder_HasData[["EntityTypeBuilder.HasData"]]
    method_1egmvje_buildtargetmodel__action_23_annotation_23__linear("Set model annotations")
    method_1egmvje_buildtargetmodel__action_253_property_change_253__linear("Make KnowledgeUnit.EbookId nullable")
    method_1egmvje_buildtargetmodel__action_27_enable_extension_27__linear("Enable Postgres vector extension")
    method_1egmvje_buildtargetmodel__action_28_configuration_28__linear("Use identity-by-default columns for Postgres")
    method_1egmvje_buildtargetmodel__action_30_entity_declaration_30__linear("Define Identity and domain entities schemas")
    method_1egmvje_buildtargetmodel__action_49_index_creation_49__linear("Create indices")
    method_1egmvje_buildtargetmodel__action_530_data_seed_530__linear("Seed SubscriptionPlan table")
    method_1egmvje_buildtargetmodel__action_620_relationship_620__linear("Configure relationships and delete behaviors")
    method_1egmvje_buildtargetmodel__action_634_navigation_634__linear("Define EF navigation properties")
    method_1egmvje_buildtargetmodel__entry(["BuildTargetModel entry"])
    method_1egmvje_buildtargetmodel__implicit_return(["return"])
    method_1egmvje_buildtargetmodel__action_23_annotation_23__linear -->|next| method_1egmvje_buildtargetmodel__action_27_enable_extension_27__linear
    method_1egmvje_buildtargetmodel__action_253_property_change_253__linear -->|next| method_1egmvje_buildtargetmodel__action_530_data_seed_530__linear
    method_1egmvje_buildtargetmodel__action_27_enable_extension_27__linear -->|modelBuilder, extension name vector| method_1egmvje_buildtargetmodel__call_27_NpgsqlModelBuilderExtensions_HasPostgresExtension
    method_1egmvje_buildtargetmodel__action_28_configuration_28__linear -->|modelBuilder| method_1egmvje_buildtargetmodel__call_28_NpgsqlModelBuilderExtensions_UseIdentityByDefaultColumns
    method_1egmvje_buildtargetmodel__action_30_entity_declaration_30__linear -->|entity type name strings for many domain types e.g. Microsoft.AspNetCore.Identity.IdentityRole| method_1egmvje_buildtargetmodel__call_30_ModelBuilder_Entity
    method_1egmvje_buildtargetmodel__action_49_index_creation_49__linear -->|next| method_1egmvje_buildtargetmodel__action_253_property_change_253__linear
    method_1egmvje_buildtargetmodel__action_530_data_seed_530__linear -->|seed array for SubscriptionPlans 4 items with Id, AITokenLimit, MonthlyPrice, PlanName, StripeProductId| method_1egmvje_buildtargetmodel__call_530_EntityTypeBuilder_HasData
    method_1egmvje_buildtargetmodel__action_620_relationship_620__linear -->|next| method_1egmvje_buildtargetmodel__action_634_navigation_634__linear
    method_1egmvje_buildtargetmodel__action_634_navigation_634__linear -->|return| method_1egmvje_buildtargetmodel__implicit_return
    method_1egmvje_buildtargetmodel__call_27_NpgsqlModelBuilderExtensions_HasPostgresExtension -->|next| method_1egmvje_buildtargetmodel__action_28_configuration_28__linear
    method_1egmvje_buildtargetmodel__call_28_NpgsqlModelBuilderExtensions_UseIdentityByDefaultColumns -->|next| method_1egmvje_buildtargetmodel__action_30_entity_declaration_30__linear
    method_1egmvje_buildtargetmodel__call_30_ModelBuilder_Entity -->|next| method_1egmvje_buildtargetmodel__action_49_index_creation_49__linear
    method_1egmvje_buildtargetmodel__call_530_EntityTypeBuilder_HasData -->|next| method_1egmvje_buildtargetmodel__action_620_relationship_620__linear
    method_1egmvje_buildtargetmodel__entry -->|next| method_1egmvje_buildtargetmodel__action_23_annotation_23__linear
```

## Diagram Validation

- Status: warn
- Warning: Control-flow extraction left 4 unresolved jumps.
- Warning: neighborhood-view: diagram file_6fusgm_20260513185108_makeknowledgeunitebookidnullable__neighborhood_view exceeds preferred complexity thresholds (13 nodes, 9 edges).
