Skip to content

Commit

Permalink
fix table sync column_type override
Browse files Browse the repository at this point in the history
  • Loading branch information
zhuxiujia committed Mar 1, 2024
1 parent b44a586 commit e584856
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ members = [

[package]
name = "rbatis"
version = "4.5.15"
version = "4.5.16"
description = "The Rust SQL Toolkit and ORM Library. An async, pure Rust SQL crate featuring compile-time Dynamic SQL"
readme = "Readme.md"
authors = ["ce <zhuxiujia@qq.com>"]
Expand Down
5 changes: 3 additions & 2 deletions src/plugin/table_sync/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,11 @@ pub fn sync<'a>(
let mut sql_column = format!("");
for (k, v) in &m {
let k = k.as_str().unwrap_or_default();
let column_type = mapper.get_column(k, &v);
sql_column.push_str(k);
sql_column.push_str(" ");
sql_column.push_str(&mapper.get_column(k, &v));
if k.eq("id") || v.as_str().unwrap_or_default() == "id" {
sql_column.push_str(column_type.as_str());
if column_type.is_empty() && k.eq("id") || v.as_str().unwrap_or_default() == "id" {
sql_column.push_str(&PRIMARY_KEY);
}
sql_column.push_str(",");
Expand Down

0 comments on commit e584856

Please sign in to comment.