mirror of
https://github.com/taylanbakircioglu/haproxy-openmanager.git
synced 2026-09-18 08:35:28 +00:00
6c24971c19
Database Type Consistency Fix:
- acl_rules: JSONB ✓
- redirect_rules: JSONB ✓
- use_backend_rules: TEXT ✗ (INCONSISTENT!)
Issue:
Different data types cause:
- JSON serialization inconsistencies
- Query performance differences
- Potential data corruption
Fix Applied:
1. CREATE TABLE (Line 2038):
Changed: use_backend_rules TEXT
To: use_backend_rules JSONB DEFAULT '[]'::jsonb
2. ALTER TABLE (Line 121):
Changed: ADD COLUMN use_backend_rules TEXT
To: ADD COLUMN use_backend_rules JSONB DEFAULT '[]'::jsonb
3. Type Conversion Migration (Line 2318-2334):
Added automatic conversion from TEXT to JSONB
Handles: NULL, empty string, existing JSON data
Safe conversion with CASE statement
Migration Logic:
IF column type is TEXT or VARCHAR:
- NULL → '[]'::jsonb
- Empty string → '[]'::jsonb
- Existing JSON → Parse to JSONB
- Invalid data → Fails gracefully
Benefits:
- Consistent JSONB type across all rule fields
- Better query performance (JSONB indexing)
- Type safety in application code
- Automatic array validation
Impact: SAFE - Migration runs automatically on startup