Is it possible to do PARTITION BY in the Ash Domain?

Hi, I’m trying to achieve the following in Ash (3.1)

-- Create the parent table
CREATE TABLE telemetry_logs (
    id BIGSERIAL,
    event TEXT,
    duration INTEGER,
    inserted_at TIMESTAMP
) PARTITION BY RANGE (inserted_at);

-- Create partitions for each month
CREATE TABLE telemetry_logs_y2024m07 PARTITION OF telemetry_logs
    FOR VALUES FROM ('2024-07-01') TO ('2024-08-01');

CREATE TABLE telemetry_logs_y2024m08 PARTITION OF telemetry_logs
    FOR VALUES FROM ('2024-08-01') TO ('2024-09-01');

Question

  1. Is it possible to do PARTITION BY in the Ash Domain?
  2. I reckon that the child partitions are created manually via Repo.query ?

Best regards
Terry

Right now it is not possible AFAIK to set PARTITION BY on table creation with the Ash migration generator. However, what you can do is generate migrations and then alter the generated migration to do that (however you see fit).

Yes, the child partitions would very likely be created manually w/ Repo.query as you stated :+1: