Refactor rebuild process and enhance service management in rebuild-solution.sh

This commit is contained in:
2026-07-08 14:45:49 -04:00
parent 94e46a04a7
commit 2415f288f7
3 changed files with 50 additions and 42 deletions
+5 -3
View File
@@ -91,7 +91,9 @@ done
set -e # Exit on error
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"
PROJECT_ROOT="$(dirname "$(dirname "$SCRIPT_DIR")")"
PROGRAM_DIR="$PROJECT_ROOT" # Assuming program directory is the project root
SQL_DIR="$PROGRAM_DIR/sql/diagnostics"
# Load database configuration
source "./db-config.sh"
@@ -116,7 +118,7 @@ invoke_diagnostic_report() {
local output_file="$1"
write_color_output "\nRunning comprehensive diagnostics..." "$CYAN"
if PGPASSWORD=$DB_PASS $PSQL_PATH -h $DB_HOST -p $DB_PORT -U $DB_USER -d $DB_NAME -f "$PROJECT_ROOT/sql/diagnostics.sql" > "$output_file" 2>&1; then
if PGPASSWORD=$DB_PASS $PSQL_PATH -h $DB_HOST -p $DB_PORT -U $DB_USER -d $DB_NAME -f "$SQL_DIR/diagnostics.sql" > "$output_file" 2>&1; then
write_color_output "[OK] Diagnostics completed: $output_file" "$GREEN"
else
write_color_output "[WARN] Diagnostics completed with warnings" "$YELLOW"
@@ -127,7 +129,7 @@ invoke_query_analysis() {
local output_file="$1"
write_color_output "\nAnalyzing slow queries..." "$CYAN"
if PGPASSWORD=$DB_PASS $PSQL_PATH -h $DB_HOST -p $DB_PORT -U $DB_USER -d $DB_NAME -f "$PROJECT_ROOT/sql/query-analysis.sql" > "$output_file" 2>&1; then
if PGPASSWORD=$DB_PASS $PSQL_PATH -h $DB_HOST -p $DB_PORT -U $DB_USER -d $DB_NAME -f "$SQL_DIR/query-analysis.sql" > "$output_file" 2>&1; then
write_color_output "[OK] Query analysis completed: $output_file" "$GREEN"
else
write_color_output "[WARN] Query analysis completed with warnings" "$YELLOW"