feat(medusa): Categories - Adds indexes + remove soft delete (#3589)

* chore: added indexes for category properties

* chore: added changset

* chore: test changeset pre

* chore: undo pre release

* chore: remove soft delete from categories (#3590)

* chore: remove soft delete from categories

* chore: remove delete indexes and columns

* chore: drop safely + changeset

* chore: fix slipped deleted_at

* chore: removes extra changeset

* chore: redraw indexes

* chore: redraw indexes

* chore: drop records before dropping column for delete

---------

Co-authored-by: Oliver Windall Juhl <59018053+olivermrbl@users.noreply.github.com>
This commit is contained in:
Riqwan Thamir
2023-03-28 12:43:15 +02:00
committed by GitHub
co-authored by Oliver Windall Juhl
parent e359d3f85b
commit 5f41cd9a67
6 changed files with 50 additions and 17 deletions
@@ -1,5 +1,5 @@
import { generateEntityId } from "../utils/generate-entity-id"
import { SoftDeletableEntity } from "../interfaces/models/soft-deletable-entity"
import { BaseEntity } from "../interfaces/models/base-entity"
import { kebabCase } from "lodash"
import { Product } from "."
import {
@@ -18,14 +18,14 @@ import {
@Entity()
@Tree("materialized-path")
@Index(["parent_category_id", "rank"], { unique: true })
export class ProductCategory extends SoftDeletableEntity {
export class ProductCategory extends BaseEntity {
static productCategoryProductJoinTable = "product_category_product"
static treeRelations = ["parent_category", "category_children"]
@Column()
name: string
@Index({ unique: true, where: "deleted_at IS NULL" })
@Index({ unique: true })
@Column({ nullable: false })
handle: string
@@ -88,7 +88,6 @@ export class ProductCategory extends SoftDeletableEntity {
* required:
* - category_children
* - created_at
* - deleted_at
* - handle
* - id
* - is_active
@@ -154,9 +153,4 @@ export class ProductCategory extends SoftDeletableEntity {
* description: The date with timezone at which the resource was updated.
* type: string
* format: date-time
* deleted_at:
* description: The date with timezone at which the resource was deleted.
* nullable: true
* type: string
* format: date-time
*/