Skip to content

Cast SQLServer's :datetimeoffset to time #1479

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

vividmuimui
Copy link

This PR is a PR to support the datetimeoffset type in SQLServer.

irb(main):009> Product.columns_hash["CreatedAt"].type
=> :datetimeoffset

irb(main):010> Product.columns_hash["CreatedAt"]
=>
#<ActiveRecord::ConnectionAdapters::SQLServer::Column:0x0000000122cfeb08
 @collation=nil,
 @comment=nil,
 @default=nil,
 @default_function=nil,
 @is_identity=false,
 @is_primary=false,
 @name="CreatedAt",
 @null=false,
 @ordinal_position=2,
 @sql_type_metadata=#<ActiveRecord::ConnectionAdapters::SqlTypeMetadata:0x0000000122bb5698 @limit=nil, @precision=7, @scale=nil, @sql_type="datetimeoffset(7)", @type=:datetimeoffset>,
 @table_name="Products">

@@ -26,7 +26,7 @@ def cast(type)
case type
when :date
cast_to_date(value)
when :datetime, :timestamp, :time, :timestamptz
when :datetime, :timestamp, :time, :timestamptz, :datetimeoffset
Copy link
Member

Choose a reason for hiding this comment

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

@vividmuimui could you please add a comment to indicate datetimeoffset is SQLServer only.

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.

2 participants