pg-boss 12.35.1 → 12.37.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/schema.json CHANGED
@@ -1,10 +1,11 @@
1
1
  {
2
2
  "_generated": "Generated by scripts/gen-manifest.ts — do not edit by hand. Run `npm run gen:manifest`.",
3
- "version": 43,
3
+ "version": 45,
4
4
  "schemaToken": "{{schema}}",
5
5
  "partitioned": {
6
6
  "tables": [
7
7
  "bam",
8
+ "instance",
8
9
  "job",
9
10
  "job_common",
10
11
  "job_dependency",
@@ -93,6 +94,181 @@
93
94
  "notNull": true,
94
95
  "default": null
95
96
  },
97
+ {
98
+ "table": "instance",
99
+ "column": "application_name",
100
+ "type": "text",
101
+ "notNull": false,
102
+ "default": null
103
+ },
104
+ {
105
+ "table": "instance",
106
+ "column": "config",
107
+ "type": "jsonb",
108
+ "notNull": true,
109
+ "default": "'{}'::jsonb"
110
+ },
111
+ {
112
+ "table": "instance",
113
+ "column": "crash_restarts",
114
+ "type": "integer",
115
+ "notNull": true,
116
+ "default": "0"
117
+ },
118
+ {
119
+ "table": "instance",
120
+ "column": "crash_restarts_since",
121
+ "type": "timestamp with time zone",
122
+ "notNull": false,
123
+ "default": null
124
+ },
125
+ {
126
+ "table": "instance",
127
+ "column": "heartbeat_on",
128
+ "type": "timestamp with time zone",
129
+ "notNull": true,
130
+ "default": "now()"
131
+ },
132
+ {
133
+ "table": "instance",
134
+ "column": "heartbeat_seconds",
135
+ "type": "integer",
136
+ "notNull": true,
137
+ "default": null
138
+ },
139
+ {
140
+ "table": "instance",
141
+ "column": "host",
142
+ "type": "text",
143
+ "notNull": true,
144
+ "default": null
145
+ },
146
+ {
147
+ "table": "instance",
148
+ "column": "id",
149
+ "type": "uuid",
150
+ "notNull": true,
151
+ "default": null
152
+ },
153
+ {
154
+ "table": "instance",
155
+ "column": "metrics",
156
+ "type": "jsonb",
157
+ "notNull": false,
158
+ "default": null
159
+ },
160
+ {
161
+ "table": "instance",
162
+ "column": "migrate",
163
+ "type": "boolean",
164
+ "notNull": true,
165
+ "default": null
166
+ },
167
+ {
168
+ "table": "instance",
169
+ "column": "name",
170
+ "type": "text",
171
+ "notNull": false,
172
+ "default": null
173
+ },
174
+ {
175
+ "table": "instance",
176
+ "column": "node_version",
177
+ "type": "text",
178
+ "notNull": true,
179
+ "default": null
180
+ },
181
+ {
182
+ "table": "instance",
183
+ "column": "persist_queue_stats",
184
+ "type": "boolean",
185
+ "notNull": true,
186
+ "default": null
187
+ },
188
+ {
189
+ "table": "instance",
190
+ "column": "persist_warnings",
191
+ "type": "boolean",
192
+ "notNull": true,
193
+ "default": null
194
+ },
195
+ {
196
+ "table": "instance",
197
+ "column": "pid",
198
+ "type": "integer",
199
+ "notNull": true,
200
+ "default": null
201
+ },
202
+ {
203
+ "table": "instance",
204
+ "column": "pool_idle",
205
+ "type": "integer",
206
+ "notNull": false,
207
+ "default": null
208
+ },
209
+ {
210
+ "table": "instance",
211
+ "column": "pool_max",
212
+ "type": "integer",
213
+ "notNull": false,
214
+ "default": null
215
+ },
216
+ {
217
+ "table": "instance",
218
+ "column": "pool_total",
219
+ "type": "integer",
220
+ "notNull": false,
221
+ "default": null
222
+ },
223
+ {
224
+ "table": "instance",
225
+ "column": "pool_waiting",
226
+ "type": "integer",
227
+ "notNull": false,
228
+ "default": null
229
+ },
230
+ {
231
+ "table": "instance",
232
+ "column": "schedule",
233
+ "type": "boolean",
234
+ "notNull": true,
235
+ "default": null
236
+ },
237
+ {
238
+ "table": "instance",
239
+ "column": "started_on",
240
+ "type": "timestamp with time zone",
241
+ "notNull": true,
242
+ "default": "now()"
243
+ },
244
+ {
245
+ "table": "instance",
246
+ "column": "stopped_on",
247
+ "type": "timestamp with time zone",
248
+ "notNull": false,
249
+ "default": null
250
+ },
251
+ {
252
+ "table": "instance",
253
+ "column": "supervise",
254
+ "type": "boolean",
255
+ "notNull": true,
256
+ "default": null
257
+ },
258
+ {
259
+ "table": "instance",
260
+ "column": "version",
261
+ "type": "text",
262
+ "notNull": true,
263
+ "default": null
264
+ },
265
+ {
266
+ "table": "instance",
267
+ "column": "workers",
268
+ "type": "jsonb",
269
+ "notNull": true,
270
+ "default": "'[]'::jsonb"
271
+ },
96
272
  {
97
273
  "table": "job_common",
98
274
  "column": "blocked",
@@ -338,6 +514,20 @@
338
514
  "notNull": true,
339
515
  "default": "'created'::{{schema}}.job_state"
340
516
  },
517
+ {
518
+ "table": "job_common",
519
+ "column": "trace_context",
520
+ "type": "jsonb",
521
+ "notNull": false,
522
+ "default": null
523
+ },
524
+ {
525
+ "table": "job_common",
526
+ "column": "upsert_by_key",
527
+ "type": "boolean",
528
+ "notNull": false,
529
+ "default": null
530
+ },
341
531
  {
342
532
  "table": "job_dependency",
343
533
  "column": "child_id",
@@ -611,6 +801,20 @@
611
801
  "notNull": true,
612
802
  "default": "'created'::{{schema}}.job_state"
613
803
  },
804
+ {
805
+ "table": "job",
806
+ "column": "trace_context",
807
+ "type": "jsonb",
808
+ "notNull": false,
809
+ "default": null
810
+ },
811
+ {
812
+ "table": "job",
813
+ "column": "upsert_by_key",
814
+ "type": "boolean",
815
+ "notNull": false,
816
+ "default": null
817
+ },
614
818
  {
615
819
  "table": "queue_stats",
616
820
  "column": "active_count",
@@ -702,6 +906,20 @@
702
906
  "notNull": true,
703
907
  "default": "0"
704
908
  },
909
+ {
910
+ "table": "queue_stats",
911
+ "column": "ready_oldest_seconds",
912
+ "type": "integer",
913
+ "notNull": false,
914
+ "default": null
915
+ },
916
+ {
917
+ "table": "queue_stats",
918
+ "column": "run_bins",
919
+ "type": "integer[]",
920
+ "notNull": false,
921
+ "default": null
922
+ },
705
923
  {
706
924
  "table": "queue_stats",
707
925
  "column": "total_count",
@@ -709,6 +927,13 @@
709
927
  "notNull": true,
710
928
  "default": "0"
711
929
  },
930
+ {
931
+ "table": "queue_stats",
932
+ "column": "wait_bins",
933
+ "type": "integer[]",
934
+ "notNull": false,
935
+ "default": null
936
+ },
712
937
  {
713
938
  "table": "queue",
714
939
  "column": "active_count",
@@ -716,6 +941,13 @@
716
941
  "notNull": true,
717
942
  "default": "0"
718
943
  },
944
+ {
945
+ "table": "queue",
946
+ "column": "blocked_count",
947
+ "type": "integer",
948
+ "notNull": true,
949
+ "default": "0"
950
+ },
719
951
  {
720
952
  "table": "queue",
721
953
  "column": "completed_delta",
@@ -870,6 +1102,13 @@
870
1102
  "notNull": true,
871
1103
  "default": "'{}'::integer[]"
872
1104
  },
1105
+ {
1106
+ "table": "queue",
1107
+ "column": "ready_oldest_seconds",
1108
+ "type": "integer",
1109
+ "notNull": false,
1110
+ "default": null
1111
+ },
873
1112
  {
874
1113
  "table": "queue",
875
1114
  "column": "retention_seconds",
@@ -905,6 +1144,13 @@
905
1144
  "notNull": true,
906
1145
  "default": null
907
1146
  },
1147
+ {
1148
+ "table": "queue",
1149
+ "column": "run_bins",
1150
+ "type": "integer[]",
1151
+ "notNull": false,
1152
+ "default": null
1153
+ },
908
1154
  {
909
1155
  "table": "queue",
910
1156
  "column": "singletons_active",
@@ -933,6 +1179,13 @@
933
1179
  "notNull": true,
934
1180
  "default": "now()"
935
1181
  },
1182
+ {
1183
+ "table": "queue",
1184
+ "column": "wait_bins",
1185
+ "type": "integer[]",
1186
+ "notNull": false,
1187
+ "default": null
1188
+ },
936
1189
  {
937
1190
  "table": "queue",
938
1191
  "column": "warning_queued",
@@ -1121,6 +1374,10 @@
1121
1374
  "table": "bam",
1122
1375
  "def": "PRIMARY KEY (id)"
1123
1376
  },
1377
+ {
1378
+ "table": "instance",
1379
+ "def": "PRIMARY KEY (id)"
1380
+ },
1124
1381
  {
1125
1382
  "table": "job_common",
1126
1383
  "def": "CHECK ((NOT ((policy = 'key_strict_fifo'::text) AND (singleton_key IS NULL))))"
@@ -1215,6 +1472,12 @@
1215
1472
  "valid": true,
1216
1473
  "def": "CREATE INDEX job_common_i12 ON {{schema}}.job_common USING btree (source_root_id) WHERE (source_root_id IS NOT NULL)"
1217
1474
  },
1475
+ {
1476
+ "name": "job_common_i13",
1477
+ "table": "job_common",
1478
+ "valid": true,
1479
+ "def": "CREATE UNIQUE INDEX job_common_i13 ON {{schema}}.job_common USING btree (name, singleton_key) WHERE ((state = 'created'::{{schema}}.job_state) AND upsert_by_key)"
1480
+ },
1218
1481
  {
1219
1482
  "name": "job_common_i2",
1220
1483
  "table": "job_common",
@@ -1279,7 +1542,7 @@
1279
1542
  "functions": [
1280
1543
  {
1281
1544
  "name": "create_queue",
1282
- "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 EXECUTE {{schema}}.job_table_format($cmd$CREATE INDEX job_i12 ON {{schema}}.job (source_root_id) WHERE source_root_id IS NOT NULL$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"
1545
+ "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 EXECUTE {{schema}}.job_table_format($cmd$CREATE INDEX job_i12 ON {{schema}}.job (source_root_id) WHERE source_root_id IS NOT NULL$cmd$, tablename);\n EXECUTE {{schema}}.job_table_format($cmd$CREATE UNIQUE INDEX job_i13 ON {{schema}}.job (name, singleton_key) WHERE state = 'created' AND upsert_by_key$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"
1283
1546
  },
1284
1547
  {
1285
1548
  "name": "delete_queue",
@@ -1314,6 +1577,7 @@
1314
1577
  "nonPartitioned": {
1315
1578
  "tables": [
1316
1579
  "bam",
1580
+ "instance",
1317
1581
  "job",
1318
1582
  "job_dependency",
1319
1583
  "queue",
@@ -1401,6 +1665,181 @@
1401
1665
  "notNull": true,
1402
1666
  "default": null
1403
1667
  },
1668
+ {
1669
+ "table": "instance",
1670
+ "column": "application_name",
1671
+ "type": "text",
1672
+ "notNull": false,
1673
+ "default": null
1674
+ },
1675
+ {
1676
+ "table": "instance",
1677
+ "column": "config",
1678
+ "type": "jsonb",
1679
+ "notNull": true,
1680
+ "default": "'{}'::jsonb"
1681
+ },
1682
+ {
1683
+ "table": "instance",
1684
+ "column": "crash_restarts",
1685
+ "type": "integer",
1686
+ "notNull": true,
1687
+ "default": "0"
1688
+ },
1689
+ {
1690
+ "table": "instance",
1691
+ "column": "crash_restarts_since",
1692
+ "type": "timestamp with time zone",
1693
+ "notNull": false,
1694
+ "default": null
1695
+ },
1696
+ {
1697
+ "table": "instance",
1698
+ "column": "heartbeat_on",
1699
+ "type": "timestamp with time zone",
1700
+ "notNull": true,
1701
+ "default": "now()"
1702
+ },
1703
+ {
1704
+ "table": "instance",
1705
+ "column": "heartbeat_seconds",
1706
+ "type": "integer",
1707
+ "notNull": true,
1708
+ "default": null
1709
+ },
1710
+ {
1711
+ "table": "instance",
1712
+ "column": "host",
1713
+ "type": "text",
1714
+ "notNull": true,
1715
+ "default": null
1716
+ },
1717
+ {
1718
+ "table": "instance",
1719
+ "column": "id",
1720
+ "type": "uuid",
1721
+ "notNull": true,
1722
+ "default": null
1723
+ },
1724
+ {
1725
+ "table": "instance",
1726
+ "column": "metrics",
1727
+ "type": "jsonb",
1728
+ "notNull": false,
1729
+ "default": null
1730
+ },
1731
+ {
1732
+ "table": "instance",
1733
+ "column": "migrate",
1734
+ "type": "boolean",
1735
+ "notNull": true,
1736
+ "default": null
1737
+ },
1738
+ {
1739
+ "table": "instance",
1740
+ "column": "name",
1741
+ "type": "text",
1742
+ "notNull": false,
1743
+ "default": null
1744
+ },
1745
+ {
1746
+ "table": "instance",
1747
+ "column": "node_version",
1748
+ "type": "text",
1749
+ "notNull": true,
1750
+ "default": null
1751
+ },
1752
+ {
1753
+ "table": "instance",
1754
+ "column": "persist_queue_stats",
1755
+ "type": "boolean",
1756
+ "notNull": true,
1757
+ "default": null
1758
+ },
1759
+ {
1760
+ "table": "instance",
1761
+ "column": "persist_warnings",
1762
+ "type": "boolean",
1763
+ "notNull": true,
1764
+ "default": null
1765
+ },
1766
+ {
1767
+ "table": "instance",
1768
+ "column": "pid",
1769
+ "type": "integer",
1770
+ "notNull": true,
1771
+ "default": null
1772
+ },
1773
+ {
1774
+ "table": "instance",
1775
+ "column": "pool_idle",
1776
+ "type": "integer",
1777
+ "notNull": false,
1778
+ "default": null
1779
+ },
1780
+ {
1781
+ "table": "instance",
1782
+ "column": "pool_max",
1783
+ "type": "integer",
1784
+ "notNull": false,
1785
+ "default": null
1786
+ },
1787
+ {
1788
+ "table": "instance",
1789
+ "column": "pool_total",
1790
+ "type": "integer",
1791
+ "notNull": false,
1792
+ "default": null
1793
+ },
1794
+ {
1795
+ "table": "instance",
1796
+ "column": "pool_waiting",
1797
+ "type": "integer",
1798
+ "notNull": false,
1799
+ "default": null
1800
+ },
1801
+ {
1802
+ "table": "instance",
1803
+ "column": "schedule",
1804
+ "type": "boolean",
1805
+ "notNull": true,
1806
+ "default": null
1807
+ },
1808
+ {
1809
+ "table": "instance",
1810
+ "column": "started_on",
1811
+ "type": "timestamp with time zone",
1812
+ "notNull": true,
1813
+ "default": "now()"
1814
+ },
1815
+ {
1816
+ "table": "instance",
1817
+ "column": "stopped_on",
1818
+ "type": "timestamp with time zone",
1819
+ "notNull": false,
1820
+ "default": null
1821
+ },
1822
+ {
1823
+ "table": "instance",
1824
+ "column": "supervise",
1825
+ "type": "boolean",
1826
+ "notNull": true,
1827
+ "default": null
1828
+ },
1829
+ {
1830
+ "table": "instance",
1831
+ "column": "version",
1832
+ "type": "text",
1833
+ "notNull": true,
1834
+ "default": null
1835
+ },
1836
+ {
1837
+ "table": "instance",
1838
+ "column": "workers",
1839
+ "type": "jsonb",
1840
+ "notNull": true,
1841
+ "default": "'[]'::jsonb"
1842
+ },
1404
1843
  {
1405
1844
  "table": "job_dependency",
1406
1845
  "column": "child_id",
@@ -1674,6 +2113,20 @@
1674
2113
  "notNull": true,
1675
2114
  "default": "'created'::{{schema}}.job_state"
1676
2115
  },
2116
+ {
2117
+ "table": "job",
2118
+ "column": "trace_context",
2119
+ "type": "jsonb",
2120
+ "notNull": false,
2121
+ "default": null
2122
+ },
2123
+ {
2124
+ "table": "job",
2125
+ "column": "upsert_by_key",
2126
+ "type": "boolean",
2127
+ "notNull": false,
2128
+ "default": null
2129
+ },
1677
2130
  {
1678
2131
  "table": "queue_stats",
1679
2132
  "column": "active_count",
@@ -1765,6 +2218,20 @@
1765
2218
  "notNull": true,
1766
2219
  "default": "0"
1767
2220
  },
2221
+ {
2222
+ "table": "queue_stats",
2223
+ "column": "ready_oldest_seconds",
2224
+ "type": "integer",
2225
+ "notNull": false,
2226
+ "default": null
2227
+ },
2228
+ {
2229
+ "table": "queue_stats",
2230
+ "column": "run_bins",
2231
+ "type": "integer[]",
2232
+ "notNull": false,
2233
+ "default": null
2234
+ },
1768
2235
  {
1769
2236
  "table": "queue_stats",
1770
2237
  "column": "total_count",
@@ -1772,6 +2239,13 @@
1772
2239
  "notNull": true,
1773
2240
  "default": "0"
1774
2241
  },
2242
+ {
2243
+ "table": "queue_stats",
2244
+ "column": "wait_bins",
2245
+ "type": "integer[]",
2246
+ "notNull": false,
2247
+ "default": null
2248
+ },
1775
2249
  {
1776
2250
  "table": "queue",
1777
2251
  "column": "active_count",
@@ -1779,6 +2253,13 @@
1779
2253
  "notNull": true,
1780
2254
  "default": "0"
1781
2255
  },
2256
+ {
2257
+ "table": "queue",
2258
+ "column": "blocked_count",
2259
+ "type": "integer",
2260
+ "notNull": true,
2261
+ "default": "0"
2262
+ },
1782
2263
  {
1783
2264
  "table": "queue",
1784
2265
  "column": "completed_delta",
@@ -1933,6 +2414,13 @@
1933
2414
  "notNull": true,
1934
2415
  "default": "'{}'::integer[]"
1935
2416
  },
2417
+ {
2418
+ "table": "queue",
2419
+ "column": "ready_oldest_seconds",
2420
+ "type": "integer",
2421
+ "notNull": false,
2422
+ "default": null
2423
+ },
1936
2424
  {
1937
2425
  "table": "queue",
1938
2426
  "column": "retention_seconds",
@@ -1968,6 +2456,13 @@
1968
2456
  "notNull": true,
1969
2457
  "default": null
1970
2458
  },
2459
+ {
2460
+ "table": "queue",
2461
+ "column": "run_bins",
2462
+ "type": "integer[]",
2463
+ "notNull": false,
2464
+ "default": null
2465
+ },
1971
2466
  {
1972
2467
  "table": "queue",
1973
2468
  "column": "singletons_active",
@@ -1996,6 +2491,13 @@
1996
2491
  "notNull": true,
1997
2492
  "default": "now()"
1998
2493
  },
2494
+ {
2495
+ "table": "queue",
2496
+ "column": "wait_bins",
2497
+ "type": "integer[]",
2498
+ "notNull": false,
2499
+ "default": null
2500
+ },
1999
2501
  {
2000
2502
  "table": "queue",
2001
2503
  "column": "warning_queued",
@@ -2184,6 +2686,10 @@
2184
2686
  "table": "bam",
2185
2687
  "def": "PRIMARY KEY (id)"
2186
2688
  },
2689
+ {
2690
+ "table": "instance",
2691
+ "def": "PRIMARY KEY (id)"
2692
+ },
2187
2693
  {
2188
2694
  "table": "job_dependency",
2189
2695
  "def": "PRIMARY KEY (child_name, child_id, parent_name, parent_id)"
@@ -2280,6 +2786,12 @@
2280
2786
  "valid": true,
2281
2787
  "def": "CREATE INDEX job_i12 ON {{schema}}.job USING btree (source_root_id) WHERE (source_root_id IS NOT NULL)"
2282
2788
  },
2789
+ {
2790
+ "name": "job_i13",
2791
+ "table": "job",
2792
+ "valid": true,
2793
+ "def": "CREATE UNIQUE INDEX job_i13 ON {{schema}}.job USING btree (name, singleton_key) WHERE ((state = 'created'::{{schema}}.job_state) AND upsert_by_key)"
2794
+ },
2283
2795
  {
2284
2796
  "name": "job_i2",
2285
2797
  "table": "job",