File tree Expand file tree Collapse file tree 3 files changed +10
-8
lines changed
Expand file tree Collapse file tree 3 files changed +10
-8
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " @medusajs/pricing " : patch
3+ " @medusajs/medusa " : patch
4+ ---
5+
6+ fix(medusa,pricing): fix migrations for existing databases
Original file line number Diff line number Diff line change @@ -59,9 +59,9 @@ const migratePriceLists = async (container: AwilixContainer) => {
5959
6060 for ( const corePriceList of corePriceLists ) {
6161 if ( priceListIdsToUpdateSet . has ( corePriceList . id ) ) {
62- priceListsToCreate . push ( corePriceList )
63- } else {
6462 priceListsToUpdate . push ( corePriceList )
63+ } else {
64+ priceListsToCreate . push ( corePriceList )
6565 }
6666
6767 const corePrices = corePriceList . prices || [ ]
@@ -93,7 +93,6 @@ const migratePriceLists = async (container: AwilixContainer) => {
9393 priceListsToUpdate . map ( ( priceList ) => {
9494 const updateData : PricingTypes . UpdatePriceListDTO = {
9595 id : priceList . id ,
96- title : priceList . name ,
9796 }
9897
9998 if ( priceList ?. customer_groups ?. length ) {
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ export class Migration20231101232834 extends Migration {
1717 `ALTER TABLE price_list
1818 ADD COLUMN IF NOT EXISTS number_rules integer not null default 0`
1919 )
20-
20+
2121 this . addSql (
2222 'alter table "price_set_money_amount" drop constraint "price_set_money_amount_price_list_id_foreign";'
2323 )
@@ -35,10 +35,7 @@ export class Migration20231101232834 extends Migration {
3535 SET title = name
3636 ` )
3737
38- this . addSql ( `alter table "price_list"
39- alter column "title" set not null ` )
40-
41- this . addSql ( 'alter table "price_list" drop column if exists "name";' )
38+ this . addSql ( `alter table "price_list" alter column "title" set not null ` )
4239
4340 this . addSql (
4441 'create index if not exists "IDX_price_list_deleted_at" on "price_list" ("deleted_at");'
You can’t perform that action at this time.
0 commit comments