Add "type" field to PipelineRecommendedPlugin model; Add query param "type" to recommended-plugins api.

This commit is contained in:
FFXN 2025-12-16 14:34:59 +08:00
parent 2f54965a72
commit 8dad6b6a6d
2 changed files with 34 additions and 1 deletions

View File

@ -0,0 +1,33 @@
"""add type column not null default tool
Revision ID: 2536f83803a8
Revises: 6bb0832495f0
Create Date: 2025-12-16 14:24:40.740253
"""
from alembic import op
import models as models
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '2536f83803a8'
down_revision = '6bb0832495f0'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('pipeline_recommended_plugins', schema=None) as batch_op:
batch_op.add_column(sa.Column('type', sa.String(length=50), nullable=False, server_default='tool'))
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('pipeline_recommended_plugins', schema=None) as batch_op:
batch_op.drop_column('type')
# ### end Alembic commands ###

View File

@ -1458,7 +1458,7 @@ class PipelineRecommendedPlugin(TypeBase):
)
plugin_id: Mapped[str] = mapped_column(LongText, nullable=False)
provider_name: Mapped[str] = mapped_column(LongText, nullable=False)
type: Mapped[str] = mapped_column(sa.String(50), nullable=True)
type: Mapped[str] = mapped_column(sa.String(50), nullable=False, default="tool")
position: Mapped[int] = mapped_column(sa.Integer, nullable=False, default=0)
active: Mapped[bool] = mapped_column(sa.Boolean, nullable=False, default=True)
created_at: Mapped[datetime] = mapped_column(