Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls

Changing Versions for Custom Modules

 
Reply
   X-Cart forums > X-Cart 5 > Dev Questions (X-Cart 5)
 
Thread Tools Search this Thread
  #11  
Old 04-01-2015, 03:47 AM
  zychen's Avatar 
zychen zychen is offline
 

Advanced Member
  
Join Date: Jul 2007
Posts: 48
 

Default Re: Changing Versions for Custom Modules

Quote:
Originally Posted by qualiteam
There should be no error. Did you guess there, or have you tried this and faced the error?

I always get an error on the Update Schema step in the redeployment.
It would say that it is unable to execute the MySQL query because it would truncate data from the additional fields. Even a minor edit like increasing the SKU to varchar(40) instead of varchar(32) in the custom module causes the same error.
__________________
X-Cart 5.1.10
X-Cart Next 5.2.1 Beta
Reply With Quote
  #12  
Old 04-01-2015, 04:52 AM
  qualiteam's Avatar 
qualiteam qualiteam is offline
 

X-Guru
  
Join Date: Dec 2010
Posts: 6,373
 

Default Re: Changing Versions for Custom Modules

Quote:
Originally Posted by zychen
I always get an error on the Update Schema step in the redeployment.
It would say that it is unable to execute the MySQL query because it would truncate data from the additional fields. Even a minor edit like increasing the SKU to varchar(40) instead of varchar(32) in the custom module causes the same error.

I've sent your message to the XC5 dev team so that they could check why it is so.
__________________
Alex Solovev,
Qualiteam

---

User manual Video tutorials X-Cart FAQ

You are welcome to press "Thanks" button
if you find this post useful

Click here to learn how to apply patches

X-Cart Extensions
Reply With Quote

The following user thanks qualiteam for this useful post:
zychen (04-01-2015)
  #13  
Old 04-01-2015, 08:44 AM
  tony_sologubov's Avatar 
tony_sologubov tony_sologubov is offline
 

X-Cart team
  
Join Date: Jan 2009
Posts: 2,431
 

Default Re: Changing Versions for Custom Modules

Quote:
Originally Posted by zychen
I always get an error on the Update Schema step in the redeployment.
It would say that it is unable to execute the MySQL query because it would truncate data from the additional fields. Even a minor edit like increasing the SKU to varchar(40) instead of varchar(32) in the custom module causes the same error.

Could you please let me know what exactly MySQL error message did you get?

Thank you.
__________________
Found a bug in X-Cart? Post it to our bug tracker!
Know how to make X-Cart better? Suggest an idea!
Reply With Quote
  #14  
Old 04-01-2015, 10:39 AM
  zychen's Avatar 
zychen zychen is offline
 

Advanced Member
  
Join Date: Jul 2007
Posts: 48
 

Default Re: Changing Versions for Custom Modules

Hey Tony,

Quote:
Originally Posted by tony_sologubov
Could you please let me know what exactly MySQL error message did you get?

Here's the error log when I disable my custom module.

Quote:
<?php die(1); ?>
[01-Apr-2015 19:36:29] Error (code: 0): An exception occurred while executing 'ALTER TABLE xc_products DROP packSize, DROP POQty, DROP available, DROP techData, CHANGE sku sku VARCHAR(32) DEFAULT NULL':

SQLSTATE[01000]: Warning: 1265 Data truncated for column 'sku' at row 9410
Server API: apache2handler;
Request method: GET;
URI: /admin.php?target=addons_list_installed&__cache_key __=e7aa43343234933acc6b95e4c7a0daff&cpid=966aa2f8a 1e4b00166397a28bec422ad;
Backtrace:
#0 G:\Xcart\Apache24\htdocs\lib\Doctrine\DBAL\DBALExc eption.php(116): Doctrine\DBAL\Driver\AbstractMySQLDriver->convertException('An exception oc...', Object(Doctrine\DBAL\Driver\PDOException))
#1 G:\Xcart\Apache24\htdocs\lib\Doctrine\DBAL\Connect ion.php(833): Doctrine\DBAL\DBALException::driverExceptionDuring Query(Object(XLite\Core\PDOMySqlDriver), Object(Doctrine\DBAL\Driver\PDOException), 'ALTER TABLE xc_...', Array)
#2 G:\Xcart\Apache24\htdocs\var\run.e7aa43343234933ac c6b95e4c7a0daff\classes\XLite\Core\Connection.php( 72): Doctrine\DBAL\Connection->executeQuery('ALTER TABLE xc_...', Array, Array, NULL)
#3 G:\Xcart\Apache24\htdocs\var\run.e7aa43343234933ac c6b95e4c7a0daff\classes\XLite\Core\DatabaseAbstrac t.php(631): XLite\Core\Connection->executeQuery('ALTER TABLE xc_...')
#4 G:\Xcart\Apache24\htdocs\Includes\Decorator\Plugin \Doctrine\Plugin\UpdateSchema\Main.php(80): XLite\Core\DatabaseAbstract->executeQueries(Array)
#5 G:\Xcart\Apache24\htdocs\Includes\Decorator\Utils\ PluginManager.php(83): Includes\Decorator\Plugin\Doctrine\Plugin\UpdateSc hema\Main->executeHookHandler()
#6 G:\Xcart\Apache24\htdocs\Includes\Decorator\Utils\ CacheManager.php(955): Includes\Decorator\Utils\PluginManager::invokeHook ('step_fifth')
#7 [internal function]: Includes\Decorator\Utils\CacheManager::executeStep Handler5()
#8 G:\Xcart\Apache24\htdocs\Includes\Utils\Operator.p hp(234): call_user_func_array(Array, Array)
#9 G:\Xcart\Apache24\htdocs\Includes\Decorator\Utils\ CacheManager.php(808): Includes\Utils\Operator::executeWithCustomMaxExecT ime('600', Array)
#10 G:\Xcart\Apache24\htdocs\Includes\Decorator\Utils\ CacheManager.php(826): Includes\Decorator\Utils\CacheManager::runStep(5)
#11 G:\Xcart\Apache24\htdocs\Includes\Decorator\Utils\ CacheManager.php(1150): Includes\Decorator\Utils\CacheManager::runStepCond itionally(5)
#12 G:\Xcart\Apache24\htdocs\top.inc.PHP53.php(108): Includes\Decorator\Utils\CacheManager::rebuildCach e()
#13 G:\Xcart\Apache24\htdocs\top.inc.php(45): require_once('G:\\Xcart\\Apache...')
#14 G:\Xcart\Apache24\htdocs\admin.php(37): require_once('G:\\Xcart\\Apache...')
#15 {main}

[01-Apr-2015 19:36:29] Error (code: 2): Cannot modify header information - headers already sent by (output started at G:\Xcart\Apache24\htdocs\Includes\Utils\Operator.p hp:185) in file G:\Xcart\Apache24\htdocs\error_handler.php : 47
Server API: apache2handler;
Request method: GET;
URI: /admin.php?target=addons_list_installed&__cache_key __=e7aa43343234933acc6b95e4c7a0daff&cpid=966aa2f8a 1e4b00166397a28bec422ad;
Backtrace:
#0 Includes\ErrorHandler::logInfo() called at [G:\Xcart\Apache24\htdocs\Includes\ErrorHandler.php :353]
#1 Includes\ErrorHandler::handleCommonError()
#2 header() called at [G:\Xcart\Apache24\htdocs\error_handler.php:47]
#3 showErrorPage() called at [G:\Xcart\Apache24\htdocs\Includes\ErrorHandler.php :285]
#4 Includes\ErrorHandler::showErrorPage() called at [G:\Xcart\Apache24\htdocs\Includes\ErrorHandler.php :366]
#5 Includes\ErrorHandler::handleException() called at [G:\Xcart\Apache24\htdocs\admin.php:42]


The error happens at:
Quote:
Deploying store [step 5 of 12], please wait...
Run the "Doctrine_Plugin_UpdateSchema" plugin...

-Niboon
__________________
X-Cart 5.1.10
X-Cart Next 5.2.1 Beta
Reply With Quote
  #15  
Old 04-03-2015, 03:47 AM
  tony_sologubov's Avatar 
tony_sologubov tony_sologubov is offline
 

X-Cart team
  
Join Date: Jan 2009
Posts: 2,431
 

Default Re: Changing Versions for Custom Modules

Do I understand correctly that your module changes length of SKU field?
Just need to make sure before I suggest some solution.
__________________
Found a bug in X-Cart? Post it to our bug tracker!
Know how to make X-Cart better? Suggest an idea!
Reply With Quote
  #16  
Old 04-06-2015, 06:35 AM
  zychen's Avatar 
zychen zychen is offline
 

Advanced Member
  
Join Date: Jul 2007
Posts: 48
 

Default Re: Changing Versions for Custom Modules

That's correct Tony,

It changes the length of SKU field, and also adds the fields packSize, POQty, available and techData.
All of which have data in the tables already.

-Niboon
__________________
X-Cart 5.1.10
X-Cart Next 5.2.1 Beta
Reply With Quote
  #17  
Old 04-08-2015, 11:27 AM
  tony_sologubov's Avatar 
tony_sologubov tony_sologubov is offline
 

X-Cart team
  
Join Date: Jan 2009
Posts: 2,431
 

Default Re: Changing Versions for Custom Modules

Hi Niboon,

Thank you for clarifications.
I will talk to our developers and will get back to you with the results within a day or two.

Tony
__________________
Found a bug in X-Cart? Post it to our bug tracker!
Know how to make X-Cart better? Suggest an idea!
Reply With Quote
  #18  
Old 04-09-2015, 01:58 AM
  tony_sologubov's Avatar 
tony_sologubov tony_sologubov is offline
 

X-Cart team
  
Join Date: Jan 2009
Posts: 2,431
 

Default Re: Changing Versions for Custom Modules

Hello Niboon,

I just talked to developers and unfortunately there is no automatic way to transfer your custom module through upgrade. You need to manually save data that is used by your custom module. Then upgrade the store, then upgrade the module and finally upload the data back.

I agree, this is a bad approach and it must be improved in the future. We have already planned changes to major upgrade procedure, so you would not have to repeat the same in the future.

Tony
__________________
Found a bug in X-Cart? Post it to our bug tracker!
Know how to make X-Cart better? Suggest an idea!
Reply With Quote
  #19  
Old 04-09-2015, 04:10 AM
  cflsystems's Avatar 
cflsystems cflsystems is offline
 

Veteran
  
Join Date: Apr 2007
Posts: 14,190
 

Default Re: Changing Versions for Custom Modules

Tony is it to understand if a module is on the market place the changes and data added to database will remain with the upgrade? And if the module is not on the market place these changes and data will be lost with the upgrade?

Or they will be lost either way?

This really puts XC5 upgrades on a lower level below upgrades of XC4.... It is a major overlook.

What if modules use pre- and post- upgrade hooks to export data first and then import it back once upgrade is done? But this assumes module in question doe snot have to be disabled in the first place right?
__________________
Steve Stoyanov
CFLSystems.com
Web Development
Reply With Quote
  #20  
Old 04-09-2015, 05:45 AM
  tony_sologubov's Avatar 
tony_sologubov tony_sologubov is offline
 

X-Cart team
  
Join Date: Jan 2009
Posts: 2,431
 

Default Re: Changing Versions for Custom Modules

Yes, if a module is in the marketplace, then data and changes will remain during upgrade.
If a module is not in the marketplace, you have to disable module during upgrade and this forces you to lose the data.

All above is true only in case of major upgrade (e.g. 5.1.11 > 5.2.3). In case of minor upgrade (e.g. 5.1.10 > 5.1.11), modules always keep the data.

I agree, this is an overlook and by next major upgrade we will come to the solution.
__________________
Found a bug in X-Cart? Post it to our bug tracker!
Know how to make X-Cart better? Suggest an idea!
Reply With Quote

The following 2 users thank tony_sologubov for this useful post:
cherie (04-17-2015), zychen (04-09-2015)
Reply
   X-Cart forums > X-Cart 5 > Dev Questions (X-Cart 5)


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 03:17 PM.

   

 
X-Cart forums © 2001-2020