From 8a2f881b61bbe14590a6f35559a06ecd59cadd8b Mon Sep 17 00:00:00 2001 From: steffen123 Date: Tue, 22 Jun 2010 22:27:10 +0200 Subject: [PATCH] split TourneyTypes.rebuyOrAddon to rebuy and addOn --- pyfpdb/AlchemyMappings.py | 5 +++-- pyfpdb/AlchemyTables.py | 9 +++++---- pyfpdb/Database.py | 14 ++++++++------ pyfpdb/SQL.py | 27 ++++++++++++++++----------- 4 files changed, 32 insertions(+), 23 deletions(-) diff --git a/pyfpdb/AlchemyMappings.py b/pyfpdb/AlchemyMappings.py index 86b78bd9..87d0f27a 100644 --- a/pyfpdb/AlchemyMappings.py +++ b/pyfpdb/AlchemyMappings.py @@ -152,7 +152,8 @@ class HandInternal(DerivedStats): 'speed': 'speed', 'maxSeats': 'maxseats', 'knockout': 'isKO', - 'rebuyOrAddon': 'isRebuy', + 'rebuy': 'isRebuy', + 'addOn': 'isAddOn', 'headsUp': 'isHU', 'shootout': 'isShootout', 'matrix': 'isMatrix', @@ -382,7 +383,7 @@ class TourneyType(MappedBase): Required kwargs: buyin fee speed maxSeats knockout - rebuyOrAddon headsUp shootout matrix sng currency + rebuy addOn headsUp shootout matrix sng currency """ return get_or_create(cls, session, **kwargs)[0] diff --git a/pyfpdb/AlchemyTables.py b/pyfpdb/AlchemyTables.py index 6052f56d..01f6f4b9 100644 --- a/pyfpdb/AlchemyTables.py +++ b/pyfpdb/AlchemyTables.py @@ -374,7 +374,8 @@ tourney_types_table = Table('TourneyTypes', metadata, Column('fee', Integer, nullable=False, default=0), # INT NOT NULL Column('maxSeats', Boolean, nullable=False, default=-1), # INT NOT NULL DEFAULT -1 Column('knockout', Boolean, nullable=False, default=False), # BOOLEAN NOT NULL DEFAULT False - Column('rebuyOrAddon', Boolean, nullable=False, default=False), # BOOLEAN NOT NULL DEFAULT False + Column('rebuy', Boolean, nullable=False, default=False), # BOOLEAN NOT NULL DEFAULT False + Column('addOn', Boolean, nullable=False, default=False), # BOOLEAN NOT NULL DEFAULT False Column('speed', String(10)), # varchar(10) Column('headsUp', Boolean, nullable=False, default=False), # BOOLEAN NOT NULL DEFAULT False Column('shootout', Boolean, nullable=False, default=False), # BOOLEAN NOT NULL DEFAULT False @@ -385,9 +386,9 @@ tourney_types_table = Table('TourneyTypes', metadata, ) Index('tourneyTypes_all', tourney_types_table.c.siteId, tourney_types_table.c.buyin, tourney_types_table.c.fee, - tourney_types_table.c.maxSeats, tourney_types_table.c.knockout, tourney_types_table.c.rebuyOrAddon, - tourney_types_table.c.speed, tourney_types_table.c.headsUp, tourney_types_table.c.shootout, - tourney_types_table.c.matrix, tourney_types_table.c.sng) + tourney_types_table.c.maxSeats, tourney_types_table.c.knockout, tourney_types_table.c.rebuy, + tourney_types_table.c.addOn, tourney_types_table.c.speed, tourney_types_table.c.headsUp, + tourney_types_table.c.shootout, tourney_types_table.c.matrix, tourney_types_table.c.sng) tourneys_players_table = Table('TourneysPlayers', metadata, diff --git a/pyfpdb/Database.py b/pyfpdb/Database.py index 94dd5cb8..ba4d1c3c 100644 --- a/pyfpdb/Database.py +++ b/pyfpdb/Database.py @@ -75,7 +75,7 @@ except ImportError: use_numpy = False -DB_VERSION = 119 +DB_VERSION = 120 # Variance created as sqlite has a bunch of undefined aggregate functions. @@ -1357,15 +1357,17 @@ class Database: c.execute("INSERT INTO Sites (name,code) VALUES ('Carbon', 'CA')") c.execute("INSERT INTO Sites (name,code) VALUES ('PKR', 'PK')") if self.backend == self.SQLITE: - c.execute("INSERT INTO TourneyTypes (id, siteId, buyin, fee) VALUES (NULL, 1, 0, 0);") + c.execute("""INSERT INTO TourneyTypes (id, siteId, buyin, fee, maxSeats, knockout + ,rebuy, addOn, speed, headsUp, shootout, matrix) + VALUES (NULL, 1, 0, 0, False, False, False, NULL, False, False, False);""") elif self.backend == self.PGSQL: c.execute("""insert into TourneyTypes(siteId, buyin, fee, maxSeats, knockout - ,rebuyOrAddon, speed, headsUp, shootout, matrix) - values (1, 0, 0, 0, False, False, null, False, False, False);""") + ,rebuy, addOn, speed, headsUp, shootout, matrix) + values (1, 0, 0, 0, False, False, False, null, False, False, False);""") elif self.backend == self.MYSQL_INNODB: c.execute("""insert into TourneyTypes(id, siteId, buyin, fee, maxSeats, knockout - ,rebuyOrAddon, speed, headsUp, shootout, matrix) - values (DEFAULT, 1, 0, 0, 0, False, False, null, False, False, False);""") + ,rebuy, addOn, speed, headsUp, shootout, matrix) + values (DEFAULT, 1, 0, 0, 0, False, False, False, null, False, False, False);""") #end def fillDefaultData diff --git a/pyfpdb/SQL.py b/pyfpdb/SQL.py index 4a83ca8d..9ba87fbb 100644 --- a/pyfpdb/SQL.py +++ b/pyfpdb/SQL.py @@ -367,7 +367,8 @@ class Sql: fee INT NOT NULL, maxSeats INT NOT NULL DEFAULT -1, knockout BOOLEAN NOT NULL DEFAULT False, - rebuyOrAddon BOOLEAN NOT NULL DEFAULT False, + rebuy BOOLEAN NOT NULL DEFAULT False, + addOn BOOLEAN NOT NULL DEFAULT False, speed varchar(10), headsUp BOOLEAN NOT NULL DEFAULT False, shootout BOOLEAN NOT NULL DEFAULT False, @@ -384,7 +385,8 @@ class Sql: fee INT NOT NULL, maxSeats INT NOT NULL DEFAULT -1, knockout BOOLEAN NOT NULL DEFAULT False, - rebuyOrAddon BOOLEAN NOT NULL DEFAULT False, + rebuy BOOLEAN NOT NULL DEFAULT False, + addOn BOOLEAN NOT NULL DEFAULT False, speed varchar(10), headsUp BOOLEAN NOT NULL DEFAULT False, shootout BOOLEAN NOT NULL DEFAULT False, @@ -400,7 +402,8 @@ class Sql: fee INT NOT NULL, maxSeats INT NOT NULL DEFAULT -1, knockout BOOLEAN NOT NULL DEFAULT 0, - rebuyOrAddon BOOLEAN NOT NULL DEFAULT 0, + rebuy BOOLEAN NOT NULL DEFAULT 0, + addOn BOOLEAN NOT NULL DEFAULT 0, speed TEXT, headsUp BOOLEAN NOT NULL DEFAULT 0, shootout BOOLEAN NOT NULL DEFAULT 0, @@ -1239,13 +1242,13 @@ class Sql: if db_server == 'mysql': self.query['addTTypesIndex'] = """ALTER TABLE TourneyTypes ADD UNIQUE INDEX tourneytypes_all(buyin, fee - , maxSeats, knockout, rebuyOrAddon, speed, headsUp, shootout, matrix, sng)""" + , maxSeats, knockout, rebuy, addOn, speed, headsUp, shootout, matrix, sng)""" elif db_server == 'postgresql': self.query['addTTypesIndex'] = """CREATE UNIQUE INDEX tourneyTypes_all ON TourneyTypes (buyin, fee - , maxSeats, knockout, rebuyOrAddon, speed, headsUp, shootout, matrix, sng)""" + , maxSeats, knockout, rebuy, addOn, speed, headsUp, shootout, matrix, sng)""" elif db_server == 'sqlite': self.query['addTTypesIndex'] = """CREATE UNIQUE INDEX tourneyTypes_all ON TourneyTypes (buyin, fee - , maxSeats, knockout, rebuyOrAddon, speed, headsUp, shootout, matrix, sng)""" + , maxSeats, knockout, rebuy, addOn, speed, headsUp, shootout, matrix, sng)""" self.query['get_last_hand'] = "select max(id) from Hands" @@ -3562,7 +3565,8 @@ class Sql: tt.fee, tt.maxSeats, tt.knockout, - tt.rebuyOrAddon, + tt.rebuy, + tt.addOn, tt.speed, tt.headsUp, tt.shootout, @@ -3578,7 +3582,8 @@ class Sql: AND buyin=%s AND fee=%s AND knockout=%s - AND rebuyOrAddon=%s + AND rebuy=%s + AND addOn=%s AND speed=%s AND headsUp=%s AND shootout=%s @@ -3586,9 +3591,9 @@ class Sql: """ self.query['insertTourneyTypes'] = """INSERT INTO TourneyTypes - (siteId, buyin, fee, knockout, rebuyOrAddon + (siteId, buyin, fee, knockout, rebuy, addOn ,speed, headsUp, shootout, matrix) - VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s) + VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s) """ self.query['getTourney'] = """SELECT t.id, @@ -3624,7 +3629,7 @@ class Sql: tourneyName = %s, matrixIdProcessed = %s, totalRebuyCount = %s, - totalAddonCount = %s, + totalAddOnCount = %s, comment = %s, commentTs = %s WHERE id=%s