In Python, bool is a subclass of int (isinstance(True, int) == True). Combined with CSV tools that coerce "0" and "1" counts into booleans, migrations routinely corrupt small integer counters or collapse flags into integers.
| Input Column Sample | Naive Inference Bug | Migrate-Anything Rule |
|---|---|---|
is_active: ["true", "false"] |
SQLite round-trips as 0/1 integer, breaking Postgres BOOLEAN import. |
Inferred as bool; hashed as {"t":"bool","v":true}. |
retry_count: ["0", "1", "0"] |
Coerced to bool when sample lacks values >= 2. |
Kept strictly as int unless schema explicitly declares boolean affinity. |
mixed: ["true", "1"] |
Silently drops type distinction. | Emits boolean_vs_int_strict_guard warning in dry-run report. |
/v1/infer-schemacurl -sS -X POST https://migrate.fastmesh.dev/v1/infer-schema \
-H "Content-Type: application/json" \
-d '{
"source_format": "csv",
"target_format": "postgres_ddl",
"table_name": "type_guard_check",
"source_data": "id,is_active,retry_count\n1,true,1\n2,false,0"
}'