Format Python code and mark release script executable

This commit is contained in:
2026-07-27 13:09:41 +08:00
parent beae4d5532
commit 548c57b83a
3 changed files with 22 additions and 23 deletions
+9 -7
View File
@@ -7,16 +7,18 @@ from sqlalchemy.orm import DeclarativeBase
load_dotenv()
class Base(DeclarativeBase):
pass
database_url = URL.create(
drivername = "mysql+pymysql",
username = os.getenv("MYSQL_USER"),
password = os.getenv("MYSQL_PASSWORD"),
host = os.getenv("MYSQL_HOST"),
port = int(os.getenv("MYSQL_PORT")),
database = os.getenv("MYSQL_DATABASE"),
)
drivername="mysql+pymysql",
username=os.getenv("MYSQL_USER"),
password=os.getenv("MYSQL_PASSWORD"),
host=os.getenv("MYSQL_HOST"),
port=int(os.getenv("MYSQL_PORT")),
database=os.getenv("MYSQL_DATABASE"),
)
engine = create_engine(database_url, pool_pre_ping=True)
+1 -4
View File
@@ -10,8 +10,5 @@ def get_session():
with Session(engine, expire_on_commit=False) as session:
yield session
SessionDep = Annotated[
Session,
Depends(get_session)
]
SessionDep = Annotated[Session, Depends(get_session)]
+12 -12
View File
@@ -8,17 +8,17 @@ from database import Base
class Todo(Base):
__tablename__ = "todos"
id: Mapped[int] = mapped_column(
BIGINT(unsigned=True),
primary_key = True,
autoincrement = True,
)
BIGINT(unsigned=True),
primary_key=True,
autoincrement=True,
)
task: Mapped[str] = mapped_column(
String(200),
nullable = False,
)
String(200),
nullable=False,
)
completion: Mapped[bool] = mapped_column(
Boolean,
nullable = False,
default = False,
server_default = false(),
)
Boolean,
nullable=False,
default=False,
server_default=false(),
)