Integrate PostgreSQL with EF Core & migrations

Add PostgreSQL support and EF Core migrations for local development. Introduces ApplicationDbContext, adds Npgsql.EntityFrameworkCore.PostgreSQL and EF Core Design packages, and includes generated migrations (InitialPostgres and RemoveTestItems) plus updated model snapshot. Program.cs now loads an optional API/appsettings.custom.json, configures the DbContext from ConnectionStrings:Postgres and runs Database.Migrate() on startup. Adds a Dev docker-compose.yml to run postgres + pgAdmin, pins dotnet-ef in dotnet-tools.json, and adds ConnectionStrings to appsettings files. Also ignores API/appsettings.custom.json in .gitignore and updates README/codexInfo to document the new DB/dev workflow.
This commit is contained in:
Jonas
2026-04-18 17:40:42 +02:00
parent db8ed2a868
commit fcd2dca8dc
15 changed files with 293 additions and 1 deletions
+5
View File
@@ -0,0 +1,5 @@
using Microsoft.EntityFrameworkCore;
namespace API.Database;
public class ApplicationDbContext(DbContextOptions<ApplicationDbContext> options) : DbContext(options);