Author: jure
Date: Wed Jan 23 13:24:12 2013
New Revision: 1437383
URL: http://svn.apache.org/viewvc?rev=1437383&view=rev
Log:
#115, ProductSetting table should be introduced as part of the environment
upgrade and not as part of initial database schema so that existing
environments can be upgraded
Modified:
incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/multiproduct/api.py
Modified:
incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/multiproduct/api.py
URL:
http://svn.apache.org/viewvc/incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/multiproduct/api.py?rev=1437383&r1=1437382&r2=1437383&view=diff
==============================================================================
---
incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/multiproduct/api.py
(original)
+++
incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/multiproduct/api.py
Wed Jan 23 13:24:12 2013
@@ -33,7 +33,7 @@ from trac.web.chrome import ITemplatePro
from multiproduct.model import Product, ProductResourceMap, ProductSetting
-DB_VERSION = 3
+DB_VERSION = 4
DB_SYSTEM_KEY = 'bloodhound_multi_product_version'
PLUGIN_NAME = 'Bloodhound multi product'
@@ -44,7 +44,7 @@ class MultiProductSystem(Component):
IPermissionRequestor, ITicketFieldProvider, IResourceManager)
SCHEMA = [mcls._get_schema() \
- for mcls in (Product, ProductResourceMap, ProductSetting)]
+ for mcls in (Product, ProductResourceMap)]
def get_version(self):
"""Finds the current version of the bloodhound database schema"""
@@ -191,6 +191,14 @@ class MultiProductSystem(Component):
insert_with_product(table, p[0])
db_installed_version = self._update_db_version(db, 3)
+ if db_installed_version < 4:
+ self.log.debug("creating additional db tables for %s plugin." %
+ PLUGIN_NAME)
+ db_connector, dummy =
DatabaseManager(self.env)._get_connector()
+ for statement in
db_connector.to_sql(ProductSetting._get_schema()):
+ db(statement)
+ db_installed_version = self._update_db_version(db, 4)
+
# ITemplateProvider methods
def get_templates_dirs(self):
"""provide the plugin templates"""