pub async fn create_app(
pool: &Pool<MySql>,
name: &str,
org_id: i64,
git_repo: Option<&str>,
git_branch: Option<&str>,
container_image_url: Option<&str>,
region_id: Option<i64>,
) -> Result<App>Expand description
Creates a new application in the database.
This function inserts a new application record with the provided parameters. It handles both required fields (name, organization ID) and optional fields. The application is created with maintenance mode disabled by default.
§Arguments
pool- Database connection pool for executing the queryname- Name of the applicationorg_id- Organization ID that the application belongs togit_repo- Optional URL of the Git repository for the applicationgit_branch- Optional branch name in the Git repositorycontainer_image_url- Optional URL for a container imageregion_id- Optional ID of the deployment region
§Returns
Ok(App)- Successfully created application, including database-assigned fieldsErr(anyhow::Error)- Failed to create application
§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.