This repository has been archived on 2022-08-17. You can view files and clone it, but cannot push or open issues or pull requests.
dex/storage/ent/schema/password.go
m.nabokikh 24fa4def5b chore: update ent
Signed-off-by: m.nabokikh <maksim.nabokikh@flant.com>
2021-04-30 17:48:16 +04:00

44 lines
842 B
Go

package schema
import (
"entgo.io/ent"
"entgo.io/ent/schema/field"
)
/* Original SQL table:
create table password
(
email text not null primary key,
hash blob not null,
username text not null,
user_id text not null
);
*/
// Password holds the schema definition for the Password entity.
type Password struct {
ent.Schema
}
// Fields of the Password.
func (Password) Fields() []ent.Field {
return []ent.Field{
field.Text("email").
SchemaType(textSchema).
StorageKey("email"). // use email as ID field to make querying easier
NotEmpty().
Unique(),
field.Bytes("hash"),
field.Text("username").
SchemaType(textSchema).
NotEmpty(),
field.Text("user_id").
SchemaType(textSchema).
NotEmpty(),
}
}
// Edges of the Password.
func (Password) Edges() []ent.Edge {
return []ent.Edge{}
}