初始化2

This commit is contained in:
SunYF
2026-08-28 15:06:01 +08:00
parent b34325a16f
commit a9c3fbeb41
537 changed files with 176215 additions and 17 deletions
+64
View File
@@ -0,0 +1,64 @@
// Code generated by ent, DO NOT EDIT.
package migrate
import (
"context"
"fmt"
"io"
"entgo.io/ent/dialect"
"entgo.io/ent/dialect/sql/schema"
)
var (
// WithGlobalUniqueID sets the universal ids options to the migration.
// If this option is enabled, ent migration will allocate a 1<<32 range
// for the ids of each entity (table).
// Note that this option cannot be applied on tables that already exist.
WithGlobalUniqueID = schema.WithGlobalUniqueID
// WithDropColumn sets the drop column option to the migration.
// If this option is enabled, ent migration will drop old columns
// that were used for both fields and edges. This defaults to false.
WithDropColumn = schema.WithDropColumn
// WithDropIndex sets the drop index option to the migration.
// If this option is enabled, ent migration will drop old indexes
// that were defined in the schema. This defaults to false.
// Note that unique constraints are defined using `UNIQUE INDEX`,
// and therefore, it's recommended to enable this option to get more
// flexibility in the schema changes.
WithDropIndex = schema.WithDropIndex
// WithForeignKeys enables creating foreign-key in schema DDL. This defaults to true.
WithForeignKeys = schema.WithForeignKeys
)
// Schema is the API for creating, migrating and dropping a schema.
type Schema struct {
drv dialect.Driver
}
// NewSchema creates a new schema client.
func NewSchema(drv dialect.Driver) *Schema { return &Schema{drv: drv} }
// Create creates all schema resources.
func (s *Schema) Create(ctx context.Context, opts ...schema.MigrateOption) error {
return Create(ctx, s, Tables, opts...)
}
// Create creates all table resources using the given schema driver.
func Create(ctx context.Context, s *Schema, tables []*schema.Table, opts ...schema.MigrateOption) error {
migrate, err := schema.NewMigrate(s.drv, opts...)
if err != nil {
return fmt.Errorf("ent/migrate: %w", err)
}
return migrate.Create(ctx, tables...)
}
// WriteTo writes the schema changes to w instead of running them against the database.
//
// if err := client.Schema.WriteTo(context.Background(), os.Stdout); err != nil {
// log.Fatal(err)
// }
func (s *Schema) WriteTo(ctx context.Context, w io.Writer, opts ...schema.MigrateOption) error {
return Create(ctx, &Schema{drv: &schema.WriteDriver{Writer: w, Driver: s.drv}}, Tables, opts...)
}
+775
View File
@@ -0,0 +1,775 @@
// Code generated by ent, DO NOT EDIT.
package migrate
import (
"entgo.io/ent/dialect/entsql"
"entgo.io/ent/dialect/sql/schema"
"entgo.io/ent/schema/field"
)
var (
// AssociationTraceColumns holds the columns for the "association_trace" table.
AssociationTraceColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
{Name: "finished_sn", Type: field.TypeString, Unique: true, Size: 64},
{Name: "order_no", Type: field.TypeString, Size: 64, Default: ""},
{Name: "process_code", Type: field.TypeString, Size: 64, Default: ""},
{Name: "batch_items", Type: field.TypeJSON, Nullable: true, SchemaType: map[string]string{"postgres": "jsonb"}},
{Name: "serial_items", Type: field.TypeJSON, Nullable: true, SchemaType: map[string]string{"postgres": "jsonb"}},
{Name: "operator", Type: field.TypeString, Size: 64, Default: ""},
{Name: "created_at", Type: field.TypeTime},
}
// AssociationTraceTable holds the schema information for the "association_trace" table.
AssociationTraceTable = &schema.Table{
Name: "association_trace",
Columns: AssociationTraceColumns,
PrimaryKey: []*schema.Column{AssociationTraceColumns[0]},
Indexes: []*schema.Index{
{
Name: "associationtrace_finished_sn",
Unique: true,
Columns: []*schema.Column{AssociationTraceColumns[1]},
},
},
}
// WorkOrderBomColumns holds the columns for the "work_order_bom" table.
WorkOrderBomColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
{Name: "work_order_no", Type: field.TypeString, Size: 64},
{Name: "material_code", Type: field.TypeString, Size: 64},
{Name: "material_name", Type: field.TypeString, Size: 128, Default: ""},
{Name: "spec", Type: field.TypeString, Size: 128, Default: ""},
{Name: "unit", Type: field.TypeString, Size: 16, Default: ""},
{Name: "manage_mode", Type: field.TypeString, Size: 10, Default: "2"},
{Name: "unit_qty", Type: field.TypeFloat64, Default: 0},
{Name: "loss_rate", Type: field.TypeFloat64, Default: 0},
{Name: "required_qty", Type: field.TypeFloat64, Default: 0},
{Name: "serial_sns", Type: field.TypeJSON, Nullable: true, SchemaType: map[string]string{"postgres": "jsonb"}},
{Name: "created_at", Type: field.TypeTime},
}
// WorkOrderBomTable holds the schema information for the "work_order_bom" table.
WorkOrderBomTable = &schema.Table{
Name: "work_order_bom",
Columns: WorkOrderBomColumns,
PrimaryKey: []*schema.Column{WorkOrderBomColumns[0]},
Indexes: []*schema.Index{
{
Name: "bomitem_work_order_no",
Unique: false,
Columns: []*schema.Column{WorkOrderBomColumns[1]},
},
{
Name: "bomitem_work_order_no_material_code",
Unique: true,
Columns: []*schema.Column{WorkOrderBomColumns[1], WorkOrderBomColumns[2]},
},
},
}
// DailyPlanColumns holds the columns for the "daily_plan" table.
DailyPlanColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
{Name: "order_no", Type: field.TypeString, Size: 64},
{Name: "plan_date", Type: field.TypeString, Size: 10},
{Name: "plan_qty", Type: field.TypeInt, Default: 0},
{Name: "completed_qty", Type: field.TypeInt, Default: 0},
{Name: "status", Type: field.TypeString, Size: 20, Default: "PENDING"},
{Name: "operator", Type: field.TypeString, Size: 64, Default: ""},
{Name: "created_at", Type: field.TypeTime},
{Name: "updated_at", Type: field.TypeTime, Nullable: true},
}
// DailyPlanTable holds the schema information for the "daily_plan" table.
DailyPlanTable = &schema.Table{
Name: "daily_plan",
Columns: DailyPlanColumns,
PrimaryKey: []*schema.Column{DailyPlanColumns[0]},
Indexes: []*schema.Index{
{
Name: "dailyplan_order_no",
Unique: false,
Columns: []*schema.Column{DailyPlanColumns[1]},
},
{
Name: "dailyplan_plan_date",
Unique: false,
Columns: []*schema.Column{DailyPlanColumns[2]},
},
{
Name: "dailyplan_plan_date_order_no",
Unique: true,
Columns: []*schema.Column{DailyPlanColumns[2], DailyPlanColumns[1]},
},
},
}
// EventLogColumns holds the columns for the "event_log" table.
EventLogColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
{Name: "event_type", Type: field.TypeString, Size: 50},
{Name: "work_order_no", Type: field.TypeString, Size: 64, Default: ""},
{Name: "operator", Type: field.TypeString, Size: 64, Default: ""},
{Name: "entity_type", Type: field.TypeString, Size: 30, Default: ""},
{Name: "entity_id", Type: field.TypeString, Size: 50, Default: ""},
{Name: "description", Type: field.TypeString, Size: 2147483647, Default: ""},
{Name: "payload", Type: field.TypeJSON, Nullable: true, SchemaType: map[string]string{"postgres": "jsonb"}},
{Name: "created_at", Type: field.TypeTime},
}
// EventLogTable holds the schema information for the "event_log" table.
EventLogTable = &schema.Table{
Name: "event_log",
Columns: EventLogColumns,
PrimaryKey: []*schema.Column{EventLogColumns[0]},
Indexes: []*schema.Index{
{
Name: "eventlog_event_type",
Unique: false,
Columns: []*schema.Column{EventLogColumns[1]},
},
{
Name: "eventlog_work_order_no",
Unique: false,
Columns: []*schema.Column{EventLogColumns[2]},
},
{
Name: "eventlog_operator",
Unique: false,
Columns: []*schema.Column{EventLogColumns[3]},
},
{
Name: "eventlog_created_at",
Unique: false,
Columns: []*schema.Column{EventLogColumns[8]},
},
},
}
// MaterialRequestColumns holds the columns for the "material_request" table.
MaterialRequestColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
{Name: "request_no", Type: field.TypeString, Size: 64},
{Name: "order_no", Type: field.TypeString, Size: 64},
{Name: "plan_date", Type: field.TypeString, Size: 10},
{Name: "material_code", Type: field.TypeString, Size: 64},
{Name: "material_name", Type: field.TypeString, Size: 128, Default: ""},
{Name: "unit", Type: field.TypeString, Size: 16, Default: ""},
{Name: "manage_mode", Type: field.TypeString, Size: 10, Default: "2"},
{Name: "req_qty", Type: field.TypeFloat64, Default: 0},
{Name: "status", Type: field.TypeString, Size: 20, Default: "PENDING"},
{Name: "target_dock", Type: field.TypeString, Size: 20, Default: ""},
{Name: "operator", Type: field.TypeString, Size: 64, Default: ""},
{Name: "created_at", Type: field.TypeTime},
{Name: "updated_at", Type: field.TypeTime, Nullable: true},
}
// MaterialRequestTable holds the schema information for the "material_request" table.
MaterialRequestTable = &schema.Table{
Name: "material_request",
Columns: MaterialRequestColumns,
PrimaryKey: []*schema.Column{MaterialRequestColumns[0]},
Indexes: []*schema.Index{
{
Name: "materialrequest_order_no",
Unique: false,
Columns: []*schema.Column{MaterialRequestColumns[2]},
},
{
Name: "materialrequest_material_code",
Unique: false,
Columns: []*schema.Column{MaterialRequestColumns[4]},
},
{
Name: "materialrequest_status",
Unique: false,
Columns: []*schema.Column{MaterialRequestColumns[9]},
},
},
}
// PermissionColumns holds the columns for the "permission" table.
PermissionColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
{Name: "code", Type: field.TypeString, Unique: true, Size: 64},
{Name: "name", Type: field.TypeString, Size: 64},
{Name: "type", Type: field.TypeString, Size: 20, Default: "MENU"},
{Name: "path", Type: field.TypeString, Size: 128, Default: ""},
{Name: "icon", Type: field.TypeString, Size: 64, Default: ""},
{Name: "sort", Type: field.TypeInt, Nullable: true, Default: 0},
{Name: "remark", Type: field.TypeString, Size: 255, Default: ""},
{Name: "created_at", Type: field.TypeTime},
}
// PermissionTable holds the schema information for the "permission" table.
PermissionTable = &schema.Table{
Name: "permission",
Columns: PermissionColumns,
PrimaryKey: []*schema.Column{PermissionColumns[0]},
Indexes: []*schema.Index{
{
Name: "permission_code",
Unique: true,
Columns: []*schema.Column{PermissionColumns[1]},
},
},
}
// PlcSendLogColumns holds the columns for the "plc_send_log" table.
PlcSendLogColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
{Name: "order_no", Type: field.TypeString, Size: 64, Default: ""},
{Name: "sn", Type: field.TypeString, Size: 64, Default: ""},
{Name: "station_no", Type: field.TypeInt, Nullable: true},
{Name: "process_combination", Type: field.TypeString, Size: 64, Default: ""},
{Name: "process_codes", Type: field.TypeJSON, Nullable: true},
{Name: "status", Type: field.TypeString, Size: 20, Default: "PENDING"},
{Name: "send_time", Type: field.TypeTime, Nullable: true},
{Name: "done_time", Type: field.TypeTime, Nullable: true},
{Name: "ack", Type: field.TypeBool, Default: false},
{Name: "remark", Type: field.TypeString, Size: 255, Default: ""},
{Name: "operator", Type: field.TypeString, Size: 64, Default: ""},
{Name: "created_at", Type: field.TypeTime},
}
// PlcSendLogTable holds the schema information for the "plc_send_log" table.
PlcSendLogTable = &schema.Table{
Name: "plc_send_log",
Columns: PlcSendLogColumns,
PrimaryKey: []*schema.Column{PlcSendLogColumns[0]},
Indexes: []*schema.Index{
{
Name: "plcsendlog_order_no",
Unique: false,
Columns: []*schema.Column{PlcSendLogColumns[1]},
},
{
Name: "plcsendlog_sn",
Unique: false,
Columns: []*schema.Column{PlcSendLogColumns[2]},
},
{
Name: "plcsendlog_status",
Unique: false,
Columns: []*schema.Column{PlcSendLogColumns[6]},
},
},
}
// ProcessStepColumns holds the columns for the "process_step" table.
ProcessStepColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
{Name: "process_code", Type: field.TypeInt},
{Name: "seq", Type: field.TypeInt, Default: 1},
{Name: "name", Type: field.TypeString, Size: 128},
{Name: "collect_type", Type: field.TypeString, Size: 20, Default: "NONE"},
{Name: "is_torque", Type: field.TypeBool, Default: false},
{Name: "remark", Type: field.TypeString, Size: 255, Default: ""},
{Name: "created_at", Type: field.TypeTime},
}
// ProcessStepTable holds the schema information for the "process_step" table.
ProcessStepTable = &schema.Table{
Name: "process_step",
Columns: ProcessStepColumns,
PrimaryKey: []*schema.Column{ProcessStepColumns[0]},
Indexes: []*schema.Index{
{
Name: "processstep_process_code",
Unique: false,
Columns: []*schema.Column{ProcessStepColumns[1]},
},
},
}
// ProductTypeColumns holds the columns for the "product_type" table.
ProductTypeColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
{Name: "name", Type: field.TypeString, Size: 50},
{Name: "code", Type: field.TypeString, Size: 20},
{Name: "category", Type: field.TypeString, Size: 30, Default: ""},
{Name: "remark", Type: field.TypeString, Size: 255, Default: ""},
{Name: "is_active", Type: field.TypeBool, Default: true},
{Name: "created_at", Type: field.TypeTime},
{Name: "updated_at", Type: field.TypeTime, Nullable: true},
}
// ProductTypeTable holds the schema information for the "product_type" table.
ProductTypeTable = &schema.Table{
Name: "product_type",
Columns: ProductTypeColumns,
PrimaryKey: []*schema.Column{ProductTypeColumns[0]},
Indexes: []*schema.Index{
{
Name: "producttype_code",
Unique: false,
Columns: []*schema.Column{ProductTypeColumns[2]},
},
{
Name: "producttype_is_active",
Unique: false,
Columns: []*schema.Column{ProductTypeColumns[5]},
},
},
}
// RoleColumns holds the columns for the "role" table.
RoleColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
{Name: "name", Type: field.TypeString, Size: 64},
{Name: "code", Type: field.TypeString, Unique: true, Size: 64},
{Name: "remark", Type: field.TypeString, Size: 255, Default: ""},
{Name: "permission_codes", Type: field.TypeJSON, Nullable: true, SchemaType: map[string]string{"postgres": "jsonb"}},
{Name: "created_at", Type: field.TypeTime},
}
// RoleTable holds the schema information for the "role" table.
RoleTable = &schema.Table{
Name: "role",
Columns: RoleColumns,
PrimaryKey: []*schema.Column{RoleColumns[0]},
Indexes: []*schema.Index{
{
Name: "role_code",
Unique: true,
Columns: []*schema.Column{RoleColumns[2]},
},
},
}
// ScanRecordColumns holds the columns for the "scan_record" table.
ScanRecordColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
{Name: "station", Type: field.TypeString, Size: 32, Default: ""},
{Name: "sn", Type: field.TypeString, Size: 64},
{Name: "order_no", Type: field.TypeString, Size: 64, Default: ""},
{Name: "type", Type: field.TypeString, Size: 20, Default: "PROCESS"},
{Name: "process_code", Type: field.TypeInt, Nullable: true},
{Name: "operator", Type: field.TypeString, Size: 64, Default: ""},
{Name: "time", Type: field.TypeTime},
{Name: "created_at", Type: field.TypeTime},
}
// ScanRecordTable holds the schema information for the "scan_record" table.
ScanRecordTable = &schema.Table{
Name: "scan_record",
Columns: ScanRecordColumns,
PrimaryKey: []*schema.Column{ScanRecordColumns[0]},
Indexes: []*schema.Index{
{
Name: "scanrecord_station",
Unique: false,
Columns: []*schema.Column{ScanRecordColumns[1]},
},
{
Name: "scanrecord_sn",
Unique: false,
Columns: []*schema.Column{ScanRecordColumns[2]},
},
{
Name: "scanrecord_order_no",
Unique: false,
Columns: []*schema.Column{ScanRecordColumns[3]},
},
{
Name: "scanrecord_created_at",
Unique: false,
Columns: []*schema.Column{ScanRecordColumns[8]},
},
},
}
// SemiFlowColumns holds the columns for the "semi_flow" table.
SemiFlowColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
{Name: "sn", Type: field.TypeString, Size: 64},
{Name: "order_no", Type: field.TypeString, Size: 64, Default: ""},
{Name: "done_process_codes", Type: field.TypeJSON, Nullable: true},
{Name: "action", Type: field.TypeString, Size: 20, Default: "INBOUND"},
{Name: "target_dock", Type: field.TypeString, Size: 20, Default: ""},
{Name: "operator", Type: field.TypeString, Size: 64, Default: ""},
{Name: "created_at", Type: field.TypeTime},
}
// SemiFlowTable holds the schema information for the "semi_flow" table.
SemiFlowTable = &schema.Table{
Name: "semi_flow",
Columns: SemiFlowColumns,
PrimaryKey: []*schema.Column{SemiFlowColumns[0]},
Indexes: []*schema.Index{
{
Name: "semiflow_sn",
Unique: false,
Columns: []*schema.Column{SemiFlowColumns[1]},
},
{
Name: "semiflow_order_no",
Unique: false,
Columns: []*schema.Column{SemiFlowColumns[2]},
},
{
Name: "semiflow_action",
Unique: false,
Columns: []*schema.Column{SemiFlowColumns[4]},
},
},
}
// StationProcessColumns holds the columns for the "station_process" table.
StationProcessColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
{Name: "station_no", Type: field.TypeInt},
{Name: "process_code", Type: field.TypeInt},
{Name: "effect_date", Type: field.TypeString, Size: 10, Default: ""},
{Name: "shift", Type: field.TypeString, Size: 20, Default: ""},
{Name: "operator", Type: field.TypeString, Size: 64, Default: ""},
{Name: "created_at", Type: field.TypeTime},
}
// StationProcessTable holds the schema information for the "station_process" table.
StationProcessTable = &schema.Table{
Name: "station_process",
Columns: StationProcessColumns,
PrimaryKey: []*schema.Column{StationProcessColumns[0]},
Indexes: []*schema.Index{
{
Name: "stationprocess_station_no",
Unique: false,
Columns: []*schema.Column{StationProcessColumns[1]},
},
{
Name: "stationprocess_effect_date",
Unique: false,
Columns: []*schema.Column{StationProcessColumns[3]},
},
{
Name: "stationprocess_station_no_effect_date",
Unique: false,
Columns: []*schema.Column{StationProcessColumns[1], StationProcessColumns[3]},
},
},
}
// StepCriterionColumns holds the columns for the "step_criterion" table.
StepCriterionColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
{Name: "step_id", Type: field.TypeInt},
{Name: "name", Type: field.TypeString, Size: 64},
{Name: "unit", Type: field.TypeString, Size: 16, Default: ""},
{Name: "logic", Type: field.TypeString, Size: 16, Default: "NONE"},
{Name: "target", Type: field.TypeFloat64, Default: 0},
{Name: "min", Type: field.TypeFloat64, Nullable: true},
{Name: "max", Type: field.TypeFloat64, Nullable: true},
{Name: "created_at", Type: field.TypeTime},
}
// StepCriterionTable holds the schema information for the "step_criterion" table.
StepCriterionTable = &schema.Table{
Name: "step_criterion",
Columns: StepCriterionColumns,
PrimaryKey: []*schema.Column{StepCriterionColumns[0]},
Indexes: []*schema.Index{
{
Name: "stepcriterion_step_id",
Unique: false,
Columns: []*schema.Column{StepCriterionColumns[1]},
},
},
}
// StepDataColumns holds the columns for the "step_data" table.
StepDataColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
{Name: "sn", Type: field.TypeString, Size: 64},
{Name: "process_id", Type: field.TypeInt, Nullable: true},
{Name: "step_id", Type: field.TypeInt},
{Name: "step_name", Type: field.TypeString, Size: 128, Default: ""},
{Name: "criterion_id", Type: field.TypeInt, Nullable: true},
{Name: "criterion_name", Type: field.TypeString, Size: 64, Default: ""},
{Name: "criterion_logic", Type: field.TypeString, Size: 16, Default: "NONE"},
{Name: "value", Type: field.TypeFloat64, Default: 0},
{Name: "value_text", Type: field.TypeString, Size: 64, Default: ""},
{Name: "is_ok", Type: field.TypeBool, Default: true},
{Name: "operator", Type: field.TypeString, Size: 64, Default: ""},
{Name: "created_at", Type: field.TypeTime},
}
// StepDataTable holds the schema information for the "step_data" table.
StepDataTable = &schema.Table{
Name: "step_data",
Columns: StepDataColumns,
PrimaryKey: []*schema.Column{StepDataColumns[0]},
Indexes: []*schema.Index{
{
Name: "stepdata_sn",
Unique: false,
Columns: []*schema.Column{StepDataColumns[1]},
},
{
Name: "stepdata_process_id",
Unique: false,
Columns: []*schema.Column{StepDataColumns[2]},
},
{
Name: "stepdata_step_id",
Unique: false,
Columns: []*schema.Column{StepDataColumns[3]},
},
},
}
// TorqueRecordColumns holds the columns for the "torque_record" table.
TorqueRecordColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
{Name: "work_order_no", Type: field.TypeString, Size: 64, Default: ""},
{Name: "sn", Type: field.TypeString, Size: 64},
{Name: "screw_no", Type: field.TypeString, Size: 32, Default: ""},
{Name: "strain", Type: field.TypeFloat64, Default: 0},
{Name: "torque", Type: field.TypeFloat64, Default: 0},
{Name: "angle", Type: field.TypeFloat64, Default: 0},
{Name: "result", Type: field.TypeString, Size: 10, Default: "OK"},
{Name: "operator", Type: field.TypeString, Size: 64, Default: ""},
{Name: "station_no", Type: field.TypeString, Size: 32, Default: ""},
{Name: "time", Type: field.TypeTime},
{Name: "created_at", Type: field.TypeTime},
}
// TorqueRecordTable holds the schema information for the "torque_record" table.
TorqueRecordTable = &schema.Table{
Name: "torque_record",
Columns: TorqueRecordColumns,
PrimaryKey: []*schema.Column{TorqueRecordColumns[0]},
Indexes: []*schema.Index{
{
Name: "torquerecord_sn",
Unique: false,
Columns: []*schema.Column{TorqueRecordColumns[2]},
},
{
Name: "torquerecord_work_order_no",
Unique: false,
Columns: []*schema.Column{TorqueRecordColumns[1]},
},
{
Name: "torquerecord_created_at",
Unique: false,
Columns: []*schema.Column{TorqueRecordColumns[11]},
},
{
Name: "torquerecord_time",
Unique: false,
Columns: []*schema.Column{TorqueRecordColumns[10]},
},
},
}
// UserColumns holds the columns for the "user" table.
UserColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
{Name: "username", Type: field.TypeString, Unique: true, Size: 64},
{Name: "password", Type: field.TypeString, Size: 128},
{Name: "name", Type: field.TypeString, Size: 64, Default: ""},
{Name: "role_id", Type: field.TypeInt, Nullable: true},
{Name: "status", Type: field.TypeString, Size: 20, Default: "ENABLED"},
{Name: "created_at", Type: field.TypeTime},
{Name: "updated_at", Type: field.TypeTime, Nullable: true},
}
// UserTable holds the schema information for the "user" table.
UserTable = &schema.Table{
Name: "user",
Columns: UserColumns,
PrimaryKey: []*schema.Column{UserColumns[0]},
Indexes: []*schema.Index{
{
Name: "user_username",
Unique: true,
Columns: []*schema.Column{UserColumns[1]},
},
{
Name: "user_role_id",
Unique: false,
Columns: []*schema.Column{UserColumns[4]},
},
},
}
// WorkOrderColumns holds the columns for the "work_order" table.
WorkOrderColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
{Name: "work_order_no", Type: field.TypeString, Size: 64},
{Name: "product_type_id", Type: field.TypeInt},
{Name: "product_code", Type: field.TypeString, Size: 64, Default: ""},
{Name: "product_name", Type: field.TypeString, Size: 128, Default: ""},
{Name: "quantity", Type: field.TypeInt, Default: 1},
{Name: "finished_num", Type: field.TypeInt, Default: 0},
{Name: "fail_num", Type: field.TypeInt, Default: 0},
{Name: "process_seq", Type: field.TypeString, Size: 64, Default: ""},
{Name: "status", Type: field.TypeString, Size: 20, Default: "CREATED"},
{Name: "plan_start", Type: field.TypeTime, Nullable: true},
{Name: "plan_end", Type: field.TypeTime, Nullable: true},
{Name: "context", Type: field.TypeJSON, Nullable: true, SchemaType: map[string]string{"postgres": "jsonb"}},
{Name: "completed_at", Type: field.TypeTime, Nullable: true},
{Name: "created_at", Type: field.TypeTime},
{Name: "updated_at", Type: field.TypeTime, Nullable: true},
}
// WorkOrderTable holds the schema information for the "work_order" table.
WorkOrderTable = &schema.Table{
Name: "work_order",
Columns: WorkOrderColumns,
PrimaryKey: []*schema.Column{WorkOrderColumns[0]},
Indexes: []*schema.Index{
{
Name: "workorder_work_order_no",
Unique: true,
Columns: []*schema.Column{WorkOrderColumns[1]},
},
{
Name: "workorder_status",
Unique: false,
Columns: []*schema.Column{WorkOrderColumns[9]},
},
{
Name: "workorder_product_type_id",
Unique: false,
Columns: []*schema.Column{WorkOrderColumns[2]},
},
},
}
// WorkpieceColumns holds the columns for the "workpiece" table.
WorkpieceColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
{Name: "sn", Type: field.TypeString, Unique: true, Size: 64},
{Name: "order_no", Type: field.TypeString, Size: 64, Default: ""},
{Name: "work_order_id", Type: field.TypeInt, Nullable: true},
{Name: "process_seq", Type: field.TypeString, Size: 64, Default: ""},
{Name: "current_process", Type: field.TypeInt, Nullable: true},
{Name: "status", Type: field.TypeString, Size: 20, Default: "ONLINE"},
{Name: "online_at", Type: field.TypeTime, Nullable: true},
{Name: "done_at", Type: field.TypeTime, Nullable: true},
{Name: "created_at", Type: field.TypeTime},
{Name: "updated_at", Type: field.TypeTime, Nullable: true},
}
// WorkpieceTable holds the schema information for the "workpiece" table.
WorkpieceTable = &schema.Table{
Name: "workpiece",
Columns: WorkpieceColumns,
PrimaryKey: []*schema.Column{WorkpieceColumns[0]},
Indexes: []*schema.Index{
{
Name: "workpiece_sn",
Unique: true,
Columns: []*schema.Column{WorkpieceColumns[1]},
},
{
Name: "workpiece_order_no",
Unique: false,
Columns: []*schema.Column{WorkpieceColumns[2]},
},
{
Name: "workpiece_status",
Unique: false,
Columns: []*schema.Column{WorkpieceColumns[6]},
},
},
}
// WorkpieceProcessColumns holds the columns for the "workpiece_process" table.
WorkpieceProcessColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
{Name: "sn", Type: field.TypeString, Size: 64},
{Name: "process_code", Type: field.TypeInt},
{Name: "station_no", Type: field.TypeString, Size: 32, Default: ""},
{Name: "order_no", Type: field.TypeString, Size: 64, Default: ""},
{Name: "process_name", Type: field.TypeString, Size: 64, Default: ""},
{Name: "status", Type: field.TypeString, Size: 20, Default: "DONE"},
{Name: "operator", Type: field.TypeString, Size: 64, Default: ""},
{Name: "result", Type: field.TypeString, Size: 10, Default: "OK"},
{Name: "started_at", Type: field.TypeTime, Nullable: true},
{Name: "ended_at", Type: field.TypeTime, Nullable: true},
{Name: "remark", Type: field.TypeString, Size: 255, Default: ""},
{Name: "created_at", Type: field.TypeTime},
}
// WorkpieceProcessTable holds the schema information for the "workpiece_process" table.
WorkpieceProcessTable = &schema.Table{
Name: "workpiece_process",
Columns: WorkpieceProcessColumns,
PrimaryKey: []*schema.Column{WorkpieceProcessColumns[0]},
Indexes: []*schema.Index{
{
Name: "workpieceprocess_sn",
Unique: false,
Columns: []*schema.Column{WorkpieceProcessColumns[1]},
},
{
Name: "workpieceprocess_sn_process_code",
Unique: false,
Columns: []*schema.Column{WorkpieceProcessColumns[1], WorkpieceProcessColumns[2]},
},
{
Name: "workpieceprocess_order_no",
Unique: false,
Columns: []*schema.Column{WorkpieceProcessColumns[4]},
},
{
Name: "workpieceprocess_station_no",
Unique: false,
Columns: []*schema.Column{WorkpieceProcessColumns[3]},
},
},
}
// Tables holds all the tables in the schema.
Tables = []*schema.Table{
AssociationTraceTable,
WorkOrderBomTable,
DailyPlanTable,
EventLogTable,
MaterialRequestTable,
PermissionTable,
PlcSendLogTable,
ProcessStepTable,
ProductTypeTable,
RoleTable,
ScanRecordTable,
SemiFlowTable,
StationProcessTable,
StepCriterionTable,
StepDataTable,
TorqueRecordTable,
UserTable,
WorkOrderTable,
WorkpieceTable,
WorkpieceProcessTable,
}
)
func init() {
AssociationTraceTable.Annotation = &entsql.Annotation{
Table: "association_trace",
}
WorkOrderBomTable.Annotation = &entsql.Annotation{
Table: "work_order_bom",
}
DailyPlanTable.Annotation = &entsql.Annotation{
Table: "daily_plan",
}
EventLogTable.Annotation = &entsql.Annotation{
Table: "event_log",
}
MaterialRequestTable.Annotation = &entsql.Annotation{
Table: "material_request",
}
PermissionTable.Annotation = &entsql.Annotation{
Table: "permission",
}
PlcSendLogTable.Annotation = &entsql.Annotation{
Table: "plc_send_log",
}
ProcessStepTable.Annotation = &entsql.Annotation{
Table: "process_step",
}
ProductTypeTable.Annotation = &entsql.Annotation{
Table: "product_type",
}
RoleTable.Annotation = &entsql.Annotation{
Table: "role",
}
ScanRecordTable.Annotation = &entsql.Annotation{
Table: "scan_record",
}
SemiFlowTable.Annotation = &entsql.Annotation{
Table: "semi_flow",
}
StationProcessTable.Annotation = &entsql.Annotation{
Table: "station_process",
}
StepCriterionTable.Annotation = &entsql.Annotation{
Table: "step_criterion",
}
StepDataTable.Annotation = &entsql.Annotation{
Table: "step_data",
}
TorqueRecordTable.Annotation = &entsql.Annotation{
Table: "torque_record",
}
UserTable.Annotation = &entsql.Annotation{
Table: "user",
}
WorkOrderTable.Annotation = &entsql.Annotation{
Table: "work_order",
}
WorkpieceTable.Annotation = &entsql.Annotation{
Table: "workpiece",
}
WorkpieceProcessTable.Annotation = &entsql.Annotation{
Table: "workpiece_process",
}
}