Skip to content
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

Add postgres Uuid to be translated as String by tapioca dsl #1694

Merged
merged 2 commits into from
Oct 18, 2023
Merged

Add postgres Uuid to be translated as String by tapioca dsl #1694

merged 2 commits into from
Oct 18, 2023

Conversation

pedrol3001
Copy link
Contributor

Motivation

The Rails application I'm working on utilizes UUIDs as described in this tutorial: link to the tutorial. Unfortunately, Tapioca's DSL couldn't correctly identify the column types generated by PostgreSQL. This led to a situation where primary and foreign keys were classified as T.untyped, disabling these attributes type checking.

Implementation

To resolve this issue, I've introduced a specific verification for the column type, "ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Uuid," which ensures that the affected columns are correctly recognized as ::String by Tapioca, thereby enabling accurate type checking.

Tests

As i am new to this repository, I couldn't find an established location for adding tests since there are no existing ones for the active_record_column_type_helper.rb file. I would appreciate guidance on the appropriate method for adding tests to this file or whether it's a common practice in this context.

@pedrol3001
Copy link
Contributor Author

I have signed the CLA!

@KaanOzkan KaanOzkan added the enhancement New feature or request label Oct 18, 2023
Copy link
Contributor

@KaanOzkan KaanOzkan left a comment

Choose a reason for hiding this comment

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

Looking at sorbet-rails string looks correct. We don't utilize postgres internally so if this branch works on your project we can merge it.

Copy link
Member

@vinistock vinistock left a comment

Choose a reason for hiding this comment

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

Thank you for the contribution!

@vinistock vinistock merged commit d2a27bd into Shopify:main Oct 18, 2023
15 checks passed
@shopify-shipit shopify-shipit bot temporarily deployed to production October 31, 2023 20:02 Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants