Skip to content

Commit

Permalink
Keeping the temporary tables really temporary. This should help with re
Browse files Browse the repository at this point in the history
#203 and re #222
  • Loading branch information
tarpas committed Oct 17, 2023
1 parent 93456ed commit c86f995
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
2 changes: 1 addition & 1 deletion testmon/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
"""PYTEST_DONT_REWRITE"""
VERSION = "2.0.12"
VERSION = "2.0.13"
17 changes: 13 additions & 4 deletions testmon/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from testmon.process_code import blob_to_checksums, checksums_to_blob


DATA_VERSION = 12
DATA_VERSION = 13

ChangedFileData = namedtuple(
"ChangedFileData", "filename name method_checksums id failed"
Expand Down Expand Up @@ -54,6 +54,8 @@ def __init__(self, datafile):
if new_db or old_format:
self.init_tables()

self.con.executescript(self._local_temp_tables_statement())

def version_compatibility(self):
return DATA_VERSION

Expand Down Expand Up @@ -349,13 +351,19 @@ def _create_test_execution_statement(self):
forced BIT,
FOREIGN KEY({self._test_execution_fk_column()}) REFERENCES {self._test_execution_fk_table()}(id));
CREATE INDEX test_execution_fk_name ON test_execution ({self._test_execution_fk_column()}, test_name);
"""

def _create_temp_tables_statement(self):
return ""

CREATE TABLE changed_files_fshas (exec_id INTEGER, filename TEXT, fsha TEXT);
def _local_temp_tables_statement(self):
return """
CREATE TEMPORARY TABLE changed_files_fshas (exec_id INTEGER, filename TEXT, fsha TEXT);
CREATE INDEX changed_files_fshas_mcall ON changed_files_fshas (exec_id, filename, fsha);
CREATE TABLE changed_files_mhashes (exec_id INTEGER, filename TEXT, mhashes BLOB);
CREATE TEMPORARY TABLE changed_files_mhashes (exec_id INTEGER, filename TEXT, mhashes BLOB);
CREATE INDEX changed_files_mhashes_eid ON changed_files_mhashes (exec_id);
"""
"""

def _create_file_fp_statement(self):
return """
Expand Down Expand Up @@ -397,6 +405,7 @@ def init_tables(self):
self._create_metadata_statement()
+ self._create_environment_statement()
+ self._create_test_execution_statement()
+ self._create_temp_tables_statement()
+ self._create_file_fp_statement()
+ self._create_test_execution_ffp_statement()
)
Expand Down

0 comments on commit c86f995

Please sign in to comment.