fix(pricing, medusa): resolve minor pricing-module bugs (#5685)
* fix region price updates * pricing migration: include title/name field value migration * update migration scripts for pricing module * move file to script utils * rename file * rename file * add changeset * remove redundant maps * update migration script * nit * remove unnecessary variable * filter before map * array function naming cleanup * chore: address pr reviews --------- Co-authored-by: Philip Korsholm <philip.korsholm@hotmail.com> Co-authored-by: Philip Korsholm <88927411+pKorsholm@users.noreply.github.com>
This commit is contained in:
@@ -14,13 +14,10 @@ export class Migration20231101232834 extends Migration {
|
||||
)
|
||||
|
||||
this.addSql(
|
||||
`ALTER TABLE price_list ADD COLUMN IF NOT EXISTS number_rules integer not null default 0`
|
||||
`ALTER TABLE price_list
|
||||
ADD COLUMN IF NOT EXISTS number_rules integer not null default 0`
|
||||
)
|
||||
|
||||
this.addSql(
|
||||
'alter table "price_list" add column if not exists "title" text not null, add column if not exists "description" text not null, add column if not exists "type" text check ("type" in (\'sale\', \'override\')) not null default \'sale\';'
|
||||
)
|
||||
|
||||
|
||||
this.addSql(
|
||||
'alter table "price_set_money_amount" drop constraint "price_set_money_amount_price_list_id_foreign";'
|
||||
)
|
||||
@@ -30,9 +27,19 @@ export class Migration20231101232834 extends Migration {
|
||||
)
|
||||
|
||||
this.addSql(
|
||||
'alter table "price_list" add column if not exists "title" text not null, add column if not exists "description" text not null, add column if not exists "type" text check ("type" in (\'sale\', \'override\')) not null default \'sale\', 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;'
|
||||
'alter table "price_list" add column if not exists "title" text, add column if not exists "name" text, add column if not exists "description" text not null, add column if not exists "type" text check ("type" in (\'sale\', \'override\')) not null default \'sale\', 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(`
|
||||
UPDATE "price_list"
|
||||
SET title = name
|
||||
`)
|
||||
|
||||
this.addSql(`alter table "price_list"
|
||||
alter column "title" set not null `)
|
||||
|
||||
this.addSql('alter table "price_list" drop column if exists "name";')
|
||||
|
||||
this.addSql(
|
||||
'create index if not exists "IDX_price_list_deleted_at" on "price_list" ("deleted_at");'
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user