mirror of
https://github.com/crowdsecurity/crowdsec.git
synced 2025-05-10 20:05:55 +02:00
feat(database): enhance schema configuration for database compatibility
Add support for specifying schema types for the `value` field in the `ConfigItem` schema. This includes defining `longtext` for MySQL and `text` for PostgreSQL, enhancing text capacity for this field
This commit is contained in:
parent
e60b3a73cf
commit
ebab153ec6
3 changed files with 8 additions and 1 deletions
2
go.sum
2
go.sum
|
@ -561,6 +561,8 @@ github.com/nxadm/tail v1.4.11 h1:8feyoE3OzPrcshW5/MJ4sGESc5cqmGkGCWlco4l0bqY=
|
|||
github.com/nxadm/tail v1.4.11/go.mod h1:OTaG3NK980DZzxbRq6lEuzgU+mug70nY11sMd4JXXHc=
|
||||
github.com/oklog/run v1.0.0 h1:Ru7dDtJNOyC66gQ5dQmaCa0qIsAUFY3sFpK1Xk8igrw=
|
||||
github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA=
|
||||
github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec=
|
||||
github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY=
|
||||
github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U=
|
||||
github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM=
|
||||
github.com/opencontainers/image-spec v1.1.0 h1:8SG7/vwALn54lVB/0yZ/MMwhFrPYtpEHQb2IpWsCzug=
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// +build tools
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
|
|
@ -2,6 +2,7 @@ package schema
|
|||
|
||||
import (
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/dialect"
|
||||
"entgo.io/ent/schema/field"
|
||||
|
||||
"github.com/crowdsecurity/crowdsec/pkg/types"
|
||||
|
@ -22,7 +23,10 @@ func (ConfigItem) Fields() []ent.Field {
|
|||
Default(types.UtcNow).
|
||||
UpdateDefault(types.UtcNow).StructTag(`json:"updated_at"`),
|
||||
field.String("name").Unique().StructTag(`json:"name"`).Immutable(),
|
||||
field.String("value").StructTag(`json:"value"`), // a json object
|
||||
field.String("value").SchemaType(map[string]string{
|
||||
dialect.MySQL: "longtext",
|
||||
dialect.Postgres: "text",
|
||||
}).StructTag(`json:"value"`), // a json object
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue