Skip to content

Commit e703708

Browse files
committed
✅ enhance datetime mapping to include local and UTC timestamp handling
1 parent f94bee6 commit e703708

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

tests/unit/sqlite3_to_mysql_test.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2014,6 +2014,19 @@ def _mk(*, expr: bool, ts_dt: bool, fsp: bool) -> SQLite3toMySQL:
20142014
("TIMESTAMP(3)", "CURRENT_TIMESTAMP", {"expr": False, "ts_dt": True, "fsp": True}, "CURRENT_TIMESTAMP(3)"),
20152015
# SQLite-style now -> map to CURRENT_TIMESTAMP (with FSP when allowed)
20162016
("DATETIME(2)", "datetime('now')", {"expr": False, "ts_dt": True, "fsp": True}, "CURRENT_TIMESTAMP(2)"),
2017+
# datetime(current_timestamp, ...) should also map to CURRENT/UTC TIMESTAMP
2018+
(
2019+
"DATETIME",
2020+
"datetime(current_timestamp, 'localtime')",
2021+
{"expr": False, "ts_dt": True, "fsp": False},
2022+
"CURRENT_TIMESTAMP",
2023+
),
2024+
(
2025+
"DATETIME(3)",
2026+
"datetime(current_timestamp, 'utc')",
2027+
{"expr": False, "ts_dt": True, "fsp": True},
2028+
"UTC_TIMESTAMP(3)",
2029+
),
20172030
# --- DATE mapping (from 'now' forms or CURRENT_TIMESTAMP) ---
20182031
# Only map when expression defaults are allowed
20192032
("DATE", "datetime('now')", {"expr": True, "ts_dt": False, "fsp": False}, "CURRENT_DATE"),

0 commit comments

Comments
 (0)