Skip to content

Commit 8b4a189

Browse files
author
secus217
committed
Update deployment creation SQL query and execution
1 parent 750cea7 commit 8b4a189

1 file changed

Lines changed: 26 additions & 23 deletions

File tree

src/handlers/deployment.rs

Lines changed: 26 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -51,30 +51,33 @@ pub async fn create_deployment(
5151
.transpose()?;
5252

5353
sqlx::query!(
54-
r#"
55-
INSERT INTO deployments (
56-
id, user_id, app_name, image, port, env_vars, replicas,
57-
resources, health_check, status, url, created_at, updated_at,error_message
54+
r#"
55+
INSERT INTO deployments (
56+
id, user_id, app_name, image, port, env_vars, replicas,
57+
resources, health_check, status, url, created_at, updated_at,
58+
deployed_at, error_message
59+
)
60+
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15)
61+
"#,
62+
deployment_id,
63+
user.user_id,
64+
payload.app_name,
65+
payload.image,
66+
payload.port,
67+
env_vars_json,
68+
payload.replicas.unwrap_or(1),
69+
resources,
70+
health_check,
71+
"pending",
72+
url,
73+
now,
74+
now,
75+
None::<DateTime<Utc>>, // deployed_at - null initially
76+
None::<String> // error_message
5877
)
59-
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13,$14)
60-
"#,
61-
deployment_id,
62-
user.user_id,
63-
payload.app_name,
64-
payload.image,
65-
payload.port,
66-
env_vars_json,
67-
payload.replicas.unwrap_or(1),
68-
resources,
69-
health_check,
70-
"pending",
71-
url,
72-
now,
73-
now,
74-
None::<String>
75-
)
76-
.execute(&state.db.pool)
77-
.await?;
78+
.execute(&state.db.pool)
79+
.await?;
80+
7881
println!("Inserted deployment record into database");
7982

8083
// TODO: Implement Kubernetes deployment logic here

0 commit comments

Comments
 (0)