don't include drafts in workspace exports tarball (#6710)

* don't include drafts in workspace exports tarball

* sqlx

* ee repo ref

---------

Co-authored-by: Ruben Fiszel <ruben@windmill.dev>
This commit is contained in:
Alexander Petric
2025-09-30 19:32:34 +00:00
committed by GitHub
co-authored by Ruben Fiszel
parent 0dd6e31688
commit 0da1b7efb1
11 changed files with 309 additions and 11 deletions
@@ -204,7 +204,6 @@ where
"edited_by",
"archived",
"has_draft",
"draft_only",
"error",
"last_server_ping",
"server_id",
@@ -354,6 +353,7 @@ pub(crate) async fn tarball_workspace(
{
let scripts = sqlx::query_as::<_, Script>(
"SELECT * FROM script as o WHERE workspace_id = $1 AND archived = false
AND (draft_only IS NULL OR draft_only = false)
AND created_at = (select max(created_at) from script where path = o.path AND \
workspace_id = $1)",
)
@@ -476,7 +476,7 @@ pub(crate) async fn tarball_workspace(
"SELECT flow.workspace_id, flow.path, flow.summary, flow.description, flow.archived, flow.extra_perms, flow.draft_only, flow.dedicated_worker, flow.tag, flow.ws_error_handler_muted, flow.timeout, flow.visible_to_runner_only, flow.on_behalf_of_email, flow_version.schema, flow_version.value, flow_version.created_at as edited_at, flow_version.created_by as edited_by
FROM flow
LEFT JOIN flow_version ON flow_version.id = flow.versions[array_upper(flow.versions, 1)]
WHERE flow.workspace_id = $1 AND flow.archived = false",
WHERE flow.workspace_id = $1 AND flow.archived = false AND (flow.draft_only IS NULL OR flow.draft_only = false)",
)
.bind(&w_id)
.fetch_all(&mut *tx)
@@ -527,7 +527,8 @@ pub(crate) async fn tarball_workspace(
"SELECT app.id, app.path, app.summary, app.versions, app.policy, app.custom_path,
app.extra_perms, app_version.value,
app_version.created_at, app_version.created_by from app, app_version
WHERE app.workspace_id = $1 AND app_version.id = app.versions[array_upper(app.versions, 1)] AND app_version.raw_app IS false",
WHERE app.workspace_id = $1 AND app_version.id = app.versions[array_upper(app.versions, 1)] AND app_version.raw_app IS false
AND (app.draft_only IS NULL OR app.draft_only = false)",
)
.bind(&w_id)
.fetch_all(&mut *tx)