🔧 chore(alembic): add migration script for changes related to the store
🔧 chore(flow.py): add new field 'is_component' to the Flow model to support store functionality 🔧 chore(user.py): add new field 'store_api_key' to the User model to support store functionality
This commit is contained in:
parent
eded928bf4
commit
878e158ac8
3 changed files with 43 additions and 0 deletions
|
|
@ -0,0 +1,41 @@
|
|||
"""Changes for the store
|
||||
|
||||
Revision ID: 595c9c2a2ad4
|
||||
Revises: eb5866d51fd2
|
||||
Create Date: 2023-10-18 16:27:37.781613
|
||||
|
||||
"""
|
||||
from typing import Sequence, Union
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
import sqlmodel
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision: str = '595c9c2a2ad4'
|
||||
down_revision: Union[str, None] = 'eb5866d51fd2'
|
||||
branch_labels: Union[str, Sequence[str], None] = None
|
||||
depends_on: Union[str, Sequence[str], None] = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
with op.batch_alter_table('flow', schema=None) as batch_op:
|
||||
batch_op.add_column(sa.Column('is_component', sa.Boolean(), nullable=False))
|
||||
|
||||
with op.batch_alter_table('user', schema=None) as batch_op:
|
||||
batch_op.add_column(sa.Column('store_api_key', sqlmodel.sql.sqltypes.AutoString(), nullable=True))
|
||||
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
with op.batch_alter_table('user', schema=None) as batch_op:
|
||||
batch_op.drop_column('store_api_key')
|
||||
|
||||
with op.batch_alter_table('flow', schema=None) as batch_op:
|
||||
batch_op.drop_column('is_component')
|
||||
|
||||
# ### end Alembic commands ###
|
||||
|
|
@ -15,6 +15,7 @@ class FlowBase(SQLModelSerializable):
|
|||
name: str = Field(index=True)
|
||||
description: Optional[str] = Field(index=True)
|
||||
data: Optional[Dict] = Field(default=None, nullable=True)
|
||||
is_component: bool = Field(default=False)
|
||||
|
||||
@validator("data")
|
||||
def validate_json(v):
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ class User(SQLModelSerializable, table=True):
|
|||
back_populates="user",
|
||||
sa_relationship_kwargs={"cascade": "delete"},
|
||||
)
|
||||
store_api_key: str = Field(default=None, nullable=True)
|
||||
flows: list["Flow"] = Relationship(back_populates="user")
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue