Skip to content

Commit

Permalink
handle list of enums
Browse files Browse the repository at this point in the history
  • Loading branch information
rpiazza committed Apr 2, 2024
1 parent e78a837 commit 8a5685d
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions stix2/datastore/relational_db/table_creation.py
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,21 @@ def generate_table_information(self, name, metadata, schema_name, table_name, **
schema_name,
),
]
elif isinstance(self.contained, EnumProperty):
columns = list()
columns.append(
Column(
"id",
Text,
ForeignKey(
canonicalize_table_name(table_name, schema_name) + ".id",
ondelete="CASCADE",
),
nullable=False,
),
)
columns.append(self.contained.generate_table_information(name))
tables.append(Table(canonicalize_table_name(table_name + "_" + name), metadata, *columns, schema=schema_name))
elif isinstance(self.contained, EmbeddedObjectProperty):
columns = list()
columns.append(
Expand Down

0 comments on commit 8a5685d

Please sign in to comment.