/*
 * Create a "pipelines" table to track ingest related pipeline states
 * downloaded from Pipedream.
 */
BEGIN;
CREATE TABLE pipelines (
    pipe_id text PRIMARY KEY,
    meta_id text NOT NULL,
    ingest integer NOT NULL,
    scheduled_at timestamptz NOT NULL,
    raw_state text,
    state integer,
    completed boolean
);
CREATE INDEX pipelines_scheduled_at_idx ON pipelines (scheduled_at);
CREATE INDEX pipelines_meta_id_idx ON pipelines (meta_id);
COMMIT;

