From b8fb658e36eb13e0d6199eeec093733bf167ca1a Mon Sep 17 00:00:00 2001 From: Mustafa Baser Date: Wed, 23 Mar 2022 23:40:12 +0300 Subject: [PATCH] feat(jans-linux-setup): multivalued json enhancement (#1102) --- jans-linux-setup/jans_setup/setup_app/installers/rdbm.py | 6 ------ jans-linux-setup/jans_setup/setup_app/utils/db_utils.py | 4 ++++ 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/jans-linux-setup/jans_setup/setup_app/installers/rdbm.py b/jans-linux-setup/jans_setup/setup_app/installers/rdbm.py index fd400ace54f..27ff2043979 100644 --- a/jans-linux-setup/jans_setup/setup_app/installers/rdbm.py +++ b/jans-linux-setup/jans_setup/setup_app/installers/rdbm.py @@ -86,12 +86,6 @@ def local_install(self): def get_sql_col_type(self, attrname, table=None): - for attr_ in self.jans_attributes: - if attrname in attr_['names'] and attr_.get('multivalued'): - if Config.rdbm_type == 'spanner': - return 'ARRAY' - return 'JSON' - if attrname in self.dbUtils.sql_data_types: type_ = self.dbUtils.sql_data_types[attrname].get(Config.rdbm_type) or self.dbUtils.sql_data_types[attrname]['mysql'] if table in type_.get('tables', {}): diff --git a/jans-linux-setup/jans_setup/setup_app/utils/db_utils.py b/jans-linux-setup/jans_setup/setup_app/utils/db_utils.py index 743a2a35946..89c8d3abde4 100644 --- a/jans-linux-setup/jans_setup/setup_app/utils/db_utils.py +++ b/jans-linux-setup/jans_setup/setup_app/utils/db_utils.py @@ -149,6 +149,10 @@ def read_jans_schema(self, others=[]): self.opendj_attributes_syntax = base.readJsonFile(os.path.join(Config.static_rdbm_dir, 'opendj_attributes_syntax.json')) self.sub_tables = base.readJsonFile(os.path.join(Config.static_rdbm_dir, 'sub_tables.json')) + for attr in attribDataTypes.listAttributes: + if not attr in self.sql_data_types: + self.sql_data_types[attr] = { 'mysql': {'type': 'JSON'}, 'spanner': {'type': 'ARRAY'} } + def in_subtable(self, table, attr): if table in self.sub_tables[Config.rdbm_type]: for stbl in self.sub_tables[Config.rdbm_type][table]: