diff --git a/.changeset/four-lobsters-hope.md b/.changeset/four-lobsters-hope.md new file mode 100644 index 0000000000..b7cd6b3c51 --- /dev/null +++ b/.changeset/four-lobsters-hope.md @@ -0,0 +1,5 @@ +--- +"@medusajs/pricing": patch +--- + +fix(pricing): add missing migrations for pricing module diff --git a/packages/pricing/src/migrations/.snapshot-medusa-pricing.json b/packages/pricing/src/migrations/.snapshot-medusa-pricing.json index 6b7a26da5b..fe83287144 100644 --- a/packages/pricing/src/migrations/.snapshot-medusa-pricing.json +++ b/packages/pricing/src/migrations/.snapshot-medusa-pricing.json @@ -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", diff --git a/packages/pricing/src/migrations/Migration20230929122253.ts b/packages/pricing/src/migrations/Migration20230929122253.ts index 81ecf7e577..d0a29286c3 100644 --- a/packages/pricing/src/migrations/Migration20230929122253.ts +++ b/packages/pricing/src/migrations/Migration20230929122253.ts @@ -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( diff --git a/packages/pricing/src/migrations/Migration20231101232834.ts b/packages/pricing/src/migrations/Migration20231101232834.ts index aa4e269711..8056911665 100644 --- a/packages/pricing/src/migrations/Migration20231101232834.ts +++ b/packages/pricing/src/migrations/Migration20231101232834.ts @@ -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 { @@ -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";' + ) } }