This is an automated email from the ASF dual-hosted git repository. skrawcz pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/hamilton.git
commit 850c5d2303244699b941c3348721e4c4d38418d5 Author: Stefan Krawczyk <[email protected]> AuthorDate: Tue Feb 24 18:01:46 2026 -0800 Upgrade from PostgreSQL 16 to PostgreSQL 18 Updates Hamilton UI to use PostgreSQL 18 (latest stable) instead of 16. Changes: - docker-compose.yml: postgres:16 → postgres:18 - docker-compose-prod.yml: postgres:16 → postgres:18 - UPGRADE.md: Updated all references to PostgreSQL 18 - migrate_postgres.sh: Updated migration path to 12→18 - migrate_postgres_simple.sh: Updated migration path to 12→18 Why PostgreSQL 18: - Latest stable version (released September 2024) - Django 6.0.2+ supports PostgreSQL 13+, so 18 is fully supported - Better performance and security features - Longer support lifecycle than 16 - No breaking changes from 16→18 Migration scripts remain compatible - the Django dumpdata/loaddata approach is version-agnostic and works across all PostgreSQL versions. --- ui/UPGRADE.md | 26 +++++++++++++------------- ui/docker-compose-prod.yml | 2 +- ui/docker-compose.yml | 2 +- ui/migrate_postgres.sh | 18 +++++++++--------- ui/migrate_postgres_simple.sh | 12 ++++++------ 5 files changed, 30 insertions(+), 30 deletions(-) diff --git a/ui/UPGRADE.md b/ui/UPGRADE.md index e177c988..99c4e389 100644 --- a/ui/UPGRADE.md +++ b/ui/UPGRADE.md @@ -21,13 +21,13 @@ under the License. This guide covers backward compatibility concerns and migration steps when upgrading Hamilton UI. -## Upgrading from PostgreSQL 12 to PostgreSQL 16 +## Upgrading from PostgreSQL 12 to PostgreSQL 18 **Affected versions:** Upgrading to versions after commit `0da07178` (February 2026) ### What Changed -Hamilton UI Docker setup now uses **PostgreSQL 16** instead of PostgreSQL 12 to support Django 6.0.2+, which requires PostgreSQL 14 or later. +Hamilton UI Docker setup now uses **PostgreSQL 18** instead of PostgreSQL 12 to support Django 6.0.2+, which requires PostgreSQL 13 or later. ### Do I Need to Migrate? @@ -56,7 +56,7 @@ cd hamilton/ui # Remove old PostgreSQL 12 data docker volume rm ui_postgres_data -# Start with PostgreSQL 16 +# Start with PostgreSQL 18 ./run.sh --build ``` @@ -83,20 +83,20 @@ docker compose exec db pg_dump -U hamilton hamilton > hamilton_backup.sql docker compose down ``` -##### Step 2: Upgrade to PostgreSQL 16 +##### Step 2: Upgrade to PostgreSQL 18 ```bash # Remove old PostgreSQL 12 volume docker volume rm ui_postgres_data -# Pull latest code with PostgreSQL 16 +# Pull latest code with PostgreSQL 18 git pull # or checkout the latest version # Start new containers ./run.sh --build ``` -##### Step 3: Import data into PostgreSQL 16 +##### Step 3: Import data into PostgreSQL 18 ```bash # Wait for database to be ready @@ -164,7 +164,7 @@ The Docker backend now uses **uv** instead of pip for dependency management. Thi ### Django 6.0+ Requirements -Django 6.0.2+ requires PostgreSQL 14 or later, which is why we upgraded to PostgreSQL 16. +Django 6.0.2+ requires PostgreSQL 13 or later, which is why we upgraded to PostgreSQL 18. ## Migration Script @@ -172,13 +172,13 @@ For automated migration, you can use this script: ```bash #!/bin/bash -# migrate_postgres.sh - Migrate Hamilton UI from PostgreSQL 12 to 16 +# migrate_postgres.sh - Migrate Hamilton UI from PostgreSQL 12 to 18 set -e BACKUP_FILE="hamilton_backup_$(date +%Y%m%d_%H%M%S).sql" -echo "Hamilton UI PostgreSQL 12 → 16 Migration" +echo "Hamilton UI PostgreSQL 12 → 18 Migration" echo "========================================" echo "" @@ -202,10 +202,10 @@ echo "✓ Old data removed" echo "" # Start new -echo "Step 3: Starting PostgreSQL 16..." +echo "Step 3: Starting PostgreSQL 18..." ./run.sh --build sleep 15 # Wait for initialization -echo "✓ PostgreSQL 16 ready" +echo "✓ PostgreSQL 18 ready" echo "" # Restore @@ -240,13 +240,13 @@ If you encounter issues during migration: | Hamilton UI Version | PostgreSQL Version | Python Version | Django Version | |--------------------|--------------------|----------------|----------------| | < 0.0.17 (2026-02) | 12 | 3.8 | 4.2 | -| ≥ 0.0.17 (2026-02) | 16 | 3.12 | 6.0.2 | +| ≥ 0.0.17 (2026-02) | 18 | 3.12 | 6.0.2 | ## FAQ **Q: Can I continue using PostgreSQL 12?** -No. Django 6.0.2+ explicitly requires PostgreSQL 14 or later. You must upgrade to at least PostgreSQL 14 (we recommend 16). +No. Django 6.0.2+ explicitly requires PostgreSQL 13 or later. You must upgrade to at least PostgreSQL 13 (we recommend 18 for the latest features and long-term support). **Q: Will my PyPI installation be affected?** diff --git a/ui/docker-compose-prod.yml b/ui/docker-compose-prod.yml index 1c3b9265..57ff7101 100644 --- a/ui/docker-compose-prod.yml +++ b/ui/docker-compose-prod.yml @@ -3,7 +3,7 @@ version: '3.8' services: db: - image: postgres:16 + image: postgres:18 volumes: - postgres_data:/var/lib/postgresql/data environment: diff --git a/ui/docker-compose.yml b/ui/docker-compose.yml index 2003ec4f..a7e15ceb 100644 --- a/ui/docker-compose.yml +++ b/ui/docker-compose.yml @@ -2,7 +2,7 @@ version: '3.8' services: db: - image: postgres:16 + image: postgres:18 volumes: - postgres_data:/var/lib/postgresql/data environment: diff --git a/ui/migrate_postgres.sh b/ui/migrate_postgres.sh index 7bfa734f..2456c732 100755 --- a/ui/migrate_postgres.sh +++ b/ui/migrate_postgres.sh @@ -16,20 +16,20 @@ # specific language governing permissions and limitations # under the License. -# migrate_postgres.sh - Migrate Hamilton UI from PostgreSQL 12 to 16 +# migrate_postgres.sh - Migrate Hamilton UI from PostgreSQL 12 to 18 set -e BACKUP_FILE="hamilton_backup_$(date +%Y%m%d_%H%M%S).sql" -echo "Hamilton UI PostgreSQL 12 → 16 Migration" +echo "Hamilton UI PostgreSQL 12 → 18 Migration" echo "========================================" echo "" echo "This script will:" echo " 1. Backup your PostgreSQL 12 data" echo " 2. Stop containers and remove old data volume" -echo " 3. Start PostgreSQL 16 containers" -echo " 4. Restore your data to PostgreSQL 16" +echo " 3. Start PostgreSQL 18 containers" +echo " 4. Restore your data to PostgreSQL 18" echo "" read -p "Continue? (yes/no): " CONFIRM @@ -56,8 +56,8 @@ fi # Check PostgreSQL version PG_VERSION=$($DOCKER_COMPOSE exec -T db psql -U hamilton -d hamilton -c "SHOW server_version;" -t | tr -d ' ') -if [[ $PG_VERSION == 16* ]]; then - echo "You are already running PostgreSQL 16. No migration needed." +if [[ $PG_VERSION == 18* ]]; then + echo "You are already running PostgreSQL 18. No migration needed." exit 0 fi @@ -79,7 +79,7 @@ echo "✓ Old data removed" echo "" # Start new -echo "Step 3: Starting PostgreSQL 16 containers..." +echo "Step 3: Starting PostgreSQL 18 containers..." echo " This may take a few minutes on first run..." ./run.sh --build > /tmp/hamilton_build.log 2>&1 & BUILD_PID=$! @@ -104,11 +104,11 @@ until $DOCKER_COMPOSE exec -T db pg_isready -U hamilton > /dev/null 2>&1; do sleep 2 done -echo "✓ PostgreSQL 16 ready" +echo "✓ PostgreSQL 18 ready" echo "" # Restore -echo "Step 4: Restoring data to PostgreSQL 16..." +echo "Step 4: Restoring data to PostgreSQL 18..." echo " (Ignoring 'already exists' errors - this is normal)" $DOCKER_COMPOSE exec -T db psql -U hamilton hamilton < "$BACKUP_FILE" 2>&1 | \ grep -v "ERROR:.*already exists" | \ diff --git a/ui/migrate_postgres_simple.sh b/ui/migrate_postgres_simple.sh index 8e331abd..201ddcf3 100755 --- a/ui/migrate_postgres_simple.sh +++ b/ui/migrate_postgres_simple.sh @@ -16,20 +16,20 @@ # specific language governing permissions and limitations # under the License. -# migrate_postgres_simple.sh - Migrate Hamilton UI from PostgreSQL 12 to 16 +# migrate_postgres_simple.sh - Migrate Hamilton UI from PostgreSQL 12 to 18 # Uses Django's dumpdata/loaddata for safe, validated migration set -euo pipefail BACKUP_FILE="hamilton_migration_$(date +%Y%m%d_%H%M%S).json" -echo "Hamilton UI PostgreSQL 12 → 16 Migration" +echo "Hamilton UI PostgreSQL 12 → 18 Migration" echo "=========================================" echo "" echo "This script will:" echo " 1. Export your Hamilton data using Django" echo " 2. Stop containers and remove PostgreSQL 12 volume" -echo " 3. Start PostgreSQL 16 containers" +echo " 3. Start PostgreSQL 18 containers" echo " 4. Restore your Hamilton data" echo "" @@ -54,14 +54,14 @@ fi echo "Checking current PostgreSQL version..." PG_VERSION=$($DOCKER_COMPOSE exec -T db psql -U hamilton -d hamilton -At -c "SHOW server_version;" | cut -d. -f1) -if [ "$PG_VERSION" -ge 16 ]; then +if [ "$PG_VERSION" -ge 18 ]; then echo "Already on PostgreSQL $PG_VERSION. No migration needed." exit 0 fi if [ "$PG_VERSION" -lt 12 ]; then echo "Error: PostgreSQL $PG_VERSION detected" - echo "This script handles PostgreSQL 12+ → 16" + echo "This script handles PostgreSQL 12+ → 18" echo "Manual upgrade required for older versions" exit 1 fi @@ -135,7 +135,7 @@ fi echo "" echo "================================================================" -echo "Step 3: Starting PostgreSQL 16" +echo "Step 3: Starting PostgreSQL 18" echo "================================================================" echo ""
