Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide OID domains per layers #68

Merged
merged 6 commits into from
Nov 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions modelbaker/dataobjects/layers.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,20 @@ def real_id(self):
else:
return None

@property
def oid_domain(self):
t_ili_tid_field = self.t_ili_tid_field
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
t_ili_tid_field = self.t_ili_tid_field
t_ili_tid_field = self.t_ili_tid_field()

Missing parentheses?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah no its a property...

if t_ili_tid_field:
return t_ili_tid_field.oid_domain
return None

@property
def t_ili_tid_field(self):
for field in self.fields:
if field.name.lower() == "t_ili_tid":
return field
return None

def isPureLinkTable(self, project):
"""
Returns True if the layer is a pure link table in a n:m relation.
Expand Down
3 changes: 2 additions & 1 deletion modelbaker/generator/generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,8 @@ def layers(self, filter_layer_list=[]):
# when there is a t_ili_tid it should be filled up when there is no OID defined in the model
if "oid_domain" not in fielddef or fielddef["oid_domain"] is None:
field.default_value_expression = "substr(uuid(), 2, 36)"

else:
field.oid_domain = fielddef["oid_domain"]
if "enum_domain" in fielddef and fielddef["enum_domain"]:
field.enum_domain = fielddef["enum_domain"]

Expand Down
Loading
Loading