ubertheme / module-ubdatamigration

This is a module for Magento 2. This allow migrate data from Magento 1.x to Magento 2.x
https://www.ubertheme.com/magento-extensions-2-x/magento-2-data-migration-pro?utm_source=github&utm_medium=repo&utm_campaign=magento_migration_ce
48 stars 38 forks source link

Step 6 Issue - Migrate Customers #28

Open djes240285 opened 8 years ago

djes240285 commented 8 years ago

Hello

I get the following error when trying to complete the Step 6:

CDbException CDbCommand failed to execute the SQL statement: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '3' for key 'PRIMARY'. The SQL statement executed was: INSERT INTO customer_group (tax_class_id, customer_group_id, customer_group_code) VALUES (:yp0, :yp1, :yp2)

/Applications/MAMP/htdocs/finaldraft-m2/public_html2/pub/ub-tool/yii/db/CDbCommand.php(358) 346 { 347 if($this->_connection->enableProfiling) 348 Yii::endProfile('system.db.CDbCommand.execute('.$this->getText().$par.')','system.db.CDbCommand.execute'); 349 350 $errorInfo=$e instanceof PDOException ? $e->errorInfo : null; 351 $message=$e->getMessage(); 352 Yii::log(Yii::t('yii','CDbCommand::execute() failed: {error}. The SQL statement executed was: {sql}.', 353 array('{error}'=>$message, '{sql}'=>$this->getText().$par)),CLogger::LEVEL_ERROR,'system.db.CDbCommand'); 354 355 if(YII_DEBUG) 356 $message.='. The SQL statement executed was: '.$this->getText().$par; 357 358 throw new CDbException(Yii::t('yii','CDbCommand failed to execute the SQL statement: {error}', 359 array('{error}'=>$message)),(int)$e->getCode(),$errorInfo); 360 } 361 } 362 363 /** 364 * Executes the SQL statement and returns query result. 365 * This method is for executing an SQL query that returns result set. 366 * @param array $params input parameters (name=>value) for the SQL execution. This is an alternative 367 * to {@link bindParam} and {@link bindValue}. If you have multiple input parameters, passing 368 * them in this way can improve the performance. Note that if you pass parameters in this way, 369 * you cannot bind parameters or values using {@link bindParam} or {@link bindValue}, and vice versa. 370 * Please also note that all values are treated as strings in this case, if you need them to be handled as Stack Trace

– /Applications/MAMP/htdocs/finaldraft-m2/public_html2/pub/ub-tool/yii/db/ar/CActiveRecord.php(1080): CDbCommand->execute()

1075 { 1076 Yii::trace(get_class($this).'.insert()','system.db.ar.CActiveRecord'); 1077 $builder=$this->getCommandBuilder(); 1078 $table=$this->getTableSchema(); 1079 $command=$builder->createInsertCommand($table,$this->getAttributes($attributes)); 1080 if($command->execute()) 1081 { 1082 $primaryKey=$table->primaryKey; 1083 if($table->sequenceName!==null) 1084 { 1085 if(is_string($primaryKey) && $this->$primaryKey===null)

– /Applications/MAMP/htdocs/finaldraft-m2/public_html2/pub/ub-tool/yii/db/ar/CActiveRecord.php(809): CActiveRecord->insert(null)

804 * @return boolean whether the saving succeeds 805 */ 806 public function save($runValidation=true,$attributes=null) 807 { 808 if(!$runValidation || $this->validate($attributes)) 809 return $this->getIsNewRecord() ? $this->insert($attributes) : $this->update($attributes); 810 else 811 return false; 812 } 813 814 /** – /Applications/MAMP/htdocs/finaldraft-m2/public_html2/pub/ub-tool/protected/controllers/MigrateController.php(1817): CActiveRecord->save()

`1812 $customer_group2->customer_group_code = $customer_group1->customer_group_code; 1813 } 1814 //update tax class_id if have exits 1815 $customer_group2->tax_class_id = $customer_group1->tax_class_id; 1816 1817 if ($customer_group2->save()){ 1818 $migrated_customer_group_ids[] = $customer_group2->customer_group_id; 1819 1820 //we will migrate related tax_class here 1821 $tax_class1 = Mage1TaxClass::model()->findByPk($customer_group2->tax_class_id); 1822 if ($tax_class1){

3`

-– /Applications/MAMP/htdocs/finaldraft-m2/public_html2/pub/ub-tool/yii/web/actions/CInlineAction.php(49): MigrateController->actionStep6()

44 $controller=$this->getController(); 45 $method=new ReflectionMethod($controller, $methodName); 46 if($method->getNumberOfParameters()>0) 47 return $this->runWithParamsInternal($controller, $method, $params); 48 49 $controller->$methodName(); 50 return true; 51 } 52 }

– /Applications/MAMP/htdocs/finaldraft-m2/public_html2/pub/ub-tool/yii/web/CController.php(308): CInlineAction->runWithParams(array())

303 { 304 $priorAction=$this->_action; 305 $this->_action=$action; 306 if($this->beforeAction($action)) 307 { 308 if($action->runWithParams($this->getActionParams())===false) 309 $this->invalidActionParams($action); 310 else 311 $this->afterAction($action); 312 } 313 $this->_action=$priorAction;

– /Applications/MAMP/htdocs/finaldraft-m2/public_html2/pub/ub-tool/yii/web/CController.php(286): CController->runAction(CInlineAction)

`281 * @see runAction 282 */ 283 public function runActionWithFilters($action,$filters) 284 { 285 if(empty($filters)) 286 $this->runAction($action); 287 else 288 { 289 $priorAction=$this->_action; 290 $this->_action=$action; 291 CFilterChain::create($this,$action,$filters)->run();

6`

– /Applications/MAMP/htdocs/finaldraft-m2/public_html2/pub/ub-tool/yii/web/CController.php(265): CController->runActionWithFilters(CInlineAction, array())

`260 { 261 if(($parent=$this->getModule())===null) 262 $parent=Yii::app(); 263 if($parent->beforeControllerAction($this,$action)) 264 { 265 $this->runActionWithFilters($action,$this->filters()); 266 $parent->afterControllerAction($this,$action); 267 } 268 } 269 else 270 $this->missingAction($actionID);

7 `

– /Applications/MAMP/htdocs/finaldraft-m2/public_html2/pub/ub-tool/yii/web/CWebApplication.php(282): CController->run("step6")

`277 { 278 list($controller,$actionID)=$ca; 279 $oldController=$this->_controller; 280 $this->_controller=$controller; 281 $controller->init(); 282 $controller->run($actionID); 283 $this->_controller=$oldController; 284 } 285 else 286 throw new CHttpException(404,Yii::t('yii','Unable to resolve the request "{route}".', 287 array('{route}'=>$route===''?$this->defaultController:$route)));

8`

– /Applications/MAMP/htdocs/finaldraft-m2/public_html2/pub/ub-tool/yii/web/CWebApplication.php(141): CWebApplication->runController("migrate/step6")

`136 foreach(array_splice($this->catchAllRequest,1) as $name=>$value) 137 $_GET[$name]=$value; 138 } 139 else 140 $route=$this->getUrlManager()->parseUrl($this->getRequest()); 141 $this->runController($route); 142 } 143 144 /* 145 * Registers the core application components. 146 \ This method overrides the parent implementation by registering additional core components.

9

`

– /Applications/MAMP/htdocs/finaldraft-m2/public_html2/pub/ub-tool/yii/base/CApplication.php(184): CWebApplication->processRequest() `179 public function run() 180 { 181 if($this->hasEventHandler('onBeginRequest')) 182 $this->onBeginRequest(new CEvent($this)); 183 register_shutdown_function(array($this,'end'),0,false); 184 $this->processRequest(); 185 if($this->hasEventHandler('onEndRequest')) 186 $this->onEndRequest(new CEvent($this)); 187 } 188 189 /**

10

`

– /Applications/MAMP/htdocs/finaldraft-m2/public_html2/pub/ub-tool/index.php(13): CApplication->run()

08 // change the following paths if necessary 09 $yii=dirname(__FILE__).'/yii/yii.php'; 10 $config=dirname(__FILE__).'/protected/config/main.php'; 11 12 require_once($yii); 13 Yii::createWebApplication($config)->run();

Screen:

Can you help me please to solve this issue?

Thanks.

quynhvv commented 8 years ago

Hi djes240285, Let's try open the sql file at path: /pub/ub-tool/protected/data/step6_reset.sql then find and remove some code line as bellow:

INSERT INTO #__customer_group VALUES ('0', 'NOT LOGGED IN', '3');
INSERT INTO #__customer_group VALUES ('1', 'General', '3');
INSERT INTO #__customer_group VALUES ('2', 'Wholesale', '3');
INSERT INTO #__customer_group VALUES ('3', 'Retailer', '3');

and then come back to back-end of this module in your Magento 2 and press the 'Reset' button and try restart the data migration on this step. and tell me know how it goes.

Also, please note that:

These old releases were provided on as-is basis and no longer maintained. We have decided to create a Premium version, as this way we will have more opportunity and resources to revamp the whole code base and add more features, while providing active bug fixes maintenance. To have full featured migration tool, highly recommend you consider our migration pro version: https://www.ubertheme.com/magento-extensions-2-x/magento-2-data-migration-pro/ (you will see a walk-through video included in this post as well).

djes240285 commented 8 years ago

Hi, Thanks for your response, but new trouble:

CDbException

CDbCommand failed to execute the SQL statement: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '4' for key 'PRIMARY'. The SQL statement executed was: INSERT INTO customer_group (tax_class_id, customer_group_id, customer_group_code) VALUES (:yp0, :yp1, :yp2)

Screen:

I tried to remove the other inserts. The result is the same. Firstly a very long running script in the browser due to the large number of records. May be Is it possible in the console to start this process? I'm thinking about buying the PRO version but I need to figure out what she will help me.

Evgeniy.

On 26/05/16 04:32, Quynh Vu Van wrote:

Hi djes240285, Let's try open the sql file at path: |/pub/ub-tool/protected/data/step6_reset.sql| then find and remove some code line as bellow:

|INSERT INTO #customer_group VALUES ('0', 'NOT LOGGED IN', '3'); INSERT INTO #__customer_group VALUES ('1', 'General', '3'); INSERT INTO #customer_group VALUES ('2', 'Wholesale', '3'); INSERT INTO

__customer_group VALUES ('3', 'Retailer', '3'); |

and then come back to back-end of this module in your Magento 2 and press the 'Reset' button and try restart the data migration on this step. and tell me know how it goes.

Also, please note that:

These old releases were provided on as-is basis and no longer
maintained.
We have decided to create a Premium version, as this way we will
have more opportunity and resources to revamp the whole code base
and add more features, while providing active bug fixes maintenance.
To have full featured migration tool, highly recommend you
consider our migration pro version:
https://www.ubertheme.com/magento-extensions-2-x/magento-2-data-migration-pro/
(you will see a walk-through video included in this post as well).

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/ubertheme/module-ubdatamigration/issues/28#issuecomment-221754889

djes240285 commented 8 years ago

Hi, Thanks for your response, but new trouble: CDbException

CDbCommand failed to execute the SQL statement: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '4' for key 'PRIMARY'. The SQL statement executed was: INSERT INTO customer_group (tax_class_id, customer_group_id, customer_group_code) VALUES (:yp0, :yp1, :yp2) Screen:

I tried to remove the other inserts. The result is the same. Firstly a very long running script in the browser due to the large number of records. May be Is it possible in the console to start this process? I'm thinking about buying the PRO version but I need to figure out what she will help me.

nilsgirard commented 5 years ago

just go to your old database look after "customer_group" table take a picture and go to the new database and modify as it will be the same. For my case it add group but the fisrt number (primary ) was not the good not in order then it will go trough