diff options
Diffstat (limited to 'lib/oracle-db/nonsap/run-generate-schema.sh')
| -rwxr-xr-x | lib/oracle-db/nonsap/run-generate-schema.sh | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/lib/oracle-db/nonsap/run-generate-schema.sh b/lib/oracle-db/nonsap/run-generate-schema.sh new file mode 100755 index 00000000..b2e215ae --- /dev/null +++ b/lib/oracle-db/nonsap/run-generate-schema.sh @@ -0,0 +1,63 @@ +#!/bin/bash + +# NonSAP Oracle to PostgreSQL 스키마 생성 스크립트 + +echo "🚀 NonSAP Oracle to PostgreSQL Schema Generation" +echo "================================================" + +# 현재 디렉토리 확인 +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +cd "$SCRIPT_DIR" + +echo "📍 Working directory: $SCRIPT_DIR" + +# CSV 파일 존재 확인 +if [ ! -f "1.table-and-columns-info.csv" ]; then + echo "❌ Error: 1.table-and-columns-info.csv not found" + exit 1 +fi + +echo "✅ Found CSV file: 1.table-and-columns-info.csv" + +# 1. Oracle TypeScript 타입 생성 +echo "" +echo "📝 Step 1: Generating Oracle TypeScript types..." +if command -v python3 &> /dev/null; then + python3 2.generate-oracle-types.py + if [ $? -eq 0 ]; then + echo "✅ Oracle TypeScript types generated successfully" + else + echo "❌ Failed to generate Oracle TypeScript types" + exit 1 + fi +else + echo "❌ Error: Python3 not found. Please install Python3" + exit 1 +fi + +# 2. PostgreSQL Drizzle 스키마 생성 +echo "" +echo "🐘 Step 2: Generating PostgreSQL Drizzle schema..." +if command -v npx &> /dev/null; then + npx tsx 3.generate-postgres-drizzle-schema.ts + if [ $? -eq 0 ]; then + echo "✅ PostgreSQL Drizzle schema generated successfully" + else + echo "❌ Failed to generate PostgreSQL Drizzle schema" + exit 1 + fi +else + echo "❌ Error: npx not found. Please install Node.js and npm" + exit 1 +fi + +echo "" +echo "🎉 Schema generation completed!" +echo "" +echo "📄 Generated files:" +echo " - oracle-schema.ts (TypeScript types)" +echo " - schema.ts (Drizzle schema)" +echo "" +echo "💡 Usage:" +echo " import { Table } from './oracle-schema';" +echo " import { cmctbVendorGeneral } from './schema';"
\ No newline at end of file |
