fix(db): prevent esbuild from mangling datetime('now') in SQL#68
Closed
wise-toddler wants to merge 1 commit intodebuglebowski:mainfrom
Closed
fix(db): prevent esbuild from mangling datetime('now') in SQL#68wise-toddler wants to merge 1 commit intodebuglebowski:mainfrom
wise-toddler wants to merge 1 commit intodebuglebowski:mainfrom
Conversation
esbuild converts simple template literals to single-quoted strings,
mangling inner datetime('now') into datetime("now"). SQLite treats
double-quoted identifiers as column names, crashing on startup.
Contributor
Author
|
Already fixed in v0.17.2. Closing as duplicate. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
datetime('now')intodatetime("now")"now"as a column identifier → crash on startupFixes #67
Test plan
datetime("now")pnpm build && pnpm start— app launches without SQLite errorGreptile Summary
This PR fixes a startup crash by converting two single-line template literals in
handlers-marketplace.tsthat containdatetime('now')to double-quoted JS strings, preventing esbuild from swapping the inner single quotes to double quotes during compilation (which caused SQLite to interpret"now"as a column identifier rather than a string literal).The remaining
datetime('now')usages in the same file are all inside genuine multi-line template literals, which esbuild cannot collapse to single-quoted strings, so they are unaffected.Confidence Score: 5/5
Safe to merge — targeted fix with no logic changes and no remaining P0/P1 issues.
The two changed lines are a straightforward quote style fix; the SQL semantics are identical. The multi-line template literals retaining datetime('now') are unaffected because esbuild cannot represent newline-containing strings as single-quoted literals. Other production files in the codebase already follow the same correct patterns. No P0 or P1 findings.
No files require special attention.
Important Files Changed
Flowchart
%%{init: {'theme': 'neutral'}}%% flowchart TD A[Source: template literal with datetime now] --> B{esbuild bundler} B -- Before fix single-line --> C[Output: inner single quotes flipped to double quotes] B -- After fix double-quoted JS string --> D[Output: inner single quotes preserved] C --> E[SQLite treats now as column identifier - CRASH] D --> F[SQLite treats now as string literal - OK] G[Multi-line template literals lines 342 382 401] --> H{esbuild bundler} H --> I[Cannot collapse - contains real newlines - Safe unchanged]Reviews (1): Last reviewed commit: "fix(db): use double-quoted strings for S..." | Re-trigger Greptile
(3/5) Reply to the agent's comments like "Can you suggest a fix for this @greptileai?" or ask follow-up questions!