alembic 1.2

This commit is contained in:
2025-10-01 12:24:49 +03:00
parent 28a853c865
commit 1c7ebdcc2e
2 changed files with 1 additions and 7 deletions

1
run.py
View File

@@ -3,7 +3,6 @@ from server.backend import endpoints# импортируем FastAPI экзем
import asyncio import asyncio
from server.database import db from server.database import db
if __name__ == "__main__": if __name__ == "__main__":
#asyncio.run(db.main())
uvicorn.run( uvicorn.run(
"server.backend.endpoints:api", "server.backend.endpoints:api",
host="127.0.0.1", host="127.0.0.1",

View File

@@ -40,9 +40,6 @@ class User(Base):
updated_at = Column(DateTime(timezone=True), onupdate=func.now()) updated_at = Column(DateTime(timezone=True), onupdate=func.now())
last_login = Column(DateTime(timezone=True)) last_login = Column(DateTime(timezone=True))
# async def init_db():
# async with async_engine.begin() as conn:
# await conn.run_sync(Base.metadata.create_all)
async def create_user(user_info): async def create_user(user_info):
async with AsyncSessionLocal() as session: async with AsyncSessionLocal() as session:
new_user = User(email=user_info.email, description=user_info.description, activated=user_info.activated, password=hash_password(user_info.password)) new_user = User(email=user_info.email, description=user_info.description, activated=user_info.activated, password=hash_password(user_info.password))
@@ -93,6 +90,4 @@ async def reset_user(user_info):
user.password = hash_password(user_info.new_password) user.password = hash_password(user_info.new_password)
await session.commit() await session.commit()
return user return user
return None return None
# async def main():
# await init_db()