소스 검색

refactor(migration/model): update column types for workflow schema (#10160)

tags/0.11.0
-LAN- 1 년 전
부모
커밋
bf048b8d7c
No account linked to committer's email address
2개의 변경된 파일4개의 추가작업 그리고 5개의 파일을 삭제
  1. 1
    3
      api/migrations/versions/2024_11_01_0623-09a8d1878d9b_update_workflows_graph_features_and_.py
  2. 3
    2
      api/models/workflow.py

+ 1
- 3
api/migrations/versions/2024_11_01_0623-09a8d1878d9b_update_workflows_graph_features_and_.py 파일 보기

@@ -39,7 +39,6 @@ def upgrade():
nullable=False)
batch_op.alter_column('features',
existing_type=sa.TEXT(),
type_=sa.String(),
nullable=False)
batch_op.alter_column('updated_at',
existing_type=postgresql.TIMESTAMP(),
@@ -55,8 +54,7 @@ def downgrade():
existing_type=postgresql.TIMESTAMP(),
nullable=True)
batch_op.alter_column('features',
existing_type=sa.String(),
type_=sa.TEXT(),
existing_type=sa.TEXT(),
nullable=True)
batch_op.alter_column('graph',
existing_type=sa.TEXT(),

+ 3
- 2
api/models/workflow.py 파일 보기

@@ -4,6 +4,7 @@ from datetime import datetime
from enum import Enum
from typing import Any, Optional, Union

import sqlalchemy as sa
from sqlalchemy import func
from sqlalchemy.orm import Mapped, mapped_column

@@ -99,8 +100,8 @@ class Workflow(db.Model):
app_id: Mapped[str] = mapped_column(StringUUID, nullable=False)
type: Mapped[str] = mapped_column(db.String(255), nullable=False)
version: Mapped[str] = mapped_column(db.String(255), nullable=False)
graph: Mapped[str] = mapped_column(db.Text)
_features: Mapped[str] = mapped_column("features")
graph: Mapped[str] = mapped_column(sa.Text)
_features: Mapped[str] = mapped_column("features", sa.TEXT)
created_by: Mapped[str] = mapped_column(StringUUID, nullable=False)
created_at: Mapped[datetime] = mapped_column(
db.DateTime, nullable=False, server_default=db.text("CURRENT_TIMESTAMP(0)")

Loading…
취소
저장