code: def run_fixtures(self):
          self.start_transaction()
  
          
          version = self.fetchone("SELECT version FROM version")["version"]
          current_version = 9
  
          if version < 8:
              # working around sqlite's utf-f case sensitivity (bug 624438)
              # more info: http://www.gsak.net/help/hs23820.htm
              self.execute("ALTER TABLE activities ADD COLUMN search_name varchar2")
  
              activities = self.fetchall("select * from activities")
              statement = "update activities set search_name = ? where id = ?"
              for activity in activities:
                  self.execute(statement, (activity['name'].lower(), activity['id']))
  
              # same for categories
              self.execute("ALTER TABLE categories ADD COLUMN search_name varchar2")
              categories = self.fetchall("select * from categories")
              statement = "update categories set search_name = ? where id = ?"
              for category in categories:
                  self.execute(statement, (category['name'].lower(), category['id']))
  
          if version < 9:
              # adding full text search
              self.execute("""CREATE VIRTUAL TABLE fact_index
                                             USING fts3(id, name, category, description, tag)""")
  
  
          # at the happy end, update version number
          if version < current_version:
              #lock down current version
              self.execute("UPDATE version SET version = %d" % current_version)
              print("updated database from version %d to %d" % (version, current_version))
  
          self.end_transaction()
docs: upgrade DB to hamster version