fix: 修复争议时间线表名映射
This commit is contained in:
@@ -26,7 +26,7 @@ const (
|
||||
// FieldCreatedAt holds the string denoting the created_at field in the database.
|
||||
FieldCreatedAt = "created_at"
|
||||
// Table holds the table name of the disputetimeline in the database.
|
||||
Table = "dispute_timelines"
|
||||
Table = "dispute_timeline"
|
||||
)
|
||||
|
||||
// Columns holds all SQL columns for disputetimeline fields.
|
||||
|
||||
@@ -3,13 +3,14 @@
|
||||
package migrate
|
||||
|
||||
import (
|
||||
"entgo.io/ent/dialect/entsql"
|
||||
"entgo.io/ent/dialect/sql/schema"
|
||||
"entgo.io/ent/schema/field"
|
||||
)
|
||||
|
||||
var (
|
||||
// DisputeTimelinesColumns holds the columns for the "dispute_timelines" table.
|
||||
DisputeTimelinesColumns = []*schema.Column{
|
||||
// DisputeTimelineColumns holds the columns for the "dispute_timeline" table.
|
||||
DisputeTimelineColumns = []*schema.Column{
|
||||
{Name: "id", Type: field.TypeInt64, Increment: true},
|
||||
{Name: "dispute_id", Type: field.TypeInt64},
|
||||
{Name: "event_type", Type: field.TypeString, Size: 30},
|
||||
@@ -18,16 +19,16 @@ var (
|
||||
{Name: "details", Type: field.TypeJSON, Nullable: true, SchemaType: map[string]string{"postgres": "jsonb"}},
|
||||
{Name: "created_at", Type: field.TypeTime},
|
||||
}
|
||||
// DisputeTimelinesTable holds the schema information for the "dispute_timelines" table.
|
||||
DisputeTimelinesTable = &schema.Table{
|
||||
Name: "dispute_timelines",
|
||||
Columns: DisputeTimelinesColumns,
|
||||
PrimaryKey: []*schema.Column{DisputeTimelinesColumns[0]},
|
||||
// DisputeTimelineTable holds the schema information for the "dispute_timeline" table.
|
||||
DisputeTimelineTable = &schema.Table{
|
||||
Name: "dispute_timeline",
|
||||
Columns: DisputeTimelineColumns,
|
||||
PrimaryKey: []*schema.Column{DisputeTimelineColumns[0]},
|
||||
Indexes: []*schema.Index{
|
||||
{
|
||||
Name: "disputetimeline_dispute_id_created_at",
|
||||
Unique: false,
|
||||
Columns: []*schema.Column{DisputeTimelinesColumns[1], DisputeTimelinesColumns[6]},
|
||||
Columns: []*schema.Column{DisputeTimelineColumns[1], DisputeTimelineColumns[6]},
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -86,10 +87,13 @@ var (
|
||||
}
|
||||
// Tables holds all the tables in the schema.
|
||||
Tables = []*schema.Table{
|
||||
DisputeTimelinesTable,
|
||||
DisputeTimelineTable,
|
||||
DisputesTable,
|
||||
}
|
||||
)
|
||||
|
||||
func init() {
|
||||
DisputeTimelineTable.Annotation = &entsql.Annotation{
|
||||
Table: "dispute_timeline",
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,8 @@ import (
|
||||
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/dialect"
|
||||
"entgo.io/ent/dialect/entsql"
|
||||
"entgo.io/ent/schema"
|
||||
"entgo.io/ent/schema/field"
|
||||
"entgo.io/ent/schema/index"
|
||||
)
|
||||
@@ -13,6 +15,12 @@ type DisputeTimeline struct {
|
||||
ent.Schema
|
||||
}
|
||||
|
||||
func (DisputeTimeline) Annotations() []schema.Annotation {
|
||||
return []schema.Annotation{
|
||||
entsql.Table("dispute_timeline"),
|
||||
}
|
||||
}
|
||||
|
||||
func (DisputeTimeline) Fields() []ent.Field {
|
||||
return []ent.Field{
|
||||
field.Int64("id").Unique().Immutable(),
|
||||
|
||||
Reference in New Issue
Block a user