comparison roundup/backends/rdbms_common.py @ 2721:1cd01cf106e1

extend OTK and session table value cols to TEXT [SF#1031271]
author Richard Jones <richard@users.sourceforge.net>
date Thu, 07 Oct 2004 06:30:20 +0000
parents 15d945dff53d
children 93e2e5b55a3c
comparison
equal deleted inserted replaced
2720:15d945dff53d 2721:1cd01cf106e1
1 # $Id: rdbms_common.py,v 1.132 2004-10-07 06:08:42 richard Exp $ 1 # $Id: rdbms_common.py,v 1.133 2004-10-07 06:30:20 richard Exp $
2 ''' Relational database (SQL) backend common code. 2 ''' Relational database (SQL) backend common code.
3 3
4 Basics: 4 Basics:
5 5
6 - map roundup classes to relational tables 6 - map roundup classes to relational tables
209 # commit 209 # commit
210 self.sql_commit() 210 self.sql_commit()
211 211
212 # update this number when we need to make changes to the SQL structure 212 # update this number when we need to make changes to the SQL structure
213 # of the backen database 213 # of the backen database
214 current_db_version = 3 214 current_db_version = 4
215 def upgrade_db(self): 215 def upgrade_db(self):
216 ''' Update the SQL database to reflect changes in the backend code. 216 ''' Update the SQL database to reflect changes in the backend code.
217 217
218 Return boolean whether we need to save the schema. 218 Return boolean whether we need to save the schema.
219 ''' 219 '''
239 if version < 3: 239 if version < 3:
240 if __debug__: 240 if __debug__:
241 self.config.logging.getLogger('hyperdb').info('upgrade to version 3') 241 self.config.logging.getLogger('hyperdb').info('upgrade to version 3')
242 self.fix_version_2_tables() 242 self.fix_version_2_tables()
243 243
244 if version < 4:
245 self.fix_version_3_tables()
246
244 self.database_schema['version'] = self.current_db_version 247 self.database_schema['version'] = self.current_db_version
245 return 1 248 return 1
249
250 def fix_version_3_tables(self):
251 # drop the shorter VARCHAR OTK column and add a new TEXT one
252 for name in ('otk', 'session'):
253 self.sql('ALTER TABLE %ss DROP %s_value'%(name, name))
254 self.sql('ALTER TABLE %ss ADD %s_value TEXT'%(name, name))
246 255
247 def fix_version_2_tables(self): 256 def fix_version_2_tables(self):
248 '''Default (used by sqlite): NOOP''' 257 '''Default (used by sqlite): NOOP'''
249 pass 258 pass
250 259

Roundup Issue Tracker: http://roundup-tracker.org/