|
@@ -23,20 +23,20 @@ def upgrade() -> None:
|
|
|
op.execute("DROP TABLE IF EXISTS contract_bundle")
|
|
op.execute("DROP TABLE IF EXISTS contract_bundle")
|
|
|
op.create_table(
|
|
op.create_table(
|
|
|
"contract_bundle",
|
|
"contract_bundle",
|
|
|
- sa.Column("id", sa.BigInteger(), autoincrement=True, nullable=False),
|
|
|
|
|
- sa.Column("subject_type", sa.String(length=20), nullable=False),
|
|
|
|
|
- sa.Column("subject_id", sa.BigInteger(), nullable=False),
|
|
|
|
|
- sa.Column("subject_name", sa.String(length=120), nullable=False),
|
|
|
|
|
- sa.Column("business_segment", sa.String(length=100), nullable=False),
|
|
|
|
|
- sa.Column("contact_name", sa.String(length=100), nullable=False),
|
|
|
|
|
- sa.Column("contact_phone", sa.String(length=20), nullable=False),
|
|
|
|
|
- sa.Column("ord_id", sa.String(length=40), nullable=False),
|
|
|
|
|
- sa.Column("bundle_type", sa.String(length=50), nullable=False),
|
|
|
|
|
- sa.Column("status", sa.String(length=20), nullable=False, server_default="未签署"),
|
|
|
|
|
- sa.Column("primary_document_id", sa.BigInteger(), nullable=True),
|
|
|
|
|
- sa.Column("created_time", sa.DateTime(), server_default=sa.text("now()"), nullable=False),
|
|
|
|
|
- sa.Column("updated_time", sa.DateTime(), server_default=sa.text("now()"), nullable=False),
|
|
|
|
|
- sa.Column("delete_flag", sa.Integer(), server_default="0", nullable=False),
|
|
|
|
|
|
|
+ sa.Column("id", sa.BigInteger(), autoincrement=True, nullable=False, comment="合同包唯一标识"),
|
|
|
|
|
+ sa.Column("subject_type", sa.String(length=20), nullable=False, comment="签约主体类型(store/lawyer)"),
|
|
|
|
|
+ sa.Column("subject_id", sa.BigInteger(), nullable=False, comment="签约主体ID,关联门店/律师业务主键"),
|
|
|
|
|
+ sa.Column("subject_name", sa.String(length=120), nullable=False, comment="签约主体名称"),
|
|
|
|
|
+ sa.Column("business_segment", sa.String(length=100), nullable=False, comment="业务板块"),
|
|
|
|
|
+ sa.Column("contact_name", sa.String(length=100), nullable=False, comment="联系人姓名"),
|
|
|
|
|
+ sa.Column("contact_phone", sa.String(length=20), nullable=False, comment="联系人手机号"),
|
|
|
|
|
+ sa.Column("ord_id", sa.String(length=40), nullable=False, comment="组织标识(统一社会信用代码)"),
|
|
|
|
|
+ sa.Column("bundle_type", sa.String(length=50), nullable=False, comment="合同包类型(STORE_STANDARD/LAWYER_STANDARD)"),
|
|
|
|
|
+ sa.Column("status", sa.String(length=20), nullable=False, server_default="未签署", comment="整体状态: 未签署/审核中/已签署"),
|
|
|
|
|
+ sa.Column("primary_document_id", sa.BigInteger(), nullable=True, comment="主合同文档ID"),
|
|
|
|
|
+ sa.Column("created_time", sa.DateTime(), server_default=sa.text("now()"), nullable=False, comment="创建时间"),
|
|
|
|
|
+ sa.Column("updated_time", sa.DateTime(), server_default=sa.text("now()"), nullable=False, comment="更新时间"),
|
|
|
|
|
+ sa.Column("delete_flag", sa.Integer(), server_default="0", nullable=False, comment="逻辑删除(0未删/1已删)"),
|
|
|
sa.PrimaryKeyConstraint("id"),
|
|
sa.PrimaryKeyConstraint("id"),
|
|
|
)
|
|
)
|
|
|
op.create_index("idx_contract_bundle_subject", "contract_bundle", ["subject_type", "subject_id"], unique=False)
|
|
op.create_index("idx_contract_bundle_subject", "contract_bundle", ["subject_type", "subject_id"], unique=False)
|
|
@@ -44,23 +44,23 @@ def upgrade() -> None:
|
|
|
|
|
|
|
|
op.create_table(
|
|
op.create_table(
|
|
|
"contract_document",
|
|
"contract_document",
|
|
|
- sa.Column("id", sa.BigInteger(), autoincrement=True, nullable=False),
|
|
|
|
|
- sa.Column("bundle_id", sa.BigInteger(), nullable=False),
|
|
|
|
|
- sa.Column("contract_type", sa.String(length=50), nullable=False),
|
|
|
|
|
- sa.Column("contract_name", sa.String(length=100), nullable=False),
|
|
|
|
|
- sa.Column("is_primary", sa.Integer(), nullable=False, server_default="0"),
|
|
|
|
|
- sa.Column("status", sa.Integer(), nullable=False, server_default="0"),
|
|
|
|
|
- sa.Column("sign_flow_id", sa.String(length=64), nullable=False),
|
|
|
|
|
- sa.Column("file_id", sa.String(length=64), nullable=False),
|
|
|
|
|
- sa.Column("template_url", mysql.LONGTEXT(), nullable=False),
|
|
|
|
|
- sa.Column("sign_url", mysql.LONGTEXT(), nullable=False),
|
|
|
|
|
- sa.Column("download_url", mysql.LONGTEXT(), nullable=False),
|
|
|
|
|
- sa.Column("signing_time", sa.DateTime(), nullable=True),
|
|
|
|
|
- sa.Column("effective_time", sa.DateTime(), nullable=True),
|
|
|
|
|
- sa.Column("expiry_time", sa.DateTime(), nullable=True),
|
|
|
|
|
- sa.Column("created_time", sa.DateTime(), server_default=sa.text("now()"), nullable=False),
|
|
|
|
|
- sa.Column("updated_time", sa.DateTime(), server_default=sa.text("now()"), nullable=False),
|
|
|
|
|
- sa.Column("delete_flag", sa.Integer(), server_default="0", nullable=False),
|
|
|
|
|
|
|
+ sa.Column("id", sa.BigInteger(), autoincrement=True, nullable=False, comment="合同文档唯一标识"),
|
|
|
|
|
+ sa.Column("bundle_id", sa.BigInteger(), nullable=False, comment="所属合同包ID"),
|
|
|
|
|
+ sa.Column("contract_type", sa.String(length=50), nullable=False, comment="合同类型编码(store_agreement/alipay_auth等)"),
|
|
|
|
|
+ sa.Column("contract_name", sa.String(length=100), nullable=False, comment="合同展示名称"),
|
|
|
|
|
+ sa.Column("is_primary", sa.Integer(), nullable=False, server_default="0", comment="是否主合同(1是/0否)"),
|
|
|
|
|
+ sa.Column("status", sa.Integer(), nullable=False, server_default="0", comment="签署状态(0未签署/1已签署)"),
|
|
|
|
|
+ sa.Column("sign_flow_id", sa.String(length=64), nullable=False, comment="e签宝签署流程ID"),
|
|
|
|
|
+ sa.Column("file_id", sa.String(length=64), nullable=False, comment="e签宝文件ID"),
|
|
|
|
|
+ sa.Column("template_url", mysql.LONGTEXT(), nullable=False, comment="合同模板预览URL"),
|
|
|
|
|
+ sa.Column("sign_url", mysql.LONGTEXT(), nullable=False, comment="签署链接URL"),
|
|
|
|
|
+ sa.Column("download_url", mysql.LONGTEXT(), nullable=False, comment="签署完成后的下载URL"),
|
|
|
|
|
+ sa.Column("signing_time", sa.DateTime(), nullable=True, comment="签署时间"),
|
|
|
|
|
+ sa.Column("effective_time", sa.DateTime(), nullable=True, comment="合同生效时间"),
|
|
|
|
|
+ sa.Column("expiry_time", sa.DateTime(), nullable=True, comment="合同到期时间"),
|
|
|
|
|
+ sa.Column("created_time", sa.DateTime(), server_default=sa.text("now()"), nullable=False, comment="创建时间"),
|
|
|
|
|
+ sa.Column("updated_time", sa.DateTime(), server_default=sa.text("now()"), nullable=False, comment="更新时间"),
|
|
|
|
|
+ sa.Column("delete_flag", sa.Integer(), server_default="0", nullable=False, comment="逻辑删除(0未删/1已删)"),
|
|
|
sa.ForeignKeyConstraint(["bundle_id"], ["contract_bundle.id"]),
|
|
sa.ForeignKeyConstraint(["bundle_id"], ["contract_bundle.id"]),
|
|
|
sa.PrimaryKeyConstraint("id"),
|
|
sa.PrimaryKeyConstraint("id"),
|
|
|
)
|
|
)
|
|
@@ -70,15 +70,15 @@ def upgrade() -> None:
|
|
|
|
|
|
|
|
op.create_table(
|
|
op.create_table(
|
|
|
"contract_event",
|
|
"contract_event",
|
|
|
- sa.Column("id", sa.BigInteger(), autoincrement=True, nullable=False),
|
|
|
|
|
- sa.Column("bundle_id", sa.BigInteger(), nullable=True),
|
|
|
|
|
- sa.Column("document_id", sa.BigInteger(), nullable=True),
|
|
|
|
|
- sa.Column("sign_flow_id", sa.String(length=64), nullable=False),
|
|
|
|
|
- sa.Column("event_type", sa.String(length=50), nullable=False),
|
|
|
|
|
- sa.Column("payload_json", mysql.LONGTEXT(), nullable=False),
|
|
|
|
|
- sa.Column("created_time", sa.DateTime(), server_default=sa.text("now()"), nullable=False),
|
|
|
|
|
- sa.Column("updated_time", sa.DateTime(), server_default=sa.text("now()"), nullable=False),
|
|
|
|
|
- sa.Column("delete_flag", sa.Integer(), server_default="0", nullable=False),
|
|
|
|
|
|
|
+ sa.Column("id", sa.BigInteger(), autoincrement=True, nullable=False, comment="事件唯一标识"),
|
|
|
|
|
+ sa.Column("bundle_id", sa.BigInteger(), nullable=True, comment="关联合同包ID"),
|
|
|
|
|
+ sa.Column("document_id", sa.BigInteger(), nullable=True, comment="关联合同文档ID"),
|
|
|
|
|
+ sa.Column("sign_flow_id", sa.String(length=64), nullable=False, comment="e签宝签署流程ID"),
|
|
|
|
|
+ sa.Column("event_type", sa.String(length=50), nullable=False, comment="事件类型(esign_callback:{action})"),
|
|
|
|
|
+ sa.Column("payload_json", mysql.LONGTEXT(), nullable=False, comment="e签宝回调原始JSON报文"),
|
|
|
|
|
+ sa.Column("created_time", sa.DateTime(), server_default=sa.text("now()"), nullable=False, comment="创建时间"),
|
|
|
|
|
+ sa.Column("updated_time", sa.DateTime(), server_default=sa.text("now()"), nullable=False, comment="更新时间"),
|
|
|
|
|
+ sa.Column("delete_flag", sa.Integer(), server_default="0", nullable=False, comment="逻辑删除(0未删/1已删)"),
|
|
|
sa.PrimaryKeyConstraint("id"),
|
|
sa.PrimaryKeyConstraint("id"),
|
|
|
)
|
|
)
|
|
|
op.create_index("idx_contract_event_sign_flow_id", "contract_event", ["sign_flow_id"], unique=False)
|
|
op.create_index("idx_contract_event_sign_flow_id", "contract_event", ["sign_flow_id"], unique=False)
|