Support Ecto DSL in `enable_hypertable_compression/2`
We have a function enable_hypertable_compression/2 which corresponds to an alter table, see the timescale docs
Currently we're only allowing you to pass the column name, but we should support the order and nulls rules as well. See below 👇🏼
ALTER TABLE <table_name> SET (timescaledb.compress, timescaledb.compress_orderby = '<column_name> [ASC | DESC] [ NULLS { FIRST | LAST } ] [, ...]',
timescaledb.compress_segmentby = '<column_name> [, ...]'
);
I'm trying to better understand how you want the Ecto DSL to play into this. Do you have an idea of what you sort of see the final product looking like?
enable_hypertable_compression(:prices,
segment_by: "currency_id",
order_by: [asc: :inserted_at, desc_nulls_first: :another_id]
)
Your example is on the money. On my phone, but I believe there are some alternative ways to do that, we should support them as well
From the Ecto.Query.order_by/3 documentation, we should support the following examples:
from(c in City, order_by: c.name, order_by: c.population)
from(c in City, order_by: [c.name, c.population])
from(c in City, order_by: [asc: c.name, desc: c.population])
from(c in City, order_by: [:name, :population])
from(c in City, order_by: [asc: :name, desc_nulls_first: :population])
Adding as a note here that this issue should also address the SQL injection issues mentioned in https://github.com/bitfo/timescale/issues/11