feat: add column schedule_id to task model

This commit is contained in:
fiftin 2024-07-03 13:56:52 +05:00
parent 82b829ebed
commit dbc1173171
No known key found for this signature in database
GPG Key ID: 044381366A5D4731
2 changed files with 11 additions and 13 deletions

View File

@ -20,15 +20,16 @@ type Task struct {
DryRun bool `db:"dry_run" json:"dry_run"` DryRun bool `db:"dry_run" json:"dry_run"`
Diff bool `db:"diff" json:"diff"` Diff bool `db:"diff" json:"diff"`
IntegrationID *int `db:"integration_id" json:"integration_id"`
// override variables // override variables
Playbook string `db:"playbook" json:"playbook"` Playbook string `db:"playbook" json:"playbook"`
Environment string `db:"environment" json:"environment"` Environment string `db:"environment" json:"environment"`
Limit string `db:"hosts_limit" json:"limit"` Limit string `db:"hosts_limit" json:"limit"`
Secret string `db:"-" json:"secret"` 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"` Created time.Time `db:"created" json:"created"`
Start *time.Time `db:"start" json:"start"` 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. // CommitMessage contains message retrieved from git repository after checkout to CommitHash.
// It is readonly by API. // It is readonly by API.
CommitMessage string `db:"commit_message" json:"commit_message"` 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. // Version is a build version.
// This field available only for Build tasks. // This field available only for Build tasks.
Version *string `db:"version" json:"version"` Version *string `db:"version" json:"version"`
Arguments *string `db:"arguments" json:"arguments"`
InventoryID *int `db:"inventory_id" json:"inventory_id"` InventoryID *int `db:"inventory_id" json:"inventory_id"`
} }

View File

@ -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 `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 `access_key` add `user_id` int null references `user`(`id`) on delete cascade;
alter table `project__integration` add `task_params` text null; 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;