Extract method to generate series of days in measure sql classes (#29928)
This commit is contained in:
parent
edf6d64eeb
commit
88cfc4056d
11 changed files with 18 additions and 10 deletions
|
@ -15,6 +15,14 @@ module Admin::Metrics::Measure::QueryHelper
|
|||
ActiveRecord::Base.sanitize_sql_array(sql_array)
|
||||
end
|
||||
|
||||
def generated_series_days
|
||||
Arel.sql(
|
||||
<<~SQL.squish
|
||||
SELECT generate_series(timestamp :start_at, :end_at, '1 day')::date AS period
|
||||
SQL
|
||||
)
|
||||
end
|
||||
|
||||
def account_domain_sql(include_subdomains)
|
||||
if include_subdomains
|
||||
"accounts.domain IN (SELECT domain FROM instances WHERE reverse('.' || domain) LIKE reverse('.' || :domain::text))"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue