fix: add support for PostgreSQL specific types (numeric, timestamptz)#9
Open
teofeo wants to merge 1 commit intoSoftwareBrothers:mainfrom
Open
fix: add support for PostgreSQL specific types (numeric, timestamptz)#9teofeo wants to merge 1 commit intoSoftwareBrothers:mainfrom
teofeo wants to merge 1 commit intoSoftwareBrothers:mainfrom
Conversation
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.
Description
Currently, the
databaseTypeToAdminTypeconverter doesn't recognize several standard PostgreSQL types. This leads to persistentconsole.warnmessages during the discovery phase, even if types are manually overridden in resource options.This PR adds the following mappings:
timestamp with time zone×tamptzmapped todatetime.numericmapped tofloat.Context & Source of the issue
When using
AdonisJS (Lucid)withPostgreSQL, it is standard practice to use timezones for auditing fields and precise decimals for financial data:Why this is necessary?
When using PostgreSQL, the adapter scans the schema and encounters these types. Since they were not explicitly defined in the
switchstatement, it triggered a "fallback to string" warning. Adding them ensures a cleaner console output and better default type detection for PostgreSQL users.Changes
src/adapter/utils/type_converter.tsto include PostgreSQL types in the switch-case logic.Visual Proof
Before (Unexpected type warnings)
After (Clean startup)
Impact
numericfields are correctly identified as numbers in the AdminJS UI, enabling the appropriate input masks and validation automatically.Verification