Skip to content

Commit

Permalink
feat: add description column to MLModelSQL with default message (#190)
Browse files Browse the repository at this point in the history
* feat: add description column to MLModelSQL with default message

* done formatting using black
  • Loading branch information
MAYANK12SHARMA authored Jan 20, 2025
1 parent 4084571 commit 36e4c94
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
"""Add description column to MLModelSQL
Revision ID: fa74fbe945fd
Revises: 12c0ccf6b825
Create Date: 2025-01-19 18:19:45.306091
"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = 'fa74fbe945fd'
down_revision = '12c0ccf6b825'
branch_labels = None
depends_on = None


def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('ml_model', sa.Column('description', sa.String(), server_default='No description provided.', nullable=True))
# ### end Alembic commands ###


def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column('ml_model', 'description')
# ### end Alembic commands ###
3 changes: 3 additions & 0 deletions pvsite_datamodel/sqlmodels.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ class MLModelSQL(Base, CreatedMixin):
name = sa.Column(sa.String)
version = sa.Column(sa.String)

# Add description with default message
description = sa.Column(sa.String, nullable=True, server_default="No description provided.")

forecast_values: Mapped[List["ForecastValueSQL"]] = relationship(
"ForecastValueSQL", back_populates="ml_model"
)
Expand Down

0 comments on commit 36e4c94

Please sign in to comment.