mirror of
https://github.com/freedbygrace/SQL.git
synced 2026-07-27 11:58:59 +00:00
Add automatic dependency installer and package checks
DEPENDENCY MANAGEMENT: - Created scripts/install-dependencies.sh - automatic installer for all required packages - Detects OS (Ubuntu, Debian, CentOS, RHEL, Fedora, Arch, macOS) - Installs PostgreSQL client (psql) automatically - Installs Docker & Docker Compose if missing - Installs utility packages (curl, wget, git) SCRIPT ENHANCEMENTS: - Updated setup-database.sh with dependency checking - Updated generate_data.sh with dependency checking - Updated verify-setup.sh with dependency checking - All scripts now prompt to run installer if dependencies are missing - Interactive prompts guide users through installation DOCUMENTATION: - Updated README.md with dependency installation instructions - Updated QUICKSTART.md with Step 0: Install Dependencies - Added supported OS list - Added automatic dependency check notes USER EXPERIENCE: - No more manual package installation required - Scripts fail gracefully with helpful error messages - One-command installation: ./scripts/install-dependencies.sh - Automatic detection and installation on Linux/macOS - Clear instructions for Windows users This ensures users can get started immediately without hunting for package installation commands.
This commit is contained in:
@@ -22,11 +22,43 @@ DB_NAME="${POSTGRES_DB:-business_analytics}"
|
||||
DB_USER="${POSTGRES_USER:-data_analyst}"
|
||||
DB_PASSWORD="${POSTGRES_PASSWORD:-SecurePass123!}"
|
||||
|
||||
# Script directory
|
||||
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
echo -e "${BLUE}============================================================================${NC}"
|
||||
echo -e "${BLUE}Business Analytics Database - Verification${NC}"
|
||||
echo -e "${BLUE}============================================================================${NC}"
|
||||
echo ""
|
||||
|
||||
# Check for required dependencies
|
||||
check_dependencies() {
|
||||
local missing_deps=()
|
||||
|
||||
# Check for psql
|
||||
if ! command -v psql >/dev/null 2>&1; then
|
||||
missing_deps+=("psql (PostgreSQL client)")
|
||||
fi
|
||||
|
||||
# Check for docker
|
||||
if ! command -v docker >/dev/null 2>&1; then
|
||||
missing_deps+=("docker")
|
||||
fi
|
||||
|
||||
if [ ${#missing_deps[@]} -gt 0 ]; then
|
||||
echo -e "${RED}✗ Missing required dependencies:${NC}"
|
||||
for dep in "${missing_deps[@]}"; do
|
||||
echo -e " - ${YELLOW}$dep${NC}"
|
||||
done
|
||||
echo ""
|
||||
echo -e "${YELLOW}Run the dependency installer:${NC}"
|
||||
echo -e " ${GREEN}./scripts/install-dependencies.sh${NC}"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Run dependency check
|
||||
check_dependencies
|
||||
|
||||
# Function to execute SQL and get result
|
||||
execute_sql() {
|
||||
PGPASSWORD=$DB_PASSWORD psql -h $DB_HOST -p $DB_PORT -U $DB_USER -d $DB_NAME -t -c "$1" 2>/dev/null | xargs
|
||||
|
||||
Reference in New Issue
Block a user