mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-09-10 00:05:27 +00:00
managed scheduled removed
This commit is contained in:
-15
@@ -1,15 +0,0 @@
|
||||
{
|
||||
"db_name": "PostgreSQL",
|
||||
"query": "DELETE FROM schedule\n WHERE workspace_id = $1\n AND script_path = $2\n AND managed",
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"parameters": {
|
||||
"Left": [
|
||||
"Text",
|
||||
"Text"
|
||||
]
|
||||
},
|
||||
"nullable": []
|
||||
},
|
||||
"hash": "3194753fa26b1395fdbe3a7a434fe061db12e3bc4cb810e05110cd8115e1ca07"
|
||||
}
|
||||
-15
@@ -1,15 +0,0 @@
|
||||
{
|
||||
"db_name": "PostgreSQL",
|
||||
"query": "DELETE FROM schedule\n WHERE workspace_id = $1\n AND script_path = $2\n AND managed",
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"parameters": {
|
||||
"Left": [
|
||||
"Text",
|
||||
"Text"
|
||||
]
|
||||
},
|
||||
"nullable": []
|
||||
},
|
||||
"hash": "edf2814409bd480ac7c61140ec8d91b461782169bad6d47127c83bc5992d30ec"
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
DROP INDEX IF EXISTS idx_schedule_managed;
|
||||
ALTER TABLE schedule DROP COLUMN IF EXISTS managed;
|
||||
@@ -1,14 +0,0 @@
|
||||
-- Flag schedules auto-created from a pipeline script's `// schedule "<cron>"`
|
||||
-- annotation so reconciliation can update / drop them on subsequent deploys
|
||||
-- without touching schedules a user created manually. Defaults to false for
|
||||
-- pre-existing rows. `script_path` already tells us which script owns the
|
||||
-- row — this is just a boolean discriminator.
|
||||
ALTER TABLE schedule ADD COLUMN IF NOT EXISTS managed BOOLEAN NOT NULL DEFAULT false;
|
||||
|
||||
-- Partial index for the two hot reconciliation queries:
|
||||
-- * "does this script already have a managed schedule?" (script_path lookup)
|
||||
-- * "drop any managed schedules for this deleted script" (same lookup)
|
||||
-- The boolean predicate keeps the index narrow (only managed rows are stored).
|
||||
CREATE INDEX IF NOT EXISTS idx_schedule_managed
|
||||
ON schedule (workspace_id, script_path)
|
||||
WHERE managed;
|
||||
@@ -44,7 +44,7 @@ use windmill_dep_map::scoped_dependency_map::ScopedDependencyMap;
|
||||
use windmill_common::{
|
||||
assets::{
|
||||
clear_script_triggers, clear_static_asset_usage, clear_static_asset_usage_by_script_hash,
|
||||
delete_managed_pipeline_schedule, insert_script_trigger, insert_static_asset_usage,
|
||||
insert_script_trigger, insert_static_asset_usage,
|
||||
parse_duration_secs, parse_pipeline_annotations,
|
||||
trigger_spec_to_row, AssetUsageKind, AssetWithAltAccessType, TriggerSpec,
|
||||
},
|
||||
@@ -2536,9 +2536,8 @@ async fn archive_script_by_path(
|
||||
clear_static_asset_usage(&mut *tx, &w_id, path, AssetUsageKind::Script).await?;
|
||||
// Pipeline event hygiene: an archived script must not be triggered by
|
||||
// anything. Wipe declared `// on ...` edges (asset-event subscribers
|
||||
// look these up) and drop any managed schedule we auto-created.
|
||||
// look these up).
|
||||
clear_script_triggers(&mut *tx, &w_id, path, AssetUsageKind::Script).await?;
|
||||
delete_managed_pipeline_schedule(&mut *tx, &w_id, path).await?;
|
||||
|
||||
audit_log(
|
||||
&mut *tx,
|
||||
@@ -2617,10 +2616,8 @@ async fn archive_script_by_hash(
|
||||
check_scopes(&authed, || format!("scripts:write:{}", &script.path))?;
|
||||
clear_static_asset_usage_by_script_hash(&mut *tx, &w_id, hash).await?;
|
||||
// Pipeline event hygiene: archived scripts must not be triggered by
|
||||
// anything. Wipe declared `// on ...` edges and drop any managed
|
||||
// schedule.
|
||||
// anything. Wipe declared `// on ...` edges.
|
||||
clear_script_triggers(&mut *tx, &w_id, &script.path, AssetUsageKind::Script).await?;
|
||||
delete_managed_pipeline_schedule(&mut *tx, &w_id, &script.path).await?;
|
||||
|
||||
audit_log(
|
||||
&mut *tx,
|
||||
@@ -2682,11 +2679,9 @@ async fn delete_script_by_hash(
|
||||
|
||||
clear_static_asset_usage_by_script_hash(&mut *tx, &w_id, hash).await?;
|
||||
// Pipeline event hygiene: a deleted script must not be triggered by
|
||||
// anything. Wipe declared `// on ...` edges and drop any managed
|
||||
// schedule. Idempotent — safe even if the script was never a pipeline
|
||||
// member.
|
||||
// anything. Wipe declared `// on ...` edges. Idempotent — safe even if
|
||||
// the script was never a pipeline member.
|
||||
clear_script_triggers(&mut *tx, &w_id, &script.path, AssetUsageKind::Script).await?;
|
||||
delete_managed_pipeline_schedule(&mut *tx, &w_id, &script.path).await?;
|
||||
|
||||
audit_log(
|
||||
&mut *tx,
|
||||
@@ -2811,11 +2806,9 @@ async fn delete_script_by_path(
|
||||
.await?;
|
||||
|
||||
// Pipeline event hygiene: a deleted script must not be triggered by
|
||||
// anything. Wipe declared `// on ...` edges and drop any managed
|
||||
// schedule. Idempotent — safe even if the script was never a pipeline
|
||||
// member.
|
||||
// anything. Wipe declared `// on ...` edges. Idempotent — safe even if
|
||||
// the script was never a pipeline member.
|
||||
clear_script_triggers(&mut *tx, &w_id, path, AssetUsageKind::Script).await?;
|
||||
delete_managed_pipeline_schedule(&mut *tx, &w_id, path).await?;
|
||||
|
||||
if !query.keep_captures.unwrap_or(false) {
|
||||
sqlx::query!(
|
||||
|
||||
@@ -103,31 +103,6 @@ pub async fn clear_script_triggers<'e>(
|
||||
Ok(())
|
||||
}
|
||||
|
||||
// Drop any managed schedule rows left over from an earlier release of the
|
||||
// pipeline editor (when `// schedule "<cron>"` annotations auto-created a
|
||||
// `managed = true` row on every deploy). Schedule annotations are now
|
||||
// marker-only — the binding lives on the schedule row's own `script_path`
|
||||
// field, same as kafka/mqtt/etc. — but this cleanup hook stays in place so
|
||||
// script archive/delete still nukes the orphaned managed rows. Manual
|
||||
// schedules at the same path keep `managed = false` and are untouched.
|
||||
pub async fn delete_managed_pipeline_schedule<'e>(
|
||||
executor: impl PgExecutor<'e>,
|
||||
workspace_id: &str,
|
||||
runnable_path: &str,
|
||||
) -> error::Result<()> {
|
||||
sqlx::query!(
|
||||
r#"DELETE FROM schedule
|
||||
WHERE workspace_id = $1
|
||||
AND script_path = $2
|
||||
AND managed"#,
|
||||
workspace_id,
|
||||
runnable_path,
|
||||
)
|
||||
.execute(executor)
|
||||
.await?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
// Insert a single trigger declaration. Caller is expected to wipe first.
|
||||
// `join_all` is the script-level `// trigger all` flag (AND join barrier);
|
||||
// `retry_count` / `retry_delay_s` are the `// retry <n> [<delay>]` policy.
|
||||
|
||||
Reference in New Issue
Block a user