Большие изменения с добавленем Alembic

This commit is contained in:
2024-07-31 22:56:31 +09:00
parent a2a400fff3
commit 7c70f82a21
19 changed files with 528 additions and 39 deletions

View File

@ -0,0 +1,21 @@
from core.models import Base
from sqlalchemy.orm import Mapped, mapped_column
from sqlalchemy import String, Integer, Boolean, ForeignKey
from typing import Optional, Sequence
class UserModel(Base):
__tablename__ ="users"
id: Mapped[int] = mapped_column(Integer, primary_key=True)
firstname: Mapped[str | None]= mapped_column(String(255), nullable=True)
lastname: Mapped[str | None]= mapped_column(String(255), nullable=True)
age: Mapped[int | None] = mapped_column(Integer, nullable=True)
email: Mapped[str | None] = mapped_column(String(255), nullable=True, unique=True)
login_id: Mapped[int] = mapped_column(Integer, ForeignKey("logins.id"))
class LoginModel(Base):
__tablename__ ="logins"
id: Mapped[int] = mapped_column(Integer, primary_key=True)
username: Mapped[str]= mapped_column(String(255), nullable=False, unique=True)
password: Mapped[str]= mapped_column(String(255), nullable=False)