modify status
This commit is contained in:
@@ -2824,17 +2824,6 @@
|
||||
"default": "false",
|
||||
"mappedType": "boolean"
|
||||
},
|
||||
"price": {
|
||||
"name": "price",
|
||||
"type": "numeric(10,0)",
|
||||
"unsigned": false,
|
||||
"autoincrement": false,
|
||||
"primary": false,
|
||||
"nullable": true,
|
||||
"precision": 10,
|
||||
"scale": 0,
|
||||
"mappedType": "decimal"
|
||||
},
|
||||
"max_purchase_quantity": {
|
||||
"name": "max_purchase_quantity",
|
||||
"type": "int",
|
||||
@@ -2844,6 +2833,71 @@
|
||||
"nullable": true,
|
||||
"default": "null",
|
||||
"mappedType": "integer"
|
||||
},
|
||||
"min_purchase_quantity": {
|
||||
"name": "min_purchase_quantity",
|
||||
"type": "int",
|
||||
"unsigned": false,
|
||||
"autoincrement": false,
|
||||
"primary": false,
|
||||
"nullable": true,
|
||||
"default": "null",
|
||||
"mappedType": "integer"
|
||||
},
|
||||
"pricing_type": {
|
||||
"name": "pricing_type",
|
||||
"type": "text",
|
||||
"unsigned": false,
|
||||
"autoincrement": false,
|
||||
"primary": false,
|
||||
"nullable": false,
|
||||
"default": "'fixed'",
|
||||
"enumItems": [
|
||||
"fixed",
|
||||
"variable"
|
||||
],
|
||||
"mappedType": "enum"
|
||||
},
|
||||
"purchase_unit": {
|
||||
"name": "purchase_unit",
|
||||
"type": "text",
|
||||
"unsigned": false,
|
||||
"autoincrement": false,
|
||||
"primary": false,
|
||||
"nullable": false,
|
||||
"default": "'number'",
|
||||
"enumItems": [
|
||||
"number",
|
||||
"kilogram",
|
||||
"gram",
|
||||
"centimeter",
|
||||
"meter",
|
||||
"milliliter",
|
||||
"liter"
|
||||
],
|
||||
"mappedType": "enum"
|
||||
},
|
||||
"purchase_pitch": {
|
||||
"name": "purchase_pitch",
|
||||
"type": "numeric(10,3)",
|
||||
"unsigned": false,
|
||||
"autoincrement": false,
|
||||
"primary": false,
|
||||
"nullable": true,
|
||||
"precision": 10,
|
||||
"scale": 3,
|
||||
"default": "null",
|
||||
"mappedType": "decimal"
|
||||
},
|
||||
"need_admin_acceptance": {
|
||||
"name": "need_admin_acceptance",
|
||||
"type": "boolean",
|
||||
"unsigned": false,
|
||||
"autoincrement": false,
|
||||
"primary": false,
|
||||
"nullable": false,
|
||||
"default": "false",
|
||||
"mappedType": "boolean"
|
||||
}
|
||||
},
|
||||
"name": "products",
|
||||
@@ -3842,7 +3896,8 @@
|
||||
"deliveredToRecepient",
|
||||
"shipped",
|
||||
"completed",
|
||||
"canceled"
|
||||
"canceled",
|
||||
"needConfirmation"
|
||||
],
|
||||
"mappedType": "enum"
|
||||
},
|
||||
@@ -5209,6 +5264,21 @@
|
||||
"precision": 10,
|
||||
"scale": 0,
|
||||
"mappedType": "decimal"
|
||||
},
|
||||
"status": {
|
||||
"name": "status",
|
||||
"type": "text",
|
||||
"unsigned": false,
|
||||
"autoincrement": false,
|
||||
"primary": false,
|
||||
"nullable": false,
|
||||
"default": "'normal'",
|
||||
"enumItems": [
|
||||
"normal",
|
||||
"needConfirmation",
|
||||
"confirmed"
|
||||
],
|
||||
"mappedType": "enum"
|
||||
}
|
||||
},
|
||||
"name": "order_items",
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
import { Migration } from '@mikro-orm/migrations';
|
||||
|
||||
export class Migration20260628071208 extends Migration {
|
||||
|
||||
override async up(): Promise<void> {
|
||||
this.addSql(`alter table "orders" drop constraint if exists "orders_status_check";`);
|
||||
|
||||
this.addSql(`alter table "products" add column "min_purchase_quantity" int null, add column "pricing_type" text check ("pricing_type" in ('fixed', 'variable')) not null default 'fixed', add column "purchase_unit" text check ("purchase_unit" in ('number', 'kilogram', 'gram', 'centimeter', 'meter', 'milliliter', 'liter')) not null default 'number', add column "purchase_pitch" numeric(10,3) null, add column "need_admin_acceptance" boolean not null default false;`);
|
||||
|
||||
this.addSql(`alter table "orders" add constraint "orders_status_check" check("status" in ('pendingPayment', 'paid', 'preparing', 'deliveredToRecepient', 'shipped', 'completed', 'canceled', 'needConfirmation'));`);
|
||||
|
||||
this.addSql(`alter table "order_items" add column "status" text check ("status" in ('normal', 'needConfirmation', 'confirmed')) not null default 'normal';`);
|
||||
}
|
||||
|
||||
override async down(): Promise<void> {
|
||||
this.addSql(`alter table "orders" drop constraint if exists "orders_status_check";`);
|
||||
|
||||
this.addSql(`alter table "products" add column "price" numeric(10,0) null;`);
|
||||
|
||||
this.addSql(`alter table "orders" add constraint "orders_status_check" check("status" in ('pendingPayment', 'paid', 'preparing', 'deliveredToRecepient', 'shipped', 'completed', 'canceled'));`);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user