SqlException: Invalid column name 'PriceRanges'.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
3 года назад
I have an odd error that just arose in a 4.3 installation
SqlException: Invalid column name 'PriceRanges'

Not aware of any changes having been made, but, I did connect to the database from a 4.4 installation. Might that have triggered a change in the database?
3 года назад
On querying changes to sys.objects I see the following occurred in the past half hour

StorePickupPoint  800721905  NULL  1  0  U   USER_TABLE  2021-02-24 15:26:43.800  2021-02-24 15:26:43.800  0  0  0
SpecificationAttributeGroup  832722019  NULL  1  0  U   USER_TABLE  2021-02-24 15:26:43.877  2021-02-24 15:26:43.917  0  0  0
Category  850102069  NULL  1  0  U   USER_TABLE  2020-04-05 11:34:52.153  2021-02-24 15:26:44.697  0  0  0
FacebookPixelConfiguration  880722190  NULL  1  0  U   USER_TABLE  2021-02-24 15:26:43.933  2021-02-24 15:26:43.933  0  0  0
Manufacturer  1010102639  NULL  1  0  U   USER_TABLE  2020-04-05 11:34:52.167  2021-02-24 15:26:44.700  0  0  0
webstock  1476200309  NULL  1  0  U   USER_TABLE  2020-12-18 14:28:51.903  2020-12-18 14:28:51.903  0  0  0
Vendor  1774629365  NULL  1  0  U   USER_TABLE  2020-04-05 11:34:52.400  2021-02-24 15:26:44.707  0  0  0
SpecificationAttribute  1925581898  NULL  1  0  U   USER_TABLE  2020-04-05 11:34:52.050  2021-02-24 15:26:43.913  0  0  0
ProductAttributeCombination  1957582012  NULL  1  0  U   USER_TABLE  2020-04-05 11:34:52.050  2021-02-24 15:26:44.580  0  0  0
3 года назад
looks like "PriceRanges" gets removed from the Category table in this migration to 4.40:
https://github.com/nopSolutions/nopCommerce/blob/af874cde45b808578e9f87e43dee22c52051f37c/src/Libraries/Nop.Data/Migrations/UpgradeTo440/DataMigration.cs#L143

so you're probably looking at restoring that data from a backup if you continue with 4.30 for that installation
3 года назад
Got it. The database structure must have been modified when I connected and in particular the attribute PriceRanges in Category might now named PriceRangeFiltering. Adding an attribute PriceRanges has allowed the site to run again. I'm about to go through other pages to find what else is now generating an error.
3 года назад
Part of the problem here is that I didn't realise it would make a change when all I did was modify a connection string and so the nearest backup I have is from last night and transactions have occurred today. Other pages are also returning the same error so off to learn what other attributes may have changed.
I would have though that whoever wrote this script that is clearly designed to modify a database that the first thing they would do is to create a backup. If that happened I' cannot see it!
3 года назад
Recreated PriceRanges in Category and Manufacturer and now the site is back online.
2 года назад
This is because this is how DB migration works.
Checks the structure of the database when starting the site and, if necessary, updates it.

https://docs.nopcommerce.com/en/installation-and-upgrading/upgrading-nopcommerce.html
2 года назад
It didn't though! I had to manually alter the tables.
2 года назад
in v4.4 code there is no need of  'PriceRanges' field in Category, Manufacturer and Vendor tables
but instead should be
PriceRangeFiltering
PriceFrom
PriceTo
ManuallyPriceRange

so if you are running v4.4 code but it still needs PriceRanges  - may be it is not 4.4?)
as well you can check migration history in db table MigrationVersionInfo
2 года назад
It is nopCommerce version 4.40.2. It has been running for a few months now but only after I recreated the field as stated earlier.  
NOTE this is an old thread.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.