diff --git a/api/tasks/logging.go b/api/tasks/logging.go index 67e4f735..7467d7a8 100644 --- a/api/tasks/logging.go +++ b/api/tasks/logging.go @@ -31,7 +31,7 @@ func (t *task) log(msg string) { } go func() { - _, err := database.Mysql.Exec("insert into task__output set task_id=?, output=?, time=?", t.task.ID, msg, now) + _, err := database.Mysql.Exec("insert into task__output set task_id=?, task='', output=?, time=?", t.task.ID, msg, now) if err != nil { panic(err) } diff --git a/api/tasks/runner.go b/api/tasks/runner.go index 64623df6..50632dc3 100644 --- a/api/tasks/runner.go +++ b/api/tasks/runner.go @@ -67,6 +67,7 @@ func (t *task) run() { now := time.Now() t.task.Status = "running" t.task.Start = &now + t.updateStatus() } diff --git a/db/migrations/v0.1.0.sql b/db/migrations/v0.1.0.sql index a14e99e4..58037033 100644 --- a/db/migrations/v0.1.0.sql +++ b/db/migrations/v0.1.0.sql @@ -1,7 +1,7 @@ -alter table user change `created` `created` datetime not null default current_timestamp; -alter table project change `created` `created` datetime not null default current_timestamp comment 'Created timestamp'; -alter table task change `created` `created` datetime not null default current_timestamp; -alter table user__token change `created` `created` datetime not null default current_timestamp; +alter table user change `created` `created` datetime not null; +alter table project change `created` `created` datetime not null comment 'Created timestamp'; +alter table task change `created` `created` datetime not null; +alter table user__token change `created` `created` datetime not null; alter table task drop foreign key `task_ibfk_1`; alter table task add constraint `task_ibfk_1` foreign key (`template_id`) references `project__template` (`id`) on delete cascade; \ No newline at end of file diff --git a/make.sh b/make.sh index 991f6476..db1a77ec 100755 --- a/make.sh +++ b/make.sh @@ -62,4 +62,4 @@ gox -os="linux darwin windows openbsd" -output="semaphore_{{.OS}}_{{.Arch}}" ./. if [ "$CIRCLE_ARTIFACTS" != "" ]; then rsync -a semaphore_* $CIRCLE_ARTIFACTS/ exit 0 -fi \ No newline at end of file +fi diff --git a/models/Project.go b/models/Project.go index a8acc2fe..11d45174 100644 --- a/models/Project.go +++ b/models/Project.go @@ -13,7 +13,9 @@ type Project struct { } func (project *Project) CreateProject() error { - res, err := database.Mysql.Exec("insert into project set name=?", project.Name) + project.Created = time.Now() + + res, err := database.Mysql.Exec("insert into project set name=?, created=?", project.Name, project.Created) if err != nil { return err } @@ -24,7 +26,6 @@ func (project *Project) CreateProject() error { } project.ID = int(projectID) - project.Created = time.Now() return nil }