pub async fn set_maintenance_mode(
pool: &Pool<MySql>,
id: i64,
maintenance_mode: bool,
) -> Result<App>
Expand description
Sets the maintenance mode status for an application.
This function updates only the maintenance_mode field of an application, making it a more efficient alternative to update_app when only this field needs to change. When an application is in maintenance mode, it typically displays a maintenance page to users instead of normal operation.
§Arguments
pool
- Database connection pool for executing the queryid
- Unique identifier of the application to updatemaintenance_mode
- Whether maintenance mode should be enabled (true) or disabled (false)
§Returns
Ok(App)
- Successfully updated application with the new maintenance mode statusErr(anyhow::Error)
- Failed to update maintenance mode
§Transaction Handling
This function uses a database transaction to ensure atomicity of the operation. If any part of the operation fails, the entire operation is rolled back.