Skip to content

Map postgres numeric type to Swift Decimal type #960

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 28, 2025

Conversation

im-jersh
Copy link
Contributor

@im-jersh im-jersh commented Jul 28, 2025

What kind of change does this PR introduce?

This PR updates the Swift type generator, mapping the postgres numeric type to Swift's Decimal type.

What is the current behavior?

Currently, when generating a Swift type for a table that includes a column with a numeric type, the resulting Swift struct's property for that column is NumericSelect, a consequence of the generator reaching src/server/templates/swift.ts#L347.

As a result, any generated Swift struct that contains NumericSelect will not compile due to the undefined type.

What is the new behavior?

These changes simply sets the the swiftType = 'Decimal' when pgType === numeric.

Additional context

Add any other context or screenshots.

@im-jersh im-jersh requested review from a team as code owners July 28, 2025 02:31
Copy link
Member

@soedirgo soedirgo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@coveralls
Copy link

coveralls commented Jul 28, 2025

Pull Request Test Coverage Report for Build 16572202474

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 2 of 2 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.01%) to 76.132%

Totals Coverage Status
Change from base Build 16461523960: 0.01%
Covered Lines: 5188
Relevant Lines: 6730

💛 - Coveralls

@soedirgo soedirgo enabled auto-merge (squash) July 28, 2025 14:46
@soedirgo soedirgo merged commit e583d43 into supabase:master Jul 28, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants