20 lines
1.0 KiB
Python
20 lines
1.0 KiB
Python
from .base import Base
|
|
from sqlalchemy.orm import Mapped, mapped_column
|
|
from sqlalchemy import func
|
|
from sqlalchemy import String, Integer, Boolean, ForeignKey, DateTime
|
|
from datetime import date, datetime
|
|
class Server(Base):
|
|
__tablename__ = "easy_servers"
|
|
id: Mapped[int] = mapped_column(Integer, primary_key=True)
|
|
name:Mapped[str] = mapped_column(String(255), nullable=False, unique=True)
|
|
description: Mapped[str | None] = mapped_column(String(1000), nullable=True)
|
|
url: Mapped[str] = mapped_column(String(1000), nullable=False, unique=False)
|
|
|
|
|
|
class Database(Base):
|
|
__tablename__ = "easy_databases"
|
|
id: Mapped[int] = mapped_column(Integer, primary_key=True)
|
|
name:Mapped[str] = mapped_column(String(255), nullable=False, unique=True)
|
|
description: Mapped[str | None] = mapped_column(String(1000), nullable=True)
|
|
date_created: Mapped[datetime | None] = mapped_column(DateTime, nullable=True, default= func.now())
|
|
server_id: Mapped[int] = mapped_column(Integer, ForeignKey("easy_servers.id")) |