Use flags to detect MySQL enums

In some cases the returned value is of `ColumnType::String`, but it has
the `ENUM` flag set.
This commit is contained in:
Julius de Bruijn 2020-08-03 18:20:23 +02:00 committed by Ryan Leckey
parent 277d0413bc
commit 7a70717944

View File

@ -167,6 +167,7 @@ impl ColumnType {
) -> &'static str {
let is_binary = char_set == 63;
let is_unsigned = flags.contains(ColumnFlags::UNSIGNED);
let is_enum = flags.contains(ColumnFlags::ENUM);
match self {
ColumnType::Tiny if max_size == Some(1) => "BOOLEAN",
@ -196,6 +197,7 @@ impl ColumnType {
ColumnType::Json => "JSON",
ColumnType::String if is_binary => "BINARY",
ColumnType::String if is_enum => "ENUM",
ColumnType::VarChar | ColumnType::VarString if is_binary => "VARBINARY",
ColumnType::String => "CHAR",