dbsafe is a pre-execution safety analysis tool for MySQL, eliminating guesswork in DDL and DML operations. With features like risk assessment, impact estimation, and rollback plans, it ensures safe database changes without modifying data. Perfect for CI/CD integrations, dbsafe provides insights that empower informed decision-making.
Know exactly what your MySQL DDL/DML operations will do before executing them. dbsafe offers a robust solution for pre-execution safety analysis, eliminating uncertainties and ensuring safer database management.
CREATE USER 'dbsafe'@'%' IDENTIFIED BY '<password>';
GRANT SELECT ON *.* TO 'dbsafe'@'%';
GRANT PROCESS ON *.* TO 'dbsafe'@'%';
GRANT REPLICATION CLIENT ON *.* TO 'dbsafe'@'%';
-- ⚠️ No write permissions ever.
```**
2. **Initialize configuration:**
```bash
dbsafe config init
dbsafe connect
dbsafe plan "ALTER TABLE users ADD COLUMN email VARCHAR(255)"
Receive a detailed analysis outlining the consequences and risks associated with this operation.
DDL Operations: From ADD COLUMN to DROP INDEX, dbsafe accurately detects algorithm types, rebuild warnings, and handles concurrent DDL operations seamlessly.
DML Operations: Efficiently estimate affected rows for DELETE, UPDATE, and INSERT operations, including automatic chunking recommendations for large datasets.
Topology Detection: dbsafe identifies cluster types (Galera, Group Replication, Standalone) to provide context-aware analysis and recommendations.
To analyze a DDL operation:
dbsafe plan "ALTER TABLE orders ADD INDEX idx_created (created_at)"
This analysis offers a comprehensive report including recommendations and expected execution time, ensuring informed decision-making.
Different output formats are available for various use cases:
| Format | Flag | Use Case |
|---|---|---|
| 🎨 Text | --format text | Default styled terminal output |
| 📄 Plain | --format plain | Safe for logs and piping |
| 📊 JSON | --format json | Ideal for CI/CD integrations |
| 📝 Markdown | --format markdown | Suitable for documentation and reports |
Configure through ~/.dbsafe/config.yaml, defining connection details, chunk sizes, and preferred output formats to fit different environments and requirements.
Contributions to dbsafe are welcome! Engage in improving this tool to enhance MySQL safety practices for all users.
No comments yet.
Sign in to be the first to comment.