# 20260428184727_InitialPostgres

- File ID: file:a32vvn:20260428184727-initialpostgres-cs
- Path: NexusReader.Data/Migrations/20260428184727_InitialPostgres.cs
- Role: database-config
- Layer: data

## Purpose

An Entity Framework Core migration that creates the initial PostgreSQL schema for identity tables, application user/ebook tables and a semantic knowledge cache for the NexusReader application.

## Key Details

Postgres-specific migration using Npgsql value generation strategy for integer identity columns, unique indexes on normalized name/email and FK relationships between AspNetUsers and Ebooks; semantic cache keyed by ContentHash to deduplicate semantic computations.

## Symbols

- InitialPostgres: An Entity Framework Core migration that creates the initial PostgreSQL schema for identity tables, application user/ebook tables and a semantic knowledge cache for the NexusReader application.
- Up(): Creates database tables, constraints and indexes needed for initial application schema on Postgres (identity tables, semantic cache, ebooks) during migration up.
- Down(): Drops the tables created by Up in reverse order to roll back the migration.
- AspNetRoles: Identity roles table used by ASP.NET Identity.
- AspNetUsers: Application users table extended with tenant and AI token tracking fields.
- SemanticKnowledgeCache: Stores cached semantic embeddings/metadata keyed by content hash to avoid recomputation.
- Ebooks: Represents ebooks uploaded or tracked by users in the application.
- AspNetRoleClaims / AspNetUserClaims / AspNetUserLogins / AspNetUserRoles / AspNetUserTokens: Standard ASP.NET Identity auxiliary tables for claims, logins, roles and tokens.

## Dependencies

- No resolved dependencies.

## Calls

- No resolved calls.

## Coverage

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

## Control Flow Fragments

- Up: 12 nodes, 11 edges, 0 jumps, 0 unsupported constructs
- Down: 11 nodes, 10 edges, 0 jumps, 0 unsupported constructs

## Diagrams

### 20260428184727_InitialPostgres Neighborhood

```mermaid
flowchart LR
    class_1xhm2de_initialpostgres("InitialPostgres")
    file_a32vvn_20260428184727_initialpostgres_cs("20260428184727_InitialPostgres")
    method_19ym4q4_up[["Up()"]]
    method_1kuci8n_down[["Down()"]]
    type_10b7z70_semanticknowledgecache[/"SemanticKnowledgeCache"/]
    type_18g2en_aspnetroles[/"AspNetRoles"/]
    type_1iyorzj_aspnetusers[/"AspNetUsers"/]
    type_1yhkunt_aspnetroleclaims_aspnetuserclaims_aspnetuserlogi[/"AspNetRoleClaims / AspNetUserClaims / AspNetUserLogins / AspNetUserRoles / AspNetUserTokens"/]
    type_96fzwh_ebooks[/"Ebooks"/]
```

### 20260428184727_InitialPostgres Execution Overview

```mermaid
flowchart TD
    class_1xhm2de_initialpostgres("InitialPostgres")
    method_19ym4q4_up[["Up()"]]
    method_1kuci8n_down[["Down()"]]
    class_1xhm2de_initialpostgres -->|contains| method_19ym4q4_up
    class_1xhm2de_initialpostgres -->|contains| method_1kuci8n_down
```

## Diagram Validation

- Status: pass
