Changeset 1ebac59 for database/drizzle/schema/components.ts
- Timestamp:
- 12/20/25 00:55:47 (7 months ago)
- Branches:
- main
- Children:
- b69759d
- Parents:
- c30935a
- File:
-
- 1 edited
-
database/drizzle/schema/components.ts (modified) (15 diffs)
Legend:
- Unmodified
- Added
- Removed
-
database/drizzle/schema/components.ts
rc30935a r1ebac59 53 53 }); 54 54 55 export const pcCase Table = pgTable("pc_case", {55 export const pcCasesTable = pgTable("pc_case", { 56 56 componentId: integer("component_id") 57 57 .primaryKey() … … 65 65 caseId: integer("case_id") 66 66 .notNull() 67 .references(() => pcCase Table.componentId, {onDelete: "cascade", onUpdate: "cascade" }),67 .references(() => pcCasesTable.componentId, {onDelete: "cascade", onUpdate: "cascade" }), 68 68 formFactor: text("form_factor").notNull(), 69 num_slots: integer("num_slots").notNull(), 69 70 }, 70 71 (t) => ({ … … 76 77 caseId: integer("case_id") 77 78 .notNull() 78 .references(() => pcCase Table.componentId, { onDelete: "cascade", onUpdate: "cascade"}),79 .references(() => pcCasesTable.componentId, { onDelete: "cascade", onUpdate: "cascade"}), 79 80 formFactor: text("form_factor").notNull(), 80 81 }, … … 87 88 caseId: integer("case_id") 88 89 .notNull() 89 .references(() => pcCase Table.componentId, { onDelete: "cascade", onUpdate: "cascade"}),90 .references(() => pcCasesTable.componentId, { onDelete: "cascade", onUpdate: "cascade"}), 90 91 formFactor: text("form_factor").notNull(), 91 92 }, … … 95 96 ); 96 97 97 export const cooler Table = pgTable("cooler", {98 export const coolersTable = pgTable("cooler", { 98 99 componentId: integer("component_id") 99 100 .primaryKey() … … 108 109 cooler_id: integer("cooler_id") 109 110 .notNull() 110 .references(() => cooler Table.componentId, { onDelete: "cascade", onUpdate: "cascade" }),111 .references(() => coolersTable.componentId, { onDelete: "cascade", onUpdate: "cascade" }), 111 112 socket: text("socket").notNull(), 112 113 }, … … 116 117 ); 117 118 118 export const motherboard Table = pgTable("motherboard", {119 export const motherboardsTable = pgTable("motherboard", { 119 120 componentId: integer("component_id") 120 121 .primaryKey() … … 139 140 140 141 // Other Components 141 export const memoryCard Table = pgTable("memory_card", {142 export const memoryCardsTable = pgTable("memory_card", { 142 143 componentId: integer("component_id") 143 144 .primaryKey() … … 147 148 }); 148 149 149 export const opticalDrive Table = pgTable("optical_drive", {150 export const opticalDrivesTable = pgTable("optical_drive", { 150 151 componentId: integer("component_id") 151 152 .primaryKey() … … 158 159 }); 159 160 160 export const soundCard Table = pgTable("sound_card", {161 export const soundCardsTable = pgTable("sound_card", { 161 162 componentId: integer("component_id") 162 163 .primaryKey() … … 166 167 chipset: text("chipset").notNull(), 167 168 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 }); 181 171 182 172 export const cablesTable = pgTable("cables", { … … 188 178 }); 189 179 190 export const networkAdapter Table = pgTable("network_adapter", {180 export const networkAdaptersTable = pgTable("network_adapter", { 191 181 componentId: integer("component_id") 192 182 .primaryKey() … … 197 187 }); 198 188 199 export const networkCard Table = pgTable("network_card", {189 export const networkCardsTable = pgTable("network_card", { 200 190 componentId: integer("component_id") 201 191 .primaryKey() … … 221 211 export type powerSupplyInsert = typeof powerSupplyTable.$inferInsert; 222 212 223 export type caseItem = typeof pcCase Table.$inferSelect;224 export type caseInsert = typeof pcCase Table.$inferInsert;213 export type caseItem = typeof pcCasesTable.$inferSelect; 214 export type caseInsert = typeof pcCasesTable.$inferInsert; 225 215 226 216 export type caseStorageFormFactorsItem = typeof caseStorageFormFactorsTable.$inferSelect; … … 233 223 export type caseMoboFormFactorsInsert = typeof caseMoboFormFactorsTable.$inferInsert; 234 224 235 export type coolerItem = typeof cooler Table.$inferSelect;236 export type coolerInsert = typeof cooler Table.$inferInsert;225 export type coolerItem = typeof coolersTable.$inferSelect; 226 export type coolerInsert = typeof coolersTable.$inferInsert; 237 227 238 228 export type coolerCPUSocketsItem = typeof coolerCPUSocketsTable.$inferSelect; 239 229 export type coolerCPUSocketsInsert = typeof coolerCPUSocketsTable.$inferInsert; 240 230 241 export type motherboardItem = typeof motherboard Table.$inferSelect;242 export type motherboardInsert = typeof motherboard Table.$inferInsert;231 export type motherboardItem = typeof motherboardsTable.$inferSelect; 232 export type motherboardInsert = typeof motherboardsTable.$inferInsert; 243 233 244 234 export type storageItem = typeof storageTable.$inferSelect; 245 235 export type storageInsert = typeof storageTable.$inferInsert 246 236 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; 237 export type memoryCardItem = typeof memoryCardsTable.$inferSelect; 238 export type memoryCardInsert = typeof memoryCardsTable.$inferInsert; 239 240 export type opticalDriveItem = typeof opticalDrivesTable.$inferSelect; 241 export type opticalDriveInsert = typeof opticalDrivesTable.$inferInsert; 242 243 export type soundCardItem = typeof soundCardsTable.$inferSelect; 244 export type soundCardInsert = typeof soundCardsTable.$inferInsert; 258 245 259 246 export type cablesItem = typeof cablesTable.$inferSelect; 260 247 export type cablesInsert = typeof cablesTable.$inferInsert; 261 248 262 export type networkAdapterItem = typeof networkAdapter Table.$inferSelect;263 export type networkAdapterInsert = typeof networkAdapter Table.$inferInsert;264 265 export type networkCardItem = typeof networkCard Table.$inferSelect;266 export type networkCardInsert = typeof networkCard Table.$inferInsert;267 249 export type networkAdapterItem = typeof networkAdaptersTable.$inferSelect; 250 export type networkAdapterInsert = typeof networkAdaptersTable.$inferInsert; 251 252 export type networkCardItem = typeof networkCardsTable.$inferSelect; 253 export type networkCardInsert = typeof networkCardsTable.$inferInsert; 254
Note:
See TracChangeset
for help on using the changeset viewer.
