diff --git a/cmd/internal/planetscale_edge_database.go b/cmd/internal/planetscale_edge_database.go index bbf42ed..bd8ecf2 100644 --- a/cmd/internal/planetscale_edge_database.go +++ b/cmd/internal/planetscale_edge_database.go @@ -144,7 +144,7 @@ func getJsonSchemaType(mysqlType string, treatTinyIntAsBoolean bool) PropertyTyp return PropertyType{Type: "string", CustomFormat: "date-time", AirbyteType: "timestamp_without_timezone"} } - if mysqlType == "tinyint(1)" { + if strings.HasPrefix(mysqlType, "tinyint(1)") { if treatTinyIntAsBoolean { return PropertyType{Type: "boolean"} } diff --git a/cmd/internal/planetscale_edge_database_test.go b/cmd/internal/planetscale_edge_database_test.go index 3637b3a..f6107e3 100644 --- a/cmd/internal/planetscale_edge_database_test.go +++ b/cmd/internal/planetscale_edge_database_test.go @@ -219,12 +219,24 @@ func TestDiscover_CanPickRightAirbyteType(t *testing.T) { AirbyteType: "", TreatTinyIntAsBoolean: true, }, + { + MysqlType: "tinyint(1) unsigned", + JSONSchemaType: "boolean", + AirbyteType: "", + TreatTinyIntAsBoolean: true, + }, { MysqlType: "tinyint(1)", JSONSchemaType: "integer", AirbyteType: "", TreatTinyIntAsBoolean: false, }, + { + MysqlType: "tinyint(1) unsigned", + JSONSchemaType: "integer", + AirbyteType: "", + TreatTinyIntAsBoolean: false, + }, { MysqlType: "bigint(16)", JSONSchemaType: "string",