From 4d25f65e78ed2343cde4948172d876e084764731 Mon Sep 17 00:00:00 2001 From: Patrick Uiterwijk Date: Fri, 4 Sep 2015 22:28:40 +0200 Subject: [PATCH 1/1] Also create plugin UserStore data tables Signed-off-by: Patrick Uiterwijk Reviewed-by: Rob Crittenden --- ipsilon/tools/dbupgrade.py | 3 +++ ipsilon/util/data.py | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/ipsilon/tools/dbupgrade.py b/ipsilon/tools/dbupgrade.py index 7e008f2..021acf3 100644 --- a/ipsilon/tools/dbupgrade.py +++ b/ipsilon/tools/dbupgrade.py @@ -96,6 +96,7 @@ def execute_upgrade(cfgfile): return upgrade_failed() # And now datastores for any of the plugins + userstore = UserStore() for facility in ['provider_config', 'login_config', 'info_config']: @@ -104,6 +105,8 @@ def execute_upgrade(cfgfile): plugin = root._site[facility].available[plugin] logger.debug('Creating plugin AdminStore table') adminstore.create_plugin_data_table(plugin.name) + logger.debug('Creating plugin UserStore table') + userstore.create_plugin_data_table(plugin.name) for store in plugin.used_datastores(): logger.debug('Handling plugin datastore %s', store.__class__.__name__) diff --git a/ipsilon/util/data.py b/ipsilon/util/data.py index 7f387b7..65bf4b5 100644 --- a/ipsilon/util/data.py +++ b/ipsilon/util/data.py @@ -739,6 +739,14 @@ class UserStore(Store): else: raise NotImplementedError() + def create_plugin_data_table(self, plugin_name): + if not self.is_readonly: + table = plugin_name+'_data' + q = self._query(self._db, table, OPTIONS_TABLE, + trans=False) + q.create() + q._con.close() # pylint: disable=protected-access + class TranStore(Store): -- 2.20.1