The best way to control Claude Code, Codex and more from any computer or phone
Drop redundant Relay user indexes (#4648)
Co-authored-by: codex <codex@users.noreply.github.com>
Julius Marminge committed
Jul 27, 2026 at 17:03 UTC
d2d40b6c1aa2464b38357d52b7f991cfb422a669
3 files changed
+1506
-2
infra/relay/migrations/postgres/20260727144838_migration/migration.sql
new
+3
@@ -0,0 +1,3 @@
1
+DROP INDEX "idx_relay_live_activities_user";
2
+--> statement-breakpoint
3
+DROP INDEX "idx_relay_mobile_devices_user";
infra/relay/migrations/postgres/20260727144838_migration/snapshot.json
new
+1503
@@ -0,0 +1,1503 @@
1
+{
2
+ "dialect": "postgres",
3
+ "id": "2374caff-40bf-423c-9255-55e76dddbc2a",
4
+ "prevIds": ["33575636-77b2-4756-8658-687165e6c9ff"],
5
+ "version": "8",
6
+ "ddl": [
7
+ {
8
+ "isRlsEnabled": false,
9
+ "name": "relay_agent_activity_rows",
10
+ "entityType": "tables",
11
+ "schema": "public"
12
+ },
13
+ {
14
+ "isRlsEnabled": false,
15
+ "name": "relay_delivery_attempts",
16
+ "entityType": "tables",
17
+ "schema": "public"
18
+ },
19
+ {
20
+ "isRlsEnabled": false,
21
+ "name": "relay_dpop_proofs",
22
+ "entityType": "tables",
23
+ "schema": "public"
24
+ },
25
+ {
26
+ "isRlsEnabled": false,
27
+ "name": "relay_environment_credentials",
28
+ "entityType": "tables",
29
+ "schema": "public"
30
+ },
31
+ {
32
+ "isRlsEnabled": false,
33
+ "name": "relay_environment_links",
34
+ "entityType": "tables",
35
+ "schema": "public"
36
+ },
37
+ {
38
+ "isRlsEnabled": false,
39
+ "name": "relay_live_activities",
40
+ "entityType": "tables",
41
+ "schema": "public"
42
+ },
43
+ {
44
+ "isRlsEnabled": false,
45
+ "name": "relay_managed_endpoint_allocations",
46
+ "entityType": "tables",
47
+ "schema": "public"
48
+ },
49
+ {
50
+ "isRlsEnabled": false,
51
+ "name": "relay_managed_tunnel_limits",
52
+ "entityType": "tables",
53
+ "schema": "public"
54
+ },
55
+ {
56
+ "isRlsEnabled": false,
57
+ "name": "relay_mobile_devices",
58
+ "entityType": "tables",
59
+ "schema": "public"
60
+ },
61
+ {
62
+ "type": "varchar(191)",
63
+ "typeSchema": null,
64
+ "notNull": true,
65
+ "dimensions": 0,
66
+ "default": null,
67
+ "generated": null,
68
+ "identity": null,
69
+ "name": "environment_id",
70
+ "entityType": "columns",
71
+ "schema": "public",
72
+ "table": "relay_agent_activity_rows"
73
+ },
74
+ {
75
+ "type": "text",
76
+ "typeSchema": null,
77
+ "notNull": true,
78
+ "dimensions": 0,
79
+ "default": null,
80
+ "generated": null,
81
+ "identity": null,
82
+ "name": "environment_public_key",
83
+ "entityType": "columns",
84
+ "schema": "public",
85
+ "table": "relay_agent_activity_rows"
86
+ },
87
+ {
88
+ "type": "varchar(191)",
89
+ "typeSchema": null,
90
+ "notNull": true,
91
+ "dimensions": 0,
92
+ "default": null,
93
+ "generated": null,
94
+ "identity": null,
95
+ "name": "thread_id",
96
+ "entityType": "columns",
97
+ "schema": "public",
98
+ "table": "relay_agent_activity_rows"
99
+ },
100
+ {
101
+ "type": "jsonb",
102
+ "typeSchema": null,
103
+ "notNull": true,
104
+ "dimensions": 0,
105
+ "default": null,
106
+ "generated": null,
107
+ "identity": null,
108
+ "name": "state_json",
109
+ "entityType": "columns",
110
+ "schema": "public",
111
+ "table": "relay_agent_activity_rows"
112
+ },
113
+ {
114
+ "type": "varchar(64)",
115
+ "typeSchema": null,
116
+ "notNull": true,
117
+ "dimensions": 0,
118
+ "default": null,
119
+ "generated": null,
120
+ "identity": null,
121
+ "name": "updated_at",
122
+ "entityType": "columns",
123
+ "schema": "public",
124
+ "table": "relay_agent_activity_rows"
125
+ },
126
+ {
127
+ "type": "varchar(64)",
128
+ "typeSchema": null,
129
+ "notNull": true,
130
+ "dimensions": 0,
131
+ "default": null,
132
+ "generated": null,
133
+ "identity": null,
134
+ "name": "created_at",
135
+ "entityType": "columns",
136
+ "schema": "public",
137
+ "table": "relay_agent_activity_rows"
138
+ },
139
+ {
140
+ "type": "varchar(36)",
141
+ "typeSchema": null,
142
+ "notNull": true,
143
+ "dimensions": 0,
144
+ "default": null,
145
+ "generated": null,
146
+ "identity": null,
147
+ "name": "id",
148
+ "entityType": "columns",
149
+ "schema": "public",
150
+ "table": "relay_delivery_attempts"
151
+ },
152
+ {
153
+ "type": "varchar(64)",
154
+ "typeSchema": null,
155
+ "notNull": true,
156
+ "dimensions": 0,
157
+ "default": null,
158
+ "generated": null,
159
+ "identity": null,
160
+ "name": "created_at",
161
+ "entityType": "columns",
162
+ "schema": "public",
163
+ "table": "relay_delivery_attempts"
164
+ },
165
+ {
166
+ "type": "varchar(255)",
167
+ "typeSchema": null,
168
+ "notNull": false,
169
+ "dimensions": 0,
170
+ "default": null,
171
+ "generated": null,
172
+ "identity": null,
173
+ "name": "user_id",
174
+ "entityType": "columns",
175
+ "schema": "public",
176
+ "table": "relay_delivery_attempts"
177
+ },
178
+ {
179
+ "type": "varchar(191)",
180
+ "typeSchema": null,
181
+ "notNull": false,
182
+ "dimensions": 0,
183
+ "default": null,
184
+ "generated": null,
185
+ "identity": null,
186
+ "name": "environment_id",
187
+ "entityType": "columns",
188
+ "schema": "public",
189
+ "table": "relay_delivery_attempts"
190
+ },
191
+ {
192
+ "type": "varchar(191)",
193
+ "typeSchema": null,
194
+ "notNull": false,
195
+ "dimensions": 0,
196
+ "default": null,
197
+ "generated": null,
198
+ "identity": null,
199
+ "name": "thread_id",
200
+ "entityType": "columns",
201
+ "schema": "public",
202
+ "table": "relay_delivery_attempts"
203
+ },
204
+ {
205
+ "type": "varchar(255)",
206
+ "typeSchema": null,
207
+ "notNull": false,
208
+ "dimensions": 0,
209
+ "default": null,
210
+ "generated": null,
211
+ "identity": null,
212
+ "name": "device_id",
213
+ "entityType": "columns",
214
+ "schema": "public",
215
+ "table": "relay_delivery_attempts"
216
+ },
217
+ {
218
+ "type": "varchar(64)",
219
+ "typeSchema": null,
220
+ "notNull": true,
221
+ "dimensions": 0,
222
+ "default": null,
223
+ "generated": null,
224
+ "identity": null,
225
+ "name": "kind",
226
+ "entityType": "columns",
227
+ "schema": "public",
228
+ "table": "relay_delivery_attempts"
229
+ },
230
+ {
231
+ "type": "varchar(64)",
232
+ "typeSchema": null,
233
+ "notNull": false,
234
+ "dimensions": 0,
235
+ "default": null,
236
+ "generated": null,
237
+ "identity": null,
238
+ "name": "source_job_id",
239
+ "entityType": "columns",
240
+ "schema": "public",
241
+ "table": "relay_delivery_attempts"
242
+ },
243
+ {
244
+ "type": "varchar(16)",
245
+ "typeSchema": null,
246
+ "notNull": false,
247
+ "dimensions": 0,
248
+ "default": null,
249
+ "generated": null,
250
+ "identity": null,
251
+ "name": "token_suffix",
252
+ "entityType": "columns",
253
+ "schema": "public",
254
+ "table": "relay_delivery_attempts"
255
+ },
256
+ {
257
+ "type": "integer",
258
+ "typeSchema": null,
259
+ "notNull": false,
260
+ "dimensions": 0,
261
+ "default": null,
262
+ "generated": null,
263
+ "identity": null,
264
+ "name": "apns_status",
265
+ "entityType": "columns",
266
+ "schema": "public",
267
+ "table": "relay_delivery_attempts"
268
+ },
269
+ {
270
+ "type": "text",
271
+ "typeSchema": null,
272
+ "notNull": false,
273
+ "dimensions": 0,
274
+ "default": null,
275
+ "generated": null,
276
+ "identity": null,
277
+ "name": "apns_reason",
278
+ "entityType": "columns",
279
+ "schema": "public",
280
+ "table": "relay_delivery_attempts"
281
+ },
282
+ {
283
+ "type": "varchar(128)",
284
+ "typeSchema": null,
285
+ "notNull": false,
286
+ "dimensions": 0,
287
+ "default": null,
288
+ "generated": null,
289
+ "identity": null,
290
+ "name": "apns_id",
291
+ "entityType": "columns",
292
+ "schema": "public",
293
+ "table": "relay_delivery_attempts"
294
+ },
295
+ {
296
+ "type": "text",
297
+ "typeSchema": null,
298
+ "notNull": false,
299
+ "dimensions": 0,
300
+ "default": null,
301
+ "generated": null,
302
+ "identity": null,
303
+ "name": "transport_error",
304
+ "entityType": "columns",
305
+ "schema": "public",
306
+ "table": "relay_delivery_attempts"
307
+ },
308
+ {
309
+ "type": "varchar(128)",
310
+ "typeSchema": null,
311
+ "notNull": true,
312
+ "dimensions": 0,
313
+ "default": null,
314
+ "generated": null,
315
+ "identity": null,
316
+ "name": "thumbprint",
317
+ "entityType": "columns",
318
+ "schema": "public",
319
+ "table": "relay_dpop_proofs"
320
+ },
321
+ {
322
+ "type": "varchar(255)",
323
+ "typeSchema": null,
324
+ "notNull": true,
325
+ "dimensions": 0,
326
+ "default": null,
327
+ "generated": null,
328
+ "identity": null,
329
+ "name": "jti",
330
+ "entityType": "columns",
331
+ "schema": "public",
332
+ "table": "relay_dpop_proofs"
333
+ },
334
+ {
335
+ "type": "integer",
336
+ "typeSchema": null,
337
+ "notNull": true,
338
+ "dimensions": 0,
339
+ "default": null,
340
+ "generated": null,
341
+ "identity": null,
342
+ "name": "iat",
343
+ "entityType": "columns",
344
+ "schema": "public",
345
+ "table": "relay_dpop_proofs"
346
+ },
347
+ {
348
+ "type": "varchar(64)",
349
+ "typeSchema": null,
350
+ "notNull": true,
351
+ "dimensions": 0,
352
+ "default": null,
353
+ "generated": null,
354
+ "identity": null,
355
+ "name": "expires_at",
356
+ "entityType": "columns",
357
+ "schema": "public",
358
+ "table": "relay_dpop_proofs"
359
+ },
360
+ {
361
+ "type": "varchar(64)",
362
+ "typeSchema": null,
363
+ "notNull": true,
364
+ "dimensions": 0,
365
+ "default": null,
366
+ "generated": null,
367
+ "identity": null,
368
+ "name": "created_at",
369
+ "entityType": "columns",
370
+ "schema": "public",
371
+ "table": "relay_dpop_proofs"
372
+ },
373
+ {
374
+ "type": "varchar(64)",
375
+ "typeSchema": null,
376
+ "notNull": true,
377
+ "dimensions": 0,
378
+ "default": null,
379
+ "generated": null,
380
+ "identity": null,
381
+ "name": "credential_id",
382
+ "entityType": "columns",
383
+ "schema": "public",
384
+ "table": "relay_environment_credentials"
385
+ },
386
+ {
387
+ "type": "varchar(191)",
388
+ "typeSchema": null,
389
+ "notNull": true,
390
+ "dimensions": 0,
391
+ "default": null,
392
+ "generated": null,
393
+ "identity": null,
394
+ "name": "environment_id",
395
+ "entityType": "columns",
396
+ "schema": "public",
397
+ "table": "relay_environment_credentials"
398
+ },
399
+ {
400
+ "type": "text",
401
+ "typeSchema": null,
402
+ "notNull": true,
403
+ "dimensions": 0,
404
+ "default": null,
405
+ "generated": null,
406
+ "identity": null,
407
+ "name": "environment_public_key",
408
+ "entityType": "columns",
409
+ "schema": "public",
410
+ "table": "relay_environment_credentials"
411
+ },
412
+ {
413
+ "type": "varchar(191)",
414
+ "typeSchema": null,
415
+ "notNull": true,
416
+ "dimensions": 0,
417
+ "default": null,
418
+ "generated": null,
419
+ "identity": null,
420
+ "name": "credential_hash",
421
+ "entityType": "columns",
422
+ "schema": "public",
423
+ "table": "relay_environment_credentials"
424
+ },
425
+ {
426
+ "type": "varchar(64)",
427
+ "typeSchema": null,
428
+ "notNull": false,
429
+ "dimensions": 0,
430
+ "default": null,
431
+ "generated": null,
432
+ "identity": null,
433
+ "name": "revoked_at",
434
+ "entityType": "columns",
435
+ "schema": "public",
436
+ "table": "relay_environment_credentials"
437
+ },
438
+ {
439
+ "type": "varchar(64)",
440
+ "typeSchema": null,
441
+ "notNull": true,
442
+ "dimensions": 0,
443
+ "default": null,
444
+ "generated": null,
445
+ "identity": null,
446
+ "name": "created_at",
447
+ "entityType": "columns",
448
+ "schema": "public",
449
+ "table": "relay_environment_credentials"
450
+ },
451
+ {
452
+ "type": "varchar(64)",
453
+ "typeSchema": null,
454
+ "notNull": true,
455
+ "dimensions": 0,
456
+ "default": null,
457
+ "generated": null,
458
+ "identity": null,
459
+ "name": "updated_at",
460
+ "entityType": "columns",
461
+ "schema": "public",
462
+ "table": "relay_environment_credentials"
463
+ },
464
+ {
465
+ "type": "varchar(191)",
466
+ "typeSchema": null,
467
+ "notNull": true,
468
+ "dimensions": 0,
469
+ "default": null,
470
+ "generated": null,
471
+ "identity": null,
472
+ "name": "user_id",
473
+ "entityType": "columns",
474
+ "schema": "public",
475
+ "table": "relay_environment_links"
476
+ },
477
+ {
478
+ "type": "varchar(191)",
479
+ "typeSchema": null,
480
+ "notNull": true,
481
+ "dimensions": 0,
482
+ "default": null,
483
+ "generated": null,
484
+ "identity": null,
485
+ "name": "environment_id",
486
+ "entityType": "columns",
487
+ "schema": "public",
488
+ "table": "relay_environment_links"
489
+ },
490
+ {
491
+ "type": "text",
492
+ "typeSchema": null,
493
+ "notNull": true,
494
+ "dimensions": 0,
495
+ "default": "'T3 Environment'",
496
+ "generated": null,
497
+ "identity": null,
498
+ "name": "environment_label",
499
+ "entityType": "columns",
500
+ "schema": "public",
501
+ "table": "relay_environment_links"
502
+ },
503
+ {
504
+ "type": "text",
505
+ "typeSchema": null,
506
+ "notNull": true,
507
+ "dimensions": 0,
508
+ "default": null,
509
+ "generated": null,
510
+ "identity": null,
511
+ "name": "environment_public_key",
512
+ "entityType": "columns",
513
+ "schema": "public",
514
+ "table": "relay_environment_links"
515
+ },
516
+ {
517
+ "type": "text",
518
+ "typeSchema": null,
519
+ "notNull": true,
520
+ "dimensions": 0,
521
+ "default": null,
522
+ "generated": null,
523
+ "identity": null,
524
+ "name": "endpoint_http_base_url",
525
+ "entityType": "columns",
526
+ "schema": "public",
527
+ "table": "relay_environment_links"
528
+ },
529
+ {
530
+ "type": "text",
531
+ "typeSchema": null,
532
+ "notNull": true,
533
+ "dimensions": 0,
534
+ "default": null,
535
+ "generated": null,
536
+ "identity": null,
537
+ "name": "endpoint_ws_base_url",
538
+ "entityType": "columns",
539
+ "schema": "public",
540
+ "table": "relay_environment_links"
541
+ },
542
+ {
543
+ "type": "varchar(32)",
544
+ "typeSchema": null,
545
+ "notNull": true,
546
+ "dimensions": 0,
547
+ "default": null,
548
+ "generated": null,
549
+ "identity": null,
550
+ "name": "endpoint_provider_kind",
551
+ "entityType": "columns",
552
+ "schema": "public",
553
+ "table": "relay_environment_links"
554
+ },
555
+ {
556
+ "type": "boolean",
557
+ "typeSchema": null,
558
+ "notNull": true,
559
+ "dimensions": 0,
560
+ "default": "true",
561
+ "generated": null,
562
+ "identity": null,
563
+ "name": "notifications_enabled",
564
+ "entityType": "columns",
565
+ "schema": "public",
566
+ "table": "relay_environment_links"
567
+ },
568
+ {
569
+ "type": "boolean",
570
+ "typeSchema": null,
571
+ "notNull": true,
572
+ "dimensions": 0,
573
+ "default": "true",
574
+ "generated": null,
575
+ "identity": null,
576
+ "name": "live_activities_enabled",
577
+ "entityType": "columns",
578
+ "schema": "public",
579
+ "table": "relay_environment_links"
580
+ },
581
+ {
582
+ "type": "boolean",
583
+ "typeSchema": null,
584
+ "notNull": true,
585
+ "dimensions": 0,
586
+ "default": "false",
587
+ "generated": null,
588
+ "identity": null,
589
+ "name": "managed_tunnels_enabled",
590
+ "entityType": "columns",
591
+ "schema": "public",
592
+ "table": "relay_environment_links"
593
+ },
594
+ {
595
+ "type": "varchar(191)",
596
+ "typeSchema": null,
597
+ "notNull": false,
598
+ "dimensions": 0,
599
+ "default": null,
600
+ "generated": null,
601
+ "identity": null,
602
+ "name": "created_by_device_id",
603
+ "entityType": "columns",
604
+ "schema": "public",
605
+ "table": "relay_environment_links"
606
+ },
607
+ {
608
+ "type": "varchar(64)",
609
+ "typeSchema": null,
610
+ "notNull": false,
611
+ "dimensions": 0,
612
+ "default": null,
613
+ "generated": null,
614
+ "identity": null,
615
+ "name": "revoked_at",
616
+ "entityType": "columns",
617
+ "schema": "public",
618
+ "table": "relay_environment_links"
619
+ },
620
+ {
621
+ "type": "varchar(64)",
622
+ "typeSchema": null,
623
+ "notNull": true,
624
+ "dimensions": 0,
625
+ "default": null,
626
+ "generated": null,
627
+ "identity": null,
628
+ "name": "created_at",
629
+ "entityType": "columns",
630
+ "schema": "public",
631
+ "table": "relay_environment_links"
632
+ },
633
+ {
634
+ "type": "varchar(64)",
635
+ "typeSchema": null,
636
+ "notNull": true,
637
+ "dimensions": 0,
638
+ "default": null,
639
+ "generated": null,
640
+ "identity": null,
641
+ "name": "updated_at",
642
+ "entityType": "columns",
643
+ "schema": "public",
644
+ "table": "relay_environment_links"
645
+ },
646
+ {
647
+ "type": "varchar(255)",
648
+ "typeSchema": null,
649
+ "notNull": true,
650
+ "dimensions": 0,
651
+ "default": null,
652
+ "generated": null,
653
+ "identity": null,
654
+ "name": "user_id",
655
+ "entityType": "columns",
656
+ "schema": "public",
657
+ "table": "relay_live_activities"
658
+ },
659
+ {
660
+ "type": "varchar(255)",
661
+ "typeSchema": null,
662
+ "notNull": true,
663
+ "dimensions": 0,
664
+ "default": null,
665
+ "generated": null,
666
+ "identity": null,
667
+ "name": "device_id",
668
+ "entityType": "columns",
669
+ "schema": "public",
670
+ "table": "relay_live_activities"
671
+ },
672
+ {
673
+ "type": "text",
674
+ "typeSchema": null,
675
+ "notNull": false,
676
+ "dimensions": 0,
677
+ "default": null,
678
+ "generated": null,
679
+ "identity": null,
680
+ "name": "activity_push_token",
681
+ "entityType": "columns",
682
+ "schema": "public",
683
+ "table": "relay_live_activities"
684
+ },
685
+ {
686
+ "type": "varchar(64)",
687
+ "typeSchema": null,
688
+ "notNull": false,
689
+ "dimensions": 0,
690
+ "default": null,
691
+ "generated": null,
692
+ "identity": null,
693
+ "name": "remote_start_queued_at",
694
+ "entityType": "columns",
695
+ "schema": "public",
696
+ "table": "relay_live_activities"
697
+ },
698
+ {
699
+ "type": "varchar(64)",
700
+ "typeSchema": null,
701
+ "notNull": false,
702
+ "dimensions": 0,
703
+ "default": null,
704
+ "generated": null,
705
+ "identity": null,
706
+ "name": "remote_started_at",
707
+ "entityType": "columns",
708
+ "schema": "public",
709
+ "table": "relay_live_activities"
710
+ },
711
+ {
712
+ "type": "varchar(64)",
713
+ "typeSchema": null,
714
+ "notNull": false,
715
+ "dimensions": 0,
716
+ "default": null,
717
+ "generated": null,
718
+ "identity": null,
719
+ "name": "ended_at",
720
+ "entityType": "columns",
721
+ "schema": "public",
722
+ "table": "relay_live_activities"
723
+ },
724
+ {
725
+ "type": "jsonb",
726
+ "typeSchema": null,
727
+ "notNull": false,
728
+ "dimensions": 0,
729
+ "default": null,
730
+ "generated": null,
731
+ "identity": null,
732
+ "name": "last_aggregate_json",
733
+ "entityType": "columns",
734
+ "schema": "public",
735
+ "table": "relay_live_activities"
736
+ },
737
+ {
738
+ "type": "varchar(64)",
739
+ "typeSchema": null,
740
+ "notNull": false,
741
+ "dimensions": 0,
742
+ "default": null,
743
+ "generated": null,
744
+ "identity": null,
745
+ "name": "last_live_activity_delivery_at",
746
+ "entityType": "columns",
747
+ "schema": "public",
748
+ "table": "relay_live_activities"
749
+ },
750
+ {
751
+ "type": "varchar(64)",
752
+ "typeSchema": null,
753
+ "notNull": true,
754
+ "dimensions": 0,
755
+ "default": null,
756
+ "generated": null,
757
+ "identity": null,
758
+ "name": "created_at",
759
+ "entityType": "columns",
760
+ "schema": "public",
761
+ "table": "relay_live_activities"
762
+ },
763
+ {
764
+ "type": "varchar(64)",
765
+ "typeSchema": null,
766
+ "notNull": true,
767
+ "dimensions": 0,
768
+ "default": null,
769
+ "generated": null,
770
+ "identity": null,
771
+ "name": "updated_at",
772
+ "entityType": "columns",
773
+ "schema": "public",
774
+ "table": "relay_live_activities"
775
+ },
776
+ {
777
+ "type": "varchar(191)",
778
+ "typeSchema": null,
779
+ "notNull": true,
780
+ "dimensions": 0,
781
+ "default": null,
782
+ "generated": null,
783
+ "identity": null,
784
+ "name": "user_id",
785
+ "entityType": "columns",
786
+ "schema": "public",
787
+ "table": "relay_managed_endpoint_allocations"
788
+ },
789
+ {
790
+ "type": "varchar(191)",
791
+ "typeSchema": null,
792
+ "notNull": true,
793
+ "dimensions": 0,
794
+ "default": null,
795
+ "generated": null,
796
+ "identity": null,
797
+ "name": "environment_id",
798
+ "entityType": "columns",
799
+ "schema": "public",
800
+ "table": "relay_managed_endpoint_allocations"
801
+ },
802
+ {
803
+ "type": "text",
804
+ "typeSchema": null,
805
+ "notNull": true,
806
+ "dimensions": 0,
807
+ "default": null,
808
+ "generated": null,
809
+ "identity": null,
810
+ "name": "hostname",
811
+ "entityType": "columns",
812
+ "schema": "public",
813
+ "table": "relay_managed_endpoint_allocations"
814
+ },
815
+ {
816
+ "type": "varchar(191)",
817
+ "typeSchema": null,
818
+ "notNull": false,
819
+ "dimensions": 0,
820
+ "default": null,
821
+ "generated": null,
822
+ "identity": null,
823
+ "name": "tunnel_id",
824
+ "entityType": "columns",
825
+ "schema": "public",
826
+ "table": "relay_managed_endpoint_allocations"
827
+ },
828
+ {
829
+ "type": "text",
830
+ "typeSchema": null,
831
+ "notNull": true,
832
+ "dimensions": 0,
833
+ "default": null,
834
+ "generated": null,
835
+ "identity": null,
836
+ "name": "tunnel_name",
837
+ "entityType": "columns",
838
+ "schema": "public",
839
+ "table": "relay_managed_endpoint_allocations"
840
+ },
841
+ {
842
+ "type": "varchar(191)",
843
+ "typeSchema": null,
844
+ "notNull": false,
845
+ "dimensions": 0,
846
+ "default": null,
847
+ "generated": null,
848
+ "identity": null,
849
+ "name": "dns_record_id",
850
+ "entityType": "columns",
851
+ "schema": "public",
852
+ "table": "relay_managed_endpoint_allocations"
853
+ },
854
+ {
855
+ "type": "varchar(64)",
856
+ "typeSchema": null,
857
+ "notNull": false,
858
+ "dimensions": 0,
859
+ "default": null,
860
+ "generated": null,
861
+ "identity": null,
862
+ "name": "ready_at",
863
+ "entityType": "columns",
864
+ "schema": "public",
865
+ "table": "relay_managed_endpoint_allocations"
866
+ },
867
+ {
868
+ "type": "varchar(64)",
869
+ "typeSchema": null,
870
+ "notNull": true,
871
+ "dimensions": 0,
872
+ "default": null,
873
+ "generated": null,
874
+ "identity": null,
875
+ "name": "created_at",
876
+ "entityType": "columns",
877
+ "schema": "public",
878
+ "table": "relay_managed_endpoint_allocations"
879
+ },
880
+ {
881
+ "type": "varchar(64)",
882
+ "typeSchema": null,
883
+ "notNull": true,
884
+ "dimensions": 0,
885
+ "default": null,
886
+ "generated": null,
887
+ "identity": null,
888
+ "name": "updated_at",
889
+ "entityType": "columns",
890
+ "schema": "public",
891
+ "table": "relay_managed_endpoint_allocations"
892
+ },
893
+ {
894
+ "type": "varchar(191)",
895
+ "typeSchema": null,
896
+ "notNull": true,
897
+ "dimensions": 0,
898
+ "default": null,
899
+ "generated": null,
900
+ "identity": null,
901
+ "name": "user_id",
902
+ "entityType": "columns",
903
+ "schema": "public",
904
+ "table": "relay_managed_tunnel_limits"
905
+ },
906
+ {
907
+ "type": "integer",
908
+ "typeSchema": null,
909
+ "notNull": true,
910
+ "dimensions": 0,
911
+ "default": null,
912
+ "generated": null,
913
+ "identity": null,
914
+ "name": "max_tunnels",
915
+ "entityType": "columns",
916
+ "schema": "public",
917
+ "table": "relay_managed_tunnel_limits"
918
+ },
919
+ {
920
+ "type": "varchar(64)",
921
+ "typeSchema": null,
922
+ "notNull": true,
923
+ "dimensions": 0,
924
+ "default": null,
925
+ "generated": null,
926
+ "identity": null,
927
+ "name": "created_at",
928
+ "entityType": "columns",
929
+ "schema": "public",
930
+ "table": "relay_managed_tunnel_limits"
931
+ },
932
+ {
933
+ "type": "varchar(64)",
934
+ "typeSchema": null,
935
+ "notNull": true,
936
+ "dimensions": 0,
937
+ "default": null,
938
+ "generated": null,
939
+ "identity": null,
940
+ "name": "updated_at",
941
+ "entityType": "columns",
942
+ "schema": "public",
943
+ "table": "relay_managed_tunnel_limits"
944
+ },
945
+ {
946
+ "type": "varchar(255)",
947
+ "typeSchema": null,
948
+ "notNull": true,
949
+ "dimensions": 0,
950
+ "default": null,
951
+ "generated": null,
952
+ "identity": null,
953
+ "name": "user_id",
954
+ "entityType": "columns",
955
+ "schema": "public",
956
+ "table": "relay_mobile_devices"
957
+ },
958
+ {
959
+ "type": "varchar(255)",
960
+ "typeSchema": null,
961
+ "notNull": true,
962
+ "dimensions": 0,
963
+ "default": null,
964
+ "generated": null,
965
+ "identity": null,
966
+ "name": "device_id",
967
+ "entityType": "columns",
968
+ "schema": "public",
969
+ "table": "relay_mobile_devices"
970
+ },
971
+ {
972
+ "type": "text",
973
+ "typeSchema": null,
974
+ "notNull": true,
975
+ "dimensions": 0,
976
+ "default": "'iOS device'",
977
+ "generated": null,
978
+ "identity": null,
979
+ "name": "label",
980
+ "entityType": "columns",
981
+ "schema": "public",
982
+ "table": "relay_mobile_devices"
983
+ },
984
+ {
985
+ "type": "varchar(16)",
986
+ "typeSchema": null,
987
+ "notNull": true,
988
+ "dimensions": 0,
989
+ "default": null,
990
+ "generated": null,
991
+ "identity": null,
992
+ "name": "platform",
993
+ "entityType": "columns",
994
+ "schema": "public",
995
+ "table": "relay_mobile_devices"
996
+ },
997
+ {
998
+ "type": "integer",
999
+ "typeSchema": null,
1000
+ "notNull": true,
1001
+ "dimensions": 0,
1002
+ "default": null,
1003
+ "generated": null,
1004
+ "identity": null,
1005
+ "name": "ios_major_version",
1006
+ "entityType": "columns",
1007
+ "schema": "public",
1008
+ "table": "relay_mobile_devices"
1009
+ },
1010
+ {
1011
+ "type": "varchar(64)",
1012
+ "typeSchema": null,
1013
+ "notNull": false,
1014
+ "dimensions": 0,
1015
+ "default": null,
1016
+ "generated": null,
1017
+ "identity": null,
1018
+ "name": "app_version",
1019
+ "entityType": "columns",
1020
+ "schema": "public",
1021
+ "table": "relay_mobile_devices"
1022
+ },
1023
+ {
1024
+ "type": "varchar(255)",
1025
+ "typeSchema": null,
1026
+ "notNull": false,
1027
+ "dimensions": 0,
1028
+ "default": null,
1029
+ "generated": null,
1030
+ "identity": null,
1031
+ "name": "bundle_id",
1032
+ "entityType": "columns",
1033
+ "schema": "public",
1034
+ "table": "relay_mobile_devices"
1035
+ },
1036
+ {
1037
+ "type": "varchar(16)",
1038
+ "typeSchema": null,
1039
+ "notNull": false,
1040
+ "dimensions": 0,
1041
+ "default": null,
1042
+ "generated": null,
1043
+ "identity": null,
1044
+ "name": "aps_environment",
1045
+ "entityType": "columns",
1046
+ "schema": "public",
1047
+ "table": "relay_mobile_devices"
1048
+ },
1049
+ {
1050
+ "type": "text",
1051
+ "typeSchema": null,
1052
+ "notNull": false,
1053
+ "dimensions": 0,
1054
+ "default": null,
1055
+ "generated": null,
1056
+ "identity": null,
1057
+ "name": "push_token",
1058
+ "entityType": "columns",
1059
+ "schema": "public",
1060
+ "table": "relay_mobile_devices"
1061
+ },
1062
+ {
1063
+ "type": "text",
1064
+ "typeSchema": null,
1065
+ "notNull": false,
1066
+ "dimensions": 0,
1067
+ "default": null,
1068
+ "generated": null,
1069
+ "identity": null,
1070
+ "name": "push_to_start_token",
1071
+ "entityType": "columns",
1072
+ "schema": "public",
1073
+ "table": "relay_mobile_devices"
1074
+ },
1075
+ {
1076
+ "type": "jsonb",
1077
+ "typeSchema": null,
1078
+ "notNull": true,
1079
+ "dimensions": 0,
1080
+ "default": null,
1081
+ "generated": null,
1082
+ "identity": null,
1083
+ "name": "preferences_json",
1084
+ "entityType": "columns",
1085
+ "schema": "public",
1086
+ "table": "relay_mobile_devices"
1087
+ },
1088
+ {
1089
+ "type": "varchar(64)",
1090
+ "typeSchema": null,
1091
+ "notNull": true,
1092
+ "dimensions": 0,
1093
+ "default": null,
1094
+ "generated": null,
1095
+ "identity": null,
1096
+ "name": "created_at",
1097
+ "entityType": "columns",
1098
+ "schema": "public",
1099
+ "table": "relay_mobile_devices"
1100
+ },
1101
+ {
1102
+ "type": "varchar(64)",
1103
+ "typeSchema": null,
1104
+ "notNull": true,
1105
+ "dimensions": 0,
1106
+ "default": null,
1107
+ "generated": null,
1108
+ "identity": null,
1109
+ "name": "updated_at",
1110
+ "entityType": "columns",
1111
+ "schema": "public",
1112
+ "table": "relay_mobile_devices"
1113
+ },
1114
+ {
1115
+ "nameExplicit": true,
1116
+ "columns": [
1117
+ {
1118
+ "value": "updated_at",
1119
+ "isExpression": false,
1120
+ "asc": true,
1121
+ "nullsFirst": false,
1122
+ "opclass": null
1123
+ }
1124
+ ],
1125
+ "isUnique": false,
1126
+ "where": null,
1127
+ "with": "",
1128
+ "method": "btree",
1129
+ "concurrently": false,
1130
+ "name": "idx_relay_agent_activity_rows_updated",
1131
+ "entityType": "indexes",
1132
+ "schema": "public",
1133
+ "table": "relay_agent_activity_rows"
1134
+ },
1135
+ {
1136
+ "nameExplicit": true,
1137
+ "columns": [
1138
+ {
1139
+ "value": "environment_id",
1140
+ "isExpression": false,
1141
+ "asc": true,
1142
+ "nullsFirst": false,
1143
+ "opclass": null
1144
+ },
1145
+ {
1146
+ "value": "thread_id",
1147
+ "isExpression": false,
1148
+ "asc": true,
1149
+ "nullsFirst": false,
1150
+ "opclass": null
1151
+ },
1152
+ {
1153
+ "value": "created_at",
1154
+ "isExpression": false,
1155
+ "asc": true,
1156
+ "nullsFirst": false,
1157
+ "opclass": null
1158
+ }
1159
+ ],
1160
+ "isUnique": false,
1161
+ "where": null,
1162
+ "with": "",
1163
+ "method": "btree",
1164
+ "concurrently": false,
1165
+ "name": "idx_relay_delivery_attempts_environment",
1166
+ "entityType": "indexes",
1167
+ "schema": "public",
1168
+ "table": "relay_delivery_attempts"
1169
+ },
1170
+ {
1171
+ "nameExplicit": true,
1172
+ "columns": [
1173
+ {
1174
+ "value": "source_job_id",
1175
+ "isExpression": false,
1176
+ "asc": true,
1177
+ "nullsFirst": false,
1178
+ "opclass": null
1179
+ }
1180
+ ],
1181
+ "isUnique": true,
1182
+ "where": null,
1183
+ "with": "",
1184
+ "method": "btree",
1185
+ "concurrently": false,
1186
+ "name": "idx_relay_delivery_attempts_source_job",
1187
+ "entityType": "indexes",
1188
+ "schema": "public",
1189
+ "table": "relay_delivery_attempts"
1190
+ },
1191
+ {
1192
+ "nameExplicit": true,
1193
+ "columns": [
1194
+ {
1195
+ "value": "expires_at",
1196
+ "isExpression": false,
1197
+ "asc": true,
1198
+ "nullsFirst": false,
1199
+ "opclass": null
1200
+ }
1201
+ ],
1202
+ "isUnique": false,
1203
+ "where": null,
1204
+ "with": "",
1205
+ "method": "btree",
1206
+ "concurrently": false,
1207
+ "name": "idx_relay_dpop_proofs_expires_at",
1208
+ "entityType": "indexes",
1209
+ "schema": "public",
1210
+ "table": "relay_dpop_proofs"
1211
+ },
1212
+ {
1213
+ "nameExplicit": true,
1214
+ "columns": [
1215
+ {
1216
+ "value": "credential_hash",
1217
+ "isExpression": false,
1218
+ "asc": true,
1219
+ "nullsFirst": false,
1220
+ "opclass": null
1221
+ }
1222
+ ],
1223
+ "isUnique": true,
1224
+ "where": null,
1225
+ "with": "",
1226
+ "method": "btree",
1227
+ "concurrently": false,
1228
+ "name": "idx_relay_environment_credentials_hash",
1229
+ "entityType": "indexes",
1230
+ "schema": "public",
1231
+ "table": "relay_environment_credentials"
1232
+ },
1233
+ {
1234
+ "nameExplicit": true,
1235
+ "columns": [
1236
+ {
1237
+ "value": "environment_id",
1238
+ "isExpression": false,
1239
+ "asc": true,
1240
+ "nullsFirst": false,
1241
+ "opclass": null
1242
+ },
1243
+ {
1244
+ "value": "revoked_at",
1245
+ "isExpression": false,
1246
+ "asc": true,
1247
+ "nullsFirst": false,
1248
+ "opclass": null
1249
+ }
1250
+ ],
1251
+ "isUnique": false,
1252
+ "where": null,
1253
+ "with": "",
1254
+ "method": "btree",
1255
+ "concurrently": false,
1256
+ "name": "idx_relay_environment_credentials_environment",
1257
+ "entityType": "indexes",
1258
+ "schema": "public",
1259
+ "table": "relay_environment_credentials"
1260
+ },
1261
+ {
1262
+ "nameExplicit": true,
1263
+ "columns": [
1264
+ {
1265
+ "value": "environment_id",
1266
+ "isExpression": false,
1267
+ "asc": true,
1268
+ "nullsFirst": false,
1269
+ "opclass": null
1270
+ },
1271
+ {
1272
+ "value": "environment_public_key",
1273
+ "isExpression": false,
1274
+ "asc": true,
1275
+ "nullsFirst": false,
1276
+ "opclass": null
1277
+ },
1278
+ {
1279
+ "value": "revoked_at",
1280
+ "isExpression": false,
1281
+ "asc": true,
1282
+ "nullsFirst": false,
1283
+ "opclass": null
1284
+ }
1285
+ ],
1286
+ "isUnique": false,
1287
+ "where": null,
1288
+ "with": "",
1289
+ "method": "btree",
1290
+ "concurrently": false,
1291
+ "name": "idx_relay_environment_credentials_environment_key",
1292
+ "entityType": "indexes",
1293
+ "schema": "public",
1294
+ "table": "relay_environment_credentials"
1295
+ },
1296
+ {
1297
+ "nameExplicit": true,
1298
+ "columns": [
1299
+ {
1300
+ "value": "environment_id",
1301
+ "isExpression": false,
1302
+ "asc": true,
1303
+ "nullsFirst": false,
1304
+ "opclass": null
1305
+ },
1306
+ {
1307
+ "value": "revoked_at",
1308
+ "isExpression": false,
1309
+ "asc": true,
1310
+ "nullsFirst": false,
1311
+ "opclass": null
1312
+ }
1313
+ ],
1314
+ "isUnique": false,
1315
+ "where": null,
1316
+ "with": "",
1317
+ "method": "btree",
1318
+ "concurrently": false,
1319
+ "name": "idx_relay_environment_links_environment",
1320
+ "entityType": "indexes",
1321
+ "schema": "public",
1322
+ "table": "relay_environment_links"
1323
+ },
1324
+ {
1325
+ "nameExplicit": true,
1326
+ "columns": [
1327
+ {
1328
+ "value": "activity_push_token",
1329
+ "isExpression": false,
1330
+ "asc": true,
1331
+ "nullsFirst": false,
1332
+ "opclass": null
1333
+ }
1334
+ ],
1335
+ "isUnique": true,
1336
+ "where": null,
1337
+ "with": "",
1338
+ "method": "btree",
1339
+ "concurrently": false,
1340
+ "name": "idx_relay_live_activities_activity_push_token",
1341
+ "entityType": "indexes",
1342
+ "schema": "public",
1343
+ "table": "relay_live_activities"
1344
+ },
1345
+ {
1346
+ "nameExplicit": true,
1347
+ "columns": [
1348
+ {
1349
+ "value": "hostname",
1350
+ "isExpression": false,
1351
+ "asc": true,
1352
+ "nullsFirst": false,
1353
+ "opclass": null
1354
+ }
1355
+ ],
1356
+ "isUnique": true,
1357
+ "where": null,
1358
+ "with": "",
1359
+ "method": "btree",
1360
+ "concurrently": false,
1361
+ "name": "idx_relay_managed_endpoint_allocations_hostname",
1362
+ "entityType": "indexes",
1363
+ "schema": "public",
1364
+ "table": "relay_managed_endpoint_allocations"
1365
+ },
1366
+ {
1367
+ "nameExplicit": true,
1368
+ "columns": [
1369
+ {
1370
+ "value": "tunnel_name",
1371
+ "isExpression": false,
1372
+ "asc": true,
1373
+ "nullsFirst": false,
1374
+ "opclass": null
1375
+ }
1376
+ ],
1377
+ "isUnique": true,
1378
+ "where": null,
1379
+ "with": "",
1380
+ "method": "btree",
1381
+ "concurrently": false,
1382
+ "name": "idx_relay_managed_endpoint_allocations_tunnel_name",
1383
+ "entityType": "indexes",
1384
+ "schema": "public",
1385
+ "table": "relay_managed_endpoint_allocations"
1386
+ },
1387
+ {
1388
+ "nameExplicit": true,
1389
+ "columns": [
1390
+ {
1391
+ "value": "push_token",
1392
+ "isExpression": false,
1393
+ "asc": true,
1394
+ "nullsFirst": false,
1395
+ "opclass": null
1396
+ }
1397
+ ],
1398
+ "isUnique": true,
1399
+ "where": null,
1400
+ "with": "",
1401
+ "method": "btree",
1402
+ "concurrently": false,
1403
+ "name": "idx_relay_mobile_devices_push_token",
1404
+ "entityType": "indexes",
1405
+ "schema": "public",
1406
+ "table": "relay_mobile_devices"
1407
+ },
1408
+ {
1409
+ "nameExplicit": true,
1410
+ "columns": [
1411
+ {
1412
+ "value": "push_to_start_token",
1413
+ "isExpression": false,
1414
+ "asc": true,
1415
+ "nullsFirst": false,
1416
+ "opclass": null
1417
+ }
1418
+ ],
1419
+ "isUnique": true,
1420
+ "where": null,
1421
+ "with": "",
1422
+ "method": "btree",
1423
+ "concurrently": false,
1424
+ "name": "idx_relay_mobile_devices_push_to_start_token",
1425
+ "entityType": "indexes",
1426
+ "schema": "public",
1427
+ "table": "relay_mobile_devices"
1428
+ },
1429
+ {
1430
+ "columns": ["environment_id", "environment_public_key", "thread_id"],
1431
+ "nameExplicit": false,
1432
+ "name": "relay_agent_activity_rows_pkey",
1433
+ "entityType": "pks",
1434
+ "schema": "public",
1435
+ "table": "relay_agent_activity_rows"
1436
+ },
1437
+ {
1438
+ "columns": ["thumbprint", "jti"],
1439
+ "nameExplicit": false,
1440
+ "name": "relay_dpop_proofs_pkey",
1441
+ "entityType": "pks",
1442
+ "schema": "public",
1443
+ "table": "relay_dpop_proofs"
1444
+ },
1445
+ {
1446
+ "columns": ["user_id", "environment_id"],
1447
+ "nameExplicit": false,
1448
+ "name": "relay_environment_links_pkey",
1449
+ "entityType": "pks",
1450
+ "schema": "public",
1451
+ "table": "relay_environment_links"
1452
+ },
1453
+ {
1454
+ "columns": ["user_id", "device_id"],
1455
+ "nameExplicit": false,
1456
+ "name": "relay_live_activities_pkey",
1457
+ "entityType": "pks",
1458
+ "schema": "public",
1459
+ "table": "relay_live_activities"
1460
+ },
1461
+ {
1462
+ "columns": ["user_id", "environment_id"],
1463
+ "nameExplicit": false,
1464
+ "name": "relay_managed_endpoint_allocations_pkey",
1465
+ "entityType": "pks",
1466
+ "schema": "public",
1467
+ "table": "relay_managed_endpoint_allocations"
1468
+ },
1469
+ {
1470
+ "columns": ["user_id", "device_id"],
1471
+ "nameExplicit": false,
1472
+ "name": "relay_mobile_devices_pkey",
1473
+ "entityType": "pks",
1474
+ "schema": "public",
1475
+ "table": "relay_mobile_devices"
1476
+ },
1477
+ {
1478
+ "columns": ["id"],
1479
+ "nameExplicit": false,
1480
+ "name": "relay_delivery_attempts_pkey",
1481
+ "schema": "public",
1482
+ "table": "relay_delivery_attempts",
1483
+ "entityType": "pks"
1484
+ },
1485
+ {
1486
+ "columns": ["credential_id"],
1487
+ "nameExplicit": false,
1488
+ "name": "relay_environment_credentials_pkey",
1489
+ "schema": "public",
1490
+ "table": "relay_environment_credentials",
1491
+ "entityType": "pks"
1492
+ },
1493
+ {
1494
+ "columns": ["user_id"],
1495
+ "nameExplicit": false,
1496
+ "name": "relay_managed_tunnel_limits_pkey",
1497
+ "schema": "public",
1498
+ "table": "relay_managed_tunnel_limits",
1499
+ "entityType": "pks"
1500
+ }
1501
+ ],
1502
+ "renames": []
1503
+}
infra/relay/src/persistence/schema.ts
-2
@@ -34,7 +34,6 @@ export const relayMobileDevices = pgTable(
34
},
35
(table) => [
36
primaryKey({ columns: [table.userId, table.deviceId] }),
37
- index("idx_relay_mobile_devices_user").on(table.userId),
37
uniqueIndex("idx_relay_mobile_devices_push_token").on(table.pushToken),
38
uniqueIndex("idx_relay_mobile_devices_push_to_start_token").on(table.pushToStartToken),
39
],
@@ -56,7 +55,6 @@ export const relayLiveActivities = pgTable(
55
},
56
(table) => [
57
primaryKey({ columns: [table.userId, table.deviceId] }),
59
- index("idx_relay_live_activities_user").on(table.userId),
58
uniqueIndex("idx_relay_live_activities_activity_push_token").on(table.activityPushToken),
59
],
60
);