初始化
This commit is contained in:
@@ -1,96 +0,0 @@
|
||||
// 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...)
|
||||
}
|
||||
|
||||
// Diff compares the state read from a database connection or migration directory with
|
||||
// the state defined by the Ent schema. Changes will be written to new migration files.
|
||||
func Diff(ctx context.Context, url string, opts ...schema.MigrateOption) error {
|
||||
return NamedDiff(ctx, url, "changes", opts...)
|
||||
}
|
||||
|
||||
// NamedDiff compares the state read from a database connection or migration directory with
|
||||
// the state defined by the Ent schema. Changes will be written to new named migration files.
|
||||
func NamedDiff(ctx context.Context, url, name string, opts ...schema.MigrateOption) error {
|
||||
return schema.Diff(ctx, url, name, Tables, opts...)
|
||||
}
|
||||
|
||||
// Diff creates a migration file containing the statements to resolve the diff
|
||||
// between the Ent schema and the connected database.
|
||||
func (s *Schema) Diff(ctx context.Context, opts ...schema.MigrateOption) error {
|
||||
migrate, err := schema.NewMigrate(s.drv, opts...)
|
||||
if err != nil {
|
||||
return fmt.Errorf("ent/migrate: %w", err)
|
||||
}
|
||||
return migrate.Diff(ctx, Tables...)
|
||||
}
|
||||
|
||||
// NamedDiff creates a named migration file containing the statements to resolve the diff
|
||||
// between the Ent schema and the connected database.
|
||||
func (s *Schema) NamedDiff(ctx context.Context, name string, opts ...schema.MigrateOption) error {
|
||||
migrate, err := schema.NewMigrate(s.drv, opts...)
|
||||
if err != nil {
|
||||
return fmt.Errorf("ent/migrate: %w", err)
|
||||
}
|
||||
return migrate.NamedDiff(ctx, name, 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...)
|
||||
}
|
||||
@@ -1,547 +0,0 @@
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package migrate
|
||||
|
||||
import (
|
||||
"entgo.io/ent/dialect/sql/schema"
|
||||
"entgo.io/ent/schema/field"
|
||||
)
|
||||
|
||||
var (
|
||||
// InboundDetailsColumns holds the columns for the "inbound_details" table.
|
||||
InboundDetailsColumns = []*schema.Column{
|
||||
{Name: "id", Type: field.TypeInt, Increment: true},
|
||||
{Name: "inbound_no", Type: field.TypeString},
|
||||
{Name: "sn_code", Type: field.TypeString, Nullable: true},
|
||||
{Name: "batch_no", Type: field.TypeString, Nullable: true},
|
||||
{Name: "material_code", Type: field.TypeString},
|
||||
{Name: "quantity", Type: field.TypeInt, Default: 1},
|
||||
{Name: "created_at", Type: field.TypeInt64},
|
||||
}
|
||||
// InboundDetailsTable holds the schema information for the "inbound_details" table.
|
||||
InboundDetailsTable = &schema.Table{
|
||||
Name: "inbound_details",
|
||||
Columns: InboundDetailsColumns,
|
||||
PrimaryKey: []*schema.Column{InboundDetailsColumns[0]},
|
||||
Indexes: []*schema.Index{
|
||||
{
|
||||
Name: "inbounddetail_inbound_no",
|
||||
Unique: false,
|
||||
Columns: []*schema.Column{InboundDetailsColumns[1]},
|
||||
},
|
||||
{
|
||||
Name: "inbounddetail_sn_code",
|
||||
Unique: false,
|
||||
Columns: []*schema.Column{InboundDetailsColumns[2]},
|
||||
},
|
||||
},
|
||||
}
|
||||
// InboundOrdersColumns holds the columns for the "inbound_orders" table.
|
||||
InboundOrdersColumns = []*schema.Column{
|
||||
{Name: "id", Type: field.TypeInt, Increment: true},
|
||||
{Name: "inbound_no", Type: field.TypeString, Unique: true},
|
||||
{Name: "inbound_type", Type: field.TypeString, Default: "purchase"},
|
||||
{Name: "material_code", Type: field.TypeString},
|
||||
{Name: "material_name", Type: field.TypeString, Nullable: true},
|
||||
{Name: "manage_mode", Type: field.TypeInt, Default: 1},
|
||||
{Name: "batch_no", Type: field.TypeString, Nullable: true},
|
||||
{Name: "zone_code", Type: field.TypeString, Nullable: true},
|
||||
{Name: "quantity", Type: field.TypeInt, Default: 0},
|
||||
{Name: "operator", Type: field.TypeString, Nullable: true},
|
||||
{Name: "remark", Type: field.TypeString, Nullable: true},
|
||||
{Name: "created_at", Type: field.TypeInt64},
|
||||
}
|
||||
// InboundOrdersTable holds the schema information for the "inbound_orders" table.
|
||||
InboundOrdersTable = &schema.Table{
|
||||
Name: "inbound_orders",
|
||||
Columns: InboundOrdersColumns,
|
||||
PrimaryKey: []*schema.Column{InboundOrdersColumns[0]},
|
||||
Indexes: []*schema.Index{
|
||||
{
|
||||
Name: "inboundorder_material_code",
|
||||
Unique: false,
|
||||
Columns: []*schema.Column{InboundOrdersColumns[3]},
|
||||
},
|
||||
{
|
||||
Name: "inboundorder_inbound_type",
|
||||
Unique: false,
|
||||
Columns: []*schema.Column{InboundOrdersColumns[2]},
|
||||
},
|
||||
{
|
||||
Name: "inboundorder_operator",
|
||||
Unique: false,
|
||||
Columns: []*schema.Column{InboundOrdersColumns[9]},
|
||||
},
|
||||
},
|
||||
}
|
||||
// InspectionRecordsColumns holds the columns for the "inspection_records" table.
|
||||
InspectionRecordsColumns = []*schema.Column{
|
||||
{Name: "id", Type: field.TypeInt, Increment: true},
|
||||
{Name: "target_type", Type: field.TypeString},
|
||||
{Name: "target_id", Type: field.TypeString},
|
||||
{Name: "material_code", Type: field.TypeString},
|
||||
{Name: "inspection_type", Type: field.TypeString, Default: "incoming"},
|
||||
{Name: "status", Type: field.TypeString, Default: "未检"},
|
||||
{Name: "result_value", Type: field.TypeString, Nullable: true},
|
||||
{Name: "inspector", Type: field.TypeString, Nullable: true},
|
||||
{Name: "remark", Type: field.TypeString, Nullable: true},
|
||||
{Name: "created_at", Type: field.TypeInt64},
|
||||
{Name: "updated_at", Type: field.TypeInt64},
|
||||
}
|
||||
// InspectionRecordsTable holds the schema information for the "inspection_records" table.
|
||||
InspectionRecordsTable = &schema.Table{
|
||||
Name: "inspection_records",
|
||||
Columns: InspectionRecordsColumns,
|
||||
PrimaryKey: []*schema.Column{InspectionRecordsColumns[0]},
|
||||
Indexes: []*schema.Index{
|
||||
{
|
||||
Name: "inspectionrecord_target_id",
|
||||
Unique: false,
|
||||
Columns: []*schema.Column{InspectionRecordsColumns[2]},
|
||||
},
|
||||
{
|
||||
Name: "inspectionrecord_material_code",
|
||||
Unique: false,
|
||||
Columns: []*schema.Column{InspectionRecordsColumns[3]},
|
||||
},
|
||||
{
|
||||
Name: "inspectionrecord_inspection_type",
|
||||
Unique: false,
|
||||
Columns: []*schema.Column{InspectionRecordsColumns[4]},
|
||||
},
|
||||
{
|
||||
Name: "inspectionrecord_status",
|
||||
Unique: false,
|
||||
Columns: []*schema.Column{InspectionRecordsColumns[5]},
|
||||
},
|
||||
},
|
||||
}
|
||||
// InventoryBatchesColumns holds the columns for the "inventory_batches" table.
|
||||
InventoryBatchesColumns = []*schema.Column{
|
||||
{Name: "id", Type: field.TypeInt, Increment: true},
|
||||
{Name: "batch_no", Type: field.TypeString, Unique: true},
|
||||
{Name: "material_code", Type: field.TypeString},
|
||||
{Name: "material_name", Type: field.TypeString, Nullable: true},
|
||||
{Name: "quantity", Type: field.TypeInt, Default: 0},
|
||||
{Name: "locked_qty", Type: field.TypeInt, Default: 0},
|
||||
{Name: "production_date", Type: field.TypeString, Nullable: true},
|
||||
{Name: "supplier", Type: field.TypeString, Nullable: true},
|
||||
{Name: "quality_status", Type: field.TypeString, Default: "未检"},
|
||||
{Name: "zone_code", Type: field.TypeString, Nullable: true},
|
||||
{Name: "remark", Type: field.TypeString, Nullable: true},
|
||||
{Name: "created_at", Type: field.TypeInt64},
|
||||
{Name: "updated_at", Type: field.TypeInt64},
|
||||
}
|
||||
// InventoryBatchesTable holds the schema information for the "inventory_batches" table.
|
||||
InventoryBatchesTable = &schema.Table{
|
||||
Name: "inventory_batches",
|
||||
Columns: InventoryBatchesColumns,
|
||||
PrimaryKey: []*schema.Column{InventoryBatchesColumns[0]},
|
||||
Indexes: []*schema.Index{
|
||||
{
|
||||
Name: "inventorybatch_material_code",
|
||||
Unique: false,
|
||||
Columns: []*schema.Column{InventoryBatchesColumns[2]},
|
||||
},
|
||||
{
|
||||
Name: "inventorybatch_quality_status",
|
||||
Unique: false,
|
||||
Columns: []*schema.Column{InventoryBatchesColumns[8]},
|
||||
},
|
||||
{
|
||||
Name: "inventorybatch_zone_code",
|
||||
Unique: false,
|
||||
Columns: []*schema.Column{InventoryBatchesColumns[9]},
|
||||
},
|
||||
},
|
||||
}
|
||||
// InventoryLocksColumns holds the columns for the "inventory_locks" table.
|
||||
InventoryLocksColumns = []*schema.Column{
|
||||
{Name: "id", Type: field.TypeInt, Increment: true},
|
||||
{Name: "target_type", Type: field.TypeString},
|
||||
{Name: "target_id", Type: field.TypeString},
|
||||
{Name: "material_code", Type: field.TypeString},
|
||||
{Name: "locked_qty", Type: field.TypeInt, Default: 1},
|
||||
{Name: "order_no", Type: field.TypeString},
|
||||
{Name: "status", Type: field.TypeString, Default: "ACTIVE"},
|
||||
{Name: "expired_at", Type: field.TypeInt64, Nullable: true},
|
||||
{Name: "remark", Type: field.TypeString, Nullable: true},
|
||||
{Name: "created_at", Type: field.TypeInt64},
|
||||
{Name: "updated_at", Type: field.TypeInt64},
|
||||
}
|
||||
// InventoryLocksTable holds the schema information for the "inventory_locks" table.
|
||||
InventoryLocksTable = &schema.Table{
|
||||
Name: "inventory_locks",
|
||||
Columns: InventoryLocksColumns,
|
||||
PrimaryKey: []*schema.Column{InventoryLocksColumns[0]},
|
||||
Indexes: []*schema.Index{
|
||||
{
|
||||
Name: "inventorylock_order_no",
|
||||
Unique: false,
|
||||
Columns: []*schema.Column{InventoryLocksColumns[5]},
|
||||
},
|
||||
{
|
||||
Name: "inventorylock_status",
|
||||
Unique: false,
|
||||
Columns: []*schema.Column{InventoryLocksColumns[6]},
|
||||
},
|
||||
{
|
||||
Name: "inventorylock_target_id",
|
||||
Unique: false,
|
||||
Columns: []*schema.Column{InventoryLocksColumns[2]},
|
||||
},
|
||||
},
|
||||
}
|
||||
// MaterialsColumns holds the columns for the "materials" table.
|
||||
MaterialsColumns = []*schema.Column{
|
||||
{Name: "id", Type: field.TypeInt, Increment: true},
|
||||
{Name: "code", Type: field.TypeString, Unique: true},
|
||||
{Name: "name", Type: field.TypeString},
|
||||
{Name: "short_name", Type: field.TypeString, Nullable: true},
|
||||
{Name: "spec", Type: field.TypeString, Nullable: true},
|
||||
{Name: "unit", Type: field.TypeString, Nullable: true},
|
||||
{Name: "description", Type: field.TypeString, Nullable: true},
|
||||
{Name: "manage_mode", Type: field.TypeInt, Default: 1},
|
||||
{Name: "is_batch_managed", Type: field.TypeBool, Default: false},
|
||||
{Name: "is_serial_managed", Type: field.TypeBool, Default: false},
|
||||
{Name: "material_type", Type: field.TypeString, Default: "raw"},
|
||||
{Name: "template_code", Type: field.TypeString, Nullable: true},
|
||||
{Name: "created_at", Type: field.TypeInt64},
|
||||
{Name: "updated_at", Type: field.TypeInt64},
|
||||
}
|
||||
// MaterialsTable holds the schema information for the "materials" table.
|
||||
MaterialsTable = &schema.Table{
|
||||
Name: "materials",
|
||||
Columns: MaterialsColumns,
|
||||
PrimaryKey: []*schema.Column{MaterialsColumns[0]},
|
||||
Indexes: []*schema.Index{
|
||||
{
|
||||
Name: "material_name",
|
||||
Unique: false,
|
||||
Columns: []*schema.Column{MaterialsColumns[2]},
|
||||
},
|
||||
{
|
||||
Name: "material_template_code",
|
||||
Unique: false,
|
||||
Columns: []*schema.Column{MaterialsColumns[11]},
|
||||
},
|
||||
},
|
||||
}
|
||||
// OrderMaterialLedgersColumns holds the columns for the "order_material_ledgers" table.
|
||||
OrderMaterialLedgersColumns = []*schema.Column{
|
||||
{Name: "id", Type: field.TypeInt, Increment: true},
|
||||
{Name: "order_no", Type: field.TypeString},
|
||||
{Name: "material_code", Type: field.TypeString},
|
||||
{Name: "material_name", Type: field.TypeString, Nullable: true},
|
||||
{Name: "total_qty", Type: field.TypeInt, Default: 0},
|
||||
{Name: "out_qty", Type: field.TypeInt, Default: 0},
|
||||
{Name: "status", Type: field.TypeString, Default: "进行中"},
|
||||
{Name: "remark", Type: field.TypeString, Nullable: true},
|
||||
{Name: "created_at", Type: field.TypeInt64},
|
||||
{Name: "updated_at", Type: field.TypeInt64},
|
||||
}
|
||||
// OrderMaterialLedgersTable holds the schema information for the "order_material_ledgers" table.
|
||||
OrderMaterialLedgersTable = &schema.Table{
|
||||
Name: "order_material_ledgers",
|
||||
Columns: OrderMaterialLedgersColumns,
|
||||
PrimaryKey: []*schema.Column{OrderMaterialLedgersColumns[0]},
|
||||
Indexes: []*schema.Index{
|
||||
{
|
||||
Name: "ordermaterialledger_order_no",
|
||||
Unique: false,
|
||||
Columns: []*schema.Column{OrderMaterialLedgersColumns[1]},
|
||||
},
|
||||
{
|
||||
Name: "ordermaterialledger_material_code",
|
||||
Unique: false,
|
||||
Columns: []*schema.Column{OrderMaterialLedgersColumns[2]},
|
||||
},
|
||||
},
|
||||
}
|
||||
// OutboundDetailsColumns holds the columns for the "outbound_details" table.
|
||||
OutboundDetailsColumns = []*schema.Column{
|
||||
{Name: "id", Type: field.TypeInt, Increment: true},
|
||||
{Name: "outbound_no", Type: field.TypeString},
|
||||
{Name: "sn_code", Type: field.TypeString, Nullable: true},
|
||||
{Name: "batch_no", Type: field.TypeString, Nullable: true},
|
||||
{Name: "material_code", Type: field.TypeString},
|
||||
{Name: "quantity", Type: field.TypeInt, Default: 1},
|
||||
{Name: "order_no", Type: field.TypeString, Nullable: true},
|
||||
{Name: "created_at", Type: field.TypeInt64},
|
||||
}
|
||||
// OutboundDetailsTable holds the schema information for the "outbound_details" table.
|
||||
OutboundDetailsTable = &schema.Table{
|
||||
Name: "outbound_details",
|
||||
Columns: OutboundDetailsColumns,
|
||||
PrimaryKey: []*schema.Column{OutboundDetailsColumns[0]},
|
||||
Indexes: []*schema.Index{
|
||||
{
|
||||
Name: "outbounddetail_outbound_no",
|
||||
Unique: false,
|
||||
Columns: []*schema.Column{OutboundDetailsColumns[1]},
|
||||
},
|
||||
{
|
||||
Name: "outbounddetail_sn_code",
|
||||
Unique: false,
|
||||
Columns: []*schema.Column{OutboundDetailsColumns[2]},
|
||||
},
|
||||
{
|
||||
Name: "outbounddetail_order_no",
|
||||
Unique: false,
|
||||
Columns: []*schema.Column{OutboundDetailsColumns[6]},
|
||||
},
|
||||
},
|
||||
}
|
||||
// OutboundOrdersColumns holds the columns for the "outbound_orders" table.
|
||||
OutboundOrdersColumns = []*schema.Column{
|
||||
{Name: "id", Type: field.TypeInt, Increment: true},
|
||||
{Name: "outbound_no", Type: field.TypeString, Unique: true},
|
||||
{Name: "outbound_type", Type: field.TypeString, Default: "workorder"},
|
||||
{Name: "order_no", Type: field.TypeString, Nullable: true},
|
||||
{Name: "material_code", Type: field.TypeString},
|
||||
{Name: "material_name", Type: field.TypeString, Nullable: true},
|
||||
{Name: "manage_mode", Type: field.TypeInt, Default: 1},
|
||||
{Name: "batch_no", Type: field.TypeString, Nullable: true},
|
||||
{Name: "zone_code", Type: field.TypeString, Nullable: true},
|
||||
{Name: "quantity", Type: field.TypeInt, Default: 0},
|
||||
{Name: "operator", Type: field.TypeString, Nullable: true},
|
||||
{Name: "reviewer", Type: field.TypeString, Nullable: true},
|
||||
{Name: "target_dock", Type: field.TypeString, Nullable: true},
|
||||
{Name: "remark", Type: field.TypeString, Nullable: true},
|
||||
{Name: "created_at", Type: field.TypeInt64},
|
||||
}
|
||||
// OutboundOrdersTable holds the schema information for the "outbound_orders" table.
|
||||
OutboundOrdersTable = &schema.Table{
|
||||
Name: "outbound_orders",
|
||||
Columns: OutboundOrdersColumns,
|
||||
PrimaryKey: []*schema.Column{OutboundOrdersColumns[0]},
|
||||
Indexes: []*schema.Index{
|
||||
{
|
||||
Name: "outboundorder_order_no",
|
||||
Unique: false,
|
||||
Columns: []*schema.Column{OutboundOrdersColumns[3]},
|
||||
},
|
||||
{
|
||||
Name: "outboundorder_material_code",
|
||||
Unique: false,
|
||||
Columns: []*schema.Column{OutboundOrdersColumns[4]},
|
||||
},
|
||||
{
|
||||
Name: "outboundorder_outbound_type",
|
||||
Unique: false,
|
||||
Columns: []*schema.Column{OutboundOrdersColumns[2]},
|
||||
},
|
||||
},
|
||||
}
|
||||
// PackageBoxesColumns holds the columns for the "package_boxes" table.
|
||||
PackageBoxesColumns = []*schema.Column{
|
||||
{Name: "id", Type: field.TypeInt, Increment: true},
|
||||
{Name: "box_no", Type: field.TypeString, Unique: true},
|
||||
{Name: "sn_list", Type: field.TypeString, Nullable: true},
|
||||
{Name: "material_code", Type: field.TypeString, Nullable: true},
|
||||
{Name: "quantity", Type: field.TypeInt, Default: 0},
|
||||
{Name: "operator", Type: field.TypeString, Nullable: true},
|
||||
{Name: "remark", Type: field.TypeString, Nullable: true},
|
||||
{Name: "created_at", Type: field.TypeInt64},
|
||||
}
|
||||
// PackageBoxesTable holds the schema information for the "package_boxes" table.
|
||||
PackageBoxesTable = &schema.Table{
|
||||
Name: "package_boxes",
|
||||
Columns: PackageBoxesColumns,
|
||||
PrimaryKey: []*schema.Column{PackageBoxesColumns[0]},
|
||||
Indexes: []*schema.Index{
|
||||
{
|
||||
Name: "packagebox_material_code",
|
||||
Unique: false,
|
||||
Columns: []*schema.Column{PackageBoxesColumns[3]},
|
||||
},
|
||||
},
|
||||
}
|
||||
// SemiFinishedsColumns holds the columns for the "semi_finisheds" table.
|
||||
SemiFinishedsColumns = []*schema.Column{
|
||||
{Name: "id", Type: field.TypeInt, Increment: true},
|
||||
{Name: "sn", Type: field.TypeString, Unique: true},
|
||||
{Name: "material_code", Type: field.TypeString},
|
||||
{Name: "completed_process", Type: field.TypeString, Nullable: true},
|
||||
{Name: "quantity", Type: field.TypeInt, Default: 1},
|
||||
{Name: "zone_code", Type: field.TypeString, Nullable: true},
|
||||
{Name: "status", Type: field.TypeString, Default: "在库"},
|
||||
{Name: "order_no", Type: field.TypeString, Nullable: true},
|
||||
{Name: "created_at", Type: field.TypeInt64},
|
||||
{Name: "updated_at", Type: field.TypeInt64},
|
||||
}
|
||||
// SemiFinishedsTable holds the schema information for the "semi_finisheds" table.
|
||||
SemiFinishedsTable = &schema.Table{
|
||||
Name: "semi_finisheds",
|
||||
Columns: SemiFinishedsColumns,
|
||||
PrimaryKey: []*schema.Column{SemiFinishedsColumns[0]},
|
||||
Indexes: []*schema.Index{
|
||||
{
|
||||
Name: "semifinished_material_code",
|
||||
Unique: false,
|
||||
Columns: []*schema.Column{SemiFinishedsColumns[2]},
|
||||
},
|
||||
{
|
||||
Name: "semifinished_status",
|
||||
Unique: false,
|
||||
Columns: []*schema.Column{SemiFinishedsColumns[6]},
|
||||
},
|
||||
},
|
||||
}
|
||||
// SerialNumbersColumns holds the columns for the "serial_numbers" table.
|
||||
SerialNumbersColumns = []*schema.Column{
|
||||
{Name: "id", Type: field.TypeInt, Increment: true},
|
||||
{Name: "sn_code", Type: field.TypeString, Unique: true},
|
||||
{Name: "material_code", Type: field.TypeString},
|
||||
{Name: "batch_no", Type: field.TypeString, Nullable: true},
|
||||
{Name: "status", Type: field.TypeString, Default: "在库"},
|
||||
{Name: "current_zone", Type: field.TypeString, Nullable: true},
|
||||
{Name: "quality_status", Type: field.TypeString, Default: "未检"},
|
||||
{Name: "last_inbound_at", Type: field.TypeString, Nullable: true},
|
||||
{Name: "last_outbound_at", Type: field.TypeString, Nullable: true},
|
||||
{Name: "remark", Type: field.TypeString, Nullable: true},
|
||||
{Name: "created_at", Type: field.TypeInt64},
|
||||
{Name: "updated_at", Type: field.TypeInt64},
|
||||
}
|
||||
// SerialNumbersTable holds the schema information for the "serial_numbers" table.
|
||||
SerialNumbersTable = &schema.Table{
|
||||
Name: "serial_numbers",
|
||||
Columns: SerialNumbersColumns,
|
||||
PrimaryKey: []*schema.Column{SerialNumbersColumns[0]},
|
||||
Indexes: []*schema.Index{
|
||||
{
|
||||
Name: "serialnumber_material_code",
|
||||
Unique: false,
|
||||
Columns: []*schema.Column{SerialNumbersColumns[2]},
|
||||
},
|
||||
{
|
||||
Name: "serialnumber_status",
|
||||
Unique: false,
|
||||
Columns: []*schema.Column{SerialNumbersColumns[4]},
|
||||
},
|
||||
{
|
||||
Name: "serialnumber_batch_no",
|
||||
Unique: false,
|
||||
Columns: []*schema.Column{SerialNumbersColumns[3]},
|
||||
},
|
||||
},
|
||||
}
|
||||
// StocktakeItemsColumns holds the columns for the "stocktake_items" table.
|
||||
StocktakeItemsColumns = []*schema.Column{
|
||||
{Name: "id", Type: field.TypeInt, Increment: true},
|
||||
{Name: "stocktake_no", Type: field.TypeString},
|
||||
{Name: "target_type", Type: field.TypeString},
|
||||
{Name: "target_id", Type: field.TypeString},
|
||||
{Name: "material_code", Type: field.TypeString, Nullable: true},
|
||||
{Name: "zone_code", Type: field.TypeString, Nullable: true},
|
||||
{Name: "book_qty", Type: field.TypeInt, Default: 0},
|
||||
{Name: "scanned_qty", Type: field.TypeInt, Default: -1},
|
||||
{Name: "diff_qty", Type: field.TypeInt, Default: 0},
|
||||
{Name: "counted", Type: field.TypeBool, Default: false},
|
||||
{Name: "updated_at", Type: field.TypeInt64},
|
||||
}
|
||||
// StocktakeItemsTable holds the schema information for the "stocktake_items" table.
|
||||
StocktakeItemsTable = &schema.Table{
|
||||
Name: "stocktake_items",
|
||||
Columns: StocktakeItemsColumns,
|
||||
PrimaryKey: []*schema.Column{StocktakeItemsColumns[0]},
|
||||
Indexes: []*schema.Index{
|
||||
{
|
||||
Name: "stocktakeitem_stocktake_no",
|
||||
Unique: false,
|
||||
Columns: []*schema.Column{StocktakeItemsColumns[1]},
|
||||
},
|
||||
{
|
||||
Name: "stocktakeitem_target_id",
|
||||
Unique: false,
|
||||
Columns: []*schema.Column{StocktakeItemsColumns[3]},
|
||||
},
|
||||
},
|
||||
}
|
||||
// StocktakeOrdersColumns holds the columns for the "stocktake_orders" table.
|
||||
StocktakeOrdersColumns = []*schema.Column{
|
||||
{Name: "id", Type: field.TypeInt, Increment: true},
|
||||
{Name: "stocktake_no", Type: field.TypeString, Unique: true},
|
||||
{Name: "status", Type: field.TypeString, Default: "进行中"},
|
||||
{Name: "operator", Type: field.TypeString, Nullable: true},
|
||||
{Name: "total_targets", Type: field.TypeInt, Default: 0},
|
||||
{Name: "created_at", Type: field.TypeInt64},
|
||||
{Name: "finished_at", Type: field.TypeInt64, Nullable: true},
|
||||
}
|
||||
// StocktakeOrdersTable holds the schema information for the "stocktake_orders" table.
|
||||
StocktakeOrdersTable = &schema.Table{
|
||||
Name: "stocktake_orders",
|
||||
Columns: StocktakeOrdersColumns,
|
||||
PrimaryKey: []*schema.Column{StocktakeOrdersColumns[0]},
|
||||
Indexes: []*schema.Index{
|
||||
{
|
||||
Name: "stocktakeorder_status",
|
||||
Unique: false,
|
||||
Columns: []*schema.Column{StocktakeOrdersColumns[2]},
|
||||
},
|
||||
},
|
||||
}
|
||||
// UsersColumns holds the columns for the "users" table.
|
||||
UsersColumns = []*schema.Column{
|
||||
{Name: "id", Type: field.TypeInt, Increment: true},
|
||||
{Name: "username", Type: field.TypeString, Unique: true},
|
||||
{Name: "password", Type: field.TypeString},
|
||||
{Name: "real_name", Type: field.TypeString, Nullable: true},
|
||||
{Name: "role", Type: field.TypeString, Default: "operator"},
|
||||
{Name: "dept", Type: field.TypeString, Nullable: true},
|
||||
{Name: "phone", Type: field.TypeString, Nullable: true},
|
||||
{Name: "is_active", Type: field.TypeBool, Default: true},
|
||||
{Name: "last_login_at", Type: field.TypeInt64, Nullable: true},
|
||||
{Name: "created_at", Type: field.TypeInt64},
|
||||
{Name: "updated_at", Type: field.TypeInt64},
|
||||
}
|
||||
// UsersTable holds the schema information for the "users" table.
|
||||
UsersTable = &schema.Table{
|
||||
Name: "users",
|
||||
Columns: UsersColumns,
|
||||
PrimaryKey: []*schema.Column{UsersColumns[0]},
|
||||
Indexes: []*schema.Index{
|
||||
{
|
||||
Name: "user_role",
|
||||
Unique: false,
|
||||
Columns: []*schema.Column{UsersColumns[4]},
|
||||
},
|
||||
},
|
||||
}
|
||||
// ZonesColumns holds the columns for the "zones" table.
|
||||
ZonesColumns = []*schema.Column{
|
||||
{Name: "id", Type: field.TypeInt, Increment: true},
|
||||
{Name: "zone_code", Type: field.TypeString, Unique: true},
|
||||
{Name: "zone_name", Type: field.TypeString},
|
||||
{Name: "description", Type: field.TypeString, Nullable: true},
|
||||
{Name: "created_at", Type: field.TypeInt64},
|
||||
}
|
||||
// ZonesTable holds the schema information for the "zones" table.
|
||||
ZonesTable = &schema.Table{
|
||||
Name: "zones",
|
||||
Columns: ZonesColumns,
|
||||
PrimaryKey: []*schema.Column{ZonesColumns[0]},
|
||||
}
|
||||
// Tables holds all the tables in the schema.
|
||||
Tables = []*schema.Table{
|
||||
InboundDetailsTable,
|
||||
InboundOrdersTable,
|
||||
InspectionRecordsTable,
|
||||
InventoryBatchesTable,
|
||||
InventoryLocksTable,
|
||||
MaterialsTable,
|
||||
OrderMaterialLedgersTable,
|
||||
OutboundDetailsTable,
|
||||
OutboundOrdersTable,
|
||||
PackageBoxesTable,
|
||||
SemiFinishedsTable,
|
||||
SerialNumbersTable,
|
||||
StocktakeItemsTable,
|
||||
StocktakeOrdersTable,
|
||||
UsersTable,
|
||||
ZonesTable,
|
||||
}
|
||||
)
|
||||
|
||||
func init() {
|
||||
}
|
||||
Reference in New Issue
Block a user