fpdb.py: Add "Recreate HUD Cache" to Database menu
fpdb_db.py: Junk the dropping of indexes/FKs for MySQL INNODB in favor of just telling MySQL to ignore them. Not sure if that works for other MySQL engines or other Database softwares.
This commit is contained in:
@@ -356,6 +356,10 @@ class fpdb_db:
|
||||
"""Drop some indexes/foreign keys to prepare for bulk import.
|
||||
Currently keeping the standalone indexes as needed to import quickly"""
|
||||
stime = time()
|
||||
if self.backend == self.MYSQL_INNODB:
|
||||
self.cursor.execute("SET foreign_key_checks=0")
|
||||
self.cursor.execute("SET autocommit=0")
|
||||
return
|
||||
if self.backend == self.PGSQL:
|
||||
self.db.set_isolation_level(0) # allow table/index operations to work
|
||||
for fk in self.foreignKeys[self.backend]:
|
||||
@@ -445,6 +449,12 @@ class fpdb_db:
|
||||
def afterBulkImport(self):
|
||||
"""Re-create any dropped indexes/foreign keys after bulk import"""
|
||||
stime = time()
|
||||
|
||||
if self.backend == self.MYSQL_INNODB:
|
||||
self.cursor.execute("SET foreign_key_checks=1")
|
||||
self.cursor.execute("SET autocommit=1")
|
||||
return
|
||||
|
||||
if self.backend == self.PGSQL:
|
||||
self.db.set_isolation_level(0) # allow table/index operations to work
|
||||
for fk in self.foreignKeys[self.backend]:
|
||||
|
||||
Reference in New Issue
Block a user