71 lines
2.8 KiB
Go
71 lines
2.8 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 (
|
|
// PlayerServicesColumns holds the columns for the "player_services" table.
|
|
PlayerServicesColumns = []*schema.Column{
|
|
{Name: "id", Type: field.TypeInt64, Increment: true},
|
|
{Name: "player_id", Type: field.TypeInt64},
|
|
{Name: "game_id", Type: field.TypeInt64},
|
|
{Name: "title", Type: field.TypeString, Size: 200},
|
|
{Name: "description", Type: field.TypeString, Nullable: true},
|
|
{Name: "price", Type: field.TypeOther, SchemaType: map[string]string{"postgres": "decimal(10,2)"}},
|
|
{Name: "unit", Type: field.TypeString, Size: 20},
|
|
{Name: "rank_range", Type: field.TypeString, Nullable: true, Size: 100},
|
|
{Name: "availability", Type: field.TypeJSON, Nullable: true},
|
|
{Name: "rating", Type: field.TypeOther, SchemaType: map[string]string{"postgres": "decimal(3,2)"}},
|
|
{Name: "is_active", Type: field.TypeBool, Nullable: true, Default: true},
|
|
{Name: "created_at", Type: field.TypeTime},
|
|
{Name: "updated_at", Type: field.TypeTime},
|
|
}
|
|
// PlayerServicesTable holds the schema information for the "player_services" table.
|
|
PlayerServicesTable = &schema.Table{
|
|
Name: "player_services",
|
|
Columns: PlayerServicesColumns,
|
|
PrimaryKey: []*schema.Column{PlayerServicesColumns[0]},
|
|
}
|
|
// PlayersColumns holds the columns for the "players" table.
|
|
PlayersColumns = []*schema.Column{
|
|
{Name: "id", Type: field.TypeInt64, Increment: true},
|
|
{Name: "user_id", Type: field.TypeInt64, Unique: true},
|
|
{Name: "status", Type: field.TypeString, Size: 20, Default: "offline"},
|
|
{Name: "gender", Type: field.TypeBool, Default: true},
|
|
{Name: "rating", Type: field.TypeOther, Nullable: true, SchemaType: map[string]string{"postgres": "decimal(3,2)"}},
|
|
{Name: "total_orders", Type: field.TypeInt, Nullable: true, Default: 0},
|
|
{Name: "completed_orders", Type: field.TypeInt, Nullable: true, Default: 0},
|
|
{Name: "shop_id", Type: field.TypeInt64, Nullable: true},
|
|
{Name: "tags", Type: field.TypeJSON, Nullable: true},
|
|
{Name: "games", Type: field.TypeOther, Nullable: true, SchemaType: map[string]string{"postgres": "bigint[]"}},
|
|
{Name: "created_at", Type: field.TypeTime},
|
|
{Name: "updated_at", Type: field.TypeTime},
|
|
}
|
|
// PlayersTable holds the schema information for the "players" table.
|
|
PlayersTable = &schema.Table{
|
|
Name: "players",
|
|
Columns: PlayersColumns,
|
|
PrimaryKey: []*schema.Column{PlayersColumns[0]},
|
|
}
|
|
// Tables holds all the tables in the schema.
|
|
Tables = []*schema.Table{
|
|
PlayerServicesTable,
|
|
PlayersTable,
|
|
}
|
|
)
|
|
|
|
func init() {
|
|
PlayerServicesTable.Annotation = &entsql.Annotation{
|
|
Table: "player_services",
|
|
}
|
|
PlayerServicesTable.Annotation.Checks = map[string]string{
|
|
"chk_price_positive": "price > 0",
|
|
"chk_service_rating": "rating >= 0 AND rating <= 5",
|
|
}
|
|
}
|