Execute the migrations.
()
| 385 | raise RuntimeError('Migration failed') |
| 386 | |
| 387 | def upgrade_db(): |
| 388 | """ |
| 389 | Execute the migrations. |
| 390 | """ |
| 391 | try: |
| 392 | db_upgrade(app) |
| 393 | os.environ['CORRUPTED_DB_BACKUP_FILE'] = '' |
| 394 | except Exception: |
| 395 | app.logger.error('Database migration failed') |
| 396 | app.logger.error(traceback.format_exc()) |
| 397 | backup_db_file() |
| 398 | |
| 399 | # check all tables are present in the db. |
| 400 | is_db_error, invalid_tb_names = check_db_tables() |
| 401 | if is_db_error: |
| 402 | app.logger.error( |
| 403 | 'Table(s) {0} are missing in the' |
| 404 | ' database'.format(invalid_tb_names)) |
| 405 | backup_db_file() |
| 406 | |
| 407 | def run_migration_for_sqlite(): |
| 408 | # Tighten the process umask while we may be creating the SQLite |
no test coverage detected