mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-30 12:11:56 +00:00
chore: Convert the migration to use receipt. (#1842)
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
use emver::VersionRange;
|
||||
|
||||
use crate::hostname::{generate_id, get_hostname, sync_hostname};
|
||||
use crate::hostname::{generate_id, sync_hostname};
|
||||
|
||||
use super::v0_3_0::V0_3_0_COMPAT;
|
||||
use super::*;
|
||||
@@ -22,19 +22,11 @@ impl VersionT for Version {
|
||||
&*V0_3_0_COMPAT
|
||||
}
|
||||
async fn up<Db: DbHandle>(&self, db: &mut Db) -> Result<(), Error> {
|
||||
let hostname = get_hostname(db).await?;
|
||||
crate::db::DatabaseModel::new()
|
||||
.server_info()
|
||||
.hostname()
|
||||
.put(db, &Some(hostname.0))
|
||||
.await?;
|
||||
crate::db::DatabaseModel::new()
|
||||
.server_info()
|
||||
.id()
|
||||
.put(db, &generate_id())
|
||||
.await?;
|
||||
let receipts = crate::hostname::HostNameReceipt::new(db).await?;
|
||||
crate::hostname::ensure_hostname_is_set(db, &receipts).await?;
|
||||
receipts.id.set(db, generate_id()).await?;
|
||||
|
||||
sync_hostname(db).await?;
|
||||
sync_hostname(db, &receipts).await?;
|
||||
Ok(())
|
||||
}
|
||||
async fn down<Db: DbHandle>(&self, _db: &mut Db) -> Result<(), Error> {
|
||||
|
||||
Reference in New Issue
Block a user