0001-sql-add-indexes-on-receipt_time-and-anonymised-colum.patch
wcs/sql.py | ||
---|---|---|
577 | 577 |
cur.execute('''%s %s_fid ON %s (formdata_id)''' % ( |
578 | 578 |
create_index, evolutions_table_name, evolutions_table_name)) |
579 | 579 | |
580 |
for attr in ('receipt_time', 'anonymised'): |
|
581 |
if not table_name + '_' + attr + '_idx' in existing_indexes: |
|
582 |
cur.execute('%(create_index)s %(table_name)s_%(attr)s ON %(table_name)s (%(attr)s)' % { |
|
583 |
'create_index': create_index, |
|
584 |
'table_name': table_name, |
|
585 |
'attr': attr}) |
|
586 | ||
580 | 587 |
@guard_postgres |
581 | 588 |
def do_user_table(): |
582 | 589 |
conn, cur = get_connection_and_cursor() |
... | ... | |
2249 | 2256 |
return result |
2250 | 2257 | |
2251 | 2258 | |
2252 |
SQL_LEVEL = 33
|
|
2259 |
SQL_LEVEL = 34
|
|
2253 | 2260 | |
2254 | 2261 |
def migrate_global_views(conn, cur): |
2255 | 2262 |
cur.execute('''SELECT COUNT(*) FROM information_schema.tables |
... | ... | |
2366 | 2373 |
if sql_level < 24: |
2367 | 2374 |
from wcs.formdef import FormDef |
2368 | 2375 |
# 24: add index on evolution(formdata_id) |
2376 |
# 34: add indexes on formdata(receipt_time) and formdata(anonymised) |
|
2369 | 2377 |
for formdef in FormDef.select(): |
2370 | 2378 |
do_formdef_indexes(formdef, created=False, conn=conn, cur=cur) |
2371 | 2379 |
if sql_level < 32: |
2372 |
- |