migrate wall to 11 rows
This commit is contained in:
@@ -356,11 +356,7 @@ fn AttemptRadioGroup() -> impl IntoView {
|
|||||||
attempt_radio_buttons.push(view! { <AttemptRadioButton on:click=onclick variant selected=ui_toggle /> });
|
attempt_radio_buttons.push(view! { <AttemptRadioButton on:click=onclick variant selected=ui_toggle /> });
|
||||||
}
|
}
|
||||||
|
|
||||||
view! {
|
view! { <div class="gap-2 flex flex-col justify-evenly 2xl:flex-row">{attempt_radio_buttons}</div> }
|
||||||
<div class="gap-2 flex flex-row justify-evenly md:flex-col 2xl:flex-row">
|
|
||||||
{attempt_radio_buttons}
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[component]
|
#[component]
|
||||||
@@ -438,7 +434,7 @@ fn Wall() -> impl IntoView {
|
|||||||
let style = {
|
let style = {
|
||||||
let grid_rows = crate::css::grid_rows_n(wall.rows);
|
let grid_rows = crate::css::grid_rows_n(wall.rows);
|
||||||
let grid_cols = crate::css::grid_cols_n(wall.cols);
|
let grid_cols = crate::css::grid_cols_n(wall.cols);
|
||||||
let max_width = format!("{}vh", wall.rows as f64 / wall.cols as f64 * 100.);
|
let max_width = format!("{}vh", wall.cols as f64 / wall.rows as f64 * 100.);
|
||||||
format!("max-height: 100vh; max-width: {max_width}; {}", [grid_rows, grid_cols].join(" "))
|
format!("max-height: 100vh; max-width: {max_width}; {}", [grid_rows, grid_cols].join(" "))
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,38 @@
|
|||||||
use super::db::Database;
|
use super::db::Database;
|
||||||
use super::db::DatabaseOperationError;
|
use super::db::DatabaseOperationError;
|
||||||
use super::db::{self};
|
use super::db::{self};
|
||||||
|
use crate::models;
|
||||||
|
use redb::ReadableTable;
|
||||||
|
|
||||||
#[tracing::instrument(skip_all, err)]
|
#[tracing::instrument(skip_all, err)]
|
||||||
pub async fn run_migrations(db: &Database) -> Result<(), Box<dyn std::error::Error>> {
|
pub async fn run_migrations(db: &Database) -> Result<(), Box<dyn std::error::Error>> {
|
||||||
if is_at_version(db, 2).await? {
|
if is_at_version(db, 2).await? {
|
||||||
migrate_to_v3(db).await?;
|
migrate_to_v3(db).await?;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
migrate_wall(db).await?;
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
#[tracing::instrument(skip_all, err)]
|
||||||
|
pub async fn migrate_wall(db: &Database) -> Result<(), Box<dyn std::error::Error>> {
|
||||||
|
tracing::warn!("MIGRATING WALL");
|
||||||
|
|
||||||
|
db.write(|txn| {
|
||||||
|
let mut table = txn.open_table(db::current::TABLE_WALLS)?;
|
||||||
|
let wall = table
|
||||||
|
.get(models::WallUid(uuid::Uuid::parse_str("8a00ab39-89f5-4fc5-b9c6-f86b4c040f68").unwrap()))?
|
||||||
|
.map(|x| x.value());
|
||||||
|
if let Some(mut wall) = wall {
|
||||||
|
wall.rows = 11;
|
||||||
|
wall.holds.retain(|k, v| k.row < 11);
|
||||||
|
table.insert(wall.uid, wall)?;
|
||||||
|
}
|
||||||
|
Ok(())
|
||||||
|
})
|
||||||
|
.await?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user