From 9c514c9808be43af9e61110493a8ee3b03c07edb Mon Sep 17 00:00:00 2001 From: erio Date: Sun, 5 Apr 2026 17:19:07 +0800 Subject: [PATCH] chore: drop Sora database schema and regenerate ent code --- backend/ent/group.go | 71 +-- backend/ent/group/group.go | 42 -- backend/ent/group/where.go | 265 --------- backend/ent/group_create.go | 477 ----------------- backend/ent/group_update.go | 342 ------------ backend/ent/migrate/schema.go | 38 +- backend/ent/mutation.go | 768 +-------------------------- backend/ent/runtime/runtime.go | 38 +- backend/ent/schema/group.go | 22 - backend/ent/schema/usage_log.go | 6 - backend/ent/schema/user.go | 6 - backend/ent/usagelog.go | 16 +- backend/ent/usagelog/usagelog.go | 10 - backend/ent/usagelog/where.go | 80 --- backend/ent/usagelog_create.go | 83 --- backend/ent/usagelog_update.go | 62 --- backend/ent/user.go | 24 +- backend/ent/user/user.go | 20 - backend/ent/user/where.go | 90 ---- backend/ent/user_create.go | 170 ------ backend/ent/user_update.go | 108 ---- backend/migrations/090_drop_sora.sql | 34 ++ 22 files changed, 67 insertions(+), 2705 deletions(-) create mode 100644 backend/migrations/090_drop_sora.sql diff --git a/backend/ent/group.go b/backend/ent/group.go index fc691a9b..b15ac15d 100644 --- a/backend/ent/group.go +++ b/backend/ent/group.go @@ -52,16 +52,6 @@ type Group struct { ImagePrice2k *float64 `json:"image_price_2k,omitempty"` // ImagePrice4k holds the value of the "image_price_4k" field. ImagePrice4k *float64 `json:"image_price_4k,omitempty"` - // SoraImagePrice360 holds the value of the "sora_image_price_360" field. - SoraImagePrice360 *float64 `json:"sora_image_price_360,omitempty"` - // SoraImagePrice540 holds the value of the "sora_image_price_540" field. - SoraImagePrice540 *float64 `json:"sora_image_price_540,omitempty"` - // SoraVideoPricePerRequest holds the value of the "sora_video_price_per_request" field. - SoraVideoPricePerRequest *float64 `json:"sora_video_price_per_request,omitempty"` - // SoraVideoPricePerRequestHd holds the value of the "sora_video_price_per_request_hd" field. - SoraVideoPricePerRequestHd *float64 `json:"sora_video_price_per_request_hd,omitempty"` - // SoraStorageQuotaBytes holds the value of the "sora_storage_quota_bytes" field. - SoraStorageQuotaBytes int64 `json:"sora_storage_quota_bytes,omitempty"` // 是否仅允许 Claude Code 客户端 ClaudeCodeOnly bool `json:"claude_code_only,omitempty"` // 非 Claude Code 请求降级使用的分组 ID @@ -196,9 +186,9 @@ func (*Group) scanValues(columns []string) ([]any, error) { values[i] = new([]byte) case group.FieldIsExclusive, group.FieldClaudeCodeOnly, group.FieldModelRoutingEnabled, group.FieldMcpXMLInject, group.FieldAllowMessagesDispatch, group.FieldRequireOauthOnly, group.FieldRequirePrivacySet: values[i] = new(sql.NullBool) - case group.FieldRateMultiplier, group.FieldDailyLimitUsd, group.FieldWeeklyLimitUsd, group.FieldMonthlyLimitUsd, group.FieldImagePrice1k, group.FieldImagePrice2k, group.FieldImagePrice4k, group.FieldSoraImagePrice360, group.FieldSoraImagePrice540, group.FieldSoraVideoPricePerRequest, group.FieldSoraVideoPricePerRequestHd: + case group.FieldRateMultiplier, group.FieldDailyLimitUsd, group.FieldWeeklyLimitUsd, group.FieldMonthlyLimitUsd, group.FieldImagePrice1k, group.FieldImagePrice2k, group.FieldImagePrice4k: values[i] = new(sql.NullFloat64) - case group.FieldID, group.FieldDefaultValidityDays, group.FieldSoraStorageQuotaBytes, group.FieldFallbackGroupID, group.FieldFallbackGroupIDOnInvalidRequest, group.FieldSortOrder: + case group.FieldID, group.FieldDefaultValidityDays, group.FieldFallbackGroupID, group.FieldFallbackGroupIDOnInvalidRequest, group.FieldSortOrder: values[i] = new(sql.NullInt64) case group.FieldName, group.FieldDescription, group.FieldStatus, group.FieldPlatform, group.FieldSubscriptionType, group.FieldDefaultMappedModel: values[i] = new(sql.NullString) @@ -335,40 +325,6 @@ func (_m *Group) assignValues(columns []string, values []any) error { _m.ImagePrice4k = new(float64) *_m.ImagePrice4k = value.Float64 } - case group.FieldSoraImagePrice360: - if value, ok := values[i].(*sql.NullFloat64); !ok { - return fmt.Errorf("unexpected type %T for field sora_image_price_360", values[i]) - } else if value.Valid { - _m.SoraImagePrice360 = new(float64) - *_m.SoraImagePrice360 = value.Float64 - } - case group.FieldSoraImagePrice540: - if value, ok := values[i].(*sql.NullFloat64); !ok { - return fmt.Errorf("unexpected type %T for field sora_image_price_540", values[i]) - } else if value.Valid { - _m.SoraImagePrice540 = new(float64) - *_m.SoraImagePrice540 = value.Float64 - } - case group.FieldSoraVideoPricePerRequest: - if value, ok := values[i].(*sql.NullFloat64); !ok { - return fmt.Errorf("unexpected type %T for field sora_video_price_per_request", values[i]) - } else if value.Valid { - _m.SoraVideoPricePerRequest = new(float64) - *_m.SoraVideoPricePerRequest = value.Float64 - } - case group.FieldSoraVideoPricePerRequestHd: - if value, ok := values[i].(*sql.NullFloat64); !ok { - return fmt.Errorf("unexpected type %T for field sora_video_price_per_request_hd", values[i]) - } else if value.Valid { - _m.SoraVideoPricePerRequestHd = new(float64) - *_m.SoraVideoPricePerRequestHd = value.Float64 - } - case group.FieldSoraStorageQuotaBytes: - if value, ok := values[i].(*sql.NullInt64); !ok { - return fmt.Errorf("unexpected type %T for field sora_storage_quota_bytes", values[i]) - } else if value.Valid { - _m.SoraStorageQuotaBytes = value.Int64 - } case group.FieldClaudeCodeOnly: if value, ok := values[i].(*sql.NullBool); !ok { return fmt.Errorf("unexpected type %T for field claude_code_only", values[i]) @@ -590,29 +546,6 @@ func (_m *Group) String() string { builder.WriteString(fmt.Sprintf("%v", *v)) } builder.WriteString(", ") - if v := _m.SoraImagePrice360; v != nil { - builder.WriteString("sora_image_price_360=") - builder.WriteString(fmt.Sprintf("%v", *v)) - } - builder.WriteString(", ") - if v := _m.SoraImagePrice540; v != nil { - builder.WriteString("sora_image_price_540=") - builder.WriteString(fmt.Sprintf("%v", *v)) - } - builder.WriteString(", ") - if v := _m.SoraVideoPricePerRequest; v != nil { - builder.WriteString("sora_video_price_per_request=") - builder.WriteString(fmt.Sprintf("%v", *v)) - } - builder.WriteString(", ") - if v := _m.SoraVideoPricePerRequestHd; v != nil { - builder.WriteString("sora_video_price_per_request_hd=") - builder.WriteString(fmt.Sprintf("%v", *v)) - } - builder.WriteString(", ") - builder.WriteString("sora_storage_quota_bytes=") - builder.WriteString(fmt.Sprintf("%v", _m.SoraStorageQuotaBytes)) - builder.WriteString(", ") builder.WriteString("claude_code_only=") builder.WriteString(fmt.Sprintf("%v", _m.ClaudeCodeOnly)) builder.WriteString(", ") diff --git a/backend/ent/group/group.go b/backend/ent/group/group.go index 35222127..21a7c2cb 100644 --- a/backend/ent/group/group.go +++ b/backend/ent/group/group.go @@ -49,16 +49,6 @@ const ( FieldImagePrice2k = "image_price_2k" // FieldImagePrice4k holds the string denoting the image_price_4k field in the database. FieldImagePrice4k = "image_price_4k" - // FieldSoraImagePrice360 holds the string denoting the sora_image_price_360 field in the database. - FieldSoraImagePrice360 = "sora_image_price_360" - // FieldSoraImagePrice540 holds the string denoting the sora_image_price_540 field in the database. - FieldSoraImagePrice540 = "sora_image_price_540" - // FieldSoraVideoPricePerRequest holds the string denoting the sora_video_price_per_request field in the database. - FieldSoraVideoPricePerRequest = "sora_video_price_per_request" - // FieldSoraVideoPricePerRequestHd holds the string denoting the sora_video_price_per_request_hd field in the database. - FieldSoraVideoPricePerRequestHd = "sora_video_price_per_request_hd" - // FieldSoraStorageQuotaBytes holds the string denoting the sora_storage_quota_bytes field in the database. - FieldSoraStorageQuotaBytes = "sora_storage_quota_bytes" // FieldClaudeCodeOnly holds the string denoting the claude_code_only field in the database. FieldClaudeCodeOnly = "claude_code_only" // FieldFallbackGroupID holds the string denoting the fallback_group_id field in the database. @@ -175,11 +165,6 @@ var Columns = []string{ FieldImagePrice1k, FieldImagePrice2k, FieldImagePrice4k, - FieldSoraImagePrice360, - FieldSoraImagePrice540, - FieldSoraVideoPricePerRequest, - FieldSoraVideoPricePerRequestHd, - FieldSoraStorageQuotaBytes, FieldClaudeCodeOnly, FieldFallbackGroupID, FieldFallbackGroupIDOnInvalidRequest, @@ -247,8 +232,6 @@ var ( SubscriptionTypeValidator func(string) error // DefaultDefaultValidityDays holds the default value on creation for the "default_validity_days" field. DefaultDefaultValidityDays int - // DefaultSoraStorageQuotaBytes holds the default value on creation for the "sora_storage_quota_bytes" field. - DefaultSoraStorageQuotaBytes int64 // DefaultClaudeCodeOnly holds the default value on creation for the "claude_code_only" field. DefaultClaudeCodeOnly bool // DefaultModelRoutingEnabled holds the default value on creation for the "model_routing_enabled" field. @@ -364,31 +347,6 @@ func ByImagePrice4k(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldImagePrice4k, opts...).ToFunc() } -// BySoraImagePrice360 orders the results by the sora_image_price_360 field. -func BySoraImagePrice360(opts ...sql.OrderTermOption) OrderOption { - return sql.OrderByField(FieldSoraImagePrice360, opts...).ToFunc() -} - -// BySoraImagePrice540 orders the results by the sora_image_price_540 field. -func BySoraImagePrice540(opts ...sql.OrderTermOption) OrderOption { - return sql.OrderByField(FieldSoraImagePrice540, opts...).ToFunc() -} - -// BySoraVideoPricePerRequest orders the results by the sora_video_price_per_request field. -func BySoraVideoPricePerRequest(opts ...sql.OrderTermOption) OrderOption { - return sql.OrderByField(FieldSoraVideoPricePerRequest, opts...).ToFunc() -} - -// BySoraVideoPricePerRequestHd orders the results by the sora_video_price_per_request_hd field. -func BySoraVideoPricePerRequestHd(opts ...sql.OrderTermOption) OrderOption { - return sql.OrderByField(FieldSoraVideoPricePerRequestHd, opts...).ToFunc() -} - -// BySoraStorageQuotaBytes orders the results by the sora_storage_quota_bytes field. -func BySoraStorageQuotaBytes(opts ...sql.OrderTermOption) OrderOption { - return sql.OrderByField(FieldSoraStorageQuotaBytes, opts...).ToFunc() -} - // ByClaudeCodeOnly orders the results by the claude_code_only field. func ByClaudeCodeOnly(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldClaudeCodeOnly, opts...).ToFunc() diff --git a/backend/ent/group/where.go b/backend/ent/group/where.go index 41bd575a..cba2ce5f 100644 --- a/backend/ent/group/where.go +++ b/backend/ent/group/where.go @@ -140,31 +140,6 @@ func ImagePrice4k(v float64) predicate.Group { return predicate.Group(sql.FieldEQ(FieldImagePrice4k, v)) } -// SoraImagePrice360 applies equality check predicate on the "sora_image_price_360" field. It's identical to SoraImagePrice360EQ. -func SoraImagePrice360(v float64) predicate.Group { - return predicate.Group(sql.FieldEQ(FieldSoraImagePrice360, v)) -} - -// SoraImagePrice540 applies equality check predicate on the "sora_image_price_540" field. It's identical to SoraImagePrice540EQ. -func SoraImagePrice540(v float64) predicate.Group { - return predicate.Group(sql.FieldEQ(FieldSoraImagePrice540, v)) -} - -// SoraVideoPricePerRequest applies equality check predicate on the "sora_video_price_per_request" field. It's identical to SoraVideoPricePerRequestEQ. -func SoraVideoPricePerRequest(v float64) predicate.Group { - return predicate.Group(sql.FieldEQ(FieldSoraVideoPricePerRequest, v)) -} - -// SoraVideoPricePerRequestHd applies equality check predicate on the "sora_video_price_per_request_hd" field. It's identical to SoraVideoPricePerRequestHdEQ. -func SoraVideoPricePerRequestHd(v float64) predicate.Group { - return predicate.Group(sql.FieldEQ(FieldSoraVideoPricePerRequestHd, v)) -} - -// SoraStorageQuotaBytes applies equality check predicate on the "sora_storage_quota_bytes" field. It's identical to SoraStorageQuotaBytesEQ. -func SoraStorageQuotaBytes(v int64) predicate.Group { - return predicate.Group(sql.FieldEQ(FieldSoraStorageQuotaBytes, v)) -} - // ClaudeCodeOnly applies equality check predicate on the "claude_code_only" field. It's identical to ClaudeCodeOnlyEQ. func ClaudeCodeOnly(v bool) predicate.Group { return predicate.Group(sql.FieldEQ(FieldClaudeCodeOnly, v)) @@ -1070,246 +1045,6 @@ func ImagePrice4kNotNil() predicate.Group { return predicate.Group(sql.FieldNotNull(FieldImagePrice4k)) } -// SoraImagePrice360EQ applies the EQ predicate on the "sora_image_price_360" field. -func SoraImagePrice360EQ(v float64) predicate.Group { - return predicate.Group(sql.FieldEQ(FieldSoraImagePrice360, v)) -} - -// SoraImagePrice360NEQ applies the NEQ predicate on the "sora_image_price_360" field. -func SoraImagePrice360NEQ(v float64) predicate.Group { - return predicate.Group(sql.FieldNEQ(FieldSoraImagePrice360, v)) -} - -// SoraImagePrice360In applies the In predicate on the "sora_image_price_360" field. -func SoraImagePrice360In(vs ...float64) predicate.Group { - return predicate.Group(sql.FieldIn(FieldSoraImagePrice360, vs...)) -} - -// SoraImagePrice360NotIn applies the NotIn predicate on the "sora_image_price_360" field. -func SoraImagePrice360NotIn(vs ...float64) predicate.Group { - return predicate.Group(sql.FieldNotIn(FieldSoraImagePrice360, vs...)) -} - -// SoraImagePrice360GT applies the GT predicate on the "sora_image_price_360" field. -func SoraImagePrice360GT(v float64) predicate.Group { - return predicate.Group(sql.FieldGT(FieldSoraImagePrice360, v)) -} - -// SoraImagePrice360GTE applies the GTE predicate on the "sora_image_price_360" field. -func SoraImagePrice360GTE(v float64) predicate.Group { - return predicate.Group(sql.FieldGTE(FieldSoraImagePrice360, v)) -} - -// SoraImagePrice360LT applies the LT predicate on the "sora_image_price_360" field. -func SoraImagePrice360LT(v float64) predicate.Group { - return predicate.Group(sql.FieldLT(FieldSoraImagePrice360, v)) -} - -// SoraImagePrice360LTE applies the LTE predicate on the "sora_image_price_360" field. -func SoraImagePrice360LTE(v float64) predicate.Group { - return predicate.Group(sql.FieldLTE(FieldSoraImagePrice360, v)) -} - -// SoraImagePrice360IsNil applies the IsNil predicate on the "sora_image_price_360" field. -func SoraImagePrice360IsNil() predicate.Group { - return predicate.Group(sql.FieldIsNull(FieldSoraImagePrice360)) -} - -// SoraImagePrice360NotNil applies the NotNil predicate on the "sora_image_price_360" field. -func SoraImagePrice360NotNil() predicate.Group { - return predicate.Group(sql.FieldNotNull(FieldSoraImagePrice360)) -} - -// SoraImagePrice540EQ applies the EQ predicate on the "sora_image_price_540" field. -func SoraImagePrice540EQ(v float64) predicate.Group { - return predicate.Group(sql.FieldEQ(FieldSoraImagePrice540, v)) -} - -// SoraImagePrice540NEQ applies the NEQ predicate on the "sora_image_price_540" field. -func SoraImagePrice540NEQ(v float64) predicate.Group { - return predicate.Group(sql.FieldNEQ(FieldSoraImagePrice540, v)) -} - -// SoraImagePrice540In applies the In predicate on the "sora_image_price_540" field. -func SoraImagePrice540In(vs ...float64) predicate.Group { - return predicate.Group(sql.FieldIn(FieldSoraImagePrice540, vs...)) -} - -// SoraImagePrice540NotIn applies the NotIn predicate on the "sora_image_price_540" field. -func SoraImagePrice540NotIn(vs ...float64) predicate.Group { - return predicate.Group(sql.FieldNotIn(FieldSoraImagePrice540, vs...)) -} - -// SoraImagePrice540GT applies the GT predicate on the "sora_image_price_540" field. -func SoraImagePrice540GT(v float64) predicate.Group { - return predicate.Group(sql.FieldGT(FieldSoraImagePrice540, v)) -} - -// SoraImagePrice540GTE applies the GTE predicate on the "sora_image_price_540" field. -func SoraImagePrice540GTE(v float64) predicate.Group { - return predicate.Group(sql.FieldGTE(FieldSoraImagePrice540, v)) -} - -// SoraImagePrice540LT applies the LT predicate on the "sora_image_price_540" field. -func SoraImagePrice540LT(v float64) predicate.Group { - return predicate.Group(sql.FieldLT(FieldSoraImagePrice540, v)) -} - -// SoraImagePrice540LTE applies the LTE predicate on the "sora_image_price_540" field. -func SoraImagePrice540LTE(v float64) predicate.Group { - return predicate.Group(sql.FieldLTE(FieldSoraImagePrice540, v)) -} - -// SoraImagePrice540IsNil applies the IsNil predicate on the "sora_image_price_540" field. -func SoraImagePrice540IsNil() predicate.Group { - return predicate.Group(sql.FieldIsNull(FieldSoraImagePrice540)) -} - -// SoraImagePrice540NotNil applies the NotNil predicate on the "sora_image_price_540" field. -func SoraImagePrice540NotNil() predicate.Group { - return predicate.Group(sql.FieldNotNull(FieldSoraImagePrice540)) -} - -// SoraVideoPricePerRequestEQ applies the EQ predicate on the "sora_video_price_per_request" field. -func SoraVideoPricePerRequestEQ(v float64) predicate.Group { - return predicate.Group(sql.FieldEQ(FieldSoraVideoPricePerRequest, v)) -} - -// SoraVideoPricePerRequestNEQ applies the NEQ predicate on the "sora_video_price_per_request" field. -func SoraVideoPricePerRequestNEQ(v float64) predicate.Group { - return predicate.Group(sql.FieldNEQ(FieldSoraVideoPricePerRequest, v)) -} - -// SoraVideoPricePerRequestIn applies the In predicate on the "sora_video_price_per_request" field. -func SoraVideoPricePerRequestIn(vs ...float64) predicate.Group { - return predicate.Group(sql.FieldIn(FieldSoraVideoPricePerRequest, vs...)) -} - -// SoraVideoPricePerRequestNotIn applies the NotIn predicate on the "sora_video_price_per_request" field. -func SoraVideoPricePerRequestNotIn(vs ...float64) predicate.Group { - return predicate.Group(sql.FieldNotIn(FieldSoraVideoPricePerRequest, vs...)) -} - -// SoraVideoPricePerRequestGT applies the GT predicate on the "sora_video_price_per_request" field. -func SoraVideoPricePerRequestGT(v float64) predicate.Group { - return predicate.Group(sql.FieldGT(FieldSoraVideoPricePerRequest, v)) -} - -// SoraVideoPricePerRequestGTE applies the GTE predicate on the "sora_video_price_per_request" field. -func SoraVideoPricePerRequestGTE(v float64) predicate.Group { - return predicate.Group(sql.FieldGTE(FieldSoraVideoPricePerRequest, v)) -} - -// SoraVideoPricePerRequestLT applies the LT predicate on the "sora_video_price_per_request" field. -func SoraVideoPricePerRequestLT(v float64) predicate.Group { - return predicate.Group(sql.FieldLT(FieldSoraVideoPricePerRequest, v)) -} - -// SoraVideoPricePerRequestLTE applies the LTE predicate on the "sora_video_price_per_request" field. -func SoraVideoPricePerRequestLTE(v float64) predicate.Group { - return predicate.Group(sql.FieldLTE(FieldSoraVideoPricePerRequest, v)) -} - -// SoraVideoPricePerRequestIsNil applies the IsNil predicate on the "sora_video_price_per_request" field. -func SoraVideoPricePerRequestIsNil() predicate.Group { - return predicate.Group(sql.FieldIsNull(FieldSoraVideoPricePerRequest)) -} - -// SoraVideoPricePerRequestNotNil applies the NotNil predicate on the "sora_video_price_per_request" field. -func SoraVideoPricePerRequestNotNil() predicate.Group { - return predicate.Group(sql.FieldNotNull(FieldSoraVideoPricePerRequest)) -} - -// SoraVideoPricePerRequestHdEQ applies the EQ predicate on the "sora_video_price_per_request_hd" field. -func SoraVideoPricePerRequestHdEQ(v float64) predicate.Group { - return predicate.Group(sql.FieldEQ(FieldSoraVideoPricePerRequestHd, v)) -} - -// SoraVideoPricePerRequestHdNEQ applies the NEQ predicate on the "sora_video_price_per_request_hd" field. -func SoraVideoPricePerRequestHdNEQ(v float64) predicate.Group { - return predicate.Group(sql.FieldNEQ(FieldSoraVideoPricePerRequestHd, v)) -} - -// SoraVideoPricePerRequestHdIn applies the In predicate on the "sora_video_price_per_request_hd" field. -func SoraVideoPricePerRequestHdIn(vs ...float64) predicate.Group { - return predicate.Group(sql.FieldIn(FieldSoraVideoPricePerRequestHd, vs...)) -} - -// SoraVideoPricePerRequestHdNotIn applies the NotIn predicate on the "sora_video_price_per_request_hd" field. -func SoraVideoPricePerRequestHdNotIn(vs ...float64) predicate.Group { - return predicate.Group(sql.FieldNotIn(FieldSoraVideoPricePerRequestHd, vs...)) -} - -// SoraVideoPricePerRequestHdGT applies the GT predicate on the "sora_video_price_per_request_hd" field. -func SoraVideoPricePerRequestHdGT(v float64) predicate.Group { - return predicate.Group(sql.FieldGT(FieldSoraVideoPricePerRequestHd, v)) -} - -// SoraVideoPricePerRequestHdGTE applies the GTE predicate on the "sora_video_price_per_request_hd" field. -func SoraVideoPricePerRequestHdGTE(v float64) predicate.Group { - return predicate.Group(sql.FieldGTE(FieldSoraVideoPricePerRequestHd, v)) -} - -// SoraVideoPricePerRequestHdLT applies the LT predicate on the "sora_video_price_per_request_hd" field. -func SoraVideoPricePerRequestHdLT(v float64) predicate.Group { - return predicate.Group(sql.FieldLT(FieldSoraVideoPricePerRequestHd, v)) -} - -// SoraVideoPricePerRequestHdLTE applies the LTE predicate on the "sora_video_price_per_request_hd" field. -func SoraVideoPricePerRequestHdLTE(v float64) predicate.Group { - return predicate.Group(sql.FieldLTE(FieldSoraVideoPricePerRequestHd, v)) -} - -// SoraVideoPricePerRequestHdIsNil applies the IsNil predicate on the "sora_video_price_per_request_hd" field. -func SoraVideoPricePerRequestHdIsNil() predicate.Group { - return predicate.Group(sql.FieldIsNull(FieldSoraVideoPricePerRequestHd)) -} - -// SoraVideoPricePerRequestHdNotNil applies the NotNil predicate on the "sora_video_price_per_request_hd" field. -func SoraVideoPricePerRequestHdNotNil() predicate.Group { - return predicate.Group(sql.FieldNotNull(FieldSoraVideoPricePerRequestHd)) -} - -// SoraStorageQuotaBytesEQ applies the EQ predicate on the "sora_storage_quota_bytes" field. -func SoraStorageQuotaBytesEQ(v int64) predicate.Group { - return predicate.Group(sql.FieldEQ(FieldSoraStorageQuotaBytes, v)) -} - -// SoraStorageQuotaBytesNEQ applies the NEQ predicate on the "sora_storage_quota_bytes" field. -func SoraStorageQuotaBytesNEQ(v int64) predicate.Group { - return predicate.Group(sql.FieldNEQ(FieldSoraStorageQuotaBytes, v)) -} - -// SoraStorageQuotaBytesIn applies the In predicate on the "sora_storage_quota_bytes" field. -func SoraStorageQuotaBytesIn(vs ...int64) predicate.Group { - return predicate.Group(sql.FieldIn(FieldSoraStorageQuotaBytes, vs...)) -} - -// SoraStorageQuotaBytesNotIn applies the NotIn predicate on the "sora_storage_quota_bytes" field. -func SoraStorageQuotaBytesNotIn(vs ...int64) predicate.Group { - return predicate.Group(sql.FieldNotIn(FieldSoraStorageQuotaBytes, vs...)) -} - -// SoraStorageQuotaBytesGT applies the GT predicate on the "sora_storage_quota_bytes" field. -func SoraStorageQuotaBytesGT(v int64) predicate.Group { - return predicate.Group(sql.FieldGT(FieldSoraStorageQuotaBytes, v)) -} - -// SoraStorageQuotaBytesGTE applies the GTE predicate on the "sora_storage_quota_bytes" field. -func SoraStorageQuotaBytesGTE(v int64) predicate.Group { - return predicate.Group(sql.FieldGTE(FieldSoraStorageQuotaBytes, v)) -} - -// SoraStorageQuotaBytesLT applies the LT predicate on the "sora_storage_quota_bytes" field. -func SoraStorageQuotaBytesLT(v int64) predicate.Group { - return predicate.Group(sql.FieldLT(FieldSoraStorageQuotaBytes, v)) -} - -// SoraStorageQuotaBytesLTE applies the LTE predicate on the "sora_storage_quota_bytes" field. -func SoraStorageQuotaBytesLTE(v int64) predicate.Group { - return predicate.Group(sql.FieldLTE(FieldSoraStorageQuotaBytes, v)) -} - // ClaudeCodeOnlyEQ applies the EQ predicate on the "claude_code_only" field. func ClaudeCodeOnlyEQ(v bool) predicate.Group { return predicate.Group(sql.FieldEQ(FieldClaudeCodeOnly, v)) diff --git a/backend/ent/group_create.go b/backend/ent/group_create.go index a635dfd9..a8c30b18 100644 --- a/backend/ent/group_create.go +++ b/backend/ent/group_create.go @@ -258,76 +258,6 @@ func (_c *GroupCreate) SetNillableImagePrice4k(v *float64) *GroupCreate { return _c } -// SetSoraImagePrice360 sets the "sora_image_price_360" field. -func (_c *GroupCreate) SetSoraImagePrice360(v float64) *GroupCreate { - _c.mutation.SetSoraImagePrice360(v) - return _c -} - -// SetNillableSoraImagePrice360 sets the "sora_image_price_360" field if the given value is not nil. -func (_c *GroupCreate) SetNillableSoraImagePrice360(v *float64) *GroupCreate { - if v != nil { - _c.SetSoraImagePrice360(*v) - } - return _c -} - -// SetSoraImagePrice540 sets the "sora_image_price_540" field. -func (_c *GroupCreate) SetSoraImagePrice540(v float64) *GroupCreate { - _c.mutation.SetSoraImagePrice540(v) - return _c -} - -// SetNillableSoraImagePrice540 sets the "sora_image_price_540" field if the given value is not nil. -func (_c *GroupCreate) SetNillableSoraImagePrice540(v *float64) *GroupCreate { - if v != nil { - _c.SetSoraImagePrice540(*v) - } - return _c -} - -// SetSoraVideoPricePerRequest sets the "sora_video_price_per_request" field. -func (_c *GroupCreate) SetSoraVideoPricePerRequest(v float64) *GroupCreate { - _c.mutation.SetSoraVideoPricePerRequest(v) - return _c -} - -// SetNillableSoraVideoPricePerRequest sets the "sora_video_price_per_request" field if the given value is not nil. -func (_c *GroupCreate) SetNillableSoraVideoPricePerRequest(v *float64) *GroupCreate { - if v != nil { - _c.SetSoraVideoPricePerRequest(*v) - } - return _c -} - -// SetSoraVideoPricePerRequestHd sets the "sora_video_price_per_request_hd" field. -func (_c *GroupCreate) SetSoraVideoPricePerRequestHd(v float64) *GroupCreate { - _c.mutation.SetSoraVideoPricePerRequestHd(v) - return _c -} - -// SetNillableSoraVideoPricePerRequestHd sets the "sora_video_price_per_request_hd" field if the given value is not nil. -func (_c *GroupCreate) SetNillableSoraVideoPricePerRequestHd(v *float64) *GroupCreate { - if v != nil { - _c.SetSoraVideoPricePerRequestHd(*v) - } - return _c -} - -// SetSoraStorageQuotaBytes sets the "sora_storage_quota_bytes" field. -func (_c *GroupCreate) SetSoraStorageQuotaBytes(v int64) *GroupCreate { - _c.mutation.SetSoraStorageQuotaBytes(v) - return _c -} - -// SetNillableSoraStorageQuotaBytes sets the "sora_storage_quota_bytes" field if the given value is not nil. -func (_c *GroupCreate) SetNillableSoraStorageQuotaBytes(v *int64) *GroupCreate { - if v != nil { - _c.SetSoraStorageQuotaBytes(*v) - } - return _c -} - // SetClaudeCodeOnly sets the "claude_code_only" field. func (_c *GroupCreate) SetClaudeCodeOnly(v bool) *GroupCreate { _c.mutation.SetClaudeCodeOnly(v) @@ -645,10 +575,6 @@ func (_c *GroupCreate) defaults() error { v := group.DefaultDefaultValidityDays _c.mutation.SetDefaultValidityDays(v) } - if _, ok := _c.mutation.SoraStorageQuotaBytes(); !ok { - v := group.DefaultSoraStorageQuotaBytes - _c.mutation.SetSoraStorageQuotaBytes(v) - } if _, ok := _c.mutation.ClaudeCodeOnly(); !ok { v := group.DefaultClaudeCodeOnly _c.mutation.SetClaudeCodeOnly(v) @@ -737,9 +663,6 @@ func (_c *GroupCreate) check() error { if _, ok := _c.mutation.DefaultValidityDays(); !ok { return &ValidationError{Name: "default_validity_days", err: errors.New(`ent: missing required field "Group.default_validity_days"`)} } - if _, ok := _c.mutation.SoraStorageQuotaBytes(); !ok { - return &ValidationError{Name: "sora_storage_quota_bytes", err: errors.New(`ent: missing required field "Group.sora_storage_quota_bytes"`)} - } if _, ok := _c.mutation.ClaudeCodeOnly(); !ok { return &ValidationError{Name: "claude_code_only", err: errors.New(`ent: missing required field "Group.claude_code_only"`)} } @@ -867,26 +790,6 @@ func (_c *GroupCreate) createSpec() (*Group, *sqlgraph.CreateSpec) { _spec.SetField(group.FieldImagePrice4k, field.TypeFloat64, value) _node.ImagePrice4k = &value } - if value, ok := _c.mutation.SoraImagePrice360(); ok { - _spec.SetField(group.FieldSoraImagePrice360, field.TypeFloat64, value) - _node.SoraImagePrice360 = &value - } - if value, ok := _c.mutation.SoraImagePrice540(); ok { - _spec.SetField(group.FieldSoraImagePrice540, field.TypeFloat64, value) - _node.SoraImagePrice540 = &value - } - if value, ok := _c.mutation.SoraVideoPricePerRequest(); ok { - _spec.SetField(group.FieldSoraVideoPricePerRequest, field.TypeFloat64, value) - _node.SoraVideoPricePerRequest = &value - } - if value, ok := _c.mutation.SoraVideoPricePerRequestHd(); ok { - _spec.SetField(group.FieldSoraVideoPricePerRequestHd, field.TypeFloat64, value) - _node.SoraVideoPricePerRequestHd = &value - } - if value, ok := _c.mutation.SoraStorageQuotaBytes(); ok { - _spec.SetField(group.FieldSoraStorageQuotaBytes, field.TypeInt64, value) - _node.SoraStorageQuotaBytes = value - } if value, ok := _c.mutation.ClaudeCodeOnly(); ok { _spec.SetField(group.FieldClaudeCodeOnly, field.TypeBool, value) _node.ClaudeCodeOnly = value @@ -1379,120 +1282,6 @@ func (u *GroupUpsert) ClearImagePrice4k() *GroupUpsert { return u } -// SetSoraImagePrice360 sets the "sora_image_price_360" field. -func (u *GroupUpsert) SetSoraImagePrice360(v float64) *GroupUpsert { - u.Set(group.FieldSoraImagePrice360, v) - return u -} - -// UpdateSoraImagePrice360 sets the "sora_image_price_360" field to the value that was provided on create. -func (u *GroupUpsert) UpdateSoraImagePrice360() *GroupUpsert { - u.SetExcluded(group.FieldSoraImagePrice360) - return u -} - -// AddSoraImagePrice360 adds v to the "sora_image_price_360" field. -func (u *GroupUpsert) AddSoraImagePrice360(v float64) *GroupUpsert { - u.Add(group.FieldSoraImagePrice360, v) - return u -} - -// ClearSoraImagePrice360 clears the value of the "sora_image_price_360" field. -func (u *GroupUpsert) ClearSoraImagePrice360() *GroupUpsert { - u.SetNull(group.FieldSoraImagePrice360) - return u -} - -// SetSoraImagePrice540 sets the "sora_image_price_540" field. -func (u *GroupUpsert) SetSoraImagePrice540(v float64) *GroupUpsert { - u.Set(group.FieldSoraImagePrice540, v) - return u -} - -// UpdateSoraImagePrice540 sets the "sora_image_price_540" field to the value that was provided on create. -func (u *GroupUpsert) UpdateSoraImagePrice540() *GroupUpsert { - u.SetExcluded(group.FieldSoraImagePrice540) - return u -} - -// AddSoraImagePrice540 adds v to the "sora_image_price_540" field. -func (u *GroupUpsert) AddSoraImagePrice540(v float64) *GroupUpsert { - u.Add(group.FieldSoraImagePrice540, v) - return u -} - -// ClearSoraImagePrice540 clears the value of the "sora_image_price_540" field. -func (u *GroupUpsert) ClearSoraImagePrice540() *GroupUpsert { - u.SetNull(group.FieldSoraImagePrice540) - return u -} - -// SetSoraVideoPricePerRequest sets the "sora_video_price_per_request" field. -func (u *GroupUpsert) SetSoraVideoPricePerRequest(v float64) *GroupUpsert { - u.Set(group.FieldSoraVideoPricePerRequest, v) - return u -} - -// UpdateSoraVideoPricePerRequest sets the "sora_video_price_per_request" field to the value that was provided on create. -func (u *GroupUpsert) UpdateSoraVideoPricePerRequest() *GroupUpsert { - u.SetExcluded(group.FieldSoraVideoPricePerRequest) - return u -} - -// AddSoraVideoPricePerRequest adds v to the "sora_video_price_per_request" field. -func (u *GroupUpsert) AddSoraVideoPricePerRequest(v float64) *GroupUpsert { - u.Add(group.FieldSoraVideoPricePerRequest, v) - return u -} - -// ClearSoraVideoPricePerRequest clears the value of the "sora_video_price_per_request" field. -func (u *GroupUpsert) ClearSoraVideoPricePerRequest() *GroupUpsert { - u.SetNull(group.FieldSoraVideoPricePerRequest) - return u -} - -// SetSoraVideoPricePerRequestHd sets the "sora_video_price_per_request_hd" field. -func (u *GroupUpsert) SetSoraVideoPricePerRequestHd(v float64) *GroupUpsert { - u.Set(group.FieldSoraVideoPricePerRequestHd, v) - return u -} - -// UpdateSoraVideoPricePerRequestHd sets the "sora_video_price_per_request_hd" field to the value that was provided on create. -func (u *GroupUpsert) UpdateSoraVideoPricePerRequestHd() *GroupUpsert { - u.SetExcluded(group.FieldSoraVideoPricePerRequestHd) - return u -} - -// AddSoraVideoPricePerRequestHd adds v to the "sora_video_price_per_request_hd" field. -func (u *GroupUpsert) AddSoraVideoPricePerRequestHd(v float64) *GroupUpsert { - u.Add(group.FieldSoraVideoPricePerRequestHd, v) - return u -} - -// ClearSoraVideoPricePerRequestHd clears the value of the "sora_video_price_per_request_hd" field. -func (u *GroupUpsert) ClearSoraVideoPricePerRequestHd() *GroupUpsert { - u.SetNull(group.FieldSoraVideoPricePerRequestHd) - return u -} - -// SetSoraStorageQuotaBytes sets the "sora_storage_quota_bytes" field. -func (u *GroupUpsert) SetSoraStorageQuotaBytes(v int64) *GroupUpsert { - u.Set(group.FieldSoraStorageQuotaBytes, v) - return u -} - -// UpdateSoraStorageQuotaBytes sets the "sora_storage_quota_bytes" field to the value that was provided on create. -func (u *GroupUpsert) UpdateSoraStorageQuotaBytes() *GroupUpsert { - u.SetExcluded(group.FieldSoraStorageQuotaBytes) - return u -} - -// AddSoraStorageQuotaBytes adds v to the "sora_storage_quota_bytes" field. -func (u *GroupUpsert) AddSoraStorageQuotaBytes(v int64) *GroupUpsert { - u.Add(group.FieldSoraStorageQuotaBytes, v) - return u -} - // SetClaudeCodeOnly sets the "claude_code_only" field. func (u *GroupUpsert) SetClaudeCodeOnly(v bool) *GroupUpsert { u.Set(group.FieldClaudeCodeOnly, v) @@ -2054,139 +1843,6 @@ func (u *GroupUpsertOne) ClearImagePrice4k() *GroupUpsertOne { }) } -// SetSoraImagePrice360 sets the "sora_image_price_360" field. -func (u *GroupUpsertOne) SetSoraImagePrice360(v float64) *GroupUpsertOne { - return u.Update(func(s *GroupUpsert) { - s.SetSoraImagePrice360(v) - }) -} - -// AddSoraImagePrice360 adds v to the "sora_image_price_360" field. -func (u *GroupUpsertOne) AddSoraImagePrice360(v float64) *GroupUpsertOne { - return u.Update(func(s *GroupUpsert) { - s.AddSoraImagePrice360(v) - }) -} - -// UpdateSoraImagePrice360 sets the "sora_image_price_360" field to the value that was provided on create. -func (u *GroupUpsertOne) UpdateSoraImagePrice360() *GroupUpsertOne { - return u.Update(func(s *GroupUpsert) { - s.UpdateSoraImagePrice360() - }) -} - -// ClearSoraImagePrice360 clears the value of the "sora_image_price_360" field. -func (u *GroupUpsertOne) ClearSoraImagePrice360() *GroupUpsertOne { - return u.Update(func(s *GroupUpsert) { - s.ClearSoraImagePrice360() - }) -} - -// SetSoraImagePrice540 sets the "sora_image_price_540" field. -func (u *GroupUpsertOne) SetSoraImagePrice540(v float64) *GroupUpsertOne { - return u.Update(func(s *GroupUpsert) { - s.SetSoraImagePrice540(v) - }) -} - -// AddSoraImagePrice540 adds v to the "sora_image_price_540" field. -func (u *GroupUpsertOne) AddSoraImagePrice540(v float64) *GroupUpsertOne { - return u.Update(func(s *GroupUpsert) { - s.AddSoraImagePrice540(v) - }) -} - -// UpdateSoraImagePrice540 sets the "sora_image_price_540" field to the value that was provided on create. -func (u *GroupUpsertOne) UpdateSoraImagePrice540() *GroupUpsertOne { - return u.Update(func(s *GroupUpsert) { - s.UpdateSoraImagePrice540() - }) -} - -// ClearSoraImagePrice540 clears the value of the "sora_image_price_540" field. -func (u *GroupUpsertOne) ClearSoraImagePrice540() *GroupUpsertOne { - return u.Update(func(s *GroupUpsert) { - s.ClearSoraImagePrice540() - }) -} - -// SetSoraVideoPricePerRequest sets the "sora_video_price_per_request" field. -func (u *GroupUpsertOne) SetSoraVideoPricePerRequest(v float64) *GroupUpsertOne { - return u.Update(func(s *GroupUpsert) { - s.SetSoraVideoPricePerRequest(v) - }) -} - -// AddSoraVideoPricePerRequest adds v to the "sora_video_price_per_request" field. -func (u *GroupUpsertOne) AddSoraVideoPricePerRequest(v float64) *GroupUpsertOne { - return u.Update(func(s *GroupUpsert) { - s.AddSoraVideoPricePerRequest(v) - }) -} - -// UpdateSoraVideoPricePerRequest sets the "sora_video_price_per_request" field to the value that was provided on create. -func (u *GroupUpsertOne) UpdateSoraVideoPricePerRequest() *GroupUpsertOne { - return u.Update(func(s *GroupUpsert) { - s.UpdateSoraVideoPricePerRequest() - }) -} - -// ClearSoraVideoPricePerRequest clears the value of the "sora_video_price_per_request" field. -func (u *GroupUpsertOne) ClearSoraVideoPricePerRequest() *GroupUpsertOne { - return u.Update(func(s *GroupUpsert) { - s.ClearSoraVideoPricePerRequest() - }) -} - -// SetSoraVideoPricePerRequestHd sets the "sora_video_price_per_request_hd" field. -func (u *GroupUpsertOne) SetSoraVideoPricePerRequestHd(v float64) *GroupUpsertOne { - return u.Update(func(s *GroupUpsert) { - s.SetSoraVideoPricePerRequestHd(v) - }) -} - -// AddSoraVideoPricePerRequestHd adds v to the "sora_video_price_per_request_hd" field. -func (u *GroupUpsertOne) AddSoraVideoPricePerRequestHd(v float64) *GroupUpsertOne { - return u.Update(func(s *GroupUpsert) { - s.AddSoraVideoPricePerRequestHd(v) - }) -} - -// UpdateSoraVideoPricePerRequestHd sets the "sora_video_price_per_request_hd" field to the value that was provided on create. -func (u *GroupUpsertOne) UpdateSoraVideoPricePerRequestHd() *GroupUpsertOne { - return u.Update(func(s *GroupUpsert) { - s.UpdateSoraVideoPricePerRequestHd() - }) -} - -// ClearSoraVideoPricePerRequestHd clears the value of the "sora_video_price_per_request_hd" field. -func (u *GroupUpsertOne) ClearSoraVideoPricePerRequestHd() *GroupUpsertOne { - return u.Update(func(s *GroupUpsert) { - s.ClearSoraVideoPricePerRequestHd() - }) -} - -// SetSoraStorageQuotaBytes sets the "sora_storage_quota_bytes" field. -func (u *GroupUpsertOne) SetSoraStorageQuotaBytes(v int64) *GroupUpsertOne { - return u.Update(func(s *GroupUpsert) { - s.SetSoraStorageQuotaBytes(v) - }) -} - -// AddSoraStorageQuotaBytes adds v to the "sora_storage_quota_bytes" field. -func (u *GroupUpsertOne) AddSoraStorageQuotaBytes(v int64) *GroupUpsertOne { - return u.Update(func(s *GroupUpsert) { - s.AddSoraStorageQuotaBytes(v) - }) -} - -// UpdateSoraStorageQuotaBytes sets the "sora_storage_quota_bytes" field to the value that was provided on create. -func (u *GroupUpsertOne) UpdateSoraStorageQuotaBytes() *GroupUpsertOne { - return u.Update(func(s *GroupUpsert) { - s.UpdateSoraStorageQuotaBytes() - }) -} - // SetClaudeCodeOnly sets the "claude_code_only" field. func (u *GroupUpsertOne) SetClaudeCodeOnly(v bool) *GroupUpsertOne { return u.Update(func(s *GroupUpsert) { @@ -2944,139 +2600,6 @@ func (u *GroupUpsertBulk) ClearImagePrice4k() *GroupUpsertBulk { }) } -// SetSoraImagePrice360 sets the "sora_image_price_360" field. -func (u *GroupUpsertBulk) SetSoraImagePrice360(v float64) *GroupUpsertBulk { - return u.Update(func(s *GroupUpsert) { - s.SetSoraImagePrice360(v) - }) -} - -// AddSoraImagePrice360 adds v to the "sora_image_price_360" field. -func (u *GroupUpsertBulk) AddSoraImagePrice360(v float64) *GroupUpsertBulk { - return u.Update(func(s *GroupUpsert) { - s.AddSoraImagePrice360(v) - }) -} - -// UpdateSoraImagePrice360 sets the "sora_image_price_360" field to the value that was provided on create. -func (u *GroupUpsertBulk) UpdateSoraImagePrice360() *GroupUpsertBulk { - return u.Update(func(s *GroupUpsert) { - s.UpdateSoraImagePrice360() - }) -} - -// ClearSoraImagePrice360 clears the value of the "sora_image_price_360" field. -func (u *GroupUpsertBulk) ClearSoraImagePrice360() *GroupUpsertBulk { - return u.Update(func(s *GroupUpsert) { - s.ClearSoraImagePrice360() - }) -} - -// SetSoraImagePrice540 sets the "sora_image_price_540" field. -func (u *GroupUpsertBulk) SetSoraImagePrice540(v float64) *GroupUpsertBulk { - return u.Update(func(s *GroupUpsert) { - s.SetSoraImagePrice540(v) - }) -} - -// AddSoraImagePrice540 adds v to the "sora_image_price_540" field. -func (u *GroupUpsertBulk) AddSoraImagePrice540(v float64) *GroupUpsertBulk { - return u.Update(func(s *GroupUpsert) { - s.AddSoraImagePrice540(v) - }) -} - -// UpdateSoraImagePrice540 sets the "sora_image_price_540" field to the value that was provided on create. -func (u *GroupUpsertBulk) UpdateSoraImagePrice540() *GroupUpsertBulk { - return u.Update(func(s *GroupUpsert) { - s.UpdateSoraImagePrice540() - }) -} - -// ClearSoraImagePrice540 clears the value of the "sora_image_price_540" field. -func (u *GroupUpsertBulk) ClearSoraImagePrice540() *GroupUpsertBulk { - return u.Update(func(s *GroupUpsert) { - s.ClearSoraImagePrice540() - }) -} - -// SetSoraVideoPricePerRequest sets the "sora_video_price_per_request" field. -func (u *GroupUpsertBulk) SetSoraVideoPricePerRequest(v float64) *GroupUpsertBulk { - return u.Update(func(s *GroupUpsert) { - s.SetSoraVideoPricePerRequest(v) - }) -} - -// AddSoraVideoPricePerRequest adds v to the "sora_video_price_per_request" field. -func (u *GroupUpsertBulk) AddSoraVideoPricePerRequest(v float64) *GroupUpsertBulk { - return u.Update(func(s *GroupUpsert) { - s.AddSoraVideoPricePerRequest(v) - }) -} - -// UpdateSoraVideoPricePerRequest sets the "sora_video_price_per_request" field to the value that was provided on create. -func (u *GroupUpsertBulk) UpdateSoraVideoPricePerRequest() *GroupUpsertBulk { - return u.Update(func(s *GroupUpsert) { - s.UpdateSoraVideoPricePerRequest() - }) -} - -// ClearSoraVideoPricePerRequest clears the value of the "sora_video_price_per_request" field. -func (u *GroupUpsertBulk) ClearSoraVideoPricePerRequest() *GroupUpsertBulk { - return u.Update(func(s *GroupUpsert) { - s.ClearSoraVideoPricePerRequest() - }) -} - -// SetSoraVideoPricePerRequestHd sets the "sora_video_price_per_request_hd" field. -func (u *GroupUpsertBulk) SetSoraVideoPricePerRequestHd(v float64) *GroupUpsertBulk { - return u.Update(func(s *GroupUpsert) { - s.SetSoraVideoPricePerRequestHd(v) - }) -} - -// AddSoraVideoPricePerRequestHd adds v to the "sora_video_price_per_request_hd" field. -func (u *GroupUpsertBulk) AddSoraVideoPricePerRequestHd(v float64) *GroupUpsertBulk { - return u.Update(func(s *GroupUpsert) { - s.AddSoraVideoPricePerRequestHd(v) - }) -} - -// UpdateSoraVideoPricePerRequestHd sets the "sora_video_price_per_request_hd" field to the value that was provided on create. -func (u *GroupUpsertBulk) UpdateSoraVideoPricePerRequestHd() *GroupUpsertBulk { - return u.Update(func(s *GroupUpsert) { - s.UpdateSoraVideoPricePerRequestHd() - }) -} - -// ClearSoraVideoPricePerRequestHd clears the value of the "sora_video_price_per_request_hd" field. -func (u *GroupUpsertBulk) ClearSoraVideoPricePerRequestHd() *GroupUpsertBulk { - return u.Update(func(s *GroupUpsert) { - s.ClearSoraVideoPricePerRequestHd() - }) -} - -// SetSoraStorageQuotaBytes sets the "sora_storage_quota_bytes" field. -func (u *GroupUpsertBulk) SetSoraStorageQuotaBytes(v int64) *GroupUpsertBulk { - return u.Update(func(s *GroupUpsert) { - s.SetSoraStorageQuotaBytes(v) - }) -} - -// AddSoraStorageQuotaBytes adds v to the "sora_storage_quota_bytes" field. -func (u *GroupUpsertBulk) AddSoraStorageQuotaBytes(v int64) *GroupUpsertBulk { - return u.Update(func(s *GroupUpsert) { - s.AddSoraStorageQuotaBytes(v) - }) -} - -// UpdateSoraStorageQuotaBytes sets the "sora_storage_quota_bytes" field to the value that was provided on create. -func (u *GroupUpsertBulk) UpdateSoraStorageQuotaBytes() *GroupUpsertBulk { - return u.Update(func(s *GroupUpsert) { - s.UpdateSoraStorageQuotaBytes() - }) -} - // SetClaudeCodeOnly sets the "claude_code_only" field. func (u *GroupUpsertBulk) SetClaudeCodeOnly(v bool) *GroupUpsertBulk { return u.Update(func(s *GroupUpsert) { diff --git a/backend/ent/group_update.go b/backend/ent/group_update.go index a9a4b9da..aa1a83d4 100644 --- a/backend/ent/group_update.go +++ b/backend/ent/group_update.go @@ -355,135 +355,6 @@ func (_u *GroupUpdate) ClearImagePrice4k() *GroupUpdate { return _u } -// SetSoraImagePrice360 sets the "sora_image_price_360" field. -func (_u *GroupUpdate) SetSoraImagePrice360(v float64) *GroupUpdate { - _u.mutation.ResetSoraImagePrice360() - _u.mutation.SetSoraImagePrice360(v) - return _u -} - -// SetNillableSoraImagePrice360 sets the "sora_image_price_360" field if the given value is not nil. -func (_u *GroupUpdate) SetNillableSoraImagePrice360(v *float64) *GroupUpdate { - if v != nil { - _u.SetSoraImagePrice360(*v) - } - return _u -} - -// AddSoraImagePrice360 adds value to the "sora_image_price_360" field. -func (_u *GroupUpdate) AddSoraImagePrice360(v float64) *GroupUpdate { - _u.mutation.AddSoraImagePrice360(v) - return _u -} - -// ClearSoraImagePrice360 clears the value of the "sora_image_price_360" field. -func (_u *GroupUpdate) ClearSoraImagePrice360() *GroupUpdate { - _u.mutation.ClearSoraImagePrice360() - return _u -} - -// SetSoraImagePrice540 sets the "sora_image_price_540" field. -func (_u *GroupUpdate) SetSoraImagePrice540(v float64) *GroupUpdate { - _u.mutation.ResetSoraImagePrice540() - _u.mutation.SetSoraImagePrice540(v) - return _u -} - -// SetNillableSoraImagePrice540 sets the "sora_image_price_540" field if the given value is not nil. -func (_u *GroupUpdate) SetNillableSoraImagePrice540(v *float64) *GroupUpdate { - if v != nil { - _u.SetSoraImagePrice540(*v) - } - return _u -} - -// AddSoraImagePrice540 adds value to the "sora_image_price_540" field. -func (_u *GroupUpdate) AddSoraImagePrice540(v float64) *GroupUpdate { - _u.mutation.AddSoraImagePrice540(v) - return _u -} - -// ClearSoraImagePrice540 clears the value of the "sora_image_price_540" field. -func (_u *GroupUpdate) ClearSoraImagePrice540() *GroupUpdate { - _u.mutation.ClearSoraImagePrice540() - return _u -} - -// SetSoraVideoPricePerRequest sets the "sora_video_price_per_request" field. -func (_u *GroupUpdate) SetSoraVideoPricePerRequest(v float64) *GroupUpdate { - _u.mutation.ResetSoraVideoPricePerRequest() - _u.mutation.SetSoraVideoPricePerRequest(v) - return _u -} - -// SetNillableSoraVideoPricePerRequest sets the "sora_video_price_per_request" field if the given value is not nil. -func (_u *GroupUpdate) SetNillableSoraVideoPricePerRequest(v *float64) *GroupUpdate { - if v != nil { - _u.SetSoraVideoPricePerRequest(*v) - } - return _u -} - -// AddSoraVideoPricePerRequest adds value to the "sora_video_price_per_request" field. -func (_u *GroupUpdate) AddSoraVideoPricePerRequest(v float64) *GroupUpdate { - _u.mutation.AddSoraVideoPricePerRequest(v) - return _u -} - -// ClearSoraVideoPricePerRequest clears the value of the "sora_video_price_per_request" field. -func (_u *GroupUpdate) ClearSoraVideoPricePerRequest() *GroupUpdate { - _u.mutation.ClearSoraVideoPricePerRequest() - return _u -} - -// SetSoraVideoPricePerRequestHd sets the "sora_video_price_per_request_hd" field. -func (_u *GroupUpdate) SetSoraVideoPricePerRequestHd(v float64) *GroupUpdate { - _u.mutation.ResetSoraVideoPricePerRequestHd() - _u.mutation.SetSoraVideoPricePerRequestHd(v) - return _u -} - -// SetNillableSoraVideoPricePerRequestHd sets the "sora_video_price_per_request_hd" field if the given value is not nil. -func (_u *GroupUpdate) SetNillableSoraVideoPricePerRequestHd(v *float64) *GroupUpdate { - if v != nil { - _u.SetSoraVideoPricePerRequestHd(*v) - } - return _u -} - -// AddSoraVideoPricePerRequestHd adds value to the "sora_video_price_per_request_hd" field. -func (_u *GroupUpdate) AddSoraVideoPricePerRequestHd(v float64) *GroupUpdate { - _u.mutation.AddSoraVideoPricePerRequestHd(v) - return _u -} - -// ClearSoraVideoPricePerRequestHd clears the value of the "sora_video_price_per_request_hd" field. -func (_u *GroupUpdate) ClearSoraVideoPricePerRequestHd() *GroupUpdate { - _u.mutation.ClearSoraVideoPricePerRequestHd() - return _u -} - -// SetSoraStorageQuotaBytes sets the "sora_storage_quota_bytes" field. -func (_u *GroupUpdate) SetSoraStorageQuotaBytes(v int64) *GroupUpdate { - _u.mutation.ResetSoraStorageQuotaBytes() - _u.mutation.SetSoraStorageQuotaBytes(v) - return _u -} - -// SetNillableSoraStorageQuotaBytes sets the "sora_storage_quota_bytes" field if the given value is not nil. -func (_u *GroupUpdate) SetNillableSoraStorageQuotaBytes(v *int64) *GroupUpdate { - if v != nil { - _u.SetSoraStorageQuotaBytes(*v) - } - return _u -} - -// AddSoraStorageQuotaBytes adds value to the "sora_storage_quota_bytes" field. -func (_u *GroupUpdate) AddSoraStorageQuotaBytes(v int64) *GroupUpdate { - _u.mutation.AddSoraStorageQuotaBytes(v) - return _u -} - // SetClaudeCodeOnly sets the "claude_code_only" field. func (_u *GroupUpdate) SetClaudeCodeOnly(v bool) *GroupUpdate { _u.mutation.SetClaudeCodeOnly(v) @@ -1082,48 +953,6 @@ func (_u *GroupUpdate) sqlSave(ctx context.Context) (_node int, err error) { if _u.mutation.ImagePrice4kCleared() { _spec.ClearField(group.FieldImagePrice4k, field.TypeFloat64) } - if value, ok := _u.mutation.SoraImagePrice360(); ok { - _spec.SetField(group.FieldSoraImagePrice360, field.TypeFloat64, value) - } - if value, ok := _u.mutation.AddedSoraImagePrice360(); ok { - _spec.AddField(group.FieldSoraImagePrice360, field.TypeFloat64, value) - } - if _u.mutation.SoraImagePrice360Cleared() { - _spec.ClearField(group.FieldSoraImagePrice360, field.TypeFloat64) - } - if value, ok := _u.mutation.SoraImagePrice540(); ok { - _spec.SetField(group.FieldSoraImagePrice540, field.TypeFloat64, value) - } - if value, ok := _u.mutation.AddedSoraImagePrice540(); ok { - _spec.AddField(group.FieldSoraImagePrice540, field.TypeFloat64, value) - } - if _u.mutation.SoraImagePrice540Cleared() { - _spec.ClearField(group.FieldSoraImagePrice540, field.TypeFloat64) - } - if value, ok := _u.mutation.SoraVideoPricePerRequest(); ok { - _spec.SetField(group.FieldSoraVideoPricePerRequest, field.TypeFloat64, value) - } - if value, ok := _u.mutation.AddedSoraVideoPricePerRequest(); ok { - _spec.AddField(group.FieldSoraVideoPricePerRequest, field.TypeFloat64, value) - } - if _u.mutation.SoraVideoPricePerRequestCleared() { - _spec.ClearField(group.FieldSoraVideoPricePerRequest, field.TypeFloat64) - } - if value, ok := _u.mutation.SoraVideoPricePerRequestHd(); ok { - _spec.SetField(group.FieldSoraVideoPricePerRequestHd, field.TypeFloat64, value) - } - if value, ok := _u.mutation.AddedSoraVideoPricePerRequestHd(); ok { - _spec.AddField(group.FieldSoraVideoPricePerRequestHd, field.TypeFloat64, value) - } - if _u.mutation.SoraVideoPricePerRequestHdCleared() { - _spec.ClearField(group.FieldSoraVideoPricePerRequestHd, field.TypeFloat64) - } - if value, ok := _u.mutation.SoraStorageQuotaBytes(); ok { - _spec.SetField(group.FieldSoraStorageQuotaBytes, field.TypeInt64, value) - } - if value, ok := _u.mutation.AddedSoraStorageQuotaBytes(); ok { - _spec.AddField(group.FieldSoraStorageQuotaBytes, field.TypeInt64, value) - } if value, ok := _u.mutation.ClaudeCodeOnly(); ok { _spec.SetField(group.FieldClaudeCodeOnly, field.TypeBool, value) } @@ -1817,135 +1646,6 @@ func (_u *GroupUpdateOne) ClearImagePrice4k() *GroupUpdateOne { return _u } -// SetSoraImagePrice360 sets the "sora_image_price_360" field. -func (_u *GroupUpdateOne) SetSoraImagePrice360(v float64) *GroupUpdateOne { - _u.mutation.ResetSoraImagePrice360() - _u.mutation.SetSoraImagePrice360(v) - return _u -} - -// SetNillableSoraImagePrice360 sets the "sora_image_price_360" field if the given value is not nil. -func (_u *GroupUpdateOne) SetNillableSoraImagePrice360(v *float64) *GroupUpdateOne { - if v != nil { - _u.SetSoraImagePrice360(*v) - } - return _u -} - -// AddSoraImagePrice360 adds value to the "sora_image_price_360" field. -func (_u *GroupUpdateOne) AddSoraImagePrice360(v float64) *GroupUpdateOne { - _u.mutation.AddSoraImagePrice360(v) - return _u -} - -// ClearSoraImagePrice360 clears the value of the "sora_image_price_360" field. -func (_u *GroupUpdateOne) ClearSoraImagePrice360() *GroupUpdateOne { - _u.mutation.ClearSoraImagePrice360() - return _u -} - -// SetSoraImagePrice540 sets the "sora_image_price_540" field. -func (_u *GroupUpdateOne) SetSoraImagePrice540(v float64) *GroupUpdateOne { - _u.mutation.ResetSoraImagePrice540() - _u.mutation.SetSoraImagePrice540(v) - return _u -} - -// SetNillableSoraImagePrice540 sets the "sora_image_price_540" field if the given value is not nil. -func (_u *GroupUpdateOne) SetNillableSoraImagePrice540(v *float64) *GroupUpdateOne { - if v != nil { - _u.SetSoraImagePrice540(*v) - } - return _u -} - -// AddSoraImagePrice540 adds value to the "sora_image_price_540" field. -func (_u *GroupUpdateOne) AddSoraImagePrice540(v float64) *GroupUpdateOne { - _u.mutation.AddSoraImagePrice540(v) - return _u -} - -// ClearSoraImagePrice540 clears the value of the "sora_image_price_540" field. -func (_u *GroupUpdateOne) ClearSoraImagePrice540() *GroupUpdateOne { - _u.mutation.ClearSoraImagePrice540() - return _u -} - -// SetSoraVideoPricePerRequest sets the "sora_video_price_per_request" field. -func (_u *GroupUpdateOne) SetSoraVideoPricePerRequest(v float64) *GroupUpdateOne { - _u.mutation.ResetSoraVideoPricePerRequest() - _u.mutation.SetSoraVideoPricePerRequest(v) - return _u -} - -// SetNillableSoraVideoPricePerRequest sets the "sora_video_price_per_request" field if the given value is not nil. -func (_u *GroupUpdateOne) SetNillableSoraVideoPricePerRequest(v *float64) *GroupUpdateOne { - if v != nil { - _u.SetSoraVideoPricePerRequest(*v) - } - return _u -} - -// AddSoraVideoPricePerRequest adds value to the "sora_video_price_per_request" field. -func (_u *GroupUpdateOne) AddSoraVideoPricePerRequest(v float64) *GroupUpdateOne { - _u.mutation.AddSoraVideoPricePerRequest(v) - return _u -} - -// ClearSoraVideoPricePerRequest clears the value of the "sora_video_price_per_request" field. -func (_u *GroupUpdateOne) ClearSoraVideoPricePerRequest() *GroupUpdateOne { - _u.mutation.ClearSoraVideoPricePerRequest() - return _u -} - -// SetSoraVideoPricePerRequestHd sets the "sora_video_price_per_request_hd" field. -func (_u *GroupUpdateOne) SetSoraVideoPricePerRequestHd(v float64) *GroupUpdateOne { - _u.mutation.ResetSoraVideoPricePerRequestHd() - _u.mutation.SetSoraVideoPricePerRequestHd(v) - return _u -} - -// SetNillableSoraVideoPricePerRequestHd sets the "sora_video_price_per_request_hd" field if the given value is not nil. -func (_u *GroupUpdateOne) SetNillableSoraVideoPricePerRequestHd(v *float64) *GroupUpdateOne { - if v != nil { - _u.SetSoraVideoPricePerRequestHd(*v) - } - return _u -} - -// AddSoraVideoPricePerRequestHd adds value to the "sora_video_price_per_request_hd" field. -func (_u *GroupUpdateOne) AddSoraVideoPricePerRequestHd(v float64) *GroupUpdateOne { - _u.mutation.AddSoraVideoPricePerRequestHd(v) - return _u -} - -// ClearSoraVideoPricePerRequestHd clears the value of the "sora_video_price_per_request_hd" field. -func (_u *GroupUpdateOne) ClearSoraVideoPricePerRequestHd() *GroupUpdateOne { - _u.mutation.ClearSoraVideoPricePerRequestHd() - return _u -} - -// SetSoraStorageQuotaBytes sets the "sora_storage_quota_bytes" field. -func (_u *GroupUpdateOne) SetSoraStorageQuotaBytes(v int64) *GroupUpdateOne { - _u.mutation.ResetSoraStorageQuotaBytes() - _u.mutation.SetSoraStorageQuotaBytes(v) - return _u -} - -// SetNillableSoraStorageQuotaBytes sets the "sora_storage_quota_bytes" field if the given value is not nil. -func (_u *GroupUpdateOne) SetNillableSoraStorageQuotaBytes(v *int64) *GroupUpdateOne { - if v != nil { - _u.SetSoraStorageQuotaBytes(*v) - } - return _u -} - -// AddSoraStorageQuotaBytes adds value to the "sora_storage_quota_bytes" field. -func (_u *GroupUpdateOne) AddSoraStorageQuotaBytes(v int64) *GroupUpdateOne { - _u.mutation.AddSoraStorageQuotaBytes(v) - return _u -} - // SetClaudeCodeOnly sets the "claude_code_only" field. func (_u *GroupUpdateOne) SetClaudeCodeOnly(v bool) *GroupUpdateOne { _u.mutation.SetClaudeCodeOnly(v) @@ -2574,48 +2274,6 @@ func (_u *GroupUpdateOne) sqlSave(ctx context.Context) (_node *Group, err error) if _u.mutation.ImagePrice4kCleared() { _spec.ClearField(group.FieldImagePrice4k, field.TypeFloat64) } - if value, ok := _u.mutation.SoraImagePrice360(); ok { - _spec.SetField(group.FieldSoraImagePrice360, field.TypeFloat64, value) - } - if value, ok := _u.mutation.AddedSoraImagePrice360(); ok { - _spec.AddField(group.FieldSoraImagePrice360, field.TypeFloat64, value) - } - if _u.mutation.SoraImagePrice360Cleared() { - _spec.ClearField(group.FieldSoraImagePrice360, field.TypeFloat64) - } - if value, ok := _u.mutation.SoraImagePrice540(); ok { - _spec.SetField(group.FieldSoraImagePrice540, field.TypeFloat64, value) - } - if value, ok := _u.mutation.AddedSoraImagePrice540(); ok { - _spec.AddField(group.FieldSoraImagePrice540, field.TypeFloat64, value) - } - if _u.mutation.SoraImagePrice540Cleared() { - _spec.ClearField(group.FieldSoraImagePrice540, field.TypeFloat64) - } - if value, ok := _u.mutation.SoraVideoPricePerRequest(); ok { - _spec.SetField(group.FieldSoraVideoPricePerRequest, field.TypeFloat64, value) - } - if value, ok := _u.mutation.AddedSoraVideoPricePerRequest(); ok { - _spec.AddField(group.FieldSoraVideoPricePerRequest, field.TypeFloat64, value) - } - if _u.mutation.SoraVideoPricePerRequestCleared() { - _spec.ClearField(group.FieldSoraVideoPricePerRequest, field.TypeFloat64) - } - if value, ok := _u.mutation.SoraVideoPricePerRequestHd(); ok { - _spec.SetField(group.FieldSoraVideoPricePerRequestHd, field.TypeFloat64, value) - } - if value, ok := _u.mutation.AddedSoraVideoPricePerRequestHd(); ok { - _spec.AddField(group.FieldSoraVideoPricePerRequestHd, field.TypeFloat64, value) - } - if _u.mutation.SoraVideoPricePerRequestHdCleared() { - _spec.ClearField(group.FieldSoraVideoPricePerRequestHd, field.TypeFloat64) - } - if value, ok := _u.mutation.SoraStorageQuotaBytes(); ok { - _spec.SetField(group.FieldSoraStorageQuotaBytes, field.TypeInt64, value) - } - if value, ok := _u.mutation.AddedSoraStorageQuotaBytes(); ok { - _spec.AddField(group.FieldSoraStorageQuotaBytes, field.TypeInt64, value) - } if value, ok := _u.mutation.ClaudeCodeOnly(); ok { _spec.SetField(group.FieldClaudeCodeOnly, field.TypeBool, value) } diff --git a/backend/ent/migrate/schema.go b/backend/ent/migrate/schema.go index bdbb9fdd..5400bf93 100644 --- a/backend/ent/migrate/schema.go +++ b/backend/ent/migrate/schema.go @@ -395,11 +395,6 @@ var ( {Name: "image_price_1k", Type: field.TypeFloat64, Nullable: true, SchemaType: map[string]string{"postgres": "decimal(20,8)"}}, {Name: "image_price_2k", Type: field.TypeFloat64, Nullable: true, SchemaType: map[string]string{"postgres": "decimal(20,8)"}}, {Name: "image_price_4k", Type: field.TypeFloat64, Nullable: true, SchemaType: map[string]string{"postgres": "decimal(20,8)"}}, - {Name: "sora_image_price_360", Type: field.TypeFloat64, Nullable: true, SchemaType: map[string]string{"postgres": "decimal(20,8)"}}, - {Name: "sora_image_price_540", Type: field.TypeFloat64, Nullable: true, SchemaType: map[string]string{"postgres": "decimal(20,8)"}}, - {Name: "sora_video_price_per_request", Type: field.TypeFloat64, Nullable: true, SchemaType: map[string]string{"postgres": "decimal(20,8)"}}, - {Name: "sora_video_price_per_request_hd", Type: field.TypeFloat64, Nullable: true, SchemaType: map[string]string{"postgres": "decimal(20,8)"}}, - {Name: "sora_storage_quota_bytes", Type: field.TypeInt64, Default: 0}, {Name: "claude_code_only", Type: field.TypeBool, Default: false}, {Name: "fallback_group_id", Type: field.TypeInt64, Nullable: true}, {Name: "fallback_group_id_on_invalid_request", Type: field.TypeInt64, Nullable: true}, @@ -447,7 +442,7 @@ var ( { Name: "group_sort_order", Unique: false, - Columns: []*schema.Column{GroupsColumns[30]}, + Columns: []*schema.Column{GroupsColumns[25]}, }, }, } @@ -770,7 +765,6 @@ var ( {Name: "ip_address", Type: field.TypeString, Nullable: true, Size: 45}, {Name: "image_count", Type: field.TypeInt, Default: 0}, {Name: "image_size", Type: field.TypeString, Nullable: true, Size: 10}, - {Name: "media_type", Type: field.TypeString, Nullable: true, Size: 16}, {Name: "cache_ttl_overridden", Type: field.TypeBool, Default: false}, {Name: "created_at", Type: field.TypeTime, SchemaType: map[string]string{"postgres": "timestamptz"}}, {Name: "api_key_id", Type: field.TypeInt64}, @@ -787,31 +781,31 @@ var ( ForeignKeys: []*schema.ForeignKey{ { Symbol: "usage_logs_api_keys_usage_logs", - Columns: []*schema.Column{UsageLogsColumns[34]}, + Columns: []*schema.Column{UsageLogsColumns[33]}, RefColumns: []*schema.Column{APIKeysColumns[0]}, OnDelete: schema.NoAction, }, { Symbol: "usage_logs_accounts_usage_logs", - Columns: []*schema.Column{UsageLogsColumns[35]}, + Columns: []*schema.Column{UsageLogsColumns[34]}, RefColumns: []*schema.Column{AccountsColumns[0]}, OnDelete: schema.NoAction, }, { Symbol: "usage_logs_groups_usage_logs", - Columns: []*schema.Column{UsageLogsColumns[36]}, + Columns: []*schema.Column{UsageLogsColumns[35]}, RefColumns: []*schema.Column{GroupsColumns[0]}, OnDelete: schema.SetNull, }, { Symbol: "usage_logs_users_usage_logs", - Columns: []*schema.Column{UsageLogsColumns[37]}, + Columns: []*schema.Column{UsageLogsColumns[36]}, RefColumns: []*schema.Column{UsersColumns[0]}, OnDelete: schema.NoAction, }, { Symbol: "usage_logs_user_subscriptions_usage_logs", - Columns: []*schema.Column{UsageLogsColumns[38]}, + Columns: []*schema.Column{UsageLogsColumns[37]}, RefColumns: []*schema.Column{UserSubscriptionsColumns[0]}, OnDelete: schema.SetNull, }, @@ -820,32 +814,32 @@ var ( { Name: "usagelog_user_id", Unique: false, - Columns: []*schema.Column{UsageLogsColumns[37]}, + Columns: []*schema.Column{UsageLogsColumns[36]}, }, { Name: "usagelog_api_key_id", Unique: false, - Columns: []*schema.Column{UsageLogsColumns[34]}, + Columns: []*schema.Column{UsageLogsColumns[33]}, }, { Name: "usagelog_account_id", Unique: false, - Columns: []*schema.Column{UsageLogsColumns[35]}, + Columns: []*schema.Column{UsageLogsColumns[34]}, }, { Name: "usagelog_group_id", Unique: false, - Columns: []*schema.Column{UsageLogsColumns[36]}, + Columns: []*schema.Column{UsageLogsColumns[35]}, }, { Name: "usagelog_subscription_id", Unique: false, - Columns: []*schema.Column{UsageLogsColumns[38]}, + Columns: []*schema.Column{UsageLogsColumns[37]}, }, { Name: "usagelog_created_at", Unique: false, - Columns: []*schema.Column{UsageLogsColumns[33]}, + Columns: []*schema.Column{UsageLogsColumns[32]}, }, { Name: "usagelog_model", @@ -865,17 +859,17 @@ var ( { Name: "usagelog_user_id_created_at", Unique: false, - Columns: []*schema.Column{UsageLogsColumns[37], UsageLogsColumns[33]}, + Columns: []*schema.Column{UsageLogsColumns[36], UsageLogsColumns[32]}, }, { Name: "usagelog_api_key_id_created_at", Unique: false, - Columns: []*schema.Column{UsageLogsColumns[34], UsageLogsColumns[33]}, + Columns: []*schema.Column{UsageLogsColumns[33], UsageLogsColumns[32]}, }, { Name: "usagelog_group_id_created_at", Unique: false, - Columns: []*schema.Column{UsageLogsColumns[36], UsageLogsColumns[33]}, + Columns: []*schema.Column{UsageLogsColumns[35], UsageLogsColumns[32]}, }, }, } @@ -896,8 +890,6 @@ var ( {Name: "totp_secret_encrypted", Type: field.TypeString, Nullable: true, SchemaType: map[string]string{"postgres": "text"}}, {Name: "totp_enabled", Type: field.TypeBool, Default: false}, {Name: "totp_enabled_at", Type: field.TypeTime, Nullable: true}, - {Name: "sora_storage_quota_bytes", Type: field.TypeInt64, Default: 0}, - {Name: "sora_storage_used_bytes", Type: field.TypeInt64, Default: 0}, } // UsersTable holds the schema information for the "users" table. UsersTable = &schema.Table{ diff --git a/backend/ent/mutation.go b/backend/ent/mutation.go index 28d9a0ef..d206039a 100644 --- a/backend/ent/mutation.go +++ b/backend/ent/mutation.go @@ -8230,16 +8230,6 @@ type GroupMutation struct { addimage_price_2k *float64 image_price_4k *float64 addimage_price_4k *float64 - sora_image_price_360 *float64 - addsora_image_price_360 *float64 - sora_image_price_540 *float64 - addsora_image_price_540 *float64 - sora_video_price_per_request *float64 - addsora_video_price_per_request *float64 - sora_video_price_per_request_hd *float64 - addsora_video_price_per_request_hd *float64 - sora_storage_quota_bytes *int64 - addsora_storage_quota_bytes *int64 claude_code_only *bool fallback_group_id *int64 addfallback_group_id *int64 @@ -9260,342 +9250,6 @@ func (m *GroupMutation) ResetImagePrice4k() { delete(m.clearedFields, group.FieldImagePrice4k) } -// SetSoraImagePrice360 sets the "sora_image_price_360" field. -func (m *GroupMutation) SetSoraImagePrice360(f float64) { - m.sora_image_price_360 = &f - m.addsora_image_price_360 = nil -} - -// SoraImagePrice360 returns the value of the "sora_image_price_360" field in the mutation. -func (m *GroupMutation) SoraImagePrice360() (r float64, exists bool) { - v := m.sora_image_price_360 - if v == nil { - return - } - return *v, true -} - -// OldSoraImagePrice360 returns the old "sora_image_price_360" field's value of the Group entity. -// If the Group object wasn't provided to the builder, the object is fetched from the database. -// An error is returned if the mutation operation is not UpdateOne, or the database query fails. -func (m *GroupMutation) OldSoraImagePrice360(ctx context.Context) (v *float64, err error) { - if !m.op.Is(OpUpdateOne) { - return v, errors.New("OldSoraImagePrice360 is only allowed on UpdateOne operations") - } - if m.id == nil || m.oldValue == nil { - return v, errors.New("OldSoraImagePrice360 requires an ID field in the mutation") - } - oldValue, err := m.oldValue(ctx) - if err != nil { - return v, fmt.Errorf("querying old value for OldSoraImagePrice360: %w", err) - } - return oldValue.SoraImagePrice360, nil -} - -// AddSoraImagePrice360 adds f to the "sora_image_price_360" field. -func (m *GroupMutation) AddSoraImagePrice360(f float64) { - if m.addsora_image_price_360 != nil { - *m.addsora_image_price_360 += f - } else { - m.addsora_image_price_360 = &f - } -} - -// AddedSoraImagePrice360 returns the value that was added to the "sora_image_price_360" field in this mutation. -func (m *GroupMutation) AddedSoraImagePrice360() (r float64, exists bool) { - v := m.addsora_image_price_360 - if v == nil { - return - } - return *v, true -} - -// ClearSoraImagePrice360 clears the value of the "sora_image_price_360" field. -func (m *GroupMutation) ClearSoraImagePrice360() { - m.sora_image_price_360 = nil - m.addsora_image_price_360 = nil - m.clearedFields[group.FieldSoraImagePrice360] = struct{}{} -} - -// SoraImagePrice360Cleared returns if the "sora_image_price_360" field was cleared in this mutation. -func (m *GroupMutation) SoraImagePrice360Cleared() bool { - _, ok := m.clearedFields[group.FieldSoraImagePrice360] - return ok -} - -// ResetSoraImagePrice360 resets all changes to the "sora_image_price_360" field. -func (m *GroupMutation) ResetSoraImagePrice360() { - m.sora_image_price_360 = nil - m.addsora_image_price_360 = nil - delete(m.clearedFields, group.FieldSoraImagePrice360) -} - -// SetSoraImagePrice540 sets the "sora_image_price_540" field. -func (m *GroupMutation) SetSoraImagePrice540(f float64) { - m.sora_image_price_540 = &f - m.addsora_image_price_540 = nil -} - -// SoraImagePrice540 returns the value of the "sora_image_price_540" field in the mutation. -func (m *GroupMutation) SoraImagePrice540() (r float64, exists bool) { - v := m.sora_image_price_540 - if v == nil { - return - } - return *v, true -} - -// OldSoraImagePrice540 returns the old "sora_image_price_540" field's value of the Group entity. -// If the Group object wasn't provided to the builder, the object is fetched from the database. -// An error is returned if the mutation operation is not UpdateOne, or the database query fails. -func (m *GroupMutation) OldSoraImagePrice540(ctx context.Context) (v *float64, err error) { - if !m.op.Is(OpUpdateOne) { - return v, errors.New("OldSoraImagePrice540 is only allowed on UpdateOne operations") - } - if m.id == nil || m.oldValue == nil { - return v, errors.New("OldSoraImagePrice540 requires an ID field in the mutation") - } - oldValue, err := m.oldValue(ctx) - if err != nil { - return v, fmt.Errorf("querying old value for OldSoraImagePrice540: %w", err) - } - return oldValue.SoraImagePrice540, nil -} - -// AddSoraImagePrice540 adds f to the "sora_image_price_540" field. -func (m *GroupMutation) AddSoraImagePrice540(f float64) { - if m.addsora_image_price_540 != nil { - *m.addsora_image_price_540 += f - } else { - m.addsora_image_price_540 = &f - } -} - -// AddedSoraImagePrice540 returns the value that was added to the "sora_image_price_540" field in this mutation. -func (m *GroupMutation) AddedSoraImagePrice540() (r float64, exists bool) { - v := m.addsora_image_price_540 - if v == nil { - return - } - return *v, true -} - -// ClearSoraImagePrice540 clears the value of the "sora_image_price_540" field. -func (m *GroupMutation) ClearSoraImagePrice540() { - m.sora_image_price_540 = nil - m.addsora_image_price_540 = nil - m.clearedFields[group.FieldSoraImagePrice540] = struct{}{} -} - -// SoraImagePrice540Cleared returns if the "sora_image_price_540" field was cleared in this mutation. -func (m *GroupMutation) SoraImagePrice540Cleared() bool { - _, ok := m.clearedFields[group.FieldSoraImagePrice540] - return ok -} - -// ResetSoraImagePrice540 resets all changes to the "sora_image_price_540" field. -func (m *GroupMutation) ResetSoraImagePrice540() { - m.sora_image_price_540 = nil - m.addsora_image_price_540 = nil - delete(m.clearedFields, group.FieldSoraImagePrice540) -} - -// SetSoraVideoPricePerRequest sets the "sora_video_price_per_request" field. -func (m *GroupMutation) SetSoraVideoPricePerRequest(f float64) { - m.sora_video_price_per_request = &f - m.addsora_video_price_per_request = nil -} - -// SoraVideoPricePerRequest returns the value of the "sora_video_price_per_request" field in the mutation. -func (m *GroupMutation) SoraVideoPricePerRequest() (r float64, exists bool) { - v := m.sora_video_price_per_request - if v == nil { - return - } - return *v, true -} - -// OldSoraVideoPricePerRequest returns the old "sora_video_price_per_request" field's value of the Group entity. -// If the Group object wasn't provided to the builder, the object is fetched from the database. -// An error is returned if the mutation operation is not UpdateOne, or the database query fails. -func (m *GroupMutation) OldSoraVideoPricePerRequest(ctx context.Context) (v *float64, err error) { - if !m.op.Is(OpUpdateOne) { - return v, errors.New("OldSoraVideoPricePerRequest is only allowed on UpdateOne operations") - } - if m.id == nil || m.oldValue == nil { - return v, errors.New("OldSoraVideoPricePerRequest requires an ID field in the mutation") - } - oldValue, err := m.oldValue(ctx) - if err != nil { - return v, fmt.Errorf("querying old value for OldSoraVideoPricePerRequest: %w", err) - } - return oldValue.SoraVideoPricePerRequest, nil -} - -// AddSoraVideoPricePerRequest adds f to the "sora_video_price_per_request" field. -func (m *GroupMutation) AddSoraVideoPricePerRequest(f float64) { - if m.addsora_video_price_per_request != nil { - *m.addsora_video_price_per_request += f - } else { - m.addsora_video_price_per_request = &f - } -} - -// AddedSoraVideoPricePerRequest returns the value that was added to the "sora_video_price_per_request" field in this mutation. -func (m *GroupMutation) AddedSoraVideoPricePerRequest() (r float64, exists bool) { - v := m.addsora_video_price_per_request - if v == nil { - return - } - return *v, true -} - -// ClearSoraVideoPricePerRequest clears the value of the "sora_video_price_per_request" field. -func (m *GroupMutation) ClearSoraVideoPricePerRequest() { - m.sora_video_price_per_request = nil - m.addsora_video_price_per_request = nil - m.clearedFields[group.FieldSoraVideoPricePerRequest] = struct{}{} -} - -// SoraVideoPricePerRequestCleared returns if the "sora_video_price_per_request" field was cleared in this mutation. -func (m *GroupMutation) SoraVideoPricePerRequestCleared() bool { - _, ok := m.clearedFields[group.FieldSoraVideoPricePerRequest] - return ok -} - -// ResetSoraVideoPricePerRequest resets all changes to the "sora_video_price_per_request" field. -func (m *GroupMutation) ResetSoraVideoPricePerRequest() { - m.sora_video_price_per_request = nil - m.addsora_video_price_per_request = nil - delete(m.clearedFields, group.FieldSoraVideoPricePerRequest) -} - -// SetSoraVideoPricePerRequestHd sets the "sora_video_price_per_request_hd" field. -func (m *GroupMutation) SetSoraVideoPricePerRequestHd(f float64) { - m.sora_video_price_per_request_hd = &f - m.addsora_video_price_per_request_hd = nil -} - -// SoraVideoPricePerRequestHd returns the value of the "sora_video_price_per_request_hd" field in the mutation. -func (m *GroupMutation) SoraVideoPricePerRequestHd() (r float64, exists bool) { - v := m.sora_video_price_per_request_hd - if v == nil { - return - } - return *v, true -} - -// OldSoraVideoPricePerRequestHd returns the old "sora_video_price_per_request_hd" field's value of the Group entity. -// If the Group object wasn't provided to the builder, the object is fetched from the database. -// An error is returned if the mutation operation is not UpdateOne, or the database query fails. -func (m *GroupMutation) OldSoraVideoPricePerRequestHd(ctx context.Context) (v *float64, err error) { - if !m.op.Is(OpUpdateOne) { - return v, errors.New("OldSoraVideoPricePerRequestHd is only allowed on UpdateOne operations") - } - if m.id == nil || m.oldValue == nil { - return v, errors.New("OldSoraVideoPricePerRequestHd requires an ID field in the mutation") - } - oldValue, err := m.oldValue(ctx) - if err != nil { - return v, fmt.Errorf("querying old value for OldSoraVideoPricePerRequestHd: %w", err) - } - return oldValue.SoraVideoPricePerRequestHd, nil -} - -// AddSoraVideoPricePerRequestHd adds f to the "sora_video_price_per_request_hd" field. -func (m *GroupMutation) AddSoraVideoPricePerRequestHd(f float64) { - if m.addsora_video_price_per_request_hd != nil { - *m.addsora_video_price_per_request_hd += f - } else { - m.addsora_video_price_per_request_hd = &f - } -} - -// AddedSoraVideoPricePerRequestHd returns the value that was added to the "sora_video_price_per_request_hd" field in this mutation. -func (m *GroupMutation) AddedSoraVideoPricePerRequestHd() (r float64, exists bool) { - v := m.addsora_video_price_per_request_hd - if v == nil { - return - } - return *v, true -} - -// ClearSoraVideoPricePerRequestHd clears the value of the "sora_video_price_per_request_hd" field. -func (m *GroupMutation) ClearSoraVideoPricePerRequestHd() { - m.sora_video_price_per_request_hd = nil - m.addsora_video_price_per_request_hd = nil - m.clearedFields[group.FieldSoraVideoPricePerRequestHd] = struct{}{} -} - -// SoraVideoPricePerRequestHdCleared returns if the "sora_video_price_per_request_hd" field was cleared in this mutation. -func (m *GroupMutation) SoraVideoPricePerRequestHdCleared() bool { - _, ok := m.clearedFields[group.FieldSoraVideoPricePerRequestHd] - return ok -} - -// ResetSoraVideoPricePerRequestHd resets all changes to the "sora_video_price_per_request_hd" field. -func (m *GroupMutation) ResetSoraVideoPricePerRequestHd() { - m.sora_video_price_per_request_hd = nil - m.addsora_video_price_per_request_hd = nil - delete(m.clearedFields, group.FieldSoraVideoPricePerRequestHd) -} - -// SetSoraStorageQuotaBytes sets the "sora_storage_quota_bytes" field. -func (m *GroupMutation) SetSoraStorageQuotaBytes(i int64) { - m.sora_storage_quota_bytes = &i - m.addsora_storage_quota_bytes = nil -} - -// SoraStorageQuotaBytes returns the value of the "sora_storage_quota_bytes" field in the mutation. -func (m *GroupMutation) SoraStorageQuotaBytes() (r int64, exists bool) { - v := m.sora_storage_quota_bytes - if v == nil { - return - } - return *v, true -} - -// OldSoraStorageQuotaBytes returns the old "sora_storage_quota_bytes" field's value of the Group entity. -// If the Group object wasn't provided to the builder, the object is fetched from the database. -// An error is returned if the mutation operation is not UpdateOne, or the database query fails. -func (m *GroupMutation) OldSoraStorageQuotaBytes(ctx context.Context) (v int64, err error) { - if !m.op.Is(OpUpdateOne) { - return v, errors.New("OldSoraStorageQuotaBytes is only allowed on UpdateOne operations") - } - if m.id == nil || m.oldValue == nil { - return v, errors.New("OldSoraStorageQuotaBytes requires an ID field in the mutation") - } - oldValue, err := m.oldValue(ctx) - if err != nil { - return v, fmt.Errorf("querying old value for OldSoraStorageQuotaBytes: %w", err) - } - return oldValue.SoraStorageQuotaBytes, nil -} - -// AddSoraStorageQuotaBytes adds i to the "sora_storage_quota_bytes" field. -func (m *GroupMutation) AddSoraStorageQuotaBytes(i int64) { - if m.addsora_storage_quota_bytes != nil { - *m.addsora_storage_quota_bytes += i - } else { - m.addsora_storage_quota_bytes = &i - } -} - -// AddedSoraStorageQuotaBytes returns the value that was added to the "sora_storage_quota_bytes" field in this mutation. -func (m *GroupMutation) AddedSoraStorageQuotaBytes() (r int64, exists bool) { - v := m.addsora_storage_quota_bytes - if v == nil { - return - } - return *v, true -} - -// ResetSoraStorageQuotaBytes resets all changes to the "sora_storage_quota_bytes" field. -func (m *GroupMutation) ResetSoraStorageQuotaBytes() { - m.sora_storage_quota_bytes = nil - m.addsora_storage_quota_bytes = nil -} - // SetClaudeCodeOnly sets the "claude_code_only" field. func (m *GroupMutation) SetClaudeCodeOnly(b bool) { m.claude_code_only = &b @@ -10502,7 +10156,7 @@ func (m *GroupMutation) Type() string { // order to get all numeric fields that were incremented/decremented, call // AddedFields(). func (m *GroupMutation) Fields() []string { - fields := make([]string, 0, 34) + fields := make([]string, 0, 29) if m.created_at != nil { fields = append(fields, group.FieldCreatedAt) } @@ -10554,21 +10208,6 @@ func (m *GroupMutation) Fields() []string { if m.image_price_4k != nil { fields = append(fields, group.FieldImagePrice4k) } - if m.sora_image_price_360 != nil { - fields = append(fields, group.FieldSoraImagePrice360) - } - if m.sora_image_price_540 != nil { - fields = append(fields, group.FieldSoraImagePrice540) - } - if m.sora_video_price_per_request != nil { - fields = append(fields, group.FieldSoraVideoPricePerRequest) - } - if m.sora_video_price_per_request_hd != nil { - fields = append(fields, group.FieldSoraVideoPricePerRequestHd) - } - if m.sora_storage_quota_bytes != nil { - fields = append(fields, group.FieldSoraStorageQuotaBytes) - } if m.claude_code_only != nil { fields = append(fields, group.FieldClaudeCodeOnly) } @@ -10647,16 +10286,6 @@ func (m *GroupMutation) Field(name string) (ent.Value, bool) { return m.ImagePrice2k() case group.FieldImagePrice4k: return m.ImagePrice4k() - case group.FieldSoraImagePrice360: - return m.SoraImagePrice360() - case group.FieldSoraImagePrice540: - return m.SoraImagePrice540() - case group.FieldSoraVideoPricePerRequest: - return m.SoraVideoPricePerRequest() - case group.FieldSoraVideoPricePerRequestHd: - return m.SoraVideoPricePerRequestHd() - case group.FieldSoraStorageQuotaBytes: - return m.SoraStorageQuotaBytes() case group.FieldClaudeCodeOnly: return m.ClaudeCodeOnly() case group.FieldFallbackGroupID: @@ -10724,16 +10353,6 @@ func (m *GroupMutation) OldField(ctx context.Context, name string) (ent.Value, e return m.OldImagePrice2k(ctx) case group.FieldImagePrice4k: return m.OldImagePrice4k(ctx) - case group.FieldSoraImagePrice360: - return m.OldSoraImagePrice360(ctx) - case group.FieldSoraImagePrice540: - return m.OldSoraImagePrice540(ctx) - case group.FieldSoraVideoPricePerRequest: - return m.OldSoraVideoPricePerRequest(ctx) - case group.FieldSoraVideoPricePerRequestHd: - return m.OldSoraVideoPricePerRequestHd(ctx) - case group.FieldSoraStorageQuotaBytes: - return m.OldSoraStorageQuotaBytes(ctx) case group.FieldClaudeCodeOnly: return m.OldClaudeCodeOnly(ctx) case group.FieldFallbackGroupID: @@ -10886,41 +10505,6 @@ func (m *GroupMutation) SetField(name string, value ent.Value) error { } m.SetImagePrice4k(v) return nil - case group.FieldSoraImagePrice360: - v, ok := value.(float64) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.SetSoraImagePrice360(v) - return nil - case group.FieldSoraImagePrice540: - v, ok := value.(float64) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.SetSoraImagePrice540(v) - return nil - case group.FieldSoraVideoPricePerRequest: - v, ok := value.(float64) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.SetSoraVideoPricePerRequest(v) - return nil - case group.FieldSoraVideoPricePerRequestHd: - v, ok := value.(float64) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.SetSoraVideoPricePerRequestHd(v) - return nil - case group.FieldSoraStorageQuotaBytes: - v, ok := value.(int64) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.SetSoraStorageQuotaBytes(v) - return nil case group.FieldClaudeCodeOnly: v, ok := value.(bool) if !ok { @@ -11037,21 +10621,6 @@ func (m *GroupMutation) AddedFields() []string { if m.addimage_price_4k != nil { fields = append(fields, group.FieldImagePrice4k) } - if m.addsora_image_price_360 != nil { - fields = append(fields, group.FieldSoraImagePrice360) - } - if m.addsora_image_price_540 != nil { - fields = append(fields, group.FieldSoraImagePrice540) - } - if m.addsora_video_price_per_request != nil { - fields = append(fields, group.FieldSoraVideoPricePerRequest) - } - if m.addsora_video_price_per_request_hd != nil { - fields = append(fields, group.FieldSoraVideoPricePerRequestHd) - } - if m.addsora_storage_quota_bytes != nil { - fields = append(fields, group.FieldSoraStorageQuotaBytes) - } if m.addfallback_group_id != nil { fields = append(fields, group.FieldFallbackGroupID) } @@ -11085,16 +10654,6 @@ func (m *GroupMutation) AddedField(name string) (ent.Value, bool) { return m.AddedImagePrice2k() case group.FieldImagePrice4k: return m.AddedImagePrice4k() - case group.FieldSoraImagePrice360: - return m.AddedSoraImagePrice360() - case group.FieldSoraImagePrice540: - return m.AddedSoraImagePrice540() - case group.FieldSoraVideoPricePerRequest: - return m.AddedSoraVideoPricePerRequest() - case group.FieldSoraVideoPricePerRequestHd: - return m.AddedSoraVideoPricePerRequestHd() - case group.FieldSoraStorageQuotaBytes: - return m.AddedSoraStorageQuotaBytes() case group.FieldFallbackGroupID: return m.AddedFallbackGroupID() case group.FieldFallbackGroupIDOnInvalidRequest: @@ -11166,41 +10725,6 @@ func (m *GroupMutation) AddField(name string, value ent.Value) error { } m.AddImagePrice4k(v) return nil - case group.FieldSoraImagePrice360: - v, ok := value.(float64) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.AddSoraImagePrice360(v) - return nil - case group.FieldSoraImagePrice540: - v, ok := value.(float64) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.AddSoraImagePrice540(v) - return nil - case group.FieldSoraVideoPricePerRequest: - v, ok := value.(float64) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.AddSoraVideoPricePerRequest(v) - return nil - case group.FieldSoraVideoPricePerRequestHd: - v, ok := value.(float64) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.AddSoraVideoPricePerRequestHd(v) - return nil - case group.FieldSoraStorageQuotaBytes: - v, ok := value.(int64) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.AddSoraStorageQuotaBytes(v) - return nil case group.FieldFallbackGroupID: v, ok := value.(int64) if !ok { @@ -11254,18 +10778,6 @@ func (m *GroupMutation) ClearedFields() []string { if m.FieldCleared(group.FieldImagePrice4k) { fields = append(fields, group.FieldImagePrice4k) } - if m.FieldCleared(group.FieldSoraImagePrice360) { - fields = append(fields, group.FieldSoraImagePrice360) - } - if m.FieldCleared(group.FieldSoraImagePrice540) { - fields = append(fields, group.FieldSoraImagePrice540) - } - if m.FieldCleared(group.FieldSoraVideoPricePerRequest) { - fields = append(fields, group.FieldSoraVideoPricePerRequest) - } - if m.FieldCleared(group.FieldSoraVideoPricePerRequestHd) { - fields = append(fields, group.FieldSoraVideoPricePerRequestHd) - } if m.FieldCleared(group.FieldFallbackGroupID) { fields = append(fields, group.FieldFallbackGroupID) } @@ -11313,18 +10825,6 @@ func (m *GroupMutation) ClearField(name string) error { case group.FieldImagePrice4k: m.ClearImagePrice4k() return nil - case group.FieldSoraImagePrice360: - m.ClearSoraImagePrice360() - return nil - case group.FieldSoraImagePrice540: - m.ClearSoraImagePrice540() - return nil - case group.FieldSoraVideoPricePerRequest: - m.ClearSoraVideoPricePerRequest() - return nil - case group.FieldSoraVideoPricePerRequestHd: - m.ClearSoraVideoPricePerRequestHd() - return nil case group.FieldFallbackGroupID: m.ClearFallbackGroupID() return nil @@ -11393,21 +10893,6 @@ func (m *GroupMutation) ResetField(name string) error { case group.FieldImagePrice4k: m.ResetImagePrice4k() return nil - case group.FieldSoraImagePrice360: - m.ResetSoraImagePrice360() - return nil - case group.FieldSoraImagePrice540: - m.ResetSoraImagePrice540() - return nil - case group.FieldSoraVideoPricePerRequest: - m.ResetSoraVideoPricePerRequest() - return nil - case group.FieldSoraVideoPricePerRequestHd: - m.ResetSoraVideoPricePerRequestHd() - return nil - case group.FieldSoraStorageQuotaBytes: - m.ResetSoraStorageQuotaBytes() - return nil case group.FieldClaudeCodeOnly: m.ResetClaudeCodeOnly() return nil @@ -19770,7 +19255,6 @@ type UsageLogMutation struct { image_count *int addimage_count *int image_size *string - media_type *string cache_ttl_overridden *bool created_at *time.Time clearedFields map[string]struct{} @@ -21713,55 +21197,6 @@ func (m *UsageLogMutation) ResetImageSize() { delete(m.clearedFields, usagelog.FieldImageSize) } -// SetMediaType sets the "media_type" field. -func (m *UsageLogMutation) SetMediaType(s string) { - m.media_type = &s -} - -// MediaType returns the value of the "media_type" field in the mutation. -func (m *UsageLogMutation) MediaType() (r string, exists bool) { - v := m.media_type - if v == nil { - return - } - return *v, true -} - -// OldMediaType returns the old "media_type" field's value of the UsageLog entity. -// If the UsageLog object wasn't provided to the builder, the object is fetched from the database. -// An error is returned if the mutation operation is not UpdateOne, or the database query fails. -func (m *UsageLogMutation) OldMediaType(ctx context.Context) (v *string, err error) { - if !m.op.Is(OpUpdateOne) { - return v, errors.New("OldMediaType is only allowed on UpdateOne operations") - } - if m.id == nil || m.oldValue == nil { - return v, errors.New("OldMediaType requires an ID field in the mutation") - } - oldValue, err := m.oldValue(ctx) - if err != nil { - return v, fmt.Errorf("querying old value for OldMediaType: %w", err) - } - return oldValue.MediaType, nil -} - -// ClearMediaType clears the value of the "media_type" field. -func (m *UsageLogMutation) ClearMediaType() { - m.media_type = nil - m.clearedFields[usagelog.FieldMediaType] = struct{}{} -} - -// MediaTypeCleared returns if the "media_type" field was cleared in this mutation. -func (m *UsageLogMutation) MediaTypeCleared() bool { - _, ok := m.clearedFields[usagelog.FieldMediaType] - return ok -} - -// ResetMediaType resets all changes to the "media_type" field. -func (m *UsageLogMutation) ResetMediaType() { - m.media_type = nil - delete(m.clearedFields, usagelog.FieldMediaType) -} - // SetCacheTTLOverridden sets the "cache_ttl_overridden" field. func (m *UsageLogMutation) SetCacheTTLOverridden(b bool) { m.cache_ttl_overridden = &b @@ -22003,7 +21438,7 @@ func (m *UsageLogMutation) Type() string { // order to get all numeric fields that were incremented/decremented, call // AddedFields(). func (m *UsageLogMutation) Fields() []string { - fields := make([]string, 0, 38) + fields := make([]string, 0, 37) if m.user != nil { fields = append(fields, usagelog.FieldUserID) } @@ -22109,9 +21544,6 @@ func (m *UsageLogMutation) Fields() []string { if m.image_size != nil { fields = append(fields, usagelog.FieldImageSize) } - if m.media_type != nil { - fields = append(fields, usagelog.FieldMediaType) - } if m.cache_ttl_overridden != nil { fields = append(fields, usagelog.FieldCacheTTLOverridden) } @@ -22196,8 +21628,6 @@ func (m *UsageLogMutation) Field(name string) (ent.Value, bool) { return m.ImageCount() case usagelog.FieldImageSize: return m.ImageSize() - case usagelog.FieldMediaType: - return m.MediaType() case usagelog.FieldCacheTTLOverridden: return m.CacheTTLOverridden() case usagelog.FieldCreatedAt: @@ -22281,8 +21711,6 @@ func (m *UsageLogMutation) OldField(ctx context.Context, name string) (ent.Value return m.OldImageCount(ctx) case usagelog.FieldImageSize: return m.OldImageSize(ctx) - case usagelog.FieldMediaType: - return m.OldMediaType(ctx) case usagelog.FieldCacheTTLOverridden: return m.OldCacheTTLOverridden(ctx) case usagelog.FieldCreatedAt: @@ -22541,13 +21969,6 @@ func (m *UsageLogMutation) SetField(name string, value ent.Value) error { } m.SetImageSize(v) return nil - case usagelog.FieldMediaType: - v, ok := value.(string) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.SetMediaType(v) - return nil case usagelog.FieldCacheTTLOverridden: v, ok := value.(bool) if !ok { @@ -22865,9 +22286,6 @@ func (m *UsageLogMutation) ClearedFields() []string { if m.FieldCleared(usagelog.FieldImageSize) { fields = append(fields, usagelog.FieldImageSize) } - if m.FieldCleared(usagelog.FieldMediaType) { - fields = append(fields, usagelog.FieldMediaType) - } return fields } @@ -22924,9 +22342,6 @@ func (m *UsageLogMutation) ClearField(name string) error { case usagelog.FieldImageSize: m.ClearImageSize() return nil - case usagelog.FieldMediaType: - m.ClearMediaType() - return nil } return fmt.Errorf("unknown UsageLog nullable field %s", name) } @@ -23040,9 +22455,6 @@ func (m *UsageLogMutation) ResetField(name string) error { case usagelog.FieldImageSize: m.ResetImageSize() return nil - case usagelog.FieldMediaType: - m.ResetMediaType() - return nil case usagelog.FieldCacheTTLOverridden: m.ResetCacheTTLOverridden() return nil @@ -23221,10 +22633,6 @@ type UserMutation struct { totp_secret_encrypted *string totp_enabled *bool totp_enabled_at *time.Time - sora_storage_quota_bytes *int64 - addsora_storage_quota_bytes *int64 - sora_storage_used_bytes *int64 - addsora_storage_used_bytes *int64 clearedFields map[string]struct{} api_keys map[int64]struct{} removedapi_keys map[int64]struct{} @@ -23939,118 +23347,6 @@ func (m *UserMutation) ResetTotpEnabledAt() { delete(m.clearedFields, user.FieldTotpEnabledAt) } -// SetSoraStorageQuotaBytes sets the "sora_storage_quota_bytes" field. -func (m *UserMutation) SetSoraStorageQuotaBytes(i int64) { - m.sora_storage_quota_bytes = &i - m.addsora_storage_quota_bytes = nil -} - -// SoraStorageQuotaBytes returns the value of the "sora_storage_quota_bytes" field in the mutation. -func (m *UserMutation) SoraStorageQuotaBytes() (r int64, exists bool) { - v := m.sora_storage_quota_bytes - if v == nil { - return - } - return *v, true -} - -// OldSoraStorageQuotaBytes returns the old "sora_storage_quota_bytes" field's value of the User entity. -// If the User object wasn't provided to the builder, the object is fetched from the database. -// An error is returned if the mutation operation is not UpdateOne, or the database query fails. -func (m *UserMutation) OldSoraStorageQuotaBytes(ctx context.Context) (v int64, err error) { - if !m.op.Is(OpUpdateOne) { - return v, errors.New("OldSoraStorageQuotaBytes is only allowed on UpdateOne operations") - } - if m.id == nil || m.oldValue == nil { - return v, errors.New("OldSoraStorageQuotaBytes requires an ID field in the mutation") - } - oldValue, err := m.oldValue(ctx) - if err != nil { - return v, fmt.Errorf("querying old value for OldSoraStorageQuotaBytes: %w", err) - } - return oldValue.SoraStorageQuotaBytes, nil -} - -// AddSoraStorageQuotaBytes adds i to the "sora_storage_quota_bytes" field. -func (m *UserMutation) AddSoraStorageQuotaBytes(i int64) { - if m.addsora_storage_quota_bytes != nil { - *m.addsora_storage_quota_bytes += i - } else { - m.addsora_storage_quota_bytes = &i - } -} - -// AddedSoraStorageQuotaBytes returns the value that was added to the "sora_storage_quota_bytes" field in this mutation. -func (m *UserMutation) AddedSoraStorageQuotaBytes() (r int64, exists bool) { - v := m.addsora_storage_quota_bytes - if v == nil { - return - } - return *v, true -} - -// ResetSoraStorageQuotaBytes resets all changes to the "sora_storage_quota_bytes" field. -func (m *UserMutation) ResetSoraStorageQuotaBytes() { - m.sora_storage_quota_bytes = nil - m.addsora_storage_quota_bytes = nil -} - -// SetSoraStorageUsedBytes sets the "sora_storage_used_bytes" field. -func (m *UserMutation) SetSoraStorageUsedBytes(i int64) { - m.sora_storage_used_bytes = &i - m.addsora_storage_used_bytes = nil -} - -// SoraStorageUsedBytes returns the value of the "sora_storage_used_bytes" field in the mutation. -func (m *UserMutation) SoraStorageUsedBytes() (r int64, exists bool) { - v := m.sora_storage_used_bytes - if v == nil { - return - } - return *v, true -} - -// OldSoraStorageUsedBytes returns the old "sora_storage_used_bytes" field's value of the User entity. -// If the User object wasn't provided to the builder, the object is fetched from the database. -// An error is returned if the mutation operation is not UpdateOne, or the database query fails. -func (m *UserMutation) OldSoraStorageUsedBytes(ctx context.Context) (v int64, err error) { - if !m.op.Is(OpUpdateOne) { - return v, errors.New("OldSoraStorageUsedBytes is only allowed on UpdateOne operations") - } - if m.id == nil || m.oldValue == nil { - return v, errors.New("OldSoraStorageUsedBytes requires an ID field in the mutation") - } - oldValue, err := m.oldValue(ctx) - if err != nil { - return v, fmt.Errorf("querying old value for OldSoraStorageUsedBytes: %w", err) - } - return oldValue.SoraStorageUsedBytes, nil -} - -// AddSoraStorageUsedBytes adds i to the "sora_storage_used_bytes" field. -func (m *UserMutation) AddSoraStorageUsedBytes(i int64) { - if m.addsora_storage_used_bytes != nil { - *m.addsora_storage_used_bytes += i - } else { - m.addsora_storage_used_bytes = &i - } -} - -// AddedSoraStorageUsedBytes returns the value that was added to the "sora_storage_used_bytes" field in this mutation. -func (m *UserMutation) AddedSoraStorageUsedBytes() (r int64, exists bool) { - v := m.addsora_storage_used_bytes - if v == nil { - return - } - return *v, true -} - -// ResetSoraStorageUsedBytes resets all changes to the "sora_storage_used_bytes" field. -func (m *UserMutation) ResetSoraStorageUsedBytes() { - m.sora_storage_used_bytes = nil - m.addsora_storage_used_bytes = nil -} - // AddAPIKeyIDs adds the "api_keys" edge to the APIKey entity by ids. func (m *UserMutation) AddAPIKeyIDs(ids ...int64) { if m.api_keys == nil { @@ -24571,7 +23867,7 @@ func (m *UserMutation) Type() string { // order to get all numeric fields that were incremented/decremented, call // AddedFields(). func (m *UserMutation) Fields() []string { - fields := make([]string, 0, 16) + fields := make([]string, 0, 14) if m.created_at != nil { fields = append(fields, user.FieldCreatedAt) } @@ -24614,12 +23910,6 @@ func (m *UserMutation) Fields() []string { if m.totp_enabled_at != nil { fields = append(fields, user.FieldTotpEnabledAt) } - if m.sora_storage_quota_bytes != nil { - fields = append(fields, user.FieldSoraStorageQuotaBytes) - } - if m.sora_storage_used_bytes != nil { - fields = append(fields, user.FieldSoraStorageUsedBytes) - } return fields } @@ -24656,10 +23946,6 @@ func (m *UserMutation) Field(name string) (ent.Value, bool) { return m.TotpEnabled() case user.FieldTotpEnabledAt: return m.TotpEnabledAt() - case user.FieldSoraStorageQuotaBytes: - return m.SoraStorageQuotaBytes() - case user.FieldSoraStorageUsedBytes: - return m.SoraStorageUsedBytes() } return nil, false } @@ -24697,10 +23983,6 @@ func (m *UserMutation) OldField(ctx context.Context, name string) (ent.Value, er return m.OldTotpEnabled(ctx) case user.FieldTotpEnabledAt: return m.OldTotpEnabledAt(ctx) - case user.FieldSoraStorageQuotaBytes: - return m.OldSoraStorageQuotaBytes(ctx) - case user.FieldSoraStorageUsedBytes: - return m.OldSoraStorageUsedBytes(ctx) } return nil, fmt.Errorf("unknown User field %s", name) } @@ -24808,20 +24090,6 @@ func (m *UserMutation) SetField(name string, value ent.Value) error { } m.SetTotpEnabledAt(v) return nil - case user.FieldSoraStorageQuotaBytes: - v, ok := value.(int64) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.SetSoraStorageQuotaBytes(v) - return nil - case user.FieldSoraStorageUsedBytes: - v, ok := value.(int64) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.SetSoraStorageUsedBytes(v) - return nil } return fmt.Errorf("unknown User field %s", name) } @@ -24836,12 +24104,6 @@ func (m *UserMutation) AddedFields() []string { if m.addconcurrency != nil { fields = append(fields, user.FieldConcurrency) } - if m.addsora_storage_quota_bytes != nil { - fields = append(fields, user.FieldSoraStorageQuotaBytes) - } - if m.addsora_storage_used_bytes != nil { - fields = append(fields, user.FieldSoraStorageUsedBytes) - } return fields } @@ -24854,10 +24116,6 @@ func (m *UserMutation) AddedField(name string) (ent.Value, bool) { return m.AddedBalance() case user.FieldConcurrency: return m.AddedConcurrency() - case user.FieldSoraStorageQuotaBytes: - return m.AddedSoraStorageQuotaBytes() - case user.FieldSoraStorageUsedBytes: - return m.AddedSoraStorageUsedBytes() } return nil, false } @@ -24881,20 +24139,6 @@ func (m *UserMutation) AddField(name string, value ent.Value) error { } m.AddConcurrency(v) return nil - case user.FieldSoraStorageQuotaBytes: - v, ok := value.(int64) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.AddSoraStorageQuotaBytes(v) - return nil - case user.FieldSoraStorageUsedBytes: - v, ok := value.(int64) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.AddSoraStorageUsedBytes(v) - return nil } return fmt.Errorf("unknown User numeric field %s", name) } @@ -24985,12 +24229,6 @@ func (m *UserMutation) ResetField(name string) error { case user.FieldTotpEnabledAt: m.ResetTotpEnabledAt() return nil - case user.FieldSoraStorageQuotaBytes: - m.ResetSoraStorageQuotaBytes() - return nil - case user.FieldSoraStorageUsedBytes: - m.ResetSoraStorageUsedBytes() - return nil } return fmt.Errorf("unknown User field %s", name) } diff --git a/backend/ent/runtime/runtime.go b/backend/ent/runtime/runtime.go index 336b1f82..803b7bc2 100644 --- a/backend/ent/runtime/runtime.go +++ b/backend/ent/runtime/runtime.go @@ -430,44 +430,40 @@ func init() { groupDescDefaultValidityDays := groupFields[10].Descriptor() // group.DefaultDefaultValidityDays holds the default value on creation for the default_validity_days field. group.DefaultDefaultValidityDays = groupDescDefaultValidityDays.Default.(int) - // groupDescSoraStorageQuotaBytes is the schema descriptor for sora_storage_quota_bytes field. - groupDescSoraStorageQuotaBytes := groupFields[18].Descriptor() - // group.DefaultSoraStorageQuotaBytes holds the default value on creation for the sora_storage_quota_bytes field. - group.DefaultSoraStorageQuotaBytes = groupDescSoraStorageQuotaBytes.Default.(int64) // groupDescClaudeCodeOnly is the schema descriptor for claude_code_only field. - groupDescClaudeCodeOnly := groupFields[19].Descriptor() + groupDescClaudeCodeOnly := groupFields[14].Descriptor() // group.DefaultClaudeCodeOnly holds the default value on creation for the claude_code_only field. group.DefaultClaudeCodeOnly = groupDescClaudeCodeOnly.Default.(bool) // groupDescModelRoutingEnabled is the schema descriptor for model_routing_enabled field. - groupDescModelRoutingEnabled := groupFields[23].Descriptor() + groupDescModelRoutingEnabled := groupFields[18].Descriptor() // group.DefaultModelRoutingEnabled holds the default value on creation for the model_routing_enabled field. group.DefaultModelRoutingEnabled = groupDescModelRoutingEnabled.Default.(bool) // groupDescMcpXMLInject is the schema descriptor for mcp_xml_inject field. - groupDescMcpXMLInject := groupFields[24].Descriptor() + groupDescMcpXMLInject := groupFields[19].Descriptor() // group.DefaultMcpXMLInject holds the default value on creation for the mcp_xml_inject field. group.DefaultMcpXMLInject = groupDescMcpXMLInject.Default.(bool) // groupDescSupportedModelScopes is the schema descriptor for supported_model_scopes field. - groupDescSupportedModelScopes := groupFields[25].Descriptor() + groupDescSupportedModelScopes := groupFields[20].Descriptor() // group.DefaultSupportedModelScopes holds the default value on creation for the supported_model_scopes field. group.DefaultSupportedModelScopes = groupDescSupportedModelScopes.Default.([]string) // groupDescSortOrder is the schema descriptor for sort_order field. - groupDescSortOrder := groupFields[26].Descriptor() + groupDescSortOrder := groupFields[21].Descriptor() // group.DefaultSortOrder holds the default value on creation for the sort_order field. group.DefaultSortOrder = groupDescSortOrder.Default.(int) // groupDescAllowMessagesDispatch is the schema descriptor for allow_messages_dispatch field. - groupDescAllowMessagesDispatch := groupFields[27].Descriptor() + groupDescAllowMessagesDispatch := groupFields[22].Descriptor() // group.DefaultAllowMessagesDispatch holds the default value on creation for the allow_messages_dispatch field. group.DefaultAllowMessagesDispatch = groupDescAllowMessagesDispatch.Default.(bool) // groupDescRequireOauthOnly is the schema descriptor for require_oauth_only field. - groupDescRequireOauthOnly := groupFields[28].Descriptor() + groupDescRequireOauthOnly := groupFields[23].Descriptor() // group.DefaultRequireOauthOnly holds the default value on creation for the require_oauth_only field. group.DefaultRequireOauthOnly = groupDescRequireOauthOnly.Default.(bool) // groupDescRequirePrivacySet is the schema descriptor for require_privacy_set field. - groupDescRequirePrivacySet := groupFields[29].Descriptor() + groupDescRequirePrivacySet := groupFields[24].Descriptor() // group.DefaultRequirePrivacySet holds the default value on creation for the require_privacy_set field. group.DefaultRequirePrivacySet = groupDescRequirePrivacySet.Default.(bool) // groupDescDefaultMappedModel is the schema descriptor for default_mapped_model field. - groupDescDefaultMappedModel := groupFields[30].Descriptor() + groupDescDefaultMappedModel := groupFields[25].Descriptor() // group.DefaultDefaultMappedModel holds the default value on creation for the default_mapped_model field. group.DefaultDefaultMappedModel = groupDescDefaultMappedModel.Default.(string) // group.DefaultMappedModelValidator is a validator for the "default_mapped_model" field. It is called by the builders before save. @@ -963,16 +959,12 @@ func init() { usagelogDescImageSize := usagelogFields[34].Descriptor() // usagelog.ImageSizeValidator is a validator for the "image_size" field. It is called by the builders before save. usagelog.ImageSizeValidator = usagelogDescImageSize.Validators[0].(func(string) error) - // usagelogDescMediaType is the schema descriptor for media_type field. - usagelogDescMediaType := usagelogFields[35].Descriptor() - // usagelog.MediaTypeValidator is a validator for the "media_type" field. It is called by the builders before save. - usagelog.MediaTypeValidator = usagelogDescMediaType.Validators[0].(func(string) error) // usagelogDescCacheTTLOverridden is the schema descriptor for cache_ttl_overridden field. - usagelogDescCacheTTLOverridden := usagelogFields[36].Descriptor() + usagelogDescCacheTTLOverridden := usagelogFields[35].Descriptor() // usagelog.DefaultCacheTTLOverridden holds the default value on creation for the cache_ttl_overridden field. usagelog.DefaultCacheTTLOverridden = usagelogDescCacheTTLOverridden.Default.(bool) // usagelogDescCreatedAt is the schema descriptor for created_at field. - usagelogDescCreatedAt := usagelogFields[37].Descriptor() + usagelogDescCreatedAt := usagelogFields[36].Descriptor() // usagelog.DefaultCreatedAt holds the default value on creation for the created_at field. usagelog.DefaultCreatedAt = usagelogDescCreatedAt.Default.(func() time.Time) userMixin := schema.User{}.Mixin() @@ -1064,14 +1056,6 @@ func init() { userDescTotpEnabled := userFields[9].Descriptor() // user.DefaultTotpEnabled holds the default value on creation for the totp_enabled field. user.DefaultTotpEnabled = userDescTotpEnabled.Default.(bool) - // userDescSoraStorageQuotaBytes is the schema descriptor for sora_storage_quota_bytes field. - userDescSoraStorageQuotaBytes := userFields[11].Descriptor() - // user.DefaultSoraStorageQuotaBytes holds the default value on creation for the sora_storage_quota_bytes field. - user.DefaultSoraStorageQuotaBytes = userDescSoraStorageQuotaBytes.Default.(int64) - // userDescSoraStorageUsedBytes is the schema descriptor for sora_storage_used_bytes field. - userDescSoraStorageUsedBytes := userFields[12].Descriptor() - // user.DefaultSoraStorageUsedBytes holds the default value on creation for the sora_storage_used_bytes field. - user.DefaultSoraStorageUsedBytes = userDescSoraStorageUsedBytes.Default.(int64) userallowedgroupFields := schema.UserAllowedGroup{}.Fields() _ = userallowedgroupFields // userallowedgroupDescCreatedAt is the schema descriptor for created_at field. diff --git a/backend/ent/schema/group.go b/backend/ent/schema/group.go index fd83bf26..0eb89c18 100644 --- a/backend/ent/schema/group.go +++ b/backend/ent/schema/group.go @@ -87,28 +87,6 @@ func (Group) Fields() []ent.Field { Nillable(). SchemaType(map[string]string{dialect.Postgres: "decimal(20,8)"}), - // Sora 按次计费配置(阶段 1) - field.Float("sora_image_price_360"). - Optional(). - Nillable(). - SchemaType(map[string]string{dialect.Postgres: "decimal(20,8)"}), - field.Float("sora_image_price_540"). - Optional(). - Nillable(). - SchemaType(map[string]string{dialect.Postgres: "decimal(20,8)"}), - field.Float("sora_video_price_per_request"). - Optional(). - Nillable(). - SchemaType(map[string]string{dialect.Postgres: "decimal(20,8)"}), - field.Float("sora_video_price_per_request_hd"). - Optional(). - Nillable(). - SchemaType(map[string]string{dialect.Postgres: "decimal(20,8)"}), - - // Sora 存储配额 - field.Int64("sora_storage_quota_bytes"). - Default(0), - // Claude Code 客户端限制 (added by migration 029) field.Bool("claude_code_only"). Default(false). diff --git a/backend/ent/schema/usage_log.go b/backend/ent/schema/usage_log.go index f6c725a2..bd3ebfcc 100644 --- a/backend/ent/schema/usage_log.go +++ b/backend/ent/schema/usage_log.go @@ -134,12 +134,6 @@ func (UsageLog) Fields() []ent.Field { MaxLen(10). Optional(). Nillable(), - // 媒体类型字段(sora 使用) - field.String("media_type"). - MaxLen(16). - Optional(). - Nillable(), - // Cache TTL Override 标记(管理员强制替换了缓存 TTL 计费) field.Bool("cache_ttl_overridden"). Default(false), diff --git a/backend/ent/schema/user.go b/backend/ent/schema/user.go index 0a3b5d9e..d443ef45 100644 --- a/backend/ent/schema/user.go +++ b/backend/ent/schema/user.go @@ -72,12 +72,6 @@ func (User) Fields() []ent.Field { field.Time("totp_enabled_at"). Optional(). Nillable(), - - // Sora 存储配额 - field.Int64("sora_storage_quota_bytes"). - Default(0), - field.Int64("sora_storage_used_bytes"). - Default(0), } } diff --git a/backend/ent/usagelog.go b/backend/ent/usagelog.go index b857afdb..a8e0cc6c 100644 --- a/backend/ent/usagelog.go +++ b/backend/ent/usagelog.go @@ -92,8 +92,6 @@ type UsageLog struct { ImageCount int `json:"image_count,omitempty"` // ImageSize holds the value of the "image_size" field. ImageSize *string `json:"image_size,omitempty"` - // MediaType holds the value of the "media_type" field. - MediaType *string `json:"media_type,omitempty"` // CacheTTLOverridden holds the value of the "cache_ttl_overridden" field. CacheTTLOverridden bool `json:"cache_ttl_overridden,omitempty"` // CreatedAt holds the value of the "created_at" field. @@ -187,7 +185,7 @@ func (*UsageLog) scanValues(columns []string) ([]any, error) { values[i] = new(sql.NullFloat64) case usagelog.FieldID, usagelog.FieldUserID, usagelog.FieldAPIKeyID, usagelog.FieldAccountID, usagelog.FieldChannelID, usagelog.FieldGroupID, usagelog.FieldSubscriptionID, usagelog.FieldInputTokens, usagelog.FieldOutputTokens, usagelog.FieldCacheCreationTokens, usagelog.FieldCacheReadTokens, usagelog.FieldCacheCreation5mTokens, usagelog.FieldCacheCreation1hTokens, usagelog.FieldBillingType, usagelog.FieldDurationMs, usagelog.FieldFirstTokenMs, usagelog.FieldImageCount: values[i] = new(sql.NullInt64) - case usagelog.FieldRequestID, usagelog.FieldModel, usagelog.FieldRequestedModel, usagelog.FieldUpstreamModel, usagelog.FieldModelMappingChain, usagelog.FieldBillingTier, usagelog.FieldBillingMode, usagelog.FieldUserAgent, usagelog.FieldIPAddress, usagelog.FieldImageSize, usagelog.FieldMediaType: + case usagelog.FieldRequestID, usagelog.FieldModel, usagelog.FieldRequestedModel, usagelog.FieldUpstreamModel, usagelog.FieldModelMappingChain, usagelog.FieldBillingTier, usagelog.FieldBillingMode, usagelog.FieldUserAgent, usagelog.FieldIPAddress, usagelog.FieldImageSize: values[i] = new(sql.NullString) case usagelog.FieldCreatedAt: values[i] = new(sql.NullTime) @@ -436,13 +434,6 @@ func (_m *UsageLog) assignValues(columns []string, values []any) error { _m.ImageSize = new(string) *_m.ImageSize = value.String } - case usagelog.FieldMediaType: - if value, ok := values[i].(*sql.NullString); !ok { - return fmt.Errorf("unexpected type %T for field media_type", values[i]) - } else if value.Valid { - _m.MediaType = new(string) - *_m.MediaType = value.String - } case usagelog.FieldCacheTTLOverridden: if value, ok := values[i].(*sql.NullBool); !ok { return fmt.Errorf("unexpected type %T for field cache_ttl_overridden", values[i]) @@ -649,11 +640,6 @@ func (_m *UsageLog) String() string { builder.WriteString(*v) } builder.WriteString(", ") - if v := _m.MediaType; v != nil { - builder.WriteString("media_type=") - builder.WriteString(*v) - } - builder.WriteString(", ") builder.WriteString("cache_ttl_overridden=") builder.WriteString(fmt.Sprintf("%v", _m.CacheTTLOverridden)) builder.WriteString(", ") diff --git a/backend/ent/usagelog/usagelog.go b/backend/ent/usagelog/usagelog.go index 1567ad9b..a7438e60 100644 --- a/backend/ent/usagelog/usagelog.go +++ b/backend/ent/usagelog/usagelog.go @@ -84,8 +84,6 @@ const ( FieldImageCount = "image_count" // FieldImageSize holds the string denoting the image_size field in the database. FieldImageSize = "image_size" - // FieldMediaType holds the string denoting the media_type field in the database. - FieldMediaType = "media_type" // FieldCacheTTLOverridden holds the string denoting the cache_ttl_overridden field in the database. FieldCacheTTLOverridden = "cache_ttl_overridden" // FieldCreatedAt holds the string denoting the created_at field in the database. @@ -177,7 +175,6 @@ var Columns = []string{ FieldIPAddress, FieldImageCount, FieldImageSize, - FieldMediaType, FieldCacheTTLOverridden, FieldCreatedAt, } @@ -245,8 +242,6 @@ var ( DefaultImageCount int // ImageSizeValidator is a validator for the "image_size" field. It is called by the builders before save. ImageSizeValidator func(string) error - // MediaTypeValidator is a validator for the "media_type" field. It is called by the builders before save. - MediaTypeValidator func(string) error // DefaultCacheTTLOverridden holds the default value on creation for the "cache_ttl_overridden" field. DefaultCacheTTLOverridden bool // DefaultCreatedAt holds the default value on creation for the "created_at" field. @@ -436,11 +431,6 @@ func ByImageSize(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldImageSize, opts...).ToFunc() } -// ByMediaType orders the results by the media_type field. -func ByMediaType(opts ...sql.OrderTermOption) OrderOption { - return sql.OrderByField(FieldMediaType, opts...).ToFunc() -} - // ByCacheTTLOverridden orders the results by the cache_ttl_overridden field. func ByCacheTTLOverridden(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldCacheTTLOverridden, opts...).ToFunc() diff --git a/backend/ent/usagelog/where.go b/backend/ent/usagelog/where.go index a1fb36cb..b8439a03 100644 --- a/backend/ent/usagelog/where.go +++ b/backend/ent/usagelog/where.go @@ -230,11 +230,6 @@ func ImageSize(v string) predicate.UsageLog { return predicate.UsageLog(sql.FieldEQ(FieldImageSize, v)) } -// MediaType applies equality check predicate on the "media_type" field. It's identical to MediaTypeEQ. -func MediaType(v string) predicate.UsageLog { - return predicate.UsageLog(sql.FieldEQ(FieldMediaType, v)) -} - // CacheTTLOverridden applies equality check predicate on the "cache_ttl_overridden" field. It's identical to CacheTTLOverriddenEQ. func CacheTTLOverridden(v bool) predicate.UsageLog { return predicate.UsageLog(sql.FieldEQ(FieldCacheTTLOverridden, v)) @@ -1905,81 +1900,6 @@ func ImageSizeContainsFold(v string) predicate.UsageLog { return predicate.UsageLog(sql.FieldContainsFold(FieldImageSize, v)) } -// MediaTypeEQ applies the EQ predicate on the "media_type" field. -func MediaTypeEQ(v string) predicate.UsageLog { - return predicate.UsageLog(sql.FieldEQ(FieldMediaType, v)) -} - -// MediaTypeNEQ applies the NEQ predicate on the "media_type" field. -func MediaTypeNEQ(v string) predicate.UsageLog { - return predicate.UsageLog(sql.FieldNEQ(FieldMediaType, v)) -} - -// MediaTypeIn applies the In predicate on the "media_type" field. -func MediaTypeIn(vs ...string) predicate.UsageLog { - return predicate.UsageLog(sql.FieldIn(FieldMediaType, vs...)) -} - -// MediaTypeNotIn applies the NotIn predicate on the "media_type" field. -func MediaTypeNotIn(vs ...string) predicate.UsageLog { - return predicate.UsageLog(sql.FieldNotIn(FieldMediaType, vs...)) -} - -// MediaTypeGT applies the GT predicate on the "media_type" field. -func MediaTypeGT(v string) predicate.UsageLog { - return predicate.UsageLog(sql.FieldGT(FieldMediaType, v)) -} - -// MediaTypeGTE applies the GTE predicate on the "media_type" field. -func MediaTypeGTE(v string) predicate.UsageLog { - return predicate.UsageLog(sql.FieldGTE(FieldMediaType, v)) -} - -// MediaTypeLT applies the LT predicate on the "media_type" field. -func MediaTypeLT(v string) predicate.UsageLog { - return predicate.UsageLog(sql.FieldLT(FieldMediaType, v)) -} - -// MediaTypeLTE applies the LTE predicate on the "media_type" field. -func MediaTypeLTE(v string) predicate.UsageLog { - return predicate.UsageLog(sql.FieldLTE(FieldMediaType, v)) -} - -// MediaTypeContains applies the Contains predicate on the "media_type" field. -func MediaTypeContains(v string) predicate.UsageLog { - return predicate.UsageLog(sql.FieldContains(FieldMediaType, v)) -} - -// MediaTypeHasPrefix applies the HasPrefix predicate on the "media_type" field. -func MediaTypeHasPrefix(v string) predicate.UsageLog { - return predicate.UsageLog(sql.FieldHasPrefix(FieldMediaType, v)) -} - -// MediaTypeHasSuffix applies the HasSuffix predicate on the "media_type" field. -func MediaTypeHasSuffix(v string) predicate.UsageLog { - return predicate.UsageLog(sql.FieldHasSuffix(FieldMediaType, v)) -} - -// MediaTypeIsNil applies the IsNil predicate on the "media_type" field. -func MediaTypeIsNil() predicate.UsageLog { - return predicate.UsageLog(sql.FieldIsNull(FieldMediaType)) -} - -// MediaTypeNotNil applies the NotNil predicate on the "media_type" field. -func MediaTypeNotNil() predicate.UsageLog { - return predicate.UsageLog(sql.FieldNotNull(FieldMediaType)) -} - -// MediaTypeEqualFold applies the EqualFold predicate on the "media_type" field. -func MediaTypeEqualFold(v string) predicate.UsageLog { - return predicate.UsageLog(sql.FieldEqualFold(FieldMediaType, v)) -} - -// MediaTypeContainsFold applies the ContainsFold predicate on the "media_type" field. -func MediaTypeContainsFold(v string) predicate.UsageLog { - return predicate.UsageLog(sql.FieldContainsFold(FieldMediaType, v)) -} - // CacheTTLOverriddenEQ applies the EQ predicate on the "cache_ttl_overridden" field. func CacheTTLOverriddenEQ(v bool) predicate.UsageLog { return predicate.UsageLog(sql.FieldEQ(FieldCacheTTLOverridden, v)) diff --git a/backend/ent/usagelog_create.go b/backend/ent/usagelog_create.go index d15e231d..fded364e 100644 --- a/backend/ent/usagelog_create.go +++ b/backend/ent/usagelog_create.go @@ -477,20 +477,6 @@ func (_c *UsageLogCreate) SetNillableImageSize(v *string) *UsageLogCreate { return _c } -// SetMediaType sets the "media_type" field. -func (_c *UsageLogCreate) SetMediaType(v string) *UsageLogCreate { - _c.mutation.SetMediaType(v) - return _c -} - -// SetNillableMediaType sets the "media_type" field if the given value is not nil. -func (_c *UsageLogCreate) SetNillableMediaType(v *string) *UsageLogCreate { - if v != nil { - _c.SetMediaType(*v) - } - return _c -} - // SetCacheTTLOverridden sets the "cache_ttl_overridden" field. func (_c *UsageLogCreate) SetCacheTTLOverridden(v bool) *UsageLogCreate { _c.mutation.SetCacheTTLOverridden(v) @@ -768,11 +754,6 @@ func (_c *UsageLogCreate) check() error { return &ValidationError{Name: "image_size", err: fmt.Errorf(`ent: validator failed for field "UsageLog.image_size": %w`, err)} } } - if v, ok := _c.mutation.MediaType(); ok { - if err := usagelog.MediaTypeValidator(v); err != nil { - return &ValidationError{Name: "media_type", err: fmt.Errorf(`ent: validator failed for field "UsageLog.media_type": %w`, err)} - } - } if _, ok := _c.mutation.CacheTTLOverridden(); !ok { return &ValidationError{Name: "cache_ttl_overridden", err: errors.New(`ent: missing required field "UsageLog.cache_ttl_overridden"`)} } @@ -935,10 +916,6 @@ func (_c *UsageLogCreate) createSpec() (*UsageLog, *sqlgraph.CreateSpec) { _spec.SetField(usagelog.FieldImageSize, field.TypeString, value) _node.ImageSize = &value } - if value, ok := _c.mutation.MediaType(); ok { - _spec.SetField(usagelog.FieldMediaType, field.TypeString, value) - _node.MediaType = &value - } if value, ok := _c.mutation.CacheTTLOverridden(); ok { _spec.SetField(usagelog.FieldCacheTTLOverridden, field.TypeBool, value) _node.CacheTTLOverridden = value @@ -1702,24 +1679,6 @@ func (u *UsageLogUpsert) ClearImageSize() *UsageLogUpsert { return u } -// SetMediaType sets the "media_type" field. -func (u *UsageLogUpsert) SetMediaType(v string) *UsageLogUpsert { - u.Set(usagelog.FieldMediaType, v) - return u -} - -// UpdateMediaType sets the "media_type" field to the value that was provided on create. -func (u *UsageLogUpsert) UpdateMediaType() *UsageLogUpsert { - u.SetExcluded(usagelog.FieldMediaType) - return u -} - -// ClearMediaType clears the value of the "media_type" field. -func (u *UsageLogUpsert) ClearMediaType() *UsageLogUpsert { - u.SetNull(usagelog.FieldMediaType) - return u -} - // SetCacheTTLOverridden sets the "cache_ttl_overridden" field. func (u *UsageLogUpsert) SetCacheTTLOverridden(v bool) *UsageLogUpsert { u.Set(usagelog.FieldCacheTTLOverridden, v) @@ -2498,27 +2457,6 @@ func (u *UsageLogUpsertOne) ClearImageSize() *UsageLogUpsertOne { }) } -// SetMediaType sets the "media_type" field. -func (u *UsageLogUpsertOne) SetMediaType(v string) *UsageLogUpsertOne { - return u.Update(func(s *UsageLogUpsert) { - s.SetMediaType(v) - }) -} - -// UpdateMediaType sets the "media_type" field to the value that was provided on create. -func (u *UsageLogUpsertOne) UpdateMediaType() *UsageLogUpsertOne { - return u.Update(func(s *UsageLogUpsert) { - s.UpdateMediaType() - }) -} - -// ClearMediaType clears the value of the "media_type" field. -func (u *UsageLogUpsertOne) ClearMediaType() *UsageLogUpsertOne { - return u.Update(func(s *UsageLogUpsert) { - s.ClearMediaType() - }) -} - // SetCacheTTLOverridden sets the "cache_ttl_overridden" field. func (u *UsageLogUpsertOne) SetCacheTTLOverridden(v bool) *UsageLogUpsertOne { return u.Update(func(s *UsageLogUpsert) { @@ -3465,27 +3403,6 @@ func (u *UsageLogUpsertBulk) ClearImageSize() *UsageLogUpsertBulk { }) } -// SetMediaType sets the "media_type" field. -func (u *UsageLogUpsertBulk) SetMediaType(v string) *UsageLogUpsertBulk { - return u.Update(func(s *UsageLogUpsert) { - s.SetMediaType(v) - }) -} - -// UpdateMediaType sets the "media_type" field to the value that was provided on create. -func (u *UsageLogUpsertBulk) UpdateMediaType() *UsageLogUpsertBulk { - return u.Update(func(s *UsageLogUpsert) { - s.UpdateMediaType() - }) -} - -// ClearMediaType clears the value of the "media_type" field. -func (u *UsageLogUpsertBulk) ClearMediaType() *UsageLogUpsertBulk { - return u.Update(func(s *UsageLogUpsert) { - s.ClearMediaType() - }) -} - // SetCacheTTLOverridden sets the "cache_ttl_overridden" field. func (u *UsageLogUpsertBulk) SetCacheTTLOverridden(v bool) *UsageLogUpsertBulk { return u.Update(func(s *UsageLogUpsert) { diff --git a/backend/ent/usagelog_update.go b/backend/ent/usagelog_update.go index 52f5a606..bb5ac86c 100644 --- a/backend/ent/usagelog_update.go +++ b/backend/ent/usagelog_update.go @@ -739,26 +739,6 @@ func (_u *UsageLogUpdate) ClearImageSize() *UsageLogUpdate { return _u } -// SetMediaType sets the "media_type" field. -func (_u *UsageLogUpdate) SetMediaType(v string) *UsageLogUpdate { - _u.mutation.SetMediaType(v) - return _u -} - -// SetNillableMediaType sets the "media_type" field if the given value is not nil. -func (_u *UsageLogUpdate) SetNillableMediaType(v *string) *UsageLogUpdate { - if v != nil { - _u.SetMediaType(*v) - } - return _u -} - -// ClearMediaType clears the value of the "media_type" field. -func (_u *UsageLogUpdate) ClearMediaType() *UsageLogUpdate { - _u.mutation.ClearMediaType() - return _u -} - // SetCacheTTLOverridden sets the "cache_ttl_overridden" field. func (_u *UsageLogUpdate) SetCacheTTLOverridden(v bool) *UsageLogUpdate { _u.mutation.SetCacheTTLOverridden(v) @@ -912,11 +892,6 @@ func (_u *UsageLogUpdate) check() error { return &ValidationError{Name: "image_size", err: fmt.Errorf(`ent: validator failed for field "UsageLog.image_size": %w`, err)} } } - if v, ok := _u.mutation.MediaType(); ok { - if err := usagelog.MediaTypeValidator(v); err != nil { - return &ValidationError{Name: "media_type", err: fmt.Errorf(`ent: validator failed for field "UsageLog.media_type": %w`, err)} - } - } if _u.mutation.UserCleared() && len(_u.mutation.UserIDs()) > 0 { return errors.New(`ent: clearing a required unique edge "UsageLog.user"`) } @@ -1124,12 +1099,6 @@ func (_u *UsageLogUpdate) sqlSave(ctx context.Context) (_node int, err error) { if _u.mutation.ImageSizeCleared() { _spec.ClearField(usagelog.FieldImageSize, field.TypeString) } - if value, ok := _u.mutation.MediaType(); ok { - _spec.SetField(usagelog.FieldMediaType, field.TypeString, value) - } - if _u.mutation.MediaTypeCleared() { - _spec.ClearField(usagelog.FieldMediaType, field.TypeString) - } if value, ok := _u.mutation.CacheTTLOverridden(); ok { _spec.SetField(usagelog.FieldCacheTTLOverridden, field.TypeBool, value) } @@ -2005,26 +1974,6 @@ func (_u *UsageLogUpdateOne) ClearImageSize() *UsageLogUpdateOne { return _u } -// SetMediaType sets the "media_type" field. -func (_u *UsageLogUpdateOne) SetMediaType(v string) *UsageLogUpdateOne { - _u.mutation.SetMediaType(v) - return _u -} - -// SetNillableMediaType sets the "media_type" field if the given value is not nil. -func (_u *UsageLogUpdateOne) SetNillableMediaType(v *string) *UsageLogUpdateOne { - if v != nil { - _u.SetMediaType(*v) - } - return _u -} - -// ClearMediaType clears the value of the "media_type" field. -func (_u *UsageLogUpdateOne) ClearMediaType() *UsageLogUpdateOne { - _u.mutation.ClearMediaType() - return _u -} - // SetCacheTTLOverridden sets the "cache_ttl_overridden" field. func (_u *UsageLogUpdateOne) SetCacheTTLOverridden(v bool) *UsageLogUpdateOne { _u.mutation.SetCacheTTLOverridden(v) @@ -2191,11 +2140,6 @@ func (_u *UsageLogUpdateOne) check() error { return &ValidationError{Name: "image_size", err: fmt.Errorf(`ent: validator failed for field "UsageLog.image_size": %w`, err)} } } - if v, ok := _u.mutation.MediaType(); ok { - if err := usagelog.MediaTypeValidator(v); err != nil { - return &ValidationError{Name: "media_type", err: fmt.Errorf(`ent: validator failed for field "UsageLog.media_type": %w`, err)} - } - } if _u.mutation.UserCleared() && len(_u.mutation.UserIDs()) > 0 { return errors.New(`ent: clearing a required unique edge "UsageLog.user"`) } @@ -2420,12 +2364,6 @@ func (_u *UsageLogUpdateOne) sqlSave(ctx context.Context) (_node *UsageLog, err if _u.mutation.ImageSizeCleared() { _spec.ClearField(usagelog.FieldImageSize, field.TypeString) } - if value, ok := _u.mutation.MediaType(); ok { - _spec.SetField(usagelog.FieldMediaType, field.TypeString, value) - } - if _u.mutation.MediaTypeCleared() { - _spec.ClearField(usagelog.FieldMediaType, field.TypeString) - } if value, ok := _u.mutation.CacheTTLOverridden(); ok { _spec.SetField(usagelog.FieldCacheTTLOverridden, field.TypeBool, value) } diff --git a/backend/ent/user.go b/backend/ent/user.go index b3f933f6..2435aa1b 100644 --- a/backend/ent/user.go +++ b/backend/ent/user.go @@ -45,10 +45,6 @@ type User struct { TotpEnabled bool `json:"totp_enabled,omitempty"` // TotpEnabledAt holds the value of the "totp_enabled_at" field. TotpEnabledAt *time.Time `json:"totp_enabled_at,omitempty"` - // SoraStorageQuotaBytes holds the value of the "sora_storage_quota_bytes" field. - SoraStorageQuotaBytes int64 `json:"sora_storage_quota_bytes,omitempty"` - // SoraStorageUsedBytes holds the value of the "sora_storage_used_bytes" field. - SoraStorageUsedBytes int64 `json:"sora_storage_used_bytes,omitempty"` // Edges holds the relations/edges for other nodes in the graph. // The values are being populated by the UserQuery when eager-loading is set. Edges UserEdges `json:"edges"` @@ -181,7 +177,7 @@ func (*User) scanValues(columns []string) ([]any, error) { values[i] = new(sql.NullBool) case user.FieldBalance: values[i] = new(sql.NullFloat64) - case user.FieldID, user.FieldConcurrency, user.FieldSoraStorageQuotaBytes, user.FieldSoraStorageUsedBytes: + case user.FieldID, user.FieldConcurrency: values[i] = new(sql.NullInt64) case user.FieldEmail, user.FieldPasswordHash, user.FieldRole, user.FieldStatus, user.FieldUsername, user.FieldNotes, user.FieldTotpSecretEncrypted: values[i] = new(sql.NullString) @@ -295,18 +291,6 @@ func (_m *User) assignValues(columns []string, values []any) error { _m.TotpEnabledAt = new(time.Time) *_m.TotpEnabledAt = value.Time } - case user.FieldSoraStorageQuotaBytes: - if value, ok := values[i].(*sql.NullInt64); !ok { - return fmt.Errorf("unexpected type %T for field sora_storage_quota_bytes", values[i]) - } else if value.Valid { - _m.SoraStorageQuotaBytes = value.Int64 - } - case user.FieldSoraStorageUsedBytes: - if value, ok := values[i].(*sql.NullInt64); !ok { - return fmt.Errorf("unexpected type %T for field sora_storage_used_bytes", values[i]) - } else if value.Valid { - _m.SoraStorageUsedBytes = value.Int64 - } default: _m.selectValues.Set(columns[i], values[i]) } @@ -440,12 +424,6 @@ func (_m *User) String() string { builder.WriteString("totp_enabled_at=") builder.WriteString(v.Format(time.ANSIC)) } - builder.WriteString(", ") - builder.WriteString("sora_storage_quota_bytes=") - builder.WriteString(fmt.Sprintf("%v", _m.SoraStorageQuotaBytes)) - builder.WriteString(", ") - builder.WriteString("sora_storage_used_bytes=") - builder.WriteString(fmt.Sprintf("%v", _m.SoraStorageUsedBytes)) builder.WriteByte(')') return builder.String() } diff --git a/backend/ent/user/user.go b/backend/ent/user/user.go index 155b9160..ae9418ff 100644 --- a/backend/ent/user/user.go +++ b/backend/ent/user/user.go @@ -43,10 +43,6 @@ const ( FieldTotpEnabled = "totp_enabled" // FieldTotpEnabledAt holds the string denoting the totp_enabled_at field in the database. FieldTotpEnabledAt = "totp_enabled_at" - // FieldSoraStorageQuotaBytes holds the string denoting the sora_storage_quota_bytes field in the database. - FieldSoraStorageQuotaBytes = "sora_storage_quota_bytes" - // FieldSoraStorageUsedBytes holds the string denoting the sora_storage_used_bytes field in the database. - FieldSoraStorageUsedBytes = "sora_storage_used_bytes" // EdgeAPIKeys holds the string denoting the api_keys edge name in mutations. EdgeAPIKeys = "api_keys" // EdgeRedeemCodes holds the string denoting the redeem_codes edge name in mutations. @@ -156,8 +152,6 @@ var Columns = []string{ FieldTotpSecretEncrypted, FieldTotpEnabled, FieldTotpEnabledAt, - FieldSoraStorageQuotaBytes, - FieldSoraStorageUsedBytes, } var ( @@ -214,10 +208,6 @@ var ( DefaultNotes string // DefaultTotpEnabled holds the default value on creation for the "totp_enabled" field. DefaultTotpEnabled bool - // DefaultSoraStorageQuotaBytes holds the default value on creation for the "sora_storage_quota_bytes" field. - DefaultSoraStorageQuotaBytes int64 - // DefaultSoraStorageUsedBytes holds the default value on creation for the "sora_storage_used_bytes" field. - DefaultSoraStorageUsedBytes int64 ) // OrderOption defines the ordering options for the User queries. @@ -298,16 +288,6 @@ func ByTotpEnabledAt(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldTotpEnabledAt, opts...).ToFunc() } -// BySoraStorageQuotaBytes orders the results by the sora_storage_quota_bytes field. -func BySoraStorageQuotaBytes(opts ...sql.OrderTermOption) OrderOption { - return sql.OrderByField(FieldSoraStorageQuotaBytes, opts...).ToFunc() -} - -// BySoraStorageUsedBytes orders the results by the sora_storage_used_bytes field. -func BySoraStorageUsedBytes(opts ...sql.OrderTermOption) OrderOption { - return sql.OrderByField(FieldSoraStorageUsedBytes, opts...).ToFunc() -} - // ByAPIKeysCount orders the results by api_keys count. func ByAPIKeysCount(opts ...sql.OrderTermOption) OrderOption { return func(s *sql.Selector) { diff --git a/backend/ent/user/where.go b/backend/ent/user/where.go index e26afcf3..1de61037 100644 --- a/backend/ent/user/where.go +++ b/backend/ent/user/where.go @@ -125,16 +125,6 @@ func TotpEnabledAt(v time.Time) predicate.User { return predicate.User(sql.FieldEQ(FieldTotpEnabledAt, v)) } -// SoraStorageQuotaBytes applies equality check predicate on the "sora_storage_quota_bytes" field. It's identical to SoraStorageQuotaBytesEQ. -func SoraStorageQuotaBytes(v int64) predicate.User { - return predicate.User(sql.FieldEQ(FieldSoraStorageQuotaBytes, v)) -} - -// SoraStorageUsedBytes applies equality check predicate on the "sora_storage_used_bytes" field. It's identical to SoraStorageUsedBytesEQ. -func SoraStorageUsedBytes(v int64) predicate.User { - return predicate.User(sql.FieldEQ(FieldSoraStorageUsedBytes, v)) -} - // CreatedAtEQ applies the EQ predicate on the "created_at" field. func CreatedAtEQ(v time.Time) predicate.User { return predicate.User(sql.FieldEQ(FieldCreatedAt, v)) @@ -870,86 +860,6 @@ func TotpEnabledAtNotNil() predicate.User { return predicate.User(sql.FieldNotNull(FieldTotpEnabledAt)) } -// SoraStorageQuotaBytesEQ applies the EQ predicate on the "sora_storage_quota_bytes" field. -func SoraStorageQuotaBytesEQ(v int64) predicate.User { - return predicate.User(sql.FieldEQ(FieldSoraStorageQuotaBytes, v)) -} - -// SoraStorageQuotaBytesNEQ applies the NEQ predicate on the "sora_storage_quota_bytes" field. -func SoraStorageQuotaBytesNEQ(v int64) predicate.User { - return predicate.User(sql.FieldNEQ(FieldSoraStorageQuotaBytes, v)) -} - -// SoraStorageQuotaBytesIn applies the In predicate on the "sora_storage_quota_bytes" field. -func SoraStorageQuotaBytesIn(vs ...int64) predicate.User { - return predicate.User(sql.FieldIn(FieldSoraStorageQuotaBytes, vs...)) -} - -// SoraStorageQuotaBytesNotIn applies the NotIn predicate on the "sora_storage_quota_bytes" field. -func SoraStorageQuotaBytesNotIn(vs ...int64) predicate.User { - return predicate.User(sql.FieldNotIn(FieldSoraStorageQuotaBytes, vs...)) -} - -// SoraStorageQuotaBytesGT applies the GT predicate on the "sora_storage_quota_bytes" field. -func SoraStorageQuotaBytesGT(v int64) predicate.User { - return predicate.User(sql.FieldGT(FieldSoraStorageQuotaBytes, v)) -} - -// SoraStorageQuotaBytesGTE applies the GTE predicate on the "sora_storage_quota_bytes" field. -func SoraStorageQuotaBytesGTE(v int64) predicate.User { - return predicate.User(sql.FieldGTE(FieldSoraStorageQuotaBytes, v)) -} - -// SoraStorageQuotaBytesLT applies the LT predicate on the "sora_storage_quota_bytes" field. -func SoraStorageQuotaBytesLT(v int64) predicate.User { - return predicate.User(sql.FieldLT(FieldSoraStorageQuotaBytes, v)) -} - -// SoraStorageQuotaBytesLTE applies the LTE predicate on the "sora_storage_quota_bytes" field. -func SoraStorageQuotaBytesLTE(v int64) predicate.User { - return predicate.User(sql.FieldLTE(FieldSoraStorageQuotaBytes, v)) -} - -// SoraStorageUsedBytesEQ applies the EQ predicate on the "sora_storage_used_bytes" field. -func SoraStorageUsedBytesEQ(v int64) predicate.User { - return predicate.User(sql.FieldEQ(FieldSoraStorageUsedBytes, v)) -} - -// SoraStorageUsedBytesNEQ applies the NEQ predicate on the "sora_storage_used_bytes" field. -func SoraStorageUsedBytesNEQ(v int64) predicate.User { - return predicate.User(sql.FieldNEQ(FieldSoraStorageUsedBytes, v)) -} - -// SoraStorageUsedBytesIn applies the In predicate on the "sora_storage_used_bytes" field. -func SoraStorageUsedBytesIn(vs ...int64) predicate.User { - return predicate.User(sql.FieldIn(FieldSoraStorageUsedBytes, vs...)) -} - -// SoraStorageUsedBytesNotIn applies the NotIn predicate on the "sora_storage_used_bytes" field. -func SoraStorageUsedBytesNotIn(vs ...int64) predicate.User { - return predicate.User(sql.FieldNotIn(FieldSoraStorageUsedBytes, vs...)) -} - -// SoraStorageUsedBytesGT applies the GT predicate on the "sora_storage_used_bytes" field. -func SoraStorageUsedBytesGT(v int64) predicate.User { - return predicate.User(sql.FieldGT(FieldSoraStorageUsedBytes, v)) -} - -// SoraStorageUsedBytesGTE applies the GTE predicate on the "sora_storage_used_bytes" field. -func SoraStorageUsedBytesGTE(v int64) predicate.User { - return predicate.User(sql.FieldGTE(FieldSoraStorageUsedBytes, v)) -} - -// SoraStorageUsedBytesLT applies the LT predicate on the "sora_storage_used_bytes" field. -func SoraStorageUsedBytesLT(v int64) predicate.User { - return predicate.User(sql.FieldLT(FieldSoraStorageUsedBytes, v)) -} - -// SoraStorageUsedBytesLTE applies the LTE predicate on the "sora_storage_used_bytes" field. -func SoraStorageUsedBytesLTE(v int64) predicate.User { - return predicate.User(sql.FieldLTE(FieldSoraStorageUsedBytes, v)) -} - // HasAPIKeys applies the HasEdge predicate on the "api_keys" edge. func HasAPIKeys() predicate.User { return predicate.User(func(s *sql.Selector) { diff --git a/backend/ent/user_create.go b/backend/ent/user_create.go index df0c6bcc..f862a580 100644 --- a/backend/ent/user_create.go +++ b/backend/ent/user_create.go @@ -210,34 +210,6 @@ func (_c *UserCreate) SetNillableTotpEnabledAt(v *time.Time) *UserCreate { return _c } -// SetSoraStorageQuotaBytes sets the "sora_storage_quota_bytes" field. -func (_c *UserCreate) SetSoraStorageQuotaBytes(v int64) *UserCreate { - _c.mutation.SetSoraStorageQuotaBytes(v) - return _c -} - -// SetNillableSoraStorageQuotaBytes sets the "sora_storage_quota_bytes" field if the given value is not nil. -func (_c *UserCreate) SetNillableSoraStorageQuotaBytes(v *int64) *UserCreate { - if v != nil { - _c.SetSoraStorageQuotaBytes(*v) - } - return _c -} - -// SetSoraStorageUsedBytes sets the "sora_storage_used_bytes" field. -func (_c *UserCreate) SetSoraStorageUsedBytes(v int64) *UserCreate { - _c.mutation.SetSoraStorageUsedBytes(v) - return _c -} - -// SetNillableSoraStorageUsedBytes sets the "sora_storage_used_bytes" field if the given value is not nil. -func (_c *UserCreate) SetNillableSoraStorageUsedBytes(v *int64) *UserCreate { - if v != nil { - _c.SetSoraStorageUsedBytes(*v) - } - return _c -} - // AddAPIKeyIDs adds the "api_keys" edge to the APIKey entity by IDs. func (_c *UserCreate) AddAPIKeyIDs(ids ...int64) *UserCreate { _c.mutation.AddAPIKeyIDs(ids...) @@ -452,14 +424,6 @@ func (_c *UserCreate) defaults() error { v := user.DefaultTotpEnabled _c.mutation.SetTotpEnabled(v) } - if _, ok := _c.mutation.SoraStorageQuotaBytes(); !ok { - v := user.DefaultSoraStorageQuotaBytes - _c.mutation.SetSoraStorageQuotaBytes(v) - } - if _, ok := _c.mutation.SoraStorageUsedBytes(); !ok { - v := user.DefaultSoraStorageUsedBytes - _c.mutation.SetSoraStorageUsedBytes(v) - } return nil } @@ -523,12 +487,6 @@ func (_c *UserCreate) check() error { if _, ok := _c.mutation.TotpEnabled(); !ok { return &ValidationError{Name: "totp_enabled", err: errors.New(`ent: missing required field "User.totp_enabled"`)} } - if _, ok := _c.mutation.SoraStorageQuotaBytes(); !ok { - return &ValidationError{Name: "sora_storage_quota_bytes", err: errors.New(`ent: missing required field "User.sora_storage_quota_bytes"`)} - } - if _, ok := _c.mutation.SoraStorageUsedBytes(); !ok { - return &ValidationError{Name: "sora_storage_used_bytes", err: errors.New(`ent: missing required field "User.sora_storage_used_bytes"`)} - } return nil } @@ -612,14 +570,6 @@ func (_c *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) { _spec.SetField(user.FieldTotpEnabledAt, field.TypeTime, value) _node.TotpEnabledAt = &value } - if value, ok := _c.mutation.SoraStorageQuotaBytes(); ok { - _spec.SetField(user.FieldSoraStorageQuotaBytes, field.TypeInt64, value) - _node.SoraStorageQuotaBytes = value - } - if value, ok := _c.mutation.SoraStorageUsedBytes(); ok { - _spec.SetField(user.FieldSoraStorageUsedBytes, field.TypeInt64, value) - _node.SoraStorageUsedBytes = value - } if nodes := _c.mutation.APIKeysIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, @@ -1006,42 +956,6 @@ func (u *UserUpsert) ClearTotpEnabledAt() *UserUpsert { return u } -// SetSoraStorageQuotaBytes sets the "sora_storage_quota_bytes" field. -func (u *UserUpsert) SetSoraStorageQuotaBytes(v int64) *UserUpsert { - u.Set(user.FieldSoraStorageQuotaBytes, v) - return u -} - -// UpdateSoraStorageQuotaBytes sets the "sora_storage_quota_bytes" field to the value that was provided on create. -func (u *UserUpsert) UpdateSoraStorageQuotaBytes() *UserUpsert { - u.SetExcluded(user.FieldSoraStorageQuotaBytes) - return u -} - -// AddSoraStorageQuotaBytes adds v to the "sora_storage_quota_bytes" field. -func (u *UserUpsert) AddSoraStorageQuotaBytes(v int64) *UserUpsert { - u.Add(user.FieldSoraStorageQuotaBytes, v) - return u -} - -// SetSoraStorageUsedBytes sets the "sora_storage_used_bytes" field. -func (u *UserUpsert) SetSoraStorageUsedBytes(v int64) *UserUpsert { - u.Set(user.FieldSoraStorageUsedBytes, v) - return u -} - -// UpdateSoraStorageUsedBytes sets the "sora_storage_used_bytes" field to the value that was provided on create. -func (u *UserUpsert) UpdateSoraStorageUsedBytes() *UserUpsert { - u.SetExcluded(user.FieldSoraStorageUsedBytes) - return u -} - -// AddSoraStorageUsedBytes adds v to the "sora_storage_used_bytes" field. -func (u *UserUpsert) AddSoraStorageUsedBytes(v int64) *UserUpsert { - u.Add(user.FieldSoraStorageUsedBytes, v) - return u -} - // UpdateNewValues updates the mutable fields using the new values that were set on create. // Using this option is equivalent to using: // @@ -1304,48 +1218,6 @@ func (u *UserUpsertOne) ClearTotpEnabledAt() *UserUpsertOne { }) } -// SetSoraStorageQuotaBytes sets the "sora_storage_quota_bytes" field. -func (u *UserUpsertOne) SetSoraStorageQuotaBytes(v int64) *UserUpsertOne { - return u.Update(func(s *UserUpsert) { - s.SetSoraStorageQuotaBytes(v) - }) -} - -// AddSoraStorageQuotaBytes adds v to the "sora_storage_quota_bytes" field. -func (u *UserUpsertOne) AddSoraStorageQuotaBytes(v int64) *UserUpsertOne { - return u.Update(func(s *UserUpsert) { - s.AddSoraStorageQuotaBytes(v) - }) -} - -// UpdateSoraStorageQuotaBytes sets the "sora_storage_quota_bytes" field to the value that was provided on create. -func (u *UserUpsertOne) UpdateSoraStorageQuotaBytes() *UserUpsertOne { - return u.Update(func(s *UserUpsert) { - s.UpdateSoraStorageQuotaBytes() - }) -} - -// SetSoraStorageUsedBytes sets the "sora_storage_used_bytes" field. -func (u *UserUpsertOne) SetSoraStorageUsedBytes(v int64) *UserUpsertOne { - return u.Update(func(s *UserUpsert) { - s.SetSoraStorageUsedBytes(v) - }) -} - -// AddSoraStorageUsedBytes adds v to the "sora_storage_used_bytes" field. -func (u *UserUpsertOne) AddSoraStorageUsedBytes(v int64) *UserUpsertOne { - return u.Update(func(s *UserUpsert) { - s.AddSoraStorageUsedBytes(v) - }) -} - -// UpdateSoraStorageUsedBytes sets the "sora_storage_used_bytes" field to the value that was provided on create. -func (u *UserUpsertOne) UpdateSoraStorageUsedBytes() *UserUpsertOne { - return u.Update(func(s *UserUpsert) { - s.UpdateSoraStorageUsedBytes() - }) -} - // Exec executes the query. func (u *UserUpsertOne) Exec(ctx context.Context) error { if len(u.create.conflict) == 0 { @@ -1774,48 +1646,6 @@ func (u *UserUpsertBulk) ClearTotpEnabledAt() *UserUpsertBulk { }) } -// SetSoraStorageQuotaBytes sets the "sora_storage_quota_bytes" field. -func (u *UserUpsertBulk) SetSoraStorageQuotaBytes(v int64) *UserUpsertBulk { - return u.Update(func(s *UserUpsert) { - s.SetSoraStorageQuotaBytes(v) - }) -} - -// AddSoraStorageQuotaBytes adds v to the "sora_storage_quota_bytes" field. -func (u *UserUpsertBulk) AddSoraStorageQuotaBytes(v int64) *UserUpsertBulk { - return u.Update(func(s *UserUpsert) { - s.AddSoraStorageQuotaBytes(v) - }) -} - -// UpdateSoraStorageQuotaBytes sets the "sora_storage_quota_bytes" field to the value that was provided on create. -func (u *UserUpsertBulk) UpdateSoraStorageQuotaBytes() *UserUpsertBulk { - return u.Update(func(s *UserUpsert) { - s.UpdateSoraStorageQuotaBytes() - }) -} - -// SetSoraStorageUsedBytes sets the "sora_storage_used_bytes" field. -func (u *UserUpsertBulk) SetSoraStorageUsedBytes(v int64) *UserUpsertBulk { - return u.Update(func(s *UserUpsert) { - s.SetSoraStorageUsedBytes(v) - }) -} - -// AddSoraStorageUsedBytes adds v to the "sora_storage_used_bytes" field. -func (u *UserUpsertBulk) AddSoraStorageUsedBytes(v int64) *UserUpsertBulk { - return u.Update(func(s *UserUpsert) { - s.AddSoraStorageUsedBytes(v) - }) -} - -// UpdateSoraStorageUsedBytes sets the "sora_storage_used_bytes" field to the value that was provided on create. -func (u *UserUpsertBulk) UpdateSoraStorageUsedBytes() *UserUpsertBulk { - return u.Update(func(s *UserUpsert) { - s.UpdateSoraStorageUsedBytes() - }) -} - // Exec executes the query. func (u *UserUpsertBulk) Exec(ctx context.Context) error { if u.create.err != nil { diff --git a/backend/ent/user_update.go b/backend/ent/user_update.go index f71f0cad..80222c92 100644 --- a/backend/ent/user_update.go +++ b/backend/ent/user_update.go @@ -242,48 +242,6 @@ func (_u *UserUpdate) ClearTotpEnabledAt() *UserUpdate { return _u } -// SetSoraStorageQuotaBytes sets the "sora_storage_quota_bytes" field. -func (_u *UserUpdate) SetSoraStorageQuotaBytes(v int64) *UserUpdate { - _u.mutation.ResetSoraStorageQuotaBytes() - _u.mutation.SetSoraStorageQuotaBytes(v) - return _u -} - -// SetNillableSoraStorageQuotaBytes sets the "sora_storage_quota_bytes" field if the given value is not nil. -func (_u *UserUpdate) SetNillableSoraStorageQuotaBytes(v *int64) *UserUpdate { - if v != nil { - _u.SetSoraStorageQuotaBytes(*v) - } - return _u -} - -// AddSoraStorageQuotaBytes adds value to the "sora_storage_quota_bytes" field. -func (_u *UserUpdate) AddSoraStorageQuotaBytes(v int64) *UserUpdate { - _u.mutation.AddSoraStorageQuotaBytes(v) - return _u -} - -// SetSoraStorageUsedBytes sets the "sora_storage_used_bytes" field. -func (_u *UserUpdate) SetSoraStorageUsedBytes(v int64) *UserUpdate { - _u.mutation.ResetSoraStorageUsedBytes() - _u.mutation.SetSoraStorageUsedBytes(v) - return _u -} - -// SetNillableSoraStorageUsedBytes sets the "sora_storage_used_bytes" field if the given value is not nil. -func (_u *UserUpdate) SetNillableSoraStorageUsedBytes(v *int64) *UserUpdate { - if v != nil { - _u.SetSoraStorageUsedBytes(*v) - } - return _u -} - -// AddSoraStorageUsedBytes adds value to the "sora_storage_used_bytes" field. -func (_u *UserUpdate) AddSoraStorageUsedBytes(v int64) *UserUpdate { - _u.mutation.AddSoraStorageUsedBytes(v) - return _u -} - // AddAPIKeyIDs adds the "api_keys" edge to the APIKey entity by IDs. func (_u *UserUpdate) AddAPIKeyIDs(ids ...int64) *UserUpdate { _u.mutation.AddAPIKeyIDs(ids...) @@ -751,18 +709,6 @@ func (_u *UserUpdate) sqlSave(ctx context.Context) (_node int, err error) { if _u.mutation.TotpEnabledAtCleared() { _spec.ClearField(user.FieldTotpEnabledAt, field.TypeTime) } - if value, ok := _u.mutation.SoraStorageQuotaBytes(); ok { - _spec.SetField(user.FieldSoraStorageQuotaBytes, field.TypeInt64, value) - } - if value, ok := _u.mutation.AddedSoraStorageQuotaBytes(); ok { - _spec.AddField(user.FieldSoraStorageQuotaBytes, field.TypeInt64, value) - } - if value, ok := _u.mutation.SoraStorageUsedBytes(); ok { - _spec.SetField(user.FieldSoraStorageUsedBytes, field.TypeInt64, value) - } - if value, ok := _u.mutation.AddedSoraStorageUsedBytes(); ok { - _spec.AddField(user.FieldSoraStorageUsedBytes, field.TypeInt64, value) - } if _u.mutation.APIKeysCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, @@ -1406,48 +1352,6 @@ func (_u *UserUpdateOne) ClearTotpEnabledAt() *UserUpdateOne { return _u } -// SetSoraStorageQuotaBytes sets the "sora_storage_quota_bytes" field. -func (_u *UserUpdateOne) SetSoraStorageQuotaBytes(v int64) *UserUpdateOne { - _u.mutation.ResetSoraStorageQuotaBytes() - _u.mutation.SetSoraStorageQuotaBytes(v) - return _u -} - -// SetNillableSoraStorageQuotaBytes sets the "sora_storage_quota_bytes" field if the given value is not nil. -func (_u *UserUpdateOne) SetNillableSoraStorageQuotaBytes(v *int64) *UserUpdateOne { - if v != nil { - _u.SetSoraStorageQuotaBytes(*v) - } - return _u -} - -// AddSoraStorageQuotaBytes adds value to the "sora_storage_quota_bytes" field. -func (_u *UserUpdateOne) AddSoraStorageQuotaBytes(v int64) *UserUpdateOne { - _u.mutation.AddSoraStorageQuotaBytes(v) - return _u -} - -// SetSoraStorageUsedBytes sets the "sora_storage_used_bytes" field. -func (_u *UserUpdateOne) SetSoraStorageUsedBytes(v int64) *UserUpdateOne { - _u.mutation.ResetSoraStorageUsedBytes() - _u.mutation.SetSoraStorageUsedBytes(v) - return _u -} - -// SetNillableSoraStorageUsedBytes sets the "sora_storage_used_bytes" field if the given value is not nil. -func (_u *UserUpdateOne) SetNillableSoraStorageUsedBytes(v *int64) *UserUpdateOne { - if v != nil { - _u.SetSoraStorageUsedBytes(*v) - } - return _u -} - -// AddSoraStorageUsedBytes adds value to the "sora_storage_used_bytes" field. -func (_u *UserUpdateOne) AddSoraStorageUsedBytes(v int64) *UserUpdateOne { - _u.mutation.AddSoraStorageUsedBytes(v) - return _u -} - // AddAPIKeyIDs adds the "api_keys" edge to the APIKey entity by IDs. func (_u *UserUpdateOne) AddAPIKeyIDs(ids ...int64) *UserUpdateOne { _u.mutation.AddAPIKeyIDs(ids...) @@ -1945,18 +1849,6 @@ func (_u *UserUpdateOne) sqlSave(ctx context.Context) (_node *User, err error) { if _u.mutation.TotpEnabledAtCleared() { _spec.ClearField(user.FieldTotpEnabledAt, field.TypeTime) } - if value, ok := _u.mutation.SoraStorageQuotaBytes(); ok { - _spec.SetField(user.FieldSoraStorageQuotaBytes, field.TypeInt64, value) - } - if value, ok := _u.mutation.AddedSoraStorageQuotaBytes(); ok { - _spec.AddField(user.FieldSoraStorageQuotaBytes, field.TypeInt64, value) - } - if value, ok := _u.mutation.SoraStorageUsedBytes(); ok { - _spec.SetField(user.FieldSoraStorageUsedBytes, field.TypeInt64, value) - } - if value, ok := _u.mutation.AddedSoraStorageUsedBytes(); ok { - _spec.AddField(user.FieldSoraStorageUsedBytes, field.TypeInt64, value) - } if _u.mutation.APIKeysCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, diff --git a/backend/migrations/090_drop_sora.sql b/backend/migrations/090_drop_sora.sql new file mode 100644 index 00000000..9ef3273f --- /dev/null +++ b/backend/migrations/090_drop_sora.sql @@ -0,0 +1,34 @@ +-- Migration: 090_drop_sora +-- Remove all Sora-related database objects. +-- Drops tables: sora_tasks, sora_generations, sora_accounts +-- Drops columns from: groups, users, usage_logs + +-- ============================================================ +-- 1. Drop Sora tables +-- ============================================================ +DROP TABLE IF EXISTS sora_tasks; +DROP TABLE IF EXISTS sora_generations; +DROP TABLE IF EXISTS sora_accounts; + +-- ============================================================ +-- 2. Drop Sora columns from groups table +-- ============================================================ +ALTER TABLE groups + DROP COLUMN IF EXISTS sora_image_price_360, + DROP COLUMN IF EXISTS sora_image_price_540, + DROP COLUMN IF EXISTS sora_video_price_per_request, + DROP COLUMN IF EXISTS sora_video_price_per_request_hd, + DROP COLUMN IF EXISTS sora_storage_quota_bytes; + +-- ============================================================ +-- 3. Drop Sora columns from users table +-- ============================================================ +ALTER TABLE users + DROP COLUMN IF EXISTS sora_storage_quota_bytes, + DROP COLUMN IF EXISTS sora_storage_used_bytes; + +-- ============================================================ +-- 4. Drop Sora column from usage_logs table +-- ============================================================ +ALTER TABLE usage_logs + DROP COLUMN IF EXISTS media_type;