Files
csgowtfd/ent/migrate/schema.go

129 lines
4.6 KiB
Go

// Code generated by entc, DO NOT EDIT.
package migrate
import (
"entgo.io/ent/dialect/sql/schema"
"entgo.io/ent/schema/field"
)
var (
// MatchesColumns holds the columns for the "matches" table.
MatchesColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
{Name: "match_id", Type: field.TypeUint64, Unique: true},
{Name: "share_code", Type: field.TypeString},
{Name: "map", Type: field.TypeString, Nullable: true},
{Name: "date", Type: field.TypeTime},
{Name: "score_team_a", Type: field.TypeInt},
{Name: "score_team_b", Type: field.TypeInt},
{Name: "replay_url", Type: field.TypeString, Nullable: true},
{Name: "duration", Type: field.TypeInt},
{Name: "match_result", Type: field.TypeInt},
{Name: "max_rounds", Type: field.TypeInt},
{Name: "demo_expired", Type: field.TypeBool, Default: false},
{Name: "demo_parsed", Type: field.TypeBool, Default: false},
{Name: "eco", Type: field.TypeJSON, Nullable: true},
}
// MatchesTable holds the schema information for the "matches" table.
MatchesTable = &schema.Table{
Name: "matches",
Columns: MatchesColumns,
PrimaryKey: []*schema.Column{MatchesColumns[0]},
}
// PlayersColumns holds the columns for the "players" table.
PlayersColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
{Name: "steamid", Type: field.TypeUint64, Unique: true},
{Name: "name", Type: field.TypeString, Nullable: true},
{Name: "avatar_url", Type: field.TypeString, Nullable: true},
{Name: "vanity_url", Type: field.TypeString, Nullable: true},
{Name: "vanity_url_real", Type: field.TypeString, Nullable: true},
{Name: "vac", Type: field.TypeBool, Default: false},
{Name: "vac_date", Type: field.TypeTime, Nullable: true},
{Name: "vac_count", Type: field.TypeInt, Nullable: true},
{Name: "steam_updated", Type: field.TypeTime},
{Name: "sharecode_updated", Type: field.TypeTime, Nullable: true},
{Name: "auth_code", Type: field.TypeString, Nullable: true},
}
// PlayersTable holds the schema information for the "players" table.
PlayersTable = &schema.Table{
Name: "players",
Columns: PlayersColumns,
PrimaryKey: []*schema.Column{PlayersColumns[0]},
}
// StatsColumns holds the columns for the "stats" table.
StatsColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
{Name: "team_id", Type: field.TypeInt},
{Name: "kills", Type: field.TypeInt},
{Name: "deaths", Type: field.TypeInt},
{Name: "assists", Type: field.TypeInt},
{Name: "headshot", Type: field.TypeInt},
{Name: "mvp", Type: field.TypeInt},
{Name: "score", Type: field.TypeInt},
{Name: "extended", Type: field.TypeJSON, Nullable: true},
{Name: "match_stats", Type: field.TypeInt, Nullable: true},
{Name: "player_stats", Type: field.TypeInt, Nullable: true},
}
// StatsTable holds the schema information for the "stats" table.
StatsTable = &schema.Table{
Name: "stats",
Columns: StatsColumns,
PrimaryKey: []*schema.Column{StatsColumns[0]},
ForeignKeys: []*schema.ForeignKey{
{
Symbol: "stats_matches_stats",
Columns: []*schema.Column{StatsColumns[9]},
RefColumns: []*schema.Column{MatchesColumns[0]},
OnDelete: schema.SetNull,
},
{
Symbol: "stats_players_stats",
Columns: []*schema.Column{StatsColumns[10]},
RefColumns: []*schema.Column{PlayersColumns[0]},
OnDelete: schema.SetNull,
},
},
}
// PlayerMatchesColumns holds the columns for the "player_matches" table.
PlayerMatchesColumns = []*schema.Column{
{Name: "player_id", Type: field.TypeInt},
{Name: "match_id", Type: field.TypeInt},
}
// PlayerMatchesTable holds the schema information for the "player_matches" table.
PlayerMatchesTable = &schema.Table{
Name: "player_matches",
Columns: PlayerMatchesColumns,
PrimaryKey: []*schema.Column{PlayerMatchesColumns[0], PlayerMatchesColumns[1]},
ForeignKeys: []*schema.ForeignKey{
{
Symbol: "player_matches_player_id",
Columns: []*schema.Column{PlayerMatchesColumns[0]},
RefColumns: []*schema.Column{PlayersColumns[0]},
OnDelete: schema.Cascade,
},
{
Symbol: "player_matches_match_id",
Columns: []*schema.Column{PlayerMatchesColumns[1]},
RefColumns: []*schema.Column{MatchesColumns[0]},
OnDelete: schema.Cascade,
},
},
}
// Tables holds all the tables in the schema.
Tables = []*schema.Table{
MatchesTable,
PlayersTable,
StatsTable,
PlayerMatchesTable,
}
)
func init() {
StatsTable.ForeignKeys[0].RefTable = MatchesTable
StatsTable.ForeignKeys[1].RefTable = PlayersTable
PlayerMatchesTable.ForeignKeys[0].RefTable = PlayersTable
PlayerMatchesTable.ForeignKeys[1].RefTable = MatchesTable
}