Feat/workflow phase2 (#4687)

This commit is contained in:
Yeuoly
2024-05-27 22:01:11 +08:00
committed by GitHub
parent 45deaee762
commit e852a21634
139 changed files with 5997 additions and 779 deletions

View File

@@ -0,0 +1,32 @@
"""add workflow tool label and tool bindings idx
Revision ID: 03f98355ba0e
Revises: 9e98fbaffb88
Create Date: 2024-05-25 07:17:00.539125
"""
import sqlalchemy as sa
from alembic import op
import models as models
# revision identifiers, used by Alembic.
revision = '03f98355ba0e'
down_revision = '9e98fbaffb88'
branch_labels = None
depends_on = None
def upgrade():
with op.batch_alter_table('tool_label_bindings', schema=None) as batch_op:
batch_op.create_unique_constraint('unique_tool_label_bind', ['tool_id', 'label_name'])
with op.batch_alter_table('tool_workflow_providers', schema=None) as batch_op:
batch_op.add_column(sa.Column('label', sa.String(length=255), server_default='', nullable=False))
def downgrade():
with op.batch_alter_table('tool_workflow_providers', schema=None) as batch_op:
batch_op.drop_column('label')
with op.batch_alter_table('tool_label_bindings', schema=None) as batch_op:
batch_op.drop_constraint('unique_tool_label_bind', type_='unique')

View File

@@ -0,0 +1,42 @@
"""add tool label bings
Revision ID: 3b18fea55204
Revises: 7bdef072e63a
Create Date: 2024-05-14 09:27:18.857890
"""
import sqlalchemy as sa
from alembic import op
import models as models
# revision identifiers, used by Alembic.
revision = '3b18fea55204'
down_revision = '7bdef072e63a'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('tool_label_bindings',
sa.Column('id', models.StringUUID(), server_default=sa.text('uuid_generate_v4()'), nullable=False),
sa.Column('tool_id', sa.String(length=64), nullable=False),
sa.Column('tool_type', sa.String(length=40), nullable=False),
sa.Column('label_name', sa.String(length=40), nullable=False),
sa.PrimaryKeyConstraint('id', name='tool_label_bind_pkey')
)
with op.batch_alter_table('tool_workflow_providers', schema=None) as batch_op:
batch_op.add_column(sa.Column('privacy_policy', sa.String(length=255), server_default='', nullable=True))
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('tool_workflow_providers', schema=None) as batch_op:
batch_op.drop_column('privacy_policy')
op.drop_table('tool_label_bindings')
# ### end Alembic commands ###

View File

@@ -0,0 +1,42 @@
"""add workflow tool
Revision ID: 7bdef072e63a
Revises: 5fda94355fce
Create Date: 2024-05-04 09:47:19.366961
"""
import sqlalchemy as sa
from alembic import op
import models as models
# revision identifiers, used by Alembic.
revision = '7bdef072e63a'
down_revision = '5fda94355fce'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('tool_workflow_providers',
sa.Column('id', models.StringUUID(), server_default=sa.text('uuid_generate_v4()'), nullable=False),
sa.Column('name', sa.String(length=40), nullable=False),
sa.Column('icon', sa.String(length=255), nullable=False),
sa.Column('app_id', models.StringUUID(), nullable=False),
sa.Column('user_id', models.StringUUID(), nullable=False),
sa.Column('tenant_id', models.StringUUID(), nullable=False),
sa.Column('description', sa.Text(), nullable=False),
sa.Column('parameter_configuration', sa.Text(), server_default='[]', nullable=False),
sa.Column('created_at', sa.DateTime(), server_default=sa.text('CURRENT_TIMESTAMP(0)'), nullable=False),
sa.Column('updated_at', sa.DateTime(), server_default=sa.text('CURRENT_TIMESTAMP(0)'), nullable=False),
sa.PrimaryKeyConstraint('id', name='tool_workflow_provider_pkey'),
sa.UniqueConstraint('name', 'tenant_id', name='unique_workflow_tool_provider'),
sa.UniqueConstraint('tenant_id', 'app_id', name='unique_workflow_tool_provider_app_id')
)
# ### end Alembic commands ###
def downgrade():
op.drop_table('tool_workflow_providers')
# ### end Alembic commands ###

View File

@@ -0,0 +1,26 @@
"""add workflow tool version
Revision ID: 9e98fbaffb88
Revises: 3b18fea55204
Create Date: 2024-05-21 10:25:40.434162
"""
import sqlalchemy as sa
from alembic import op
import models as models
# revision identifiers, used by Alembic.
revision = '9e98fbaffb88'
down_revision = '3b18fea55204'
branch_labels = None
depends_on = None
def upgrade():
with op.batch_alter_table('tool_workflow_providers', schema=None) as batch_op:
batch_op.add_column(sa.Column('version', sa.String(length=255), server_default='', nullable=False))
def downgrade():
with op.batch_alter_table('tool_workflow_providers', schema=None) as batch_op:
batch_op.drop_column('version')