2016-04-04 15:44:34 +02:00
|
|
|
package models
|
|
|
|
|
|
|
|
import "time"
|
2016-04-07 14:49:34 +02:00
|
|
|
import "github.com/ansible-semaphore/semaphore/database"
|
2016-04-04 15:44:34 +02:00
|
|
|
|
|
|
|
type Task struct {
|
2016-04-08 21:41:20 +02:00
|
|
|
ID int `db:"id" json:"id"`
|
|
|
|
TemplateID int `db:"template_id" json:"template_id" binding:"required"`
|
|
|
|
|
|
|
|
Status string `db:"status" json:"status"`
|
|
|
|
Debug bool `db:"debug" json:"debug"`
|
|
|
|
|
|
|
|
// override variables
|
2016-04-04 15:44:34 +02:00
|
|
|
Playbook string `db:"playbook" json:"playbook"`
|
|
|
|
Environment string `db:"environment" json:"environment"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type TaskOutput struct {
|
|
|
|
TaskID int `db:"task_id" json:"task_id"`
|
|
|
|
Time time.Time `db:"time" json:"time"`
|
|
|
|
Output string `db:"output" json:"output"`
|
|
|
|
}
|
2016-04-07 14:49:34 +02:00
|
|
|
|
|
|
|
func init() {
|
|
|
|
database.Mysql.AddTableWithName(Task{}, "task").SetKeys(true, "id")
|
|
|
|
database.Mysql.AddTableWithName(TaskOutput{}, "task__output").SetUniqueTogether("task_id", "time")
|
|
|
|
}
|