feat(order): Add display_id to order table (#7242)
Co-authored-by: Carlos R. L. Rodrigues <37986729+carlos-r-l-rodrigues@users.noreply.github.com>
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -30,6 +30,7 @@ export class Migration20240219102530 extends Migration {
|
||||
CREATE TABLE IF NOT EXISTS "order" (
|
||||
"id" TEXT NOT NULL,
|
||||
"region_id" TEXT NULL,
|
||||
"display_id" SERIAL,
|
||||
"customer_id" TEXT NULL,
|
||||
"version" INTEGER NOT NULL DEFAULT 1,
|
||||
"sales_channel_id" TEXT NULL,
|
||||
@@ -111,6 +112,11 @@ export class Migration20240219102530 extends Migration {
|
||||
"DROP NOT NULL"
|
||||
)}
|
||||
|
||||
CREATE INDEX IF NOT EXISTS "IDX_order_display_id" ON "order" (
|
||||
display_id
|
||||
)
|
||||
WHERE deleted_at IS NOT NULL;
|
||||
|
||||
CREATE INDEX IF NOT EXISTS "IDX_order_region_id" ON "order" (
|
||||
region_id
|
||||
)
|
||||
|
||||
@@ -28,6 +28,12 @@ type OptionalOrderProps =
|
||||
| "billing_address"
|
||||
| DAL.EntityDateColumns
|
||||
|
||||
const DisplayIdIndex = createPsqlIndexStatementHelper({
|
||||
tableName: "order",
|
||||
columns: "display_id",
|
||||
where: "deleted_at IS NOT NULL",
|
||||
})
|
||||
|
||||
const RegionIdIndex = createPsqlIndexStatementHelper({
|
||||
tableName: "order",
|
||||
columns: "region_id",
|
||||
@@ -83,6 +89,10 @@ export default class Order {
|
||||
@PrimaryKey({ columnType: "text" })
|
||||
id: string
|
||||
|
||||
@Property({ autoincrement: true, primary: false })
|
||||
@DisplayIdIndex.MikroORMIndex()
|
||||
display_id: number
|
||||
|
||||
@Property({
|
||||
columnType: "text",
|
||||
nullable: true,
|
||||
|
||||
Reference in New Issue
Block a user