Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions lib/conceptql/operators/episode.rb
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,16 @@ def partition_vars

def date_adjust_add(db, from, by, timeframe)
if db.database_type == :postgres
if db.respond_to?(:redshift_version)
case timeframe
when /year/
by = (by * 365.24).round
timeframe = 'day'
when /month/
by = (by * 30.44).round
timeframe = 'day'
end
end
Sequel.cast(from + Sequel.lit("(? * INTERVAL '1' ?)", by, Sequel.lit(timeframe.sub(/s\z/, ''))), Date)
else
from + Sequel.lit("INTERVAL ? ?", by, Sequel.lit(timeframe))
Expand Down