mirror of
https://github.com/nitnelave/lldap.git
synced 2023-04-12 14:25:13 +00:00
db: Change the version number from u8 to i16
This is the smallest integer compatible with all of MySQL, Postgres and SQlite. This is a backwards-compatible change for SQlite since both are represented as "integer", and all u8 values can be represented as i16.
This commit is contained in:
parent
260b545a54
commit
692bbb00f1
@ -116,6 +116,7 @@ pub async fn upgrade_to_v1(pool: &DbConnection) -> std::result::Result<(), sea_o
|
||||
.col(
|
||||
ColumnDef::new(Groups::GroupId)
|
||||
.integer()
|
||||
.auto_increment()
|
||||
.not_null()
|
||||
.primary_key(),
|
||||
)
|
||||
@ -309,7 +310,7 @@ pub async fn upgrade_to_v1(pool: &DbConnection) -> std::result::Result<(), sea_o
|
||||
Table::create()
|
||||
.table(Metadata::Table)
|
||||
.if_not_exists()
|
||||
.col(ColumnDef::new(Metadata::Version).tiny_integer()),
|
||||
.col(ColumnDef::new(Metadata::Version).small_integer()),
|
||||
),
|
||||
)
|
||||
.await?;
|
||||
|
@ -4,7 +4,7 @@ use sea_orm::Value;
|
||||
pub type DbConnection = sea_orm::DatabaseConnection;
|
||||
|
||||
#[derive(Copy, PartialEq, Eq, Debug, Clone)]
|
||||
pub struct SchemaVersion(pub u8);
|
||||
pub struct SchemaVersion(pub i16);
|
||||
|
||||
impl sea_orm::TryGetable for SchemaVersion {
|
||||
fn try_get(
|
||||
@ -12,7 +12,7 @@ impl sea_orm::TryGetable for SchemaVersion {
|
||||
pre: &str,
|
||||
col: &str,
|
||||
) -> Result<Self, sea_orm::TryGetError> {
|
||||
Ok(SchemaVersion(u8::try_get(res, pre, col)?))
|
||||
Ok(SchemaVersion(i16::try_get(res, pre, col)?))
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user