Congratulations for the release of nopCommerce 4.3!
We started testing our products with nopCommerce 4.30 and while testing the upgrades of our theme demos (more than 30 databases) we ended up with several errors that I am sure some nopCommerce users might also experience during their upgrades.
There are a couple of places in the new version of nopCommerce where we see some kind of validations or assumptions that didn't exist in the previous versions of nopCommerce.
Here are some of them:
1. If you have a language resource with the same key (there is no constraint in the database to ensure unique keys) then nopCommerce 4.30 will throw an exception because of this code assuming the resource name is unique:
var lsNamesList = _lsrRepository.Table
.Where(lsr => lsr.LanguageId == language.Id)
.ToDictionary(lsr => lsr.ResourceName, lsr => lsr);
2. We already discussed the addresses validation
and shared my concerns
but we ended up with databases that have customers (probably started the checkout but didn't completed their orders maybe) which addresses are not in their address book and for these customers the store could not be loaded at all.
I am not saying that these validation are a bad thing but since the previous versions allowed more freedom it is absolutely possible that some database will not match the new rules and many store owners will have issues after the upgrade to 4.30. So I think the upgrade script should also validate the database and fix the issues beforehand.
We will add fixes in our upgrade scripts and ensure that our clients will never experience these issues but I think it will be helpful for nopCommerce in general to ensure that the databases match the new validations during the upgrade and that is why I write to you.
For example here is a script that ensures that no user has an address that is not in their address books.
SET Customer.BillingAddress_Id = NULL, Customer.ShippingAddress_Id = NULL
WHERE (Customer.BillingAddress_Id IS NOT NULL
AND NOT EXISTS (SELECT 1
WHERE Customer.BillingAddress_Id = CustomerAddresses.Address_Id))
(Customer.ShippingAddress_Id IS NOT NULL
AND NOT EXISTS (SELECT 1
WHERE Customer.ShippingAddress_Id = CustomerAddresses.Address_Id))
You can also easily delete any duplicate language resources during the upgrade to ensure there are no duplicates and that the store will be loaded without errors.
Hope this helps and if you consider adding these the official upgrade script I am sure this will save a lot of problems to many store owners that upgrade to the new version :)