From e6a69401c994437e7f57db7388926fb3a88ad536 Mon Sep 17 00:00:00 2001 From: Juan Vargas <66626747+v4rgas@users.noreply.github.com> Date: Fri, 17 Oct 2025 15:35:43 -0300 Subject: [PATCH] Add SQLite native time format to connection string (#61) Use _time_format=sqlite parameter in modernc.org/sqlite connection string to ensure DATETIME columns use SQLite's native time format (format 7 with timezone) instead of Go's default String() format. This improves compatibility with SQLite's date/time functions and ensures consistent time representation across the database. --- internal/storage/sqlite/sqlite.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/storage/sqlite/sqlite.go b/internal/storage/sqlite/sqlite.go index d9e03dbd..59f5893a 100644 --- a/internal/storage/sqlite/sqlite.go +++ b/internal/storage/sqlite/sqlite.go @@ -32,7 +32,8 @@ func New(path string) (*SQLiteStorage, error) { // Open database with WAL mode for better concurrency and busy timeout for parallel writes // _pragma=busy_timeout(30000) means wait up to 30 seconds for locks instead of failing immediately // Higher timeout helps with parallel issue creation from multiple processes - db, err := sql.Open("sqlite", path+"?_journal_mode=WAL&_foreign_keys=ON&_pragma=busy_timeout(30000)") + // _time_format=sqlite uses SQLite's native time format for DATETIME columns + db, err := sql.Open("sqlite", path+"?_journal_mode=WAL&_foreign_keys=ON&_pragma=busy_timeout(30000)&_time_format=sqlite") if err != nil { return nil, fmt.Errorf("failed to open database: %w", err) }