@@ -158,6 +158,18 @@ test('typegen: typescript', async () => {
158
158
referencedRelation: "users_view"
159
159
referencedColumns: ["id"]
160
160
},
161
+ {
162
+ foreignKeyName: "todos_user-id_fkey"
163
+ columns: ["user-id"]
164
+ referencedRelation: "users_view_with_multiple_refs_to_users"
165
+ referencedColumns: ["initial_id"]
166
+ },
167
+ {
168
+ foreignKeyName: "todos_user-id_fkey"
169
+ columns: ["user-id"]
170
+ referencedRelation: "users_view_with_multiple_refs_to_users"
171
+ referencedColumns: ["second_id"]
172
+ },
161
173
]
162
174
}
163
175
user_details: {
@@ -192,6 +204,18 @@ test('typegen: typescript', async () => {
192
204
referencedRelation: "users_view"
193
205
referencedColumns: ["id"]
194
206
},
207
+ {
208
+ foreignKeyName: "user_details_user_id_fkey"
209
+ columns: ["user_id"]
210
+ referencedRelation: "users_view_with_multiple_refs_to_users"
211
+ referencedColumns: ["initial_id"]
212
+ },
213
+ {
214
+ foreignKeyName: "user_details_user_id_fkey"
215
+ columns: ["user_id"]
216
+ referencedRelation: "users_view_with_multiple_refs_to_users"
217
+ referencedColumns: ["second_id"]
218
+ },
195
219
]
196
220
}
197
221
users: {
@@ -272,6 +296,18 @@ test('typegen: typescript', async () => {
272
296
referencedRelation: "users_view"
273
297
referencedColumns: ["id"]
274
298
},
299
+ {
300
+ foreignKeyName: "todos_user-id_fkey"
301
+ columns: ["user-id"]
302
+ referencedRelation: "users_view_with_multiple_refs_to_users"
303
+ referencedColumns: ["initial_id"]
304
+ },
305
+ {
306
+ foreignKeyName: "todos_user-id_fkey"
307
+ columns: ["user-id"]
308
+ referencedRelation: "users_view_with_multiple_refs_to_users"
309
+ referencedColumns: ["second_id"]
310
+ },
275
311
]
276
312
}
277
313
todos_view: {
@@ -309,6 +345,18 @@ test('typegen: typescript', async () => {
309
345
referencedRelation: "users_view"
310
346
referencedColumns: ["id"]
311
347
},
348
+ {
349
+ foreignKeyName: "todos_user-id_fkey"
350
+ columns: ["user-id"]
351
+ referencedRelation: "users_view_with_multiple_refs_to_users"
352
+ referencedColumns: ["initial_id"]
353
+ },
354
+ {
355
+ foreignKeyName: "todos_user-id_fkey"
356
+ columns: ["user-id"]
357
+ referencedRelation: "users_view_with_multiple_refs_to_users"
358
+ referencedColumns: ["second_id"]
359
+ },
312
360
]
313
361
}
314
362
users_view: {
@@ -329,6 +377,15 @@ test('typegen: typescript', async () => {
329
377
}
330
378
Relationships: []
331
379
}
380
+ users_view_with_multiple_refs_to_users: {
381
+ Row: {
382
+ initial_id: number | null
383
+ initial_name: string | null
384
+ second_id: number | null
385
+ second_name: string | null
386
+ }
387
+ Relationships: []
388
+ }
332
389
}
333
390
Functions: {
334
391
blurb: {
@@ -713,6 +770,20 @@ test('typegen w/ one-to-one relationships', async () => {
713
770
referencedRelation: "users_view"
714
771
referencedColumns: ["id"]
715
772
},
773
+ {
774
+ foreignKeyName: "todos_user-id_fkey"
775
+ columns: ["user-id"]
776
+ isOneToOne: false
777
+ referencedRelation: "users_view_with_multiple_refs_to_users"
778
+ referencedColumns: ["initial_id"]
779
+ },
780
+ {
781
+ foreignKeyName: "todos_user-id_fkey"
782
+ columns: ["user-id"]
783
+ isOneToOne: false
784
+ referencedRelation: "users_view_with_multiple_refs_to_users"
785
+ referencedColumns: ["second_id"]
786
+ },
716
787
]
717
788
}
718
789
user_details: {
@@ -750,6 +821,20 @@ test('typegen w/ one-to-one relationships', async () => {
750
821
referencedRelation: "users_view"
751
822
referencedColumns: ["id"]
752
823
},
824
+ {
825
+ foreignKeyName: "user_details_user_id_fkey"
826
+ columns: ["user_id"]
827
+ isOneToOne: true
828
+ referencedRelation: "users_view_with_multiple_refs_to_users"
829
+ referencedColumns: ["initial_id"]
830
+ },
831
+ {
832
+ foreignKeyName: "user_details_user_id_fkey"
833
+ columns: ["user_id"]
834
+ isOneToOne: true
835
+ referencedRelation: "users_view_with_multiple_refs_to_users"
836
+ referencedColumns: ["second_id"]
837
+ },
753
838
]
754
839
}
755
840
users: {
@@ -833,6 +918,20 @@ test('typegen w/ one-to-one relationships', async () => {
833
918
referencedRelation: "users_view"
834
919
referencedColumns: ["id"]
835
920
},
921
+ {
922
+ foreignKeyName: "todos_user-id_fkey"
923
+ columns: ["user-id"]
924
+ isOneToOne: false
925
+ referencedRelation: "users_view_with_multiple_refs_to_users"
926
+ referencedColumns: ["initial_id"]
927
+ },
928
+ {
929
+ foreignKeyName: "todos_user-id_fkey"
930
+ columns: ["user-id"]
931
+ isOneToOne: false
932
+ referencedRelation: "users_view_with_multiple_refs_to_users"
933
+ referencedColumns: ["second_id"]
934
+ },
836
935
]
837
936
}
838
937
todos_view: {
@@ -873,6 +972,20 @@ test('typegen w/ one-to-one relationships', async () => {
873
972
referencedRelation: "users_view"
874
973
referencedColumns: ["id"]
875
974
},
975
+ {
976
+ foreignKeyName: "todos_user-id_fkey"
977
+ columns: ["user-id"]
978
+ isOneToOne: false
979
+ referencedRelation: "users_view_with_multiple_refs_to_users"
980
+ referencedColumns: ["initial_id"]
981
+ },
982
+ {
983
+ foreignKeyName: "todos_user-id_fkey"
984
+ columns: ["user-id"]
985
+ isOneToOne: false
986
+ referencedRelation: "users_view_with_multiple_refs_to_users"
987
+ referencedColumns: ["second_id"]
988
+ },
876
989
]
877
990
}
878
991
users_view: {
@@ -893,6 +1006,15 @@ test('typegen w/ one-to-one relationships', async () => {
893
1006
}
894
1007
Relationships: []
895
1008
}
1009
+ users_view_with_multiple_refs_to_users: {
1010
+ Row: {
1011
+ initial_id: number | null
1012
+ initial_name: string | null
1013
+ second_id: number | null
1014
+ second_name: string | null
1015
+ }
1016
+ Relationships: []
1017
+ }
896
1018
}
897
1019
Functions: {
898
1020
blurb: {
@@ -1277,6 +1399,20 @@ test('typegen: typescript w/ one-to-one relationships', async () => {
1277
1399
referencedRelation: "users_view"
1278
1400
referencedColumns: ["id"]
1279
1401
},
1402
+ {
1403
+ foreignKeyName: "todos_user-id_fkey"
1404
+ columns: ["user-id"]
1405
+ isOneToOne: false
1406
+ referencedRelation: "users_view_with_multiple_refs_to_users"
1407
+ referencedColumns: ["initial_id"]
1408
+ },
1409
+ {
1410
+ foreignKeyName: "todos_user-id_fkey"
1411
+ columns: ["user-id"]
1412
+ isOneToOne: false
1413
+ referencedRelation: "users_view_with_multiple_refs_to_users"
1414
+ referencedColumns: ["second_id"]
1415
+ },
1280
1416
]
1281
1417
}
1282
1418
user_details: {
@@ -1314,6 +1450,20 @@ test('typegen: typescript w/ one-to-one relationships', async () => {
1314
1450
referencedRelation: "users_view"
1315
1451
referencedColumns: ["id"]
1316
1452
},
1453
+ {
1454
+ foreignKeyName: "user_details_user_id_fkey"
1455
+ columns: ["user_id"]
1456
+ isOneToOne: true
1457
+ referencedRelation: "users_view_with_multiple_refs_to_users"
1458
+ referencedColumns: ["initial_id"]
1459
+ },
1460
+ {
1461
+ foreignKeyName: "user_details_user_id_fkey"
1462
+ columns: ["user_id"]
1463
+ isOneToOne: true
1464
+ referencedRelation: "users_view_with_multiple_refs_to_users"
1465
+ referencedColumns: ["second_id"]
1466
+ },
1317
1467
]
1318
1468
}
1319
1469
users: {
@@ -1397,6 +1547,20 @@ test('typegen: typescript w/ one-to-one relationships', async () => {
1397
1547
referencedRelation: "users_view"
1398
1548
referencedColumns: ["id"]
1399
1549
},
1550
+ {
1551
+ foreignKeyName: "todos_user-id_fkey"
1552
+ columns: ["user-id"]
1553
+ isOneToOne: false
1554
+ referencedRelation: "users_view_with_multiple_refs_to_users"
1555
+ referencedColumns: ["initial_id"]
1556
+ },
1557
+ {
1558
+ foreignKeyName: "todos_user-id_fkey"
1559
+ columns: ["user-id"]
1560
+ isOneToOne: false
1561
+ referencedRelation: "users_view_with_multiple_refs_to_users"
1562
+ referencedColumns: ["second_id"]
1563
+ },
1400
1564
]
1401
1565
}
1402
1566
todos_view: {
@@ -1437,6 +1601,20 @@ test('typegen: typescript w/ one-to-one relationships', async () => {
1437
1601
referencedRelation: "users_view"
1438
1602
referencedColumns: ["id"]
1439
1603
},
1604
+ {
1605
+ foreignKeyName: "todos_user-id_fkey"
1606
+ columns: ["user-id"]
1607
+ isOneToOne: false
1608
+ referencedRelation: "users_view_with_multiple_refs_to_users"
1609
+ referencedColumns: ["initial_id"]
1610
+ },
1611
+ {
1612
+ foreignKeyName: "todos_user-id_fkey"
1613
+ columns: ["user-id"]
1614
+ isOneToOne: false
1615
+ referencedRelation: "users_view_with_multiple_refs_to_users"
1616
+ referencedColumns: ["second_id"]
1617
+ },
1440
1618
]
1441
1619
}
1442
1620
users_view: {
@@ -1457,6 +1635,15 @@ test('typegen: typescript w/ one-to-one relationships', async () => {
1457
1635
}
1458
1636
Relationships: []
1459
1637
}
1638
+ users_view_with_multiple_refs_to_users: {
1639
+ Row: {
1640
+ initial_id: number | null
1641
+ initial_name: string | null
1642
+ second_id: number | null
1643
+ second_name: string | null
1644
+ }
1645
+ Relationships: []
1646
+ }
1460
1647
}
1461
1648
Functions: {
1462
1649
blurb: {
@@ -1853,6 +2040,13 @@ type PublicAViewSelect struct {
1853
2040
Id *int64 \`json:"id"\`
1854
2041
}
1855
2042
2043
+ type PublicUsersViewWithMultipleRefsToUsersSelect struct {
2044
+ InitialId *int64 \`json:"initial_id"\`
2045
+ InitialName *string \`json:"initial_name"\`
2046
+ SecondId *int64 \`json:"second_id"\`
2047
+ SecondName *string \`json:"second_name"\`
2048
+ }
2049
+
1856
2050
type PublicTodosMatviewSelect struct {
1857
2051
Details *string \`json:"details"\`
1858
2052
Id *int64 \`json:"id"\`
@@ -2200,6 +2394,18 @@ test('typegen: swift', async () => {
2200
2394
case status = "status"
2201
2395
}
2202
2396
}
2397
+ internal struct UsersViewWithMultipleRefsToUsersSelect: Codable, Hashable, Sendable {
2398
+ internal let initialId: Int64?
2399
+ internal let initialName: String?
2400
+ internal let secondId: Int64?
2401
+ internal let secondName: String?
2402
+ internal enum CodingKeys: String, CodingKey {
2403
+ case initialId = "initial_id"
2404
+ case initialName = "initial_name"
2405
+ case secondId = "second_id"
2406
+ case secondName = "second_name"
2407
+ }
2408
+ }
2203
2409
internal struct CompositeTypeWithArrayAttribute: Codable, Hashable, Sendable {
2204
2410
internal let MyTextArray: AnyJSON
2205
2411
internal enum CodingKeys: String, CodingKey {
@@ -2551,6 +2757,18 @@ test('typegen: swift w/ public access control', async () => {
2551
2757
case status = "status"
2552
2758
}
2553
2759
}
2760
+ public struct UsersViewWithMultipleRefsToUsersSelect: Codable, Hashable, Sendable {
2761
+ public let initialId: Int64?
2762
+ public let initialName: String?
2763
+ public let secondId: Int64?
2764
+ public let secondName: String?
2765
+ public enum CodingKeys: String, CodingKey {
2766
+ case initialId = "initial_id"
2767
+ case initialName = "initial_name"
2768
+ case secondId = "second_id"
2769
+ case secondName = "second_name"
2770
+ }
2771
+ }
2554
2772
public struct CompositeTypeWithArrayAttribute: Codable, Hashable, Sendable {
2555
2773
public let MyTextArray: AnyJSON
2556
2774
public enum CodingKeys: String, CodingKey {
0 commit comments