Changeset 1ebac59 for database/drizzle


Ignore:
Timestamp:
12/20/25 00:55:47 (7 months ago)
Author:
Tome <gjorgievtome@…>
Branches:
main
Children:
b69759d
Parents:
c30935a
Message:

add schema and queries

Location:
database/drizzle
Files:
3 added
3 edited

Legend:

Unmodified
Added
Removed
  • database/drizzle/schema/builds.ts

    rc30935a r1ebac59  
    33import { componentsTable } from "./components";
    44
    5 export const buildTable = pgTable("build", {
     5export const buildsTable = pgTable("build", {
    66    id: serial("id").primaryKey(),
    77    userId: integer("user_id")
     
    1515});
    1616
    17 export const buildComponentTable = pgTable("build_component", {
     17export const buildComponentsTable = pgTable("build_component", {
    1818        buildId: integer("build_id")
    1919            .notNull()
    20             .references(() => buildTable.id, { onDelete: "cascade", onUpdate: "cascade" }),
     20            .references(() => buildsTable.id, { onDelete: "cascade", onUpdate: "cascade" }),
    2121        componentId: integer("component_id")
    2222            .notNull()
     
    2828);
    2929
    30 export const favoriteBuildTable = pgTable("favorite_build", {
     30export const favoriteBuildsTable = pgTable("favorite_build", {
    3131        buildId: integer("build_id")
    3232            .notNull()
    33             .references(() => buildTable.id, { onDelete: "cascade", onUpdate: "cascade" }),
     33            .references(() => buildsTable.id, { onDelete: "cascade", onUpdate: "cascade" }),
    3434        userId: integer("user_id")
    3535            .notNull()
     
    4141);
    4242
    43 export const ratingBuildTable = pgTable("rating_build", {
     43export const ratingBuildsTable = pgTable("rating_build", {
    4444        buildId: integer("build_id")
    4545            .notNull()
    46             .references(() => buildTable.id, { onDelete: "cascade", onUpdate: "cascade" }),
     46            .references(() => buildsTable.id, { onDelete: "cascade", onUpdate: "cascade" }),
    4747        userId: integer("user_id")
    4848            .notNull()
     
    5555);
    5656
    57 export const reviewTable = pgTable("review", {
     57export const reviewsTable = pgTable("review", {
    5858    id: serial("id").primaryKey(),
    5959
    6060    buildId: integer("build_id")
    6161        .notNull()
    62         .references(() => buildTable.id, { onDelete: "cascade", onUpdate: "cascade" }),
     62        .references(() => buildsTable.id, { onDelete: "cascade", onUpdate: "cascade" }),
    6363    userId: integer("user_id")
    6464        .notNull()
     
    6868});
    6969
    70 export type buildItem = typeof buildTable.$inferSelect;
    71 export type buildInsert = typeof buildTable.$inferInsert;
     70export type buildItem = typeof buildsTable.$inferSelect;
     71export type buildInsert = typeof buildsTable.$inferInsert;
    7272
    73 export type buildComponentItem = typeof buildComponentTable.$inferSelect;
    74 export type buildComponentInsert = typeof buildComponentTable.$inferInsert;
     73export type buildComponentItem = typeof buildComponentsTable.$inferSelect;
     74export type buildComponentInsert = typeof buildComponentsTable.$inferInsert;
    7575
    76 export type favoriteBuildItem = typeof favoriteBuildTable.$inferSelect;
    77 export type favoriteBuildInsert = typeof favoriteBuildTable.$inferInsert;
     76export type favoriteBuildItem = typeof favoriteBuildsTable.$inferSelect;
     77export type favoriteBuildInsert = typeof favoriteBuildsTable.$inferInsert;
    7878
    79 export type ratingBuildItem = typeof ratingBuildTable.$inferSelect;
    80 export type ratingBuildInsert = typeof ratingBuildTable.$inferInsert;
     79export type ratingBuildItem = typeof ratingBuildsTable.$inferSelect;
     80export type ratingBuildInsert = typeof ratingBuildsTable.$inferInsert;
    8181
    82 export type reviewItem = typeof reviewTable.$inferSelect;
    83 export type reviewInsert = typeof reviewTable.$inferInsert;
     82export type reviewItem = typeof reviewsTable.$inferSelect;
     83export type reviewInsert = typeof reviewsTable.$inferInsert;
  • database/drizzle/schema/components.ts

    rc30935a r1ebac59  
    5353});
    5454
    55 export const pcCaseTable = pgTable("pc_case", {
     55export const pcCasesTable = pgTable("pc_case", {
    5656    componentId: integer("component_id")
    5757        .primaryKey()
     
    6565        caseId: integer("case_id")
    6666            .notNull()
    67             .references(() => pcCaseTable.componentId, {onDelete: "cascade", onUpdate: "cascade" }),
     67            .references(() => pcCasesTable.componentId, {onDelete: "cascade", onUpdate: "cascade" }),
    6868        formFactor: text("form_factor").notNull(),
     69        num_slots: integer("num_slots").notNull(),
    6970    },
    7071    (t) => ({
     
    7677        caseId: integer("case_id")
    7778            .notNull()
    78             .references(() => pcCaseTable.componentId, { onDelete: "cascade", onUpdate: "cascade"}),
     79            .references(() => pcCasesTable.componentId, { onDelete: "cascade", onUpdate: "cascade"}),
    7980        formFactor: text("form_factor").notNull(),
    8081    },
     
    8788        caseId: integer("case_id")
    8889            .notNull()
    89             .references(() => pcCaseTable.componentId, { onDelete: "cascade", onUpdate: "cascade"}),
     90            .references(() => pcCasesTable.componentId, { onDelete: "cascade", onUpdate: "cascade"}),
    9091        formFactor: text("form_factor").notNull(),
    9192    },
     
    9596);
    9697
    97 export const coolerTable = pgTable("cooler", {
     98export const coolersTable = pgTable("cooler", {
    9899    componentId: integer("component_id")
    99100        .primaryKey()
     
    108109        cooler_id: integer("cooler_id")
    109110            .notNull()
    110             .references(() => coolerTable.componentId, { onDelete: "cascade", onUpdate: "cascade" }),
     111            .references(() => coolersTable.componentId, { onDelete: "cascade", onUpdate: "cascade" }),
    111112        socket: text("socket").notNull(),
    112113    },
     
    116117);
    117118
    118 export const motherboardTable = pgTable("motherboard", {
     119export const motherboardsTable = pgTable("motherboard", {
    119120    componentId: integer("component_id")
    120121        .primaryKey()
     
    139140
    140141// Other Components
    141 export const memoryCardTable = pgTable("memory_card", {
     142export const memoryCardsTable = pgTable("memory_card", {
    142143    componentId: integer("component_id")
    143144        .primaryKey()
     
    147148});
    148149
    149 export const opticalDriveTable = pgTable("optical_drive", {
     150export const opticalDrivesTable = pgTable("optical_drive", {
    150151    componentId: integer("component_id")
    151152        .primaryKey()
     
    158159});
    159160
    160 export const soundCardTable = pgTable("sound_card", {
     161export const soundCardsTable = pgTable("sound_card", {
    161162    componentId: integer("component_id")
    162163        .primaryKey()
     
    166167    chipset: text("chipset").notNull(),
    167168    interface: text("interface").notNull(),
    168 });
    169 
    170 // SoundCard multi-values
    171 export const soundCardChannelsTable = pgTable("sound_card_channels", {
    172         soundCardId: integer("sound_card_id")
    173             .notNull()
    174             .references(() => soundCardTable.componentId, { onDelete: "cascade", onUpdate: "cascade" }),
    175         channel: text("channel").notNull(),
    176     },
    177     (t) => ({
    178         pk: primaryKey({ columns: [t.soundCardId, t.channel] }),
    179     })
    180 );
     169    channel: text("channel").notNull(),
     170});
    181171
    182172export const cablesTable = pgTable("cables", {
     
    188178});
    189179
    190 export const networkAdapterTable = pgTable("network_adapter", {
     180export const networkAdaptersTable = pgTable("network_adapter", {
    191181    componentId: integer("component_id")
    192182        .primaryKey()
     
    197187});
    198188
    199 export const networkCardTable = pgTable("network_card", {
     189export const networkCardsTable = pgTable("network_card", {
    200190    componentId: integer("component_id")
    201191        .primaryKey()
     
    221211export type powerSupplyInsert = typeof powerSupplyTable.$inferInsert;
    222212
    223 export type caseItem = typeof pcCaseTable.$inferSelect;
    224 export type caseInsert = typeof pcCaseTable.$inferInsert;
     213export type caseItem = typeof pcCasesTable.$inferSelect;
     214export type caseInsert = typeof pcCasesTable.$inferInsert;
    225215
    226216export type caseStorageFormFactorsItem = typeof caseStorageFormFactorsTable.$inferSelect;
     
    233223export type caseMoboFormFactorsInsert = typeof caseMoboFormFactorsTable.$inferInsert;
    234224
    235 export type coolerItem = typeof coolerTable.$inferSelect;
    236 export type coolerInsert = typeof coolerTable.$inferInsert;
     225export type coolerItem = typeof coolersTable.$inferSelect;
     226export type coolerInsert = typeof coolersTable.$inferInsert;
    237227
    238228export type coolerCPUSocketsItem = typeof coolerCPUSocketsTable.$inferSelect;
    239229export type coolerCPUSocketsInsert = typeof coolerCPUSocketsTable.$inferInsert;
    240230
    241 export type motherboardItem = typeof motherboardTable.$inferSelect;
    242 export type motherboardInsert = typeof motherboardTable.$inferInsert;
     231export type motherboardItem = typeof motherboardsTable.$inferSelect;
     232export type motherboardInsert = typeof motherboardsTable.$inferInsert;
    243233
    244234export type storageItem = typeof storageTable.$inferSelect;
    245235export type storageInsert = typeof storageTable.$inferInsert
    246236
    247 export type memoryCardItem = typeof memoryCardTable.$inferSelect;
    248 export type memoryCardInsert = typeof memoryCardTable.$inferInsert;
    249 
    250 export type opticalDriveItem = typeof opticalDriveTable.$inferSelect;
    251 export type opticalDriveInsert = typeof opticalDriveTable.$inferInsert;
    252 
    253 export type soundCardItem = typeof soundCardTable.$inferSelect;
    254 export type soundCardInsert = typeof soundCardTable.$inferInsert;
    255 
    256 export type soundCardChannelsItem = typeof soundCardChannelsTable.$inferSelect;
    257 export type soundCardChannelsInsert = typeof soundCardChannelsTable.$inferInsert;
     237export type memoryCardItem = typeof memoryCardsTable.$inferSelect;
     238export type memoryCardInsert = typeof memoryCardsTable.$inferInsert;
     239
     240export type opticalDriveItem = typeof opticalDrivesTable.$inferSelect;
     241export type opticalDriveInsert = typeof opticalDrivesTable.$inferInsert;
     242
     243export type soundCardItem = typeof soundCardsTable.$inferSelect;
     244export type soundCardInsert = typeof soundCardsTable.$inferInsert;
    258245
    259246export type cablesItem = typeof cablesTable.$inferSelect;
    260247export type cablesInsert = typeof cablesTable.$inferInsert;
    261248
    262 export type networkAdapterItem = typeof networkAdapterTable.$inferSelect;
    263 export type networkAdapterInsert = typeof networkAdapterTable.$inferInsert;
    264 
    265 export type networkCardItem = typeof networkCardTable.$inferSelect;
    266 export type networkCardInsert = typeof networkCardTable.$inferInsert;
    267 
     249export type networkAdapterItem = typeof networkAdaptersTable.$inferSelect;
     250export type networkAdapterInsert = typeof networkAdaptersTable.$inferInsert;
     251
     252export type networkCardItem = typeof networkCardsTable.$inferSelect;
     253export type networkCardInsert = typeof networkCardsTable.$inferInsert;
     254
  • database/drizzle/schema/relations.ts

    rc30935a r1ebac59  
    77    memoryTable,
    88    powerSupplyTable,
    9     pcCaseTable,
     9    pcCasesTable,
    1010    caseStorageFormFactorsTable,
    1111    casePsFormFactorsTable,
    1212    caseMoboFormFactorsTable,
    13     coolerTable,
     13    coolersTable,
    1414    coolerCPUSocketsTable,
    15     motherboardTable,
     15    motherboardsTable,
    1616    storageTable,
    17     memoryCardTable,
    18     opticalDriveTable,
    19     soundCardTable,
    20     soundCardChannelsTable,
     17    memoryCardsTable,
     18    opticalDrivesTable,
     19    soundCardsTable,
    2120    cablesTable,
    22     networkAdapterTable,
    23     networkCardTable,
     21    networkAdaptersTable,
     22    networkCardsTable,
    2423
    2524} from "./components";
    2625
    2726import {
    28     buildTable,
    29     buildComponentTable,
    30     favoriteBuildTable,
    31     ratingBuildTable,
    32     reviewTable
     27    buildsTable,
     28    buildComponentsTable,
     29    favoriteBuildsTable,
     30    ratingBuildsTable,
     31    reviewsTable
    3332} from "./builds"
    3433
     
    4039
    4140export const usersRelations = relations(usersTable, ({ many, one }) => ({
    42     builds: many(buildTable),
    43     reviews: many(reviewTable),
    44     favorites: many(favoriteBuildTable),
    45     ratings: many(ratingBuildTable),
     41    builds: many(buildsTable),
     42    reviews: many(reviewsTable),
     43    favorites: many(favoriteBuildsTable),
     44    ratings: many(ratingBuildsTable),
    4645    suggestions: many(suggestionsTable),
    4746    adminProfile: one(adminsTable, {
     
    7069}));
    7170
    72 export const buildRelations = relations(buildTable, ({ one, many }) => ({
     71export const buildRelations = relations(buildsTable, ({ one, many }) => ({
    7372    owner: one(usersTable, {
    74         fields: [buildTable.userId],
    75         references: [usersTable.id],
    76     }),
    77     buildComponents: many(buildComponentTable),
    78     favorites: many(favoriteBuildTable),
    79     ratings: many(ratingBuildTable),
    80     reviews: many(reviewTable),
    81 }));
    82 
    83 export const buildComponentRelations = relations(buildComponentTable, ({ one }) => ({
    84     build: one(buildTable, {
    85         fields: [buildComponentTable.buildId],
    86         references: [buildTable.id],
    87     }),
    88     component: one(componentsTable, {
    89         fields: [buildComponentTable.componentId],
    90         references: [componentsTable.id],
    91     }),
    92 }));
    93 
    94 export const favoriteBuildRelations = relations(favoriteBuildTable, ({ one }) => ({
     73        fields: [buildsTable.userId],
     74        references: [usersTable.id],
     75    }),
     76    buildComponents: many(buildComponentsTable),
     77    favorites: many(favoriteBuildsTable),
     78    ratings: many(ratingBuildsTable),
     79    reviews: many(reviewsTable),
     80}));
     81
     82export const buildComponentRelations = relations(buildComponentsTable, ({ one }) => ({
     83    build: one(buildsTable, {
     84        fields: [buildComponentsTable.buildId],
     85        references: [buildsTable.id],
     86    }),
     87    component: one(componentsTable, {
     88        fields: [buildComponentsTable.componentId],
     89        references: [componentsTable.id],
     90    }),
     91}));
     92
     93export const favoriteBuildRelations = relations(favoriteBuildsTable, ({ one }) => ({
    9594    user: one(usersTable, {
    96         fields: [favoriteBuildTable.userId],
    97         references: [usersTable.id],
    98     }),
    99     build: one(buildTable, {
    100         fields: [favoriteBuildTable.buildId],
    101         references: [buildTable.id],
    102     }),
    103 }));
    104 
    105 export const ratingBuildRelations = relations(ratingBuildTable, ({ one }) => ({
     95        fields: [favoriteBuildsTable.userId],
     96        references: [usersTable.id],
     97    }),
     98    build: one(buildsTable, {
     99        fields: [favoriteBuildsTable.buildId],
     100        references: [buildsTable.id],
     101    }),
     102}));
     103
     104export const ratingBuildRelations = relations(ratingBuildsTable, ({ one }) => ({
    106105    user: one(usersTable, {
    107         fields: [ratingBuildTable.userId],
    108         references: [usersTable.id],
    109     }),
    110     build: one(buildTable, {
    111         fields: [ratingBuildTable.buildId],
    112         references: [buildTable.id],
    113     }),
    114 }));
    115 
    116 export const reviewRelations = relations(reviewTable, ({ one }) => ({
     106        fields: [ratingBuildsTable.userId],
     107        references: [usersTable.id],
     108    }),
     109    build: one(buildsTable, {
     110        fields: [ratingBuildsTable.buildId],
     111        references: [buildsTable.id],
     112    }),
     113}));
     114
     115export const reviewRelations = relations(reviewsTable, ({ one }) => ({
    117116    author: one(usersTable, {
    118         fields: [reviewTable.userId],
    119         references: [usersTable.id],
    120     }),
    121     build: one(buildTable, {
    122         fields: [reviewTable.buildId],
    123         references: [buildTable.id],
     117        fields: [reviewsTable.userId],
     118        references: [usersTable.id],
     119    }),
     120    build: one(buildsTable, {
     121        fields: [reviewsTable.buildId],
     122        references: [buildsTable.id],
    124123    }),
    125124}));
    126125
    127126export const componentsRelations = relations(componentsTable, ({ many, one }) => ({
    128     buildComponents: many(buildComponentTable),
     127    buildComponents: many(buildComponentsTable),
    129128
    130129    cpu: one(CPUTable, {
     
    144143        references: [powerSupplyTable.componentId]
    145144    }),
    146     pcCase: one(pcCaseTable, {
    147         fields: [componentsTable.id],
    148         references: [pcCaseTable.componentId]
    149     }),
    150     cooler: one(coolerTable, {
    151         fields: [componentsTable.id],
    152         references: [coolerTable.componentId]
    153     }),
    154     motherboard: one(motherboardTable, {
    155         fields: [componentsTable.id],
    156         references: [motherboardTable.componentId]
     145    pcCase: one(pcCasesTable, {
     146        fields: [componentsTable.id],
     147        references: [pcCasesTable.componentId]
     148    }),
     149    cooler: one(coolersTable, {
     150        fields: [componentsTable.id],
     151        references: [coolersTable.componentId]
     152    }),
     153    motherboard: one(motherboardsTable, {
     154        fields: [componentsTable.id],
     155        references: [motherboardsTable.componentId]
    157156    }),
    158157    storage: one(storageTable, {
     
    160159        references: [storageTable.componentId]
    161160    }),
    162     memoryCard: one(memoryCardTable, {
    163         fields: [componentsTable.id],
    164         references: [memoryCardTable.componentId]
    165     }),
    166     opticalDrive: one(opticalDriveTable, {
    167         fields: [componentsTable.id],
    168         references: [opticalDriveTable.componentId]
    169     }),
    170     soundCard: one(soundCardTable, {
    171         fields: [componentsTable.id],
    172         references: [soundCardTable.componentId]
     161    memoryCard: one(memoryCardsTable, {
     162        fields: [componentsTable.id],
     163        references: [memoryCardsTable.componentId]
     164    }),
     165    opticalDrive: one(opticalDrivesTable, {
     166        fields: [componentsTable.id],
     167        references: [opticalDrivesTable.componentId]
     168    }),
     169    soundCard: one(soundCardsTable, {
     170        fields: [componentsTable.id],
     171        references: [soundCardsTable.componentId]
    173172    }),
    174173    cables: one(cablesTable, {
     
    176175        references: [cablesTable.componentId]
    177176    }),
    178     networkAdapter: one(networkAdapterTable, {
    179         fields: [componentsTable.id],
    180         references: [networkAdapterTable.componentId]
    181     }),
    182     networkCard: one(networkCardTable, {
    183         fields: [componentsTable.id],
    184         references: [networkCardTable.componentId]
     177    networkAdapter: one(networkAdaptersTable, {
     178        fields: [componentsTable.id],
     179        references: [networkAdaptersTable.componentId]
     180    }),
     181    networkCard: one(networkCardsTable, {
     182        fields: [componentsTable.id],
     183        references: [networkCardsTable.componentId]
    185184    }),
    186185}));
     
    214213}));
    215214
    216 export const motherboardRelations = relations(motherboardTable, ({ one }) => ({
    217     component: one(componentsTable, {
    218         fields: [motherboardTable.componentId],
     215export const motherboardRelations = relations(motherboardsTable, ({ one }) => ({
     216    component: one(componentsTable, {
     217        fields: [motherboardsTable.componentId],
    219218        references: [componentsTable.id],
    220219    }),
     
    228227}));
    229228
    230 export const memoryCardRelations = relations(memoryCardTable, ({ one }) => ({
    231     component: one(componentsTable, {
    232         fields: [memoryCardTable.componentId],
    233         references: [componentsTable.id],
    234     }),
    235 }));
    236 
    237 export const opticalDriveRelations = relations(opticalDriveTable, ({ one }) => ({
    238     component: one(componentsTable, {
    239         fields: [opticalDriveTable.componentId],
     229export const memoryCardRelations = relations(memoryCardsTable, ({ one }) => ({
     230    component: one(componentsTable, {
     231        fields: [memoryCardsTable.componentId],
     232        references: [componentsTable.id],
     233    }),
     234}));
     235
     236export const opticalDriveRelations = relations(opticalDrivesTable, ({ one }) => ({
     237    component: one(componentsTable, {
     238        fields: [opticalDrivesTable.componentId],
    240239        references: [componentsTable.id],
    241240    }),
     
    249248}));
    250249
    251 export const networkAdapterRelations = relations(networkAdapterTable, ({ one }) => ({
    252     component: one(componentsTable, {
    253         fields: [networkAdapterTable.componentId],
    254         references: [componentsTable.id],
    255     }),
    256 }));
    257 
    258 export const networkCardRelations = relations(networkCardTable, ({ one }) => ({
    259     component: one(componentsTable, {
    260         fields: [networkCardTable.componentId],
    261         references: [componentsTable.id],
    262     }),
    263 }));
    264 
    265 export const pcCaseRelations = relations(pcCaseTable, ({ one, many }) => ({
    266     component: one(componentsTable, {
    267         fields: [pcCaseTable.componentId],
     250export const networkAdapterRelations = relations(networkAdaptersTable, ({ one }) => ({
     251    component: one(componentsTable, {
     252        fields: [networkAdaptersTable.componentId],
     253        references: [componentsTable.id],
     254    }),
     255}));
     256
     257export const networkCardRelations = relations(networkCardsTable, ({ one }) => ({
     258    component: one(componentsTable, {
     259        fields: [networkCardsTable.componentId],
     260        references: [componentsTable.id],
     261    }),
     262}));
     263
     264export const pcCaseRelations = relations(pcCasesTable, ({ one, many }) => ({
     265    component: one(componentsTable, {
     266        fields: [pcCasesTable.componentId],
    268267        references: [componentsTable.id],
    269268    }),
     
    274273
    275274export const caseStorageFormFactorsRelations = relations(caseStorageFormFactorsTable, ({ one }) => ({
    276     pcCase: one(pcCaseTable, {
     275    pcCase: one(pcCasesTable, {
    277276        fields: [caseStorageFormFactorsTable.caseId],
    278         references: [pcCaseTable.componentId],
     277        references: [pcCasesTable.componentId],
    279278    }),
    280279}));
    281280
    282281export const casePsFormFactorsRelations = relations(casePsFormFactorsTable, ({ one }) => ({
    283     pcCase: one(pcCaseTable, {
     282    pcCase: one(pcCasesTable, {
    284283        fields: [casePsFormFactorsTable.caseId],
    285         references: [pcCaseTable.componentId],
     284        references: [pcCasesTable.componentId],
    286285    }),
    287286}));
    288287
    289288export const caseMoboFormFactorsRelations = relations(caseMoboFormFactorsTable, ({ one }) => ({
    290     pcCase: one(pcCaseTable, {
     289    pcCase: one(pcCasesTable, {
    291290        fields: [caseMoboFormFactorsTable.caseId],
    292         references: [pcCaseTable.componentId],
    293     }),
    294 }));
    295 
    296 export const coolerRelations = relations(coolerTable, ({ one, many }) => ({
    297     component: one(componentsTable, {
    298         fields: [coolerTable.componentId],
     291        references: [pcCasesTable.componentId],
     292    }),
     293}));
     294
     295export const coolerRelations = relations(coolersTable, ({ one, many }) => ({
     296    component: one(componentsTable, {
     297        fields: [coolersTable.componentId],
    299298        references: [componentsTable.id],
    300299    }),
     
    303302
    304303export const coolerCpuSocketsRelations = relations(coolerCPUSocketsTable, ({ one }) => ({
    305     cooler: one(coolerTable, {
     304    cooler: one(coolersTable, {
    306305        fields: [coolerCPUSocketsTable.cooler_id],
    307         references: [coolerTable.componentId],
    308     }),
    309 }));
    310 
    311 export const soundCardRelations = relations(soundCardTable, ({ one, many }) => ({
    312     component: one(componentsTable, {
    313         fields: [soundCardTable.componentId],
    314         references: [componentsTable.id],
    315     }),
    316     channels: many(soundCardChannelsTable),
    317 }));
    318 
    319 export const soundCardChannelsRelations = relations(soundCardChannelsTable, ({ one }) => ({
    320     soundCard: one(soundCardTable, {
    321         fields: [soundCardChannelsTable.soundCardId],
    322         references: [soundCardTable.componentId],
    323     }),
    324 }));
     306        references: [coolersTable.componentId],
     307    }),
     308}));
     309
     310export const soundCardRelations = relations(soundCardsTable, ({ one, many }) => ({
     311    component: one(componentsTable, {
     312        fields: [soundCardsTable.componentId],
     313        references: [componentsTable.id],
     314    }),
     315}));
Note: See TracChangeset for help on using the changeset viewer.