Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Weakky committed Sep 26, 2022
1 parent 527b415 commit 4b79345
Show file tree
Hide file tree
Showing 4 changed files with 209 additions and 115 deletions.
5 changes: 2 additions & 3 deletions psl/builtin-connectors/src/mysql_datamodel_connector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -419,9 +419,8 @@ impl Connector for MySqlDatamodelConnector {
MySqlType::UnsignedSmallInt => Some(IntType::Unsigned16),
MySqlType::UnsignedMediumInt => Some(IntType::Unsigned24),
MySqlType::UnsignedInt => Some(IntType::Unsigned32),
// Technically stored as an Unsigned8 but with values ranging
// from 1901 and 2155, so we have to validate the value with greater boudaries
MySqlType::Year => Some(IntType::Unsigned16),
// Technically stored as an Unsigned8 but with values ranging from 1901 and 2155
MySqlType::Year => Some(IntType::Custom(1901, 2155)),
_ => None,
}
}
Expand Down
2 changes: 2 additions & 0 deletions psl/psl-core/src/datamodel_connector/int_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ pub enum IntType {
Unsigned16,
Unsigned24,
Unsigned32,
Custom(i64, i64),
}

impl std::fmt::Display for IntType {
Expand All @@ -21,6 +22,7 @@ impl std::fmt::Display for IntType {
IntType::Unsigned16 => write!(f, "16-bit unsigned integer"),
IntType::Unsigned24 => write!(f, "24-bit unsigned integer"),
IntType::Unsigned32 => write!(f, "32-bit unsigned integer"),
IntType::Custom(min, max) => write!(f, "custom integer (min: {}, max: {})", min, max),
}
}
}

0 comments on commit 4b79345

Please sign in to comment.