Files
juwan-backend/app/order/rpc/internal/models/migrate/schema.go
T
wwweww 19cc7a778c Refactor: Remove deprecated gRPC service files and implement new API structure
- Deleted old gRPC service definitions in `game_grpc.pb.go` and `public.go`.
- Added new API server implementations for objectstory, player, and shop services.
- Introduced configuration files for new APIs in `etc/*.yaml`.
- Created main entry points for each service in `objectstory.go`, `player.go`, and `shop.go`.
- Removed unused user update handler and user API files.
- Added utility functions for context management and HTTP header parsing.
- Introduced PostgreSQL backup configuration in `backup/postgreSql.yaml`.
2026-02-28 18:35:56 +08:00

78 lines
3.2 KiB
Go

// 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 (
// OrderStateLogsColumns holds the columns for the "order_state_logs" table.
OrderStateLogsColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt64, Increment: true},
{Name: "order_id", Type: field.TypeInt64},
{Name: "from_status", Type: field.TypeString, Nullable: true, Size: 30},
{Name: "to_status", Type: field.TypeString, Size: 30},
{Name: "action", Type: field.TypeString, Size: 50},
{Name: "actor_id", Type: field.TypeInt64},
{Name: "actor_role", Type: field.TypeString, Size: 20},
{Name: "metadata", Type: field.TypeJSON, Nullable: true, SchemaType: map[string]string{"postgres": "jsonb"}},
{Name: "created_at", Type: field.TypeTime},
}
// OrderStateLogsTable holds the schema information for the "order_state_logs" table.
OrderStateLogsTable = &schema.Table{
Name: "order_state_logs",
Columns: OrderStateLogsColumns,
PrimaryKey: []*schema.Column{OrderStateLogsColumns[0]},
}
// OrdersColumns holds the columns for the "orders" table.
OrdersColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt64, Increment: true},
{Name: "consumer_id", Type: field.TypeInt64},
{Name: "consumer_name", Type: field.TypeString, Size: 100},
{Name: "player_id", Type: field.TypeInt64},
{Name: "player_name", Type: field.TypeString, Size: 100},
{Name: "shop_id", Type: field.TypeInt64, Nullable: true},
{Name: "shop_name", Type: field.TypeString, Nullable: true, Size: 200},
{Name: "service_snapshot", Type: field.TypeJSON, SchemaType: map[string]string{"postgres": "jsonb"}},
{Name: "status", Type: field.TypeString, Size: 30, Default: "pending_payment"},
{Name: "total_price", Type: field.TypeOther, SchemaType: map[string]string{"postgres": "decimal(10,2)"}},
{Name: "note", Type: field.TypeString, Nullable: true},
{Name: "version", Type: field.TypeInt, Default: 1},
{Name: "timeout_job_id", Type: field.TypeString, Nullable: true, Size: 100},
{Name: "search_text", Type: field.TypeString, Nullable: true},
{Name: "created_at", Type: field.TypeTime},
{Name: "accepted_at", Type: field.TypeTime, Nullable: true},
{Name: "closed_at", Type: field.TypeTime, Nullable: true},
{Name: "completed_at", Type: field.TypeTime, Nullable: true},
{Name: "cancelled_at", Type: field.TypeTime, Nullable: true},
{Name: "updated_at", Type: field.TypeTime},
}
// OrdersTable holds the schema information for the "orders" table.
OrdersTable = &schema.Table{
Name: "orders",
Columns: OrdersColumns,
PrimaryKey: []*schema.Column{OrdersColumns[0]},
}
// Tables holds all the tables in the schema.
Tables = []*schema.Table{
OrderStateLogsTable,
OrdersTable,
}
)
func init() {
OrderStateLogsTable.Annotation = &entsql.Annotation{
Table: "order_state_logs",
}
OrdersTable.Annotation = &entsql.Annotation{
Table: "orders",
}
OrdersTable.Annotation.Checks = map[string]string{
"chk_order_status": "status IN ('pending_payment', 'pending_accept', 'in_progress', 'pending_close', 'pending_review', 'disputed', 'completed', 'cancelled')",
"chk_price_positive": "total_price > 0",
}
}