Skip to content

Commit 640a01d

Browse files
committed
Support BINARY type name for SQLite
1 parent 22c535f commit 640a01d

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

  • diesel_infer_schema/infer_schema_internals/src

diesel_infer_schema/infer_schema_internals/src/sqlite.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ pub fn determine_column_type(attr: &ColumnInformation) -> Result<ColumnType, Box
169169
String::from("Integer")
170170
} else if is_text(&type_name) {
171171
String::from("Text")
172-
} else if type_name.contains("blob") || type_name.is_empty() {
172+
} else if is_binary(&type_name) {
173173
String::from("Binary")
174174
} else if is_float(&type_name) {
175175
String::from("Float")
@@ -196,6 +196,10 @@ fn is_text(type_name: &str) -> bool {
196196
type_name.contains("char") || type_name.contains("clob") || type_name.contains("text")
197197
}
198198

199+
fn is_binary(type_name: &str) -> bool {
200+
type_name.contains("blob") || type_name.contains("binary") || type_name.is_empty()
201+
}
202+
199203
fn is_bool(type_name: &str) -> bool {
200204
type_name == "boolean" || type_name.contains("tiny") && type_name.contains("int")
201205
}

0 commit comments

Comments
 (0)