Skip to content

Fix PostgreSQL schema: Add UNIQUE constraint and BIGINT types - #29

Merged
surrealwolf merged 4 commits into
mainfrom
fix/postgresql-schema-constraints
Jan 12, 2026
Merged

surrealwolf merged 4 commits into
mainfrom
fix/postgresql-schema-constraints

Conversation

@surrealwolf

Copy link
Copy Markdown
Collaborator

Summary

Fixes database schema issues causing poller errors:

  1. Planet Status Errors: Added UNIQUE constraint on planet_status.planet_index to support ON CONFLICT clause
  2. Assignments Integer Overflow: Changed assignment_id from INTEGER to BIGINT
  3. Preventive Fixes: Changed campaign_id, dispatch_id, and event_id to BIGINT for consistency

Changes

  • src/database.py: Updated schema definitions to match database fixes

Issues Fixed

  • ✅ Failed to save planet status: there is no unique or exclusion constraint matching the ON CONFLICT specification
  • ✅ Failed to save assignments: integer out of range

Testing

Schema fixes have been applied to the production database and verified. The next poller cycle should confirm the errors are resolved.

The CI pipeline uses 'make build' but the Makefile didn't have a build target for Python projects.

Error: make: *** No rule to make target 'build'. Stop.

Changes:
- Added build target that runs 'pip install --upgrade pip build' and 'python -m build'
- Build depends on clean target to ensure fresh builds
- Updated .PHONY declaration to include build
- Updated help text to include build target
- Add UNIQUE constraint on planet_status.planet_index for ON CONFLICT support
- Change assignment_id from INTEGER to BIGINT to prevent integer overflow
- Change campaign_id, dispatch_id, event_id to BIGINT for consistency

Fixes:
- 'Failed to save planet status: there is no unique or exclusion constraint'
- 'Failed to save assignments: integer out of range'
@surrealwolf
surrealwolf merged commit 2679088 into main Jan 12, 2026
8 checks passed
@surrealwolf
surrealwolf deleted the fix/postgresql-schema-constraints branch January 12, 2026 05:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant