Mercurial > p > roundup > code
diff roundup/backends/rdbms_common.py @ 6806:bdd28b244839
- issue2551223 - fix timestamp truncation in mysql and postgresql
The data types used to represent timestamps in pg and mysql for
ephemeral tables: sessions and otks don't have enough signifcant
digits to work. As a result the timestamps are rounduped (up/down)
rsuling in the stored timestamp being 2 minutes (pg) or 2-3
hours(mysql) off from what it should be.
Modify db schema to use a numeric type that preserves more significant
figures. Implement schema upgrade. Document need for upgrade in
upgrading.txt.
Write tests for schema upgrade.
Implement test for updateTimestamp method on BasicDatabase that showed
this issue in the first place. Write overrides for test for
anydbm/memorydb which store timestamp properly or not at all.
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Mon, 25 Jul 2022 17:20:20 -0400 |
| parents | 408fd477761f |
| children | 9ff091537f43 |
line wrap: on
line diff
--- a/roundup/backends/rdbms_common.py Mon Jul 25 16:39:31 2022 -0400 +++ b/roundup/backends/rdbms_common.py Mon Jul 25 17:20:20 2022 -0400 @@ -331,7 +331,7 @@ # update this number when we need to make changes to the SQL structure # of the backend database - current_db_version = 7 + current_db_version = 8 db_version_updated = False def upgrade_db(self): @@ -381,6 +381,10 @@ self.log_info('upgrade to version 7') self.fix_version_6_tables() + if version < 8: + self.log_info('upgrade to version 8') + self.fix_version_7_tables() + self.database_schema['version'] = self.current_db_version self.db_version_updated = True return 1 @@ -422,6 +426,12 @@ # You would think ALTER commands would be the same but nooo. pass + def fix_version_7_tables(self): + # Default (used by sqlite): NOOP + # Each backend mysql, postgres overrides this + # You would think ALTER commands would be the same but nooo. + pass + def _convert_journal_tables(self): """Get current journal table contents, drop the table and re-create""" c = self.cursor
