SKILL.md
Day 1 · Step 4 — Configure the DB connection (no redeploy)
```Run bash cd up-api dotnet add package Npgsql.EntityFrameworkCore.PostgreSQL dotnet add package Microsoft.EntityFrameworkCore.Design
`appsettings.Development.json`:
{ "ConnectionStrings": { "Default": "Host=localhost;Port=5432;Database=up_db;Username=upadmin;Password=uppass" } }
Use `localhost` here because EF CLI commands (next steps) run from the host. Inside the `up-api`
container the connection string instead uses the compose service name `db` — that's already set in the
container's environment from the docker-deploy step, don't change it.
`Data/AppDbContext.cs`:
public class AppDbContext : DbContext { public AppDbContext(DbContextOptions<AppDbContext> options) : base(options) { } // DbSet<Entity> properties are added in the entity-migration step }
`Program.cs`:
builder.Services.AddDbContext<AppDbContext>(opt => opt.UseNpgsql(builder.Configuration.GetConnectionString("Default")));
This step is code + config only — do not redeploy.