From 4133d7d9a5d099c0de0abab4b016e6f8f8e1b82a Mon Sep 17 00:00:00 2001 From: KOSASIH Date: Thu, 8 Aug 2024 14:12:18 +0700 Subject: [PATCH] Create contract.py --- .../contract-sphere-db/models/contract.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 projects/ContractSphere/data_storage/contract-sphere-db/models/contract.py diff --git a/projects/ContractSphere/data_storage/contract-sphere-db/models/contract.py b/projects/ContractSphere/data_storage/contract-sphere-db/models/contract.py new file mode 100644 index 000000000..1e4435415 --- /dev/null +++ b/projects/ContractSphere/data_storage/contract-sphere-db/models/contract.py @@ -0,0 +1,16 @@ +from sqlalchemy import Column, Integer, String, DateTime +from sqlalchemy.ext.declarative import declarative_base + +Base = declarative_base() + +class Contract(Base): + __tablename__ = 'contracts' + + id = Column(Integer, primary_key=True) + title = Column(String(255), nullable=False) + description = Column(String, nullable=True) + created_at = Column(DateTime, default=datetime.utcnow) + updated_at = Column(DateTime, default=datetime.utcnow, onupdate=datetime.utcnow) + + def __repr__(self): + return f''