Skip to content

Commit

Permalink
Make columns non-nullable
Browse files Browse the repository at this point in the history
  • Loading branch information
schustmi committed Dec 9, 2024
1 parent bd5bc41 commit 882d841
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Add model version producer run unique constraint [cd7b17d5a3c3].
"""Add model version producer run index [cd7b17d5a3c3].
Revision ID: cd7b17d5a3c3
Revises: 0.71.0
Expand Down Expand Up @@ -28,7 +28,7 @@ def upgrade() -> None:
sa.Computed(
"name == number",
),
nullable=True,
nullable=False,
)
)
batch_op.add_column(
Expand All @@ -43,7 +43,7 @@ def upgrade() -> None:
sa.Computed(
"CASE WHEN producer_run_id IS NOT NULL THEN producer_run_id ELSE id END",
),
nullable=True,
nullable=False,
)
)
batch_op.create_index(
Expand Down
3 changes: 2 additions & 1 deletion src/zenml/zen_stores/schemas/model_schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ class ModelVersionSchema(NamedSchema, RunMetadataInterface, table=True):
)

is_numeric: bool = Field(
sa_column=Column(BOOLEAN, Computed("name = number"))
sa_column=Column(BOOLEAN, Computed("name = number"), nullable=False)
)

# Don't use a foreign key here here to avoid a cycle
Expand All @@ -357,6 +357,7 @@ class ModelVersionSchema(NamedSchema, RunMetadataInterface, table=True):
Computed(
"CASE WHEN producer_run_id IS NOT NULL THEN producer_run_id ELSE id END"
),
nullable=False
)
)

Expand Down

0 comments on commit 882d841

Please sign in to comment.