Skip to content
This repository was archived by the owner on May 30, 2024. It is now read-only.

Commit 0bf13d7

Browse files
author
Noah Lee
authored
Add default value to the 'latest_deployed_at' field (#362)
* Add default value to the 'latest_deployed_at field * Replace the method
1 parent ad80e06 commit 0bf13d7

File tree

6 files changed

+16
-1
lines changed

6 files changed

+16
-1
lines changed

Diff for: model/ent/entc.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// +build ignore
1+
//go:build ignore
22

33
package main
44

Diff for: model/ent/repo/repo.go

+2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: model/ent/repo_create.go

+4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: model/ent/runtime.go

+4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: model/ent/schema/repo.go

+1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ func (Repo) Fields() []ent.Field {
3434
UpdateDefault(nowUTC),
3535
// Denormalization to sort with deployment.
3636
field.Time("latest_deployed_at").
37+
Default(zeroTime).
3738
Optional(),
3839
// The 'owner_id' field is the ID who activated the repository.
3940
field.Int64("owner_id").

Diff for: model/ent/schema/shared.go

+4
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,7 @@ func generateHash() string {
1919
func nowUTC() time.Time {
2020
return time.Now().UTC()
2121
}
22+
23+
func zeroTime() time.Time {
24+
return time.Time{}
25+
}

0 commit comments

Comments
 (0)