see commit comments for version info

Direct suggestions, praise and animal names to steffen@sycamoretest.info

TODO clean all the crap out of this like i did in HudData, line39 onwards

I decided to be generous on the sizes of the types - if computing experience shows one thing then its that it will come back to bite you in the ass if you save 2 bits in the wrong place. If performance and/or db size are too bad we can still shrink some fields.

Relationships are noted in the comment (need to double check that all are listed)

If you want more comments or if anything is confusing or bad let me know.

All money/cash amounts are stored in cents/pennies/whatever (e.g. $4.27 would be stored a 427). Chips are stored as-is (e.g. 3675 chips would be stored as 3675).

Support for ringgames in Holdem, Omaha, Razz and Stud complete. Support for SnG/MTT is alpha

Notes on use/editing:

Any change to this must be carried to to the table creation code in fpdb_db.py or at least an entry to known bugs is to be made.

If the code (in particular the importer) and this document disagree then this document is to be considered authorative. Please report such mismatches to steffen@sycamoretest.org or through an assembla ticket.

License
Trademarks of third parties have been used under Fair Use or similar laws.
Copyright 2008 Steffen Jobbagy-Felso
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 as published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license can be found in fdl-1.2.txt
The program itself is licensed under AGPLv3, see agpl-3.0.txt

See readme.txt for copying

Table settings

Field name

Type

Comment

version

smallint

the git version of the database (ie. table design changes and major bugfixes require a bump)

Table players

Field name

Type

Comment

id

int


name

varchar(32)


site_id

smallint

references sites.id

comment

text


comment_ts

datetime (in UTC)



Table autorates

An autorating is a computer-"recognised" label/category for a player. Examples could include "Calling Station" if a player has <20% each for aggression and folding postflop. Or "Tight-Aggressive/Aggressive" for players with <20% VPIP, >10% PFR and >40% postflop aggression.

Field name

Type

Comment

id

bigint


player_id

int

references players.id

gametype_id

smallint

references gametypes.id

description

varchar(50)

autorating description

short_desc

char(8)

short description e.g. for display in HUD

rating_time

datetime (in UTC)

timestamp of rating

hand_count

int

number of hands rating is based on


Table gametypes

Field name

Type

Comment

id

smallint


site_id

smallint

references sites.id

type

char(4)

valid entries:

ring - ringgames aka cash games

tour - tournament incl SnG

category

varchar(9)

valid entries:

holdem=Texas Hold'em

omahahi=Omaha High only

omahahilo=Omaha 8 or better

razz=Razz

studhi=7 Card Stud High only

studhl=7 Card Stud 8 or better

limit_type

char(2)

nl=No Limit

cn=Cap No Limit

pl=Pot Limit

cp=Cap Pot Limit

fl=Fixed Limit

small_blind

int


big_blind

int


small_bet

int


big_bet

int



Table sites

Field name

Type

Comment

id

smallint


name

varchar(32)


currency

char(3)

currency code, e.g. USD, GBP, EUR


Table hands

Field Name

Type

Comment

id

bigint


site_hand_no

bigint

the site's hand number

gametype_id

smallint

references gametypes.id

hand_start

datetime (in UTC)

start date&time of the hand

seats

smallint

number of used seats (ie. that got dealt cards)

comment

text


comment_ts

datetime (in UTC)



Table board_cards

cardX -> can be 1 through 5

Field Name

Type

Comment

id

bigint


hand_id

bigint

the site's hand number

cardX_value

smallint

2-10=2-10, J=11, Q=12, K=13, A=14 (even in razz), unknown/no card=x

cardX_suit

char(1)

h=hearts, s=spades, d=diamonds, c=clubs, unknown/no card=x


Table hands_players

cardX: can be 1 through 7, one for each card. In holdem/omaha this stores the hole cards so 3-7 or 5-7 are empty

I did not separate this into an extra table because I felt the lost space is not sufficiently large. Also the benefit for searching is far less relevant.

Field Name

Type

Comment

id

bigint


hand_id

bigint

references hands_stud.id

player_id

int

references players.id

player_startcash

int


position

char(1)

BB=B, SB=S, Button=0, Cutoff=1, etc.

This is used in holdem/omaha only.

ante

int

note: for cash this couldbe boolean, but in tourneys you may enter a hand with less thanthe full ante

cardX_value

smallint

2-10=2-10, J=11, Q=12, K=13, A=14 (even in razz), unknown/no card=x

see note above table

cardX_suit

char(1)

h=hearts, s=spades, d=diamonds, c=clubs, unknown/no card=x

winnings

int

winnings in this hand (bets, antes, etc. are NOT deducted, but rake already is)

rake

int

rake for this player for this hand

comment

text


comment_ts

datetime (in UTC)


tourneys_players_id

bigint

references tourneys_players.id


Table HudDataHoldemOmaha

Field Name

Type

Comment

id

bigint


gametypeId

smallint

references gametypes.id

playerId

int

references players.id

activeSeats

smallint

range 2-10

HDs

int

number of hands this player played in this gametype with this number of seats

VPIP

int

number of hands where player paid to see flop

PFR

int

number of hands where player raised before flop

PF3B4BChance

int

number of hands where player had chance to 3B or 4B

PF3B4B

int

number of hands where player 3bet/4bet before flop

sawFlop

int

number of hands where player saw flop

sawTurn

int

number of hands where player saw turn

sawRiver

int

number of hands where player saw river

sawShowdown

int

number of hands where player saw showdown

raisedFlop

int

number of hands where player raised flop

raisedTurn

int

number of hands where player raised turn

raisedRiver

int

number of hands where player raised river

otherRaisedFlop

int

number of hands where someone else raised flop

otherRaisedFlopFold

int

number of hands where someone else raised flop and the player folded

otherRaisedTurn

int

number of hands where someone else raised Turn

otherRaisedTurnFold

int

number of hands where someone else raised Turn and the player folded

otherRaisedRiver

int

number of hands where someone else raised River

otherRaisedRiverFold

int

number of hands where someone else raised River and the player folded

wonWhenSeenFlop

float

How many hands the player won after seeing the flop - this can be a "partial win" if the pot is split.
To be completely clear, this stores a hand count, NOT a money amount.

wonAtSD

float

As wonWhenSeenFlop, but for showdown.

stealAttemptChance

int

Player was in CO, BTN or SB and nobody has called yet

stealAttempted

int

Player took a chance per the above condition

foldBbToStealChance

int

Somebody tried to steal BB from player

foldedBbToSteal

int

Player folded BB to steal attempt

foldSbToStealChance

int

Somebody tried to steal SB from player

foldedSbToSteal

int

Player folded SB to steal attempt

Table hands_actions

Did separate this into an extra table because it makes SELECTing across different streets so much easier. Also the space saving will be very large.

Field Name

Type

Comment

id

bigint


hand_player_id

bigint

references hands_players.id

street

smallint

street number, 0-3 (preflop, flop, turn, river) for holdem/omaha or 0-4 for razz/stud

-1 for seen showdown

action_no

smallint

action number, this is counted from zero for each street but across all players (e.g. in a heads up where the SB calls and the BB raises and the SB calls again would have numbers 0 and 1 for blinds, 2 and 4 for call and 3 for bet)
Note that the blinds are counted as an action, so if the SB stays in the hand it'll always be action #0

action

char(5)

Bet stands for bring in, complete, bet, double bet, raise and double raise, since they all - technically - do the same thing. Unbet is used for when an uncalled bet is returned.

Other valid values: blind call check fold

amount

int

amount put into the middle for this action

comment

text


comment_ts

datetime (in UTC)



Tournament Tables


Table tourneys

Field name

Type

Comment

id

int


site_id

smallint

References sites.id

site_tourney_no

bigint


buyin

int

Buy-in in cents. Without rebuy/add-on

fee

int


knockout

int


entries

int

-1 if unknown

prizepool

int

Need this as separate field to support rebuy/addon

-1 if unknown

start_time

datetime (in UTC)

Empty if unknown

comment

text


comment_ts

datetime (in UTC)



Table tourneys_players

Field Name

Type

Comment

id

bigint


tourney_id

int

References tourneys.id

player_id

int

References players.id

payin_amount

int

Buyin, fee, rebuys and add-ons

rank

int

Finishing rank

winnings

signed int

Winnings (not profit) by this player, -1 if unknown.

comment

text


comment_ts

datetime (in UTC)