Magento 1.5 to 1.6 error: core/Mage/SalesRule/sql/salesrule_setup/upgrade-1.6.0.0-1.6.0.1.php" - Fehlerhafter Vorgabewert (DEFAULT) für 'period'

StackOverflow https://stackoverflow.com/questions/18229111

Question

I'll try to update my database to Magento version 1.6.2 and get stucked at this update script:

home/html/magento/magento16/magento/app/code/core/Mage/SalesRule/sql/salesrule_setup/upgrade-1.6.0.0-1.6.0.1.php" -
 SQLSTATE[42000]: Syntax error or access violation: 1067 Fehlerhafter Vorgabewert (DEFAULT) für 'period'";i:1;s:1162:"#0 
Was it helpful?

Solution

First I tried to locate all columns with the name "period" by using this mysql statement. Please note to edit your database name with my sample text:

SELECT * 
FROM information_schema.columns
WHERE table_schema =  'your_db_name'
AND column_name =  'period'
ORDER BY table_name, ordinal_position

Then I looked in the file itself (luckily it's very small). In the file there are references to two models, so the affected database table should sound similiar:

enter image description here

There is a column "period" in the table "coupon_aggregated". So I'll set the default value to "0000-00-00" and also allow "null". Maybe there are better solutions, but this helped in my case.

ALTER TABLE  `coupon_aggregated` CHANGE  `period`  `period` DATE NULL DEFAULT  '0000-00-00' COMMENT  'Period'
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top