* Added HandsActions & Actions indexes & foreign keys to Database.py
* Added 'createActionsTable' to the SQL dictionary * Updated create_tables so 'createActionsTable' would be called * Updated dumpdatabase(), adding in u'Actions' * Added action name & code info for filling the Actions table in FillDefaultData()
This commit is contained in:
parent
94d4bf6ed5
commit
c1b2a0040c
|
@ -126,6 +126,7 @@ class Database:
|
|||
, {'tab':'Hands', 'col':'gametypeId', 'drop':0} # mct 22/3/09
|
||||
#, {'tab':'Hands', 'col':'siteHandNo', 'drop':0} unique indexes not dropped
|
||||
, {'tab':'HandsActions', 'col':'handsPlayerId', 'drop':0}
|
||||
, {'tab':'HandsActions', 'col':'actionId', 'drop':1}
|
||||
, {'tab':'HandsPlayers', 'col':'handId', 'drop':1}
|
||||
, {'tab':'HandsPlayers', 'col':'playerId', 'drop':1}
|
||||
, {'tab':'HandsPlayers', 'col':'tourneysPlayersId', 'drop':0}
|
||||
|
@ -149,6 +150,8 @@ class Database:
|
|||
, {'tab':'HandsPlayers', 'col':'handId', 'drop':0}
|
||||
, {'tab':'HandsPlayers', 'col':'playerId', 'drop':0}
|
||||
, {'tab':'HandsPlayers', 'col':'tourneysPlayersId', 'drop':0}
|
||||
, {'tab':'HandsActions', 'col':'handsPlayerId', 'drop':0}
|
||||
, {'tab':'HandsActions', 'col':'actionId', 'drop':1}
|
||||
, {'tab':'HudCache', 'col':'gametypeId', 'drop':1}
|
||||
, {'tab':'HudCache', 'col':'playerId', 'drop':0}
|
||||
, {'tab':'HudCache', 'col':'tourneyTypeId', 'drop':0}
|
||||
|
@ -172,6 +175,7 @@ class Database:
|
|||
, {'fktab':'HandsPlayers', 'fkcol':'playerId', 'rtab':'Players', 'rcol':'id', 'drop':1}
|
||||
, {'fktab':'HandsPlayers', 'fkcol':'tourneysPlayersId','rtab':'TourneysPlayers','rcol':'id', 'drop':1}
|
||||
, {'fktab':'HandsActions', 'fkcol':'handsPlayerId', 'rtab':'HandsPlayers', 'rcol':'id', 'drop':1}
|
||||
, {'fktab':'HandsActions', 'fkcol':'actionId', 'rtab':'Actions', 'rcol':'id', 'drop':1}
|
||||
, {'fktab':'HudCache', 'fkcol':'gametypeId', 'rtab':'Gametypes', 'rcol':'id', 'drop':1}
|
||||
, {'fktab':'HudCache', 'fkcol':'playerId', 'rtab':'Players', 'rcol':'id', 'drop':0}
|
||||
, {'fktab':'HudCache', 'fkcol':'tourneyTypeId', 'rtab':'TourneyTypes', 'rcol':'id', 'drop':1}
|
||||
|
@ -181,6 +185,7 @@ class Database:
|
|||
, {'fktab':'HandsPlayers', 'fkcol':'handId', 'rtab':'Hands', 'rcol':'id', 'drop':1}
|
||||
, {'fktab':'HandsPlayers', 'fkcol':'playerId', 'rtab':'Players', 'rcol':'id', 'drop':1}
|
||||
, {'fktab':'HandsActions', 'fkcol':'handsPlayerId', 'rtab':'HandsPlayers', 'rcol':'id', 'drop':1}
|
||||
, {'fktab':'HandsActions', 'fkcol':'actionId', 'rtab':'Actions', 'rcol':'id', 'drop':1}
|
||||
, {'fktab':'HudCache', 'fkcol':'gametypeId', 'rtab':'Gametypes', 'rcol':'id', 'drop':1}
|
||||
, {'fktab':'HudCache', 'fkcol':'playerId', 'rtab':'Players', 'rcol':'id', 'drop':0}
|
||||
, {'fktab':'HudCache', 'fkcol':'tourneyTypeId', 'rtab':'TourneyTypes', 'rcol':'id', 'drop':1}
|
||||
|
@ -302,7 +307,7 @@ class Database:
|
|||
|
||||
tables=self.cursor.execute(self.sql.query['list_tables'])
|
||||
tables=self.cursor.fetchall()
|
||||
for table in (u'Autorates', u'Backings', u'Gametypes', u'Hands', u'HandsActions', u'HandsPlayers', u'HudCache', u'Players', u'RawHands', u'RawTourneys', u'Settings', u'Sites', u'TourneyTypes', u'Tourneys', u'TourneysPlayers'):
|
||||
for table in (u'Actions', u'Autorates', u'Backings', u'Gametypes', u'Hands', u'HandsActions', u'HandsPlayers', u'HudCache', u'Players', u'RawHands', u'RawTourneys', u'Settings', u'Sites', u'TourneyTypes', u'Tourneys', u'TourneysPlayers'):
|
||||
print "table:", table
|
||||
result+="###################\nTable "+table+"\n###################\n"
|
||||
rows=self.cursor.execute(self.sql.query['get'+table])
|
||||
|
@ -1151,6 +1156,7 @@ class Database:
|
|||
c.execute(self.sql.query['createSettingsTable'])
|
||||
|
||||
log.debug("Creating tables")
|
||||
c.execute(self.sql.query['createActionsTable'])
|
||||
c.execute(self.sql.query['createSitesTable'])
|
||||
c.execute(self.sql.query['createGametypesTable'])
|
||||
c.execute(self.sql.query['createPlayersTable'])
|
||||
|
@ -1422,6 +1428,7 @@ class Database:
|
|||
def fillDefaultData(self):
|
||||
c = self.get_cursor()
|
||||
c.execute("INSERT INTO Settings (version) VALUES (%s);" % (DB_VERSION))
|
||||
#Fill Sites
|
||||
c.execute("INSERT INTO Sites (name,code) VALUES ('Full Tilt Poker', 'FT')")
|
||||
c.execute("INSERT INTO Sites (name,code) VALUES ('PokerStars', 'PS')")
|
||||
c.execute("INSERT INTO Sites (name,code) VALUES ('Everleaf', 'EV')")
|
||||
|
@ -1436,6 +1443,22 @@ class Database:
|
|||
c.execute("INSERT INTO Sites (name,code) VALUES ('PKR', 'PK')")
|
||||
c.execute("INSERT INTO Sites (name,code) VALUES ('iPoker', 'IP')")
|
||||
c.execute("INSERT INTO Sites (name,code) VALUES ('Winamax', 'WM')")
|
||||
#Fill Actions
|
||||
c.execute("INSERT INTO Actions (name,code) VALUES ('ante', 'A')")
|
||||
c.execute("INSERT INTO Actions (name,code) VALUES ('small blind', 'SB')")
|
||||
c.execute("INSERT INTO Actions (name,code) VALUES ('secondsb', 'SSB')")
|
||||
c.execute("INSERT INTO Actions (name,code) VALUES ('big blind', 'BB')")
|
||||
c.execute("INSERT INTO Actions (name,code) VALUES ('both', 'SBBB')")
|
||||
c.execute("INSERT INTO Actions (name,code) VALUES ('calls', 'C')")
|
||||
c.execute("INSERT INTO Actions (name,code) VALUES ('raises', 'R')")
|
||||
c.execute("INSERT INTO Actions (name,code) VALUES ('bets', 'B')")
|
||||
c.execute("INSERT INTO Actions (name,code) VALUES ('stands pat', 'S')")
|
||||
c.execute("INSERT INTO Actions (name,code) VALUES ('folds', 'F')")
|
||||
c.execute("INSERT INTO Actions (name,code) VALUES ('checks', 'K')")
|
||||
c.execute("INSERT INTO Actions (name,code) VALUES ('discards', 'D')")
|
||||
c.execute("INSERT INTO Actions (name,code) VALUES ('bringin', 'I')")
|
||||
c.execute("INSERT INTO Actions (name,code) VALUES ('completes', 'P')")
|
||||
|
||||
#end def fillDefaultData
|
||||
|
||||
def rebuild_indexes(self, start=None):
|
||||
|
|
|
@ -154,6 +154,27 @@ class Sql:
|
|||
rawTourney TEXT NOT NULL,
|
||||
complain BOOLEAN NOT NULL DEFAULT FALSE)"""
|
||||
|
||||
################################
|
||||
# Create Actions
|
||||
################################
|
||||
|
||||
if db_server == 'mysql':
|
||||
self.query['createActionsTable'] = """CREATE TABLE Actions (
|
||||
id SMALLINT UNSIGNED AUTO_INCREMENT NOT NULL, PRIMARY KEY (id),
|
||||
name varchar(32) NOT NULL,
|
||||
code char(2) NOT NULL)
|
||||
ENGINE=INNODB"""
|
||||
elif db_server == 'postgresql':
|
||||
self.query['createActionsTable'] = """CREATE TABLE Actions (
|
||||
id SERIAL, PRIMARY KEY (id),
|
||||
name varchar(32),
|
||||
code char(2))"""
|
||||
elif db_server == 'sqlite':
|
||||
self.query['createActionsTable'] = """CREATE TABLE Actions (
|
||||
id INTEGER PRIMARY KEY,
|
||||
name TEXT NOT NULL,
|
||||
code TEXT NOT NULL)"""
|
||||
|
||||
################################
|
||||
# Create Sites
|
||||
################################
|
||||
|
|
Loading…
Reference in New Issue
Block a user