|
| 1 | +{ |
| 2 | + "generatedAt": "2025-11-14T00:00:00.000Z", |
| 3 | + "description": "Schema inventory of JSON-encoded array/object fields stored as String requiring normalization to Json type for Harden Checkout, Tenancy, Newsletter (T038).", |
| 4 | + "fields": [ |
| 5 | + { |
| 6 | + "model": "Product", |
| 7 | + "field": "images", |
| 8 | + "currentType": "String (JSON array of blob URLs)", |
| 9 | + "semantics": "ARRAY_STRING", |
| 10 | + "recommendedType": "Json", |
| 11 | + "migrationId": "T038b", |
| 12 | + "parseStrategy": "Try JSON.parse; if invalid or empty string, set []", |
| 13 | + "risk": "low", |
| 14 | + "tests": ["migration parses valid arrays", "empty string becomes []", "invalid JSON causes row flagged"] |
| 15 | + }, |
| 16 | + { |
| 17 | + "model": "Product", |
| 18 | + "field": "metaKeywords", |
| 19 | + "currentType": "String (JSON array)", |
| 20 | + "semantics": "ARRAY_STRING", |
| 21 | + "recommendedType": "Json", |
| 22 | + "migrationId": "T038c", |
| 23 | + "parseStrategy": "JSON.parse or [] if falsy", |
| 24 | + "risk": "low", |
| 25 | + "tests": ["keywords preserved", "null/empty -> []"] |
| 26 | + }, |
| 27 | + { |
| 28 | + "model": "ProductVariant", |
| 29 | + "field": "options", |
| 30 | + "currentType": "String (JSON object)", |
| 31 | + "semantics": "OBJECT", |
| 32 | + "recommendedType": "Json", |
| 33 | + "migrationId": "T038d", |
| 34 | + "parseStrategy": "JSON.parse; must be object else {}", |
| 35 | + "risk": "medium", |
| 36 | + "tests": ["object keys preserved", "non-object becomes {}"] |
| 37 | + }, |
| 38 | + { |
| 39 | + "model": "ProductAttribute", |
| 40 | + "field": "values", |
| 41 | + "currentType": "String (JSON array)", |
| 42 | + "semantics": "ARRAY_STRING", |
| 43 | + "recommendedType": "Json", |
| 44 | + "migrationId": "T038e", |
| 45 | + "parseStrategy": "JSON.parse or []", |
| 46 | + "risk": "low", |
| 47 | + "tests": ["values preserved", "empty -> []"] |
| 48 | + }, |
| 49 | + { |
| 50 | + "model": "Review", |
| 51 | + "field": "images", |
| 52 | + "currentType": "String (JSON array of blob URLs)", |
| 53 | + "semantics": "ARRAY_STRING", |
| 54 | + "recommendedType": "Json", |
| 55 | + "migrationId": "T038f", |
| 56 | + "parseStrategy": "JSON.parse or []", |
| 57 | + "risk": "low", |
| 58 | + "tests": ["images preserved", "empty -> []"] |
| 59 | + }, |
| 60 | + { |
| 61 | + "model": "ShippingZone", |
| 62 | + "field": "countries", |
| 63 | + "currentType": "String (JSON array of ISO country codes)", |
| 64 | + "semantics": "ARRAY_STRING", |
| 65 | + "recommendedType": "Json", |
| 66 | + "migrationId": "T038g", |
| 67 | + "parseStrategy": "JSON.parse or []", |
| 68 | + "risk": "low", |
| 69 | + "tests": ["countries preserved", "invalid -> []"] |
| 70 | + }, |
| 71 | + { |
| 72 | + "model": "Page", |
| 73 | + "field": "metaKeywords", |
| 74 | + "currentType": "String (JSON array)", |
| 75 | + "semantics": "ARRAY_STRING", |
| 76 | + "recommendedType": "Json", |
| 77 | + "migrationId": "T038h", |
| 78 | + "parseStrategy": "JSON.parse or []", |
| 79 | + "risk": "low", |
| 80 | + "tests": ["keywords preserved", "invalid -> []"] |
| 81 | + }, |
| 82 | + { |
| 83 | + "model": "EmailTemplate", |
| 84 | + "field": "variables", |
| 85 | + "currentType": "String (JSON array)", |
| 86 | + "semantics": "ARRAY_STRING", |
| 87 | + "recommendedType": "Json", |
| 88 | + "migrationId": "T038i", |
| 89 | + "parseStrategy": "JSON.parse or []", |
| 90 | + "risk": "low", |
| 91 | + "tests": ["variables preserved", "invalid -> []"] |
| 92 | + }, |
| 93 | + { |
| 94 | + "model": "Webhook", |
| 95 | + "field": "events", |
| 96 | + "currentType": "String (JSON array)", |
| 97 | + "semantics": "ARRAY_STRING", |
| 98 | + "recommendedType": "Json", |
| 99 | + "migrationId": "T038j", |
| 100 | + "parseStrategy": "JSON.parse or []", |
| 101 | + "risk": "low", |
| 102 | + "tests": ["events preserved", "invalid -> []"] |
| 103 | + }, |
| 104 | + { |
| 105 | + "model": "Payment", |
| 106 | + "field": "metadata", |
| 107 | + "currentType": "String? (JSON gateway-specific)", |
| 108 | + "semantics": "OBJECT_OPTIONAL", |
| 109 | + "recommendedType": "Json?", |
| 110 | + "migrationId": "T038k", |
| 111 | + "parseStrategy": "If null skip; else JSON.parse; if invalid -> store validation error separately", |
| 112 | + "risk": "medium", |
| 113 | + "tests": ["metadata preserved", "invalid JSON flagged"] |
| 114 | + }, |
| 115 | + { |
| 116 | + "model": "SyncLog", |
| 117 | + "field": "metadata", |
| 118 | + "currentType": "String? (JSON)", |
| 119 | + "semantics": "OBJECT_OPTIONAL", |
| 120 | + "recommendedType": "Json?", |
| 121 | + "migrationId": "T038l", |
| 122 | + "parseStrategy": "If null skip; else JSON.parse or {}", |
| 123 | + "risk": "low", |
| 124 | + "tests": ["preserves object", "null untouched"] |
| 125 | + }, |
| 126 | + { |
| 127 | + "model": "AuditLog", |
| 128 | + "field": "changes", |
| 129 | + "currentType": "String? (JSON diff object)", |
| 130 | + "semantics": "OBJECT_OPTIONAL", |
| 131 | + "recommendedType": "Json?", |
| 132 | + "migrationId": "T038m", |
| 133 | + "parseStrategy": "If null skip; else JSON.parse or {}", |
| 134 | + "risk": "medium", |
| 135 | + "tests": ["diff object preserved", "invalid -> {}"] |
| 136 | + } |
| 137 | + ], |
| 138 | + "summary": { |
| 139 | + "arrayFields": 9, |
| 140 | + "objectFields": 1, |
| 141 | + "optionalObjectFields": 3, |
| 142 | + "total": 13, |
| 143 | + "nextSteps": [ |
| 144 | + "Generate Prisma migration altering field types from String to Json/Json?", |
| 145 | + "Write backfill script to parse existing data", |
| 146 | + "Add integration tests under tests/integration/migrations/json-fields.spec.ts", |
| 147 | + "Update application code to treat these fields as typed JSON instead of string", |
| 148 | + "Add validation guards when writing to these fields going forward" |
| 149 | + ] |
| 150 | + } |
| 151 | +} |
0 commit comments