feat: add first database migration
This commit is contained in:
parent
3701c50711
commit
1f50e8bf7b
10 changed files with 311 additions and 13 deletions
Binary file not shown.
|
|
@ -26,4 +26,5 @@ def get_db():
|
|||
try:
|
||||
yield db
|
||||
finally:
|
||||
db.close()
|
||||
db.close()
|
||||
import app.models.user
|
||||
26
backend/hermes/app/models/user.py
Normal file
26
backend/hermes/app/models/user.py
Normal 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)
|
||||
)
|
||||
Loading…
Add table
Add a link
Reference in a new issue