Большие изменения с добавленем Alembic
This commit is contained in:
21
backend-app/repo/models.py
Normal file
21
backend-app/repo/models.py
Normal 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)
|
Reference in New Issue
Block a user