import datetime

from sqlalchemy import Column, DateTime, String, Integer, ForeignKey, Boolean

from app.domain.models.base import BaseModel
from app.settings import settings


class Backup(BaseModel):
    __tablename__ = 'backups'
    __table_args__ = {"schema": settings.SCHEMA}

    timestamp = Column(DateTime, nullable=False, default=datetime.datetime.now)
    path = Column(String, nullable=False)
    filename = Column(String, nullable=False)
    is_by_user = Column(Boolean, nullable=False, default=False)

    user_id = Column(Integer, ForeignKey(f'{settings.SCHEMA}.users.id'), nullable=False)
