If you run the following query against the database you can find all of the tables which have an
SELECT DISTINCT TABLE_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE COLUMN_NAME IN ('sku') AND TABLE_SCHEMA = 'your_database';
You will find the following returned:
catalog_product_entity - varchar(64)
catalog_product_flat_1 - varchar(64)
catalog_product_flat_2 - varchar(64)
catalog_product_flat_x // as many flat tables as there are stores
catalog_product_option - varchar(64)
catalog_product_option_type_value - varchar(64)
sales_flat_creditmemo_item - varchar(255)
sales_flat_invoice_item - varchar(255)
sales_flat_order_item - varchar(255)
sales_flat_quote_address_item - varchar(255)
sales_flat_quote_item - varchar(255)
sales_flat_shipment_item - varchar(255)
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:
$installer = $this;
'type' => Varien_Db_Ddl_Table::TYPE_TEXT,
'length' => '64k',
'comment' => 'SKU'
// more changeColumn() calls for each table
A few gotcha's I would look out for:
- There may be some PHP based restrictions on the length of content saved to these fields, have to test to be sure
- Watch out if you upgrade the store, some of these columns could be reset to 64/255 characters and data will irrecoverably be lost in the process if this is the case
- Be careful when adding new stores as a new flat product table will be created so you will need to check the field is of the correct length.