From b391fd017bc3b77ca40c12e7b744aeddbda54b66 Mon Sep 17 00:00:00 2001 From: Lee Chapman Date: Sun, 11 Jan 2026 12:47:02 -0800 Subject: [PATCH 1/2] fix: add build target to Makefile 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 --- Makefile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index cfd1d07..b58bede 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -.PHONY: help install dev test lint format clean docker-build docker-login docker-push docker-pull docker-run run check check-all commit-changes release venv +.PHONY: help install dev test lint format clean build docker-build docker-login docker-push docker-pull docker-run run check check-all commit-changes release venv # Force use of bash shell (required for make to work properly with line continuations) SHELL := /bin/bash @@ -67,6 +67,10 @@ format: $(BLACK) src tests $(RUFF) check --fix src tests +build: clean + pip install --upgrade pip build + python -m build + clean: find . -type d -name __pycache__ -exec rm -rf {} + 2>/dev/null || true find . -type f -name "*.pyc" -delete From 57bce737a033c9141f9c89e3ac0bb0179ba41c4b Mon Sep 17 00:00:00 2001 From: Lee Chapman Date: Sun, 11 Jan 2026 21:08:16 -0800 Subject: [PATCH 2/2] Fix PostgreSQL schema: Add UNIQUE constraint and BIGINT types - 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' --- src/database.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/database.py b/src/database.py index be62690..5a76a2c 100644 --- a/src/database.py +++ b/src/database.py @@ -87,7 +87,7 @@ def _init_db(self): """ CREATE TABLE IF NOT EXISTS planet_status ( id SERIAL PRIMARY KEY, - planet_index INTEGER NOT NULL, + planet_index INTEGER UNIQUE NOT NULL, data JSONB NOT NULL, timestamp TIMESTAMP DEFAULT CURRENT_TIMESTAMP ) @@ -99,7 +99,7 @@ def _init_db(self): """ CREATE TABLE IF NOT EXISTS campaigns ( id SERIAL PRIMARY KEY, - campaign_id INTEGER UNIQUE NOT NULL, + campaign_id BIGINT UNIQUE NOT NULL, planet_index INTEGER, status TEXT, data JSONB NOT NULL, @@ -113,7 +113,7 @@ def _init_db(self): """ CREATE TABLE IF NOT EXISTS assignments ( id SERIAL PRIMARY KEY, - assignment_id INTEGER UNIQUE NOT NULL, + assignment_id BIGINT UNIQUE NOT NULL, data JSONB NOT NULL, timestamp TIMESTAMP DEFAULT CURRENT_TIMESTAMP ) @@ -125,7 +125,7 @@ def _init_db(self): """ CREATE TABLE IF NOT EXISTS dispatches ( id SERIAL PRIMARY KEY, - dispatch_id INTEGER UNIQUE NOT NULL, + dispatch_id BIGINT UNIQUE NOT NULL, data JSONB NOT NULL, timestamp TIMESTAMP DEFAULT CURRENT_TIMESTAMP ) @@ -137,7 +137,7 @@ def _init_db(self): """ CREATE TABLE IF NOT EXISTS planet_events ( id SERIAL PRIMARY KEY, - event_id INTEGER UNIQUE NOT NULL, + event_id BIGINT UNIQUE NOT NULL, planet_index INTEGER, event_type TEXT, data JSONB NOT NULL,