File size: 1,304 Bytes
551658a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
from sqlalchemy import Column, Integer, String, Text, DateTime, ForeignKey
from sqlalchemy.sql import text
from database import Base

class CustomerRelationship(Base):
    __tablename__ = "customer_relationships"
    
    id = Column(Integer, primary_key=True, index=True, comment='主键ID')
    company_code = Column(String(50), nullable=False, server_default="", index=True, comment='公司编码')
    customer_name = Column(String(100), nullable=False, server_default="", comment='客户名称')
    contact_person = Column(String(100), nullable=False, server_default="", comment='联系人')
    phone = Column(String(50), nullable=False, server_default="", comment='电话')
    email = Column(String(100), nullable=False, server_default="", comment='邮箱')
    social_media = Column(Text, nullable=False, default="", comment='社交平台账号,JSON格式')
    address = Column(Text, nullable=False, default="", comment='地址')
    notes = Column(Text, nullable=False, default="", comment='备注')
    created_at = Column(DateTime(timezone=True), nullable=False, server_default=text('CURRENT_TIMESTAMP'), comment='创建时间')
    updated_at = Column(DateTime(timezone=True), nullable=False, server_default=text('CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP'), comment='更新时间')