Skip to content

Commit

Permalink
Consistent schema ordering
Browse files Browse the repository at this point in the history
  • Loading branch information
segiddins committed Apr 4, 2023
1 parent 007c837 commit 0e3dcfc
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 31 deletions.
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
60 changes: 30 additions & 30 deletions db/downloads_schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand Down

0 comments on commit 0e3dcfc

Please sign in to comment.