feat: add first database migration

This commit is contained in:
Schubert Ferenc 2026-07-01 21:24:20 +02:00
parent 3701c50711
commit 1f50e8bf7b
10 changed files with 311 additions and 13 deletions

View file

@ -26,4 +26,5 @@ def get_db():
try:
yield db
finally:
db.close()
db.close()
import app.models.user

View file

@ -0,0 +1,26 @@
from sqlalchemy import String
from sqlalchemy.orm import Mapped
from sqlalchemy.orm import mapped_column
from app.db.database import Base
class User(Base):
__tablename__ = "users"
id: Mapped[int] = mapped_column(primary_key=True)
username: Mapped[str] = mapped_column(
String(50),
unique=True,
index=True
)
email: Mapped[str] = mapped_column(
String(255),
unique=True
)
password_hash: Mapped[str] = mapped_column(
String(255)
)