Skip to content

Commit

Permalink
fix(docker-jans-persistence-loader): handle missing data type for ove…
Browse files Browse the repository at this point in the history
…rriden column (#8392)

* fix(docker-jans-persistence-loader): handle missing data type for overriden column

Signed-off-by: iromli <isman.firmansyah@gmail.com>

* fix: handle scripts properties changes

Signed-off-by: iromli <isman.firmansyah@gmail.com>

* fix: handle non-collection properties

Signed-off-by: iromli <isman.firmansyah@gmail.com>

---------

Signed-off-by: iromli <isman.firmansyah@gmail.com>
  • Loading branch information
iromli committed Apr 28, 2024
1 parent 96aa200 commit 5b25766
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
3 changes: 3 additions & 0 deletions docker-jans-persistence-loader/scripts/spanner_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ def get_data_type(self, attr, table=None):

type_ = type_def.get(self.client.dialect)

if not type_:
continue

if table in type_.get("tables", {}):
type_ = type_["tables"][table]

Expand Down
3 changes: 3 additions & 0 deletions docker-jans-persistence-loader/scripts/sql_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ def get_data_type(self, attr, table=None):

type_ = type_def.get(self.client.dialect) or type_def["mysql"]

if not type_:
continue

if table in type_.get("tables", {}):
type_ = type_["tables"][table]

Expand Down
10 changes: 5 additions & 5 deletions docker-jans-persistence-loader/scripts/upgrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,9 +369,10 @@ def update_scripts_entries(self):
else:
props = agama_entry.attrs["jansConfProperty"]

if self.backend.type != "couchbase":
# try converting to mapping
props = [json.loads(prop) for prop in props]
if not isinstance(props, list):
props = [props]

props = [json.loads(prop) for prop in props]

# filter out unwanted properties
new_props = [
Expand All @@ -380,8 +381,7 @@ def update_scripts_entries(self):
]

if new_props != props:
if self.backend.type != "couchbase":
new_props = [json.dumps(prop) for prop in new_props]
new_props = [json.dumps(prop) for prop in new_props]

if self.backend.type == "sql" and self.backend.client.dialect == "mysql":
agama_entry.attrs["jansConfProperty"]["v"] = new_props
Expand Down

0 comments on commit 5b25766

Please sign in to comment.