39 lines
1.4 KiB
Python
39 lines
1.4 KiB
Python
from sqlalchemy import Column, String, Integer, DateTime, JSON, BigInteger, Text
|
|
from sqlalchemy.ext.declarative import declarative_base
|
|
from datetime import datetime
|
|
|
|
Base = declarative_base()
|
|
|
|
|
|
class Artifact(Base):
|
|
__tablename__ = "artifacts"
|
|
|
|
id = Column(Integer, primary_key=True, index=True)
|
|
filename = Column(String(500), nullable=False, index=True)
|
|
file_type = Column(String(50), nullable=False, index=True) # csv, json, binary, pcap
|
|
file_size = Column(BigInteger, nullable=False)
|
|
storage_path = Column(String(1000), nullable=False)
|
|
content_type = Column(String(100))
|
|
|
|
# Test metadata
|
|
test_name = Column(String(500), index=True)
|
|
test_suite = Column(String(500), index=True)
|
|
test_config = Column(JSON)
|
|
test_result = Column(String(50), index=True) # pass, fail, skip, error
|
|
|
|
# Additional metadata
|
|
metadata = Column(JSON)
|
|
description = Column(Text)
|
|
tags = Column(JSON) # Array of tags for categorization
|
|
|
|
# Timestamps
|
|
created_at = Column(DateTime, default=datetime.utcnow, index=True)
|
|
updated_at = Column(DateTime, default=datetime.utcnow, onupdate=datetime.utcnow)
|
|
|
|
# Versioning
|
|
version = Column(String(50))
|
|
parent_id = Column(Integer, index=True) # For file versioning
|
|
|
|
def __repr__(self):
|
|
return f"<Artifact(id={self.id}, filename='{self.filename}', test_name='{self.test_name}')>"
|