fix: Product type tax overrides (#9951)
* fix: Make product type tax override work * fix: Make product type tax override work
This commit is contained in:
@@ -579,6 +579,15 @@
|
||||
"nullable": true,
|
||||
"mappedType": "text"
|
||||
},
|
||||
"product_type_id": {
|
||||
"name": "product_type_id",
|
||||
"type": "text",
|
||||
"unsigned": false,
|
||||
"autoincrement": false,
|
||||
"primary": false,
|
||||
"nullable": true,
|
||||
"mappedType": "text"
|
||||
},
|
||||
"product_collection": {
|
||||
"name": "product_collection",
|
||||
"type": "text",
|
||||
@@ -771,6 +780,16 @@
|
||||
"unique": false,
|
||||
"expression": "CREATE INDEX IF NOT EXISTS \"IDX_order_line_item_product_id\" ON \"order_line_item\" (product_id) WHERE deleted_at IS NOT NULL"
|
||||
},
|
||||
{
|
||||
"keyName": "IDX_line_item_product_type_id",
|
||||
"columnNames": [
|
||||
"product_type_id"
|
||||
],
|
||||
"composite": false,
|
||||
"primary": false,
|
||||
"unique": false,
|
||||
"expression": "CREATE INDEX IF NOT EXISTS \"IDX_line_item_product_type_id\" ON \"order_line_item\" (product_type_id) WHERE deleted_at IS NOT NULL AND product_type_id IS NOT NULL"
|
||||
},
|
||||
{
|
||||
"keyName": "IDX_order_line_item_deleted_at",
|
||||
"columnNames": [
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
import { Migration } from '@mikro-orm/migrations';
|
||||
|
||||
export class Migration20241106085223 extends Migration {
|
||||
|
||||
async up(): Promise<void> {
|
||||
this.addSql('alter table if exists "order_line_item" add column if not exists "product_type_id" text null;');
|
||||
this.addSql('CREATE INDEX IF NOT EXISTS "IDX_line_item_product_type_id" ON "order_line_item" (product_type_id) WHERE deleted_at IS NOT NULL AND product_type_id IS NOT NULL;');
|
||||
}
|
||||
|
||||
async down(): Promise<void> {
|
||||
this.addSql('drop index if exists "IDX_line_item_product_type_id";');
|
||||
this.addSql('alter table if exists "order_line_item" drop column if exists "product_type_id";');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -36,6 +36,13 @@ const ProductIdIndex = createPsqlIndexStatementHelper({
|
||||
where: "deleted_at IS NOT NULL",
|
||||
})
|
||||
|
||||
const ProductTypeIdIndex = createPsqlIndexStatementHelper({
|
||||
name: "IDX_line_item_product_type_id",
|
||||
tableName: "order_line_item",
|
||||
columns: "product_type_id",
|
||||
where: "deleted_at IS NOT NULL AND product_type_id IS NOT NULL",
|
||||
}).MikroORMIndex
|
||||
|
||||
const VariantIdIndex = createPsqlIndexStatementHelper({
|
||||
tableName: "order_line_item",
|
||||
columns: "variant_id",
|
||||
@@ -85,6 +92,10 @@ export default class OrderLineItem {
|
||||
@Property({ columnType: "text", nullable: true })
|
||||
product_type: string | null = null
|
||||
|
||||
@ProductTypeIdIndex()
|
||||
@Property({ columnType: "text", nullable: true })
|
||||
product_type_id: string | null = null
|
||||
|
||||
@Property({ columnType: "text", nullable: true })
|
||||
product_collection: string | null = null
|
||||
|
||||
|
||||
@@ -161,6 +161,7 @@ type OrderLineItem {
|
||||
product_description: String
|
||||
product_subtitle: String
|
||||
product_type: String
|
||||
product_type_id: String
|
||||
product_collection: String
|
||||
product_handle: String
|
||||
variant_sku: String
|
||||
|
||||
Reference in New Issue
Block a user