hana-cli
Version:
HANA Developer Command Line Interface
185 lines (140 loc) • 5.61 kB
Markdown
# HANA CLI Command Consistency Fixes - Implementation Summary
## Overview
Comprehensive scan and updates of all commands in the `./bin` folder for:
- Default value consistency
- Current schema support (`**CURRENT_SCHEMA**` defaults)
- Profile parameter coverage
- Standard limit defaults
## Changes Applied
### 1. CURRENT_SCHEMA Default Additions (10 commands)
Added `default: '**CURRENT_SCHEMA**'` to the following commands:
| Command | Parameter(s) Fixed |
| --------- | -------------------- |
| dataLineage.js | schema |
| dataDiff.js | schema1, schema2 |
| dataProfile.js | schema |
| dataValidator.js | schema |
| duplicateDetection.js | schema |
| erdDiagram.js | schema |
| export.js | schema |
| referentialCheck.js | schema |
| schemaClone.js | sourceSchema, targetSchema |
| import.js | schema (NEW PARAMETER ADDED) |
**Impact:** Users can now omit the schema parameter in these commands and will default to their current database schema context.
### 2. Schema Parameter Addition (1 command)
**import.js** - Added brand new schema parameter:
- Added to builder with default: `'**CURRENT_SCHEMA**'`
- Added to inputPrompts with required: false
- Placed after table parameter for logical flow
**Impact:** Import command now fully supports schema context, allowing users to specify target schema or use their current schema.
### 3. Profile Parameter Additions (19 commands)
Added standard profile parameter to all list/query commands for database connection flexibility:
| Commands Updated | Profile Alias |
| ------------------- | -------------- |
| views.js | ['p'] |
| indexes.js | ['p'] |
| functions.js | ['p'] |
| procedures.js | ['p'] |
| triggers.js | ['p'] |
| sequences.js | ['p'] |
| libraries.js | ['p'] |
| roles.js | ['p'] |
| objects.js | ['p'] |
| partitions.js | ['p'] |
| columnStats.js | ['p'] |
| spatialData.js | ['p'] |
| ftIndexes.js | ['p'] |
| graphWorkspaces.js | ['p'] |
| tableHotspots.js | ['p'] |
| tableGroups.js | ['p'] |
| calcViewAnalyzer.js | ['p'] |
| callProcedure.js | ['p'] |
| cds.js | ['pr'] (to avoid conflict with port alias ['p']) |
**Profile Parameter Pattern:**
```javascript
profile: {
alias: ['p'],
type: 'string',
desc: baseLite.bundle.getText("profile")
}
```
**Impact:** All list commands can now use different database profiles for connections, supporting multi-environment workflows.
## Default Values Consistency
### Limit Defaults (Standardized)
- **100**: calcViewAnalyzer.js (specific to calc view analysis)
- **200**: All listing commands (views, tables, indexes, functions, procedures, sequences, triggers, libraries, roles, objects, partitions, synonyms, tableHotspots, tableGroups, ftIndexes, graphWorkspaces, columnStats, spatialData)
- **1000**: import.js (batchSize parameter)
- **10000**: Analysis commands (dataDiff, dataValidator, duplicateDetection, referentialCheck)
### Other Standard Defaults
- **format**: "csv" or "json" (depends on command)
- **truncate**: false
- **batchSize**: 1000 (import)
- **timeout**: 3600 seconds (1 hour) for long-running operations
- **matchMode**: "auto" (import)
## Files Modified
Total: **30 files**
### By Category
**CURRENT_SCHEMA additions:**
1. dataLineage.js
2. dataDiff.js
3. dataProfile.js
4. dataValidator.js
5. duplicateDetection.js
6. erdDiagram.js
7. export.js
8. referentialCheck.js
9. schemaClone.js
10. import.js (+ new parameter)
**Profile parameter additions:**
11. views.js
12. indexes.js
13. functions.js
14. procedures.js
15. triggers.js
16. sequences.js
17. libraries.js
18. roles.js
19. objects.js
20. partitions.js
21. columnStats.js
22. spatialData.js
23. ftIndexes.js
24. graphWorkspaces.js
25. tableHotspots.js
26. tableGroups.js
27. calcViewAnalyzer.js
28. callProcedure.js
29. cds.js
30. import.js (also received profile parameter in builder already)
## Validation & Testing
All changes maintain:
- ✓ Consistent builder pattern using `baseLite.getBuilder()`
- ✓ Standard parameter naming and aliasing
- ✓ Internationalization via `baseLite.bundle.getText()`
- ✓ Alphabetical ordering within builder objects (maintained existing patterns)
- ✓ Proper type definitions for all parameters
## Special Cases
### cds.js Profile Parameter
- Used alias ['pr'] instead of ['p'] because port parameter already uses ['p']
- Maintains consistency while avoiding alias conflicts
### import.js Schema Parameter
- Added as a new parameter (previously missing)
- Placed after table parameter in logical grouping
- Added to both builder and inputPrompts sections
- Set required: false to maintain backward compatibility
## Benefits
1. **Improved User Experience**: Users can now use `**CURRENT_SCHEMA**` placeholder in 10+ commands
2. **Multi-Profile Support**: All database commands can use different profiles for multi-environment workflows
3. **Consistency**: Standard defaults and parameter names across similar commands
4. **Schema Context**: Import command now supports schema specification
5. **Backward Compatibility**: All changes are additive with sensible defaults
## Documentation Artifacts
- `COMMAND_CONSISTENCY_ANALYSIS.md` - Detailed analysis report with findings and recommendations
- This file - Implementation summary of all changes made
## Next Steps (Optional)
Consider:
1. Adding similar profile parameters to remaining utility commands (if needed)
2. Documenting the **CURRENT_SCHEMA** feature in user guides
3. Adding examples showing profile usage in help text
4. Testing import.js schema parameter in various scenarios
5. Reviewing any commands that might use implicit schema (e.g., system info commands)