diff --git a/db/downloads_migrate/20240708184547_create_downloads.rb b/db/downloads_migrate/20240708184547_create_downloads.rb index 86d9afa82a3..887286772c0 100644 --- a/db/downloads_migrate/20240708184547_create_downloads.rb +++ b/db/downloads_migrate/20240708184547_create_downloads.rb @@ -10,7 +10,7 @@ def self.up chunk_time_interval: '1 day', compress_segmentby: 'gem_name, gem_version', compress_orderby: 'created_at DESC', - compression_interval: '7 days' + compress_after: '7 days' } create_table(:downloads, id: false, hypertable: hypertable_options) do |t| diff --git a/db/downloads_schema.rb b/db/downloads_schema.rb index 2e2c67ef86f..048a36c18a3 100644 --- a/db/downloads_schema.rb +++ b/db/downloads_schema.rb @@ -34,7 +34,7 @@ t.index ["key", "directory"], name: "index_log_downloads_on_key_and_directory", unique: true end - create_hypertable "downloads", time_column: "created_at", chunk_time_interval: "1 day", compress_segmentby: "gem_name, gem_version", compress_orderby: "created_at DESC", compression_interval: "P7D" + create_hypertable "downloads", time_column: "created_at", chunk_time_interval: "1 day", compress_segmentby: "gem_name, gem_version", compress_orderby: "created_at DESC", compress_after: "P7D" create_continuous_aggregate("total_downloads_per_minute", <<-SQL, refresh_policies: { start_offset: "INTERVAL 'PT10M'", end_offset: "INTERVAL 'PT1M'", schedule_interval: "INTERVAL '60'"}, materialized_only: true, finalized: true) SELECT time_bucket('PT1M'::interval, created_at) AS created_at, count(*) AS downloads