Files
relspecgo/pkg/inspector/TODO.md
Hein 64aeac972a
Some checks failed
CI / Test (1.24) (push) Successful in -25m43s
CI / Test (1.25) (push) Successful in -25m39s
CI / Build (push) Successful in -25m54s
CI / Lint (push) Successful in -25m43s
Integration Tests / Integration Tests (push) Failing after -26m1s
Release / Build and Release (push) Successful in -24m59s
feature: I had an idea
2025-12-31 01:51:37 +02:00

2.8 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
  • Function naming conventions (here we have my rules used in Bitech etc. Work from a rules file.)
  • View naming conventions
  • Enum naming conventions
  • Custom type naming conventions
  • Table name consistency across related 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