1# -*- coding: utf-8 -*- 2# 3# Copyright (C) 2012-2021 Edgewall Software 4# All rights reserved. 5# 6# This software is licensed as described in the file COPYING, which 7# you should have received as part of this distribution. The terms 8# are also available at https://trac.edgewall.org/wiki/TracLicense. 9# 10# This software consists of voluntary contributions made by many 11# individuals. For the exact contribution history, see the revision 12# history and logs, available at https://trac.edgewall.org/. 13 14from trac.db import Table, Column, DatabaseManager 15 16def do_upgrade(env, ver, cursor): 17 """Modify the cache table to use an integer id.""" 18 # No need to keep the previous content 19 cursor.execute("DROP TABLE cache") 20 21 table = Table('cache', key='id')[ 22 Column('id', type='int'), 23 Column('generation', type='int'), 24 Column('key'), 25 ] 26 db_connector, _ = DatabaseManager(env).get_connector() 27 for stmt in db_connector.to_sql(table): 28 cursor.execute(stmt) 29