fix(pricing): add missing migrations for pricing module (#5646)

This commit is contained in:
Riqwan Thamir
2023-11-16 15:26:00 +01:00
committed by GitHub
parent a67a8e7e90
commit 4f0bea4909
4 changed files with 86 additions and 11 deletions

View File

@@ -0,0 +1,5 @@
---
"@medusajs/pricing": patch
---
fix(pricing): add missing migrations for pricing module

View File

@@ -105,6 +105,38 @@
"primary": false,
"nullable": true,
"mappedType": "decimal"
},
"created_at": {
"name": "created_at",
"type": "timestamptz",
"unsigned": false,
"autoincrement": false,
"primary": false,
"nullable": false,
"length": 6,
"default": "now()",
"mappedType": "datetime"
},
"updated_at": {
"name": "updated_at",
"type": "timestamptz",
"unsigned": false,
"autoincrement": false,
"primary": false,
"nullable": false,
"length": 6,
"default": "now()",
"mappedType": "datetime"
},
"deleted_at": {
"name": "deleted_at",
"type": "timestamptz",
"unsigned": false,
"autoincrement": false,
"primary": false,
"nullable": true,
"length": 6,
"mappedType": "datetime"
}
},
"name": "money_amount",
@@ -119,6 +151,15 @@
"primary": false,
"unique": false
},
{
"columnNames": [
"deleted_at"
],
"composite": false,
"keyName": "IDX_money_amount_deleted_at",
"primary": false,
"unique": false
},
{
"keyName": "money_amount_pkey",
"columnNames": [
@@ -398,6 +439,15 @@
"primary": false,
"unique": false
},
{
"columnNames": [
"money_amount_id"
],
"composite": false,
"keyName": "price_set_money_amount_money_amount_id_unique",
"primary": false,
"unique": true
},
{
"columnNames": [
"price_list_id"
@@ -884,16 +934,6 @@
"nullable": false,
"mappedType": "text"
},
"priority": {
"name": "priority",
"type": "integer",
"unsigned": false,
"autoincrement": false,
"primary": false,
"nullable": false,
"default": "0",
"mappedType": "integer"
},
"price_list_id": {
"name": "price_list_id",
"type": "text",

View File

@@ -107,7 +107,7 @@ export class Migration20230929122253 extends Migration {
)
this.addSql(
'create table "price_list_rule" ("id" text not null, "rule_type_id" text not null, "value" text not null, "price_list_id" text not null, constraint "price_list_rule_pkey" primary key ("id"));'
'create table "price_list_rule" ("id" text not null, "rule_type_id" text not null, "price_list_id" text not null, constraint "price_list_rule_pkey" primary key ("id"));'
)
this.addSql(

View File

@@ -44,6 +44,18 @@ export class Migration20231101232834 extends Migration {
this.addSql(
'alter table "price_list_rule" add constraint "IDX_price_list_rule_rule_type_id_price_list_id_unique" unique ("price_list_id", "rule_type_id");'
)
this.addSql(
'alter table "money_amount" add column if not exists "created_at" timestamptz not null default now(), add column if not exists "updated_at" timestamptz not null default now(), add column if not exists "deleted_at" timestamptz null;'
)
this.addSql(
'create index if not exists "IDX_money_amount_deleted_at" on "money_amount" ("deleted_at");'
)
this.addSql(
'alter table "price_set_money_amount" add constraint "price_set_money_amount_money_amount_id_unique" unique ("money_amount_id");'
)
}
async down(): Promise<void> {
@@ -82,5 +94,23 @@ export class Migration20231101232834 extends Migration {
this.addSql(
'alter table "price_list_rule" drop constraint if exists "IDX_price_list_rule_rule_type_id_price_list_id_unique";'
)
this.addSql('drop index if exists "IDX_money_amount_deleted_at";')
this.addSql(
'alter table "money_amount" drop column if exists "created_at";'
)
this.addSql(
'alter table "money_amount" drop column if exists "updated_at";'
)
this.addSql(
'alter table "money_amount" drop column if exists "deleted_at";'
)
this.addSql(
'alter table "price_set_money_amount" drop constraint if exists "price_set_money_amount_money_amount_id_unique";'
)
}
}