fix dla mysql

This commit is contained in:
Mateusz Gruszczyński
2025-08-16 23:10:56 +02:00
parent 2d22fd2583
commit 25d1967fd8

6
app.py
View File

@@ -951,9 +951,11 @@ def save_pdf_as_webp(file, path):
def get_active_months_query(visible_lists_query=None):
if db.engine.name == "sqlite":
if db.engine.name in ("sqlite",):
month_col = func.strftime("%Y-%m", ShoppingList.created_at)
else:
elif db.engine.name in ("mysql", "mariadb"):
month_col = func.date_format(ShoppingList.created_at, "%Y-%m")
else: # PostgreSQL i inne wspierające to_char
month_col = func.to_char(ShoppingList.created_at, "YYYY-MM")
query = db.session.query(month_col.label("month"))