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.
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user