ソースを参照

标签软删转硬删

boweniac 1 日 前
コミット
025a3b6277

+ 2 - 4
ent/client.go

@@ -3660,14 +3660,12 @@ func (c *LabelRelationshipClient) QueryLabels(lr *LabelRelationship) *LabelQuery
 
 // Hooks returns the client hooks.
 func (c *LabelRelationshipClient) Hooks() []Hook {
-	hooks := c.hooks.LabelRelationship
-	return append(hooks[:len(hooks):len(hooks)], labelrelationship.Hooks[:]...)
+	return c.hooks.LabelRelationship
 }
 
 // Interceptors returns the client interceptors.
 func (c *LabelRelationshipClient) Interceptors() []Interceptor {
-	inters := c.inters.LabelRelationship
-	return append(inters[:len(inters):len(inters)], labelrelationship.Interceptors[:]...)
+	return c.inters.LabelRelationship
 }
 
 func (c *LabelRelationshipClient) mutate(ctx context.Context, m *LabelRelationshipMutation) (Value, error) {

+ 1 - 12
ent/labelrelationship.go

@@ -25,8 +25,6 @@ type LabelRelationship struct {
 	UpdatedAt time.Time `json:"updated_at,omitempty"`
 	// Status 1: normal 2: ban | 状态 1 正常 2 禁用
 	Status uint8 `json:"status,omitempty"`
-	// Delete Time | 删除日期
-	DeletedAt time.Time `json:"deleted_at,omitempty"`
 	// 标签 ID
 	LabelID uint64 `json:"label_id,omitempty"`
 	// 联系人 ID
@@ -79,7 +77,7 @@ func (*LabelRelationship) scanValues(columns []string) ([]any, error) {
 		switch columns[i] {
 		case labelrelationship.FieldID, labelrelationship.FieldStatus, labelrelationship.FieldLabelID, labelrelationship.FieldContactID, labelrelationship.FieldOrganizationID:
 			values[i] = new(sql.NullInt64)
-		case labelrelationship.FieldCreatedAt, labelrelationship.FieldUpdatedAt, labelrelationship.FieldDeletedAt:
+		case labelrelationship.FieldCreatedAt, labelrelationship.FieldUpdatedAt:
 			values[i] = new(sql.NullTime)
 		default:
 			values[i] = new(sql.UnknownType)
@@ -120,12 +118,6 @@ func (lr *LabelRelationship) assignValues(columns []string, values []any) error
 			} else if value.Valid {
 				lr.Status = uint8(value.Int64)
 			}
-		case labelrelationship.FieldDeletedAt:
-			if value, ok := values[i].(*sql.NullTime); !ok {
-				return fmt.Errorf("unexpected type %T for field deleted_at", values[i])
-			} else if value.Valid {
-				lr.DeletedAt = value.Time
-			}
 		case labelrelationship.FieldLabelID:
 			if value, ok := values[i].(*sql.NullInt64); !ok {
 				return fmt.Errorf("unexpected type %T for field label_id", values[i])
@@ -199,9 +191,6 @@ func (lr *LabelRelationship) String() string {
 	builder.WriteString("status=")
 	builder.WriteString(fmt.Sprintf("%v", lr.Status))
 	builder.WriteString(", ")
-	builder.WriteString("deleted_at=")
-	builder.WriteString(lr.DeletedAt.Format(time.ANSIC))
-	builder.WriteString(", ")
 	builder.WriteString("label_id=")
 	builder.WriteString(fmt.Sprintf("%v", lr.LabelID))
 	builder.WriteString(", ")

+ 0 - 16
ent/labelrelationship/labelrelationship.go

@@ -5,7 +5,6 @@ package labelrelationship
 import (
 	"time"
 
-	"entgo.io/ent"
 	"entgo.io/ent/dialect/sql"
 	"entgo.io/ent/dialect/sql/sqlgraph"
 )
@@ -21,8 +20,6 @@ const (
 	FieldUpdatedAt = "updated_at"
 	// FieldStatus holds the string denoting the status field in the database.
 	FieldStatus = "status"
-	// FieldDeletedAt holds the string denoting the deleted_at field in the database.
-	FieldDeletedAt = "deleted_at"
 	// FieldLabelID holds the string denoting the label_id field in the database.
 	FieldLabelID = "label_id"
 	// FieldContactID holds the string denoting the contact_id field in the database.
@@ -57,7 +54,6 @@ var Columns = []string{
 	FieldCreatedAt,
 	FieldUpdatedAt,
 	FieldStatus,
-	FieldDeletedAt,
 	FieldLabelID,
 	FieldContactID,
 	FieldOrganizationID,
@@ -73,14 +69,7 @@ func ValidColumn(column string) bool {
 	return false
 }
 
-// Note that the variables below are initialized by the runtime
-// package on the initialization of the application. Therefore,
-// it should be imported in the main as follows:
-//
-//	import _ "wechat-api/ent/runtime"
 var (
-	Hooks        [1]ent.Hook
-	Interceptors [1]ent.Interceptor
 	// DefaultCreatedAt holds the default value on creation for the "created_at" field.
 	DefaultCreatedAt func() time.Time
 	// DefaultUpdatedAt holds the default value on creation for the "updated_at" field.
@@ -120,11 +109,6 @@ func ByStatus(opts ...sql.OrderTermOption) OrderOption {
 	return sql.OrderByField(FieldStatus, opts...).ToFunc()
 }
 
-// ByDeletedAt orders the results by the deleted_at field.
-func ByDeletedAt(opts ...sql.OrderTermOption) OrderOption {
-	return sql.OrderByField(FieldDeletedAt, opts...).ToFunc()
-}
-
 // ByLabelID orders the results by the label_id field.
 func ByLabelID(opts ...sql.OrderTermOption) OrderOption {
 	return sql.OrderByField(FieldLabelID, opts...).ToFunc()

+ 0 - 55
ent/labelrelationship/where.go

@@ -70,11 +70,6 @@ func Status(v uint8) predicate.LabelRelationship {
 	return predicate.LabelRelationship(sql.FieldEQ(FieldStatus, v))
 }
 
-// DeletedAt applies equality check predicate on the "deleted_at" field. It's identical to DeletedAtEQ.
-func DeletedAt(v time.Time) predicate.LabelRelationship {
-	return predicate.LabelRelationship(sql.FieldEQ(FieldDeletedAt, v))
-}
-
 // LabelID applies equality check predicate on the "label_id" field. It's identical to LabelIDEQ.
 func LabelID(v uint64) predicate.LabelRelationship {
 	return predicate.LabelRelationship(sql.FieldEQ(FieldLabelID, v))
@@ -220,56 +215,6 @@ func StatusNotNil() predicate.LabelRelationship {
 	return predicate.LabelRelationship(sql.FieldNotNull(FieldStatus))
 }
 
-// DeletedAtEQ applies the EQ predicate on the "deleted_at" field.
-func DeletedAtEQ(v time.Time) predicate.LabelRelationship {
-	return predicate.LabelRelationship(sql.FieldEQ(FieldDeletedAt, v))
-}
-
-// DeletedAtNEQ applies the NEQ predicate on the "deleted_at" field.
-func DeletedAtNEQ(v time.Time) predicate.LabelRelationship {
-	return predicate.LabelRelationship(sql.FieldNEQ(FieldDeletedAt, v))
-}
-
-// DeletedAtIn applies the In predicate on the "deleted_at" field.
-func DeletedAtIn(vs ...time.Time) predicate.LabelRelationship {
-	return predicate.LabelRelationship(sql.FieldIn(FieldDeletedAt, vs...))
-}
-
-// DeletedAtNotIn applies the NotIn predicate on the "deleted_at" field.
-func DeletedAtNotIn(vs ...time.Time) predicate.LabelRelationship {
-	return predicate.LabelRelationship(sql.FieldNotIn(FieldDeletedAt, vs...))
-}
-
-// DeletedAtGT applies the GT predicate on the "deleted_at" field.
-func DeletedAtGT(v time.Time) predicate.LabelRelationship {
-	return predicate.LabelRelationship(sql.FieldGT(FieldDeletedAt, v))
-}
-
-// DeletedAtGTE applies the GTE predicate on the "deleted_at" field.
-func DeletedAtGTE(v time.Time) predicate.LabelRelationship {
-	return predicate.LabelRelationship(sql.FieldGTE(FieldDeletedAt, v))
-}
-
-// DeletedAtLT applies the LT predicate on the "deleted_at" field.
-func DeletedAtLT(v time.Time) predicate.LabelRelationship {
-	return predicate.LabelRelationship(sql.FieldLT(FieldDeletedAt, v))
-}
-
-// DeletedAtLTE applies the LTE predicate on the "deleted_at" field.
-func DeletedAtLTE(v time.Time) predicate.LabelRelationship {
-	return predicate.LabelRelationship(sql.FieldLTE(FieldDeletedAt, v))
-}
-
-// DeletedAtIsNil applies the IsNil predicate on the "deleted_at" field.
-func DeletedAtIsNil() predicate.LabelRelationship {
-	return predicate.LabelRelationship(sql.FieldIsNull(FieldDeletedAt))
-}
-
-// DeletedAtNotNil applies the NotNil predicate on the "deleted_at" field.
-func DeletedAtNotNil() predicate.LabelRelationship {
-	return predicate.LabelRelationship(sql.FieldNotNull(FieldDeletedAt))
-}
-
 // LabelIDEQ applies the EQ predicate on the "label_id" field.
 func LabelIDEQ(v uint64) predicate.LabelRelationship {
 	return predicate.LabelRelationship(sql.FieldEQ(FieldLabelID, v))

+ 2 - 89
ent/labelrelationship_create.go

@@ -66,20 +66,6 @@ func (lrc *LabelRelationshipCreate) SetNillableStatus(u *uint8) *LabelRelationsh
 	return lrc
 }
 
-// SetDeletedAt sets the "deleted_at" field.
-func (lrc *LabelRelationshipCreate) SetDeletedAt(t time.Time) *LabelRelationshipCreate {
-	lrc.mutation.SetDeletedAt(t)
-	return lrc
-}
-
-// SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.
-func (lrc *LabelRelationshipCreate) SetNillableDeletedAt(t *time.Time) *LabelRelationshipCreate {
-	if t != nil {
-		lrc.SetDeletedAt(*t)
-	}
-	return lrc
-}
-
 // SetLabelID sets the "label_id" field.
 func (lrc *LabelRelationshipCreate) SetLabelID(u uint64) *LabelRelationshipCreate {
 	lrc.mutation.SetLabelID(u)
@@ -157,9 +143,7 @@ func (lrc *LabelRelationshipCreate) Mutation() *LabelRelationshipMutation {
 
 // Save creates the LabelRelationship in the database.
 func (lrc *LabelRelationshipCreate) Save(ctx context.Context) (*LabelRelationship, error) {
-	if err := lrc.defaults(); err != nil {
-		return nil, err
-	}
+	lrc.defaults()
 	return withHooks(ctx, lrc.sqlSave, lrc.mutation, lrc.hooks)
 }
 
@@ -186,18 +170,12 @@ func (lrc *LabelRelationshipCreate) ExecX(ctx context.Context) {
 }
 
 // defaults sets the default values of the builder before save.
-func (lrc *LabelRelationshipCreate) defaults() error {
+func (lrc *LabelRelationshipCreate) defaults() {
 	if _, ok := lrc.mutation.CreatedAt(); !ok {
-		if labelrelationship.DefaultCreatedAt == nil {
-			return fmt.Errorf("ent: uninitialized labelrelationship.DefaultCreatedAt (forgotten import ent/runtime?)")
-		}
 		v := labelrelationship.DefaultCreatedAt()
 		lrc.mutation.SetCreatedAt(v)
 	}
 	if _, ok := lrc.mutation.UpdatedAt(); !ok {
-		if labelrelationship.DefaultUpdatedAt == nil {
-			return fmt.Errorf("ent: uninitialized labelrelationship.DefaultUpdatedAt (forgotten import ent/runtime?)")
-		}
 		v := labelrelationship.DefaultUpdatedAt()
 		lrc.mutation.SetUpdatedAt(v)
 	}
@@ -217,7 +195,6 @@ func (lrc *LabelRelationshipCreate) defaults() error {
 		v := labelrelationship.DefaultOrganizationID
 		lrc.mutation.SetOrganizationID(v)
 	}
-	return nil
 }
 
 // check runs all checks and user-defined validators on the builder.
@@ -285,10 +262,6 @@ func (lrc *LabelRelationshipCreate) createSpec() (*LabelRelationship, *sqlgraph.
 		_spec.SetField(labelrelationship.FieldStatus, field.TypeUint8, value)
 		_node.Status = value
 	}
-	if value, ok := lrc.mutation.DeletedAt(); ok {
-		_spec.SetField(labelrelationship.FieldDeletedAt, field.TypeTime, value)
-		_node.DeletedAt = value
-	}
 	if value, ok := lrc.mutation.OrganizationID(); ok {
 		_spec.SetField(labelrelationship.FieldOrganizationID, field.TypeUint64, value)
 		_node.OrganizationID = value
@@ -415,24 +388,6 @@ func (u *LabelRelationshipUpsert) ClearStatus() *LabelRelationshipUpsert {
 	return u
 }
 
-// SetDeletedAt sets the "deleted_at" field.
-func (u *LabelRelationshipUpsert) SetDeletedAt(v time.Time) *LabelRelationshipUpsert {
-	u.Set(labelrelationship.FieldDeletedAt, v)
-	return u
-}
-
-// UpdateDeletedAt sets the "deleted_at" field to the value that was provided on create.
-func (u *LabelRelationshipUpsert) UpdateDeletedAt() *LabelRelationshipUpsert {
-	u.SetExcluded(labelrelationship.FieldDeletedAt)
-	return u
-}
-
-// ClearDeletedAt clears the value of the "deleted_at" field.
-func (u *LabelRelationshipUpsert) ClearDeletedAt() *LabelRelationshipUpsert {
-	u.SetNull(labelrelationship.FieldDeletedAt)
-	return u
-}
-
 // SetLabelID sets the "label_id" field.
 func (u *LabelRelationshipUpsert) SetLabelID(v uint64) *LabelRelationshipUpsert {
 	u.Set(labelrelationship.FieldLabelID, v)
@@ -574,27 +529,6 @@ func (u *LabelRelationshipUpsertOne) ClearStatus() *LabelRelationshipUpsertOne {
 	})
 }
 
-// SetDeletedAt sets the "deleted_at" field.
-func (u *LabelRelationshipUpsertOne) SetDeletedAt(v time.Time) *LabelRelationshipUpsertOne {
-	return u.Update(func(s *LabelRelationshipUpsert) {
-		s.SetDeletedAt(v)
-	})
-}
-
-// UpdateDeletedAt sets the "deleted_at" field to the value that was provided on create.
-func (u *LabelRelationshipUpsertOne) UpdateDeletedAt() *LabelRelationshipUpsertOne {
-	return u.Update(func(s *LabelRelationshipUpsert) {
-		s.UpdateDeletedAt()
-	})
-}
-
-// ClearDeletedAt clears the value of the "deleted_at" field.
-func (u *LabelRelationshipUpsertOne) ClearDeletedAt() *LabelRelationshipUpsertOne {
-	return u.Update(func(s *LabelRelationshipUpsert) {
-		s.ClearDeletedAt()
-	})
-}
-
 // SetLabelID sets the "label_id" field.
 func (u *LabelRelationshipUpsertOne) SetLabelID(v uint64) *LabelRelationshipUpsertOne {
 	return u.Update(func(s *LabelRelationshipUpsert) {
@@ -910,27 +844,6 @@ func (u *LabelRelationshipUpsertBulk) ClearStatus() *LabelRelationshipUpsertBulk
 	})
 }
 
-// SetDeletedAt sets the "deleted_at" field.
-func (u *LabelRelationshipUpsertBulk) SetDeletedAt(v time.Time) *LabelRelationshipUpsertBulk {
-	return u.Update(func(s *LabelRelationshipUpsert) {
-		s.SetDeletedAt(v)
-	})
-}
-
-// UpdateDeletedAt sets the "deleted_at" field to the value that was provided on create.
-func (u *LabelRelationshipUpsertBulk) UpdateDeletedAt() *LabelRelationshipUpsertBulk {
-	return u.Update(func(s *LabelRelationshipUpsert) {
-		s.UpdateDeletedAt()
-	})
-}
-
-// ClearDeletedAt clears the value of the "deleted_at" field.
-func (u *LabelRelationshipUpsertBulk) ClearDeletedAt() *LabelRelationshipUpsertBulk {
-	return u.Update(func(s *LabelRelationshipUpsert) {
-		s.ClearDeletedAt()
-	})
-}
-
 // SetLabelID sets the "label_id" field.
 func (u *LabelRelationshipUpsertBulk) SetLabelID(v uint64) *LabelRelationshipUpsertBulk {
 	return u.Update(func(s *LabelRelationshipUpsert) {

+ 4 - 68
ent/labelrelationship_update.go

@@ -63,26 +63,6 @@ func (lru *LabelRelationshipUpdate) ClearStatus() *LabelRelationshipUpdate {
 	return lru
 }
 
-// SetDeletedAt sets the "deleted_at" field.
-func (lru *LabelRelationshipUpdate) SetDeletedAt(t time.Time) *LabelRelationshipUpdate {
-	lru.mutation.SetDeletedAt(t)
-	return lru
-}
-
-// SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.
-func (lru *LabelRelationshipUpdate) SetNillableDeletedAt(t *time.Time) *LabelRelationshipUpdate {
-	if t != nil {
-		lru.SetDeletedAt(*t)
-	}
-	return lru
-}
-
-// ClearDeletedAt clears the value of the "deleted_at" field.
-func (lru *LabelRelationshipUpdate) ClearDeletedAt() *LabelRelationshipUpdate {
-	lru.mutation.ClearDeletedAt()
-	return lru
-}
-
 // SetLabelID sets the "label_id" field.
 func (lru *LabelRelationshipUpdate) SetLabelID(u uint64) *LabelRelationshipUpdate {
 	lru.mutation.SetLabelID(u)
@@ -179,9 +159,7 @@ func (lru *LabelRelationshipUpdate) ClearLabels() *LabelRelationshipUpdate {
 
 // Save executes the query and returns the number of nodes affected by the update operation.
 func (lru *LabelRelationshipUpdate) Save(ctx context.Context) (int, error) {
-	if err := lru.defaults(); err != nil {
-		return 0, err
-	}
+	lru.defaults()
 	return withHooks(ctx, lru.sqlSave, lru.mutation, lru.hooks)
 }
 
@@ -208,15 +186,11 @@ func (lru *LabelRelationshipUpdate) ExecX(ctx context.Context) {
 }
 
 // defaults sets the default values of the builder before save.
-func (lru *LabelRelationshipUpdate) defaults() error {
+func (lru *LabelRelationshipUpdate) defaults() {
 	if _, ok := lru.mutation.UpdatedAt(); !ok {
-		if labelrelationship.UpdateDefaultUpdatedAt == nil {
-			return fmt.Errorf("ent: uninitialized labelrelationship.UpdateDefaultUpdatedAt (forgotten import ent/runtime?)")
-		}
 		v := labelrelationship.UpdateDefaultUpdatedAt()
 		lru.mutation.SetUpdatedAt(v)
 	}
-	return nil
 }
 
 // check runs all checks and user-defined validators on the builder.
@@ -254,12 +228,6 @@ func (lru *LabelRelationshipUpdate) sqlSave(ctx context.Context) (n int, err err
 	if lru.mutation.StatusCleared() {
 		_spec.ClearField(labelrelationship.FieldStatus, field.TypeUint8)
 	}
-	if value, ok := lru.mutation.DeletedAt(); ok {
-		_spec.SetField(labelrelationship.FieldDeletedAt, field.TypeTime, value)
-	}
-	if lru.mutation.DeletedAtCleared() {
-		_spec.ClearField(labelrelationship.FieldDeletedAt, field.TypeTime)
-	}
 	if value, ok := lru.mutation.OrganizationID(); ok {
 		_spec.SetField(labelrelationship.FieldOrganizationID, field.TypeUint64, value)
 	}
@@ -380,26 +348,6 @@ func (lruo *LabelRelationshipUpdateOne) ClearStatus() *LabelRelationshipUpdateOn
 	return lruo
 }
 
-// SetDeletedAt sets the "deleted_at" field.
-func (lruo *LabelRelationshipUpdateOne) SetDeletedAt(t time.Time) *LabelRelationshipUpdateOne {
-	lruo.mutation.SetDeletedAt(t)
-	return lruo
-}
-
-// SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.
-func (lruo *LabelRelationshipUpdateOne) SetNillableDeletedAt(t *time.Time) *LabelRelationshipUpdateOne {
-	if t != nil {
-		lruo.SetDeletedAt(*t)
-	}
-	return lruo
-}
-
-// ClearDeletedAt clears the value of the "deleted_at" field.
-func (lruo *LabelRelationshipUpdateOne) ClearDeletedAt() *LabelRelationshipUpdateOne {
-	lruo.mutation.ClearDeletedAt()
-	return lruo
-}
-
 // SetLabelID sets the "label_id" field.
 func (lruo *LabelRelationshipUpdateOne) SetLabelID(u uint64) *LabelRelationshipUpdateOne {
 	lruo.mutation.SetLabelID(u)
@@ -509,9 +457,7 @@ func (lruo *LabelRelationshipUpdateOne) Select(field string, fields ...string) *
 
 // Save executes the query and returns the updated LabelRelationship entity.
 func (lruo *LabelRelationshipUpdateOne) Save(ctx context.Context) (*LabelRelationship, error) {
-	if err := lruo.defaults(); err != nil {
-		return nil, err
-	}
+	lruo.defaults()
 	return withHooks(ctx, lruo.sqlSave, lruo.mutation, lruo.hooks)
 }
 
@@ -538,15 +484,11 @@ func (lruo *LabelRelationshipUpdateOne) ExecX(ctx context.Context) {
 }
 
 // defaults sets the default values of the builder before save.
-func (lruo *LabelRelationshipUpdateOne) defaults() error {
+func (lruo *LabelRelationshipUpdateOne) defaults() {
 	if _, ok := lruo.mutation.UpdatedAt(); !ok {
-		if labelrelationship.UpdateDefaultUpdatedAt == nil {
-			return fmt.Errorf("ent: uninitialized labelrelationship.UpdateDefaultUpdatedAt (forgotten import ent/runtime?)")
-		}
 		v := labelrelationship.UpdateDefaultUpdatedAt()
 		lruo.mutation.SetUpdatedAt(v)
 	}
-	return nil
 }
 
 // check runs all checks and user-defined validators on the builder.
@@ -601,12 +543,6 @@ func (lruo *LabelRelationshipUpdateOne) sqlSave(ctx context.Context) (_node *Lab
 	if lruo.mutation.StatusCleared() {
 		_spec.ClearField(labelrelationship.FieldStatus, field.TypeUint8)
 	}
-	if value, ok := lruo.mutation.DeletedAt(); ok {
-		_spec.SetField(labelrelationship.FieldDeletedAt, field.TypeTime, value)
-	}
-	if lruo.mutation.DeletedAtCleared() {
-		_spec.ClearField(labelrelationship.FieldDeletedAt, field.TypeTime)
-	}
 	if value, ok := lruo.mutation.OrganizationID(); ok {
 		_spec.SetField(labelrelationship.FieldOrganizationID, field.TypeUint64, value)
 	}

+ 3 - 4
ent/migrate/schema.go

@@ -626,7 +626,6 @@ var (
 		{Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
 		{Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
 		{Name: "status", Type: field.TypeUint8, Nullable: true, Comment: "Status 1: normal 2: ban | 状态 1 正常 2 禁用", Default: 1},
-		{Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"},
 		{Name: "organization_id", Type: field.TypeUint64, Nullable: true, Comment: "机构 ID", Default: 1},
 		{Name: "contact_id", Type: field.TypeUint64, Comment: "联系人 ID", Default: 1},
 		{Name: "label_id", Type: field.TypeUint64, Comment: "标签 ID", Default: 1},
@@ -639,13 +638,13 @@ var (
 		ForeignKeys: []*schema.ForeignKey{
 			{
 				Symbol:     "label_relationship_contact_contact_relationships",
-				Columns:    []*schema.Column{LabelRelationshipColumns[6]},
+				Columns:    []*schema.Column{LabelRelationshipColumns[5]},
 				RefColumns: []*schema.Column{ContactColumns[0]},
 				OnDelete:   schema.NoAction,
 			},
 			{
 				Symbol:     "label_relationship_label_label_relationships",
-				Columns:    []*schema.Column{LabelRelationshipColumns[7]},
+				Columns:    []*schema.Column{LabelRelationshipColumns[6]},
 				RefColumns: []*schema.Column{LabelColumns[0]},
 				OnDelete:   schema.NoAction,
 			},
@@ -654,7 +653,7 @@ var (
 			{
 				Name:    "u_label_contact",
 				Unique:  true,
-				Columns: []*schema.Column{LabelRelationshipColumns[7], LabelRelationshipColumns[6]},
+				Columns: []*schema.Column{LabelRelationshipColumns[6], LabelRelationshipColumns[5]},
 			},
 		},
 	}

+ 1 - 74
ent/mutation.go

@@ -24249,7 +24249,6 @@ type LabelRelationshipMutation struct {
 	updated_at         *time.Time
 	status             *uint8
 	addstatus          *int8
-	deleted_at         *time.Time
 	organization_id    *uint64
 	addorganization_id *int64
 	clearedFields      map[string]struct{}
@@ -24508,55 +24507,6 @@ func (m *LabelRelationshipMutation) ResetStatus() {
 	delete(m.clearedFields, labelrelationship.FieldStatus)
 }
 
-// SetDeletedAt sets the "deleted_at" field.
-func (m *LabelRelationshipMutation) SetDeletedAt(t time.Time) {
-	m.deleted_at = &t
-}
-
-// DeletedAt returns the value of the "deleted_at" field in the mutation.
-func (m *LabelRelationshipMutation) DeletedAt() (r time.Time, exists bool) {
-	v := m.deleted_at
-	if v == nil {
-		return
-	}
-	return *v, true
-}
-
-// OldDeletedAt returns the old "deleted_at" field's value of the LabelRelationship entity.
-// If the LabelRelationship 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 *LabelRelationshipMutation) OldDeletedAt(ctx context.Context) (v time.Time, err error) {
-	if !m.op.Is(OpUpdateOne) {
-		return v, errors.New("OldDeletedAt is only allowed on UpdateOne operations")
-	}
-	if m.id == nil || m.oldValue == nil {
-		return v, errors.New("OldDeletedAt requires an ID field in the mutation")
-	}
-	oldValue, err := m.oldValue(ctx)
-	if err != nil {
-		return v, fmt.Errorf("querying old value for OldDeletedAt: %w", err)
-	}
-	return oldValue.DeletedAt, nil
-}
-
-// ClearDeletedAt clears the value of the "deleted_at" field.
-func (m *LabelRelationshipMutation) ClearDeletedAt() {
-	m.deleted_at = nil
-	m.clearedFields[labelrelationship.FieldDeletedAt] = struct{}{}
-}
-
-// DeletedAtCleared returns if the "deleted_at" field was cleared in this mutation.
-func (m *LabelRelationshipMutation) DeletedAtCleared() bool {
-	_, ok := m.clearedFields[labelrelationship.FieldDeletedAt]
-	return ok
-}
-
-// ResetDeletedAt resets all changes to the "deleted_at" field.
-func (m *LabelRelationshipMutation) ResetDeletedAt() {
-	m.deleted_at = nil
-	delete(m.clearedFields, labelrelationship.FieldDeletedAt)
-}
-
 // SetLabelID sets the "label_id" field.
 func (m *LabelRelationshipMutation) SetLabelID(u uint64) {
 	m.labels = &u
@@ -24813,7 +24763,7 @@ func (m *LabelRelationshipMutation) Type() string {
 // order to get all numeric fields that were incremented/decremented, call
 // AddedFields().
 func (m *LabelRelationshipMutation) Fields() []string {
-	fields := make([]string, 0, 7)
+	fields := make([]string, 0, 6)
 	if m.created_at != nil {
 		fields = append(fields, labelrelationship.FieldCreatedAt)
 	}
@@ -24823,9 +24773,6 @@ func (m *LabelRelationshipMutation) Fields() []string {
 	if m.status != nil {
 		fields = append(fields, labelrelationship.FieldStatus)
 	}
-	if m.deleted_at != nil {
-		fields = append(fields, labelrelationship.FieldDeletedAt)
-	}
 	if m.labels != nil {
 		fields = append(fields, labelrelationship.FieldLabelID)
 	}
@@ -24849,8 +24796,6 @@ func (m *LabelRelationshipMutation) Field(name string) (ent.Value, bool) {
 		return m.UpdatedAt()
 	case labelrelationship.FieldStatus:
 		return m.Status()
-	case labelrelationship.FieldDeletedAt:
-		return m.DeletedAt()
 	case labelrelationship.FieldLabelID:
 		return m.LabelID()
 	case labelrelationship.FieldContactID:
@@ -24872,8 +24817,6 @@ func (m *LabelRelationshipMutation) OldField(ctx context.Context, name string) (
 		return m.OldUpdatedAt(ctx)
 	case labelrelationship.FieldStatus:
 		return m.OldStatus(ctx)
-	case labelrelationship.FieldDeletedAt:
-		return m.OldDeletedAt(ctx)
 	case labelrelationship.FieldLabelID:
 		return m.OldLabelID(ctx)
 	case labelrelationship.FieldContactID:
@@ -24910,13 +24853,6 @@ func (m *LabelRelationshipMutation) SetField(name string, value ent.Value) error
 		}
 		m.SetStatus(v)
 		return nil
-	case labelrelationship.FieldDeletedAt:
-		v, ok := value.(time.Time)
-		if !ok {
-			return fmt.Errorf("unexpected type %T for field %s", value, name)
-		}
-		m.SetDeletedAt(v)
-		return nil
 	case labelrelationship.FieldLabelID:
 		v, ok := value.(uint64)
 		if !ok {
@@ -24998,9 +24934,6 @@ func (m *LabelRelationshipMutation) ClearedFields() []string {
 	if m.FieldCleared(labelrelationship.FieldStatus) {
 		fields = append(fields, labelrelationship.FieldStatus)
 	}
-	if m.FieldCleared(labelrelationship.FieldDeletedAt) {
-		fields = append(fields, labelrelationship.FieldDeletedAt)
-	}
 	if m.FieldCleared(labelrelationship.FieldOrganizationID) {
 		fields = append(fields, labelrelationship.FieldOrganizationID)
 	}
@@ -25021,9 +24954,6 @@ func (m *LabelRelationshipMutation) ClearField(name string) error {
 	case labelrelationship.FieldStatus:
 		m.ClearStatus()
 		return nil
-	case labelrelationship.FieldDeletedAt:
-		m.ClearDeletedAt()
-		return nil
 	case labelrelationship.FieldOrganizationID:
 		m.ClearOrganizationID()
 		return nil
@@ -25044,9 +24974,6 @@ func (m *LabelRelationshipMutation) ResetField(name string) error {
 	case labelrelationship.FieldStatus:
 		m.ResetStatus()
 		return nil
-	case labelrelationship.FieldDeletedAt:
-		m.ResetDeletedAt()
-		return nil
 	case labelrelationship.FieldLabelID:
 		m.ResetLabelID()
 		return nil

+ 0 - 4
ent/runtime/runtime.go

@@ -1028,10 +1028,6 @@ func init() {
 	// labellog.DefaultOrganizationID holds the default value on creation for the organization_id field.
 	labellog.DefaultOrganizationID = labellogDescOrganizationID.Default.(uint64)
 	labelrelationshipMixin := schema.LabelRelationship{}.Mixin()
-	labelrelationshipMixinHooks2 := labelrelationshipMixin[2].Hooks()
-	labelrelationship.Hooks[0] = labelrelationshipMixinHooks2[0]
-	labelrelationshipMixinInters2 := labelrelationshipMixin[2].Interceptors()
-	labelrelationship.Interceptors[0] = labelrelationshipMixinInters2[0]
 	labelrelationshipMixinFields0 := labelrelationshipMixin[0].Fields()
 	_ = labelrelationshipMixinFields0
 	labelrelationshipMixinFields1 := labelrelationshipMixin[1].Fields()

+ 0 - 2
ent/schema/label_relationship.go

@@ -8,7 +8,6 @@ import (
 	"entgo.io/ent/schema/field"
 	"entgo.io/ent/schema/index"
 	"github.com/suyuan32/simple-admin-common/orm/ent/mixins"
-	"wechat-api/ent/schema/localmixin"
 )
 
 type LabelRelationship struct {
@@ -33,7 +32,6 @@ func (LabelRelationship) Mixin() []ent.Mixin {
 	return []ent.Mixin{
 		mixins.IDMixin{},
 		mixins.StatusMixin{},
-		localmixin.SoftDeleteMixin{},
 	}
 }
 

+ 0 - 24
ent/set_not_nil.go

@@ -5408,30 +5408,6 @@ func (lr *LabelRelationshipCreate) SetNotNilStatus(value *uint8) *LabelRelations
 }
 
 // set field if value's pointer is not nil.
-func (lr *LabelRelationshipUpdate) SetNotNilDeletedAt(value *time.Time) *LabelRelationshipUpdate {
-	if value != nil {
-		return lr.SetDeletedAt(*value)
-	}
-	return lr
-}
-
-// set field if value's pointer is not nil.
-func (lr *LabelRelationshipUpdateOne) SetNotNilDeletedAt(value *time.Time) *LabelRelationshipUpdateOne {
-	if value != nil {
-		return lr.SetDeletedAt(*value)
-	}
-	return lr
-}
-
-// set field if value's pointer is not nil.
-func (lr *LabelRelationshipCreate) SetNotNilDeletedAt(value *time.Time) *LabelRelationshipCreate {
-	if value != nil {
-		return lr.SetDeletedAt(*value)
-	}
-	return lr
-}
-
-// set field if value's pointer is not nil.
 func (lr *LabelRelationshipUpdate) SetNotNilLabelID(value *uint64) *LabelRelationshipUpdate {
 	if value != nil {
 		return lr.SetLabelID(*value)