From 698375cb17b2d50250df714f4891b213e3609b78 Mon Sep 17 00:00:00 2001 From: yacine Bouraroui Date: Tue, 1 Oct 2024 12:41:19 +0200 Subject: [PATCH] added tag field, needed for postgres RLS --- .../20241001103508_add_tagged_scripts.down.sql | 2 ++ .../migrations/20241001103508_add_tagged_scripts.up.sql | 2 ++ backend/windmill-queue/src/jobs.rs | 9 +++++---- 3 files changed, 9 insertions(+), 4 deletions(-) create mode 100644 backend/migrations/20241001103508_add_tagged_scripts.down.sql create mode 100644 backend/migrations/20241001103508_add_tagged_scripts.up.sql diff --git a/backend/migrations/20241001103508_add_tagged_scripts.down.sql b/backend/migrations/20241001103508_add_tagged_scripts.down.sql new file mode 100644 index 0000000000..3a800e777e --- /dev/null +++ b/backend/migrations/20241001103508_add_tagged_scripts.down.sql @@ -0,0 +1,2 @@ +-- Add down migration script here +ALTER TABLE job_params DROP COLUMN tag; \ No newline at end of file diff --git a/backend/migrations/20241001103508_add_tagged_scripts.up.sql b/backend/migrations/20241001103508_add_tagged_scripts.up.sql new file mode 100644 index 0000000000..ab84677b44 --- /dev/null +++ b/backend/migrations/20241001103508_add_tagged_scripts.up.sql @@ -0,0 +1,2 @@ +-- Add up migration script here +ALTER TABLE job_params ADD COLUMN tag VARCHAR(50); \ No newline at end of file diff --git a/backend/windmill-queue/src/jobs.rs b/backend/windmill-queue/src/jobs.rs index 0467272ef4..292027dd8c 100644 --- a/backend/windmill-queue/src/jobs.rs +++ b/backend/windmill-queue/src/jobs.rs @@ -3944,7 +3944,7 @@ pub async fn push<'c, 'd, R: rsmq_async::RsmqConnection + Send + 'c>( email, visible_to_owner, root_job, - tag, + tag.clone(), concurrent_limit, if concurrent_limit.is_some() { concurrency_time_window_s } else { None }, custom_timeout, @@ -3959,13 +3959,14 @@ pub async fn push<'c, 'd, R: rsmq_async::RsmqConnection + Send + 'c>( // insert into args queue sqlx::query!( r#" - INSERT INTO job_params (id, args, raw_code, raw_flow) - VALUES ($1, $2, $3, $4) + INSERT INTO job_params (id, args, raw_code, raw_flow, tag) + VALUES ($1, $2, $3, $4, $5) "#, uuid, args as Json, raw_code, - raw_flow as Option> + raw_flow as Option>, + tag ) .execute(&mut tx) .await?;