diff --git a/Gemfile.lock b/Gemfile.lock index 4543ddfbcfc..faf14b88f13 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,6 +1,6 @@ GIT remote: https://github.com/segiddins/timescaledb-rails - revision: 14432ded5954a9cf46dc3c40faa62857dfef63db + revision: 7982ddc421e2f00ee5e49eb44fa064452c071d7e branch: segiddins/support-for-timescale-in-other-database specs: timescaledb-rails (0.1.5) diff --git a/db/downloads_schema.rb b/db/downloads_schema.rb index 2fc31562319..497bef3c380 100644 --- a/db/downloads_schema.rb +++ b/db/downloads_schema.rb @@ -51,16 +51,6 @@ add_continuous_aggregate_policy "downloads_15_minutes_all_versions", "1 week", "1 hour", "1 hour" - create_continuous_aggregate "downloads_15_minutes_all_gems", <<-SQL, force: false - SELECT time_bucket('PT15M'::interval, downloads_15_minutes_all_versions.occurred_at) AS occurred_at, - sum(downloads_15_minutes_all_versions.downloads) AS downloads - FROM downloads_15_minutes_all_versions - GROUP BY (time_bucket('PT15M'::interval, downloads_15_minutes_all_versions.occurred_at)) - ORDER BY (time_bucket('PT15M'::interval, downloads_15_minutes_all_versions.occurred_at)); - SQL - - add_continuous_aggregate_policy "downloads_15_minutes_all_gems", "1 week", "1 hour", "1 hour" - create_continuous_aggregate "downloads_1_day", <<-SQL, force: false SELECT time_bucket('P1D'::interval, downloads_15_minutes.occurred_at) AS occurred_at, downloads_15_minutes.rubygem_id, @@ -72,6 +62,16 @@ add_continuous_aggregate_policy "downloads_1_day", "2 years", "1 day", "12 hours" + create_continuous_aggregate "downloads_15_minutes_all_gems", <<-SQL, force: false + SELECT time_bucket('PT15M'::interval, downloads_15_minutes_all_versions.occurred_at) AS occurred_at, + sum(downloads_15_minutes_all_versions.downloads) AS downloads + FROM downloads_15_minutes_all_versions + GROUP BY (time_bucket('PT15M'::interval, downloads_15_minutes_all_versions.occurred_at)) + ORDER BY (time_bucket('PT15M'::interval, downloads_15_minutes_all_versions.occurred_at)); + SQL + + add_continuous_aggregate_policy "downloads_15_minutes_all_gems", "1 week", "1 hour", "1 hour" + create_continuous_aggregate "downloads_1_day_all_versions", <<-SQL, force: false SELECT time_bucket('P1D'::interval, downloads_1_day.occurred_at) AS occurred_at, downloads_1_day.rubygem_id, @@ -83,16 +83,6 @@ add_continuous_aggregate_policy "downloads_1_day_all_versions", "2 years", "1 day", "12 hours" - create_continuous_aggregate "downloads_1_day_all_gems", <<-SQL, force: false - SELECT time_bucket('P1D'::interval, downloads_1_day_all_versions.occurred_at) AS occurred_at, - sum(downloads_1_day_all_versions.downloads) AS downloads - FROM downloads_1_day_all_versions - GROUP BY (time_bucket('P1D'::interval, downloads_1_day_all_versions.occurred_at)) - ORDER BY (time_bucket('P1D'::interval, downloads_1_day_all_versions.occurred_at)); - SQL - - add_continuous_aggregate_policy "downloads_1_day_all_gems", "2 years", "1 day", "12 hours" - create_continuous_aggregate "downloads_1_month", <<-SQL, force: false SELECT time_bucket('P1M'::interval, downloads_1_day.occurred_at) AS occurred_at, downloads_1_day.rubygem_id, @@ -104,6 +94,16 @@ add_continuous_aggregate_policy "downloads_1_month", "20 years", "1 month", "1 day" + create_continuous_aggregate "downloads_1_day_all_gems", <<-SQL, force: false + SELECT time_bucket('P1D'::interval, downloads_1_day_all_versions.occurred_at) AS occurred_at, + sum(downloads_1_day_all_versions.downloads) AS downloads + FROM downloads_1_day_all_versions + GROUP BY (time_bucket('P1D'::interval, downloads_1_day_all_versions.occurred_at)) + ORDER BY (time_bucket('P1D'::interval, downloads_1_day_all_versions.occurred_at)); + SQL + + add_continuous_aggregate_policy "downloads_1_day_all_gems", "2 years", "1 day", "12 hours" + create_continuous_aggregate "downloads_1_month_all_versions", <<-SQL, force: false SELECT time_bucket('P1M'::interval, downloads_1_month.occurred_at) AS occurred_at, downloads_1_month.rubygem_id, @@ -115,16 +115,6 @@ add_continuous_aggregate_policy "downloads_1_month_all_versions", "20 years", "1 month", "1 day" - create_continuous_aggregate "downloads_1_month_all_gems", <<-SQL, force: false - SELECT time_bucket('P1M'::interval, downloads_1_month_all_versions.occurred_at) AS occurred_at, - sum(downloads_1_month_all_versions.downloads) AS downloads - FROM downloads_1_month_all_versions - GROUP BY (time_bucket('P1M'::interval, downloads_1_month_all_versions.occurred_at)) - ORDER BY (time_bucket('P1M'::interval, downloads_1_month_all_versions.occurred_at)); - SQL - - add_continuous_aggregate_policy "downloads_1_month_all_gems", "20 years", "1 month", "1 day" - create_continuous_aggregate "downloads_1_year", <<-SQL, force: false SELECT time_bucket('P1Y'::interval, downloads_1_month.occurred_at) AS occurred_at, downloads_1_month.rubygem_id, @@ -136,6 +126,16 @@ add_continuous_aggregate_policy "downloads_1_year", "20 years", "1 year", "1 month" + create_continuous_aggregate "downloads_1_month_all_gems", <<-SQL, force: false + SELECT time_bucket('P1M'::interval, downloads_1_month_all_versions.occurred_at) AS occurred_at, + sum(downloads_1_month_all_versions.downloads) AS downloads + FROM downloads_1_month_all_versions + GROUP BY (time_bucket('P1M'::interval, downloads_1_month_all_versions.occurred_at)) + ORDER BY (time_bucket('P1M'::interval, downloads_1_month_all_versions.occurred_at)); + SQL + + add_continuous_aggregate_policy "downloads_1_month_all_gems", "20 years", "1 month", "1 day" + create_continuous_aggregate "downloads_1_year_all_versions", <<-SQL, force: false SELECT time_bucket('P1Y'::interval, downloads_1_year.occurred_at) AS occurred_at, downloads_1_year.rubygem_id,