{
    "_generated": "Generated by scripts/gen-manifest.ts — do not edit by hand. Run `npm run gen:manifest`.",
    "version": 42,
    "schemaToken": "{{schema}}",
    "partitioned": {
        "tables": [
            "bam",
            "job",
            "job_common",
            "job_dependency",
            "queue",
            "queue_stats",
            "schedule",
            "subscription",
            "version",
            "warning"
        ],
        "columns": [
            {
                "table": "bam",
                "column": "command",
                "type": "text",
                "notNull": true,
                "default": null
            },
            {
                "table": "bam",
                "column": "completed_on",
                "type": "timestamp with time zone",
                "notNull": false,
                "default": null
            },
            {
                "table": "bam",
                "column": "created_on",
                "type": "timestamp with time zone",
                "notNull": true,
                "default": "clock_timestamp()"
            },
            {
                "table": "bam",
                "column": "error",
                "type": "text",
                "notNull": false,
                "default": null
            },
            {
                "table": "bam",
                "column": "id",
                "type": "uuid",
                "notNull": true,
                "default": "gen_random_uuid()"
            },
            {
                "table": "bam",
                "column": "name",
                "type": "text",
                "notNull": true,
                "default": null
            },
            {
                "table": "bam",
                "column": "queue",
                "type": "text",
                "notNull": false,
                "default": null
            },
            {
                "table": "bam",
                "column": "started_on",
                "type": "timestamp with time zone",
                "notNull": false,
                "default": null
            },
            {
                "table": "bam",
                "column": "status",
                "type": "text",
                "notNull": true,
                "default": "'pending'::text"
            },
            {
                "table": "bam",
                "column": "table_name",
                "type": "text",
                "notNull": true,
                "default": null
            },
            {
                "table": "bam",
                "column": "version",
                "type": "integer",
                "notNull": true,
                "default": null
            },
            {
                "table": "job_common",
                "column": "blocked",
                "type": "boolean",
                "notNull": true,
                "default": "false"
            },
            {
                "table": "job_common",
                "column": "blocking",
                "type": "boolean",
                "notNull": true,
                "default": "false"
            },
            {
                "table": "job_common",
                "column": "completed_on",
                "type": "timestamp with time zone",
                "notNull": false,
                "default": null
            },
            {
                "table": "job_common",
                "column": "created_on",
                "type": "timestamp with time zone",
                "notNull": true,
                "default": "now()"
            },
            {
                "table": "job_common",
                "column": "data",
                "type": "jsonb",
                "notNull": false,
                "default": null
            },
            {
                "table": "job_common",
                "column": "dead_letter",
                "type": "text",
                "notNull": false,
                "default": null
            },
            {
                "table": "job_common",
                "column": "deletion_seconds",
                "type": "integer",
                "notNull": true,
                "default": "604800"
            },
            {
                "table": "job_common",
                "column": "expire_seconds",
                "type": "integer",
                "notNull": true,
                "default": "900"
            },
            {
                "table": "job_common",
                "column": "group_id",
                "type": "text",
                "notNull": false,
                "default": null
            },
            {
                "table": "job_common",
                "column": "group_tier",
                "type": "text",
                "notNull": false,
                "default": null
            },
            {
                "table": "job_common",
                "column": "heartbeat_on",
                "type": "timestamp with time zone",
                "notNull": false,
                "default": null
            },
            {
                "table": "job_common",
                "column": "heartbeat_seconds",
                "type": "integer",
                "notNull": false,
                "default": null
            },
            {
                "table": "job_common",
                "column": "id",
                "type": "uuid",
                "notNull": true,
                "default": "gen_random_uuid()"
            },
            {
                "table": "job_common",
                "column": "keep_until",
                "type": "timestamp with time zone",
                "notNull": true,
                "default": "(now() + '336:00:00'::interval)"
            },
            {
                "table": "job_common",
                "column": "name",
                "type": "text",
                "notNull": true,
                "default": null
            },
            {
                "table": "job_common",
                "column": "output",
                "type": "jsonb",
                "notNull": false,
                "default": null
            },
            {
                "table": "job_common",
                "column": "pending_dependencies",
                "type": "integer",
                "notNull": true,
                "default": "0"
            },
            {
                "table": "job_common",
                "column": "policy",
                "type": "text",
                "notNull": false,
                "default": null
            },
            {
                "table": "job_common",
                "column": "priority",
                "type": "integer",
                "notNull": true,
                "default": "0"
            },
            {
                "table": "job_common",
                "column": "retry_backoff",
                "type": "boolean",
                "notNull": true,
                "default": "false"
            },
            {
                "table": "job_common",
                "column": "retry_count",
                "type": "integer",
                "notNull": true,
                "default": "0"
            },
            {
                "table": "job_common",
                "column": "retry_delay",
                "type": "integer",
                "notNull": true,
                "default": "0"
            },
            {
                "table": "job_common",
                "column": "retry_delay_max",
                "type": "integer",
                "notNull": false,
                "default": null
            },
            {
                "table": "job_common",
                "column": "retry_limit",
                "type": "integer",
                "notNull": true,
                "default": "2"
            },
            {
                "table": "job_common",
                "column": "singleton_key",
                "type": "text",
                "notNull": false,
                "default": null
            },
            {
                "table": "job_common",
                "column": "singleton_on",
                "type": "timestamp without time zone",
                "notNull": false,
                "default": null
            },
            {
                "table": "job_common",
                "column": "source_created_on",
                "type": "timestamp with time zone",
                "notNull": false,
                "default": null
            },
            {
                "table": "job_common",
                "column": "source_id",
                "type": "uuid",
                "notNull": false,
                "default": null
            },
            {
                "table": "job_common",
                "column": "source_name",
                "type": "text",
                "notNull": false,
                "default": null
            },
            {
                "table": "job_common",
                "column": "source_retry_count",
                "type": "integer",
                "notNull": false,
                "default": null
            },
            {
                "table": "job_common",
                "column": "start_after",
                "type": "timestamp with time zone",
                "notNull": true,
                "default": "now()"
            },
            {
                "table": "job_common",
                "column": "started_on",
                "type": "timestamp with time zone",
                "notNull": false,
                "default": null
            },
            {
                "table": "job_common",
                "column": "state",
                "type": "{{schema}}.job_state",
                "notNull": true,
                "default": "'created'::{{schema}}.job_state"
            },
            {
                "table": "job_dependency",
                "column": "child_id",
                "type": "uuid",
                "notNull": true,
                "default": null
            },
            {
                "table": "job_dependency",
                "column": "child_name",
                "type": "text",
                "notNull": true,
                "default": null
            },
            {
                "table": "job_dependency",
                "column": "parent_id",
                "type": "uuid",
                "notNull": true,
                "default": null
            },
            {
                "table": "job_dependency",
                "column": "parent_name",
                "type": "text",
                "notNull": true,
                "default": null
            },
            {
                "table": "job",
                "column": "blocked",
                "type": "boolean",
                "notNull": true,
                "default": "false"
            },
            {
                "table": "job",
                "column": "blocking",
                "type": "boolean",
                "notNull": true,
                "default": "false"
            },
            {
                "table": "job",
                "column": "completed_on",
                "type": "timestamp with time zone",
                "notNull": false,
                "default": null
            },
            {
                "table": "job",
                "column": "created_on",
                "type": "timestamp with time zone",
                "notNull": true,
                "default": "now()"
            },
            {
                "table": "job",
                "column": "data",
                "type": "jsonb",
                "notNull": false,
                "default": null
            },
            {
                "table": "job",
                "column": "dead_letter",
                "type": "text",
                "notNull": false,
                "default": null
            },
            {
                "table": "job",
                "column": "deletion_seconds",
                "type": "integer",
                "notNull": true,
                "default": "604800"
            },
            {
                "table": "job",
                "column": "expire_seconds",
                "type": "integer",
                "notNull": true,
                "default": "900"
            },
            {
                "table": "job",
                "column": "group_id",
                "type": "text",
                "notNull": false,
                "default": null
            },
            {
                "table": "job",
                "column": "group_tier",
                "type": "text",
                "notNull": false,
                "default": null
            },
            {
                "table": "job",
                "column": "heartbeat_on",
                "type": "timestamp with time zone",
                "notNull": false,
                "default": null
            },
            {
                "table": "job",
                "column": "heartbeat_seconds",
                "type": "integer",
                "notNull": false,
                "default": null
            },
            {
                "table": "job",
                "column": "id",
                "type": "uuid",
                "notNull": true,
                "default": "gen_random_uuid()"
            },
            {
                "table": "job",
                "column": "keep_until",
                "type": "timestamp with time zone",
                "notNull": true,
                "default": "(now() + '336:00:00'::interval)"
            },
            {
                "table": "job",
                "column": "name",
                "type": "text",
                "notNull": true,
                "default": null
            },
            {
                "table": "job",
                "column": "output",
                "type": "jsonb",
                "notNull": false,
                "default": null
            },
            {
                "table": "job",
                "column": "pending_dependencies",
                "type": "integer",
                "notNull": true,
                "default": "0"
            },
            {
                "table": "job",
                "column": "policy",
                "type": "text",
                "notNull": false,
                "default": null
            },
            {
                "table": "job",
                "column": "priority",
                "type": "integer",
                "notNull": true,
                "default": "0"
            },
            {
                "table": "job",
                "column": "retry_backoff",
                "type": "boolean",
                "notNull": true,
                "default": "false"
            },
            {
                "table": "job",
                "column": "retry_count",
                "type": "integer",
                "notNull": true,
                "default": "0"
            },
            {
                "table": "job",
                "column": "retry_delay",
                "type": "integer",
                "notNull": true,
                "default": "0"
            },
            {
                "table": "job",
                "column": "retry_delay_max",
                "type": "integer",
                "notNull": false,
                "default": null
            },
            {
                "table": "job",
                "column": "retry_limit",
                "type": "integer",
                "notNull": true,
                "default": "2"
            },
            {
                "table": "job",
                "column": "singleton_key",
                "type": "text",
                "notNull": false,
                "default": null
            },
            {
                "table": "job",
                "column": "singleton_on",
                "type": "timestamp without time zone",
                "notNull": false,
                "default": null
            },
            {
                "table": "job",
                "column": "source_created_on",
                "type": "timestamp with time zone",
                "notNull": false,
                "default": null
            },
            {
                "table": "job",
                "column": "source_id",
                "type": "uuid",
                "notNull": false,
                "default": null
            },
            {
                "table": "job",
                "column": "source_name",
                "type": "text",
                "notNull": false,
                "default": null
            },
            {
                "table": "job",
                "column": "source_retry_count",
                "type": "integer",
                "notNull": false,
                "default": null
            },
            {
                "table": "job",
                "column": "start_after",
                "type": "timestamp with time zone",
                "notNull": true,
                "default": "now()"
            },
            {
                "table": "job",
                "column": "started_on",
                "type": "timestamp with time zone",
                "notNull": false,
                "default": null
            },
            {
                "table": "job",
                "column": "state",
                "type": "{{schema}}.job_state",
                "notNull": true,
                "default": "'created'::{{schema}}.job_state"
            },
            {
                "table": "queue_stats",
                "column": "active_count",
                "type": "integer",
                "notNull": true,
                "default": "0"
            },
            {
                "table": "queue_stats",
                "column": "captured_on",
                "type": "timestamp with time zone",
                "notNull": true,
                "default": "now()"
            },
            {
                "table": "queue_stats",
                "column": "deferred_count",
                "type": "integer",
                "notNull": true,
                "default": "0"
            },
            {
                "table": "queue_stats",
                "column": "failed_count",
                "type": "integer",
                "notNull": true,
                "default": "0"
            },
            {
                "table": "queue_stats",
                "column": "id",
                "type": "uuid",
                "notNull": true,
                "default": "gen_random_uuid()"
            },
            {
                "table": "queue_stats",
                "column": "name",
                "type": "text",
                "notNull": true,
                "default": null
            },
            {
                "table": "queue_stats",
                "column": "queued_count",
                "type": "integer",
                "notNull": true,
                "default": "0"
            },
            {
                "table": "queue_stats",
                "column": "ready_count",
                "type": "integer",
                "notNull": true,
                "default": "0"
            },
            {
                "table": "queue_stats",
                "column": "total_count",
                "type": "integer",
                "notNull": true,
                "default": "0"
            },
            {
                "table": "queue",
                "column": "active_count",
                "type": "integer",
                "notNull": true,
                "default": "0"
            },
            {
                "table": "queue",
                "column": "created_on",
                "type": "timestamp with time zone",
                "notNull": true,
                "default": "now()"
            },
            {
                "table": "queue",
                "column": "dead_letter",
                "type": "text",
                "notNull": false,
                "default": null
            },
            {
                "table": "queue",
                "column": "deferred_count",
                "type": "integer",
                "notNull": true,
                "default": "0"
            },
            {
                "table": "queue",
                "column": "deletion_seconds",
                "type": "integer",
                "notNull": true,
                "default": null
            },
            {
                "table": "queue",
                "column": "expire_seconds",
                "type": "integer",
                "notNull": true,
                "default": null
            },
            {
                "table": "queue",
                "column": "failed_count",
                "type": "integer",
                "notNull": true,
                "default": "0"
            },
            {
                "table": "queue",
                "column": "heartbeat_seconds",
                "type": "integer",
                "notNull": false,
                "default": null
            },
            {
                "table": "queue",
                "column": "maintain_on",
                "type": "timestamp with time zone",
                "notNull": false,
                "default": null
            },
            {
                "table": "queue",
                "column": "monitor_claim_on",
                "type": "timestamp with time zone",
                "notNull": false,
                "default": null
            },
            {
                "table": "queue",
                "column": "monitor_on",
                "type": "timestamp with time zone",
                "notNull": false,
                "default": null
            },
            {
                "table": "queue",
                "column": "name",
                "type": "text",
                "notNull": true,
                "default": null
            },
            {
                "table": "queue",
                "column": "notify",
                "type": "boolean",
                "notNull": true,
                "default": "false"
            },
            {
                "table": "queue",
                "column": "partition",
                "type": "boolean",
                "notNull": true,
                "default": null
            },
            {
                "table": "queue",
                "column": "policy",
                "type": "text",
                "notNull": true,
                "default": null
            },
            {
                "table": "queue",
                "column": "queued_count",
                "type": "integer",
                "notNull": true,
                "default": "0"
            },
            {
                "table": "queue",
                "column": "ready_count",
                "type": "integer",
                "notNull": true,
                "default": "0"
            },
            {
                "table": "queue",
                "column": "ready_history",
                "type": "integer[]",
                "notNull": true,
                "default": "'{}'::integer[]"
            },
            {
                "table": "queue",
                "column": "retention_seconds",
                "type": "integer",
                "notNull": true,
                "default": null
            },
            {
                "table": "queue",
                "column": "retry_backoff",
                "type": "boolean",
                "notNull": true,
                "default": null
            },
            {
                "table": "queue",
                "column": "retry_delay",
                "type": "integer",
                "notNull": true,
                "default": null
            },
            {
                "table": "queue",
                "column": "retry_delay_max",
                "type": "integer",
                "notNull": false,
                "default": null
            },
            {
                "table": "queue",
                "column": "retry_limit",
                "type": "integer",
                "notNull": true,
                "default": null
            },
            {
                "table": "queue",
                "column": "singletons_active",
                "type": "text[]",
                "notNull": false,
                "default": null
            },
            {
                "table": "queue",
                "column": "table_name",
                "type": "text",
                "notNull": true,
                "default": null
            },
            {
                "table": "queue",
                "column": "total_count",
                "type": "integer",
                "notNull": true,
                "default": "0"
            },
            {
                "table": "queue",
                "column": "updated_on",
                "type": "timestamp with time zone",
                "notNull": true,
                "default": "now()"
            },
            {
                "table": "queue",
                "column": "warning_queued",
                "type": "integer",
                "notNull": true,
                "default": "0"
            },
            {
                "table": "schedule",
                "column": "created_on",
                "type": "timestamp with time zone",
                "notNull": true,
                "default": "now()"
            },
            {
                "table": "schedule",
                "column": "cron",
                "type": "text",
                "notNull": true,
                "default": null
            },
            {
                "table": "schedule",
                "column": "data",
                "type": "jsonb",
                "notNull": false,
                "default": null
            },
            {
                "table": "schedule",
                "column": "key",
                "type": "text",
                "notNull": true,
                "default": "''::text"
            },
            {
                "table": "schedule",
                "column": "kind",
                "type": "text",
                "notNull": true,
                "default": "'cron'::text"
            },
            {
                "table": "schedule",
                "column": "last_job_id",
                "type": "uuid",
                "notNull": false,
                "default": null
            },
            {
                "table": "schedule",
                "column": "name",
                "type": "text",
                "notNull": true,
                "default": null
            },
            {
                "table": "schedule",
                "column": "options",
                "type": "jsonb",
                "notNull": false,
                "default": null
            },
            {
                "table": "schedule",
                "column": "timezone",
                "type": "text",
                "notNull": false,
                "default": "'UTC'::text"
            },
            {
                "table": "schedule",
                "column": "updated_on",
                "type": "timestamp with time zone",
                "notNull": true,
                "default": "now()"
            },
            {
                "table": "subscription",
                "column": "created_on",
                "type": "timestamp with time zone",
                "notNull": true,
                "default": "now()"
            },
            {
                "table": "subscription",
                "column": "event",
                "type": "text",
                "notNull": true,
                "default": null
            },
            {
                "table": "subscription",
                "column": "name",
                "type": "text",
                "notNull": true,
                "default": null
            },
            {
                "table": "subscription",
                "column": "updated_on",
                "type": "timestamp with time zone",
                "notNull": true,
                "default": "now()"
            },
            {
                "table": "version",
                "column": "bam_on",
                "type": "timestamp with time zone",
                "notNull": false,
                "default": null
            },
            {
                "table": "version",
                "column": "cron_on",
                "type": "timestamp with time zone",
                "notNull": false,
                "default": null
            },
            {
                "table": "version",
                "column": "flow_on",
                "type": "timestamp with time zone",
                "notNull": false,
                "default": null
            },
            {
                "table": "version",
                "column": "monitor_backoff_on",
                "type": "timestamp with time zone",
                "notNull": false,
                "default": null
            },
            {
                "table": "version",
                "column": "reindex_on",
                "type": "timestamp with time zone",
                "notNull": false,
                "default": null
            },
            {
                "table": "version",
                "column": "version",
                "type": "integer",
                "notNull": true,
                "default": null
            },
            {
                "table": "warning",
                "column": "created_on",
                "type": "timestamp with time zone",
                "notNull": true,
                "default": "now()"
            },
            {
                "table": "warning",
                "column": "data",
                "type": "jsonb",
                "notNull": false,
                "default": null
            },
            {
                "table": "warning",
                "column": "id",
                "type": "uuid",
                "notNull": true,
                "default": "gen_random_uuid()"
            },
            {
                "table": "warning",
                "column": "message",
                "type": "text",
                "notNull": true,
                "default": null
            },
            {
                "table": "warning",
                "column": "type",
                "type": "text",
                "notNull": true,
                "default": null
            }
        ],
        "constraints": [
            {
                "table": "bam",
                "def": "PRIMARY KEY (id)"
            },
            {
                "table": "job_common",
                "def": "CHECK ((NOT ((policy = 'key_strict_fifo'::text) AND (singleton_key IS NULL))))"
            },
            {
                "table": "job_common",
                "def": "FOREIGN KEY (dead_letter) REFERENCES {{schema}}.queue(name) ON DELETE RESTRICT DEFERRABLE INITIALLY DEFERRED"
            },
            {
                "table": "job_common",
                "def": "FOREIGN KEY (name) REFERENCES {{schema}}.queue(name) ON DELETE RESTRICT DEFERRABLE INITIALLY DEFERRED"
            },
            {
                "table": "job_common",
                "def": "PRIMARY KEY (name, id)"
            },
            {
                "table": "job_dependency",
                "def": "PRIMARY KEY (child_name, child_id, parent_name, parent_id)"
            },
            {
                "table": "job",
                "def": "PRIMARY KEY (name, id)"
            },
            {
                "table": "queue_stats",
                "def": "PRIMARY KEY (id, captured_on)"
            },
            {
                "table": "queue",
                "def": "CHECK ((dead_letter IS DISTINCT FROM name))"
            },
            {
                "table": "queue",
                "def": "FOREIGN KEY (dead_letter) REFERENCES {{schema}}.queue(name)"
            },
            {
                "table": "queue",
                "def": "PRIMARY KEY (name)"
            },
            {
                "table": "schedule",
                "def": "CHECK ((kind = ANY (ARRAY['cron'::text, 'rrule'::text])))"
            },
            {
                "table": "schedule",
                "def": "FOREIGN KEY (name) REFERENCES {{schema}}.queue(name) ON DELETE CASCADE"
            },
            {
                "table": "schedule",
                "def": "PRIMARY KEY (name, key)"
            },
            {
                "table": "subscription",
                "def": "FOREIGN KEY (name) REFERENCES {{schema}}.queue(name) ON DELETE CASCADE"
            },
            {
                "table": "subscription",
                "def": "PRIMARY KEY (event, name)"
            },
            {
                "table": "version",
                "def": "PRIMARY KEY (version)"
            },
            {
                "table": "warning",
                "def": "PRIMARY KEY (id)"
            }
        ],
        "indexes": [
            {
                "name": "job_common_i1",
                "table": "job_common",
                "valid": true,
                "def": "CREATE UNIQUE INDEX job_common_i1 ON {{schema}}.job_common USING btree (name, COALESCE(singleton_key, ''::text)) WHERE ((state = 'created'::{{schema}}.job_state) AND (policy = 'short'::text))"
            },
            {
                "name": "job_common_i10",
                "table": "job_common",
                "valid": true,
                "def": "CREATE INDEX job_common_i10 ON {{schema}}.job_common USING btree (name, singleton_key, state DESC, created_on, id) INCLUDE (start_after) WHERE ((state < 'active'::{{schema}}.job_state) AND (NOT blocked) AND (policy = 'key_strict_fifo'::text))"
            },
            {
                "name": "job_common_i11",
                "table": "job_common",
                "valid": true,
                "def": "CREATE INDEX job_common_i11 ON {{schema}}.job_common USING btree (name, priority DESC, created_on, start_after) WHERE ((state < 'active'::{{schema}}.job_state) AND (NOT blocked))"
            },
            {
                "name": "job_common_i2",
                "table": "job_common",
                "valid": true,
                "def": "CREATE UNIQUE INDEX job_common_i2 ON {{schema}}.job_common USING btree (name, COALESCE(singleton_key, ''::text)) WHERE ((state = 'active'::{{schema}}.job_state) AND (policy = 'singleton'::text))"
            },
            {
                "name": "job_common_i3",
                "table": "job_common",
                "valid": true,
                "def": "CREATE UNIQUE INDEX job_common_i3 ON {{schema}}.job_common USING btree (name, state, COALESCE(singleton_key, ''::text)) WHERE ((state <= 'active'::{{schema}}.job_state) AND (policy = 'stately'::text))"
            },
            {
                "name": "job_common_i4",
                "table": "job_common",
                "valid": true,
                "def": "CREATE UNIQUE INDEX job_common_i4 ON {{schema}}.job_common USING btree (name, singleton_on, COALESCE(singleton_key, ''::text)) WHERE ((state <> 'cancelled'::{{schema}}.job_state) AND (singleton_on IS NOT NULL))"
            },
            {
                "name": "job_common_i6",
                "table": "job_common",
                "valid": true,
                "def": "CREATE UNIQUE INDEX job_common_i6 ON {{schema}}.job_common USING btree (name, COALESCE(singleton_key, ''::text)) WHERE ((state <= 'active'::{{schema}}.job_state) AND (policy = 'exclusive'::text))"
            },
            {
                "name": "job_common_i7",
                "table": "job_common",
                "valid": true,
                "def": "CREATE INDEX job_common_i7 ON {{schema}}.job_common USING btree (name, group_id) WHERE ((state = 'active'::{{schema}}.job_state) AND (group_id IS NOT NULL))"
            },
            {
                "name": "job_common_i8",
                "table": "job_common",
                "valid": true,
                "def": "CREATE UNIQUE INDEX job_common_i8 ON {{schema}}.job_common USING btree (name, singleton_key) WHERE ((state = ANY (ARRAY['active'::{{schema}}.job_state, 'retry'::{{schema}}.job_state, 'failed'::{{schema}}.job_state])) AND (policy = 'key_strict_fifo'::text))"
            },
            {
                "name": "job_common_i9",
                "table": "job_common",
                "valid": true,
                "def": "CREATE INDEX job_common_i9 ON {{schema}}.job_common USING btree (name, id) WHERE (blocking AND (state = 'completed'::{{schema}}.job_state))"
            },
            {
                "name": "job_dep_parent_idx",
                "table": "job_dependency",
                "valid": true,
                "def": "CREATE INDEX job_dep_parent_idx ON {{schema}}.job_dependency USING btree (parent_name, parent_id)"
            },
            {
                "name": "queue_stats_i1",
                "table": "queue_stats",
                "valid": true,
                "def": "CREATE INDEX queue_stats_i1 ON ONLY {{schema}}.queue_stats USING btree (name, captured_on DESC) INCLUDE (deferred_count, queued_count, ready_count, active_count, failed_count, total_count)"
            },
            {
                "name": "warning_i1",
                "table": "warning",
                "valid": true,
                "def": "CREATE INDEX warning_i1 ON {{schema}}.warning USING btree (created_on DESC)"
            }
        ],
        "functions": [
            {
                "name": "create_queue",
                "def": "CREATE OR REPLACE FUNCTION {{schema}}.create_queue(queue_name text, options jsonb)\n RETURNS void\n LANGUAGE plpgsql\nAS $function$\n    DECLARE\n      tablename varchar := CASE WHEN options->>'partition' = 'true'\n                            THEN 'j' || encode(sha224(queue_name::bytea), 'hex')\n                            ELSE 'job_common'\n                            END;\n      queue_created_on timestamptz;\n    BEGIN\n\n      WITH q as (\n        INSERT INTO {{schema}}.queue (\n          name,\n          policy,\n          retry_limit,\n          retry_delay,\n          retry_backoff,\n          retry_delay_max,\n          expire_seconds,\n          retention_seconds,\n          deletion_seconds,\n          warning_queued,\n          dead_letter,\n          partition,\n          table_name,\n          heartbeat_seconds,\n          notify,\n          created_on,\n          updated_on\n        )\n        VALUES (\n          queue_name,\n          options->>'policy',\n          COALESCE((options->>'retryLimit')::int, 2),\n          COALESCE((options->>'retryDelay')::int, 0),\n          COALESCE((options->>'retryBackoff')::bool, false),\n          (options->>'retryDelayMax')::int,\n          COALESCE((options->>'expireInSeconds')::int, 900),\n          COALESCE((options->>'retentionSeconds')::int, 1209600),\n          COALESCE((options->>'deleteAfterSeconds')::int, 604800),\n          COALESCE((options->>'warningQueueSize')::int, 0),\n          options->>'deadLetter',\n          COALESCE((options->>'partition')::bool, false),\n          tablename,\n          (options->>'heartbeatSeconds')::int,\n          COALESCE((options->>'notify')::bool, false),\n          {{schema}}.job_now(),\n          {{schema}}.job_now()\n        )\n        ON CONFLICT DO NOTHING\n        RETURNING created_on\n      )\n      SELECT created_on into queue_created_on from q;\n\n      IF queue_created_on IS NULL OR options->>'partition' IS DISTINCT FROM 'true' THEN\n        RETURN;\n      END IF;\n\n      EXECUTE format('CREATE TABLE {{schema}}.%I (LIKE {{schema}}.job INCLUDING DEFAULTS)', tablename);\n\n      EXECUTE {{schema}}.job_table_format($cmd$ALTER TABLE {{schema}}.job ADD PRIMARY KEY (name, id)$cmd$, tablename);\n      EXECUTE {{schema}}.job_table_format($cmd$ALTER TABLE {{schema}}.job ADD CONSTRAINT q_fkey FOREIGN KEY (name) REFERENCES {{schema}}.queue (name) ON DELETE RESTRICT DEFERRABLE INITIALLY DEFERRED$cmd$, tablename);\n      EXECUTE {{schema}}.job_table_format($cmd$ALTER TABLE {{schema}}.job ADD CONSTRAINT dlq_fkey FOREIGN KEY (dead_letter) REFERENCES {{schema}}.queue (name) ON DELETE RESTRICT DEFERRABLE INITIALLY DEFERRED$cmd$, tablename);\n\n      EXECUTE {{schema}}.job_table_format($cmd$CREATE INDEX job_i11 ON {{schema}}.job (name, priority DESC, created_on, start_after) WHERE state < 'active' AND NOT blocked$cmd$, tablename);\n      EXECUTE {{schema}}.job_table_format($cmd$CREATE UNIQUE INDEX job_i4 ON {{schema}}.job (name, singleton_on, COALESCE(singleton_key, '')) WHERE state <> 'cancelled' AND singleton_on IS NOT NULL$cmd$, tablename);\n      EXECUTE {{schema}}.job_table_format($cmd$CREATE INDEX job_i7 ON {{schema}}.job (name, group_id) WHERE state = 'active' AND group_id IS NOT NULL$cmd$, tablename);\n      EXECUTE {{schema}}.job_table_format($cmd$CREATE INDEX job_i9 ON {{schema}}.job (name, id) WHERE blocking AND state = 'completed'$cmd$, tablename);\n\n      IF options->>'policy' = 'short' THEN\n        EXECUTE {{schema}}.job_table_format($cmd$CREATE UNIQUE INDEX job_i1 ON {{schema}}.job (name, COALESCE(singleton_key, '')) WHERE state = 'created' AND policy = 'short'$cmd$, tablename);\n      ELSIF options->>'policy' = 'singleton' THEN\n        EXECUTE {{schema}}.job_table_format($cmd$CREATE UNIQUE INDEX job_i2 ON {{schema}}.job (name, COALESCE(singleton_key, '')) WHERE state = 'active' AND policy = 'singleton'$cmd$, tablename);\n      ELSIF options->>'policy' = 'stately' THEN\n        EXECUTE {{schema}}.job_table_format($cmd$CREATE UNIQUE INDEX job_i3 ON {{schema}}.job (name, state, COALESCE(singleton_key, '')) WHERE state <= 'active' AND policy = 'stately'$cmd$, tablename);\n      ELSIF options->>'policy' = 'exclusive' THEN\n        EXECUTE {{schema}}.job_table_format($cmd$CREATE UNIQUE INDEX job_i6 ON {{schema}}.job (name, COALESCE(singleton_key, '')) WHERE state <= 'active' AND policy = 'exclusive'$cmd$, tablename);\n      ELSIF options->>'policy' = 'key_strict_fifo' THEN\n        EXECUTE {{schema}}.job_table_format($cmd$CREATE UNIQUE INDEX job_i8 ON {{schema}}.job (name, singleton_key) WHERE state IN ('active', 'retry', 'failed') AND policy = 'key_strict_fifo'$cmd$, tablename);\n        EXECUTE {{schema}}.job_table_format($cmd$CREATE INDEX job_i10 ON {{schema}}.job (name, singleton_key, state DESC, created_on, id) INCLUDE (start_after) WHERE state < 'active' AND NOT blocked AND policy = 'key_strict_fifo'$cmd$, tablename);\n        EXECUTE {{schema}}.job_table_format($cmd$ALTER TABLE {{schema}}.job ADD CONSTRAINT job_key_strict_fifo_singleton_key_check CHECK (NOT (policy = 'key_strict_fifo' AND singleton_key IS NULL))$cmd$, tablename);\n      END IF;\n\n      EXECUTE format('ALTER TABLE {{schema}}.%I ADD CONSTRAINT cjc CHECK (name=%L)', tablename, queue_name);\n      EXECUTE format('ALTER TABLE {{schema}}.job ATTACH PARTITION {{schema}}.%I FOR VALUES IN (%L)', tablename, queue_name);\n    END;\n    $function$\n"
            },
            {
                "name": "delete_queue",
                "def": "CREATE OR REPLACE FUNCTION {{schema}}.delete_queue(queue_name text)\n RETURNS void\n LANGUAGE plpgsql\nAS $function$\n    DECLARE\n      v_table varchar;\n      v_partition bool;\n    BEGIN\n      \n      SELECT table_name, partition\n      FROM {{schema}}.queue\n      WHERE name = queue_name\n      INTO v_table, v_partition;\n\n      IF v_partition THEN\n        EXECUTE format('DROP TABLE IF EXISTS {{schema}}.%I', v_table);\n      ELSE\n        EXECUTE format('DELETE FROM {{schema}}.%I WHERE name = %L', v_table, queue_name);\n      END IF;\n    \n      DELETE FROM {{schema}}.queue WHERE name = queue_name;\n    END;\n    $function$\n"
            },
            {
                "name": "job_now",
                "def": "CREATE OR REPLACE FUNCTION {{schema}}.job_now()\n RETURNS timestamp with time zone\n LANGUAGE sql\n STABLE\nAS $function$\n      SELECT pg_catalog.now();\n    $function$\n"
            },
            {
                "name": "job_table_format",
                "def": "CREATE OR REPLACE FUNCTION {{schema}}.job_table_format(command text, table_name text)\n RETURNS text\n LANGUAGE sql\n IMMUTABLE\nAS $function$\n      SELECT format(\n        regexp_replace(\n          regexp_replace(command, '\\.job\\y', '.%1$I', 'g'),\n          '\\yjob_i(\\d+)', '%1$s_i\\1', 'g'\n        ),\n        table_name\n      );\n    $function$\n"
            },
            {
                "name": "job_table_run",
                "def": "CREATE OR REPLACE FUNCTION {{schema}}.job_table_run(command text, tbl_name text DEFAULT NULL::text, queue_name text DEFAULT NULL::text)\n RETURNS void\n LANGUAGE plpgsql\nAS $function$\n    DECLARE\n      tbl RECORD;\n    BEGIN\n      IF queue_name IS NOT NULL THEN\n        SELECT table_name INTO tbl_name FROM {{schema}}.queue WHERE name = queue_name;\n      END IF;\n\n      IF tbl_name IS NOT NULL THEN\n        EXECUTE {{schema}}.job_table_format(command, tbl_name);\n        RETURN;\n      END IF;\n\n      EXECUTE {{schema}}.job_table_format(command, 'job_common');\n\n      FOR tbl IN SELECT table_name FROM {{schema}}.queue WHERE partition = true\n      LOOP\n        EXECUTE {{schema}}.job_table_format(command, tbl.table_name);\n      END LOOP;\n    END;\n    $function$\n"
            },
            {
                "name": "job_table_run_async",
                "def": "CREATE OR REPLACE FUNCTION {{schema}}.job_table_run_async(command_name text, version integer, command text, tbl_name text DEFAULT NULL::text, queue_name text DEFAULT NULL::text)\n RETURNS void\n LANGUAGE plpgsql\nAS $function$\n    BEGIN\n      IF queue_name IS NOT NULL THEN\n        SELECT table_name INTO tbl_name FROM {{schema}}.queue WHERE name = queue_name;\n      END IF;\n\n      IF tbl_name IS NOT NULL THEN\n        INSERT INTO {{schema}}.bam (name, version, status, queue, table_name, command)\n        VALUES (\n          command_name,\n          version,\n          'pending',\n          queue_name,\n          tbl_name,\n          {{schema}}.job_table_format(command, tbl_name)\n        );\n        RETURN;\n      END IF;\n\n      INSERT INTO {{schema}}.bam (name, version, status, queue, table_name, command)\n      SELECT\n        command_name,\n        version,\n        'pending',\n        NULL,\n        'job_common',\n        {{schema}}.job_table_format(command, 'job_common')\n      UNION ALL\n      SELECT\n        command_name,\n        version,\n        'pending',\n        queue.name,\n        queue.table_name,\n        {{schema}}.job_table_format(command, queue.table_name)\n      FROM {{schema}}.queue\n      WHERE partition = true;\n    END;\n    $function$\n"
            }
        ],
        "enum": [
            "created",
            "retry",
            "active",
            "completed",
            "cancelled",
            "failed"
        ]
    },
    "nonPartitioned": {
        "tables": [
            "bam",
            "job",
            "job_dependency",
            "queue",
            "queue_stats",
            "schedule",
            "subscription",
            "version",
            "warning"
        ],
        "columns": [
            {
                "table": "bam",
                "column": "command",
                "type": "text",
                "notNull": true,
                "default": null
            },
            {
                "table": "bam",
                "column": "completed_on",
                "type": "timestamp with time zone",
                "notNull": false,
                "default": null
            },
            {
                "table": "bam",
                "column": "created_on",
                "type": "timestamp with time zone",
                "notNull": true,
                "default": "clock_timestamp()"
            },
            {
                "table": "bam",
                "column": "error",
                "type": "text",
                "notNull": false,
                "default": null
            },
            {
                "table": "bam",
                "column": "id",
                "type": "uuid",
                "notNull": true,
                "default": "gen_random_uuid()"
            },
            {
                "table": "bam",
                "column": "name",
                "type": "text",
                "notNull": true,
                "default": null
            },
            {
                "table": "bam",
                "column": "queue",
                "type": "text",
                "notNull": false,
                "default": null
            },
            {
                "table": "bam",
                "column": "started_on",
                "type": "timestamp with time zone",
                "notNull": false,
                "default": null
            },
            {
                "table": "bam",
                "column": "status",
                "type": "text",
                "notNull": true,
                "default": "'pending'::text"
            },
            {
                "table": "bam",
                "column": "table_name",
                "type": "text",
                "notNull": true,
                "default": null
            },
            {
                "table": "bam",
                "column": "version",
                "type": "integer",
                "notNull": true,
                "default": null
            },
            {
                "table": "job_dependency",
                "column": "child_id",
                "type": "uuid",
                "notNull": true,
                "default": null
            },
            {
                "table": "job_dependency",
                "column": "child_name",
                "type": "text",
                "notNull": true,
                "default": null
            },
            {
                "table": "job_dependency",
                "column": "parent_id",
                "type": "uuid",
                "notNull": true,
                "default": null
            },
            {
                "table": "job_dependency",
                "column": "parent_name",
                "type": "text",
                "notNull": true,
                "default": null
            },
            {
                "table": "job",
                "column": "blocked",
                "type": "boolean",
                "notNull": true,
                "default": "false"
            },
            {
                "table": "job",
                "column": "blocking",
                "type": "boolean",
                "notNull": true,
                "default": "false"
            },
            {
                "table": "job",
                "column": "completed_on",
                "type": "timestamp with time zone",
                "notNull": false,
                "default": null
            },
            {
                "table": "job",
                "column": "created_on",
                "type": "timestamp with time zone",
                "notNull": true,
                "default": "now()"
            },
            {
                "table": "job",
                "column": "data",
                "type": "jsonb",
                "notNull": false,
                "default": null
            },
            {
                "table": "job",
                "column": "dead_letter",
                "type": "text",
                "notNull": false,
                "default": null
            },
            {
                "table": "job",
                "column": "deletion_seconds",
                "type": "integer",
                "notNull": true,
                "default": "604800"
            },
            {
                "table": "job",
                "column": "expire_seconds",
                "type": "integer",
                "notNull": true,
                "default": "900"
            },
            {
                "table": "job",
                "column": "group_id",
                "type": "text",
                "notNull": false,
                "default": null
            },
            {
                "table": "job",
                "column": "group_tier",
                "type": "text",
                "notNull": false,
                "default": null
            },
            {
                "table": "job",
                "column": "heartbeat_on",
                "type": "timestamp with time zone",
                "notNull": false,
                "default": null
            },
            {
                "table": "job",
                "column": "heartbeat_seconds",
                "type": "integer",
                "notNull": false,
                "default": null
            },
            {
                "table": "job",
                "column": "id",
                "type": "uuid",
                "notNull": true,
                "default": "gen_random_uuid()"
            },
            {
                "table": "job",
                "column": "keep_until",
                "type": "timestamp with time zone",
                "notNull": true,
                "default": "(now() + '336:00:00'::interval)"
            },
            {
                "table": "job",
                "column": "name",
                "type": "text",
                "notNull": true,
                "default": null
            },
            {
                "table": "job",
                "column": "output",
                "type": "jsonb",
                "notNull": false,
                "default": null
            },
            {
                "table": "job",
                "column": "pending_dependencies",
                "type": "integer",
                "notNull": true,
                "default": "0"
            },
            {
                "table": "job",
                "column": "policy",
                "type": "text",
                "notNull": false,
                "default": null
            },
            {
                "table": "job",
                "column": "priority",
                "type": "integer",
                "notNull": true,
                "default": "0"
            },
            {
                "table": "job",
                "column": "retry_backoff",
                "type": "boolean",
                "notNull": true,
                "default": "false"
            },
            {
                "table": "job",
                "column": "retry_count",
                "type": "integer",
                "notNull": true,
                "default": "0"
            },
            {
                "table": "job",
                "column": "retry_delay",
                "type": "integer",
                "notNull": true,
                "default": "0"
            },
            {
                "table": "job",
                "column": "retry_delay_max",
                "type": "integer",
                "notNull": false,
                "default": null
            },
            {
                "table": "job",
                "column": "retry_limit",
                "type": "integer",
                "notNull": true,
                "default": "2"
            },
            {
                "table": "job",
                "column": "singleton_key",
                "type": "text",
                "notNull": false,
                "default": null
            },
            {
                "table": "job",
                "column": "singleton_on",
                "type": "timestamp without time zone",
                "notNull": false,
                "default": null
            },
            {
                "table": "job",
                "column": "source_created_on",
                "type": "timestamp with time zone",
                "notNull": false,
                "default": null
            },
            {
                "table": "job",
                "column": "source_id",
                "type": "uuid",
                "notNull": false,
                "default": null
            },
            {
                "table": "job",
                "column": "source_name",
                "type": "text",
                "notNull": false,
                "default": null
            },
            {
                "table": "job",
                "column": "source_retry_count",
                "type": "integer",
                "notNull": false,
                "default": null
            },
            {
                "table": "job",
                "column": "start_after",
                "type": "timestamp with time zone",
                "notNull": true,
                "default": "now()"
            },
            {
                "table": "job",
                "column": "started_on",
                "type": "timestamp with time zone",
                "notNull": false,
                "default": null
            },
            {
                "table": "job",
                "column": "state",
                "type": "{{schema}}.job_state",
                "notNull": true,
                "default": "'created'::{{schema}}.job_state"
            },
            {
                "table": "queue_stats",
                "column": "active_count",
                "type": "integer",
                "notNull": true,
                "default": "0"
            },
            {
                "table": "queue_stats",
                "column": "captured_on",
                "type": "timestamp with time zone",
                "notNull": true,
                "default": "now()"
            },
            {
                "table": "queue_stats",
                "column": "deferred_count",
                "type": "integer",
                "notNull": true,
                "default": "0"
            },
            {
                "table": "queue_stats",
                "column": "failed_count",
                "type": "integer",
                "notNull": true,
                "default": "0"
            },
            {
                "table": "queue_stats",
                "column": "id",
                "type": "uuid",
                "notNull": true,
                "default": "gen_random_uuid()"
            },
            {
                "table": "queue_stats",
                "column": "name",
                "type": "text",
                "notNull": true,
                "default": null
            },
            {
                "table": "queue_stats",
                "column": "queued_count",
                "type": "integer",
                "notNull": true,
                "default": "0"
            },
            {
                "table": "queue_stats",
                "column": "ready_count",
                "type": "integer",
                "notNull": true,
                "default": "0"
            },
            {
                "table": "queue_stats",
                "column": "total_count",
                "type": "integer",
                "notNull": true,
                "default": "0"
            },
            {
                "table": "queue",
                "column": "active_count",
                "type": "integer",
                "notNull": true,
                "default": "0"
            },
            {
                "table": "queue",
                "column": "created_on",
                "type": "timestamp with time zone",
                "notNull": true,
                "default": "now()"
            },
            {
                "table": "queue",
                "column": "dead_letter",
                "type": "text",
                "notNull": false,
                "default": null
            },
            {
                "table": "queue",
                "column": "deferred_count",
                "type": "integer",
                "notNull": true,
                "default": "0"
            },
            {
                "table": "queue",
                "column": "deletion_seconds",
                "type": "integer",
                "notNull": true,
                "default": null
            },
            {
                "table": "queue",
                "column": "expire_seconds",
                "type": "integer",
                "notNull": true,
                "default": null
            },
            {
                "table": "queue",
                "column": "failed_count",
                "type": "integer",
                "notNull": true,
                "default": "0"
            },
            {
                "table": "queue",
                "column": "heartbeat_seconds",
                "type": "integer",
                "notNull": false,
                "default": null
            },
            {
                "table": "queue",
                "column": "maintain_on",
                "type": "timestamp with time zone",
                "notNull": false,
                "default": null
            },
            {
                "table": "queue",
                "column": "monitor_claim_on",
                "type": "timestamp with time zone",
                "notNull": false,
                "default": null
            },
            {
                "table": "queue",
                "column": "monitor_on",
                "type": "timestamp with time zone",
                "notNull": false,
                "default": null
            },
            {
                "table": "queue",
                "column": "name",
                "type": "text",
                "notNull": true,
                "default": null
            },
            {
                "table": "queue",
                "column": "notify",
                "type": "boolean",
                "notNull": true,
                "default": "false"
            },
            {
                "table": "queue",
                "column": "partition",
                "type": "boolean",
                "notNull": true,
                "default": null
            },
            {
                "table": "queue",
                "column": "policy",
                "type": "text",
                "notNull": true,
                "default": null
            },
            {
                "table": "queue",
                "column": "queued_count",
                "type": "integer",
                "notNull": true,
                "default": "0"
            },
            {
                "table": "queue",
                "column": "ready_count",
                "type": "integer",
                "notNull": true,
                "default": "0"
            },
            {
                "table": "queue",
                "column": "ready_history",
                "type": "integer[]",
                "notNull": true,
                "default": "'{}'::integer[]"
            },
            {
                "table": "queue",
                "column": "retention_seconds",
                "type": "integer",
                "notNull": true,
                "default": null
            },
            {
                "table": "queue",
                "column": "retry_backoff",
                "type": "boolean",
                "notNull": true,
                "default": null
            },
            {
                "table": "queue",
                "column": "retry_delay",
                "type": "integer",
                "notNull": true,
                "default": null
            },
            {
                "table": "queue",
                "column": "retry_delay_max",
                "type": "integer",
                "notNull": false,
                "default": null
            },
            {
                "table": "queue",
                "column": "retry_limit",
                "type": "integer",
                "notNull": true,
                "default": null
            },
            {
                "table": "queue",
                "column": "singletons_active",
                "type": "text[]",
                "notNull": false,
                "default": null
            },
            {
                "table": "queue",
                "column": "table_name",
                "type": "text",
                "notNull": true,
                "default": null
            },
            {
                "table": "queue",
                "column": "total_count",
                "type": "integer",
                "notNull": true,
                "default": "0"
            },
            {
                "table": "queue",
                "column": "updated_on",
                "type": "timestamp with time zone",
                "notNull": true,
                "default": "now()"
            },
            {
                "table": "queue",
                "column": "warning_queued",
                "type": "integer",
                "notNull": true,
                "default": "0"
            },
            {
                "table": "schedule",
                "column": "created_on",
                "type": "timestamp with time zone",
                "notNull": true,
                "default": "now()"
            },
            {
                "table": "schedule",
                "column": "cron",
                "type": "text",
                "notNull": true,
                "default": null
            },
            {
                "table": "schedule",
                "column": "data",
                "type": "jsonb",
                "notNull": false,
                "default": null
            },
            {
                "table": "schedule",
                "column": "key",
                "type": "text",
                "notNull": true,
                "default": "''::text"
            },
            {
                "table": "schedule",
                "column": "kind",
                "type": "text",
                "notNull": true,
                "default": "'cron'::text"
            },
            {
                "table": "schedule",
                "column": "last_job_id",
                "type": "uuid",
                "notNull": false,
                "default": null
            },
            {
                "table": "schedule",
                "column": "name",
                "type": "text",
                "notNull": true,
                "default": null
            },
            {
                "table": "schedule",
                "column": "options",
                "type": "jsonb",
                "notNull": false,
                "default": null
            },
            {
                "table": "schedule",
                "column": "timezone",
                "type": "text",
                "notNull": false,
                "default": "'UTC'::text"
            },
            {
                "table": "schedule",
                "column": "updated_on",
                "type": "timestamp with time zone",
                "notNull": true,
                "default": "now()"
            },
            {
                "table": "subscription",
                "column": "created_on",
                "type": "timestamp with time zone",
                "notNull": true,
                "default": "now()"
            },
            {
                "table": "subscription",
                "column": "event",
                "type": "text",
                "notNull": true,
                "default": null
            },
            {
                "table": "subscription",
                "column": "name",
                "type": "text",
                "notNull": true,
                "default": null
            },
            {
                "table": "subscription",
                "column": "updated_on",
                "type": "timestamp with time zone",
                "notNull": true,
                "default": "now()"
            },
            {
                "table": "version",
                "column": "bam_on",
                "type": "timestamp with time zone",
                "notNull": false,
                "default": null
            },
            {
                "table": "version",
                "column": "cron_on",
                "type": "timestamp with time zone",
                "notNull": false,
                "default": null
            },
            {
                "table": "version",
                "column": "flow_on",
                "type": "timestamp with time zone",
                "notNull": false,
                "default": null
            },
            {
                "table": "version",
                "column": "monitor_backoff_on",
                "type": "timestamp with time zone",
                "notNull": false,
                "default": null
            },
            {
                "table": "version",
                "column": "reindex_on",
                "type": "timestamp with time zone",
                "notNull": false,
                "default": null
            },
            {
                "table": "version",
                "column": "version",
                "type": "integer",
                "notNull": true,
                "default": null
            },
            {
                "table": "warning",
                "column": "created_on",
                "type": "timestamp with time zone",
                "notNull": true,
                "default": "now()"
            },
            {
                "table": "warning",
                "column": "data",
                "type": "jsonb",
                "notNull": false,
                "default": null
            },
            {
                "table": "warning",
                "column": "id",
                "type": "uuid",
                "notNull": true,
                "default": "gen_random_uuid()"
            },
            {
                "table": "warning",
                "column": "message",
                "type": "text",
                "notNull": true,
                "default": null
            },
            {
                "table": "warning",
                "column": "type",
                "type": "text",
                "notNull": true,
                "default": null
            }
        ],
        "constraints": [
            {
                "table": "bam",
                "def": "PRIMARY KEY (id)"
            },
            {
                "table": "job_dependency",
                "def": "PRIMARY KEY (child_name, child_id, parent_name, parent_id)"
            },
            {
                "table": "job",
                "def": "CHECK ((NOT ((policy = 'key_strict_fifo'::text) AND (singleton_key IS NULL))))"
            },
            {
                "table": "job",
                "def": "FOREIGN KEY (dead_letter) REFERENCES {{schema}}.queue(name) ON DELETE RESTRICT DEFERRABLE INITIALLY DEFERRED"
            },
            {
                "table": "job",
                "def": "FOREIGN KEY (name) REFERENCES {{schema}}.queue(name) ON DELETE RESTRICT DEFERRABLE INITIALLY DEFERRED"
            },
            {
                "table": "job",
                "def": "PRIMARY KEY (name, id)"
            },
            {
                "table": "queue_stats",
                "def": "PRIMARY KEY (id)"
            },
            {
                "table": "queue",
                "def": "CHECK ((dead_letter IS DISTINCT FROM name))"
            },
            {
                "table": "queue",
                "def": "FOREIGN KEY (dead_letter) REFERENCES {{schema}}.queue(name)"
            },
            {
                "table": "queue",
                "def": "PRIMARY KEY (name)"
            },
            {
                "table": "schedule",
                "def": "CHECK ((kind = ANY (ARRAY['cron'::text, 'rrule'::text])))"
            },
            {
                "table": "schedule",
                "def": "FOREIGN KEY (name) REFERENCES {{schema}}.queue(name) ON DELETE CASCADE"
            },
            {
                "table": "schedule",
                "def": "PRIMARY KEY (name, key)"
            },
            {
                "table": "subscription",
                "def": "FOREIGN KEY (name) REFERENCES {{schema}}.queue(name) ON DELETE CASCADE"
            },
            {
                "table": "subscription",
                "def": "PRIMARY KEY (event, name)"
            },
            {
                "table": "version",
                "def": "PRIMARY KEY (version)"
            },
            {
                "table": "warning",
                "def": "PRIMARY KEY (id)"
            }
        ],
        "indexes": [
            {
                "name": "job_dep_parent_idx",
                "table": "job_dependency",
                "valid": true,
                "def": "CREATE INDEX job_dep_parent_idx ON {{schema}}.job_dependency USING btree (parent_name, parent_id)"
            },
            {
                "name": "job_i1",
                "table": "job",
                "valid": true,
                "def": "CREATE UNIQUE INDEX job_i1 ON {{schema}}.job USING btree (name, COALESCE(singleton_key, ''::text)) WHERE ((state = 'created'::{{schema}}.job_state) AND (policy = 'short'::text))"
            },
            {
                "name": "job_i10",
                "table": "job",
                "valid": true,
                "def": "CREATE INDEX job_i10 ON {{schema}}.job USING btree (name, singleton_key, state DESC, created_on, id) INCLUDE (start_after) WHERE ((state < 'active'::{{schema}}.job_state) AND (NOT blocked) AND (policy = 'key_strict_fifo'::text))"
            },
            {
                "name": "job_i11",
                "table": "job",
                "valid": true,
                "def": "CREATE INDEX job_i11 ON {{schema}}.job USING btree (name, priority DESC, created_on, start_after) WHERE ((state < 'active'::{{schema}}.job_state) AND (NOT blocked))"
            },
            {
                "name": "job_i2",
                "table": "job",
                "valid": true,
                "def": "CREATE UNIQUE INDEX job_i2 ON {{schema}}.job USING btree (name, COALESCE(singleton_key, ''::text)) WHERE ((state = 'active'::{{schema}}.job_state) AND (policy = 'singleton'::text))"
            },
            {
                "name": "job_i3",
                "table": "job",
                "valid": true,
                "def": "CREATE UNIQUE INDEX job_i3 ON {{schema}}.job USING btree (name, state, COALESCE(singleton_key, ''::text)) WHERE ((state <= 'active'::{{schema}}.job_state) AND (policy = 'stately'::text))"
            },
            {
                "name": "job_i4",
                "table": "job",
                "valid": true,
                "def": "CREATE UNIQUE INDEX job_i4 ON {{schema}}.job USING btree (name, singleton_on, COALESCE(singleton_key, ''::text)) WHERE ((state <> 'cancelled'::{{schema}}.job_state) AND (singleton_on IS NOT NULL))"
            },
            {
                "name": "job_i6",
                "table": "job",
                "valid": true,
                "def": "CREATE UNIQUE INDEX job_i6 ON {{schema}}.job USING btree (name, COALESCE(singleton_key, ''::text)) WHERE ((state <= 'active'::{{schema}}.job_state) AND (policy = 'exclusive'::text))"
            },
            {
                "name": "job_i7",
                "table": "job",
                "valid": true,
                "def": "CREATE INDEX job_i7 ON {{schema}}.job USING btree (name, group_id) WHERE ((state = 'active'::{{schema}}.job_state) AND (group_id IS NOT NULL))"
            },
            {
                "name": "job_i8",
                "table": "job",
                "valid": true,
                "def": "CREATE UNIQUE INDEX job_i8 ON {{schema}}.job USING btree (name, singleton_key) WHERE ((state = ANY (ARRAY['active'::{{schema}}.job_state, 'retry'::{{schema}}.job_state, 'failed'::{{schema}}.job_state])) AND (policy = 'key_strict_fifo'::text))"
            },
            {
                "name": "job_i9",
                "table": "job",
                "valid": true,
                "def": "CREATE INDEX job_i9 ON {{schema}}.job USING btree (name, id) WHERE (blocking AND (state = 'completed'::{{schema}}.job_state))"
            },
            {
                "name": "queue_stats_i1",
                "table": "queue_stats",
                "valid": true,
                "def": "CREATE INDEX queue_stats_i1 ON {{schema}}.queue_stats USING btree (name, captured_on DESC) INCLUDE (deferred_count, queued_count, ready_count, active_count, failed_count, total_count)"
            },
            {
                "name": "warning_i1",
                "table": "warning",
                "valid": true,
                "def": "CREATE INDEX warning_i1 ON {{schema}}.warning USING btree (created_on DESC)"
            }
        ],
        "functions": [
            {
                "name": "create_queue",
                "def": "CREATE OR REPLACE FUNCTION {{schema}}.create_queue(queue_name text, options jsonb)\n RETURNS void\n LANGUAGE plpgsql\nAS $function$\n      BEGIN\n        INSERT INTO {{schema}}.queue (\n          name,\n          policy,\n          retry_limit,\n          retry_delay,\n          retry_backoff,\n          retry_delay_max,\n          expire_seconds,\n          retention_seconds,\n          deletion_seconds,\n          warning_queued,\n          dead_letter,\n          partition,\n          table_name,\n          heartbeat_seconds,\n          created_on,\n          updated_on\n        )\n        VALUES (\n          queue_name,\n          options->>'policy',\n          COALESCE((options->>'retryLimit')::int, 2),\n          COALESCE((options->>'retryDelay')::int, 0),\n          COALESCE((options->>'retryBackoff')::bool, false),\n          (options->>'retryDelayMax')::int,\n          COALESCE((options->>'expireInSeconds')::int, 900),\n          COALESCE((options->>'retentionSeconds')::int, 1209600),\n          COALESCE((options->>'deleteAfterSeconds')::int, 604800),\n          COALESCE((options->>'warningQueueSize')::int, 0),\n          options->>'deadLetter',\n          false,\n          'job',\n          (options->>'heartbeatSeconds')::int,\n          {{schema}}.job_now(),\n          {{schema}}.job_now()\n        )\n        ON CONFLICT DO NOTHING;\n      END;\n      $function$\n"
            },
            {
                "name": "delete_queue",
                "def": "CREATE OR REPLACE FUNCTION {{schema}}.delete_queue(queue_name text)\n RETURNS void\n LANGUAGE plpgsql\nAS $function$\n    BEGIN\n      DELETE FROM {{schema}}.job WHERE name = queue_name;\n      DELETE FROM {{schema}}.queue WHERE name = queue_name;\n    END;\n    $function$\n"
            },
            {
                "name": "job_now",
                "def": "CREATE OR REPLACE FUNCTION {{schema}}.job_now()\n RETURNS timestamp with time zone\n LANGUAGE sql\n STABLE\nAS $function$\n      SELECT pg_catalog.now();\n    $function$\n"
            }
        ],
        "enum": [
            "created",
            "retry",
            "active",
            "completed",
            "cancelled",
            "failed"
        ]
    }
}
