Большие изменения с добавленем Alembic
This commit is contained in:
@ -0,0 +1,5 @@
|
||||
__all__ = (
|
||||
"UserModel",
|
||||
"LoginModel"
|
||||
)
|
||||
from .models import UserModel, LoginModel
|
@ -1,21 +1,21 @@
|
||||
from database import Model
|
||||
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(Model):
|
||||
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)
|
||||
email: Mapped[str | None] = mapped_column(String(255), nullable=True, unique=True)
|
||||
login_id: Mapped[int] = mapped_column(Integer, ForeignKey("logins.id"))
|
||||
|
||||
class LoginModel(Model):
|
||||
class LoginModel(Base):
|
||||
__tablename__ ="logins"
|
||||
|
||||
id: Mapped[int] = mapped_column(Integer, primary_key=True)
|
||||
login: Mapped[str]= mapped_column(String(255), nullable=False)
|
||||
password: Mapped[str]= mapped_column(String(255), nullable=False)
|
||||
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