News:

Support the VirtueMart project and become a member

Main Menu

DB tables change during upgrade.

Started by sandstorm, April 23, 2013, 17:35:50 PM

Previous topic - Next topic

sandstorm

Hi There,

I use custom fields with my products for some long text strings.
I found out a while ago that inside xxx_virtuemart_product_customfileds the table for "Custom value" was set as VARCHAR and had a max of 8000 character set to it.
This wasn't enough for what I needed, so I changed the VARCHAR within "Custom Value" to TEXT.  This allowed me to add my extra text stings against my products and all has been working OK.

I was just testing an upgrade from 2.0.18 to 2.0.20b, and noticed in the upgrade notes that this table was changed back to VARCHAR 8000. After checking my products, I found that yes they had all changed which left all my products with lots of missing text and in turn some bad styling problems.

This was a test upgrade on a test site, so my live site is OK, but how in future can I upgrade with the table/field left alone?
Is there a best practice for this?

As a work around to test some other things out I just deleted the xxx_virtuemart_product_customfileds table completely and re-imported it from my live site & this has worked as a dirty work around.

Thanks in advance,
Andy
J3.6.4 / PHP7.0.12
VM3.0.16

sandstorm

Sorry to bump this, but does anybody have any ideas/solutions on how I could possibly get around my problem?
J3.6.4 / PHP7.0.12
VM3.0.16

Milbo

Take the zip installer version, dig into it find the install.sql, change it there. Atm the only solution, sry. I will keep this in mind and maybe merge the custom_value and custom_params field, it has the same purpose, one for hte plugins the others for the normal customfields. But for vm2.1 then
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

sandstorm

#3
Just upgrading and testing a few things and notice that this still overwrites the database change.
I can fix manually, but would still be nice to have the "Custom Value" for xxx_virtuemart_product_customfileds set to text & not VARCHAR 8000

I have found this line in the instal.sql file,

  `custom_value` varchar(8000) COMMENT 'field value',

I tried changing this to `custom_value` TEXT COMMENT 'field value', & also `custom_value` text notnull default 'field value',
I also tried just changing it to `custom_value` varchar(12800) COMMENT 'field value',

But everytime I upgrade, this value is alway reverted to  varchar(8000)

So I guess it is getting this from someplace else, other than install/install.sql ?

Andy
J3.6.4 / PHP7.0.12
VM3.0.16

Milbo

In vm3 it is even
`customfield_value` varchar(2500) COMMENT 'field value',
and
`customfield_params` varchar(17000) NOT NULL DEFAULT '' COMMENT 'Param for Plugins',

I wonder that you need such a biiig custom_value.

Maybe the solution is to change your plugin. There are a lot methods to store something and there were some misunderstandings in the past. It is more clear in vm3
In general
The "custom" keeps the standard settings. It is like an empty hull, which got filled by attaching it to a product. I am still searching for a nice word for it. Prototype/Pattern, something like that.

the "product customfield" keeps the information for the product. The configuration should be always stored in the params. The interesting value for the Search! is in customfield_value. This information is product dependend.
If you want to store data, process dependend, then you need to use the internal plugin table, which is as you define it.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/