Skip to content

Commit

Permalink
chore(mysql): map medium int to int, tinytext to varchar(255)
Browse files Browse the repository at this point in the history
  • Loading branch information
ttys3 committed Dec 14, 2024
1 parent 8c82cc3 commit 40277ec
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/mysql/writer/column.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 40277ec

Please sign in to comment.