Sha256: c2b78a9041904808e286313631d8a53f5c36917a22613af0d4e32f3bf4e87e4c

Contents?: true

Size: 584 Bytes

Versions: 7

Compression:

Stored size: 584 Bytes

Contents

class CreatePlays < ActiveRecord::Migration[7.0]
  def change
    enable_extension("timescaledb") unless extensions.include? "timescaledb"
    hypertable_options = {
        time_column: 'created_at',
        chunk_time_interval: '1 day',
        compress_segmentby: 'game_id',
        compress_orderby: 'created_at',
        compression_interval: '7 days'
    }
    create_table :plays, hypertable: hypertable_options, id: false do |t|
      t.references :game, null: false, foreign_key: false
      t.integer :score
      t.decimal :total_time

      t.timestamps
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
timescaledb-0.2.6 examples/ranking/db/migrate/20220209120910_create_plays.rb
timescaledb-0.2.5 examples/ranking/db/migrate/20220209120910_create_plays.rb
timescaledb-0.2.4 examples/ranking/db/migrate/20220209120910_create_plays.rb
timescaledb-0.2.3 examples/ranking/db/migrate/20220209120910_create_plays.rb
timescaledb-0.2.2 examples/ranking/db/migrate/20220209120910_create_plays.rb
timescaledb-0.2.1 examples/ranking/db/migrate/20220209120910_create_plays.rb
timescaledb-0.2.0 examples/ranking/db/migrate/20220209120910_create_plays.rb