2020-12-31 03:37:32 +05:30
|
|
|
package schema
|
|
|
|
|
|
|
|
import (
|
|
|
|
"time"
|
|
|
|
|
2021-03-24 12:07:51 +05:30
|
|
|
"entgo.io/ent"
|
|
|
|
"entgo.io/ent/schema/field"
|
2020-12-31 03:37:32 +05:30
|
|
|
)
|
|
|
|
|
|
|
|
/* Original SQL table:
|
|
|
|
create table refresh_token
|
|
|
|
(
|
|
|
|
id text not null primary key,
|
|
|
|
client_id text not null,
|
|
|
|
scopes blob not null,
|
|
|
|
nonce text not null,
|
|
|
|
claims_user_id text not null,
|
|
|
|
claims_username text not null,
|
|
|
|
claims_email text not null,
|
|
|
|
claims_email_verified integer not null,
|
|
|
|
claims_groups blob not null,
|
|
|
|
connector_id text not null,
|
|
|
|
connector_data blob,
|
|
|
|
token text default '' not null,
|
|
|
|
created_at timestamp default '0001-01-01 00:00:00 UTC' not null,
|
|
|
|
last_used timestamp default '0001-01-01 00:00:00 UTC' not null,
|
2021-04-30 20:01:49 +05:30
|
|
|
claims_preferred_username text default '' not null,
|
|
|
|
obsolete_token text default ''
|
2020-12-31 03:37:32 +05:30
|
|
|
);
|
|
|
|
*/
|
|
|
|
|
|
|
|
// RefreshToken holds the schema definition for the RefreshToken entity.
|
|
|
|
type RefreshToken struct {
|
|
|
|
ent.Schema
|
|
|
|
}
|
|
|
|
|
|
|
|
// Fields of the RefreshToken.
|
|
|
|
func (RefreshToken) Fields() []ent.Field {
|
|
|
|
return []ent.Field{
|
|
|
|
field.Text("id").
|
|
|
|
SchemaType(textSchema).
|
|
|
|
NotEmpty().
|
|
|
|
Unique(),
|
|
|
|
field.Text("client_id").
|
|
|
|
SchemaType(textSchema).
|
|
|
|
NotEmpty(),
|
|
|
|
field.JSON("scopes", []string{}).
|
|
|
|
Optional(),
|
|
|
|
field.Text("nonce").
|
|
|
|
SchemaType(textSchema).
|
|
|
|
NotEmpty(),
|
|
|
|
|
|
|
|
field.Text("claims_user_id").
|
|
|
|
SchemaType(textSchema).
|
|
|
|
NotEmpty(),
|
|
|
|
field.Text("claims_username").
|
|
|
|
SchemaType(textSchema).
|
|
|
|
NotEmpty(),
|
|
|
|
field.Text("claims_email").
|
|
|
|
SchemaType(textSchema).
|
|
|
|
NotEmpty(),
|
|
|
|
field.Bool("claims_email_verified"),
|
|
|
|
field.JSON("claims_groups", []string{}).
|
|
|
|
Optional(),
|
|
|
|
field.Text("claims_preferred_username").
|
|
|
|
SchemaType(textSchema).
|
|
|
|
Default(""),
|
|
|
|
|
|
|
|
field.Text("connector_id").
|
|
|
|
SchemaType(textSchema).
|
|
|
|
NotEmpty(),
|
|
|
|
field.Bytes("connector_data").
|
|
|
|
Nillable().
|
|
|
|
Optional(),
|
|
|
|
|
|
|
|
field.Text("token").
|
|
|
|
SchemaType(textSchema).
|
|
|
|
Default(""),
|
2021-04-30 20:01:49 +05:30
|
|
|
field.Text("obsolete_token").
|
|
|
|
SchemaType(textSchema).
|
|
|
|
Default(""),
|
2020-12-31 03:37:32 +05:30
|
|
|
|
|
|
|
field.Time("created_at").
|
2021-09-13 19:18:02 +05:30
|
|
|
SchemaType(timeSchema).
|
2020-12-31 03:37:32 +05:30
|
|
|
Default(time.Now),
|
|
|
|
field.Time("last_used").
|
2021-09-13 19:18:02 +05:30
|
|
|
SchemaType(timeSchema).
|
2020-12-31 03:37:32 +05:30
|
|
|
Default(time.Now),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Edges of the RefreshToken.
|
|
|
|
func (RefreshToken) Edges() []ent.Edge {
|
|
|
|
return []ent.Edge{}
|
|
|
|
}
|