@@ -422,22 +422,44 @@ export const polymorphic_relationships = pgTable(
422
422
} ) ,
423
423
)
424
424
425
+ export const polymorphic_relationships_locales = pgTable (
426
+ 'polymorphic_relationships_locales' ,
427
+ {
428
+ id : serial ( 'id' ) . primaryKey ( ) ,
429
+ _locale : enum__locales ( '_locale' ) . notNull ( ) ,
430
+ _parentID : integer ( '_parent_id' ) . notNull ( ) ,
431
+ } ,
432
+ ( columns ) => ( {
433
+ _localeParent : uniqueIndex ( 'polymorphic_relationships_locales_locale_parent_id_unique' ) . on (
434
+ columns . _locale ,
435
+ columns . _parentID ,
436
+ ) ,
437
+ _parentIdFk : foreignKey ( {
438
+ columns : [ columns [ '_parentID' ] ] ,
439
+ foreignColumns : [ polymorphic_relationships . id ] ,
440
+ name : 'polymorphic_relationships_locales_parent_id_fk' ,
441
+ } ) . onDelete ( 'cascade' ) ,
442
+ } ) ,
443
+ )
444
+
425
445
export const polymorphic_relationships_rels = pgTable (
426
446
'polymorphic_relationships_rels' ,
427
447
{
428
448
id : serial ( 'id' ) . primaryKey ( ) ,
429
449
order : integer ( 'order' ) ,
430
450
parent : integer ( 'parent_id' ) . notNull ( ) ,
431
451
path : varchar ( 'path' ) . notNull ( ) ,
452
+ locale : enum__locales ( 'locale' ) ,
432
453
moviesID : integer ( 'movies_id' ) ,
433
454
} ,
434
455
( columns ) => ( {
435
456
order : index ( 'polymorphic_relationships_rels_order_idx' ) . on ( columns . order ) ,
436
457
parentIdx : index ( 'polymorphic_relationships_rels_parent_idx' ) . on ( columns . parent ) ,
437
458
pathIdx : index ( 'polymorphic_relationships_rels_path_idx' ) . on ( columns . path ) ,
459
+ localeIdx : index ( 'polymorphic_relationships_rels_locale_idx' ) . on ( columns . locale ) ,
438
460
polymorphic_relationships_rels_movies_id_idx : index (
439
461
'polymorphic_relationships_rels_movies_id_idx' ,
440
- ) . on ( columns . moviesID ) ,
462
+ ) . on ( columns . moviesID , columns . locale ) ,
441
463
parentFk : foreignKey ( {
442
464
columns : [ columns [ 'parent' ] ] ,
443
465
foreignColumns : [ polymorphic_relationships . id ] ,
@@ -1093,6 +1115,16 @@ export const relations_movie_reviews = relations(movie_reviews, ({ one, many })
1093
1115
relationName : '_rels' ,
1094
1116
} ) ,
1095
1117
} ) )
1118
+ export const relations_polymorphic_relationships_locales = relations (
1119
+ polymorphic_relationships_locales ,
1120
+ ( { one } ) => ( {
1121
+ _parentID : one ( polymorphic_relationships , {
1122
+ fields : [ polymorphic_relationships_locales . _parentID ] ,
1123
+ references : [ polymorphic_relationships . id ] ,
1124
+ relationName : '_locales' ,
1125
+ } ) ,
1126
+ } ) ,
1127
+ )
1096
1128
export const relations_polymorphic_relationships_rels = relations (
1097
1129
polymorphic_relationships_rels ,
1098
1130
( { one } ) => ( {
@@ -1111,6 +1143,9 @@ export const relations_polymorphic_relationships_rels = relations(
1111
1143
export const relations_polymorphic_relationships = relations (
1112
1144
polymorphic_relationships ,
1113
1145
( { many } ) => ( {
1146
+ _locales : many ( polymorphic_relationships_locales , {
1147
+ relationName : '_locales' ,
1148
+ } ) ,
1114
1149
_rels : many ( polymorphic_relationships_rels , {
1115
1150
relationName : '_rels' ,
1116
1151
} ) ,
@@ -1347,6 +1382,7 @@ type DatabaseSchema = {
1347
1382
movie_reviews : typeof movie_reviews
1348
1383
movie_reviews_rels : typeof movie_reviews_rels
1349
1384
polymorphic_relationships : typeof polymorphic_relationships
1385
+ polymorphic_relationships_locales : typeof polymorphic_relationships_locales
1350
1386
polymorphic_relationships_rels : typeof polymorphic_relationships_rels
1351
1387
tree : typeof tree
1352
1388
pages_menu : typeof pages_menu
@@ -1377,6 +1413,7 @@ type DatabaseSchema = {
1377
1413
relations_directors : typeof relations_directors
1378
1414
relations_movie_reviews_rels : typeof relations_movie_reviews_rels
1379
1415
relations_movie_reviews : typeof relations_movie_reviews
1416
+ relations_polymorphic_relationships_locales : typeof relations_polymorphic_relationships_locales
1380
1417
relations_polymorphic_relationships_rels : typeof relations_polymorphic_relationships_rels
1381
1418
relations_polymorphic_relationships : typeof relations_polymorphic_relationships
1382
1419
relations_tree : typeof relations_tree
0 commit comments