Connects to and queries the Aspire-managed PostgreSQL 15 database for TalkingPointsSummary. Use this when asked about database tables, running SQL queries, checking data, viewing the schema, inspecting migrations, or troubleshooting database connection issues in this project.
This project uses .NET Aspire to manage a local PostgreSQL 15 container for development. The container name and host port are dynamic (randomly assigned by Aspire on each run). Always resolve the live container details before connecting.
Run the following command to identify the Postgres container name and its exposed host port:
docker ps --format "table {{.Names}}\t{{.Image}}\t{{.Ports}}" | Select-String "postgres"
Expected output example:
postgres-ughgzjvt postgres:15-alpine 127.0.0.1:50444->5432/tcp
postgres-* entry (e.g. postgres-ughgzjvt)->5432/tcp (e.g. 50444)| Property | Value |
|---|---|
| Host | 127.0.0.1 |
| Port | Resolved from Step 1 (dynamic) |
| Database | talkingpoints |
| Username | postgres |
| Password | postgres (from appsettings.json → Parameters.postgres-password) |
Connection string format:
Host=127.0.0.1;Port=<PORT>;Database=talkingpoints;Username=postgres;Password=postgres
Use docker exec with PGPASSWORD to avoid interactive password prompts:
docker exec -e PGPASSWORD=postgres <CONTAINER_NAME> psql -U postgres -d talkingpoints -c "<SQL>"
List all tables:
docker exec -e PGPASSWORD=postgres <CONTAINER_NAME> psql -U postgres -d talkingpoints -c "\dt"
Count rows in a table:
docker exec -e PGPASSWORD=postgres <CONTAINER_NAME> psql -U postgres -d talkingpoints -c "SELECT COUNT(*) FROM \"Parents\";"
Describe a table:
docker exec -e PGPASSWORD=postgres <CONTAINER_NAME> psql -U postgres -d talkingpoints -c "\d \"Parents\""
Managed by EF Core migrations located in src/TalkingPointsSummary/Migrations/.
| Table | Model class | Notes |
|---|---|---|
Parents | Parent | Top-level entity; owns Children, Messages, NewsItems, Summaries |
Children | Child | Belongs to a Parent |
Messages | Message | Talking Points messages; unique on ExternalMessageId |
NewsItems | NewsItem | Scraped/fetched news items per parent |
Summaries | Summary | AI-generated summaries per parent |
__EFMigrationsHistory | — | EF Core migration tracking |
src/TalkingPointsSummary.AppHost/Program.cssrc/TalkingPointsSummary.AppHost/appsettings.json → Parameters.postgres-passwordsrc/TalkingPointsSummary.Core/Data/AppDbContext.cssrc/TalkingPointsSummary/Migrations/ManagePostgres flag in appsettings.json controls whether Aspire spins up the container (true) or defers to an external connection string (false)Migrations run automatically on worker startup via db.Database.MigrateAsync() in src/TalkingPointsSummary/Program.cs.
To check applied migrations:
docker exec -e PGPASSWORD=postgres <CONTAINER_NAME> psql -U postgres -d talkingpoints -c "SELECT version FROM \"__EFMigrationsHistory\" ORDER BY version;"