I have a magento site with many custom options. When the product is created, sometimes the sku is longer than 255 characters.
The sku I'm refering to is in "sales_flat_order_item" and a few other places I believe.
Is it safe to change these fields to "text" instead of "varchar255"?
Best Answer
If you run the following query against the database you can find all of the tables which have an
sku
column:You will find the following returned:
So a fair few tables. Although making the
sku
field longer is not something I have tried, I don't see any particular reason why it won't work, but you should approach the task carefully with plenty of testing.No idea why but it seems
sku
is stored as a 64 character long field in relation to products, and a 255 character long field in relation to ordered items - so you are essentially restricted to 64 characters by default.My advice would be to write an install script to change these columns, something along the lines of the following:
A few gotcha's I would look out for: