| Conditions | 2 |
| Total Lines | 15 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 6 |
| 1 | from plugin.core.database import Database |
||
| 12 | def run(self): |
||
| 13 | log.debug('migrations_path: %r', migrations_path) |
||
| 14 | |||
| 15 | router = self._build_router() |
||
| 16 | |||
| 17 | # Validate current schema |
||
| 18 | if not router.validate(): |
||
| 19 | log.error('Detected corrupt/invalid database schema, resetting database...') |
||
| 20 | return self.reset() |
||
| 21 | else: |
||
| 22 | log.info('Database schema is valid') |
||
| 23 | |||
| 24 | # Run schema migrations |
||
| 25 | router.run() |
||
| 26 | return True |
||
| 27 | |||
| 52 |