trading-platform-database-v2/ddl/schemas/education/uninstall.sh
rckrdmrd 45e77e9a9c feat: Initial commit - Database schemas and scripts
DDL schemas for Trading Platform:
- User management
- Authentication
- Payments
- Education
- ML predictions
- Trading data

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-18 04:30:23 -06:00

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:-trading_platform}"
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 ""