Fro 17 setup des bases de donnees#7
Conversation
- Create tables: role, user, character, article, character_article, comment - Add indexes for performance optimization - Seed roles, test users, articles and sample characters
- Gender: Male, Female - ArticleType: Clothing, Armor, Weapon, Accessory - CommentStatus: Pending, Approved - ActivityAction: 12 actions for MongoDB activity logs
- Role, User, Character, Article, CharacterArticle, Comment (PostgreSQL) - ActivityLog (MongoDB) - Add MongoDB.Bson package for ActivityLog serialization
…ntion - SnakeCaseNamingConvention for automatic PascalCase to snake_case mapping - DbContext with 6 DbSets and Fluent API configuration - Enums stored as strings for SQL readability
- MongoDB context with ActivityLogs collection - Uses primary constructor (C# 12)
- Add connection strings placeholders in appsettings.json - Add DependencyInjection.cs with AddInfrastructure extension method - Add InMemory EF Core package for unit tests - Add 5 unit tests for FantasyRealmDbContext
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| entity.Property(e => e.Gender) | ||
| .HasConversion<string>() | ||
| .HasMaxLength(20) | ||
| .IsRequired(); |
There was a problem hiding this comment.
Align enum conversions with DB check constraints
EF Core maps Gender, ArticleType, and CommentStatus to strings via HasConversion<string>(), which writes PascalCase values such as "Male", "Weapon", and "Pending". The SQL schema introduced in the same commit (database/sql/001_create_tables.sql lines 39, 63, 90) enforces lowercase-only values through CHECK constraints ('male', 'armor', 'pending'), so any SaveChanges against a database created from that script will fail when inserting characters, articles, or comments due to constraint violations. The enum conversion or the SQL constraints need to use the same casing.
Useful? React with 👍 / 👎.
No description provided.