20 lines
900 B
Python
20 lines
900 B
Python
"""YakPanel - Database model"""
|
|
from datetime import datetime
|
|
from sqlalchemy import String, Integer, DateTime, ForeignKey
|
|
from sqlalchemy.orm import Mapped, mapped_column
|
|
from app.core.database import Base
|
|
|
|
|
|
class Database(Base):
|
|
__tablename__ = "databases"
|
|
|
|
id: Mapped[int] = mapped_column(Integer, primary_key=True, autoincrement=True)
|
|
sid: Mapped[int] = mapped_column(Integer, default=0)
|
|
pid: Mapped[int] = mapped_column(Integer, ForeignKey("sites.id"), default=0)
|
|
name: Mapped[str] = mapped_column(String(64), nullable=False)
|
|
username: Mapped[str] = mapped_column(String(64), nullable=False)
|
|
password: Mapped[str] = mapped_column(String(255), default="")
|
|
db_type: Mapped[str] = mapped_column(String(32), default="MySQL")
|
|
ps: Mapped[str] = mapped_column(String(255), default="")
|
|
addtime: Mapped[datetime] = mapped_column(DateTime, default=datetime.utcnow)
|