lib/timescaledb/migration_helpers.rb
# create_table can receive `hypertable` argument
# @example
#  options = {
#    time_column: 'created_at',
#    chunk_time_interval: '1 min',
#    compress_segmentby: 'identifier',
#    compress_orderby: 'created_at',
#    compression_interval: '7 days'
#  }
#
#  create_table(:events, id: false, hypertable: options) do |t|
#    t.string :identifier, null: false
#    t.jsonb :payload
#    t.timestamps
#  end
create_table can receive `hypertable` argument
create_table can receive ` hypertable ` argument
def create_continuous_aggregate_policy(table_name, **options)
      return if options.empty?
      execute <<~SQL
        SELECT add_continuous_aggregate_policy('#{table_name}',
          start_offset => #{options[:start_offset]},
          end_offset => #{options[:end_offset]},
          schedule_interval => #{options[:schedule_interval]});
      SQL
    end
def create_continuous_aggregate_policy ( table_name , ** options ) return if options . empty? execute <<~SQL 
        SELECT add_continuous_aggregate_policy(' #{ table_name } ',
          start_offset =>  #{ options [ :start_offset ] } ,
          end_offset =>  #{ options [ :end_offset ] } ,
          schedule_interval =>  #{ options [ :schedule_interval ] } );
       SQL end
create_table can receive `hypertable` argument
create_table can receive ` hypertable ` argument
# TODO: assert valid keys
table_name
<not_specific>
options
<not_specific>
example
options = { time_column: 'created_at', chunk_time_interval: '1 min', compress_segmentby: 'identifier', compress_orderby: 'created_at', compression_interval: '7 days' } create_table(:events, id: false, hypertable: options) do |t| t.string :identifier, null: false t.jsonb :payload t.timestamps end
options = { time_column : ' created_at ' chunk_time_interval : ' 1 min ' compress_segmentby : ' identifier ' compress_orderby : ' created_at ' compression_interval : ' 7 days ' } create_table ( : events id : false hypertable : options ) do |t| t . string : identifier null : false t . jsonb : payload t . timestamps end