codegen: implement auto-timestamps for created_at and updated_at
Some checks failed
CI / build-docker (push) Successful in 7s
CI / build-docker-bootstrap (push) Has been skipped
CI / release-test (push) Failing after 3m7s

This commit is contained in:
2026-01-31 20:35:03 -08:00
parent 75b7662c34
commit 5973a2a4b7
3 changed files with 51 additions and 16 deletions

View File

@@ -46,6 +46,18 @@ type Table struct {
GoTypeName string
}
func (t Table) HasAutoTimestamps() (hasCreatedAt bool, hasUpdatedAt bool) {
for _, c := range t.Columns {
if c.Name == "created_at" && c.Type == "integer" {
hasCreatedAt = true
}
if c.Name == "updated_at" && c.Type == "integer" {
hasUpdatedAt = true
}
}
return
}
type Index struct {
Name string `db:"index_name"`
TableName string `db:"table_name"`