mirror of
https://github.com/YFGaia/dify-plus.git
synced 2026-06-12 18:11:42 +08:00
fix: 升级依赖并修复相关问题
- 升级web依赖到最新版本 - 修复1.11.4版本兼容性问题 - 解决google字体dockerfile访问问题 - 恢复丢失的相关文件 - 添加多语言支持 - 调整docker版本及worker镜像配置
This commit is contained in:
@@ -1,45 +0,0 @@
|
||||
"""add_app_extend
|
||||
|
||||
Revision ID: 012_app_extend
|
||||
Revises: 011_system_integration_fields
|
||||
Create Date: 2025-01-15 12:00:00.000000
|
||||
|
||||
"""
|
||||
import sqlalchemy as sa
|
||||
from alembic import op
|
||||
from sqlalchemy.engine.reflection import Inspector
|
||||
|
||||
from models import types
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '012_app_extend'
|
||||
down_revision = '011_system_integration_fields'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
conn = op.get_bind()
|
||||
inspector = Inspector.from_engine(conn)
|
||||
tables = inspector.get_table_names()
|
||||
|
||||
if 'app_extend' not in tables:
|
||||
op.create_table('app_extend',
|
||||
sa.Column('id', types.StringUUID(), server_default=sa.text('uuid_generate_v4()'), nullable=False),
|
||||
sa.Column('app_id', types.StringUUID(), nullable=False),
|
||||
sa.Column('retention_number', sa.Integer(), nullable=True),
|
||||
sa.PrimaryKeyConstraint('id', name='app_extend_joins_pkey')
|
||||
)
|
||||
with op.batch_alter_table('app_extend', schema=None) as batch_op:
|
||||
batch_op.create_index('app_extend_id_app_id_idx', ['app_id'], unique=False)
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
with op.batch_alter_table('app_extend', schema=None) as batch_op:
|
||||
batch_op.drop_index('app_extend_id_app_id_idx')
|
||||
|
||||
op.drop_table('app_extend')
|
||||
# ### end Alembic commands ###
|
||||
@@ -1,48 +0,0 @@
|
||||
"""add_message_context_extend
|
||||
|
||||
Revision ID: 013_message_context_extend
|
||||
Revises: 012_app_extend
|
||||
Create Date: 2025-01-15 13:00:00.000000
|
||||
|
||||
"""
|
||||
import sqlalchemy as sa
|
||||
from alembic import op
|
||||
from sqlalchemy.engine.reflection import Inspector
|
||||
|
||||
from models import types
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '013_message_context_extend'
|
||||
down_revision = '012_app_extend'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
conn = op.get_bind()
|
||||
inspector = Inspector.from_engine(conn)
|
||||
tables = inspector.get_table_names()
|
||||
|
||||
if 'message_context_extend' not in tables:
|
||||
op.create_table('message_context_extend',
|
||||
sa.Column('id', types.StringUUID(), server_default=sa.text('uuid_generate_v4()'), nullable=False),
|
||||
sa.Column('created_at', sa.DateTime(), server_default=sa.text('CURRENT_TIMESTAMP(0)'), nullable=False),
|
||||
sa.Column('conversation_id', sa.String(length=36), nullable=True),
|
||||
sa.Column('message_id', sa.String(length=36), nullable=False),
|
||||
sa.PrimaryKeyConstraint('id', name='message_context_extend_joins_pkey')
|
||||
)
|
||||
with op.batch_alter_table('message_context_extend', schema=None) as batch_op:
|
||||
batch_op.create_index('message_context_conversation_id_idx', ['conversation_id'], unique=False)
|
||||
batch_op.create_index('message_context_created_at_idx', ['created_at'], unique=False)
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
with op.batch_alter_table('message_context_extend', schema=None) as batch_op:
|
||||
batch_op.drop_index('message_context_created_at_idx')
|
||||
batch_op.drop_index('message_context_conversation_id_idx')
|
||||
|
||||
op.drop_table('message_context_extend')
|
||||
# ### end Alembic commands ###
|
||||
+62
@@ -0,0 +1,62 @@
|
||||
"""add_account_money_extend_unique_constraint
|
||||
|
||||
Revision ID: 012_account_money_extend_unique
|
||||
Revises: 011_system_integration_fields
|
||||
Create Date: 2025-10-21 18:00:00.000000
|
||||
|
||||
"""
|
||||
import sqlalchemy as sa
|
||||
from alembic import op
|
||||
from sqlalchemy.engine.reflection import Inspector
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '012_account_money_extend_unique'
|
||||
down_revision = '011_system_integration_fields'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
conn = op.get_bind()
|
||||
inspector = Inspector.from_engine(conn)
|
||||
tables = inspector.get_table_names()
|
||||
|
||||
if 'account_money_extend' in tables:
|
||||
# 首先删除重复数据,只保留每个account_id中updated_at最大的记录
|
||||
conn.execute(sa.text("""
|
||||
DELETE FROM account_money_extend
|
||||
WHERE id NOT IN (
|
||||
SELECT DISTINCT ON (account_id) id
|
||||
FROM account_money_extend
|
||||
ORDER BY account_id, updated_at DESC
|
||||
)
|
||||
"""))
|
||||
|
||||
# 删除现有的普通索引
|
||||
with op.batch_alter_table('account_money_extend', schema=None) as batch_op:
|
||||
try:
|
||||
batch_op.drop_index('idx_account_money_account_id')
|
||||
except Exception:
|
||||
# 如果索引不存在,忽略错误
|
||||
pass
|
||||
|
||||
# 创建唯一约束
|
||||
with op.batch_alter_table('account_money_extend', schema=None) as batch_op:
|
||||
batch_op.create_unique_constraint('idx_account_money_account_id_unique', ['account_id'])
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
if 'account_money_extend' in tables:
|
||||
with op.batch_alter_table('account_money_extend', schema=None) as batch_op:
|
||||
try:
|
||||
batch_op.drop_constraint('idx_account_money_account_id_unique', type_='unique')
|
||||
except Exception:
|
||||
# 如果约束不存在,忽略错误
|
||||
pass
|
||||
|
||||
# 重新创建普通索引
|
||||
batch_op.create_index('idx_account_money_account_id', ['account_id'], unique=False)
|
||||
# ### end Alembic commands ###
|
||||
Reference in New Issue
Block a user