|
@@ -106,15 +106,19 @@ pub(crate) struct DatabaseSchema {
|
|
|
impl DatabaseSchema {
|
|
|
pub(crate) const SCHEMA_SIGNATURE_KEY: &'static str = "schema_signature";
|
|
|
|
|
|
- pub fn signature(&self) -> &str {
|
|
|
+ // the following functions are for use in migrations
|
|
|
+ #[allow(unused)]
|
|
|
+ pub(crate) fn signature(&self) -> &str {
|
|
|
self.signature.as_str()
|
|
|
}
|
|
|
|
|
|
- pub fn table_queries(&self) -> &HashMap<String, String> {
|
|
|
+ #[allow(unused)]
|
|
|
+ pub(crate) fn table_queries(&self) -> &HashMap<String, String> {
|
|
|
&self.table_queries
|
|
|
}
|
|
|
|
|
|
- pub fn index_queries(&self) -> &HashMap<String, String> {
|
|
|
+ #[allow(unused)]
|
|
|
+ pub(crate) fn index_queries(&self) -> &HashMap<String, String> {
|
|
|
&self.index_queries
|
|
|
}
|
|
|
|
|
@@ -163,7 +167,7 @@ impl DatabaseSchema {
|
|
|
txn.lease(),
|
|
|
meta::MicrormMeta {
|
|
|
key: Self::SCHEMA_SIGNATURE_KEY.into(),
|
|
|
- value: format!("{}", self.signature),
|
|
|
+ value: self.signature.clone(),
|
|
|
},
|
|
|
)?;
|
|
|
|
|
@@ -334,8 +338,8 @@ pub(crate) fn collect_from_database<DB: Schema>(schema: &DB) -> DatabaseSchema {
|
|
|
let digest = hasher.finalize();
|
|
|
|
|
|
DatabaseSchema {
|
|
|
- signature: digest.into_iter().map(|v| format!("{:02x}", v)).collect(),
|
|
|
- table_queries: HashMap::from_iter(table_queries.into_iter()),
|
|
|
- index_queries: HashMap::from_iter(index_queries.into_iter()),
|
|
|
+ signature: digest.into_iter().fold(String::new(), |mut a, v| { a += &format!("{:02x}", v); a }),
|
|
|
+ table_queries: HashMap::from_iter(table_queries),
|
|
|
+ index_queries: HashMap::from_iter(index_queries),
|
|
|
}
|
|
|
}
|