From 40277ec6711ce665cc64b6a63dcc9809aa9be9c0 Mon Sep 17 00:00:00 2001 From: ttyS3 Date: Sat, 14 Dec 2024 04:20:51 +0000 Subject: [PATCH] chore(mysql): map medium int to int, tinytext to varchar(255) --- src/mysql/writer/column.rs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/mysql/writer/column.rs b/src/mysql/writer/column.rs index 84c172e..d8afd3d 100644 --- a/src/mysql/writer/column.rs +++ b/src/mysql/writer/column.rs @@ -75,9 +75,12 @@ impl ColumnInfo { }; col_def = self.write_num_attr(col_def, num_attr); } - Type::MediumInt(_) => { - // FIXME: Unresolved type mapping - col_def.custom(self.col_type.clone()); + Type::MediumInt(num_attr) => { + match num_attr.unsigned { + Some(_) => col_def.unsigned(), + None => col_def.integer(), + }; + col_def = self.write_num_attr(col_def, num_attr); } Type::Int(num_attr) => { match num_attr.unsigned { @@ -169,8 +172,9 @@ impl ColumnInfo { col_def = self.write_str_attr(col_def, str_attr); } Type::TinyText(_) => { - // FIXME: Unresolved type mapping - col_def.custom(self.col_type.clone()); + // map to varchar(255) + col_def.string_len(255); + col_def.extra(format!("CHARACTER SET {}", CharSet::Utf8.to_string())); } Type::MediumText(_) => { // FIXME: Unresolved type mapping