Fix MySQL 'ADD INDEX' syntax, add functions to create_tables
This commit is contained in:
parent
165ca5bf19
commit
1f7f3f7187
|
@ -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'] = """ """
|
||||
|
||||
|
|
|
@ -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):
|
||||
|
|
Loading…
Reference in New Issue
Block a user