fix dla mysql
This commit is contained in:
1 parent
2d22fd2583
commit
25d1967fd8
1 file changed
+4
-2
@@ -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"))
|
||||
|
||||
Reference in new issue
Block a user