Skip to content

Commit 35d34bf

Browse files
author
Olexandr Lysenko
committed
MAGETWO-33221: Date created column is not populated in invoices and credit memo grid
1 parent bbe0268 commit 35d34bf

File tree

3 files changed

+28
-14
lines changed

3 files changed

+28
-14
lines changed

app/code/Magento/Sales/etc/module.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*/
77
-->
88
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd">
9-
<module name="Magento_Sales" schema_version="2.0.0">
9+
<module name="Magento_Sales" schema_version="2.0.1">
1010
<sequence>
1111
<module name="Magento_Rule"/>
1212
<module name="Magento_Catalog"/>

app/code/Magento/Sales/sql/sales_setup/update-2.0.1.php

Lines changed: 0 additions & 13 deletions
This file was deleted.
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
/**
3+
* Copyright © 2015 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
/**
8+
* update columns created_at and updated_at in sales tables
9+
*/
10+
11+
$tables = [
12+
'sales_creditmemo', 'sales_creditmemo_comment', 'sales_invoice', 'sales_invoice_comment', 'sales_order',
13+
'sales_order_item', 'sales_order_status_history', 'sales_payment_transaction', 'sales_shipment',
14+
'sales_shipment_comment', 'sales_shipment_track'
15+
];
16+
/** @var \Magento\Framework\DB\Adapter\AdapterInterface $connection */
17+
$connection = $this->getConnection();
18+
foreach ($tables as $table) {
19+
$columns = $connection->describeTable($table);
20+
$createdAt = $columns['created_at'];
21+
$createdAt['default'] = 'CURRENT_TIMESTAMP';
22+
$updatedAt = $columns['updated_at'];
23+
$updatedAt['default'] = 'CURRENT_TIMESTAMP';
24+
$connection->modifyColumn($table, 'created_at', $createdAt);
25+
$connection->modifyColumn($table, 'updated_at', $updatedAt);
26+
}
27+

0 commit comments

Comments
 (0)