comparison examples/trac/trac/upgrades/db11.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 import os.path
2
3 sql = [
4 #-- Remove empty values from the milestone list
5 """DELETE FROM milestone WHERE COALESCE(name,'')='';""",
6 #-- Add a description column to the version table, and remove unnamed versions
7 """CREATE TEMPORARY TABLE version_old AS SELECT * FROM version;""",
8 """DROP TABLE version;""",
9 """CREATE TABLE version (
10 name text PRIMARY KEY,
11 time integer,
12 description text
13 );""",
14 """INSERT INTO version(name,time,description)
15 SELECT name,time,'' FROM version_old WHERE COALESCE(name,'')<>'';""",
16 #-- Add a description column to the component table, and remove unnamed components
17 """CREATE TEMPORARY TABLE component_old AS SELECT * FROM component;""",
18 """DROP TABLE component;""",
19 """CREATE TABLE component (
20 name text PRIMARY KEY,
21 owner text,
22 description text
23 );""",
24 """INSERT INTO component(name,owner,description)
25 SELECT name,owner,'' FROM component_old WHERE COALESCE(name,'')<>'';""",
26 """DROP TABLE version_old;""",
27 """DROP TABLE component_old;"""
28 ]
29
30 def do_upgrade(env, ver, cursor):
31 for s in sql:
32 cursor.execute(s)
Copyright (C) 2012-2017 Edgewall Software