@authhero/drizzle 0.26.1 → 0.27.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/drizzle/meta/0000_snapshot.json +106 -354
- package/drizzle/meta/_journal.json +1 -1
- package/package.json +2 -2
- package/src/schema/sqlite/branding.ts +14 -9
- package/src/schema/sqlite/clients.ts +115 -73
- package/src/schema/sqlite/organizations.ts +71 -51
- package/src/schema/sqlite/sessions.ts +4 -1
|
@@ -383,12 +383,8 @@
|
|
|
383
383
|
"name": "passwords_tenant_id_tenants_id_fk",
|
|
384
384
|
"tableFrom": "passwords",
|
|
385
385
|
"tableTo": "tenants",
|
|
386
|
-
"columnsFrom": [
|
|
387
|
-
|
|
388
|
-
],
|
|
389
|
-
"columnsTo": [
|
|
390
|
-
"id"
|
|
391
|
-
],
|
|
386
|
+
"columnsFrom": ["tenant_id"],
|
|
387
|
+
"columnsTo": ["id"],
|
|
392
388
|
"onDelete": "cascade",
|
|
393
389
|
"onUpdate": "no action"
|
|
394
390
|
}
|
|
@@ -644,59 +640,37 @@
|
|
|
644
640
|
"indexes": {
|
|
645
641
|
"unique_email_provider": {
|
|
646
642
|
"name": "unique_email_provider",
|
|
647
|
-
"columns": [
|
|
648
|
-
"email",
|
|
649
|
-
"provider",
|
|
650
|
-
"tenant_id"
|
|
651
|
-
],
|
|
643
|
+
"columns": ["email", "provider", "tenant_id"],
|
|
652
644
|
"isUnique": true
|
|
653
645
|
},
|
|
654
646
|
"unique_phone_provider": {
|
|
655
647
|
"name": "unique_phone_provider",
|
|
656
|
-
"columns": [
|
|
657
|
-
"phone_number",
|
|
658
|
-
"provider",
|
|
659
|
-
"tenant_id"
|
|
660
|
-
],
|
|
648
|
+
"columns": ["phone_number", "provider", "tenant_id"],
|
|
661
649
|
"isUnique": true
|
|
662
650
|
},
|
|
663
651
|
"unique_username_provider": {
|
|
664
652
|
"name": "unique_username_provider",
|
|
665
|
-
"columns": [
|
|
666
|
-
"username",
|
|
667
|
-
"provider",
|
|
668
|
-
"tenant_id"
|
|
669
|
-
],
|
|
653
|
+
"columns": ["username", "provider", "tenant_id"],
|
|
670
654
|
"isUnique": true
|
|
671
655
|
},
|
|
672
656
|
"users_email_index": {
|
|
673
657
|
"name": "users_email_index",
|
|
674
|
-
"columns": [
|
|
675
|
-
"email"
|
|
676
|
-
],
|
|
658
|
+
"columns": ["email"],
|
|
677
659
|
"isUnique": false
|
|
678
660
|
},
|
|
679
661
|
"users_linked_to_index": {
|
|
680
662
|
"name": "users_linked_to_index",
|
|
681
|
-
"columns": [
|
|
682
|
-
"linked_to"
|
|
683
|
-
],
|
|
663
|
+
"columns": ["linked_to"],
|
|
684
664
|
"isUnique": false
|
|
685
665
|
},
|
|
686
666
|
"users_name_index": {
|
|
687
667
|
"name": "users_name_index",
|
|
688
|
-
"columns": [
|
|
689
|
-
"name"
|
|
690
|
-
],
|
|
668
|
+
"columns": ["name"],
|
|
691
669
|
"isUnique": false
|
|
692
670
|
},
|
|
693
671
|
"users_phone_tenant_provider_index": {
|
|
694
672
|
"name": "users_phone_tenant_provider_index",
|
|
695
|
-
"columns": [
|
|
696
|
-
"tenant_id",
|
|
697
|
-
"phone_number",
|
|
698
|
-
"provider"
|
|
699
|
-
],
|
|
673
|
+
"columns": ["tenant_id", "phone_number", "provider"],
|
|
700
674
|
"isUnique": false
|
|
701
675
|
}
|
|
702
676
|
},
|
|
@@ -705,22 +679,15 @@
|
|
|
705
679
|
"name": "users_tenant_id_tenants_id_fk",
|
|
706
680
|
"tableFrom": "users",
|
|
707
681
|
"tableTo": "tenants",
|
|
708
|
-
"columnsFrom": [
|
|
709
|
-
|
|
710
|
-
],
|
|
711
|
-
"columnsTo": [
|
|
712
|
-
"id"
|
|
713
|
-
],
|
|
682
|
+
"columnsFrom": ["tenant_id"],
|
|
683
|
+
"columnsTo": ["id"],
|
|
714
684
|
"onDelete": "cascade",
|
|
715
685
|
"onUpdate": "no action"
|
|
716
686
|
}
|
|
717
687
|
},
|
|
718
688
|
"compositePrimaryKeys": {
|
|
719
689
|
"users_tenants": {
|
|
720
|
-
"columns": [
|
|
721
|
-
"user_id",
|
|
722
|
-
"tenant_id"
|
|
723
|
-
],
|
|
690
|
+
"columns": ["user_id", "tenant_id"],
|
|
724
691
|
"name": "users_tenants"
|
|
725
692
|
}
|
|
726
693
|
},
|
|
@@ -828,12 +795,8 @@
|
|
|
828
795
|
"name": "authentication_codes_tenant_id_tenants_id_fk",
|
|
829
796
|
"tableFrom": "authentication_codes",
|
|
830
797
|
"tableTo": "tenants",
|
|
831
|
-
"columnsFrom": [
|
|
832
|
-
|
|
833
|
-
],
|
|
834
|
-
"columnsTo": [
|
|
835
|
-
"id"
|
|
836
|
-
],
|
|
798
|
+
"columnsFrom": ["tenant_id"],
|
|
799
|
+
"columnsTo": ["id"],
|
|
837
800
|
"onDelete": "cascade",
|
|
838
801
|
"onUpdate": "no action"
|
|
839
802
|
}
|
|
@@ -954,9 +917,7 @@
|
|
|
954
917
|
"indexes": {
|
|
955
918
|
"codes_expires_at_index": {
|
|
956
919
|
"name": "codes_expires_at_index",
|
|
957
|
-
"columns": [
|
|
958
|
-
"expires_at"
|
|
959
|
-
],
|
|
920
|
+
"columns": ["expires_at"],
|
|
960
921
|
"isUnique": false
|
|
961
922
|
}
|
|
962
923
|
},
|
|
@@ -965,22 +926,15 @@
|
|
|
965
926
|
"name": "codes_tenant_id_tenants_id_fk",
|
|
966
927
|
"tableFrom": "codes",
|
|
967
928
|
"tableTo": "tenants",
|
|
968
|
-
"columnsFrom": [
|
|
969
|
-
|
|
970
|
-
],
|
|
971
|
-
"columnsTo": [
|
|
972
|
-
"id"
|
|
973
|
-
],
|
|
929
|
+
"columnsFrom": ["tenant_id"],
|
|
930
|
+
"columnsTo": ["id"],
|
|
974
931
|
"onDelete": "cascade",
|
|
975
932
|
"onUpdate": "no action"
|
|
976
933
|
}
|
|
977
934
|
},
|
|
978
935
|
"compositePrimaryKeys": {
|
|
979
936
|
"PK_codes_code_id_code_type": {
|
|
980
|
-
"columns": [
|
|
981
|
-
"code_id",
|
|
982
|
-
"code_type"
|
|
983
|
-
],
|
|
937
|
+
"columns": ["code_id", "code_type"],
|
|
984
938
|
"name": "PK_codes_code_id_code_type"
|
|
985
939
|
}
|
|
986
940
|
},
|
|
@@ -1212,39 +1166,27 @@
|
|
|
1212
1166
|
"indexes": {
|
|
1213
1167
|
"login_sessions_id_index": {
|
|
1214
1168
|
"name": "login_sessions_id_index",
|
|
1215
|
-
"columns": [
|
|
1216
|
-
"id"
|
|
1217
|
-
],
|
|
1169
|
+
"columns": ["id"],
|
|
1218
1170
|
"isUnique": false
|
|
1219
1171
|
},
|
|
1220
1172
|
"login_sessions_state_idx": {
|
|
1221
1173
|
"name": "login_sessions_state_idx",
|
|
1222
|
-
"columns": [
|
|
1223
|
-
"state"
|
|
1224
|
-
],
|
|
1174
|
+
"columns": ["state"],
|
|
1225
1175
|
"isUnique": false
|
|
1226
1176
|
},
|
|
1227
1177
|
"login_sessions_state_updated_idx": {
|
|
1228
1178
|
"name": "login_sessions_state_updated_idx",
|
|
1229
|
-
"columns": [
|
|
1230
|
-
"state",
|
|
1231
|
-
"updated_at_ts"
|
|
1232
|
-
],
|
|
1179
|
+
"columns": ["state", "updated_at_ts"],
|
|
1233
1180
|
"isUnique": false
|
|
1234
1181
|
},
|
|
1235
1182
|
"login_sessions_tenant_user_idx": {
|
|
1236
1183
|
"name": "login_sessions_tenant_user_idx",
|
|
1237
|
-
"columns": [
|
|
1238
|
-
"tenant_id",
|
|
1239
|
-
"user_id"
|
|
1240
|
-
],
|
|
1184
|
+
"columns": ["tenant_id", "user_id"],
|
|
1241
1185
|
"isUnique": false
|
|
1242
1186
|
},
|
|
1243
1187
|
"idx_login_sessions_expires_at_ts": {
|
|
1244
1188
|
"name": "idx_login_sessions_expires_at_ts",
|
|
1245
|
-
"columns": [
|
|
1246
|
-
"expires_at_ts"
|
|
1247
|
-
],
|
|
1189
|
+
"columns": ["expires_at_ts"],
|
|
1248
1190
|
"isUnique": false
|
|
1249
1191
|
}
|
|
1250
1192
|
},
|
|
@@ -1253,22 +1195,15 @@
|
|
|
1253
1195
|
"name": "login_sessions_tenant_id_tenants_id_fk",
|
|
1254
1196
|
"tableFrom": "login_sessions",
|
|
1255
1197
|
"tableTo": "tenants",
|
|
1256
|
-
"columnsFrom": [
|
|
1257
|
-
|
|
1258
|
-
],
|
|
1259
|
-
"columnsTo": [
|
|
1260
|
-
"id"
|
|
1261
|
-
],
|
|
1198
|
+
"columnsFrom": ["tenant_id"],
|
|
1199
|
+
"columnsTo": ["id"],
|
|
1262
1200
|
"onDelete": "cascade",
|
|
1263
1201
|
"onUpdate": "no action"
|
|
1264
1202
|
}
|
|
1265
1203
|
},
|
|
1266
1204
|
"compositePrimaryKeys": {
|
|
1267
1205
|
"login_sessions_pk": {
|
|
1268
|
-
"columns": [
|
|
1269
|
-
"tenant_id",
|
|
1270
|
-
"id"
|
|
1271
|
-
],
|
|
1206
|
+
"columns": ["tenant_id", "id"],
|
|
1272
1207
|
"name": "login_sessions_pk"
|
|
1273
1208
|
}
|
|
1274
1209
|
},
|
|
@@ -1408,16 +1343,12 @@
|
|
|
1408
1343
|
"indexes": {
|
|
1409
1344
|
"otps_email_index": {
|
|
1410
1345
|
"name": "otps_email_index",
|
|
1411
|
-
"columns": [
|
|
1412
|
-
"email"
|
|
1413
|
-
],
|
|
1346
|
+
"columns": ["email"],
|
|
1414
1347
|
"isUnique": false
|
|
1415
1348
|
},
|
|
1416
1349
|
"otps_expires_at_index": {
|
|
1417
1350
|
"name": "otps_expires_at_index",
|
|
1418
|
-
"columns": [
|
|
1419
|
-
"expires_at"
|
|
1420
|
-
],
|
|
1351
|
+
"columns": ["expires_at"],
|
|
1421
1352
|
"isUnique": false
|
|
1422
1353
|
}
|
|
1423
1354
|
},
|
|
@@ -1426,12 +1357,8 @@
|
|
|
1426
1357
|
"name": "otps_tenant_id_tenants_id_fk",
|
|
1427
1358
|
"tableFrom": "otps",
|
|
1428
1359
|
"tableTo": "tenants",
|
|
1429
|
-
"columnsFrom": [
|
|
1430
|
-
|
|
1431
|
-
],
|
|
1432
|
-
"columnsTo": [
|
|
1433
|
-
"id"
|
|
1434
|
-
],
|
|
1360
|
+
"columnsFrom": ["tenant_id"],
|
|
1361
|
+
"columnsTo": ["id"],
|
|
1435
1362
|
"onDelete": "cascade",
|
|
1436
1363
|
"onUpdate": "no action"
|
|
1437
1364
|
}
|
|
@@ -1531,24 +1458,17 @@
|
|
|
1531
1458
|
"indexes": {
|
|
1532
1459
|
"idx_refresh_tokens_user_id": {
|
|
1533
1460
|
"name": "idx_refresh_tokens_user_id",
|
|
1534
|
-
"columns": [
|
|
1535
|
-
"tenant_id",
|
|
1536
|
-
"user_id"
|
|
1537
|
-
],
|
|
1461
|
+
"columns": ["tenant_id", "user_id"],
|
|
1538
1462
|
"isUnique": false
|
|
1539
1463
|
},
|
|
1540
1464
|
"idx_refresh_tokens_session_id": {
|
|
1541
1465
|
"name": "idx_refresh_tokens_session_id",
|
|
1542
|
-
"columns": [
|
|
1543
|
-
"session_id"
|
|
1544
|
-
],
|
|
1466
|
+
"columns": ["session_id"],
|
|
1545
1467
|
"isUnique": false
|
|
1546
1468
|
},
|
|
1547
1469
|
"idx_refresh_tokens_expires_at_ts": {
|
|
1548
1470
|
"name": "idx_refresh_tokens_expires_at_ts",
|
|
1549
|
-
"columns": [
|
|
1550
|
-
"expires_at_ts"
|
|
1551
|
-
],
|
|
1471
|
+
"columns": ["expires_at_ts"],
|
|
1552
1472
|
"isUnique": false
|
|
1553
1473
|
}
|
|
1554
1474
|
},
|
|
@@ -1557,22 +1477,15 @@
|
|
|
1557
1477
|
"name": "refresh_tokens_tenant_id_tenants_id_fk",
|
|
1558
1478
|
"tableFrom": "refresh_tokens",
|
|
1559
1479
|
"tableTo": "tenants",
|
|
1560
|
-
"columnsFrom": [
|
|
1561
|
-
|
|
1562
|
-
],
|
|
1563
|
-
"columnsTo": [
|
|
1564
|
-
"id"
|
|
1565
|
-
],
|
|
1480
|
+
"columnsFrom": ["tenant_id"],
|
|
1481
|
+
"columnsTo": ["id"],
|
|
1566
1482
|
"onDelete": "cascade",
|
|
1567
1483
|
"onUpdate": "no action"
|
|
1568
1484
|
}
|
|
1569
1485
|
},
|
|
1570
1486
|
"compositePrimaryKeys": {
|
|
1571
1487
|
"refresh_tokens_pk": {
|
|
1572
|
-
"columns": [
|
|
1573
|
-
"tenant_id",
|
|
1574
|
-
"id"
|
|
1575
|
-
],
|
|
1488
|
+
"columns": ["tenant_id", "id"],
|
|
1576
1489
|
"name": "refresh_tokens_pk"
|
|
1577
1490
|
}
|
|
1578
1491
|
},
|
|
@@ -1684,24 +1597,17 @@
|
|
|
1684
1597
|
"indexes": {
|
|
1685
1598
|
"IDX_sessions_login_session_id": {
|
|
1686
1599
|
"name": "IDX_sessions_login_session_id",
|
|
1687
|
-
"columns": [
|
|
1688
|
-
"login_session_id"
|
|
1689
|
-
],
|
|
1600
|
+
"columns": ["login_session_id"],
|
|
1690
1601
|
"isUnique": false
|
|
1691
1602
|
},
|
|
1692
1603
|
"idx_sessions_user_id": {
|
|
1693
1604
|
"name": "idx_sessions_user_id",
|
|
1694
|
-
"columns": [
|
|
1695
|
-
"tenant_id",
|
|
1696
|
-
"user_id"
|
|
1697
|
-
],
|
|
1605
|
+
"columns": ["tenant_id", "user_id"],
|
|
1698
1606
|
"isUnique": false
|
|
1699
1607
|
},
|
|
1700
1608
|
"idx_sessions_expires_at_ts": {
|
|
1701
1609
|
"name": "idx_sessions_expires_at_ts",
|
|
1702
|
-
"columns": [
|
|
1703
|
-
"expires_at_ts"
|
|
1704
|
-
],
|
|
1610
|
+
"columns": ["expires_at_ts"],
|
|
1705
1611
|
"isUnique": false
|
|
1706
1612
|
}
|
|
1707
1613
|
},
|
|
@@ -1710,22 +1616,15 @@
|
|
|
1710
1616
|
"name": "sessions_tenant_id_tenants_id_fk",
|
|
1711
1617
|
"tableFrom": "sessions",
|
|
1712
1618
|
"tableTo": "tenants",
|
|
1713
|
-
"columnsFrom": [
|
|
1714
|
-
|
|
1715
|
-
],
|
|
1716
|
-
"columnsTo": [
|
|
1717
|
-
"id"
|
|
1718
|
-
],
|
|
1619
|
+
"columnsFrom": ["tenant_id"],
|
|
1620
|
+
"columnsTo": ["id"],
|
|
1719
1621
|
"onDelete": "cascade",
|
|
1720
1622
|
"onUpdate": "no action"
|
|
1721
1623
|
}
|
|
1722
1624
|
},
|
|
1723
1625
|
"compositePrimaryKeys": {
|
|
1724
1626
|
"sessions_pk": {
|
|
1725
|
-
"columns": [
|
|
1726
|
-
"tenant_id",
|
|
1727
|
-
"id"
|
|
1728
|
-
],
|
|
1627
|
+
"columns": ["tenant_id", "id"],
|
|
1729
1628
|
"name": "sessions_pk"
|
|
1730
1629
|
}
|
|
1731
1630
|
},
|
|
@@ -1833,12 +1732,8 @@
|
|
|
1833
1732
|
"name": "tickets_tenant_id_tenants_id_fk",
|
|
1834
1733
|
"tableFrom": "tickets",
|
|
1835
1734
|
"tableTo": "tenants",
|
|
1836
|
-
"columnsFrom": [
|
|
1837
|
-
|
|
1838
|
-
],
|
|
1839
|
-
"columnsTo": [
|
|
1840
|
-
"id"
|
|
1841
|
-
],
|
|
1735
|
+
"columnsFrom": ["tenant_id"],
|
|
1736
|
+
"columnsTo": ["id"],
|
|
1842
1737
|
"onDelete": "cascade",
|
|
1843
1738
|
"onUpdate": "no action"
|
|
1844
1739
|
}
|
|
@@ -1942,9 +1837,7 @@
|
|
|
1942
1837
|
"indexes": {
|
|
1943
1838
|
"idx_client_grants_audience": {
|
|
1944
1839
|
"name": "idx_client_grants_audience",
|
|
1945
|
-
"columns": [
|
|
1946
|
-
"audience"
|
|
1947
|
-
],
|
|
1840
|
+
"columns": ["audience"],
|
|
1948
1841
|
"isUnique": false
|
|
1949
1842
|
}
|
|
1950
1843
|
},
|
|
@@ -1953,22 +1846,15 @@
|
|
|
1953
1846
|
"name": "client_grants_tenant_id_tenants_id_fk",
|
|
1954
1847
|
"tableFrom": "client_grants",
|
|
1955
1848
|
"tableTo": "tenants",
|
|
1956
|
-
"columnsFrom": [
|
|
1957
|
-
|
|
1958
|
-
],
|
|
1959
|
-
"columnsTo": [
|
|
1960
|
-
"id"
|
|
1961
|
-
],
|
|
1849
|
+
"columnsFrom": ["tenant_id"],
|
|
1850
|
+
"columnsTo": ["id"],
|
|
1962
1851
|
"onDelete": "cascade",
|
|
1963
1852
|
"onUpdate": "no action"
|
|
1964
1853
|
}
|
|
1965
1854
|
},
|
|
1966
1855
|
"compositePrimaryKeys": {
|
|
1967
1856
|
"pk_client_grants": {
|
|
1968
|
-
"columns": [
|
|
1969
|
-
"tenant_id",
|
|
1970
|
-
"id"
|
|
1971
|
-
],
|
|
1857
|
+
"columns": ["tenant_id", "id"],
|
|
1972
1858
|
"name": "pk_client_grants"
|
|
1973
1859
|
}
|
|
1974
1860
|
},
|
|
@@ -2357,22 +2243,15 @@
|
|
|
2357
2243
|
"name": "clients_tenant_id_tenants_id_fk",
|
|
2358
2244
|
"tableFrom": "clients",
|
|
2359
2245
|
"tableTo": "tenants",
|
|
2360
|
-
"columnsFrom": [
|
|
2361
|
-
|
|
2362
|
-
],
|
|
2363
|
-
"columnsTo": [
|
|
2364
|
-
"id"
|
|
2365
|
-
],
|
|
2246
|
+
"columnsFrom": ["tenant_id"],
|
|
2247
|
+
"columnsTo": ["id"],
|
|
2366
2248
|
"onDelete": "cascade",
|
|
2367
2249
|
"onUpdate": "no action"
|
|
2368
2250
|
}
|
|
2369
2251
|
},
|
|
2370
2252
|
"compositePrimaryKeys": {
|
|
2371
2253
|
"clients_tenant_id_client_id": {
|
|
2372
|
-
"columns": [
|
|
2373
|
-
"tenant_id",
|
|
2374
|
-
"client_id"
|
|
2375
|
-
],
|
|
2254
|
+
"columns": ["tenant_id", "client_id"],
|
|
2376
2255
|
"name": "clients_tenant_id_client_id"
|
|
2377
2256
|
}
|
|
2378
2257
|
},
|
|
@@ -2486,16 +2365,12 @@
|
|
|
2486
2365
|
"indexes": {
|
|
2487
2366
|
"connections_tenant_id_index": {
|
|
2488
2367
|
"name": "connections_tenant_id_index",
|
|
2489
|
-
"columns": [
|
|
2490
|
-
"tenant_id"
|
|
2491
|
-
],
|
|
2368
|
+
"columns": ["tenant_id"],
|
|
2492
2369
|
"isUnique": false
|
|
2493
2370
|
},
|
|
2494
2371
|
"connections_id_unique": {
|
|
2495
2372
|
"name": "connections_id_unique",
|
|
2496
|
-
"columns": [
|
|
2497
|
-
"id"
|
|
2498
|
-
],
|
|
2373
|
+
"columns": ["id"],
|
|
2499
2374
|
"isUnique": true
|
|
2500
2375
|
}
|
|
2501
2376
|
},
|
|
@@ -2504,22 +2379,15 @@
|
|
|
2504
2379
|
"name": "connections_tenant_id_tenants_id_fk",
|
|
2505
2380
|
"tableFrom": "connections",
|
|
2506
2381
|
"tableTo": "tenants",
|
|
2507
|
-
"columnsFrom": [
|
|
2508
|
-
|
|
2509
|
-
],
|
|
2510
|
-
"columnsTo": [
|
|
2511
|
-
"id"
|
|
2512
|
-
],
|
|
2382
|
+
"columnsFrom": ["tenant_id"],
|
|
2383
|
+
"columnsTo": ["id"],
|
|
2513
2384
|
"onDelete": "cascade",
|
|
2514
2385
|
"onUpdate": "no action"
|
|
2515
2386
|
}
|
|
2516
2387
|
},
|
|
2517
2388
|
"compositePrimaryKeys": {
|
|
2518
2389
|
"connections_tenant_id_id_pk": {
|
|
2519
|
-
"columns": [
|
|
2520
|
-
"tenant_id",
|
|
2521
|
-
"id"
|
|
2522
|
-
],
|
|
2390
|
+
"columns": ["tenant_id", "id"],
|
|
2523
2391
|
"name": "connections_tenant_id_id_pk"
|
|
2524
2392
|
}
|
|
2525
2393
|
},
|
|
@@ -2627,12 +2495,8 @@
|
|
|
2627
2495
|
"name": "custom_domains_tenant_id_tenants_id_fk",
|
|
2628
2496
|
"tableFrom": "custom_domains",
|
|
2629
2497
|
"tableTo": "tenants",
|
|
2630
|
-
"columnsFrom": [
|
|
2631
|
-
|
|
2632
|
-
],
|
|
2633
|
-
"columnsTo": [
|
|
2634
|
-
"id"
|
|
2635
|
-
],
|
|
2498
|
+
"columnsFrom": ["tenant_id"],
|
|
2499
|
+
"columnsTo": ["id"],
|
|
2636
2500
|
"onDelete": "cascade",
|
|
2637
2501
|
"onUpdate": "no action"
|
|
2638
2502
|
}
|
|
@@ -2714,12 +2578,8 @@
|
|
|
2714
2578
|
"name": "domains_tenant_id_tenants_id_fk",
|
|
2715
2579
|
"tableFrom": "domains",
|
|
2716
2580
|
"tableTo": "tenants",
|
|
2717
|
-
"columnsFrom": [
|
|
2718
|
-
|
|
2719
|
-
],
|
|
2720
|
-
"columnsTo": [
|
|
2721
|
-
"id"
|
|
2722
|
-
],
|
|
2581
|
+
"columnsFrom": ["tenant_id"],
|
|
2582
|
+
"columnsTo": ["id"],
|
|
2723
2583
|
"onDelete": "cascade",
|
|
2724
2584
|
"onUpdate": "no action"
|
|
2725
2585
|
}
|
|
@@ -2847,31 +2707,22 @@
|
|
|
2847
2707
|
"indexes": {
|
|
2848
2708
|
"idx_invites_tenant_id": {
|
|
2849
2709
|
"name": "idx_invites_tenant_id",
|
|
2850
|
-
"columns": [
|
|
2851
|
-
"tenant_id"
|
|
2852
|
-
],
|
|
2710
|
+
"columns": ["tenant_id"],
|
|
2853
2711
|
"isUnique": false
|
|
2854
2712
|
},
|
|
2855
2713
|
"idx_invites_organization_id": {
|
|
2856
2714
|
"name": "idx_invites_organization_id",
|
|
2857
|
-
"columns": [
|
|
2858
|
-
"organization_id"
|
|
2859
|
-
],
|
|
2715
|
+
"columns": ["organization_id"],
|
|
2860
2716
|
"isUnique": false
|
|
2861
2717
|
},
|
|
2862
2718
|
"idx_invites_expires_at": {
|
|
2863
2719
|
"name": "idx_invites_expires_at",
|
|
2864
|
-
"columns": [
|
|
2865
|
-
"expires_at"
|
|
2866
|
-
],
|
|
2720
|
+
"columns": ["expires_at"],
|
|
2867
2721
|
"isUnique": false
|
|
2868
2722
|
},
|
|
2869
2723
|
"idx_invites_tenant_created": {
|
|
2870
2724
|
"name": "idx_invites_tenant_created",
|
|
2871
|
-
"columns": [
|
|
2872
|
-
"tenant_id",
|
|
2873
|
-
"created_at"
|
|
2874
|
-
],
|
|
2725
|
+
"columns": ["tenant_id", "created_at"],
|
|
2875
2726
|
"isUnique": false
|
|
2876
2727
|
}
|
|
2877
2728
|
},
|
|
@@ -2957,9 +2808,7 @@
|
|
|
2957
2808
|
"indexes": {
|
|
2958
2809
|
"idx_organizations_tenant_id": {
|
|
2959
2810
|
"name": "idx_organizations_tenant_id",
|
|
2960
|
-
"columns": [
|
|
2961
|
-
"tenant_id"
|
|
2962
|
-
],
|
|
2811
|
+
"columns": ["tenant_id"],
|
|
2963
2812
|
"isUnique": false
|
|
2964
2813
|
}
|
|
2965
2814
|
},
|
|
@@ -3017,32 +2866,22 @@
|
|
|
3017
2866
|
"indexes": {
|
|
3018
2867
|
"user_organizations_unique": {
|
|
3019
2868
|
"name": "user_organizations_unique",
|
|
3020
|
-
"columns": [
|
|
3021
|
-
"tenant_id",
|
|
3022
|
-
"user_id",
|
|
3023
|
-
"organization_id"
|
|
3024
|
-
],
|
|
2869
|
+
"columns": ["tenant_id", "user_id", "organization_id"],
|
|
3025
2870
|
"isUnique": true
|
|
3026
2871
|
},
|
|
3027
2872
|
"idx_user_organizations_tenant_id": {
|
|
3028
2873
|
"name": "idx_user_organizations_tenant_id",
|
|
3029
|
-
"columns": [
|
|
3030
|
-
"tenant_id"
|
|
3031
|
-
],
|
|
2874
|
+
"columns": ["tenant_id"],
|
|
3032
2875
|
"isUnique": false
|
|
3033
2876
|
},
|
|
3034
2877
|
"idx_user_organizations_user_id": {
|
|
3035
2878
|
"name": "idx_user_organizations_user_id",
|
|
3036
|
-
"columns": [
|
|
3037
|
-
"user_id"
|
|
3038
|
-
],
|
|
2879
|
+
"columns": ["user_id"],
|
|
3039
2880
|
"isUnique": false
|
|
3040
2881
|
},
|
|
3041
2882
|
"idx_user_organizations_organization_id": {
|
|
3042
2883
|
"name": "idx_user_organizations_organization_id",
|
|
3043
|
-
"columns": [
|
|
3044
|
-
"organization_id"
|
|
3045
|
-
],
|
|
2884
|
+
"columns": ["organization_id"],
|
|
3046
2885
|
"isUnique": false
|
|
3047
2886
|
}
|
|
3048
2887
|
},
|
|
@@ -3179,10 +3018,7 @@
|
|
|
3179
3018
|
"foreignKeys": {},
|
|
3180
3019
|
"compositePrimaryKeys": {
|
|
3181
3020
|
"resource_servers_pk": {
|
|
3182
|
-
"columns": [
|
|
3183
|
-
"tenant_id",
|
|
3184
|
-
"id"
|
|
3185
|
-
],
|
|
3021
|
+
"columns": ["tenant_id", "id"],
|
|
3186
3022
|
"name": "resource_servers_pk"
|
|
3187
3023
|
}
|
|
3188
3024
|
},
|
|
@@ -3231,10 +3067,7 @@
|
|
|
3231
3067
|
"indexes": {
|
|
3232
3068
|
"role_permissions_role_fk": {
|
|
3233
3069
|
"name": "role_permissions_role_fk",
|
|
3234
|
-
"columns": [
|
|
3235
|
-
"tenant_id",
|
|
3236
|
-
"role_id"
|
|
3237
|
-
],
|
|
3070
|
+
"columns": ["tenant_id", "role_id"],
|
|
3238
3071
|
"isUnique": false
|
|
3239
3072
|
},
|
|
3240
3073
|
"role_permissions_permission_fk": {
|
|
@@ -3327,10 +3160,7 @@
|
|
|
3327
3160
|
"foreignKeys": {},
|
|
3328
3161
|
"compositePrimaryKeys": {
|
|
3329
3162
|
"roles_pk": {
|
|
3330
|
-
"columns": [
|
|
3331
|
-
"tenant_id",
|
|
3332
|
-
"id"
|
|
3333
|
-
],
|
|
3163
|
+
"columns": ["tenant_id", "id"],
|
|
3334
3164
|
"name": "roles_pk"
|
|
3335
3165
|
}
|
|
3336
3166
|
},
|
|
@@ -3387,10 +3217,7 @@
|
|
|
3387
3217
|
"indexes": {
|
|
3388
3218
|
"user_permissions_user_fk": {
|
|
3389
3219
|
"name": "user_permissions_user_fk",
|
|
3390
|
-
"columns": [
|
|
3391
|
-
"tenant_id",
|
|
3392
|
-
"user_id"
|
|
3393
|
-
],
|
|
3220
|
+
"columns": ["tenant_id", "user_id"],
|
|
3394
3221
|
"isUnique": false
|
|
3395
3222
|
},
|
|
3396
3223
|
"user_permissions_permission_fk": {
|
|
@@ -3404,9 +3231,7 @@
|
|
|
3404
3231
|
},
|
|
3405
3232
|
"user_permissions_organization_fk": {
|
|
3406
3233
|
"name": "user_permissions_organization_fk",
|
|
3407
|
-
"columns": [
|
|
3408
|
-
"organization_id"
|
|
3409
|
-
],
|
|
3234
|
+
"columns": ["organization_id"],
|
|
3410
3235
|
"isUnique": false
|
|
3411
3236
|
}
|
|
3412
3237
|
},
|
|
@@ -3469,37 +3294,24 @@
|
|
|
3469
3294
|
"indexes": {
|
|
3470
3295
|
"user_roles_user_fk": {
|
|
3471
3296
|
"name": "user_roles_user_fk",
|
|
3472
|
-
"columns": [
|
|
3473
|
-
"tenant_id",
|
|
3474
|
-
"user_id"
|
|
3475
|
-
],
|
|
3297
|
+
"columns": ["tenant_id", "user_id"],
|
|
3476
3298
|
"isUnique": false
|
|
3477
3299
|
},
|
|
3478
3300
|
"user_roles_role_fk": {
|
|
3479
3301
|
"name": "user_roles_role_fk",
|
|
3480
|
-
"columns": [
|
|
3481
|
-
"tenant_id",
|
|
3482
|
-
"role_id"
|
|
3483
|
-
],
|
|
3302
|
+
"columns": ["tenant_id", "role_id"],
|
|
3484
3303
|
"isUnique": false
|
|
3485
3304
|
},
|
|
3486
3305
|
"user_roles_organization_fk": {
|
|
3487
3306
|
"name": "user_roles_organization_fk",
|
|
3488
|
-
"columns": [
|
|
3489
|
-
"organization_id"
|
|
3490
|
-
],
|
|
3307
|
+
"columns": ["organization_id"],
|
|
3491
3308
|
"isUnique": false
|
|
3492
3309
|
}
|
|
3493
3310
|
},
|
|
3494
3311
|
"foreignKeys": {},
|
|
3495
3312
|
"compositePrimaryKeys": {
|
|
3496
3313
|
"user_roles_pk": {
|
|
3497
|
-
"columns": [
|
|
3498
|
-
"tenant_id",
|
|
3499
|
-
"user_id",
|
|
3500
|
-
"role_id",
|
|
3501
|
-
"organization_id"
|
|
3502
|
-
],
|
|
3314
|
+
"columns": ["tenant_id", "user_id", "role_id", "organization_id"],
|
|
3503
3315
|
"name": "user_roles_pk"
|
|
3504
3316
|
}
|
|
3505
3317
|
},
|
|
@@ -3579,12 +3391,8 @@
|
|
|
3579
3391
|
"name": "branding_tenant_id_tenants_id_fk",
|
|
3580
3392
|
"tableFrom": "branding",
|
|
3581
3393
|
"tableTo": "tenants",
|
|
3582
|
-
"columnsFrom": [
|
|
3583
|
-
|
|
3584
|
-
],
|
|
3585
|
-
"columnsTo": [
|
|
3586
|
-
"id"
|
|
3587
|
-
],
|
|
3394
|
+
"columnsFrom": ["tenant_id"],
|
|
3395
|
+
"columnsTo": ["id"],
|
|
3588
3396
|
"onDelete": "cascade",
|
|
3589
3397
|
"onUpdate": "no action"
|
|
3590
3398
|
}
|
|
@@ -3645,23 +3453,15 @@
|
|
|
3645
3453
|
"name": "custom_text_tenant_id_tenants_id_fk",
|
|
3646
3454
|
"tableFrom": "custom_text",
|
|
3647
3455
|
"tableTo": "tenants",
|
|
3648
|
-
"columnsFrom": [
|
|
3649
|
-
|
|
3650
|
-
],
|
|
3651
|
-
"columnsTo": [
|
|
3652
|
-
"id"
|
|
3653
|
-
],
|
|
3456
|
+
"columnsFrom": ["tenant_id"],
|
|
3457
|
+
"columnsTo": ["id"],
|
|
3654
3458
|
"onDelete": "cascade",
|
|
3655
3459
|
"onUpdate": "no action"
|
|
3656
3460
|
}
|
|
3657
3461
|
},
|
|
3658
3462
|
"compositePrimaryKeys": {
|
|
3659
3463
|
"custom_text_tenant_id_prompt_language_pk": {
|
|
3660
|
-
"columns": [
|
|
3661
|
-
"tenant_id",
|
|
3662
|
-
"prompt",
|
|
3663
|
-
"language"
|
|
3664
|
-
],
|
|
3464
|
+
"columns": ["tenant_id", "prompt", "language"],
|
|
3665
3465
|
"name": "custom_text_tenant_id_prompt_language_pk"
|
|
3666
3466
|
}
|
|
3667
3467
|
},
|
|
@@ -3785,9 +3585,7 @@
|
|
|
3785
3585
|
"indexes": {
|
|
3786
3586
|
"flows_tenant_id_idx": {
|
|
3787
3587
|
"name": "flows_tenant_id_idx",
|
|
3788
|
-
"columns": [
|
|
3789
|
-
"tenant_id"
|
|
3790
|
-
],
|
|
3588
|
+
"columns": ["tenant_id"],
|
|
3791
3589
|
"isUnique": false
|
|
3792
3590
|
}
|
|
3793
3591
|
},
|
|
@@ -3796,12 +3594,8 @@
|
|
|
3796
3594
|
"name": "flows_tenant_id_tenants_id_fk",
|
|
3797
3595
|
"tableFrom": "flows",
|
|
3798
3596
|
"tableTo": "tenants",
|
|
3799
|
-
"columnsFrom": [
|
|
3800
|
-
|
|
3801
|
-
],
|
|
3802
|
-
"columnsTo": [
|
|
3803
|
-
"id"
|
|
3804
|
-
],
|
|
3597
|
+
"columnsFrom": ["tenant_id"],
|
|
3598
|
+
"columnsTo": ["id"],
|
|
3805
3599
|
"onDelete": "cascade",
|
|
3806
3600
|
"onUpdate": "no action"
|
|
3807
3601
|
}
|
|
@@ -3901,9 +3695,7 @@
|
|
|
3901
3695
|
"indexes": {
|
|
3902
3696
|
"forms_tenant_id_idx": {
|
|
3903
3697
|
"name": "forms_tenant_id_idx",
|
|
3904
|
-
"columns": [
|
|
3905
|
-
"tenant_id"
|
|
3906
|
-
],
|
|
3698
|
+
"columns": ["tenant_id"],
|
|
3907
3699
|
"isUnique": false
|
|
3908
3700
|
}
|
|
3909
3701
|
},
|
|
@@ -3912,12 +3704,8 @@
|
|
|
3912
3704
|
"name": "forms_tenant_id_tenants_id_fk",
|
|
3913
3705
|
"tableFrom": "forms",
|
|
3914
3706
|
"tableTo": "tenants",
|
|
3915
|
-
"columnsFrom": [
|
|
3916
|
-
|
|
3917
|
-
],
|
|
3918
|
-
"columnsTo": [
|
|
3919
|
-
"id"
|
|
3920
|
-
],
|
|
3707
|
+
"columnsFrom": ["tenant_id"],
|
|
3708
|
+
"columnsTo": ["id"],
|
|
3921
3709
|
"onDelete": "cascade",
|
|
3922
3710
|
"onUpdate": "no action"
|
|
3923
3711
|
}
|
|
@@ -4014,12 +3802,8 @@
|
|
|
4014
3802
|
"name": "hooks_tenant_id_tenants_id_fk",
|
|
4015
3803
|
"tableFrom": "hooks",
|
|
4016
3804
|
"tableTo": "tenants",
|
|
4017
|
-
"columnsFrom": [
|
|
4018
|
-
|
|
4019
|
-
],
|
|
4020
|
-
"columnsTo": [
|
|
4021
|
-
"id"
|
|
4022
|
-
],
|
|
3805
|
+
"columnsFrom": ["tenant_id"],
|
|
3806
|
+
"columnsTo": ["id"],
|
|
4023
3807
|
"onDelete": "cascade",
|
|
4024
3808
|
"onUpdate": "no action"
|
|
4025
3809
|
}
|
|
@@ -4123,12 +3907,8 @@
|
|
|
4123
3907
|
"name": "keys_tenant_id_tenants_id_fk",
|
|
4124
3908
|
"tableFrom": "keys",
|
|
4125
3909
|
"tableTo": "tenants",
|
|
4126
|
-
"columnsFrom": [
|
|
4127
|
-
|
|
4128
|
-
],
|
|
4129
|
-
"columnsTo": [
|
|
4130
|
-
"id"
|
|
4131
|
-
],
|
|
3910
|
+
"columnsFrom": ["tenant_id"],
|
|
3911
|
+
"columnsTo": ["id"],
|
|
4132
3912
|
"onDelete": "cascade",
|
|
4133
3913
|
"onUpdate": "no action"
|
|
4134
3914
|
},
|
|
@@ -4136,12 +3916,8 @@
|
|
|
4136
3916
|
"name": "keys_connection_connections_id_fk",
|
|
4137
3917
|
"tableFrom": "keys",
|
|
4138
3918
|
"tableTo": "connections",
|
|
4139
|
-
"columnsFrom": [
|
|
4140
|
-
|
|
4141
|
-
],
|
|
4142
|
-
"columnsTo": [
|
|
4143
|
-
"id"
|
|
4144
|
-
],
|
|
3919
|
+
"columnsFrom": ["connection"],
|
|
3920
|
+
"columnsTo": ["id"],
|
|
4145
3921
|
"onDelete": "cascade",
|
|
4146
3922
|
"onUpdate": "no action"
|
|
4147
3923
|
}
|
|
@@ -4598,9 +4374,7 @@
|
|
|
4598
4374
|
"indexes": {
|
|
4599
4375
|
"themes_tenant_id_idx": {
|
|
4600
4376
|
"name": "themes_tenant_id_idx",
|
|
4601
|
-
"columns": [
|
|
4602
|
-
"tenant_id"
|
|
4603
|
-
],
|
|
4377
|
+
"columns": ["tenant_id"],
|
|
4604
4378
|
"isUnique": false
|
|
4605
4379
|
}
|
|
4606
4380
|
},
|
|
@@ -4609,22 +4383,15 @@
|
|
|
4609
4383
|
"name": "themes_tenant_id_tenants_id_fk",
|
|
4610
4384
|
"tableFrom": "themes",
|
|
4611
4385
|
"tableTo": "tenants",
|
|
4612
|
-
"columnsFrom": [
|
|
4613
|
-
|
|
4614
|
-
],
|
|
4615
|
-
"columnsTo": [
|
|
4616
|
-
"id"
|
|
4617
|
-
],
|
|
4386
|
+
"columnsFrom": ["tenant_id"],
|
|
4387
|
+
"columnsTo": ["id"],
|
|
4618
4388
|
"onDelete": "cascade",
|
|
4619
4389
|
"onUpdate": "no action"
|
|
4620
4390
|
}
|
|
4621
4391
|
},
|
|
4622
4392
|
"compositePrimaryKeys": {
|
|
4623
4393
|
"themes_pkey": {
|
|
4624
|
-
"columns": [
|
|
4625
|
-
"tenant_id",
|
|
4626
|
-
"themeId"
|
|
4627
|
-
],
|
|
4394
|
+
"columns": ["tenant_id", "themeId"],
|
|
4628
4395
|
"name": "themes_pkey"
|
|
4629
4396
|
}
|
|
4630
4397
|
},
|
|
@@ -4669,12 +4436,8 @@
|
|
|
4669
4436
|
"name": "universal_login_templates_tenant_id_tenants_id_fk",
|
|
4670
4437
|
"tableFrom": "universal_login_templates",
|
|
4671
4438
|
"tableTo": "tenants",
|
|
4672
|
-
"columnsFrom": [
|
|
4673
|
-
|
|
4674
|
-
],
|
|
4675
|
-
"columnsTo": [
|
|
4676
|
-
"id"
|
|
4677
|
-
],
|
|
4439
|
+
"columnsFrom": ["tenant_id"],
|
|
4440
|
+
"columnsTo": ["id"],
|
|
4678
4441
|
"onDelete": "cascade",
|
|
4679
4442
|
"onUpdate": "no action"
|
|
4680
4443
|
}
|
|
@@ -4893,33 +4656,22 @@
|
|
|
4893
4656
|
"indexes": {
|
|
4894
4657
|
"logs_user_id": {
|
|
4895
4658
|
"name": "logs_user_id",
|
|
4896
|
-
"columns": [
|
|
4897
|
-
"user_id"
|
|
4898
|
-
],
|
|
4659
|
+
"columns": ["user_id"],
|
|
4899
4660
|
"isUnique": false
|
|
4900
4661
|
},
|
|
4901
4662
|
"logs_tenant_id": {
|
|
4902
4663
|
"name": "logs_tenant_id",
|
|
4903
|
-
"columns": [
|
|
4904
|
-
"tenant_id"
|
|
4905
|
-
],
|
|
4664
|
+
"columns": ["tenant_id"],
|
|
4906
4665
|
"isUnique": false
|
|
4907
4666
|
},
|
|
4908
4667
|
"logs_date": {
|
|
4909
4668
|
"name": "logs_date",
|
|
4910
|
-
"columns": [
|
|
4911
|
-
"date"
|
|
4912
|
-
],
|
|
4669
|
+
"columns": ["date"],
|
|
4913
4670
|
"isUnique": false
|
|
4914
4671
|
},
|
|
4915
4672
|
"IDX_logs_tenant_date_type_user": {
|
|
4916
4673
|
"name": "IDX_logs_tenant_date_type_user",
|
|
4917
|
-
"columns": [
|
|
4918
|
-
"tenant_id",
|
|
4919
|
-
"date",
|
|
4920
|
-
"type",
|
|
4921
|
-
"user_id"
|
|
4922
|
-
],
|
|
4674
|
+
"columns": ["tenant_id", "date", "type", "user_id"],
|
|
4923
4675
|
"isUnique": false
|
|
4924
4676
|
}
|
|
4925
4677
|
},
|
|
@@ -4939,4 +4691,4 @@
|
|
|
4939
4691
|
"internal": {
|
|
4940
4692
|
"indexes": {}
|
|
4941
4693
|
}
|
|
4942
|
-
}
|
|
4694
|
+
}
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"type": "git",
|
|
12
12
|
"url": "https://github.com/markusahlstrand/authhero"
|
|
13
13
|
},
|
|
14
|
-
"version": "0.
|
|
14
|
+
"version": "0.27.0",
|
|
15
15
|
"files": [
|
|
16
16
|
"dist",
|
|
17
17
|
"src/schema",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"drizzle-orm": "^0.44.2",
|
|
44
|
-
"@authhero/adapter-interfaces": "0.
|
|
44
|
+
"@authhero/adapter-interfaces": "0.142.0"
|
|
45
45
|
},
|
|
46
46
|
"scripts": {
|
|
47
47
|
"build": "tsc && vite build",
|
|
@@ -26,14 +26,17 @@ export const branding = sqliteTable("branding", {
|
|
|
26
26
|
colors_page_background_angle_dev: integer("colors_page_background_angle_dev"),
|
|
27
27
|
});
|
|
28
28
|
|
|
29
|
-
export const universalLoginTemplates = sqliteTable(
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
29
|
+
export const universalLoginTemplates = sqliteTable(
|
|
30
|
+
"universal_login_templates",
|
|
31
|
+
{
|
|
32
|
+
tenant_id: text("tenant_id", { length: 191 })
|
|
33
|
+
.primaryKey()
|
|
34
|
+
.references(() => tenants.id, { onDelete: "cascade" }),
|
|
35
|
+
body: text("body").notNull(),
|
|
36
|
+
created_at_ts: integer("created_at_ts").notNull(),
|
|
37
|
+
updated_at_ts: integer("updated_at_ts").notNull(),
|
|
38
|
+
},
|
|
39
|
+
);
|
|
37
40
|
|
|
38
41
|
export const themes = sqliteTable(
|
|
39
42
|
"themes",
|
|
@@ -284,5 +287,7 @@ export const customText = sqliteTable(
|
|
|
284
287
|
created_at_ts: integer("created_at_ts").notNull(),
|
|
285
288
|
updated_at_ts: integer("updated_at_ts").notNull(),
|
|
286
289
|
},
|
|
287
|
-
(table) => [
|
|
290
|
+
(table) => [
|
|
291
|
+
primaryKey({ columns: [table.tenant_id, table.prompt, table.language] }),
|
|
292
|
+
],
|
|
288
293
|
);
|
|
@@ -1,76 +1,118 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
sqliteTable,
|
|
3
|
+
text,
|
|
4
|
+
integer,
|
|
5
|
+
primaryKey,
|
|
6
|
+
index,
|
|
7
|
+
} from "drizzle-orm/sqlite-core";
|
|
2
8
|
import { tenants } from "./tenants";
|
|
3
9
|
|
|
4
|
-
export const clients = sqliteTable(
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
10
|
+
export const clients = sqliteTable(
|
|
11
|
+
"clients",
|
|
12
|
+
{
|
|
13
|
+
client_id: text("client_id", { length: 191 }).notNull(),
|
|
14
|
+
tenant_id: text("tenant_id", { length: 191 })
|
|
15
|
+
.notNull()
|
|
16
|
+
.references(() => tenants.id, { onDelete: "cascade" }),
|
|
17
|
+
name: text("name", { length: 255 }).notNull(),
|
|
18
|
+
description: text("description", { length: 140 }),
|
|
19
|
+
global: integer("global").notNull().default(0),
|
|
20
|
+
client_secret: text("client_secret", { length: 255 }),
|
|
21
|
+
app_type: text("app_type", { length: 64 }).default("regular_web"),
|
|
22
|
+
logo_uri: text("logo_uri", { length: 2083 }),
|
|
23
|
+
is_first_party: integer("is_first_party").notNull().default(0),
|
|
24
|
+
oidc_conformant: integer("oidc_conformant").notNull().default(1),
|
|
25
|
+
auth0_conformant: integer("auth0_conformant").notNull().default(1),
|
|
26
|
+
callbacks: text("callbacks").notNull(),
|
|
27
|
+
allowed_origins: text("allowed_origins").notNull(),
|
|
28
|
+
web_origins: text("web_origins").notNull(),
|
|
29
|
+
client_aliases: text("client_aliases").notNull(),
|
|
30
|
+
allowed_clients: text("allowed_clients").notNull(),
|
|
31
|
+
allowed_logout_urls: text("allowed_logout_urls").notNull(),
|
|
32
|
+
session_transfer: text("session_transfer").notNull(),
|
|
33
|
+
oidc_logout: text("oidc_logout").notNull(),
|
|
34
|
+
grant_types: text("grant_types").notNull(),
|
|
35
|
+
jwt_configuration: text("jwt_configuration").notNull(),
|
|
36
|
+
signing_keys: text("signing_keys").notNull(),
|
|
37
|
+
encryption_key: text("encryption_key").notNull(),
|
|
38
|
+
sso: integer("sso").notNull().default(0),
|
|
39
|
+
sso_disabled: integer("sso_disabled").notNull().default(1),
|
|
40
|
+
cross_origin_authentication: integer("cross_origin_authentication")
|
|
41
|
+
.notNull()
|
|
42
|
+
.default(0),
|
|
43
|
+
cross_origin_loc: text("cross_origin_loc", { length: 2083 }),
|
|
44
|
+
custom_login_page_on: integer("custom_login_page_on").notNull().default(0),
|
|
45
|
+
custom_login_page: text("custom_login_page"),
|
|
46
|
+
custom_login_page_preview: text("custom_login_page_preview"),
|
|
47
|
+
form_template: text("form_template"),
|
|
48
|
+
addons: text("addons").notNull(),
|
|
49
|
+
token_endpoint_auth_method: text("token_endpoint_auth_method", {
|
|
50
|
+
length: 64,
|
|
51
|
+
}).default("client_secret_basic"),
|
|
52
|
+
client_metadata: text("client_metadata").notNull(),
|
|
53
|
+
mobile: text("mobile").notNull(),
|
|
54
|
+
initiate_login_uri: text("initiate_login_uri", { length: 2083 }),
|
|
55
|
+
native_social_login: text("native_social_login").notNull(),
|
|
56
|
+
refresh_token: text("refresh_token").notNull(),
|
|
57
|
+
default_organization: text("default_organization").notNull(),
|
|
58
|
+
organization_usage: text("organization_usage", { length: 32 }).default(
|
|
59
|
+
"deny",
|
|
60
|
+
),
|
|
61
|
+
organization_require_behavior: text("organization_require_behavior", {
|
|
62
|
+
length: 32,
|
|
63
|
+
}).default("no_prompt"),
|
|
64
|
+
client_authentication_methods: text(
|
|
65
|
+
"client_authentication_methods",
|
|
66
|
+
).notNull(),
|
|
67
|
+
require_pushed_authorization_requests: integer(
|
|
68
|
+
"require_pushed_authorization_requests",
|
|
69
|
+
)
|
|
70
|
+
.notNull()
|
|
71
|
+
.default(0),
|
|
72
|
+
require_proof_of_possession: integer("require_proof_of_possession")
|
|
73
|
+
.notNull()
|
|
74
|
+
.default(0),
|
|
75
|
+
signed_request_object: text("signed_request_object").notNull(),
|
|
76
|
+
compliance_level: text("compliance_level", { length: 64 }),
|
|
77
|
+
par_request_expiry: integer("par_request_expiry"),
|
|
78
|
+
token_quota: text("token_quota").notNull(),
|
|
79
|
+
created_at: text("created_at", { length: 35 }).notNull(),
|
|
80
|
+
updated_at: text("updated_at", { length: 35 }).notNull(),
|
|
81
|
+
connections: text("connections").notNull().default("[]"),
|
|
82
|
+
},
|
|
83
|
+
(table) => [
|
|
84
|
+
primaryKey({
|
|
85
|
+
columns: [table.tenant_id, table.client_id],
|
|
86
|
+
name: "clients_tenant_id_client_id",
|
|
87
|
+
}),
|
|
88
|
+
],
|
|
89
|
+
);
|
|
59
90
|
|
|
60
|
-
export const clientGrants = sqliteTable(
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
91
|
+
export const clientGrants = sqliteTable(
|
|
92
|
+
"client_grants",
|
|
93
|
+
{
|
|
94
|
+
id: text("id", { length: 21 }).notNull(),
|
|
95
|
+
tenant_id: text("tenant_id", { length: 191 })
|
|
96
|
+
.notNull()
|
|
97
|
+
.references(() => tenants.id, { onDelete: "cascade" }),
|
|
98
|
+
client_id: text("client_id", { length: 191 }).notNull(),
|
|
99
|
+
audience: text("audience", { length: 191 }).notNull(),
|
|
100
|
+
scope: text("scope").default("[]"),
|
|
101
|
+
organization_usage: text("organization_usage", { length: 32 }),
|
|
102
|
+
allow_any_organization: integer("allow_any_organization").default(0),
|
|
103
|
+
is_system: integer("is_system").default(0),
|
|
104
|
+
subject_type: text("subject_type", { length: 32 }),
|
|
105
|
+
authorization_details_types: text("authorization_details_types").default(
|
|
106
|
+
"[]",
|
|
107
|
+
),
|
|
108
|
+
created_at: text("created_at", { length: 35 }).notNull(),
|
|
109
|
+
updated_at: text("updated_at", { length: 35 }).notNull(),
|
|
110
|
+
},
|
|
111
|
+
(table) => [
|
|
112
|
+
primaryKey({
|
|
113
|
+
columns: [table.tenant_id, table.id],
|
|
114
|
+
name: "pk_client_grants",
|
|
115
|
+
}),
|
|
116
|
+
index("idx_client_grants_audience").on(table.audience),
|
|
117
|
+
],
|
|
118
|
+
);
|
|
@@ -1,54 +1,74 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
sqliteTable,
|
|
3
|
+
text,
|
|
4
|
+
integer,
|
|
5
|
+
uniqueIndex,
|
|
6
|
+
index,
|
|
7
|
+
} from "drizzle-orm/sqlite-core";
|
|
2
8
|
|
|
3
|
-
export const organizations = sqliteTable(
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
9
|
+
export const organizations = sqliteTable(
|
|
10
|
+
"organizations",
|
|
11
|
+
{
|
|
12
|
+
id: text("id", { length: 21 }).primaryKey(),
|
|
13
|
+
tenant_id: text("tenant_id", { length: 191 }).notNull(),
|
|
14
|
+
name: text("name", { length: 256 }).notNull(),
|
|
15
|
+
display_name: text("display_name", { length: 256 }),
|
|
16
|
+
branding: text("branding"),
|
|
17
|
+
metadata: text("metadata"),
|
|
18
|
+
enabled_connections: text("enabled_connections"),
|
|
19
|
+
token_quota: text("token_quota"),
|
|
20
|
+
created_at: text("created_at", { length: 35 }).notNull(),
|
|
21
|
+
updated_at: text("updated_at", { length: 35 }).notNull(),
|
|
22
|
+
},
|
|
23
|
+
(table) => [index("idx_organizations_tenant_id").on(table.tenant_id)],
|
|
24
|
+
);
|
|
17
25
|
|
|
18
|
-
export const userOrganizations = sqliteTable(
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
26
|
+
export const userOrganizations = sqliteTable(
|
|
27
|
+
"user_organizations",
|
|
28
|
+
{
|
|
29
|
+
id: text("id", { length: 21 }).primaryKey(),
|
|
30
|
+
tenant_id: text("tenant_id", { length: 191 }).notNull(),
|
|
31
|
+
user_id: text("user_id", { length: 191 }).notNull(),
|
|
32
|
+
organization_id: text("organization_id", { length: 21 }).notNull(),
|
|
33
|
+
created_at: text("created_at", { length: 35 }).notNull(),
|
|
34
|
+
updated_at: text("updated_at", { length: 35 }).notNull(),
|
|
35
|
+
},
|
|
36
|
+
(table) => [
|
|
37
|
+
uniqueIndex("user_organizations_unique").on(
|
|
38
|
+
table.tenant_id,
|
|
39
|
+
table.user_id,
|
|
40
|
+
table.organization_id,
|
|
41
|
+
),
|
|
42
|
+
index("idx_user_organizations_tenant_id").on(table.tenant_id),
|
|
43
|
+
index("idx_user_organizations_user_id").on(table.user_id),
|
|
44
|
+
index("idx_user_organizations_organization_id").on(table.organization_id),
|
|
45
|
+
],
|
|
46
|
+
);
|
|
31
47
|
|
|
32
|
-
export const invites = sqliteTable(
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
48
|
+
export const invites = sqliteTable(
|
|
49
|
+
"invites",
|
|
50
|
+
{
|
|
51
|
+
id: text("id", { length: 21 }).primaryKey(),
|
|
52
|
+
tenant_id: text("tenant_id", { length: 191 }).notNull(),
|
|
53
|
+
organization_id: text("organization_id", { length: 21 }).notNull(),
|
|
54
|
+
inviter: text("inviter").notNull(),
|
|
55
|
+
invitee: text("invitee").notNull(),
|
|
56
|
+
client_id: text("client_id", { length: 191 }).notNull(),
|
|
57
|
+
connection_id: text("connection_id", { length: 21 }),
|
|
58
|
+
invitation_url: text("invitation_url").notNull(),
|
|
59
|
+
created_at: text("created_at", { length: 35 }).notNull(),
|
|
60
|
+
expires_at: text("expires_at", { length: 35 }).notNull(),
|
|
61
|
+
app_metadata: text("app_metadata"),
|
|
62
|
+
user_metadata: text("user_metadata"),
|
|
63
|
+
roles: text("roles"),
|
|
64
|
+
ticket_id: text("ticket_id", { length: 191 }),
|
|
65
|
+
ttl_sec: integer("ttl_sec"),
|
|
66
|
+
send_invitation_email: integer("send_invitation_email"),
|
|
67
|
+
},
|
|
68
|
+
(table) => [
|
|
69
|
+
index("idx_invites_tenant_id").on(table.tenant_id),
|
|
70
|
+
index("idx_invites_organization_id").on(table.organization_id),
|
|
71
|
+
index("idx_invites_expires_at").on(table.expires_at),
|
|
72
|
+
index("idx_invites_tenant_created").on(table.tenant_id, table.created_at),
|
|
73
|
+
],
|
|
74
|
+
);
|
|
@@ -114,7 +114,10 @@ export const loginSessions = sqliteTable(
|
|
|
114
114
|
}),
|
|
115
115
|
index("login_sessions_id_index").on(table.id),
|
|
116
116
|
index("login_sessions_state_idx").on(table.state),
|
|
117
|
-
index("login_sessions_state_updated_idx").on(
|
|
117
|
+
index("login_sessions_state_updated_idx").on(
|
|
118
|
+
table.state,
|
|
119
|
+
table.updated_at_ts,
|
|
120
|
+
),
|
|
118
121
|
index("login_sessions_tenant_user_idx").on(table.tenant_id, table.user_id),
|
|
119
122
|
index("idx_login_sessions_expires_at_ts").on(table.expires_at_ts),
|
|
120
123
|
],
|