From dbc11731713870403c8e98cb0d8eb049c510f7a5 Mon Sep 17 00:00:00 2001 From: fiftin Date: Wed, 3 Jul 2024 13:56:52 +0500 Subject: [PATCH] feat: add column schedule_id to task model --- db/Task.go | 21 +++++++++------------ db/sql/migrations/v2.10.15.sql | 3 ++- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/db/Task.go b/db/Task.go index 78b6b1a8..8a1897d5 100644 --- a/db/Task.go +++ b/db/Task.go @@ -20,15 +20,16 @@ type Task struct { DryRun bool `db:"dry_run" json:"dry_run"` Diff bool `db:"diff" json:"diff"` - IntegrationID *int `db:"integration_id" json:"integration_id"` - // override variables - Playbook string `db:"playbook" json:"playbook"` - Environment string `db:"environment" json:"environment"` - Limit string `db:"hosts_limit" json:"limit"` - Secret string `db:"-" json:"secret"` + Playbook string `db:"playbook" json:"playbook"` + Environment string `db:"environment" json:"environment"` + Limit string `db:"hosts_limit" json:"limit"` + Secret string `db:"-" json:"secret"` + Arguments *string `db:"arguments" json:"arguments"` - UserID *int `db:"user_id" json:"user_id"` + UserID *int `db:"user_id" json:"user_id"` + IntegrationID *int `db:"integration_id" json:"integration_id"` + ScheduleID *int `db:"schedule_id" json:"schedule_id"` Created time.Time `db:"created" json:"created"` Start *time.Time `db:"start" json:"start"` @@ -42,15 +43,11 @@ type Task struct { // CommitMessage contains message retrieved from git repository after checkout to CommitHash. // It is readonly by API. CommitMessage string `db:"commit_message" json:"commit_message"` - - BuildTaskID *int `db:"build_task_id" json:"build_task_id"` - + BuildTaskID *int `db:"build_task_id" json:"build_task_id"` // Version is a build version. // This field available only for Build tasks. Version *string `db:"version" json:"version"` - Arguments *string `db:"arguments" json:"arguments"` - InventoryID *int `db:"inventory_id" json:"inventory_id"` } diff --git a/db/sql/migrations/v2.10.15.sql b/db/sql/migrations/v2.10.15.sql index c27e8046..96d4869a 100644 --- a/db/sql/migrations/v2.10.15.sql +++ b/db/sql/migrations/v2.10.15.sql @@ -1,3 +1,4 @@ alter table `access_key` add `environment_id` int null references project__environment(`id`) on delete cascade; alter table `access_key` add `user_id` int null references `user`(`id`) on delete cascade; -alter table `project__integration` add `task_params` text null; \ No newline at end of file +alter table `project__integration` add `task_params` text null; +alter table `task` add `schedule_id` int null references project__schedule(`id`) on delete set null; \ No newline at end of file