andb-core
v1.0.5
Published
Database migration and comparison tool by ph4n4n
Maintainers
Readme
andb-core
Database migration and comparison tool by ph4n4n
Quick Start
# Install
npm install andb-core
# Basic usage
andb export -t tables
andb compare -f functions
andb migrate:new -p procedures🚀 Features
- ✅ Database Export - Tables, Procedures, Functions, Triggers
- ✅ Environment Comparison - Compare between DEV/STAGE/PROD
- ✅ Migration Tools - New/Update/Remove objects
- ✅ Script Generator - Auto-generate npm scripts
- ✅ Multi-Environment - Support DEV/PROD workflows (extensible)
📚 Documentation
🇺🇸 English
- 📖 CLI Usage - Complete CLI commands
- 📖 Script Generator - Auto-generate npm scripts
- 📖 Integration Guide - Programmatic usage
- 📖 Examples - Ready-to-use examples
🇻🇳 Tiếng Việt
- 📖 Hướng dẫn CLI - Lệnh CLI đầy đủ
- 📖 Script Generator - Tự động sinh npm scripts
- 📖 Hướng dẫn tích hợp - Sử dụng programmatic
- 📖 Ví dụ - Ví dụ sẵn sàng sử dụng
🛠️ Script Generator
Auto-generate npm scripts for your workflow:
# Generate with default config
npm run generate
# Custom environments
ANDB_ENVIRONMENTS="DEV,STAGE,PROD" npm run generate
# Generated scripts
npm run export:dev:fn # Export functions from DEV
npm run compare:prod:sp # Compare procedures in PROD
npm run migrate:stage:new # Migrate new objects to STAGE📖 Documentation: GENERATOR.md | GENERATOR_EN.md
📁 Project Structure
andb-core/
├── core/ # Core functionality
├── examples/ # Integration examples
├── docs/ # Documentation
├── scripts/ # CLI scripts
└── test/ # Test files🔧 Environment Setup
# .env
DEV_DB_HOST=localhost
DEV_DB_NAME=dev_database
DEV_DB_USER=root
DEV_DB_PASS=password
PROD_DB_HOST=prod-server.com
PROD_DB_NAME=prod_database
PROD_DB_USER=prod_user
PROD_DB_PASS=prod_password
# 💡 Extend with more environments
# STAGE_DB_HOST=stage-server.com
# STAGE_DB_NAME=stage_database
# STAGE_DB_USER=stage_user
# STAGE_DB_PASS=stage_password📊 Output Structure
📦 <environment>
├── 📂 <schema>
│ ├── 📄 current-ddl
│ ├── ⚙️ functions
│ ├── 🔧 procedures
│ ├── 📊 tables
│ └── 🔄 triggers
└── 📂 backup/
└── 📅 <date>/🤝 Contributing
- Fork the repository
- Create feature branch
- Commit changes
- Push to branch
- Create Pull Request
📄 License
MIT License - see LICENSE file
ph4n4n
