mirror of
https://github.com/LemmyNet/lemmy.git
synced 2025-01-31 06:11:43 +00:00
fmt
This commit is contained in:
parent
e8e354c9b2
commit
402ab1414f
1 changed files with 14 additions and 15 deletions
|
@ -1,4 +1,4 @@
|
|||
use crate::{schema::previously_run_sql};
|
||||
use crate::schema::previously_run_sql;
|
||||
use anyhow::Context;
|
||||
use diesel::{
|
||||
connection::SimpleConnection,
|
||||
|
@ -6,9 +6,10 @@ use diesel::{
|
|||
update,
|
||||
Connection,
|
||||
ExpressionMethods,
|
||||
NullableExpressionMethods,
|
||||
PgConnection,
|
||||
QueryDsl,
|
||||
RunQueryDsl,NullableExpressionMethods
|
||||
RunQueryDsl,
|
||||
};
|
||||
use diesel_migrations::{EmbeddedMigrations, MigrationHarness};
|
||||
use lemmy_utils::error::LemmyError;
|
||||
|
@ -116,15 +117,13 @@ pub fn run(db_url: &str) -> Result<(), LemmyError> {
|
|||
let name = migration.name();
|
||||
// TODO measure time on database
|
||||
let start_time = Instant::now();
|
||||
conn.run_migration(migration)
|
||||
.map_err(|e| anyhow::anyhow!("Couldn't run migration {name}: {e}"))?;
|
||||
conn.run_migration(migration).map_err(|e| anyhow::anyhow!("Couldn't run migration {name}: {e}"))?;
|
||||
let duration = start_time.elapsed().as_millis();
|
||||
info!("{duration}ms {name}");
|
||||
}
|
||||
|
||||
// Run replaceable_schema
|
||||
conn.batch_execute(&new_sql)
|
||||
.context("Couldn't run SQL files in crates/db_schema/replaceable_schema")?;
|
||||
conn.batch_execute(&new_sql).context("Couldn't run SQL files in crates/db_schema/replaceable_schema")?;
|
||||
|
||||
let num_rows_updated = update(previously_run_sql::table)
|
||||
.set(previously_run_sql::content.eq(new_sql))
|
||||
|
|
Loading…
Reference in a new issue