@voyantjs/products 0.6.7 → 0.6.9

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.
@@ -1,19 +1,41 @@
1
1
  import { typeId, typeIdRef } from "@voyantjs/db/lib/typeid-column";
2
- import { boolean, index, integer, jsonb, pgTable, text, timestamp } from "drizzle-orm/pg-core";
2
+ import { sql } from "drizzle-orm";
3
+ import { boolean, index, integer, jsonb, pgTable, text, timestamp, uniqueIndex, } from "drizzle-orm/pg-core";
3
4
  import { products } from "./schema-core";
4
5
  import { productMediaTypeEnum, serviceTypeEnum } from "./schema-shared";
5
- export const productDays = pgTable("product_days", {
6
- id: typeId("product_days"),
6
+ export const productItineraries = pgTable("product_itineraries", {
7
+ id: typeId("product_itineraries"),
7
8
  productId: typeIdRef("product_id")
8
9
  .notNull()
9
10
  .references(() => products.id, { onDelete: "cascade" }),
11
+ name: text("name").notNull(),
12
+ isDefault: boolean("is_default").notNull().default(false),
13
+ sortOrder: integer("sort_order").notNull().default(0),
14
+ createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
15
+ updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow(),
16
+ }, (table) => [
17
+ index("idx_product_itineraries_product").on(table.productId),
18
+ index("idx_product_itineraries_product_sort").on(table.productId, table.sortOrder, table.createdAt),
19
+ index("idx_product_itineraries_product_default").on(table.productId, table.isDefault),
20
+ uniqueIndex("uidx_product_itineraries_default")
21
+ .on(table.productId)
22
+ .where(sql `${table.isDefault} = true`),
23
+ ]);
24
+ export const productDays = pgTable("product_days", {
25
+ id: typeId("product_days"),
26
+ itineraryId: typeIdRef("itinerary_id")
27
+ .notNull()
28
+ .references(() => productItineraries.id, { onDelete: "cascade" }),
10
29
  dayNumber: integer("day_number").notNull(),
11
30
  title: text("title"),
12
31
  description: text("description"),
13
32
  location: text("location"),
14
33
  createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
15
34
  updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow(),
16
- }, (table) => [index("idx_product_days_product").on(table.productId)]);
35
+ }, (table) => [
36
+ index("idx_product_days_itinerary").on(table.itineraryId),
37
+ index("idx_product_days_itinerary_day_number").on(table.itineraryId, table.dayNumber),
38
+ ]);
17
39
  export const productDayServices = pgTable("product_day_services", {
18
40
  id: typeId("product_day_services"),
19
41
  dayId: typeIdRef("day_id")
@@ -31,6 +53,7 @@ export const productDayServices = pgTable("product_day_services", {
31
53
  createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
32
54
  }, (table) => [
33
55
  index("idx_product_day_services_day").on(table.dayId),
56
+ index("idx_product_day_services_day_sort").on(table.dayId, table.sortOrder),
34
57
  index("idx_product_day_services_supplier_service").on(table.supplierServiceId),
35
58
  ]);
36
59
  export const productVersions = pgTable("product_versions", {
@@ -43,7 +66,10 @@ export const productVersions = pgTable("product_versions", {
43
66
  authorId: text("author_id").notNull(),
44
67
  notes: text("notes"),
45
68
  createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
46
- }, (table) => [index("idx_product_versions_product").on(table.productId)]);
69
+ }, (table) => [
70
+ index("idx_product_versions_product").on(table.productId),
71
+ index("idx_product_versions_product_version").on(table.productId, table.versionNumber),
72
+ ]);
47
73
  export const productNotes = pgTable("product_notes", {
48
74
  id: typeId("product_notes"),
49
75
  productId: typeIdRef("product_id")
@@ -52,7 +78,10 @@ export const productNotes = pgTable("product_notes", {
52
78
  authorId: text("author_id").notNull(),
53
79
  content: text("content").notNull(),
54
80
  createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
55
- }, (table) => [index("idx_product_notes_product").on(table.productId)]);
81
+ }, (table) => [
82
+ index("idx_product_notes_product").on(table.productId),
83
+ index("idx_product_notes_product_created").on(table.productId, table.createdAt),
84
+ ]);
56
85
  export const productMedia = pgTable("product_media", {
57
86
  id: typeId("product_media"),
58
87
  productId: typeIdRef("product_id")
@@ -77,4 +106,7 @@ export const productMedia = pgTable("product_media", {
77
106
  index("idx_product_media_product").on(table.productId),
78
107
  index("idx_product_media_day").on(table.dayId),
79
108
  index("idx_product_media_product_day").on(table.productId, table.dayId),
109
+ index("idx_product_media_product_cover_sort").on(table.productId, table.isCover, table.sortOrder, table.createdAt),
110
+ index("idx_product_media_product_day_cover_sort").on(table.productId, table.dayId, table.isCover, table.sortOrder, table.createdAt),
111
+ index("idx_product_media_product_brochure_current_version").on(table.productId, table.isBrochure, table.dayId, table.isBrochureCurrent, table.brochureVersion, table.updatedAt, table.createdAt),
80
112
  ]);
@@ -9,8 +9,8 @@ export declare const productsRelations: import("drizzle-orm").Relations<"product
9
9
  faqs: import("drizzle-orm").Many<"product_faqs">;
10
10
  locations: import("drizzle-orm").Many<"product_locations">;
11
11
  options: import("drizzle-orm").Many<"product_options">;
12
+ itineraries: import("drizzle-orm").Many<"product_itineraries">;
12
13
  translations: import("drizzle-orm").Many<"product_translations">;
13
- days: import("drizzle-orm").Many<"product_days">;
14
14
  versions: import("drizzle-orm").Many<"product_versions">;
15
15
  notes: import("drizzle-orm").Many<"product_notes">;
16
16
  media: import("drizzle-orm").Many<"product_media">;
@@ -60,8 +60,12 @@ export declare const productOptionTranslationsRelations: import("drizzle-orm").R
60
60
  export declare const optionUnitTranslationsRelations: import("drizzle-orm").Relations<"option_unit_translations", {
61
61
  unit: import("drizzle-orm").One<"option_units", true>;
62
62
  }>;
63
- export declare const productDaysRelations: import("drizzle-orm").Relations<"product_days", {
63
+ export declare const productItinerariesRelations: import("drizzle-orm").Relations<"product_itineraries", {
64
64
  product: import("drizzle-orm").One<"products", true>;
65
+ days: import("drizzle-orm").Many<"product_days">;
66
+ }>;
67
+ export declare const productDaysRelations: import("drizzle-orm").Relations<"product_days", {
68
+ itinerary: import("drizzle-orm").One<"product_itineraries", true>;
65
69
  services: import("drizzle-orm").Many<"product_day_services">;
66
70
  media: import("drizzle-orm").Many<"product_media">;
67
71
  }>;
@@ -1 +1 @@
1
- {"version":3,"file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-1,6 +1,6 @@
1
1
  import { relations } from "drizzle-orm";
2
2
  import { optionUnits, productOptions, products } from "./schema-core";
3
- import { productDayServices, productDays, productMedia, productNotes, productVersions, } from "./schema-itinerary";
3
+ import { productDayServices, productDays, productItineraries, productMedia, productNotes, productVersions, } from "./schema-itinerary";
4
4
  import { optionUnitTranslations, productActivationSettings, productCapabilities, productDeliveryFormats, productFaqs, productFeatures, productLocations, productOptionTranslations, productTicketSettings, productTranslations, productVisibilitySettings, } from "./schema-settings";
5
5
  import { destinations, destinationTranslations, productCategories, productCategoryProducts, productDestinations, productTagProducts, productTags, productTypes, } from "./schema-taxonomy";
6
6
  export const productsRelations = relations(products, ({ one, many }) => ({
@@ -17,8 +17,8 @@ export const productsRelations = relations(products, ({ one, many }) => ({
17
17
  faqs: many(productFaqs),
18
18
  locations: many(productLocations),
19
19
  options: many(productOptions),
20
+ itineraries: many(productItineraries),
20
21
  translations: many(productTranslations),
21
- days: many(productDays),
22
22
  versions: many(productVersions),
23
23
  notes: many(productNotes),
24
24
  media: many(productMedia),
@@ -101,8 +101,18 @@ export const optionUnitTranslationsRelations = relations(optionUnitTranslations,
101
101
  references: [optionUnits.id],
102
102
  }),
103
103
  }));
104
+ export const productItinerariesRelations = relations(productItineraries, ({ one, many }) => ({
105
+ product: one(products, {
106
+ fields: [productItineraries.productId],
107
+ references: [products.id],
108
+ }),
109
+ days: many(productDays),
110
+ }));
104
111
  export const productDaysRelations = relations(productDays, ({ one, many }) => ({
105
- product: one(products, { fields: [productDays.productId], references: [products.id] }),
112
+ itinerary: one(productItineraries, {
113
+ fields: [productDays.itineraryId],
114
+ references: [productItineraries.id],
115
+ }),
106
116
  services: many(productDayServices),
107
117
  media: many(productMedia),
108
118
  }));
@@ -1 +1 @@
1
- {"version":3,"file":"schema-settings.d.ts","sourceRoot":"","sources":["../src/schema-settings.ts"],"names":[],"mappings":"AAsBA,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;EAyBlC,CAAA;AAED,MAAM,MAAM,kBAAkB,GAAG,OAAO,mBAAmB,CAAC,YAAY,CAAA;AACxE,MAAM,MAAM,qBAAqB,GAAG,OAAO,mBAAmB,CAAC,YAAY,CAAA;AAC3E,MAAM,MAAM,wBAAwB,GAAG,OAAO,yBAAyB,CAAC,YAAY,CAAA;AACpF,MAAM,MAAM,2BAA2B,GAAG,OAAO,yBAAyB,CAAC,YAAY,CAAA;AACvF,MAAM,MAAM,qBAAqB,GAAG,OAAO,sBAAsB,CAAC,YAAY,CAAA;AAC9E,MAAM,MAAM,wBAAwB,GAAG,OAAO,sBAAsB,CAAC,YAAY,CAAA"}
@@ -16,7 +16,9 @@ export const productActivationSettings = pgTable("product_activation_settings",
16
16
  updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow(),
17
17
  }, (table) => [
18
18
  uniqueIndex("uidx_product_activation_settings_product").on(table.productId),
19
+ index("idx_product_activation_settings_created").on(table.createdAt),
19
20
  index("idx_product_activation_settings_mode").on(table.activationMode),
21
+ index("idx_product_activation_settings_mode_created").on(table.activationMode, table.createdAt),
20
22
  ]);
21
23
  export const productTicketSettings = pgTable("product_ticket_settings", {
22
24
  id: typeId("product_ticket_settings"),
@@ -33,7 +35,11 @@ export const productTicketSettings = pgTable("product_ticket_settings", {
33
35
  ticketMessage: text("ticket_message"),
34
36
  createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
35
37
  updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow(),
36
- }, (table) => [uniqueIndex("uidx_product_ticket_settings_product").on(table.productId)]);
38
+ }, (table) => [
39
+ uniqueIndex("uidx_product_ticket_settings_product").on(table.productId),
40
+ index("idx_product_ticket_settings_created").on(table.createdAt),
41
+ index("idx_product_ticket_settings_fulfillment_created").on(table.fulfillmentMode, table.createdAt),
42
+ ]);
37
43
  export const productVisibilitySettings = pgTable("product_visibility_settings", {
38
44
  id: typeId("product_visibility_settings"),
39
45
  productId: typeIdRef("product_id")
@@ -45,7 +51,13 @@ export const productVisibilitySettings = pgTable("product_visibility_settings",
45
51
  requiresAuthentication: boolean("requires_authentication").notNull().default(false),
46
52
  createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
47
53
  updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow(),
48
- }, (table) => [uniqueIndex("uidx_product_visibility_settings_product").on(table.productId)]);
54
+ }, (table) => [
55
+ uniqueIndex("uidx_product_visibility_settings_product").on(table.productId),
56
+ index("idx_product_visibility_settings_created").on(table.createdAt),
57
+ index("idx_product_visibility_settings_searchable_created").on(table.isSearchable, table.createdAt),
58
+ index("idx_product_visibility_settings_bookable_created").on(table.isBookable, table.createdAt),
59
+ index("idx_product_visibility_settings_featured_product").on(table.isFeatured, table.productId),
60
+ ]);
49
61
  export const productCapabilities = pgTable("product_capabilities", {
50
62
  id: typeId("product_capabilities"),
51
63
  productId: typeIdRef("product_id")
@@ -59,6 +71,8 @@ export const productCapabilities = pgTable("product_capabilities", {
59
71
  }, (table) => [
60
72
  index("idx_product_capabilities_product").on(table.productId),
61
73
  index("idx_product_capabilities_capability").on(table.capability),
74
+ index("idx_product_capabilities_capability_created").on(table.capability, table.createdAt),
75
+ index("idx_product_capabilities_enabled_capability_created").on(table.enabled, table.capability, table.createdAt),
62
76
  uniqueIndex("uidx_product_capabilities_product_capability").on(table.productId, table.capability),
63
77
  ]);
64
78
  export const productDeliveryFormats = pgTable("product_delivery_formats", {
@@ -72,6 +86,9 @@ export const productDeliveryFormats = pgTable("product_delivery_formats", {
72
86
  updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow(),
73
87
  }, (table) => [
74
88
  index("idx_product_delivery_formats_product").on(table.productId),
89
+ index("idx_product_delivery_formats_default_created").on(table.isDefault, table.createdAt),
90
+ index("idx_product_delivery_formats_product_default_created").on(table.productId, table.isDefault, table.createdAt),
91
+ index("idx_product_delivery_formats_format_default_created").on(table.format, table.isDefault, table.createdAt),
75
92
  uniqueIndex("uidx_product_delivery_formats_product_format").on(table.productId, table.format),
76
93
  ]);
77
94
  export const productFeatures = pgTable("product_features", {
@@ -87,7 +104,11 @@ export const productFeatures = pgTable("product_features", {
87
104
  updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow(),
88
105
  }, (table) => [
89
106
  index("idx_product_features_product").on(table.productId),
107
+ index("idx_product_features_sort").on(table.sortOrder, table.createdAt),
108
+ index("idx_product_features_product_sort").on(table.productId, table.sortOrder, table.createdAt),
90
109
  index("idx_product_features_type").on(table.featureType),
110
+ index("idx_product_features_type_sort").on(table.featureType, table.sortOrder, table.createdAt),
111
+ index("idx_product_features_product_type_sort").on(table.productId, table.featureType, table.sortOrder, table.createdAt),
91
112
  ]);
92
113
  export const productFaqs = pgTable("product_faqs", {
93
114
  id: typeId("product_faqs"),
@@ -99,7 +120,11 @@ export const productFaqs = pgTable("product_faqs", {
99
120
  sortOrder: integer("sort_order").notNull().default(0),
100
121
  createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
101
122
  updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow(),
102
- }, (table) => [index("idx_product_faqs_product").on(table.productId)]);
123
+ }, (table) => [
124
+ index("idx_product_faqs_product").on(table.productId),
125
+ index("idx_product_faqs_sort").on(table.sortOrder, table.createdAt),
126
+ index("idx_product_faqs_product_sort").on(table.productId, table.sortOrder, table.createdAt),
127
+ ]);
103
128
  export const productLocations = pgTable("product_locations", {
104
129
  id: typeId("product_locations"),
105
130
  productId: typeIdRef("product_id")
@@ -120,7 +145,13 @@ export const productLocations = pgTable("product_locations", {
120
145
  updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow(),
121
146
  }, (table) => [
122
147
  index("idx_product_locations_product").on(table.productId),
148
+ index("idx_product_locations_sort").on(table.sortOrder, table.createdAt),
149
+ index("idx_product_locations_product_sort").on(table.productId, table.sortOrder, table.createdAt),
123
150
  index("idx_product_locations_type").on(table.locationType),
151
+ index("idx_product_locations_type_product").on(table.locationType, table.productId),
152
+ index("idx_product_locations_type_sort").on(table.locationType, table.sortOrder, table.createdAt),
153
+ index("idx_product_locations_product_type_sort").on(table.productId, table.locationType, table.sortOrder, table.createdAt),
154
+ index("idx_product_locations_country_product").on(table.countryCode, table.productId),
124
155
  ]);
125
156
  export const productTranslations = pgTable("product_translations", {
126
157
  id: typeId("product_translations"),
@@ -139,6 +170,8 @@ export const productTranslations = pgTable("product_translations", {
139
170
  }, (table) => [
140
171
  index("idx_product_translations_product").on(table.productId),
141
172
  index("idx_product_translations_language").on(table.languageTag),
173
+ index("idx_product_translations_product_language_created").on(table.productId, table.languageTag, table.createdAt),
174
+ index("idx_product_translations_language_created").on(table.languageTag, table.createdAt),
142
175
  uniqueIndex("uidx_product_translations_product_language").on(table.productId, table.languageTag),
143
176
  ]);
144
177
  export const productOptionTranslations = pgTable("product_option_translations", {
@@ -155,6 +188,8 @@ export const productOptionTranslations = pgTable("product_option_translations",
155
188
  }, (table) => [
156
189
  index("idx_product_option_translations_option").on(table.optionId),
157
190
  index("idx_product_option_translations_language").on(table.languageTag),
191
+ index("idx_product_option_translations_option_language_created").on(table.optionId, table.languageTag, table.createdAt),
192
+ index("idx_product_option_translations_language_created").on(table.languageTag, table.createdAt),
158
193
  uniqueIndex("uidx_product_option_translations_option_language").on(table.optionId, table.languageTag),
159
194
  ]);
160
195
  export const optionUnitTranslations = pgTable("option_unit_translations", {
@@ -171,5 +206,7 @@ export const optionUnitTranslations = pgTable("option_unit_translations", {
171
206
  }, (table) => [
172
207
  index("idx_option_unit_translations_unit").on(table.unitId),
173
208
  index("idx_option_unit_translations_language").on(table.languageTag),
209
+ index("idx_option_unit_translations_unit_language_created").on(table.unitId, table.languageTag, table.createdAt),
210
+ index("idx_option_unit_translations_language_created").on(table.languageTag, table.createdAt),
174
211
  uniqueIndex("uidx_option_unit_translations_unit_language").on(table.unitId, table.languageTag),
175
212
  ]);
@@ -1 +1 @@
1
- {"version":3,"file":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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAyBnC,CAAA;AAED,MAAM,MAAM,sBAAsB,GAAG,OAAO,uBAAuB,CAAC,YAAY,CAAA;AAChF,MAAM,MAAM,yBAAyB,GAAG,OAAO,uBAAuB,CAAC,YAAY,CAAA;AAEnF,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkBnC,CAAA;AAED,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAe9B,CAAA;AAED,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkB/B,CAAA"}
@@ -14,6 +14,8 @@ export const productTypes = pgTable("product_types", {
14
14
  }, (table) => [
15
15
  uniqueIndex("uidx_product_types_code").on(table.code),
16
16
  index("idx_product_types_active").on(table.active),
17
+ index("idx_product_types_sort_name").on(table.sortOrder, table.name),
18
+ index("idx_product_types_active_sort_name").on(table.active, table.sortOrder, table.name),
17
19
  ]);
18
20
  export const productCategories = pgTable("product_categories", {
19
21
  id: typeId("product_categories"),
@@ -30,6 +32,9 @@ export const productCategories = pgTable("product_categories", {
30
32
  uniqueIndex("uidx_product_categories_slug").on(table.slug),
31
33
  index("idx_product_categories_parent").on(table.parentId),
32
34
  index("idx_product_categories_active").on(table.active),
35
+ index("idx_product_categories_sort_name").on(table.sortOrder, table.name),
36
+ index("idx_product_categories_active_sort_name").on(table.active, table.sortOrder, table.name),
37
+ index("idx_product_categories_parent_sort_name").on(table.parentId, table.sortOrder, table.name),
33
38
  ]);
34
39
  export const productTags = pgTable("product_tags", {
35
40
  id: typeId("product_tags"),
@@ -53,6 +58,10 @@ export const destinations = pgTable("destinations", {
53
58
  uniqueIndex("uidx_destinations_code").on(table.code),
54
59
  index("idx_destinations_parent").on(table.parentId),
55
60
  index("idx_destinations_active").on(table.active),
61
+ index("idx_destinations_sort_slug").on(table.sortOrder, table.slug),
62
+ index("idx_destinations_active_sort_slug").on(table.active, table.sortOrder, table.slug),
63
+ index("idx_destinations_type_sort_slug").on(table.destinationType, table.sortOrder, table.slug),
64
+ index("idx_destinations_parent_sort_slug").on(table.parentId, table.sortOrder, table.slug),
56
65
  ]);
57
66
  export const destinationTranslations = pgTable("destination_translations", {
58
67
  id: typeId("destination_translations"),
@@ -69,6 +78,8 @@ export const destinationTranslations = pgTable("destination_translations", {
69
78
  }, (table) => [
70
79
  uniqueIndex("uidx_destination_translations_locale").on(table.destinationId, table.languageTag),
71
80
  index("idx_destination_translations_language").on(table.languageTag),
81
+ index("idx_destination_translations_destination_language_created").on(table.destinationId, table.languageTag, table.createdAt),
82
+ index("idx_destination_translations_language_created").on(table.languageTag, table.createdAt),
72
83
  ]);
73
84
  export const productCategoryProducts = pgTable("product_category_products", {
74
85
  productId: typeIdRef("product_id")
@@ -82,6 +93,7 @@ export const productCategoryProducts = pgTable("product_category_products", {
82
93
  updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow(),
83
94
  }, (table) => [
84
95
  primaryKey({ columns: [table.productId, table.categoryId] }),
96
+ index("idx_pcp_product_sort").on(table.productId, table.sortOrder),
85
97
  index("idx_pcp_category").on(table.categoryId),
86
98
  ]);
87
99
  export const productTagProducts = pgTable("product_tag_products", {
@@ -108,5 +120,6 @@ export const productDestinations = pgTable("product_destinations", {
108
120
  updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow(),
109
121
  }, (table) => [
110
122
  primaryKey({ columns: [table.productId, table.destinationId] }),
111
- index("idx_product_destinations_destination").on(table.destinationId),
123
+ index("idx_product_destinations_product_sort").on(table.productId, table.sortOrder),
124
+ index("idx_product_destinations_destination_sort").on(table.destinationId, table.sortOrder),
112
125
  ]);