Here’s a clean, ready-to-use PR description you can paste: --- ## 🛠️ Fix database initialization and custom BigInt type handling#256
Open
ThomasHumper wants to merge 3 commits into
Conversation
Member
|
hi @ThomasHumper thanks for the PR! i have some issues with this. did you test it? |
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.
🛠️ Fix database initialization and custom BigInt type handling
Summary
This PR fixes multiple bugs and unsafe behaviors in the database initialization layer and the custom
RealBigIntSequelize data type. It improves runtime stability, correctness of Sequelize usage, and cross-dialect compatibility (Postgres + SQLite).🚨 Fixes
Database initialization (
initStorage)Fixed incorrect Sequelize typing (
AbstractDialectmisuse removed)Corrected dialect typing to use Sequelize-supported
DialectFixed unsafe port parsing (string → number)
Improved environment handling for DB host detection
Added proper error handling for:
authenticate()sync()Fixed unsafe model association binding order (now guarded)
Improved logging for DB lifecycle failures
BigInt DataType (
RealBigInt)Fixed incorrect
instanceof BigIntusage (replaced withtypeof === "bigint")Fixed invalid Sequelize
ValidationErrorItemusageAdded proper null/undefined handling in
escape()Fixed SQL escaping to prevent malformed queries
Improved
sanitize()to safely convert:Fixed unsafe error message construction
Hardened dialect support detection with optional chaining
Improved fallback behavior for non-native BigInt dialects (SQLite)
🧠 Behavioral Improvements
123nfallback encoding)None (fully backward compatible at runtime)
✅ Testing Checklist
📌 Notes
This refactor aligns Sequelize usage with supported APIs and removes unsafe assumptions about BigInt handling across dialects.
If you want, I can also write:
CHANGELOG.md)