| 12345678910111213141516171819202122232425262728293031323334 |
- from datetime import datetime
- from sqlalchemy import Column, Integer, String, Text, SmallInteger, DateTime, UniqueConstraint, Index
- from app.core.database import Base
- class Plugin(Base):
- __tablename__ = "plugins"
- id = Column(Integer, primary_key=True, autoincrement=True)
- name = Column(String(64), unique=True, nullable=False, index=True)
- display_name = Column(String(128), nullable=False, default="")
- filename = Column(String(128), nullable=False, default="")
- latest_version = Column(String(32), nullable=False, default="1.0.0")
- description = Column(String(512), nullable=False, default="")
- status = Column(SmallInteger, nullable=False, default=1, index=True)
- created_at = Column(DateTime, default=datetime.utcnow, nullable=False)
- updated_at = Column(DateTime, default=datetime.utcnow, onupdate=datetime.utcnow, nullable=False)
- class PluginVersion(Base):
- __tablename__ = "plugin_versions"
- id = Column(Integer, primary_key=True, autoincrement=True)
- plugin_id = Column(Integer, nullable=False, default=0, index=True)
- plugin_name = Column(String(64), nullable=False, index=True)
- version = Column(String(32), nullable=False)
- download_url = Column(String(512), nullable=False)
- sha256 = Column(String(64), nullable=False, default="")
- changelog = Column(Text, nullable=True)
- created_at = Column(DateTime, default=datetime.utcnow, nullable=False)
- __table_args__ = (
- UniqueConstraint("plugin_id", "version", name="uk_plugin_version"),
- )
|