Skip to content

Commit

Permalink
handle option-sqlite-exact-column-type
Browse files Browse the repository at this point in the history
  • Loading branch information
tyt2y3 committed Jan 27, 2024
1 parent c5a9b6e commit fa0b7dc
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/backend/sqlite/table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,16 +139,14 @@ impl SqliteQueryBuilder {
None => "varchar".into(),
},
ColumnType::Text => "text".into(),
ColumnType::TinyInteger | ColumnType::TinyUnsigned => "tinyint".into(),
ColumnType::SmallInteger | ColumnType::SmallUnsigned => "smallint".into(),
ColumnType::TinyInteger | ColumnType::TinyUnsigned => integer("tinyint").into(),
ColumnType::SmallInteger | ColumnType::SmallUnsigned => integer("smallint").into(),
ColumnType::Integer | ColumnType::Unsigned => "integer".into(),
#[allow(clippy::if_same_then_else)]
ColumnType::BigInteger | ColumnType::BigUnsigned => if is_auto_increment {
"integer"
} else if cfg!(feature = "option-sqlite-exact-column-type") {
"integer"
} else {
"bigint"
integer("bigint")
}
.into(),
ColumnType::Float => "float".into(),
Expand Down Expand Up @@ -200,3 +198,11 @@ impl SqliteQueryBuilder {
.unwrap()
}
}

fn integer(ty: &str) -> &str {
if cfg!(feature = "option-sqlite-exact-column-type") {
"integer"
} else {
ty
}
}

0 comments on commit fa0b7dc

Please sign in to comment.