trading-platform-database/ddl/schemas/education/uninstall.sh

56 lines
1.6 KiB
Bash
Executable File

#!/bin/bash
# =====================================================
# UNINSTALL SCRIPT - Schema Education
# =====================================================
# Proyecto: OrbiQuant IA (Trading Platform)
# Módulo: OQI-002 - Education
# =====================================================
set -e
# Colors
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m'
# Configuration
DB_HOST="${DB_HOST:-localhost}"
DB_PORT="${DB_PORT:-5432}"
DB_NAME="${DB_NAME:-orbiquant}"
DB_USER="${DB_USER:-postgres}"
SCHEMA_NAME="education"
echo -e "${YELLOW}=================================================${NC}"
echo -e "${YELLOW} OrbiQuant IA - Education Schema Uninstall${NC}"
echo -e "${YELLOW}=================================================${NC}"
echo ""
echo -e "${RED}WARNING: This will DROP the entire '$SCHEMA_NAME' schema and ALL its data!${NC}"
echo ""
read -p "Are you sure you want to continue? (type 'yes' to confirm): " CONFIRM
if [ "$CONFIRM" != "yes" ]; then
echo "Uninstall cancelled."
exit 0
fi
echo ""
echo -e "${YELLOW}${NC} Dropping schema: $SCHEMA_NAME (CASCADE)"
if PGPASSWORD=$DB_PASSWORD psql -h "$DB_HOST" -p "$DB_PORT" -U "$DB_USER" -d "$DB_NAME" -c "DROP SCHEMA IF EXISTS $SCHEMA_NAME CASCADE;" > /dev/null 2>&1; then
echo -e "${GREEN} ✓ Schema dropped successfully${NC}"
else
echo -e "${RED} ✗ Failed to drop schema${NC}"
exit 1
fi
echo ""
echo -e "${GREEN}=================================================${NC}"
echo -e "${GREEN} Uninstall Complete!${NC}"
echo -e "${GREEN}=================================================${NC}"
echo ""
echo "Schema '$SCHEMA_NAME' has been removed."
echo ""