diff --git a/pyfpdb/FpdbSQLQueries.py b/pyfpdb/FpdbSQLQueries.py index f8e07fb2..11826018 100644 --- a/pyfpdb/FpdbSQLQueries.py +++ b/pyfpdb/FpdbSQLQueries.py @@ -574,26 +574,26 @@ class FpdbSQLQueries: self.query['createHudCacheTable'] = """ """ if(self.dbname == 'MySQL InnoDB'): - self.query['addTourneyIndex'] = """ALTER TABLE Tourneys ADD INDEX 'siteTourneyNo'('siteTourneyNo')""" + self.query['addTourneyIndex'] = """ALTER TABLE Tourneys ADD INDEX siteTourneyNo(siteTourneyNo)""" elif(self.dbname == 'PostgreSQL'): # FIXME: This query has a different syntax - self.query['addTourneyIndex'] = """ALTER TABLE Tourneys ADD INDEX 'siteTourneyNo'('siteTourneyNo')""" + self.query['addTourneyIndex'] = """ALTER TABLE Tourneys ADD INDEX siteTourneyNo(siteTourneyNo)""" elif(self.dbname == 'SQLite'): self.query['addHandsIndex'] = """ """ if(self.dbname == 'MySQL InnoDB'): - self.query['addHandsIndex'] = """ALTER TABLE Hands ADD INDEX 'siteHandNo'('siteHandNo')""" + self.query['addHandsIndex'] = """ALTER TABLE Hands ADD INDEX siteHandNo(siteHandNo)""" elif(self.dbname == 'PostgreSQL'): # FIXME: This query has a different syntax - self.query['addHandsIndex'] = """ALTER TABLE Hands ADD INDEX 'siteHandNo'('siteHandNo')""" + self.query['addHandsIndex'] = """ALTER TABLE Hands ADD INDEX siteHandNo(siteHandNo)""" elif(self.dbname == 'SQLite'): self.query['addHandsIndex'] = """ """ if(self.dbname == 'MySQL InnoDB'): - self.query['addPlayersIndex'] = """ALTER TABLE Players ADD INDEX 'name'('name')""" + self.query['addPlayersIndex'] = """ALTER TABLE Players ADD INDEX name(name)""" elif(self.dbname == 'PostgreSQL'): # FIXME: This query has a different syntax - self.query['addHandsIndex'] = """ALTER TABLE Hands ADD INDEX 'siteHandNo'('siteHandNo')""" + self.query['addHandsIndex'] = """ALTER TABLE Hands ADD INDEX siteHandNo(siteHandNo)""" elif(self.dbname == 'SQLite'): self.query['addHandsIndex'] = """ """ diff --git a/pyfpdb/fpdb_db.py b/pyfpdb/fpdb_db.py index b5fd53c9..8165211c 100755 --- a/pyfpdb/fpdb_db.py +++ b/pyfpdb/fpdb_db.py @@ -81,20 +81,23 @@ class fpdb_db: def create_tables(self): #todo: should detect and fail gracefully if tables already exist. self.cursor.execute(self.sql.query['createSettingsTable']) - self.cursor.execute(self.sql.query['createSitesTable']) - self.cursor.execute(self.sql.query['createGametypesTable']) - self.cursor.execute(self.sql.query['createPlayersTable']) - self.cursor.execute(self.sql.query['createAutoratesTable']) - self.cursor.execute(self.sql.query['createHandsTable']) - self.cursor.execute(self.sql.query['createBoardCardsTable']) - self.cursor.execute(self.sql.query['createTourneyTypesTable']) - self.cursor.execute(self.sql.query['createTourneysTable']) - self.cursor.execute(self.sql.query['createTourneysPlayersTable']) - self.cursor.execute(self.sql.query['createHandsPlayersTable']) - self.cursor.execute(self.sql.query['createHandsActionsTable']) - self.cursor.execute(self.sql.query['createHudCacheTable']) + self.cursor.execute(self.sql.query['createSitesTable']) + self.cursor.execute(self.sql.query['createGametypesTable']) + self.cursor.execute(self.sql.query['createPlayersTable']) + self.cursor.execute(self.sql.query['createAutoratesTable']) + self.cursor.execute(self.sql.query['createHandsTable']) + self.cursor.execute(self.sql.query['createBoardCardsTable']) + self.cursor.execute(self.sql.query['createTourneyTypesTable']) + self.cursor.execute(self.sql.query['createTourneysTable']) + self.cursor.execute(self.sql.query['createTourneysPlayersTable']) + self.cursor.execute(self.sql.query['createHandsPlayersTable']) + self.cursor.execute(self.sql.query['createHandsActionsTable']) + self.cursor.execute(self.sql.query['createHudCacheTable']) + self.cursor.execute(self.sql.query['addTourneyIndex']) + self.cursor.execute(self.sql.query['addHandsIndex']) + self.cursor.execute(self.sql.query['addPlayersIndex']) self.fillDefaultData() - self.db.commit() + self.db.commit() #end def disconnect def drop_tables(self):