Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

1.6.0 -> 1.6.1 - Error in SalesRule “Syntax error or access violation: 1067 Invalid default value for ‘period‘“
 
aaronheinrich
Jr. Member
 
Total Posts:  2
Joined:  2011-10-06
 

Upgrading a working 1.6.0 site to 1.6.1 with the Connect Manager. Download and install of modules code succeeded, but with access error on clearing cache and session. I manually cleared the cache and session data. On loading the app, when the upgrader packages attempt their DB upgrade, an exception is thrown, creating the following error log:

a:5:{i:0;s:252:\\\\\\\\\\\\\\\"Error in file: \\\\\\\\\\\\\\\".../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 Invalid default value for \\\\\\\\\\\\\\\’period\\\\\\\\\\\\\\\’\\\\\\\\\\\\\\\”;i:1;s:1298:
\\\\\\\\\\\\\\\"#0 .../app/code/core/Mage/Core/Model/Resource/Setup.php(645): Mage::exception(\\\\\\\\\\\\\\\’Mage_Core\\\\\\\\\\\\\\\’, \\\\\\\\\\\\\\\’Error in file: ...\\\\\\\\\\\\\\\’)
#1 .../app/code/core/Mage/Core/Model/Resource/Setup.php(437): Mage_Core_Model_Resource_Setup->_modifyResourceDb(\\\\\\\\\\\\\\\’upgrade\\\\\\\\\\\\\\\’, \\\\\\\\\\\\\\\’1.6.0.0\\\\\\\\\\\\\\\’, \\\\\\\\\\\\\\\’1.6.0.1\\\\\\\\\\\\\\\’)
#2 .../app/code/core/Mage/Core/Model/Resource/Setup.php(320): Mage_Core_Model_Resource_Setup->_upgradeResourceDb(\\\\\\\\\\\\\\\’1.6.0.0\\\\\\\\\\\\\\\’, \\\\\\\\\\\\\\\’1.6.0.1\\\\\\\\\\\\\\\’)
#3 .../app/code/core/Mage/Core/Model/Resource/Setup.php(235): Mage_Core_Model_Resource_Setup->applyUpdates()
#4 .../app/code/core/Mage/Core/Model/App.php(412): Mage_Core_Model_Resource_Setup::applyAllUpdates()
#5 .../app/code/core/Mage/Core/Model/App.php(338): Mage_Core_Model_App->_initModules()
#6 .../app/Mage.php(640): Mage_Core_Model_App->run(Array)
#7 .../index.php(80): Mage::run(\\\\\\\\\\\\\\\’\\\\\\\\\\\\\\\’, \\\\\\\\\\\\\\\’store\\\\\\\\\\\\\\\’)
#8 {main}\\\\\\\\\\\\\\\”;s:3:\\\\\\\\\\\\\\\"url\\\\\\\\\\\\\\\”;s:11:\\\\\\\\\\\\\\\"/shop/admin\\\\\\\\\\\\\\\”;s:11:\\\\\\\\\\\\\\\"script_name\\\\\\\\\\\\\\\”;s:15:\\\\\\\\\\\\\\\"/shop/index.php\\\\\\\\\\\\\\\”;s:4:\\\\\\\\\\\\\\\"skin\\\\\\\\\\\\\\\”;s:7:\\\\\\\\\\\\\\\"default\\\\\\\\\\\\\\\";}

The database user has been granted all privileges.

Is there a resolution for this or a way to roll back the upgrade?

Thanks.

 
Magento Community Magento Community
Magento Community
Magento Community
 
steve.mentzer
Jr. Member
 
Total Posts:  1
Joined:  2011-09-22
 

Issue this MySQL command to your Magento db:

ALTER TABLE `coupon_aggregated` CHANGE COLUMN `period` `period` DATE NOT NULL DEFAULT ‘0000-00-00’

then try the upgrade again.

 
Magento Community Magento Community
Magento Community
Magento Community
 
aaronheinrich
Jr. Member
 
Total Posts:  2
Joined:  2011-10-06
 

Bingo. That worked.

Thanks very much!

 
Magento Community Magento Community
Magento Community
Magento Community
 
bacci paintball
Jr. Member
 
Total Posts:  16
Joined:  2009-05-01
 

I was also having this error on my update from 1.6 to 1.6.1 (both magento connect and ssh) and although I couldn’t enter this sql change directly into mysql through a query (is that the right terminology?) I made the change manually in my database and it did allow me to apply the update from magento connect.
Thanks sooo much!
-Dan

 
Magento Community Magento Community
Magento Community
Magento Community
 
fabregas4
Jr. Member
 
Total Posts:  2
Joined:  2011-11-20
 

I get this same error when running a fresh 1.6.1 install (no upgrade).

Is there a change I can make to an install file somewhere which can do the equivalent of the SQL alter statement above? In a fresh install the table won’t get created, so there is nothing to alter.

 
Magento Community Magento Community
Magento Community
Magento Community
 
fabregas4
Jr. Member
 
Total Posts:  2
Joined:  2011-11-20
 

This does the trick…

In salesrule_setup/install-1.6.0.0.php…

Change:
->addColumn(’period’, Varien_Db_Ddl_Table::TYPE_DATE, null, array(
‘nullable’ => false,
), ‘Period’)

To:
->addColumn(’period’, Varien_Db_Ddl_Table::TYPE_DATE, null, array(
‘nullable’ => false,
‘default’ => ‘0000-00-00’,
), ‘Period’)

Install now works!

 
Magento Community Magento Community
Magento Community
Magento Community
 
myk
Jr. Member
 
Total Posts:  3
Joined:  2008-10-19
 

just so use guys know!  I pasted the line:

ALTER TABLE `coupon_aggregated` CHANGE COLUMN `period` `period` DATE NOT NULL DEFAULT ‘0000-00-00’

but for ‘000-00-00’ this syntax does not work in myadmin use “000-00-00”

and working for me!!!

 
Magento Community Magento Community
Magento Community
Magento Community
 
procorp
Jr. Member
 
Total Posts:  1
Joined:  2010-06-27
 

Thanks you fabregas4, it worked well for me!

The full path for the 1.6.2.0 version is : app/code/core/Mage/SalesRule/sql/salesrule_setup/install-1.6.0.0.php

I had to paste ‘default’ => ‘0000-00-00’, (as you mentioned) two times, in line 335 and 395

 
Magento Community Magento Community
Magento Community
Magento Community
 
mbatz
Jr. Member
 
Total Posts:  1
Joined:  2012-03-02
 

This error also appears with 1.7.0.0 beta

We have tried the fix discussed in this post, additionally we had to set the database encoding to utf8_unicode_ci. utf8_bin would not work for us.

See also our post here on our IdeaDay blog:

Magento Commerce installation problems solved

 
Magento Community Magento Community
Magento Community
Magento Community
 
rochi
Jr. Member
 
Total Posts:  7
Joined:  2010-01-11
 

Can someone with this error post his MySQL version number?

We have some 5.1.x MySQL servers without this error and one MySQL 5.0.32 with this error.

We think this error depends on some configuration settings.

 
Magento Community Magento Community
Magento Community
Magento Community
 
rockeyfreak
Jr. Member
 
Avatar
Total Posts:  8
Joined:  2012-02-12
 

Hello All,

i have same issue when i am installing fresh magento1.6.2 CE then it shows me an error in “app\code\core\Mage\SalesRule\sql\salesrule_setup\upgrade-1.6.0.0-1.6.0.1.php” File so this is latest upgrade by magento team and i think there is an error and that’s why we are facing this issue.

i was deleted code line of this file which is latest upgrade by magento team and delete previous tables from database and chache, reports, session in var.
After doing this all i tried and got success.

So i think there is an error in “app\code\core\Mage\SalesRule\sql\salesrule_setup\upgrade-1.6.0.0-1.6.0.1.php” file.
Try this on your own risk because you are deleting corecode of magento team may be this will cause error but it’s working fine for me.
I have post this reply for help so any thing happen i am not responsible for that.
This is just for a helping purpose.

Enjoy Magento CE.
Have a nice day to all smile

Reagrds,
[Rahul Dhamecha]

 
Magento Community Magento Community
Magento Community
Magento Community
 
kimcom
Jr. Member
 
Total Posts:  1
Joined:  2012-04-06
 

replace in the file magento\app\code\core\Mage\SalesRule\sql\salesrule_setup\install-1.6.0.0.fp
lines 333-335:

-> addColumn (’period’, Varien_Db_Ddl_Table :: TYPE_DATE, null, array (
‘nullable’ => false,
), ‘Period’)

on

-> addColumn (’period’, Varien_Db_Ddl_Table :: TYPE_DATE, null, array (
‘nullable’ => true,
), ‘Period’)

good luck.

 
Magento Community Magento Community
Magento Community
Magento Community
 
webtoadd
Jr. Member
 
Total Posts:  1
Joined:  2012-07-16
 

Somehow, i get this error when i try to install magento 1.7 :(

 
Magento Community Magento Community
Magento Community
Magento Community
 
beacon44
Jr. Member
 
Total Posts:  2
Joined:  2013-05-01
 
webtoadd - 16 July 2012 11:16 AM

Somehow, i get this error when i try to install magento 1.7 :(

According to me, change the version, Everything would be better. Same issue was with me.

airticketbooking.net/

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top