Mercurial > bitten > bitten-test
diff bitten/upgrades.py @ 410:7930cdd83d13
More restructuring: got rid of the `trac_ext` subpackage, which makes no sense now that the master is also coupled to Trac.
author | cmlenz |
---|---|
date | Tue, 07 Aug 2007 09:49:08 +0000 |
parents | 933105ab516b |
children | a169d2e96463 |
line wrap: on
line diff
--- a/bitten/upgrades.py +++ b/bitten/upgrades.py @@ -14,15 +14,16 @@ import os import sys -from bitten.trac_ext.compat import schema_to_sql +from trac.db import DatabaseManager def add_log_table(env, db): """Add a table for storing the builds logs.""" from bitten.model import BuildLog, BuildStep cursor = db.cursor() + connector, _ = DatabaseManager(env)._get_connector() for table in BuildLog._schema: - for stmt in schema_to_sql(env, db, table): + for stmt in connector.to_sql(table): cursor.execute(stmt) cursor.execute("SELECT build,name,log FROM bitten_step " @@ -35,7 +36,7 @@ cursor.execute("CREATE TEMP TABLE old_step AS SELECT * FROM bitten_step") cursor.execute("DROP TABLE bitten_step") for table in BuildStep._schema: - for stmt in schema_to_sql(env, db, table): + for stmt in connector.to_sql(table): cursor.execute(stmt) cursor.execute("INSERT INTO bitten_step (build,name,description,status," "started,stopped) SELECT build,name,description,status," @@ -44,16 +45,18 @@ def add_recipe_to_config(env, db): """Add a column for storing the build recipe to the build configuration table.""" - from bitten.model import BuildConfig cursor = db.cursor() cursor.execute("CREATE TEMP TABLE old_config AS " "SELECT * FROM bitten_config") cursor.execute("DROP TABLE bitten_config") + + connector, _ = DatabaseManager(env)._get_connector() for table in BuildConfig._schema: - for stmt in schema_to_sql(env, db, table): + for stmt in connector.to_sql(table): cursor.execute(stmt) + cursor.execute("INSERT INTO bitten_config (name,path,active,recipe,min_rev," "max_rev,label,description) SELECT name,path,0,'',NULL," "NULL,label,description FROM old_config") @@ -112,8 +115,11 @@ cursor.execute("CREATE TEMP TABLE old_log AS " "SELECT * FROM bitten_log") cursor.execute("DROP TABLE bitten_log") - for stmt in schema_to_sql(env, db, BuildLog._schema[0]): + + connector, _ = DatabaseManager(env)._get_connector() + for stmt in connector.to_sql(BuildLog._schema[0]): cursor.execute(stmt) + cursor.execute("INSERT INTO bitten_log (id,build,step,generator,orderno) " "SELECT id,build,step,type,0 FROM old_log") @@ -122,8 +128,9 @@ from bitten.model import Report cursor = db.cursor() + connector, _ = DatabaseManager(env)._get_connector() for table in Report._schema: - for stmt in schema_to_sql(env, db, table): + for stmt in connector.to_sql(table): cursor.execute(stmt) def xmldb_to_db(env, db): @@ -267,7 +274,9 @@ Column('orderno', type='int') ] cursor = db.cursor() - for stmt in schema_to_sql(env, db, table): + + connector, _ = DatabaseManager(env)._get_connector() + for stmt in connector.to_sql(table): cursor.execute(stmt) map = {