searcherside/infrastructure/db/schema/migration.go

63 lines
988 B
Go
Raw Permalink Normal View History

package schema
import (
"ariga.io/atlas/sql/migrate"
"entgo.io/contrib/entgql"
"entgo.io/ent"
"entgo.io/ent/schema"
"entgo.io/ent/schema/field"
"entgo.io/ent/schema/mixin"
)
type Migration struct {
ent.Schema
}
func (Migration) Fields() []ent.Field {
return []ent.Field{
field.String("version").
Unique().
Immutable(),
field.String("description").
Optional(),
field.Uint("type").
Default(uint(migrate.RevisionTypeUnknown)),
field.Int("applied").
Optional(),
field.Int("total").
Optional(),
field.Time("executed_at"),
field.Int64("execution_time"),
field.String("error").
Optional(),
field.String("error_stmt").
Optional(),
field.String("hash"),
field.Strings("partial_hashes"),
field.String("operator_version"),
}
}
func (Migration) Mixin() []ent.Mixin {
return []ent.Mixin{
mixin.Time{},
}
}
func (Migration) Annotations() []schema.Annotation {
return []schema.Annotation{
entgql.Skip(entgql.SkipAll),
}
}