BREAKING CHANGE: update: migrate to better-sqlite3#20
BREAKING CHANGE: update: migrate to better-sqlite3#20deadlyjack merged 15 commits intoAcode-Foundation:mainfrom
Conversation
Greptile SummaryThis PR migrates the database layer from Key Changes:
Migration Quality:
Confidence Score: 4/5
Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[sqlite3 with callbacks] -->|Migration| B[better-sqlite3 synchronous]
B --> C[Database Layer<br/>server/lib/db.js]
C --> D{Foreign Keys Enabled}
D -->|Yes| E[Entity Layer<br/>server/entities/entity.js]
E --> F[execSql: Prepared Statements]
F --> G{Statement Type}
G -->|SELECT| H[stmt.all returns rows]
G -->|INSERT/UPDATE/DELETE| I[stmt.run returns empty array]
I --> J[API Layer Adaptations]
H --> J
J --> K[Comment API<br/>Fetch after insert]
J --> L[Plugin API<br/>Manual cascades]
J --> M[User/OTP APIs<br/>Type conversions]
Last reviewed commit: 6b9dcad |
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as outdated.
This comment was marked as outdated.
This comment has been minimized.
This comment has been minimized.
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
|
@greptileai Review it again. |
Additional Comments (1)
In the paid-download flow, |
|
@greptileai Review it again. |
| // (if needed, in future) `result` could be set as { rows: [], changes: ..., lastInsertRowid: ... } | ||
| // for now, we'll just set it as an empty array | ||
| stmt.run(...values); | ||
| result = []; | ||
| } |
There was a problem hiding this comment.
Write operations (INSERT/UPDATE/DELETE) now return empty array instead of the actual result info (changes, lastInsertRowid). If callers ever need the insert ID or affected row count, they won't have access to it. This could break code that relies on these values.
There was a problem hiding this comment.
This can be handled in future if needed, Currently it returns empty array for compatibility
|
@greptileai Review changes. |
|
@greptileai review again |
Additional Comments (1)
This will break the earnings calculation jobs in |
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
|
@greptileai Review Once Again. |
Why
sqlite3 has received no updates in the past 2-3 years and has blockers on package updating, like tar/node-tar, which has vulnerabilities.
Better-sqlite3 is benchmarked to be faster, better, and more updated in comparison to sqlite3.
I've tested as much as I could; breaking changes could occur because of how the better-sqlite3 API is without callbacks.
To Do
The update schema script needs changes.