Add postgres Uuid to be translated as String by tapioca dsl #1694
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.
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.