增加索引
This commit is contained in:
parent
04e5581506
commit
81d09fc668
@ -36,6 +36,13 @@ var (
|
|||||||
OnDelete: schema.NoAction,
|
OnDelete: schema.NoAction,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
Indexes: []*schema.Index{
|
||||||
|
{
|
||||||
|
Name: "texture_user_profile_texture",
|
||||||
|
Unique: false,
|
||||||
|
Columns: []*schema.Column{TexturesColumns[5]},
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
// UsersColumns holds the columns for the "users" table.
|
// UsersColumns holds the columns for the "users" table.
|
||||||
UsersColumns = []*schema.Column{
|
UsersColumns = []*schema.Column{
|
||||||
|
@ -5,6 +5,7 @@ import (
|
|||||||
"entgo.io/ent/dialect"
|
"entgo.io/ent/dialect"
|
||||||
"entgo.io/ent/schema/edge"
|
"entgo.io/ent/schema/edge"
|
||||||
"entgo.io/ent/schema/field"
|
"entgo.io/ent/schema/field"
|
||||||
|
"entgo.io/ent/schema/index"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Texture holds the schema definition for the Texture entity.
|
// Texture holds the schema definition for the Texture entity.
|
||||||
@ -38,5 +39,7 @@ func (Texture) Edges() []ent.Edge {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (Texture) Indexes() []ent.Index {
|
func (Texture) Indexes() []ent.Index {
|
||||||
return nil
|
return []ent.Index{
|
||||||
|
index.Edges("user"),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,7 @@ import (
|
|||||||
"github.com/samber/lo"
|
"github.com/samber/lo"
|
||||||
"github.com/xmdhs/authlib-skin/db/ent"
|
"github.com/xmdhs/authlib-skin/db/ent"
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/texture"
|
"github.com/xmdhs/authlib-skin/db/ent/texture"
|
||||||
|
"github.com/xmdhs/authlib-skin/db/ent/user"
|
||||||
"github.com/xmdhs/authlib-skin/db/ent/userprofile"
|
"github.com/xmdhs/authlib-skin/db/ent/userprofile"
|
||||||
"github.com/xmdhs/authlib-skin/model/yggdrasil"
|
"github.com/xmdhs/authlib-skin/model/yggdrasil"
|
||||||
utilsService "github.com/xmdhs/authlib-skin/service/utils"
|
utilsService "github.com/xmdhs/authlib-skin/service/utils"
|
||||||
@ -31,7 +32,7 @@ func (y *Yggdrasil) PutTexture(ctx context.Context, token string, texturebyte []
|
|||||||
return fmt.Errorf("PutTexture: %w", ErrUUIDNotEq)
|
return fmt.Errorf("PutTexture: %w", ErrUUIDNotEq)
|
||||||
}
|
}
|
||||||
|
|
||||||
up, err := y.client.UserProfile.Query().Where(userprofile.UUIDEQ(uuid)).WithUser().First(ctx)
|
up, err := y.client.UserProfile.Query().Where(userprofile.HasUserWith(user.ID(t.UID))).WithUser().First(ctx)
|
||||||
|
|
||||||
err = utils.WithTx(ctx, y.client, func(tx *ent.Tx) error {
|
err = utils.WithTx(ctx, y.client, func(tx *ent.Tx) error {
|
||||||
// 查找此用户该类型下是否已经存在皮肤
|
// 查找此用户该类型下是否已经存在皮肤
|
||||||
|
Loading…
x
Reference in New Issue
Block a user