Jelajahi Sumber

perf(core): Add indexes to Product & Collection slugs

BREAKING CHANGE: Indexes have been added to the ProductTranslation & CollectionTranslation slug
fields. This means a database migration will be needed - the change is small and non-destructive
so this is a routine migration which should not require manual editing of the migration script.
Michael Bromley 3 tahun lalu
induk
melakukan
937cf67298

+ 3 - 1
packages/core/src/entity/collection/collection-translation.entity.ts

@@ -19,7 +19,9 @@ export class CollectionTranslation extends VendureEntity implements Translation<
 
     @Column() name: string;
 
-    @Column() slug: string;
+    @Index({ unique: false })
+    @Column()
+    slug: string;
 
     @Column('text') description: string;
 

+ 3 - 1
packages/core/src/entity/product/product-translation.entity.ts

@@ -19,7 +19,9 @@ export class ProductTranslation extends VendureEntity implements Translation<Pro
 
     @Column() name: string;
 
-    @Column() slug: string;
+    @Index({ unique: false })
+    @Column()
+    slug: string;
 
     @Column('text') description: string;