Skip to content

Commit

Permalink
sqlite: decimal -> real
Browse files Browse the repository at this point in the history
  • Loading branch information
billy1624 committed Jan 24, 2024
1 parent 93d61a7 commit 287df79
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/backend/sqlite/table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,13 @@ impl SqliteQueryBuilder {
ColumnType::Float => "float".into(),
ColumnType::Double => "double".into(),
ColumnType::Decimal(precision) => match precision {
Some((precision, scale)) => format!("decimal_text({precision}, {scale})"),
None => "decimal_text".into(),
Some((precision, scale)) => {
if precision + scale <= 16 {
panic!("sum of precision and scale cannot be larger than 16");
}
format!("real({precision}, {scale})")
},
None => "real".into(),
},
ColumnType::DateTime => "datetime_text".into(),
ColumnType::Timestamp => "timestamp_text".into(),
Expand Down

0 comments on commit 287df79

Please sign in to comment.