mirror of
https://github.com/langgenius/dify.git
synced 2026-05-06 02:18:08 +08:00
feat: sandbox provider configuration
This commit is contained in:
@ -0,0 +1,56 @@
|
||||
"""sandbox_providers
|
||||
|
||||
Revision ID: aab323465866
|
||||
Revises: 03ea244985ce
|
||||
Create Date: 2026-01-08 10:31:05.062722
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import models as models
|
||||
import sqlalchemy as sa
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'aab323465866'
|
||||
down_revision = '03ea244985ce'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_table('sandbox_provider_system_config',
|
||||
sa.Column('id', models.types.StringUUID(), nullable=False),
|
||||
sa.Column('provider_type', sa.String(length=50), nullable=False, comment='e2b, docker, local'),
|
||||
sa.Column('encrypted_config', models.types.LongText(), nullable=False, comment='Encrypted config JSON'),
|
||||
sa.Column('created_at', sa.DateTime(), server_default=sa.text('CURRENT_TIMESTAMP'), nullable=False),
|
||||
sa.Column('updated_at', sa.DateTime(), server_default=sa.text('CURRENT_TIMESTAMP'), nullable=False),
|
||||
sa.PrimaryKeyConstraint('id', name='sandbox_provider_system_config_pkey'),
|
||||
sa.UniqueConstraint('provider_type', name='unique_sandbox_provider_system_config_type')
|
||||
)
|
||||
op.create_table('sandbox_providers',
|
||||
sa.Column('id', models.types.StringUUID(), nullable=False),
|
||||
sa.Column('tenant_id', models.types.StringUUID(), nullable=False),
|
||||
sa.Column('provider_type', sa.String(length=50), nullable=False, comment='e2b, docker, local'),
|
||||
sa.Column('encrypted_config', models.types.LongText(), nullable=False, comment='Encrypted config JSON'),
|
||||
sa.Column('is_active', sa.Boolean(), server_default=sa.text('false'), nullable=False),
|
||||
sa.Column('created_at', sa.DateTime(), server_default=sa.text('CURRENT_TIMESTAMP'), nullable=False),
|
||||
sa.Column('updated_at', sa.DateTime(), server_default=sa.text('CURRENT_TIMESTAMP'), nullable=False),
|
||||
sa.PrimaryKeyConstraint('id', name='sandbox_provider_pkey'),
|
||||
sa.UniqueConstraint('tenant_id', 'provider_type', name='unique_sandbox_provider_tenant_type')
|
||||
)
|
||||
with op.batch_alter_table('sandbox_providers', schema=None) as batch_op:
|
||||
batch_op.create_index('idx_sandbox_providers_tenant_active', ['tenant_id', 'is_active'], unique=False)
|
||||
batch_op.create_index('idx_sandbox_providers_tenant_id', ['tenant_id'], unique=False)
|
||||
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
with op.batch_alter_table('sandbox_providers', schema=None) as batch_op:
|
||||
batch_op.drop_index('idx_sandbox_providers_tenant_id')
|
||||
batch_op.drop_index('idx_sandbox_providers_tenant_active')
|
||||
|
||||
op.drop_table('sandbox_providers')
|
||||
op.drop_table('sandbox_provider_system_config')
|
||||
# ### end Alembic commands ###
|
||||
Reference in New Issue
Block a user