Skip to content

Commit 9333eed

Browse files
author
Olexandr Lysenko
committed
Merge branch 'MAGETWO-33221' into bugfixes
2 parents af86ad6 + 6042641 commit 9333eed

File tree

3 files changed

+43
-14
lines changed

3 files changed

+43
-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: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<?php
2+
/**
3+
* Copyright © 2015 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
use Magento\Framework\DB\Ddl\Table;
8+
9+
/**
10+
* update columns created_at and updated_at in sales entities tables
11+
*/
12+
13+
$tables = [
14+
'sales_creditmemo',
15+
'sales_creditmemo_comment',
16+
'sales_invoice',
17+
'sales_invoice_comment',
18+
'sales_order',
19+
'sales_order_item',
20+
'sales_order_status_history',
21+
'sales_payment_transaction',
22+
'sales_shipment',
23+
'sales_shipment_comment',
24+
'sales_shipment_track'
25+
];
26+
/** @var \Magento\Framework\DB\Adapter\AdapterInterface $connection */
27+
$connection = $this->getConnection();
28+
foreach ($tables as $table) {
29+
$columns = $connection->describeTable($table);
30+
if (isset($columns['created_at'])) {
31+
$createdAt = $columns['created_at'];
32+
$createdAt['DEFAULT'] = Table::TIMESTAMP_INIT;
33+
$createdAt['TYPE'] = Table::TYPE_TIMESTAMP;
34+
$connection->modifyColumn($table, 'created_at', $createdAt);
35+
}
36+
if (isset($columns['updated_at'])) {
37+
$updatedAt = $columns['updated_at'];
38+
$updatedAt['DEFAULT'] = Table::TIMESTAMP_UPDATE;
39+
$updatedAt['TYPE'] = Table::TYPE_TIMESTAMP;
40+
$connection->modifyColumn($table, 'updated_at', $updatedAt);
41+
}
42+
}

0 commit comments

Comments
 (0)