Initial YakPanel commit
This commit is contained in:
29
YakPanel-server/backend/app/models/site.py
Normal file
29
YakPanel-server/backend/app/models/site.py
Normal file
@@ -0,0 +1,29 @@
|
||||
"""YakPanel - Site and Domain models"""
|
||||
from datetime import datetime
|
||||
from sqlalchemy import String, Integer, DateTime, ForeignKey, Text
|
||||
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
||||
from app.core.database import Base
|
||||
|
||||
|
||||
class Site(Base):
|
||||
__tablename__ = "sites"
|
||||
|
||||
id: Mapped[int] = mapped_column(Integer, primary_key=True, autoincrement=True)
|
||||
name: Mapped[str] = mapped_column(String(128), unique=True, nullable=False, index=True)
|
||||
path: Mapped[str] = mapped_column(String(512), nullable=False)
|
||||
status: Mapped[int] = mapped_column(Integer, default=1) # 0=stopped, 1=running
|
||||
ps: Mapped[str] = mapped_column(String(255), default="")
|
||||
project_type: Mapped[str] = mapped_column(String(32), default="PHP")
|
||||
php_version: Mapped[str] = mapped_column(String(16), default="74") # 74, 80, 81, 82
|
||||
force_https: Mapped[int] = mapped_column(Integer, default=0) # 0=off, 1=redirect HTTP to HTTPS
|
||||
addtime: Mapped[datetime] = mapped_column(DateTime, default=datetime.utcnow)
|
||||
|
||||
|
||||
class Domain(Base):
|
||||
__tablename__ = "domain"
|
||||
|
||||
id: Mapped[int] = mapped_column(Integer, primary_key=True, autoincrement=True)
|
||||
pid: Mapped[int] = mapped_column(Integer, ForeignKey("sites.id"), nullable=False)
|
||||
name: Mapped[str] = mapped_column(String(256), nullable=False)
|
||||
port: Mapped[str] = mapped_column(String(16), default="80")
|
||||
addtime: Mapped[datetime] = mapped_column(DateTime, default=datetime.utcnow)
|
||||
Reference in New Issue
Block a user