update databasing system with minimum API, schema parsing and FreeCAD

integration
This commit is contained in:
Forbes
2026-01-24 15:03:17 -06:00
parent eafdc30f32
commit c327baf36f
51 changed files with 11635 additions and 0 deletions

36
scripts/init-db.sh Executable file
View File

@@ -0,0 +1,36 @@
#!/bin/bash
# Initialize the Silo database
# This script waits for PostgreSQL to be ready and runs migrations
set -e
# Configuration
DB_HOST="${SILO_DB_HOST:-localhost}"
DB_PORT="${SILO_DB_PORT:-5432}"
DB_NAME="${SILO_DB_NAME:-silo}"
DB_USER="${SILO_DB_USER:-silo}"
DB_PASSWORD="${SILO_DB_PASSWORD:-silodev}"
# Wait for PostgreSQL to be ready
echo "Waiting for PostgreSQL at $DB_HOST:$DB_PORT..."
until PGPASSWORD="$DB_PASSWORD" psql -h "$DB_HOST" -p "$DB_PORT" -U "$DB_USER" -d "$DB_NAME" -c '\q' 2>/dev/null; do
echo "PostgreSQL is unavailable - sleeping"
sleep 2
done
echo "PostgreSQL is ready!"
# Run migrations
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
MIGRATIONS_DIR="${SCRIPT_DIR}/../migrations"
echo "Running migrations from $MIGRATIONS_DIR..."
for migration in "$MIGRATIONS_DIR"/*.sql; do
if [ -f "$migration" ]; then
echo "Applying $(basename "$migration")..."
PGPASSWORD="$DB_PASSWORD" psql -h "$DB_HOST" -p "$DB_PORT" -U "$DB_USER" -d "$DB_NAME" -f "$migration"
fi
done
echo "Database initialization complete!"