Conversation
Create comprehensive markdown documentation of the database schema including: - Entity relationship diagram - All tables with columns and types - Foreign key relationships - Key indexes and constraints
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bf6ebd8b83
ℹ️ 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".
| # Get the project_id from the area | ||
| cursor.execute(""" | ||
| SELECT project_id FROM areas WHERE id = %s | ||
| """, (area_id,)) | ||
| """, (campaign_id,)) |
There was a problem hiding this comment.
Resolve project_id via campaigns in coverage population
This refactor switched to campaign_id, but the lookup still queries areas, which the new migration renames/retire in favor of campaigns. When uploading locations for a campaign, populate_coverage_for_locations will fail to find a project and return early, so no coverage rows are created for those locations. That leaves adaptive sampling/coverage endpoints with empty data for all new uploads.
Useful? React with 👍 / 👎.
| # Get the project_id from the area | ||
| cursor.execute(""" | ||
| SELECT project_id FROM areas WHERE id = %s | ||
| """, (area_id,)) | ||
| """, (campaign_id,)) |
There was a problem hiding this comment.
Use campaigns table for default coverage pixels
This default coverage-pixel creation now takes campaign_id, but still fetches the project from areas. After the campaign refactor, that lookup will fail and the function returns without creating any coverage_pixel rows for new pixels, which will break coverage aggregation and downstream sampling for those campaigns. The lookup should be against campaigns (or a join) so new pixels get initialized correctly.
Useful? React with 👍 / 👎.
Summary
truecover-backend/docs/DATABASE_SCHEMA.mdCloses ONA-2086
Test plan
🤖 Generated with Claude Code