comparison examples/trac/trac/upgrades/db16.py @ 39:93b4dcbafd7b trunk

Copy Trac to main branch.
author cmlenz
date Mon, 03 Jul 2006 18:53:27 +0000
parents
children
comparison
equal deleted inserted replaced
38:ee669cb9cccc 39:93b4dcbafd7b
1 from trac.db import Table, Column, Index
2
3 def do_upgrade(env, ver, cursor):
4 # Add a few new indices to speed things up
5 cursor.execute("CREATE INDEX wiki_time_idx ON wiki (time)")
6 cursor.execute("CREATE INDEX revision_time_idx ON revision (time)")
7 cursor.execute("CREATE INDEX ticket_status_idx ON ticket (status)")
8 cursor.execute("CREATE INDEX ticket_time_idx ON ticket (time)")
9
10 # Fix missing single column primary key constraints
11 if env.config.get('trac', 'database').startswith('postgres'):
12 cursor.execute("ALTER TABLE system ADD CONSTRAINT system_pkey PRIMARY KEY (name)")
13 cursor.execute("ALTER TABLE revision ADD CONSTRAINT revision_pkey PRIMARY KEY (rev)")
14 cursor.execute("ALTER TABLE ticket ADD CONSTRAINT ticket_pkey PRIMARY KEY (id)")
15 cursor.execute("ALTER TABLE component ADD CONSTRAINT component_pkey PRIMARY KEY (name)")
16 cursor.execute("ALTER TABLE milestone ADD CONSTRAINT milestone_pkey PRIMARY KEY (name)")
17 cursor.execute("ALTER TABLE version ADD CONSTRAINT version_pkey PRIMARY KEY (name)")
18 cursor.execute("ALTER TABLE report ADD CONSTRAINT report_pkey PRIMARY KEY (id)")
Copyright (C) 2012-2017 Edgewall Software