Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

remove built-in pipeline template user field (#27184)

Jyong05f66fcf0d89
diff --git a/api/migrations/versions/2025_10_21_1430-ae662b25d9bc_remove_builtin_template_user.py b/api/migrations/versions/2025_10_21_1430-ae662b25d9bc_remove_builtin_template_user.py
new file mode 100644
index 00000000000..086a02e7c35
--- /dev/null
+++ b/api/migrations/versions/2025_10_21_1430-ae662b25d9bc_remove_builtin_template_user.py
@@ -0,0 +1,36 @@
+"""remove-builtin-template-user
+
+Revision ID: ae662b25d9bc
+Revises: d98acf217d43
+Create Date: 2025-10-21 14:30:28.566192
+
+"""
+from alembic import op
+import models as models
+import sqlalchemy as sa
+
+
+# revision identifiers, used by Alembic.
+revision = 'ae662b25d9bc'
+down_revision = 'd98acf217d43'
+branch_labels = None
+depends_on = None
+
+
+def upgrade():
+ # ### commands auto generated by Alembic - please adjust! ###
+
+ with op.batch_alter_table('pipeline_built_in_templates', schema=None) as batch_op:
+ batch_op.drop_column('updated_by')
+ batch_op.drop_column('created_by')
+
+ # ### end Alembic commands ###
+
+
+def downgrade():
+ # ### commands auto generated by Alembic - please adjust! ###
+ with op.batch_alter_table('pipeline_built_in_templates', schema=None) as batch_op:
+ batch_op.add_column(sa.Column('created_by', sa.UUID(), autoincrement=False, nullable=False))
+ batch_op.add_column(sa.Column('updated_by', sa.UUID(), autoincrement=False, nullable=True))
+
+ # ### end Alembic commands ###
diff --git a/api/models/dataset.py b/api/models/dataset.py
index 5653445f2bf..4a9e2688b8d 100644
--- a/api/models/dataset.py
+++ b/api/models/dataset.py
@@ -1239,15 +1239,6 @@ class PipelineBuiltInTemplate(Base): # type: ignore[name-defined]
language = mapped_column(db.String(255), nullable=False)
created_at = mapped_column(sa.DateTime, nullable=False, server_default=func.current_timestamp())
updated_at = mapped_column(sa.DateTime, nullable=False, server_default=func.current_timestamp())
- created_by = mapped_column(StringUUID, nullable=False)
- updated_by = mapped_column(StringUUID, nullable=True)
-
- @property
- def created_user_name(self):
- account = db.session.query(Account).where(Account.id == self.created_by).first()
- if account:
- return account.name
- return ""
class PipelineCustomizedTemplate(Base): # type: ignore[name-defined]
diff --git a/api/services/rag_pipeline/pipeline_template/database/database_retrieval.py b/api/services/rag_pipeline/pipeline_template/database/database_retrieval.py
index ec91f79606f..908f9a26840 100644
--- a/api/services/rag_pipeline/pipeline_template/database/database_retrieval.py
+++ b/api/services/rag_pipeline/pipeline_template/database/database_retrieval.py
@@ -74,5 +74,4 @@ class DatabasePipelineTemplateRetrieval(PipelineTemplateRetrievalBase):
"chunk_structure": pipeline_template.chunk_structure,
"export_data": pipeline_template.yaml_content,
"graph": graph_data,
- "created_by": pipeline_template.created_user_name,
}