Hi,
I am receiving this error at step number 7 Migrate Sales. Please tell me how can I fix it and migrate sales.
CDbCommand failed to execute the SQL statement: SQLSTATE[22007]: Invalid datetime format: 1292 Incorrect datetime value: ‘0000-00-00 00:00:00’ for column ‘converted_at’ at row 1
3 answers
Hi there,
CDbCommand failed to execute the SQL statement: SQLSTATE[22007]: Invalid datetime format: 1292 Incorrect datetime value: ‘0000-00-00 00:00:00’ for column ‘converted_at’ at row 1
That issue occurred because your M1 database had the bad data in the value of the `converted_at` field. It may relate to the `sales_flat_quote` table.
Please run the data migration in step #7 using this CLI command:
php -f bin/ubdatamigration run --step=7
And then provide me more details of the error message you get. I will check further and get back to you then.
Regards,
Mall.
Hi Mall,
I run the below command in CLI. The error screenshot from the CLI is attached.
php -f bin/ubdatamigration run --step=7
Hi there,
That is a bad data case in the ‘sales_flat_quote.converted_at’ table.
To resolve, you can try with these steps:
1. Open the PHP file at ub-tool/protected/controllers/Step7Controller.php
and find the code line (Please note that there are two lines with the following code in the file, you need to replace both lines of code):
if (!$quote2->save()) {
and replace it with:
if ($quote2->converted_at === '0000-00-00 00:00:00') {
$quote2->converted_at = null;
}
if (!$quote2->save()) {
2. Once done, you can continue with the data migration in step #7 using this command:
php -f bin/ubdatamigration run --step=7
Regards,
Mall.