53 lines
1.7 KiB
Python
53 lines
1.7 KiB
Python
from sqlalchemy import Column, String, Text, DateTime, Boolean, Integer, ForeignKey, JSON
|
|
from sqlalchemy.orm import relationship
|
|
from sqlalchemy.sql import func
|
|
from database import Base
|
|
|
|
|
|
class Skill(Base):
|
|
__tablename__ = "skills"
|
|
|
|
id = Column(String, primary_key=True)
|
|
name = Column(String, nullable=False)
|
|
description = Column(Text)
|
|
category = Column(String)
|
|
content = Column(Text, nullable=False)
|
|
tags = Column(JSON, default=list)
|
|
created_at = Column(DateTime(timezone=True), server_default=func.now())
|
|
updated_at = Column(DateTime(timezone=True), server_default=func.now(), onupdate=func.now())
|
|
usage_count = Column(Integer, default=0)
|
|
|
|
|
|
class Snippet(Base):
|
|
__tablename__ = "snippets"
|
|
|
|
id = Column(String, primary_key=True)
|
|
name = Column(String, nullable=False)
|
|
language = Column(String)
|
|
content = Column(Text, nullable=False)
|
|
category = Column(String)
|
|
tags = Column(JSON, default=list)
|
|
created_at = Column(DateTime(timezone=True), server_default=func.now())
|
|
|
|
|
|
class Convention(Base):
|
|
__tablename__ = "conventions"
|
|
|
|
id = Column(String, primary_key=True)
|
|
project_path = Column(String)
|
|
name = Column(String, nullable=False)
|
|
content = Column(Text, nullable=False)
|
|
auto_inject = Column(Boolean, default=False)
|
|
created_at = Column(DateTime(timezone=True), server_default=func.now())
|
|
|
|
|
|
|
|
class Memory(Base):
|
|
__tablename__ = "memory"
|
|
|
|
id = Column(String, primary_key=True)
|
|
project = Column(String, nullable=False)
|
|
key = Column(String, nullable=False)
|
|
content = Column(Text, nullable=False)
|
|
created_at = Column(DateTime(timezone=True), server_default=func.now())
|
|
updated_at = Column(DateTime(timezone=True), server_default=func.now(), onupdate=func.now())
|