forked from ALHP/ALHP.GO
Add database backend (SQLite) (#26)
Add database with background information for each pkgbase, for possible future use. A static status page is generated from the db. Currently includes: * sub-packages * build-time * build-duration * status (failed, latest, skipped, queued, building, build) * version (both from PKGBUILD and repo) * last checked Database is currently only used for informational purposes. Goal is to refactor many (expensive) methods to use the db instead of searching/parsing files. Reviewed-on: https://git.harting.dev/anonfunc/ALHP.GO/pulls/26 Co-authored-by: Giovanni Harting <539@idlegandalf.com> Co-committed-by: Giovanni Harting <539@idlegandalf.com>
This commit is contained in:
33
ent/schema/dbpackage.go
Normal file
33
ent/schema/dbpackage.go
Normal file
@@ -0,0 +1,33 @@
|
||||
package schema
|
||||
|
||||
import (
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/schema/field"
|
||||
)
|
||||
|
||||
// DbPackage holds the schema definition for the DbPackage entity.
|
||||
type DbPackage struct {
|
||||
ent.Schema
|
||||
}
|
||||
|
||||
// Fields of the DbPackage.
|
||||
func (DbPackage) Fields() []ent.Field {
|
||||
return []ent.Field{
|
||||
field.String("pkgbase").NotEmpty().Immutable().Unique(),
|
||||
field.Strings("packages").Optional(),
|
||||
field.Int("status").Optional().Min(0),
|
||||
field.String("skip_reason").Optional(),
|
||||
field.String("repository").NotEmpty(),
|
||||
field.String("march").NotEmpty(),
|
||||
field.String("version").Optional(),
|
||||
field.String("repo_version").Optional(),
|
||||
field.Time("build_time").Optional(),
|
||||
field.Uint64("build_duration").Positive().Optional(),
|
||||
field.Time("updated").Optional(),
|
||||
}
|
||||
}
|
||||
|
||||
// Edges of the DbPackage.
|
||||
func (DbPackage) Edges() []ent.Edge {
|
||||
return nil
|
||||
}
|
Reference in New Issue
Block a user