feat(fulfillment): Migration backward compatibility (#6672)

**What**
- Update migration for backward compatibility. This does not take into account data migration and table cleanup (@olivermrbl do we have a general tasks for the modules on that subject)?
- Rename fulfillment provider id to provider id
- add integration tests to ensure the migration backward compatibility
- add new module type for the options to be used in the medusa config for example

FIXES CORE-1724
This commit is contained in:
Adrien de Peretti
2024-03-12 14:53:33 +01:00
committed by GitHub
parent e82b4788ec
commit 87e63c024e
17 changed files with 897 additions and 138 deletions

View File

@@ -50,7 +50,7 @@ const ShippingProfileIdIndex = createPsqlIndexStatementHelper({
const FulfillmentProviderIdIndex = createPsqlIndexStatementHelper({
tableName: "shipping_option",
columns: "fulfillment_provider_id",
columns: "provider_id",
where: "deleted_at IS NULL",
})
@@ -73,7 +73,7 @@ export default class ShippingOption {
@Enum({
items: () => ShippingOptionPriceType,
default: ShippingOptionPriceType.CALCULATED,
default: ShippingOptionPriceType.FLAT,
})
price_type: ShippingOptionPriceType
@@ -98,12 +98,12 @@ export default class ShippingOption {
@ManyToOne(() => FulfillmentProvider, {
type: "text",
fieldName: "fulfillment_provider_id",
fieldName: "provider_id",
mapToPk: true,
nullable: true,
})
@FulfillmentProviderIdIndex.MikroORMIndex()
fulfillment_provider_id: string
provider_id: string
@Property({ columnType: "text", persist: false })
@ShippingOptionTypeIdIndex.MikroORMIndex()
@@ -126,7 +126,7 @@ export default class ShippingOption {
@ManyToOne(() => FulfillmentProvider, {
persist: false,
})
fulfillment_provider: FulfillmentProvider | null
provider: FulfillmentProvider | null
@OneToOne(() => ShippingOptionType, (so) => so.shipping_option, {
owner: true,