Files
Nexus.Reader/src/.documentation/cache/summaries/NexusReader.Data__Migrations__20260510161155_AddEbookProgressAndChapter.Designer.cs.json
T
2026-05-25 14:02:56 +02:00

1 line
14 KiB
JSON

{"path":"NexusReader.Data/Migrations/20260510161155_AddEbookProgressAndChapter.Designer.cs","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).","classification":{"role":"database-config","layer":"data","confidence":0.9,"evidence":["Class is annotated with [DbContext(typeof(AppDbContext))] and [Migration(...)] (lines 15-17).","Method BuildTargetModel(ModelBuilder) configures entities, relationships, indices and seed data (line 20+)."]},"className":"AddEbookProgressAndChapter","methods":[{"name":"BuildTargetModel","line":20,"endLine":695,"signature":"(modelBuilder: ModelBuilder) -> void","purpose":"Constructs the EF Core model: registers Postgres vector extension, identity and domain entities, their properties, relationships, indices and seed data for SubscriptionPlans.","calls":[],"actions":[{"id":"annotation_23","kind":"mapping","label":"Set product and identifier annotations","line":23,"detail":"modelBuilder.HasAnnotation(\"ProductVersion\",\"10.0.7\").HasAnnotation(\"Relational:MaxIdentifierLength\", 63)","visibility":"detail-only","confidence":0.7},{"id":"external-extension_27","kind":"mapping","label":"Enable Postgres vector extension","line":27,"detail":"NpgsqlModelBuilderExtensions.HasPostgresExtension(modelBuilder, \"vector\")","visibility":"detail-only","confidence":0.7},{"id":"external-config_28","kind":"mapping","label":"Configure identity column behavior","line":28,"detail":"NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder)","visibility":"detail-only","confidence":0.7},{"id":"entity-declaration_30","kind":"mapping","label":"Configure Identity and AspNet tables","line":30,"detail":"Adds Identity role, user, claims, logins, tokens, roles mapping tables with keys and indices","visibility":"detail-only","confidence":0.7},{"id":"indexing_47","kind":"mapping","label":"Indexes and unique constraints","line":47,"detail":"Multiple HasIndex calls across entities (e.g., RoleNameIndex, UserNameIndex, TenantId indices, unique ContentHash)","visibility":"detail-only","confidence":0.7},{"id":"entity-declaration_162","kind":"mapping","label":"Configure domain entities (Author, Ebook, KnowledgeUnit, KnowledgeUnitLink, NexusUser, QuizResult, SemanticKnowledgeCache, SubscriptionPlan)","line":162,"detail":"Registers domain entities and their properties, columns, keys and indices","visibility":"detail-only","confidence":0.7},{"id":"data-seed_526","kind":"mapping","label":"Seed SubscriptionPlans","line":526,"detail":"b.HasData(...) inserts Free, Basic, Pro, Enterprise plans with explicit Ids and defaults","visibility":"detail-only","confidence":0.7},{"id":"relationship_616","kind":"mapping","label":"Ebook -> Author and Ebook -> NexusUser foreign keys","line":616,"detail":"HasOne Author (restrict), HasOne User (cascade)","visibility":"detail-only","confidence":0.7},{"id":"relationship_635","kind":"mapping","label":"KnowledgeUnitLink -> KnowledgeUnit links (SourceUnit, TargetUnit)","line":635,"detail":"Two HasOne relationships with cascade deletes","visibility":"detail-only","confidence":0.7},{"id":"relationship_654","kind":"mapping","label":"NexusUser -> SubscriptionPlan FK","line":654,"detail":"HasOne SubscriptionPlan (restrict)","visibility":"detail-only","confidence":0.7},{"id":"navigation-setup_676","kind":"mapping","label":"Configure navigation properties","line":676,"detail":"Adds Navigation for collections and related entities (Ebooks, IncomingLinks, OutgoingLinks, QuizResults)","visibility":"detail-only","confidence":0.7}]}],"types":[{"name":"Ebook (model configured)","kind":"entity","line":180,"purpose":"Represents an ebook record tracked per user/tenant with reading progress and last chapter metadata.","fields":[{"name":"Id","type":"Guid","required":true,"line":182,"description":"Primary key, uuid, value generated on add"},{"name":"AddedDate","type":"DateTime","required":true,"line":186,"description":"When ebook was added"},{"name":"AuthorId","type":"int","required":false,"line":189,"description":"FK to Author"},{"name":"CoverUrl","type":"string","required":false,"line":192,"description":"Optional cover image URL"},{"name":"FilePath","type":"string","required":true,"line":195,"description":"Required file system path or storage reference"},{"name":"LastChapter","type":"string","required":false,"line":199,"description":"Optional last chapter title/name (MaxLength 255)"},{"name":"LastReadDate","type":"DateTime?","required":false,"line":203,"description":"Nullable last read timestamp"},{"name":"Progress","type":"double","required":true,"line":206,"description":"Reading progress (double precision)"},{"name":"TenantId","type":"string","required":true,"line":209,"description":"Tenant scoping (MaxLength 128)"},{"name":"Title","type":"string","required":true,"line":214,"description":"Ebook title (MaxLength 255)"},{"name":"UserId","type":"string","required":true,"line":219,"description":"Owning user id (FK to NexusUser)"}]},{"name":"KnowledgeUnit (model configured)","kind":"entity","line":234,"purpose":"Stores text chunks with vector embeddings and tenant/source metadata for semantic search.","fields":[{"name":"Id","type":"string","required":true,"line":236,"description":"Primary key (MaxLength 128)"},{"name":"Content","type":"string","required":true,"line":240,"description":"Text content"},{"name":"CreatedAt","type":"DateTime","required":true,"line":244,"description":"Creation timestamp"},{"name":"MetadataJson","type":"string","required":false,"line":247,"description":"Optional JSON metadata"},{"name":"SourceId","type":"string","required":true,"line":250,"description":"Source identifier (MaxLength 128)"},{"name":"TenantId","type":"string","required":true,"line":255,"description":"Tenant scoping (MaxLength 128)"},{"name":"Type","type":"int","required":true,"line":260,"description":"Unit type discriminator"},{"name":"Vector","type":"Vector","required":false,"line":263,"description":"Vector embedding column vector(768)"},{"name":"Version","type":"string","required":true,"line":266,"description":"Version of the unit/pipeline (MaxLength 50)"}]},{"name":"KnowledgeUnitLink (model configured)","kind":"entity","line":280,"purpose":"Represents directed relations between KnowledgeUnits (source -> target) with relation type.","fields":[{"name":"Id","type":"int","required":true,"line":282,"description":"Primary key, identity"},{"name":"RelationType","type":"string","required":true,"line":288,"description":"Relation type (MaxLength 50)"},{"name":"SourceUnitId","type":"string","required":true,"line":293,"description":"FK to source KnowledgeUnit (MaxLength 128)"},{"name":"TargetUnitId","type":"string","required":true,"line":298,"description":"FK to target KnowledgeUnit (MaxLength 128)"}]},{"name":"NexusUser (model configured)","kind":"entity","line":312,"purpose":"Application user with subscription & usage tracking fields plus identity columns.","fields":[{"name":"Id","type":"string","required":true,"line":314,"description":"Primary key (text)"},{"name":"AITokenLimit","type":"int","required":true,"line":317,"description":"AI token allowance"},{"name":"AITokensUsed","type":"int","required":true,"line":320,"description":"Tokens consumed"},{"name":"LastAiActionDate","type":"DateTime?","required":false,"line":341,"description":"Nullable last AI action timestamp"},{"name":"LastReadAt","type":"DateTime?","required":false,"line":344,"description":"Nullable last read timestamp"},{"name":"LastReadPageId","type":"string","required":false,"line":347,"description":"Last page id read (MaxLength 255)"},{"name":"SubscriptionPlanId","type":"int","required":true,"line":377,"description":"FK to SubscriptionPlan, default value 1"},{"name":"TenantId","type":"string","required":true,"line":382,"description":"Tenant scoping (MaxLength 128)"}]},{"name":"SubscriptionPlan (model configured)","kind":"entity","line":492,"purpose":"Defines available subscription tiers and token limits; seeded with default plans.","fields":[{"name":"Id","type":"int","required":true,"line":494,"description":"Primary key, identity"},{"name":"AITokenLimit","type":"int","required":true,"line":500,"description":"Token limit for plan"},{"name":"IsUnlimitedTokens","type":"bool","required":true,"line":503,"description":"Flag for unlimited tokens"},{"name":"MonthlyPrice","type":"decimal","required":true,"line":506,"description":"Monthly price numeric"},{"name":"PlanName","type":"string","required":true,"line":509,"description":"Unique plan name (MaxLength 50)"},{"name":"StripeProductId","type":"string","required":true,"line":514,"description":"Stripe product identifier (MaxLength 50)"}]},{"name":"SemanticKnowledgeCache (model configured)","kind":"entity","line":447,"purpose":"Cache of semantic embeddings and JSON response data per tenant and model/version to avoid recomputation.","fields":[{"name":"ContentHash","type":"string","required":true,"line":449,"description":"Primary key/hash (MaxLength 128)"},{"name":"CreatedAt","type":"DateTime","required":true,"line":453,"description":"Creation timestamp"},{"name":"JsonData","type":"string","required":true,"line":456,"description":"Stored JSON response"},{"name":"ModelId","type":"string","required":true,"line":460,"description":"Model identifier (MaxLength 50)"},{"name":"OriginalText","type":"string","required":true,"line":465,"description":"Original text that produced the vector"},{"name":"PromptVersion","type":"string","required":true,"line":469,"description":"Prompt version used (MaxLength 10)"},{"name":"TenantId","type":"string","required":true,"line":474,"description":"Tenant scoping (MaxLength 128)"},{"name":"Vector","type":"Vector","required":false,"line":479,"description":"Embedding vector column vector(1536)"}]},{"name":"Author (model configured)","kind":"entity","line":162,"purpose":"Book author with a collection of Ebooks.","fields":[{"name":"Id","type":"int","required":true,"line":164,"description":"Primary key, identity"},{"name":"Name","type":"string","required":true,"line":170,"description":"Author name (MaxLength 255)"}]},{"name":"QuizResult (model configured)","kind":"entity","line":410,"purpose":"User quiz attempt result tied to tenant and user.","fields":[{"name":"Id","type":"Guid","required":true,"line":412,"description":"Primary key uuid"},{"name":"CompletedDate","type":"DateTime","required":true,"line":416,"description":"When quiz completed"},{"name":"Score","type":"int","required":true,"line":419,"description":"Score achieved"},{"name":"TenantId","type":"string","required":true,"line":422,"description":"Tenant scoping (MaxLength 128)"},{"name":"Topic","type":"string","required":true,"line":427,"description":"Quiz topic text"},{"name":"TotalQuestions","type":"int","required":true,"line":431,"description":"Number of questions in quiz"},{"name":"UserId","type":"string","required":true,"line":434,"description":"Owning user id"}]}],"serviceRegistrations":[],"startupActions":[],"dependencies":["NexusReader.Data/Persistence/AppDbContext.cs","Pgvector (external)","Npgsql.EntityFrameworkCore.PostgreSQL (external)"],"patterns":["EF Core Migrations","ORM Model Builder","Data Seeding"],"domainConcepts":["Ebook","Author","KnowledgeUnit","KnowledgeUnitLink","NexusUser","SubscriptionPlan","SemanticKnowledgeCache","QuizResult","Identity (AspNetUsers/AspNetRoles)"],"keyDetails":"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.","orchestrationMethods":[],"typedContracts":[{"name":"Ebook (model configured)","kind":"entity","line":180,"fieldCount":11,"evidencePaths":["NexusReader.Data/Migrations/20260510161155_AddEbookProgressAndChapter.Designer.cs"]},{"name":"KnowledgeUnit (model configured)","kind":"entity","line":234,"fieldCount":9,"evidencePaths":["NexusReader.Data/Migrations/20260510161155_AddEbookProgressAndChapter.Designer.cs"]},{"name":"KnowledgeUnitLink (model configured)","kind":"entity","line":280,"fieldCount":4,"evidencePaths":["NexusReader.Data/Migrations/20260510161155_AddEbookProgressAndChapter.Designer.cs"]},{"name":"NexusUser (model configured)","kind":"entity","line":312,"fieldCount":8,"evidencePaths":["NexusReader.Data/Migrations/20260510161155_AddEbookProgressAndChapter.Designer.cs"]},{"name":"SubscriptionPlan (model configured)","kind":"entity","line":492,"fieldCount":6,"evidencePaths":["NexusReader.Data/Migrations/20260510161155_AddEbookProgressAndChapter.Designer.cs"]},{"name":"SemanticKnowledgeCache (model configured)","kind":"entity","line":447,"fieldCount":8,"evidencePaths":["NexusReader.Data/Migrations/20260510161155_AddEbookProgressAndChapter.Designer.cs"]},{"name":"Author (model configured)","kind":"entity","line":162,"fieldCount":2,"evidencePaths":["NexusReader.Data/Migrations/20260510161155_AddEbookProgressAndChapter.Designer.cs"]},{"name":"QuizResult (model configured)","kind":"entity","line":410,"fieldCount":7,"evidencePaths":["NexusReader.Data/Migrations/20260510161155_AddEbookProgressAndChapter.Designer.cs"]}],"persistenceInteractions":[],"externalInteractions":[],"evidenceAnchors":[{"kind":"typed-contract","label":"Ebook (model configured)","line":180,"summary":"entity with 11 fields.","confidence":0.8,"evidencePaths":["NexusReader.Data/Migrations/20260510161155_AddEbookProgressAndChapter.Designer.cs"]},{"kind":"typed-contract","label":"KnowledgeUnit (model configured)","line":234,"summary":"entity with 9 fields.","confidence":0.8,"evidencePaths":["NexusReader.Data/Migrations/20260510161155_AddEbookProgressAndChapter.Designer.cs"]},{"kind":"typed-contract","label":"KnowledgeUnitLink (model configured)","line":280,"summary":"entity with 4 fields.","confidence":0.8,"evidencePaths":["NexusReader.Data/Migrations/20260510161155_AddEbookProgressAndChapter.Designer.cs"]},{"kind":"typed-contract","label":"NexusUser (model configured)","line":312,"summary":"entity with 8 fields.","confidence":0.8,"evidencePaths":["NexusReader.Data/Migrations/20260510161155_AddEbookProgressAndChapter.Designer.cs"]}],"cacheMetadata":{"schemaVersion":2,"analysisVersion":"2026-05-23.cache-v1","contentChecksum":"a1af16beae694f3f78c6c2f1e456837c1c19107b35549d6de463bafb5376379e","sourceByteSize":26260,"analyzedAt":"2026-05-23T16:25:27.800Z","technology":"dotnet"}}