Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def check_schema(self):
- if self.debug:
- print('storage: check_schema')
- try:
- result = self.execute('get_metadata', name='version').fetchone()
- self.version = int(result[0])
- if self.debug:
- print('version read as', self.version)
- except (sqlite3.OperationalError, TypeError):
- self.version = 0
- if self.debug:
- print('version set to', self.version)
- for schema in (s for s in self._doc.iter('schema')
- if int(s.get('version')) > self.version
- ):
- self.version = self.upgrade_schema(schema)
- if self.debug:
- print('upgraded schema, ver', self.version)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement