Files
relspecgo/pkg/inspector/TODO.md
Hein 97a57f5dc8
Some checks failed
CI / Test (1.24) (push) Successful in -25m44s
CI / Test (1.25) (push) Successful in -25m40s
CI / Build (push) Successful in -25m53s
CI / Lint (push) Successful in -25m45s
Integration Tests / Integration Tests (push) Failing after -26m2s
feature: Inspector Gadget
2025-12-31 01:40:08 +02:00

2.6 KiB

Inspector TODO

See the Inspector README for complete documentation of implemented features.

Implemented ✓

  • Core validation framework with configurable rules
  • YAML configuration with three severity levels (enforce/warn/off)
  • Generic validators (table_regexpr, column_regexpr)
  • Primary key validation (naming, datatype, auto-increment)
  • Foreign key validation (column naming, constraint naming, indexes)
  • Naming convention validation (snake_case, custom patterns)
  • Length validation (table names, column names)
  • Reserved keywords detection
  • Schema integrity checks (missing PKs, orphaned FKs, circular dependencies)
  • Multiple output formats (Markdown with ANSI colors, JSON)
  • Terminal-aware color output
  • All input formats supported (PostgreSQL, DBML, JSON, GORM, Bun, etc.)
  • CI/CD integration support (proper exit codes)
  • Comprehensive documentation and examples

Future Enhancements

Reporting Enhancements

  • Add verbose mode to show all passing checks in detail
  • Add summary-only mode (suppress violation details)
  • Group violations by table/schema in report
  • Add statistics: most violated rules, tables with most issues
  • HTML report format with interactive filtering

Additional Validators

  • Optimal column order for space and storage efficiency
  • Similar-sounding column names detection (synonyms, typos)
  • Plural/singular table name consistency
  • Column order validation (PK first, FKs next, data columns, timestamps last)
  • Data type consistency across related columns
  • Index coverage analysis
  • Unused indexes detection
  • Missing indexes on commonly filtered columns
  • Table size estimates and warnings for large tables

Auto-Fix Capabilities

  • Auto-fix mode (relspec inspect --fix)
  • Update foreign key types to match primary key types
  • Rename foreign keys to match primary key names with configurable prefix/suffix
  • Reorder columns according to rules
  • Add missing indexes on foreign keys
  • Generate migration scripts for fixes
  • Dry-run mode to preview changes

Advanced Features

  • Custom validator plugins (Go plugin system)
  • Rule templates for different databases (PostgreSQL, MySQL, etc.)
  • Rule inheritance and composition
  • Conditional rules (apply only to certain schemas/tables)
  • Performance metrics in report (validation time per rule)
  • Caching for large databases
  • Incremental validation (only changed tables)
  • Watch mode for continuous validation