first commit
This commit is contained in:
20
backend/app/models/order.py
Normal file
20
backend/app/models/order.py
Normal file
@@ -0,0 +1,20 @@
|
||||
from sqlalchemy import Column, Integer, String, DateTime, Float
|
||||
from sqlalchemy.sql import func
|
||||
from app.models import Base
|
||||
from app.config import TABLE_PREFIX
|
||||
|
||||
class OrderRecord(Base):
|
||||
__tablename__ = f"{TABLE_PREFIX}Order_Records"
|
||||
|
||||
id = Column(Integer, primary_key=True, index=True)
|
||||
order_id = Column(String(50), index=True, nullable=False) # 移除 unique,訂單可能有多個項次
|
||||
order_no = Column(String(50), index=True)
|
||||
cust_id = Column(String(100), index=True)
|
||||
customer = Column(String(255), nullable=False, index=True)
|
||||
customer_normalized = Column(String(255), index=True)
|
||||
pn = Column(String(100), nullable=False, index=True)
|
||||
qty = Column(Integer, default=0)
|
||||
status = Column(String(50), default='Backlog') # 改為 String 以支援中文狀態
|
||||
amount = Column(Float, default=0.0)
|
||||
created_at = Column(DateTime(timezone=True), server_default=func.now())
|
||||
updated_at = Column(DateTime(timezone=True), onupdate=func.now())
|
||||
Reference in New Issue
Block a user