pub async fn delete_region(pool: &Pool<MySql>, id: i64) -> Result<()>
Expand description
Deletes a deployment region from the system.
This function permanently removes a region record from the database. It should be used with extreme caution, as it may affect deployed applications and infrastructure allocation.
§Arguments
pool
- Database connection pool for executing the queryid
- Unique identifier of the region to delete
§Returns
Ok(())
- Successfully deleted the regionErr(anyhow::Error)
- Failed to delete the region
§Warning
This operation is irreversible and potentially dangerous. Instead of deleting regions, consider changing their status to “deprecated” or “unavailable” first, and ensure no active deployments exist in the region before deletion.
§Cascading Effects
Depending on the database schema and application logic:
- Deployed applications in this region may lose their region reference
- Foreign key constraints may prevent deletion if the region is in use
- Monitoring, billing, and operational systems may be affected
§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.